Skip to content

Instantly share code, notes, and snippets.

View tadpol's full-sized avatar

michael conrad tadpol tilstra tadpol

View GitHub Profile
#!/bin/zsh
path+=(/opt/homebrew/bin /Applications/Arq.app/Contents/Resources/)
plans=($(arqc listBackupPlans 2>/dev/null | awk -F'[= \t]' '/UUID/ {print $2}'))
for plan in $plans; do
msg=$(arqc latestBackupActivityJSON $plan 2>/dev/null | jq -r '.message')
if [[ $msg == "Backing up"* ]]; then
echo yes
exit 0
@tadpol
tadpol / scan_netrc.zsh
Created January 25, 2021 16:08
ZSH function to scan .netrc file for matching machine and login
function scan_netrc {
local host_to_find=$1
local user_to_find=$2
local netrc=($(< ~/.netrc ))
# This does not correctly handle `macrodef`
# netrc is a series of key-value pairs seperated by anysort of white space.
# (netrc explictily does not handle password with whitespace in them)
# Strictly, netrc only mactches on `machine` and there can only be one of each.
local key=''
local state=START
const sleep = (delay) => new Promise(resolve => setTimeout(resolve, delay));
module.exports = {sleep};
# convert INI to sourcable env. (does not handle comments)
awk 'BEGIN {sec="default"}; /^\[/ {gsub(/\[|\]/,""); sec=$0} /=/ {print sec "_" $0}' < config.ini
# Filter in a single section (does not handle comments)
awk -v sec=dev 'BEGIN {nskip=0} /^\[.+\]$/ {if($0 == "[" sec "]") nskip=1; else nskip=0; next} nskip' < config.ini
@tadpol
tadpol / tot.sh
Last active March 23, 2020 14:12 — forked from chockenberry/tot.sh
A shell script for Tot
#!/bin/sh
set -x
basename=`basename $0`
if [ -z "$*" ]; then
echo "usage: ${basename} <dot> [ -o | -r | <file> | - ]"
echo ""
echo "options:"
echo " -o open dot in window with keyboard focus"
echo " -r read contents of dot"
@tadpol
tadpol / adc_test_client_certs.sh
Last active August 28, 2017 17:17
Quick test to see if auto-provisioning with TLS Client Certificate is working
#!/bin/sh
set -x
set -e
DEVICE_HOST=${DEVICE_HOST:-<>.m2.exosite-dev.io}
BY_ACTION=${BY_ACTION:-write}
USE_CERT=${USE_CERT:-rsa}
HOST_CA=${HOST_CA:-MURANO_ROOT_CA.cer}
/* My first attempt at building a sequence that will make a collection loop forever.
I had a need where I wanted to loop over two lists but instead of truncating the
longer list to the shorter one, I wanted the shorter one repeat until the longer
one completed.
FE:
let c = ["Z", "Y", "X", "W", "V", "U", "T"]
let d = [0,9,7]
let i = ForeverSequence(vals: d)
@tadpol
tadpol / ResetBuildNumber.sh
Last active March 29, 2016 20:08
Xcode Build Phase scripts for setting build number
# This goes at the end of the Build Phases
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion DEVEL" "${PROJECT_DIR}/${INFOPLIST_FILE}"

Keybase proof

I hereby claim:

  • I am tadpol on github.
  • I am tadpol (https://keybase.io/tadpol) on keybase.
  • I have a public key whose fingerprint is 7C5B 00EA 8547 223C BF1B E3A0 666A F760 2B4D 0504

To claim this, I am signing this object:

@tadpol
tadpol / gist:1567158
Created January 5, 2012 20:35
Blink a LED
_replace DDRB, 0x04
_replace PORTB, 0x05
_replace LEDP, 5
_replace SPH, 0x3e
_replace SPL, 0x3d
_replace RAMEND_HI, 0x04
_replace RAMEND_LO, 0xff
; Rest and Interrupt table for ATmega168
_loc 0