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
@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
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 / 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 / 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
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)
@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
@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
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 / nighttime.py
Last active Feb 21, 2020
Sets volumes for all Google home device on the local network programmatically.
View nighttime.py
#!/usr/bin/python3
# Sets volumes for all Google home device on the local network programmatically.
# Adapted from script at https://pastebin.com/ke3Z65pm
# from this discussion by reddit user Mjjjjjjjjjjjjjjjj
# https://www.reddit.com/r/googlehome/comments/8b0b4o/python_script_to_manage_the_volume_of_multiple/
#
from __future__ import print_function
import time
import sys
@satmandu
satmandu / build_arm64_rpi_userland.sh
Last active Feb 21, 2020
Generate an arm64 rpi userland for use on ubuntu/arm64.
View build_arm64_rpi_userland.sh
#!/bin/bash
workdir=$(pwd)
rm -rf "${workdir}"/rpiuserland.compile.log
sudo apt install -y git patchelf checkinstall
is_git_repo="$(
cd "${workdir}"""/rpi-userland || exit
git rev-parse --is-inside-work-tree 2>/dev/null
)"
if [ "$is_git_repo" ]; then
(cd rpi-userland && git clean -d -x -f)
You can’t perform that action at this time.