Skip to content

Instantly share code, notes, and snippets.

@jfeilbach
jfeilbach / ubuntu_22.04_motd.md
Last active April 20, 2024 12:09
Make Ubuntu 22.04 less annoying. Remove ESM Ubuntu Advantage

Ubuntu 22.04 Annoyances

Here are a few collected ways I like to customize Ubuntu 22.04 servers. I used to love Ubuntu, but I hate auto updates and snaps. They also put ads and other usless ads diguised as "news" in MOTD. ESM FUD is spread throughout the OS including simple apt functions. You do not need ESM and thus Ubuntu 22.04 has become super annoying. unattended-upgrade is an automatic installation of security (and other) upgrades without user intervention. Consider the ramifications of disabling this service.

Disable unattended upgrades

The Unattended Upgrades feature is enabled by default and it runs at system boot without the user's permission. The configuration is stored in /etc/apt/apt.conf.d/20auto-upgrades

Disable: sudo dpkg-reconfigure unattended-upgrades then a TUI will come up, select "No"

This will not permantently disable the function. After an update it will be enabled. In the file /etc/apt/apt.conf.d/20auto-upgrades change these values from 1 to 0. Even doing this it will

@jfeilbach
jfeilbach / sysctl.conf.md
Last active March 1, 2024 10:30
10/40 Gb NIC Linux Kernel Performance Tuning for samba file server

TCP tuning

The most important TCP tuning areas since kernel 4.9 are:

  • packet pacing
  • dynamic TSO sizing
  • TCP small queues
  • BBR TCP congestion algorithm

Definitions

  • Gb = gigabit
@jfeilbach
jfeilbach / grub.md
Last active February 8, 2024 10:06
Make Linux fast

In /etc/default/grub, modify:

noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off tsx=on tsx_async_abort=off mitigations=off 

Then sudo update-grub

from https:// make-linux-fast-again.com/ This domain does not seem to be maintained any longer.

@jfeilbach
jfeilbach / gist:18b08ea0ed9eaf844d643ab092905973
Last active December 8, 2023 03:47
tvOS.xml for plex (modified) for use with AppleTV 4k
<?xml version="1.0" encoding="utf-8"?>
<Client name="tvOS">
<!-- Author: Plex Inc. -->
<!-- This profile is used by A10X-based tvOS (Apple TV 4K) devices using the MPV ("experimental") video player. Currently, this requires a Plex Pass subscription. -->
<!-- Because Plex does not currently support TrueHD or DTS-MA playback in the client, this audio is transcoded to FLAC. -->
<Settings>
<Setting name="DirectPlayStreamSelection" value="true" />
<Setting name="StreamUnselectedIncompatibleAudioStreams" value="true" />
</Settings>
<TranscodeTargets>
@jfeilbach
jfeilbach / bluey.md
Last active August 23, 2023 18:06
Fixing Season 2 of Bluey

Bluey Season 2

Fixing Bluey Season 2 to conform to the TVDB order. This fixes the giant mess displayed in Plex. Otherwise titles, descriptions. and other metadata will not match to the correct file.

Reorder

Move the incorrect episode number to the correct episode number temporarily. This avoids overwriting needed files.

mv -v Bluey\ \(2018\).S02E01.Dance\ Mode.WEBDL-1080p.h264.EAC3.mkv Bluey\ \(2018\).S02E02.Hammerbarn.WEBDL-1080p.h264.EAC3.mkv-tmp
mv -v Bluey\ \(2018\).S02E02.Hammerbarn.WEBDL-1080p.h264.EAC3.mkv 'Bluey (2018).S02E03.Featherwand.WEBDL-1080p.h264.EAC3.mkv-tmp'
mv -v Bluey\ \(2018\).S02E03.Featherwand.WEBDL-1080p.h264.EAC3.mkv Bluey\ \(2018\).S02E01.Dance\ Mode.WEBDL-1080p.h264.EAC3.mkv-tmp
mv -v Bluey\ \(2018\).S02E05.Hairdressers.WEBDL-1080p.h264.EAC3.mkv Bluey\ \(2018\).S02E11.Charades.WEBDL-1080p.h264.EAC3.mkv-tmp
@jfeilbach
jfeilbach / gist:fd109c7dbc9798ce6e47358b82d0be76
Last active August 2, 2023 15:51
DNS over TLS (knot resolver) setup using 1.1.1.1 on macOS
# Configuring DNS-over-TLS on macOS
# Worked on macOS 10.13.4
brew -v update
brew -v doctor
# Next two commands are optional
sudo chown -R $(whoami) $(brew --prefix)/*
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile
# Install DNS client
brew install knot-resolver
# Should be installed to something like: /usr/local/Cellar/knot-resolver/2.3.0/sbin/kresd
@jfeilbach
jfeilbach / transmission-openvpn.sh
Last active April 15, 2023 18:24
docker pull, stop container, rm container, rotate log file, backup config, start new image as container, add dig, check public ip address
#!/bin/bash
host=<>
name=transmission-openvpn
log=transmission-openvpn.log
echo "Stopping ${name}"
/usr/bin/docker stop ${name}
echo "Removing ${name}"
/usr/bin/docker rm ${name}
@jfeilbach
jfeilbach / check_update.md
Last active April 15, 2023 18:20
check if reboot needed on RHEL or Ubuntu

RHEL

Should work on Amazon Linux as well

needs-restarting -r ; echo $?

or

needs-restarting -r || shutdown -r

or

#!/bin/bash
@jfeilbach
jfeilbach / cheat.md
Last active March 14, 2023 23:52
super fast tail to web cheat using netcat

tail log file to web via netcat

Server side

sudo yum install nc -y && (echo -e ‘HTTP/1.1 200 OK\nAccess-Control-Allow-Origin: *\nContent-type: text/event-stream\n’ && tail -f /var/log/squid/access.log | grep 10.120.13.31| sed -u -e ‘s/^/data: /;s/$/\n/’) | nc -l 8000

Client browser

new EventSource("http://${server}:8000/").onmessage = function(e) {
  console.log(e.data);
};
@jfeilbach
jfeilbach / check_tls.sh
Last active March 14, 2023 23:51
Check for TLS cert expiration
#!/bin/bash
SECONDS=0
RED='\033[0;31m'
WHITE='\033[1;37m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
list=''