Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View statianzo's full-sized avatar
🎯
Focusing

Jason Staten statianzo

🎯
Focusing
View GitHub Profile
#!/usr/bin/env bash
# HubCrypt
# ========
#
# Decrypt a file encrypted using hubencrypt (ok, it's just openssl + rsautl +
# your SSH keys). It needs the private key that matches your last public key
# listed at github.com/<user>.keys
#
@statianzo
statianzo / PKGBUILD.diff
Last active August 29, 2015 14:01
openresty PKGBUILD update
--- PKGBUILD.old 2013-09-30 14:24:47.000000000 -0600
+++ PKGBUILD 2014-05-27 12:59:49.359684637 -0600
@@ -4,7 +4,7 @@
_tmpdir=/var/lib/openresty
pkgname=openresty
_pkgname=ngx_openresty
-pkgver=1.4.2.9
+pkgver=1.5.12.1
pkgrel=1
pkgdesc="a powerful web app server by extending nginx"
"template": {
"data": [
{"name": "full-name", "value": "Joe", "prompt": "Full Name"},
{"name": "sports", "parameter": "quiz[sports]", "prompt": "Sports",
"template": {
"data": [
{"parameter": "best_rugby", "name": "rugby", "prompt": "Best rugby team?", "value": "All Blacks" }
]
}
}
@statianzo
statianzo / etcdenv.sh
Last active August 29, 2015 14:06
etcd directory to env file, supports recursion
#!/bin/bash
set -eo pipefail
usage(){
echo "etcdenv - Recursively prints etcd dir as environment file"
echo "Usage: etcdenv rootdir"
exit 1
}
@statianzo
statianzo / docker-check.sh
Created September 15, 2014 20:43
Run command on docker image change
#!/bin/bash
set -eo pipefail
usage(){
echo "Usage: docker-check image [command]"
exit 1
}
version(){
@statianzo
statianzo / cxenv.sh
Last active August 29, 2015 14:07
Run a command in the same environment as a cloud66 stack
#!/bin/bash
set -eo pipefail
usage(){
echo "Usage: cxenv stack environment [command]"
exit 1
}
[ $# -lt 3 ] && usage
@statianzo
statianzo / openssl.sh
Last active August 29, 2015 14:17 — forked from colby/openssl.sh
#!/bin/bash
awk=$(which awk || echo 'missing: install awk' && exit 1)
# update apt
sudo apt-get update
# get ssl related packages from simulated upgrade
sudo apt-get upgrade -s | grep ssl | grep Inst | $awk '{print $2}' | xargs -t sudo apt-get install
@statianzo
statianzo / di.js
Created June 22, 2015 17:00
Simple DI
var deps = {};
function register(name, value) {
deps[name] = value;
}
function inject(fn) {
var wants = fn.wants || [];
var resolved = wants.map(resolve);
return fn.apply(null, resolved);
(defn ellipsize [length text]
(let [words (take length (split #"\W+" text))]
(str (join " " words ) "...")))
(defn indexed [coll] (map vector (iterate inc 0) coll))
(defn index-filter [pred coll]
(when pred
(for [[idx elt] (indexed coll) :when (pred elt)] idx)))
(defn index-of-any [pred coll]
(first (index-filter pred coll)))
(ns com.jstaten.predicates)
(defn non-blank? [line]
(re-find #"\S" line))
(defn non-svn? [file]
(not (.contains (.toString file) ".svn")))
(defn clojure-source? [file]
(.endsWith (.toString file) ".clj"))
(use '[clojure.contrib.io :only (reader)])
(defn clojure-loc [dir]