Skip to content

Instantly share code, notes, and snippets.

View sneeu's full-sized avatar
🦀
Hi

John Sutherland sneeu

🦀
Hi
View GitHub Profile
# "Secrets" are just environment variables--I can never remember `-Ugex` etc.
function secret
switch (count $argv)
case 0 # Usage
echo "Usage: secret <name> [value]"
echo " If value is not provided, the secret is unset."
case 1 # Unset
set -e -Ug $argv[1]
case 2 # Set
set -Ux $argv[1] $argv[2]
@sneeu
sneeu / aoc_2022_day_01.sql
Created December 1, 2022 14:09
Advent of Code 2022: Day #1
DROP TABLE IF EXISTS elf_calories;
CREATE TABLE elf_calories (
calories INT NULL
);
COPY elf_calories (calories) FROM '/tmp/aoc_day01.input' NULL AS '';
WITH item_id_added AS (
SELECT
@sneeu
sneeu / main.fish
Created September 1, 2020 15:38
Switch between main (or master) and the most recent branch
# Switches between a "main" branch ($BRANCHES) and the last checked-out branch.
function main
set -l BRANCHES main master
for branch in $BRANCHES;
# Check if branch exists
if [ (git branch --list $branch) ]
# Check if branch is the currently checked-out branch
if not [ (git branch --show-current) = $branch ]
on alfred_script(q)
set theName to (q)
set isRunning to false
tell application "System Events"
if exists process "OmniFocus" then
set isRunning to true
end if
end tell
[alias]
amend = commit --amend
cane = commit --amend --no-edit
br = branch
brd = !git diff `git merge-base HEAD master`
brdt = !git difftool `git merge-base HEAD master`
brl = !git branch --sort=-committerdate | head -n 5
ci = commit
co = checkout
di = diff
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sneeu
sneeu / Makefile
Created July 4, 2018 17:03
Hugo Build/upload to S3/CF invalidation Makefile
.PHONY: build
build:
hugo
s3cmd sync --delete-removed public/ s3://sneeu.com/
aws cloudfront create-invalidation --distribution-id «REDACTED» --paths "/*"
import functools
def memoize(f):
memos = {}
@functools.wraps(f)
def g(*args):
if args not in memos:
print 'Calling'
### Keybase proof
I hereby claim:
* I am sneeu on github.
* I am sneeu (https://keybase.io/sneeu) on keybase.
* I have a public key whose fingerprint is C3C1 78AF FB8D F39D 2B52 AD0F 9DEC 5627 576E 5629
To claim this, I am signing this object:
@sneeu
sneeu / -
Created November 26, 2014 16:41
[user]
name = John Sutherland
email = john@sneeu.com
[alias]
amend = commit --amend -C HEAD
br = branch
brdi = !git diff `git merge-base HEAD master`
brdt = !git difftool `git merge-base HEAD master`
ci = commit