chore(snippets): moved snippets which were no scripts to the place I look for them the most

This commit is contained in:
Michele Cereda
2024-02-17 14:26:58 +01:00
parent e7e466c1c3
commit 3c1566653a
13 changed files with 18 additions and 20 deletions

View File

@@ -1,16 +0,0 @@
#!/bin/sh
# sources:
# - https://wiki.archlinux.org/?title=BOINC#Laptop_overheating_and_battery_duration_reduction
if ( ! cpupower frequency-info --governors | grep --quiet ondemand )
then
echo "ERROR: no ondemand governor available. Aborting."
fi
sudo gpasswd -a boinc video
xhost si:localuser:boinc
sudo cpupower frequency-set --governor ondemand
echo 1 | sudo tee /sys/devices/system/cpu/cpufreq/ondemand/ignore_nice_load
sudo systemctl start boinc-client.service

View File

@@ -1,19 +0,0 @@
#!/bin/sh
# sources:
# - https://stevenmortimer.com/5-steps-to-change-github-default-branch-from-master-to-main/
# create main branch locally, taking the history from master
git branch --move master main
# push the new local main branch to the remote repo (GitHub)
git push --set-upstream origin main
# switch the current HEAD to the main branch
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
# change the default branch on GitHub to main
# https://docs.github.com/en/github/administering-a-repository/setting-the-default-branch
# delete the master branch on the remote
git push origin --delete master

View File

@@ -1,7 +1,5 @@
#!/usr/bin/env fish
gpg-connect-agent updatestartuptty /bye
set SSH_AUTH_SOCK (gpgconf --list-dirs agent-ssh-socket)
export SSH_AUTH_SOCK
set GPG_TTY (tty)
export GPG_TTY
gpg-connect-agent updatestartuptty '/bye'
set -x 'SSH_AUTH_SOCK' (gpgconf --list-dirs 'agent-ssh-socket')
set -x 'GPG_TTY' (tty)

View File

@@ -1,17 +0,0 @@
#!/usr/bin/env bash
# https://k3s.io/
set -e
curl "https://github.com/k3s-io/k3s/releases/download/v1.19.7%2Bk3s1/k3s" \
--location \
--remote-name
sudo k3s server &
# Kubeconfig is written to /etc/rancher/k3s/k3s.yaml
sudo k3s kubectl get node
# On a different node run the below.
# NODE_TOKEN comes from /var/lib/rancher/k3s/server/node-token on your server
sudo k3s agent --server https://myserver:6443 --token ${NODE_TOKEN}

View File

@@ -1,26 +0,0 @@
#!/usr/bin/env bash
set -e
sudo apt update
sudo apt install --assume-yes boinc-client boinctui
BAM="http://bam.boincstats.com/"
ACCT_MGR_URL="${ACCT_MGR_URL:-$BAM}"
ACCT_MGR_USERNAME="${ACCT_MGR_USERNAME}"
ACCT_MGR_PASSWORD="${ACCT_MGR_PASSWORD}"
boinccmd --acct_mgr attach "${ACCT_MGR_URL}" "${ACCT_MGR_USERNAME}" "${ACCT_MGR_PASSWORD}"
## /var/lib/boinc/cc_config.xml
# …
# <allow_remote_gui_rpc>1</allow_remote_gui_rpc> # <-- add this
# </log_flags>
# </cc_config>
##
## /var/lib/boinc/remote_hosts.cfg
## network addresses do not work, only single hosts
# 192.168.0.190 # my-laptop
##

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bash
set -e
sudo curl -fsSL https://get.docker.com | sh -
sudo usermod -aG docker $USER
# logout && login to apply the new status
docker run --rm --name test hello-world && docker rmi hello-world

View File

@@ -1,25 +0,0 @@
#!/bin/sh
for release in stable testing
do
envsubst <<-EOF | sudo tee /etc/apt/sources.list.d/raspi.${release}.list
deb http://raspbian.raspberrypi.org/raspbian/ ${release} main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ ${release} main contrib non-free rpi
EOF
done
cat <<-EOF > /etc/apt/preferences.d/90pin-to-release
Package: *
Pin: release n=stable
Pin-Priority: 500
Package: *
Pin: release n=testing
Pin-Priority: 450
Package: *
Pin: release n=buster
Pin-Priority: 400
EOF

View File

@@ -1,15 +0,0 @@
#!/bin/sh
# https://linuxize.com/post/how-to-install-git-on-raspberry-pi/
sudo apt update
sudo apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext
cd /usr/src/
sudo wget https://github.com/git/git/archive/refs/tags/v2.33.0.tar.gz -O git.tar.gz
sudo tar -xf git.tar.gz
cd git-*
sudo make prefix=/usr/local all
sudo make prefix=/usr/local install
git --version

View File

@@ -1,4 +0,0 @@
deb http://raspbian.raspberrypi.org/raspbian/ ${release} main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ ${release} main contrib non-free rpi

View File

@@ -1,11 +0,0 @@
#!/bin/sh
lxc-create -n 'alpine' -t 'download' -- -d 'Alpine' -r '3.18' -a 'armv7l'
uci add dhcp host
uci set dhcp.@host[-1].name='alpine'
uci set dhcp.@host[-1].mac="$(grep 'hwaddr' '/srv/lxc/alpine/config' | sed 's/.*= //')"
uci set dhcp.@host[-1].ip='192.168.111.2'
uci commit 'dhcp'
reload_config
luci-reload

View File

@@ -1,7 +0,0 @@
#!/bin/sh
cat <<EOF | tee -a '/etc/config/lxc-auto'
config container
option name alpine
option timeout 60
EOF

View File

@@ -1,16 +0,0 @@
#!/usr/bin/env sh
# source: https://docs.docker.com/engine/install/ubuntu/
export \
DEBIAN_FRONTEND='noninteractive' \
LC_ALL='C'
sudo apt --assume-yes purge docker docker-engine docker.io containerd runc
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
| sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update && sudo apt --assume-yes install docker-ce