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 / 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 / 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
@satmandu
satmandu / build_rstudio_focal.sh
Last active August 27, 2022 15:44
COMPLETELY UNSUPPORTED way to build rstudio from the v1.3-patches branch with QT 5.15 for ubuntu/20.04 focal & R 4.0. Put both files in the same directory. Note a docker install is needed for this to work.
#!/bin/bash -ex
git_branch="v1.3-patch"
git_base="https://github.com/rstudio/rstudio"
QT_VERSION=5.15.0
now=$(date +"%m%d%Y%H%M")
#docker build --pull --no-cache -f Dockerfile.focal-amd64 -t rstudio:focal-amd64 .
# following from https://stackoverflow.com/a/246128
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
@satmandu
satmandu / make_current_arm64_rpi_kernel_debs.sh
Last active October 22, 2023 11:06
Make arm64 deb packages for the offical Raspberry Pi Foundation arm64 kernels, tested with ubuntu 23.04
#!/bin/bash -x
# make_arm64_rpi_kernel_debs.sh
# Builds arm64 debian packages from the CURRENT rpi firmware repository kernel which is installed by:
# sudo rpi-update
# This runs on an arm64 host with arm64 compilation tools...
# or with some sort of cross-compilation setup.
# Debs are put in $workdir/build
#
# This will NOT work in Raspbian unless you have an arm64 compilation
# environment setup. Appears to work on
@satmandu
satmandu / bashprompt.sh
Last active March 31, 2024 00:54
bash prompt with color, xterm title setting, and ssh host in title
# Goes in .bashrc
# Heavily cribbed from
# https://stackoverflow.com/a/16715681
# and inspired by
# https://unix.stackexchange.com/a/420090
__prompt_command() {
local EXIT="$?" # This needs to be first
PS1=""
local RCol='\[\e[0m\]'
@satmandu
satmandu / usbtrim
Last active March 31, 2024 00:54
Detect and enable trim for usb-connected sata/nvme drives in initramfs/initrd, ideally before zfs modules load.
#!/bin/bash
# This goes in /usr/share/initramfs-tools/hooks/usbtrim
case $1 in
prereqs)
echo "udev"
exit 0
;;
esac
@satmandu
satmandu / dpcd_pixel_slate.patch
Last active May 29, 2021 14:13
Patch to make backlight work for nocturne/Pixel Slate (and maybe also eve) with linux kernel 5.12
diff -Npaur a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
--- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c 2021-05-07 18:57:14.612178675 -0400
+++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c 2021-05-07 18:58:15.107279925 -0400
@@ -593,7 +593,6 @@ intel_dp_aux_supports_vesa_backlight(str
* work just fine using normal PWM controls anyway.
*/
if (intel_dp->edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP &&
- (intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) &&
(intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP)) {
drm_dbg_kms(&i915->drm, "AUX Backlight Control Supported!\n");
@satmandu
satmandu / arch2crew
Last active March 9, 2021 15:36
Script to help with creating Chromebrew package files from Arch Linux PKGBUILD files
#!/bin/bash -x
# arch2crew
# Script to help with creating Chromebrew package files from Arch Linux PKGBUILD files
# Assumes rubocop is installed via "gem install rubocop"
# Usage: arch2crew <Arch Linux package name>
# Satadru Pramanik <satadru@gmail.com>
#
archpkgname="${1}"
# Initial setup
@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 / chromeos_docker.sh
Last active March 16, 2021 20:42
Docker buildx based package builder for Chromebrew on x86_64, i686, & armv7l. (armv7l only tested on Raspberry PI) Put both files in the same folder.
#!/bin/bash
# chromeos_docker.sh
# Usage:
# chromeos_docker.sh recoveryfileurl name milestone arch
# or if image.bin already exists this works too:
# chromeos_docker.sh dummy name milestone arch
# (Default is not to delete the image after download.)
# e.g.
# Example for x86_64:
# chromeos_docker.sh https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_13505.73.0_nocturne_recovery_stable-channel_mp.bin.zip nocturne 87 x86_64