Skip to content

Instantly share code, notes, and snippets.

#################### ~/.config/helix/config.toml ####################
theme = "tokyonight_storm"
#theme = "base16_transparent"
[editor]
line-number = "relative"
mouse = false
bufferline = "multiple"
[keys.normal]
@wwiill
wwiill / zshrc
Last active March 8, 2025 00:24
zshrc
echo "Loading .zshrc"
source $HOME/.aliases
## curl https://raw.githubusercontent.com/git/git/refs/heads/master/contrib/completion/git-prompt.sh > ~/.git-prompt.sh
source $HOME/.git-prompt.sh
setopt PROMPT_SUBST ; PS1='[%F{39}%~%F{green}$(__git_ps1 " (%s)")%f]>'
export VSCODE="/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
export EDITOR=hx
@wwiill
wwiill / csv.clj
Created November 13, 2020 12:11
babashka script to process csv
#!/usr/bin/env bb
;; cat test.csv | csv.clj '(fn [m] (get m "column1"))'
(defn lines->maps [lines]
(let [headers (first lines)
body (rest lines)]
(->> body
(map (partial zipmap headers)))))
@wwiill
wwiill / generative-testing.md
Last active October 15, 2020 01:43
Generative testing with test.check
@wwiill
wwiill / unless-error.cljc
Created October 6, 2020 11:04
Unless error macro
(defmacro unless-error->
"Unless expr is a map like {:error xxx}, threads it into the first form (via ->),
and unless that result is a map like {:error xxx}, through the next etc"
[expr & forms]
(let [g (gensym)
steps (map (fn [step] `(if (:error ~g) ~g (~step ~g)))
forms)]
`(let [~g ~expr
~@(interleave (repeat g) (butlast steps))]
~(if (empty? steps)
#!/bin/bash
ENCRYPTED_BIN_FILE=$1
aws kms decrypt --ciphertext-blob fileb://$ENCRYPTED_BIN_FILE --query Plaintext --output text | base64 --decode
#!/bin/bash
KEY_ID=$1
UNENCRYPTED=$2
aws kms encrypt --key-id $KEY_ID --plaintext "$UNENCRYPTED" --query CiphertextBlob --output text | base64 --decode
#!/bin/bash
KEY_ID=$1
UNENCRYPTED=$2
aws kms encrypt --key-id $KEY_ID --plaintext "$UNENCRYPTED" --query CiphertextBlob --output text
#!/bin/bash
BASE_DIR=`pwd`
for REPO in $(find . -type d -d 1 | sed -e s/[\.\/]//g)
do
echo "Pulling $BASE_DIR/$REPO ..."
cd "$BASE_DIR/$REPO"
if [ "`git status | grep modified | wc -l`" -eq "0" ] ; then git pull; else echo "Skipping (has modified files)"; fi
done