Skip to content

Instantly share code, notes, and snippets.

#!/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")
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
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
kennwhite / ct32.c
Created April 25, 2014 01:38 — forked from sneves/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 / Vagrantfile
Last active August 29, 2015 14:06 — forked from jbgo/Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :private_network, ip: "192.168.33.10"
config.ssh.forward_agent = true
root@brutalis:~/cudaHashcat-1.31# nvidia-smi -L
GPU 0: GeForce GTX 980 (UUID: GPU-5869777e-6d0b-1f77-cfed-d1b4a6a5e098)
GPU 1: GeForce GTX 980 (UUID: GPU-08c2e212-876d-a6ec-933b-1188e9824ccd)
GPU 2: GeForce GTX 980 (UUID: GPU-b8c2647c-8f47-ecce-34f8-781ea83c429c)
GPU 3: GeForce GTX 980 (UUID: GPU-10eac0ac-6ab6-cf9f-7ca7-3657d4f23bae)
GPU 4: GeForce GTX 980 (UUID: GPU-d494a6c6-eef3-890a-b11c-b4842e57c0bf)
GPU 5: GeForce GTX 980 (UUID: GPU-35fe33d3-f61d-5fed-4fcf-bd5c94a39fc7)
GPU 6: GeForce GTX 980 (UUID: GPU-233240fe-5699-2edc-01d2-2f961c275b13)
GPU 7: GeForce GTX 980 (UUID: GPU-b64da0f4-27c5-6d92-1ae0-16c0b4f98d0e)
@kennwhite
kennwhite / gist:1d60ff622248d725f1de
Last active August 29, 2015 14:07 — forked from tedder/gist:0d3276040054eb10857b
Tedder's ELB Security Policy
PolicyDescriptions:
- PolicyName: ELBSecurityPolicy-2014-10
PolicyTypeName: SSLNegotiationPolicyType
PolicyAttributeDescriptions:
- AttributeName: Protocol-SSLv2
AttributeValue: false # http://en.wikipedia.org/wiki/Transport_Layer_Security#SSL_2.0
- AttributeName: Protocol-TLSv1
AttributeValue: true # generally recognized as safe
- AttributeName: Protocol-SSLv3
AttributeValue: false # POODLE, https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-3566
#!/bin/bash
# bin/elb-describe-lbs | awk '{print $2}' | xargs -n1 elb-set-secure-policy.sh
ELB=$1
echo "Setting Policy on Load Balancer $1"
bin/elb-create-lb-policy $ELB \
--policy-type SSLNegotiationPolicyType \
--policy-name elb-secure-ssl \
@kennwhite
kennwhite / rc4.js
Last active August 29, 2015 14:08 — forked from dchest/rc4.js
function rc4(f,F,g,G){for(var U=256,b=[],c=a=0,d;U>a;a++)b[a]=a;for(a=0;U>a;a++)c=(c+b[a]+f[a%F])%U,d=b[a],b[a]=b[c],b[c]=d;for(var e=c=a=0;e<G;e++)a++,a%=U,c+=b[a],c%=U,d=b[a],b[a]=b[c],b[c]=d,g[e]=b[(b[a]+b[c])%U]}
// Usage:
//
var key = [75, 101, 121]; // input bytes: "Key"
var out = new Array(10); // place for keystream bytes
rc4(key, key.length, out, out.length); // out now contains keystream: [235, 159, 119, 129, 183, 52, 202, 114, 167, 25]