Skip to content

Instantly share code, notes, and snippets.

set -e
# Send a private message to someone on slack
# from the command line.
# Print a usage message and exit.
local name=$(basename "$0")
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
View gist:9690720
urlencode() {
# urlencode <string>
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;;
' ') printf + ;;
*) printf '%%%X' "'$c"

Setting Up Clojure on OS X

I spent a lot of time trying to find a pretty optimal (for me) setup for Clojure… at the same time I was trying to dive in and learn it. This is never optimal; you shouldn't be fighting the environment while trying to learn something.

I feel like I went through a lot of pain searching Google, StackOverflow, blogs, and other sites for random tidbits of information and instructions.

This is a comprehensive "what I learned and what I ended up doing" that will hopefully be of use to others and act as a journal for myself if I ever have to do it again. I want to be very step-by-step and explain what's happening (and why) at each step.

Step 1: Getting Clojure (1.3)

kennwhite /
Created April 4, 2014 15:54 verification

Keybase proof

I hereby claim:

  • I am kennwhite on github.
  • I am kwhite ( on keybase.
  • I have a public key whose fingerprint is 757B 3A56 7E3C 9BF6 CE78 0C2D A01E DA60 0C2A 97FE

To claim this, I am signing this object:

kennwhite / ct32.c
Created April 25, 2014 01:38 — forked from sneves/ct32.c
View ct32.c
Constant-time integer comparisons
Written in 2014 by Samuel Neves <>
To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
You should have received a copy of the CC0 Public Domain Dedication along with
kennwhite /
Last active August 29, 2015 14:03
Disable WD utilities auto-mount on OSX (SL, Lion, Mountain Lion)
# vifs can be used too, but this works.
sudo sh -c "echo UUID=`diskutil info /Volumes/WD\ SmartWare/ | grep 'UUID' | awk '{print $NF}'` none hfs rw,noauto 0 0 >> /etc/fstab"
kennwhite / ptrace_stack_control.c
Created July 9, 2014 03:40
Ptrace stack control PoC CVE-2014-4699
View ptrace_stack_control.c
CVE-2014-4699 ptrace stack control POC By Andy Lutomirski
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/syscall.h>
#include <sys/user.h>
#include <unistd.h>
kennwhite /
Created July 14, 2014 16:48
Bash snippets
# Print random number range, Linux or OSX:
# ex: 4707
cat /dev/urandom | od -N2 -An -i|awk -v f=1 -v r=65000 '{printf "%i\n", f + r * $1 / 65536}' | head -n 1
# Create OSX dictionary-based passphrases
# Ex: banish-wilsomeness-piquant
cnt=$( wc -l /usr/share/dict/words | awk '{print $1;}' ); \
for i in {1..3}
do awk -v lineno=$(jot -r 1 1 $cnt) 'lineno==NR{printf $0"-" ;exit}' \
kennwhite /
Last active August 29, 2015 14:05
Launch php page in Safari from localhost built-in server, in current directory
# !/bin/bash
# Requires OSX Mavericks for php 5.4+
# Instantiate stand-alone server, suppress all stdout logging from php & bash job messages
echo '<?php phpinfo();' > info.php && { php -S localhost:8000 >/dev/null 2>&1 & } 2>/dev/null
sleep 2
osascript \