Skip to content

Instantly share code, notes, and snippets.

satmandu

  • New York, NY
Block or report user

Report or block satmandu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View use_rpi_bootloader_on_ubuntu_rpi.sh
#!/bin/bash
echo "* Disabling any non-vmlinuz kernel lines"
echo " in /boot/firmware/config.txt ."
sed -i -E '/(^kernel=vmlinuz)/!s/^kernel=/#kernel=/g' /boot/firmware/config.txt
echo "* Adding line to use the rpi bootloader to load the kernel"
echo " in /boot/firmware/config.txt ."
if ! grep -qs '^kernel=vmlinuz' /boot/firmware/config.txt
then echo "kernel=vmlinuz" >> /boot/firmware/config.txt
fi
echo "* Adding line to use the rpi bootloader to load the initrd"
@satmandu
satmandu / overlayon.sh
Created Jan 9, 2020
set overlay on so that everything mounts at boot
View overlayon.sh
#!/bin/bash
for f in `sudo zfs list -H| awk '{print $1}'`; do sudo zfs set overlay=on "$f" ; done
@satmandu
satmandu / mount_zfs.sh
Last active Nov 20, 2019
Alternative non-bpool/rpool zpool mount service for ubuntu 19.10
View mount_zfs.sh
#!/bin/bash -e
#export PS4='+(${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
# Place in /usr/local/sbin/mount_zfs.sh
USAGE="Usage: $0 zpool1 zpool2 zpool3 ... zpoolN"
MOUNTATTEMPTS=50
COUNTER=1
if [ "$#" == "0" ]; then
echo "$USAGE"
exit 0
View zfsuseradd.sh
#!/bin/bash -ex
# Hack to add user USERDATA zpool to an Ubuntu 19.10 system.
# I have this at /usr/local/bin/zfsuseradd.sh
user="${1}"
[[ -n "$user" ]] || (echo "User not specified." && exit 1)
zfs_user_suffix=$(mount | grep rpool/USERDATA/root_ | awk '{print $1}' | sed 's/rpool\/USERDATA\/root_//')
[[ -n "$zfs_user_suffix" ]] || (echo "Can't get Ubuntu ZFS user suffix." && exit 1)
zfs_system_suffix=$(mount | grep rpool/ROOT/ubuntu_ | awk '{print $1}' | head -1 | sed 's/rpool\/ROOT\/ubuntu_//')
[[ -n "$zfs_system_suffix" ]] || (echo "Can't get Ubuntu ZFS system suffix." && exit 1)
View nvidia-wallpaper-restore-on-resume.sh
#!/bin/bash
# ***Note*** You need machinectl installed.
# This can be found in the systemd-container package on Ubuntu!
#
# Place this nvidia-wallpaper-restore-on-resume.sh script in /lib/systemd/system-sleep/
# Then run: sudo chmod +x /lib/systemd/system-sleep/nvidia-wallpaper-restore-on-resume.sh
#
# This works around the wallpaper corruption on resume from suspend with Nvidia GPUs
# reported at https://gitlab.gnome.org/GNOME/gnome-shell/issues/1084
# and due to this feature of the Nvidia driver:
@satmandu
satmandu / build-arm64-eoan-rpi4
Last active Jul 25, 2019
Building eoan image for Raspberry Pi 4B
View build-arm64-eoan-rpi4
-v /dev:/dev --privileged
wget http://cdimage.ubuntu.com/ubuntu-server/daily-preinstalled/current/eoan-preinstalled-server-arm64+raspi3.img.xz
xzcat eoan-preinstalled-server-arm64+raspi3.img.xz > eoan-preinstalled-server-arm64+raspi4.img
kpartx -av eoan-preinstalled-server-arm64+raspi4.img
mount /dev/mapper/loop0p2 /mnt
mount /dev/mapper/loop0p1 /mnt/boot/firmware
git clone --depth=1 https://github.com/Hexxeh/rpi-firmware
@satmandu
satmandu / a_enable_wireless.sh
Last active Jul 13, 2019 — forked from telenieko/a_enable_wireless.sh
Sample files to enable wireless on Debian initramfs
View a_enable_wireless.sh
#!/bin/sh
# this goes into /etc/initramfs-tools/scripts/init-premount/a_enable_wireless
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
prereqs)
@satmandu
satmandu / before-dkms-ubuntu-mainline
Last active Jul 10, 2019
Workaround for ubuntu mainline kernel cross-compile issues with module building files compiled in wrong architecture
View before-dkms-ubuntu-mainline
#!/bin/bash
# This should go in /etc/kernel/header_postinst.d
kernelver=$1
files=("scripts/recordmcount" "scripts/mod/modpost" \
"scripts/basic/fixdep")
rebuild=0
@satmandu
satmandu / gist:3fd42c5a538bc34a1636950740838d3e
Created Apr 12, 2019
Waveshare35a config info for raspberry pi
View gist:3fd42c5a538bc34a1636950740838d3e
From https://www.spotpear.com/learn/EN/raspberry-pi/Raspberry-Pi-LCD/Raspberry-Pi-_Rotate-the-screen-display.html
Raspberry Pi - Rotate the screen display
Raspberry Pi 2.4/3.2 inch LCD
Rotate display
sudo nano /boot/config.txt
View ocr
#!/bin/bash
if [ "$1" != "" ]; then
nice -20 ocrmypdf --redo-ocr --pdfa-image-compression lossless --output-type pdfa-2 "$1" "$1"
else
echo "No filename given"
fi
You can’t perform that action at this time.