Skip to content

Instantly share code, notes, and snippets.

kennwhite

Block or report user

Report or block kennwhite

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View slack_send_pm.sh
#!/bin/bash
set -e
# Send a private message to someone on slack
# from the command line.
# Print a usage message and exit.
usage(){
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"
View clojure.md

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
kennwhite / keybase.md
Created Apr 4, 2014
keybase.io verification
View keybase.md

Keybase proof

I hereby claim:

  • I am kennwhite on github.
  • I am kwhite (https://keybase.io/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:

View ct32.c
/*
Constant-time integer comparisons
Written in 2014 by Samuel Neves <sneves@dei.uc.pt>
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
kennwhite / disable_wd_utilities.sh
Last active Aug 29, 2015
Disable WD utilities auto-mount on OSX (SL, Lion, Mountain Lion)
View disable_wd_utilities.sh
#!/bin/bash
# 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
kennwhite / ptrace_stack_control.c
Created Jul 9, 2014
Ptrace stack control PoC CVE-2014-4699
View ptrace_stack_control.c
/*
CVE-2014-4699 ptrace stack control POC By Andy Lutomirski
See: http://www.openwall.com/lists/oss-security/2014/07/08/16
*/
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/syscall.h>
#include <sys/user.h>
#include <unistd.h>
View snippets.sh
# 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}' \
/usr/share/dict/words
@kennwhite
kennwhite / php_local_safari_osx.sh
Last active Aug 29, 2015
Launch php page in Safari from localhost built-in server, in current directory
View php_local_safari_osx.sh
# !/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 \
You can’t perform that action at this time.