Skip to content

Instantly share code, notes, and snippets.

View satmandu's full-sized avatar

Satadru Pramanik, DO, MPH, MEng satmandu

View GitHub Profile
@satmandu
satmandu / overlayon.sh
Created January 9, 2020 21:03
set overlay on so that everything mounts at boot
#!/bin/bash
for f in `sudo zfs list -H| awk '{print $1}'`; do sudo zfs set overlay=on "$f" ; done
#!/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 February 21, 2020 21:36
Sets volumes for all Google home device on the local network programmatically.
#!/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 / k5.6.3.patch
Last active February 27, 2020 17:56
Patch for zfs-dkms_0.8.3-1ubuntu5 to fix compatibility with kernel 5.6rc3 as per zfs PR #9961 & PR #1064
diff -Npaur a/config/kernel-inode-times.m4 b/config/kernel-inode-times.m4
--- a/config/kernel-inode-times.m4 2020-01-22 16:49:01.000000000 -0500
+++ b/config/kernel-inode-times.m4 2020-02-27 12:40:52.273139053 -0500
@@ -1,8 +1,22 @@
-dnl #
-dnl # 4.18 API change
-dnl # i_atime, i_mtime, and i_ctime changed from timespec to timespec64.
-dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_TIMES], [
+
@satmandu
satmandu / mavericks make iso v1
Last active March 24, 2020 18:36
Quick and Dirty make OS X Mavericks ISO on desktop. Note that you're going to have to enter your password for the sudo commands.
hdiutil attach /Applications/Install\ OS\ X\ Mavericks.app/Contents/SharedSupport/InstallESD.dmg
cd /tmp
hdiutil convert /Volumes/OS\ X\ Install\ ESD/BaseSystem.dmg -format UDRW -o /tmp/RWBase
hdiutil convert -format UDSP -o /tmp/sparseRWBase RWBase.dmg
rm /tmp/RWBase.dmg
hdiutil resize -size 6g /tmp/sparseRWBase.sparseimage
hdiutil attach -owners on /tmp/sparseRWBase.sparseimage -shadow
sudo rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
sudo ditto /Volumes/OS\ X\ Install\ ESD/Packages /Volumes/OS\ X\ Base\ System/System/Installation/Packages
hdiutil eject /Volumes/OS\ X\ Install\ ESD/
@satmandu
satmandu / 70-gapps.sh
Created April 10, 2020 15:42
not working 70-gapps.sh
#!/sbin/sh
#
# ADDOND_VERSION=2
#
# /system/addon.d/70-gapps.sh
#
. /tmp/backuptool.functions
if [ -z $backuptool_ab ]; then
SYS=$S
#!/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 / sommelier.rb
Last active October 19, 2020 03:47
WIP Platform2 Sommelier for chromebrew
require 'package'
class Sommelier < Package
description 'Sommelier works by redirecting X11 and Wayland programs to the built-in ChromeOS wayland server.'
homepage 'https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/vm_tools/sommelier/'
version '2237607'
compatibility 'all'
source_url 'https://chromium-review.googlesource.com/changes/chromiumos%2Fplatform2~2237607/revisions/10/patch?zip&path=%2FCOMMIT_MSG'
source_sha256 '0dda9635fe947383e0a4abc573a289acbd81e07115dbb1aaafcc7f3b85a35d6a'
@satmandu
satmandu / llvm.rb
Last active December 19, 2020 13:57
llvm 11.0.1-rc2 for chromebrew
require 'package'
class Llvm < Package
description 'The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. The optional packages clang, lld, lldb, polly, compiler-rt, libcxx, libcxxabi and openmp are included.'
homepage 'http://llvm.org/'
version '11.0.1-rc2'
compatibility 'all'
source_url 'https://github.com/llvm/llvm-project/archive/llvmorg-11.0.1-rc2.tar.gz'
source_sha256 'c217780b9903eabf0fdb8ed227ae50b623d3f82afb9ac36beffbc81acbc6ff6c'
@satmandu
satmandu / netflix-dns.sh
Last active January 10, 2021 13:12
PfSense script to keep HE tunnels from confusing netflix by blocking netflix IPV6 resolution.
#!/bin/sh
#make sure the directory for the python libraries is in the chroot
mkdir -p /var/unbound/usr/local/lib/python2.7
#link the actual python library directory to the chroot's directory
mount -t nullfs /usr/local/lib/python2.7 /var/unbound/usr/local/lib/python2.7
#copy the python script to the /var/unbound directory so
#unbound-checkconf can find it