Skip to content

Instantly share code, notes, and snippets.

View ppenguin's full-sized avatar

ppenguin ppenguin

View GitHub Profile
@ppenguin
ppenguin / nixos-remote
Created February 1, 2023 22:05
quick&dirty adaptation of nixos-remote install script with kexec removed (for RAM constrained remote systems)
#!/usr/bin/env bash
set -eufo pipefail
# set -x
SSHPORT=${SSHPORT:-22}
showUsage() {
cat <<USAGE
Usage: $0 [options] ssh-host
@ppenguin
ppenguin / 90-plugdisplay.rules
Last active December 12, 2020 11:50
quick&dirty but generic solution to scale external monitors connected to a (4k) laptop
# /etc/udev/rules.d/90-plugdisplay.rules
# may have to be modified if you e.g. have more than 1 graphics card
KERNEL=="card0", SUBSYSTEM=="drm", ACTION=="change", RUN+="/usr/local/bin/plugdisplay.sh"
@ppenguin
ppenguin / gist:e170c64269e42dc62895ab2002021bab
Last active October 6, 2020 14:57
bash (portable) quote a single quote in double quotes for substitution in a single quoted field (for use in e.g. borg --exclude pattern)
# or, in other words: close single quote ' | dquote squote "'" | start single quote ', but this all quoted within single quotes for the sed command
# so this sed MUST ONLY be used for text which is substituted in a field which is itself quoted in single quotes (as in our --exclude='<pattern>')
<crazy output with string including single quote(s)> | sed -e 's/'"'"'/'"'"'"'"'"'"'"'"'/g' | awk ... -v q="'" '{ printf "--exclude="q"*/%s"q" ", $1 }'
@ppenguin
ppenguin / gist:e665d4804e096e00eb10e44b0e1e1017
Created August 21, 2020 21:49
Build squid with time_quota external acl helper on FreeBSD for use with pfSense
# The squid package for pfSense is compiled without the time_quota external acl helper.
# To get this helper, the only solution appears to be to build squid from source in FreeBSD.
# It is apparently necessary to explicitly install the package db6 and refer to it in the corresponding CFLAGS and LDFLAGS.
# This configure command did the trick:
./configure --with-default-user=squid --bindir=/usr/local/sbin --sbindir=/usr/local/sbin --datadir=/usr/local/etc/squid --libexecdir=/usr/local/libexec/squid --localstatedir=/var --sysconfdir=/usr/local/etc/squid --with-logdir=/var/log/squid --with-pidfile=/var/run/squid/squid.pid --with-swapdir=/var/squid/cache --without-gnutls --with-included-ltdl --enable-auth --enable-zph-qos --enable-build-info --enable-loadable-modules --enable-removal-policies=lru heap --disable-epoll --disable-linux-netfilter --disable-linux-tproxy --disable-translation --disable-arch-native --disable-strict-error-checking --enable-eui --enable-cache-digests --enable-delay-pools --disable-ecap
@ppenguin
ppenguin / keybase.md
Created January 13, 2020 23:05
Keybase proof

Keybase proof

I hereby claim:

  • I am ppenguin on github.
  • I am ppenguin (https://keybase.io/ppenguin) on keybase.
  • I have a public key ASDc1SEBATF_4YiTpjMKoRFzBiKXuvon9Ebchks_FghHawo

To claim this, I am signing this object: