Skip to content

Instantly share code, notes, and snippets.

$ sudo nginx -s stop
$ sudo nginx
@kennwhite
kennwhite / trim_enabler.sh
Last active December 21, 2015 05:18 — forked from return1/trim_enabler.txt
Enable SSD Trim support on Mac Lion & Mountain Lion. Original version by Grant Parnell.
#
# Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/)
#
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
#
# Alternative to http://www.groths.org/trim-enabler-3-0-released/
# Method behind this madness described: http://forums.macrumors.com/showthread.php?t=1409151&page=4
# See discussion in comments here: https://www.macupdate.com/app/mac/39654/lion-tweaks
# And here: http://forums.macrumors.com/showthread.php?t=1410459
# And here: http://forums.macrumors.com/showthread.php?t=1480302
sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.original
# for Mountain Lion 10.8.3 - 10.8.4
sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x54)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
# for Mountain Lion 10.8.1-10.8.2 and Lion 10.7.5
#sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x4D)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
# for Mountain Lion 10.8.0 and Lion 10.7.4 BELOW
#sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x51)|
#!/bin/bash
#
# sqlite3_backup.sh
# Script for backing up sqlite3 database with integrity checking
# Intended for use with cron for regular automated backups
#
# @author <shaune@princeton.edu>
#
# 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)