Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -e
VAULT_PASSWORD_FILE=${VAULT_PASSWORD_FILE:-"vault-password.gpg"}
GPG_ID=${GPG_ID:-$EMAIL}
CMD=${1:-"--decrypt"}
function wrap {
@theasp
theasp / ldif2yaml
Last active January 2, 2022 02:32
LDIF to YAML with some basic Base64 handling
#!/bin/bash
set -o pipefail
ldif_attr_re='^([^ :]+)(::?) (.+)$'
ldif_continue_re='^ (.+)$'
printable_re="^[[:print:]]+$"
yaml_attr_fmt='%s %s: "%s"\n'
declare -A RECORD
@theasp
theasp / gist:92b36733846be7dc0ed78840d3a3515a
Created January 20, 2018 19:26
NGINX Configuration for shadow-cljs
location /shadow-cljs/ {
# Reverse proxy: http://192.168.0.2:9650/
proxy_pass http://192.168.0.2:9650/;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $http_host;
# Allow websockets
proxy_set_header Upgrade $http_upgrade;
@theasp
theasp / pg.cljs
Created December 15, 2017 20:08
Using `pg` from ClojureScript on Node.js with an interface like `postgres.async`
(ns hello-world.pg
(:require
[clojure.string :as string]
[cljs.nodejs :as nodejs]
[cljs.core.async
:refer [<! chan put! close! onto-chan to-chan]]
[taoensso.timbre :as timbre
:refer-macros [tracef debugf infof warnf errorf]])
(:require-macros
[cljs.core.async.macros :as m :refer [go]]))
@theasp
theasp / config.sh
Last active August 31, 2017 19:57
Basic preprocessor for your ~/.ssh/config. Useful if you use various versions of ssh regularly, or you want to create a bunch of host entries dynamically.
#!/bin/bash
set -e
export SSH=${SSH:-/usr/bin/ssh}
SSH_FULL_NAME="$(${SSH} -V 2>&1)"
SSH_SHORT_NAME="${SSH_FULL_NAME%% *}"
export SSH_PROVIDER=${SSH_SHORT_NAME%%_*}
export SSH_VERSION=${SSH_SHORT_NAME##*_}

Keybase proof

I hereby claim:

  • I am theasp on github.
  • I am theasp (https://keybase.io/theasp) on keybase.
  • I have a public key whose fingerprint is 2C00 178C 7FA5 FD36 8EAD 07BF F047 DCC8 B64B 390E

To claim this, I am signing this object: