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 / zfs_build
Last active April 21, 2023 17:13
Compiles zfs 2.0.1 for ubuntu & debian systems (tested on x86_64 [groovy] and arm64 [raspi_os]). Not tested with zsys. . In a new folder do this to make zfs debs: curl -OLf https://gist.github.com/satmandu/3aebcd7d26cdc588b40af29f1be6009c/raw/8bd4ce4dc67ba258b9b6f613c1b604fdade9e552/zfs_build && chmod +x zfs_build && ./zfs_build
#!/bin/bash -x
main () {
VER=10
export CC="ccache gcc-${VER}"
export CXX="ccache g++-${VER}"
export SHLIB_CXXLD="g++-${VER}"
#FC="ccache gfortran"
#F77="ccache gfortran"
zfs_work="$(pwd)/$(uname -m)"
mkdir -p "${zfs_work}"
@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 / getdeps
Last active March 25, 2021 18:11
Chromebrew get actual runtime dependencies for a package
#!/bin/env bash
# set -x
pkg="${1}"
CREW_LIB_PREFIX=$(crew const | grep CREW_LIB_PREFIX | awk -F = '{print $2}')
# Which packages have a needed library in CREW_LIB_PREFIX
# This is a subset of what crew whatprovides gives
whatprovidesfxn() {
pkgdepslcl="${1}"
filelcl=$(grep "$pkgdepslcl" /usr/local/etc/crew/meta/*.filelist | grep $CREW_LIB_PREFIX)
@satmandu
satmandu / gcc10.rb
Created April 14, 2021 12:38
gcc 10.3.0 chromebrew package WIP
require 'package'
class Gcc10 < Package
description 'The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Ada, and Go.'
homepage 'https://www.gnu.org/software/gcc/'
version '10.3.0'
@isl_ver = '0.23'
compatibility 'all'
license 'GPL-3'
source_url 'https://gcc.gnu.org/pub/gcc/releases/gcc-10.3.0/gcc-10.3.0.tar.xz'
@satmandu
satmandu / chromeos_docker.sh
Last active August 5, 2021 18:07
Updated ChromeOS docker container script
#!/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_13816.82.0_nocturne_recovery_stable-channel_mp.bin.zip nocturne 90 x86_64
@satmandu
satmandu / ubuntu-mainline-kernel.sh
Created December 18, 2021 22:19
Ubuntu Mainline Kernel update script , modified from forks of https://github.com/pimlie/ubuntu-mainline-kernel.sh
#!/usr/bin/env bash
# shellcheck disable=SC1117
# Ubuntu Kernel PPA info
ppa_host="kernel.ubuntu.com"
ppa_index="/~kernel-ppa/mainline/"
ppa_key="17C622B0"
# If quiet=1 then no log messages are printed (except errors)
@satmandu
satmandu / gist:37ce878ba5c3e002b7cb6c3a47aa598a
Last active February 23, 2022 22:11
Extract macos dmg with pkg inside from Linux (ubuntu 22.04)
# Install build prereqs:
sudo apt-get install build-essential libxml2-dev libssl-dev zlib1g-dev
# You can extract a dmg using 7z thus: 7z x File.dmg
# This installs tools like lsbom to see what is inside bom files
git clone https://github.com/hogliux/bomutils && cd bomutils && make && sudo make install
# Now install xar so you can extract the pkg file
curl -OLf https://opensource.apple.com/tarballs/xar/xar-425.2.tar.gz
tar fxv xar-425.2.tar.gz
cd xar-425.2/xar/
curl -OLf https://raw.githubusercontent.com/macports/macports-ports/master/archivers/xar/files/xar-1.8-openssl-1.1.patch
@satmandu
satmandu / google-chrome.desktop
Last active March 3, 2022 16:44
The google-chrome.desktop I use on Ubuntu 22.04 on my MBP11,3. Put in /usr/share/applications/ . Also, I use a patched mesa as per https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5139#note_1279423
[Desktop Entry]
Version=1.0
Name=Google Chrome
# Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
GenericName=Web Browser
GenericName[ar]=متصفح الشبكة
GenericName[bg]=Уеб браузър
GenericName[ca]=Navegador web
GenericName[cs]=WWW prohlížeč
@satmandu
satmandu / chromeos_docker35
Last active April 20, 2024 02:38
Docker buildx based package builder for Chromebrew on x86_64, i686, & armv7l, generating containier scripts at https://gist.github.com/satmandu/d8365cb70b899901a05290d31c04909a
#!/bin/bash
# chromeos_docker.sh
# Usage:
# REPOSITORY=YOUR_DOCKER_HUB_REPOSITORY_NAME chromeos_docker.sh recovery_file_url container_name chromeos_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_13816.82.0_nocturne_recovery_stable-channel_mp.bin.zip nocturne 90 x86_64
@satmandu
satmandu / bounce_ipv6.sh
Created January 17, 2023 23:02
Bounce IPv6 connection if router is up but IPv6 connectivity is down, and check the connection every 30 seconds.
#!/bin/bash
# Put this script into your crontab e.g.
# @reboot ~/bin/bounce_ipv6.sh
# Bounce IPv6 connection if router is up but IPv6 connectivity is down,
# and check the connection every 30 seconds.
router_address="192.168.0.1"
ipvsixaddress="2600::"
while true;
do
if ping -c1 $router_address &>/dev/null; then