reduce swap usage

# get swappiness
cat /proc/sys/vm/swappiness
# set swappiness
echo "vm.swappiness = 1" > /etc/sysctl.d/90-swap.conf
# disable IPv6
echo "net.ipv6.conf.all.disable_ipv6 = 1" > /etc/sysctl.d/01-disable-ipv6.conf
# load kernel settings from all system configuration files
sysctl --system
# load settings from default configuration /etc/sysctl.conf
sysctl -p
# load settings from specified file
sysctl -p /etc/sysctl.d/filename.conf
# sysctl

YouTube download and convert to mp3

wget -q -O /tmp/youtube-dl
sudo cp /tmp/youtube-dl /usr/local/sbin/
sudo chmod a+x /usr/local/sbin/youtube-dl
# download audio (mp3) only
youtube-dl --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s"
# download whole channel starting from 3 months
youtube-dl --extract-audio --audio-format mp3 -o "%(upload_date)s_%(title)s.%(ext)s" --dateafter now-3months -v
# update
sudo youtube-dl -U

# output template

Install tftp server

Install tftp server package
sudo apt-get install -y xinetd tftpd tftp

Create xinetd tftp configuration

cat <<EOF> /etc/xinetd.d/tftp
service tftp
protocol        = udp
port            = 69
socket_type     = dgram
wait            = yes
user            = nobody
server          = /usr/sbin/in.tftpd
server_args     = /tftpboot
disable         = no

Create /tftpboot folder

sudo mkdir /tftpboot
sudo chmod -R 777 /tftpboot
sudo chown -R nobody /tftpboot

Restart the xinetd service

sudo service xinetd restart

Testing our tftp server

ip a add dev eth0:1
echo foo > /tftpboot/testfile
get testfile


OpenStack: rescue / recovery system

Download rescure iso

Create rescure system

openstack image create systemrescuecd \
  --file grml64-small_2018.12.iso \
  --disk-format iso \
  --container-format bare \
  --min-ram 512 \
  --property hw_cdrom_bus=scsi
# show image
openstack image list --name systemrescuecd

Attach rescure system

openstack server rescue --image systemrescuecd ${SERVER_ID}

# Login to VM console and fix issues
Detach rescure system

openstack server unrescue ${SERVER_ID}


Visual Studio Code

# deb download
curl | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] stable main" > /etc/apt/sources.list.d/vscode.list'

sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install code # or code-insiders

# manual download
wget -q -O /tmp/code.deb