Skip to content

Instantly share code, notes, and snippets.

Avatar

satmandu

  • New York, NY
View GitHub Profile
@satmandu
satmandu / chromeos_docker.sh
Last active Oct 26, 2020
Chromebrew Docker-based package builder for X86_64, i686, armv7l. (armv7l only tested on Raspberry PI)
View chromeos_docker.sh
#!/bin/bash
# chromeos_docker.sh
# Usage:
# chromeos_docker.sh recoveryfileurl name milestone
# or if image.bin already exists this works too:
# chromeos_docker.sh dummy name milestone
# (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_13310.93.0_nocturne_recovery_stable-channel_mp.bin.zip nocturne 85
@satmandu
satmandu / make_current_arm64_rpi_kernel_debs.sh
Last active Oct 24, 2020
Make arm64 deb packages for the offical Raspberry Pi Foundation arm64 kernels + NOW INSTALLS headers package too.
View make_current_arm64_rpi_kernel_debs.sh
#!/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 / arch2crew
Last active Oct 21, 2020
Script to help with creating Chromebrew package files from Arch Linux PKGBUILD files
View arch2crew
#!/bin/bash
# arch2crew
# Script to help with creating Chromebrew package files from Arch Linux PKGBUILD files
# Usage: arch2crew <Arch Linux package name>
# Satadru Pramanik <satadru@gmail.com>
#
archpkgname="${1}"
#curl -Lf https://raw.githubusercontent.com/archlinux/svntogit-packages/packages/"${archpkgname}"/trunk/PKGBUILD > /tmp/"${archpkgname}" || exit 1
curl -Lf https://github.com/archlinux/svntogit-community/raw/packages/"${archpkgname}"/trunk/PKGBUILD > /tmp/"${archpkgname}" || exit 1
CleanBuildVars () {
@satmandu
satmandu / build_arm64_rpi_userland.sh
Last active Oct 20, 2020
Generate an arm64 rpi userland for use on ubuntu/arm64.
View build_arm64_rpi_userland.sh
#!/bin/bash -x
workdir="${HOME}/workdir"
[[ ! -d "$workdir" ]] && ( mkdir -p "$workdir" || exit 1)
[[ ! -d "$workdir"/tmp ]] && ( mkdir -p "$workdir"/tmp || exit 1)
[[ ! -d "$workdir"/output ]] && ( mkdir -p "$workdir"/output || exit 1)
echo "workdir is ${workdir}"
tmpdir=$(mktemp -d deb_XXXX -p "$workdir"/tmp)
deb_temp=${tmpdir}/deb
extract_tmp=${tmpdir}/extract
@satmandu
satmandu / sommelier.rb
Last active Oct 19, 2020
WIP Platform2 Sommelier for chromebrew
View sommelier.rb
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 / dpcd_pixel_slate.patch
Last active Oct 7, 2020
Patch to make backlight work for nocturne/Pixel Slate (and maybe also eve) with linux kernel 5.9-rc5
View dpcd_pixel_slate.patch
diff -Paur linux-5.9-rc6/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c new/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
--- linux-5.9-rc6/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c 2020-09-20 19:33:55.000000000 -0400
+++ new/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c 2020-09-23 14:29:57.647511808 -0400
@@ -334,8 +334,7 @@
* the panel can support backlight control over the aux channel
*/
if (intel_dp->edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP &&
- (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP) &&
- !(intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP)) {
+ (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP)) {
@satmandu
satmandu / usbtrim
Last active Jun 27, 2020
Detect and enable trim for usb-connected sata/nvme drives in initramfs/initrd, ideally before zfs modules load.
View usbtrim
#!/bin/bash
# This goes in /usr/share/initramfs-tools/hooks/usbtrim
case $1 in
prereqs)
echo "udev"
exit 0
;;
esac
@satmandu
satmandu / bashprompt.sh
Last active Jun 12, 2020
bash prompt with color, xterm title setting, and ssh host in title
View bashprompt.sh
# 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\]'
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_rstudio_focal.sh
Last active May 12, 2020
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.
View build_rstudio_focal.sh
#!/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 )"
You can’t perform that action at this time.