Skip to content

Instantly share code, notes, and snippets.

View Apsu's full-sized avatar

Eve Apsu

  • Lambda Labs
  • Pittsburgh, PA
View GitHub Profile
@Apsu
Apsu / preset.sh
Last active March 13, 2024 01:24
GPG passphrase preset to be called from pam_exec
#!/bin/bash
# grab PAM-provided auth token
read token
# gpg-preset-passphrase is often in /usr/libexec or /usr/lib/gnupg
preset=/usr/lib/gnupg/gpg-preset-passphrase
# grab our user, USER isn't always set
USER=$(id -un)
@Apsu
Apsu / failover.sh
Last active February 12, 2024 07:08
An example failover script for dual WAN, using a ping healthcheck and managing default routes appropriately
#!/bin/bash
# Set defaults if not provided by environment
CHECK_DELAY=${CHECK_DELAY:-5}
CHECK_IP=${CHECK_IP:-8.8.8.8}
PRIMARY_IF=${PRIMARY_IF:-eth0}
PRIMARY_GW=${PRIMARY_GW:-1.2.3.4}
BACKUP_IF=${BACKUP_IF:-eth1}
BACKUP_GW=${BACKUP_GW:-2.3.4.5}
@Apsu
Apsu / ip a
Created June 2, 2014 19:41
ML2 + LinuxBridge + VXLAN
stack@apsu-ih-dev1:~/devstack$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet 169.254.169.254/32 scope link lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
@Apsu
Apsu / mapping.txt
Last active November 21, 2023 07:15
Asetnioptimized
n s t h a e i o
Spc Shift
● j x w - = [ ]
j ● m c v k ` ;
x m ● d b g z /
w c d ● f p q '
- v b f ● r l y
= k g p r ● u ,
@Apsu
Apsu / kanata.kbd
Last active June 3, 2023 04:38
Kanata keyboard def
(defcfg
process-unmapped-keys yes
windows-altgr cancel-lctl-press
)
(defsrc
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
caps a s d f g h j k l ; ' ret
lsft z x c v b n m , . / rsft
@Apsu
Apsu / input.txt
Last active April 10, 2023 01:48
/etc/network/interfaces parser
# Comment lo
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 162.242.220.169
gateway 162.242.220.1
netmask 255.255.255.0
@Apsu
Apsu / gpg-pam-exec
Last active August 22, 2022 14:55
PAM-integrated GPG-agent with passphrase presetting
#!/usr/bin/env bash
# grab PAM-provided auth token
read token
# grab our user, $USER isn't always set
USER="$(id -un)"
# switch to PAM_USER if passed, buffer return value
$([[ "$PAM_USER" != "$USER" ]] && echo su - "$PAM_USER" -s) /usr/local/bin/gpg-preset-passphrase <<< "$token"
@Apsu
Apsu / vimrc
Created April 25, 2021 15:40
Colemak DHm vim remap
noremap f e
noremap p r
noremap b t
noremap j y
noremap l u
noremap u i
noremap y o
noremap ' p
noremap r s
noremap s d
@Apsu
Apsu / chords.py
Last active July 13, 2021 09:34
5 Finger Chord Sequences With No Finger Reuse
#!/usr/bin/env python3
import itertools
def same_finger(ngram):
fingers = 0
for chord in ngram:
if chord & fingers:
return False
fingers |= chord
@Apsu
Apsu / uefisetup.sh
Last active July 8, 2021 03:54
Arch Linux UEFI Setup
# **************** READ THIS FIRST ******************
#
# This is not a script for you to run. I repeat, do not download and run this!
#
# This is only a guide to show the required steps for successful UEFI + GRUB2 installation
# Many of the choices are examples or assumptions; don't blindly type shit into your machine
# until/unless you at least read the comments around each command
#
# These steps assume you've booted in UEFI mode by preparing your USB stick per these instructions:
# https://wiki.archlinux.org/index.php/UEFI#Archiso