linux

Install: tinyproxy

sudo apt-get install -y tinyproxy
 
sed -i 's|#Allow 192.168.0.0/16|Allow 192.168.0.0/16|g' /etc/tinyproxy.conf
sed -i 's|Port 8888|Port 8080|g' /etc/tinyproxy.conf
 
Port 80
Allow 10.0.0.0/8
 
FilterExtended On
FilterURLs On
FilterDefaultDeny Yes
Filter "/etc/tinyproxy/whitelist"
#Filter "/etc/tinyproxy/filter"
 
 
service tinyproxy restart

YouTube download and convert to mp3

https://yt-dl.org/update
https://github.com/ytdl-org/youtube-dl/releases

Installation
https://github.com/ytdl-org/youtube-dl#installation

wget -q https://yt-dl.org/downloads/latest/youtube-dl -O ~/.local/bin/youtube-dl
sudo chmod a+x ~/.local/bin/youtube-dl
# download audio (mp3) only
youtube-dl --extract-audio --audio-format mp3 -o "%(uploader)s/%(title)s.%(ext)s" https://www.youtube.com/watch?v=XXX
 
# download whole channel starting from 3 months
youtube-dl --extract-audio --audio-format mp3 -o "%(uploader)s/%(upload_date)s_%(title)s.%(ext)s" --dateafter now-3months -v https://www.youtube.com/user/OpenStackFoundation/videos
 
# update
sudo youtube-dl -U

# output template
https://github.com/ytdl-org/youtube-dl/blob/master/README.md#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
}
EOF

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 192.168.1.1/24 dev eth0:1
echo foo > /tftpboot/testfile
tftp 192.168.1.1
get testfile
quit

Links
https://askubuntu.com/questions/201505/how-do-i-install-and-run-a-tftp-server

OpenStack: rescue / recovery system

Download rescure iso
wget https://download.grml.org/grml64-small_2022.11.iso

Create rescure system

openstack image create systemrescuecd \
  --file grml64-small_2022.11.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}

Links
https://help.switch.ch/engines/documentation/rescue-vm/
https://grml.org/

Visual Studio Code

# deb download
# https://code.visualstudio.com/docs/setup/linux
curl https://packages.microsoft.com/keys/microsoft.asc | 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] https://packages.microsoft.com/repos/vscode 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 https://update.code.visualstudio.com/latest/linux-deb-x64/stable -O /tmp/code.deb

unbound

/etc/unbound/unbound.conf.d/forward.conf
# unbound forward-zone output
for IP in $(consul catalog nodes | grep ctl | cut -d " " -f6); do
echo " forward-addr: ${IP}@53"
done
systemctl restart unbound

Enable UEFI / PXE boot on Mellanox ConnectX NIC

Boot GRML iso
https://grml.org/download/

Enable SSH daemon
service ssh start
passwd
ip a

# ssh root@GRML_IP

Install Mellanox CLI tools (MFT)
http://www.mellanox.com/page/management_tools
apt update
apt install -y gcc make dkms linux-headers-$(uname -r)

URL=http://www.mellanox.com/downloads/MFT/mft-4.12.0-105-x86_64-deb.tgz
wget -O- ${URL} | tar xvz -C /tmp
/tmp/mft-*-deb/install.sh
mst start

Show device state
mst status
flint -d /dev/mst/mt4119_pciconf0 q