Skip to content

Instantly share code, notes, and snippets.

@viliampucik
viliampucik / dnf-obsletes-test.sh
Created April 23, 2020 14:49
PoC Handling Obsoletes by dnf
# Run a clean CentOS 8 Docker container
docker run --name dnf-obsoletes-test --rm -it centos:8 bash
# Inside the container install the necessary RPM building tools
dnf install -y rpmdevtools rpm-build redhat-rpm-config createrepo glibc-langpack-en
# Setup the environment
export LANG="en_US.UTF-8"
rpmdev-setuptree
SOURCEDIR="$(rpm --eval '%{_sourcedir}')"
@viliampucik
viliampucik / raspbian-dns-caching.sh
Last active April 19, 2020 15:42
Raspbian DNS Caching
sudo apt install dnsmasq
sudo tee -a /etc/dnsmasq.conf > /dev/null <<'EOF'
listen-address=::1,127.0.0.1
cache-size=1000
no-negcache
EOF
sudo systemctl restart dnsmasq
@viliampucik
viliampucik / rpi-storage-benchmark.sh
Created April 19, 2020 15:35
Raspberry Pi Storage Benchmarking Script
wget https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh
chmod +x Storage.sh
sudo ./Storage.sh
@viliampucik
viliampucik / ubuntu-headless.sh
Last active April 19, 2020 15:52
Ubuntu Headless
# Unmount mounted microSD card partitions, just in case
sudo umount /dev/mmcblk0p1
sudo umount /dev/mmcblk0p2
# Download the latest Ubuntu Server and upload it to microSD card: https://ubuntu.com/download/raspberry-pi
wget http://cdimage.ubuntu.com/releases/19.10.1/release/ubuntu-19.10.1-preinstalled-server-arm64+raspi3.img.xz
xzcat ubuntu-19.10.1-preinstalled-server-arm64+raspi3.img.xz | sudo dd of=/dev/mmcblk0 bs=4M conv=fsync status=progress
sync
sudo partprobe /dev/mmcblk0
@viliampucik
viliampucik / raspbian-headless.sh
Last active May 5, 2020 12:05
Raspbian Headless
# Unmount mounted microSD card partitions, just in case
sudo umount /dev/mmcblk0p1
sudo umount /dev/mmcblk0p2
# Download the latest Raspbian and upload it to microSD card: https://www.raspberrypi.org/documentation/installation/installing-images/linux.md
wget https://downloads.raspberrypi.org/raspbian_lite_latest
unzip -p 2020-02-13-raspbian-buster-lite.zip | sudo dd of=/dev/mmcblk0 bs=4M conv=fsync status=progress
sync
sudo partprobe /dev/mmcblk0
@viliampucik
viliampucik / fix-tearing-and-flickering-in-zoom-screen-sharing.sh
Created April 2, 2020 11:15
Fix Tearing and Flickering in Zoom Screen Sharing
# Remove "old" Intel driver in favor of the default modesetting driver
sudo pacman -R xf86-video-intel
# Disable vsync for Zoom for more smooth screen sharing experience
sudo rm /usr/bin/zoom
cat <<"EOF" > /tmp/zoom
#!/bin/sh
vblank_mode=0 /opt/zoom/ZoomLauncher "$@"
EOF
@viliampucik
viliampucik / prefer-global-dns.sh
Last active August 22, 2020 18:18
Always prefer global DNS and use interface DNS (obtained via DHCP) just for routed domains
#!/bin/sh
INTERFACE=$1
ACTION=$2
# DNS modification makes sense for active (up and vpn-up) interfaces only
[[ "${ACTION}" =~ up$ ]] || exit 0
# Disable DNS default route for all interfaces to prefer global DNS
resolvectl default-route "${INTERFACE}" no
@viliampucik
viliampucik / mpv.conf
Last active November 1, 2020 10:45
MPV YouTube
ytdl-format=bestvideo[ext=mp4][height<=1080]+bestaudio/best[ext=mp4]/best
@viliampucik
viliampucik / dsdt.patch
Last active February 11, 2017 16:16
CFGD and \_TZ.PSL Fix
--- dsdt.dsl.org 2017-02-11 16:34:15.627459663 +0100
+++ dsdt.dsl 2017-02-11 16:34:47.727597598 +0100
@@ -18,7 +18,7 @@
* Compiler ID "INTL"
* Compiler Version 0x20110112 (537985298)
*/
-DefinitionBlock ("", "DSDT", 2, "HPQOEM", "1909 ", 0x00000001)
+DefinitionBlock ("", "DSDT", 2, "HPQOEM", "1909 ", 0x00000002)
{
/*
perl -MPOSIX -MIO::Socket -We '
my $s = IO::Socket::INET->new(
Proto => "udp",
LocalAddr => "0.0.0.0:162"
);
while ( $s->recv( $_, 65535 ) ) {
print strftime( "%F %T", localtime ), " ", $s->peerhost(), " $_\n";
}'