Skip to content

Instantly share code, notes, and snippets.

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 / neckbeard-push.sh
Last active May 17, 2022 12:32
Minimalist, bash-only utility script to push a file to S3 bucket. AWS ID & Key can be passed via environment or on command line. Only dependency is openssl tools (usually default). Name is an homage to Joe Stump.
#!/usr/bin/env bash
#
# Upload a file to the Amazon S3 service
# Usage:
# neckbeard-push FILE S3_BUCKET [-a ACL_POLICY] [-i AWS_ACCESS_ID] [-k AWS_SECRET_KEY] [-d debug] [-l write verbose session log]
# Note: If option -l is requested, curl_session.log contains SSL handshake *and* plaintext AWS keys
#
# Ex 1: neckbeard-push foo.log my-bucket -a public-read (with env vars: $AWS_ACCESS_ID & $AWS_SECRET_KEY)
# Ex 2: neckbeard-push foo.log my-bucket -a private -i AKIXXXXX -k aBcDeFgHxxx -d
#
@kennwhite
kennwhite / multi_key_crypto.sh
Last active January 16, 2024 15:47
OpenSSL command line recipe for multi-public key file encryption. Any single private key paired to one of the public keys can decrypt the file.
#!/usr/bin/env bash
#
# Example of multiple key AES encryption for text files using the openssl v. 0.9.8+ command line utility
# Uses n public certs as key for MIME PKCS envelope, any individual private key can decrypt.
#
# If standard RSA ssh keys exist, these can be converted to public certs as well (and ssh keys can decrypt)
#
# To sign (and verify) the encrypted file, one of the private keys is required, see:
# http://www.openssl.org/docs/apps/smime.html#EXAMPLES for openssl smime examples
# or http://www.openssl.org/docs/apps/cms.html#EXAMPLES for cms utility (OpenSSL v. 1.0+)
@kennwhite
kennwhite / keybase.md
Created April 4, 2014 15:54
keybase.io verification

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:

@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 / disable_wd_utilities.sh
Last active August 29, 2015 14:03
Disable WD utilities auto-mount on OSX (SL, Lion, Mountain Lion)
#!/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 / hash.ps1
Last active October 4, 2017 06:36
Simple Win7/8 PowerShell script to compute md5, sha, and sha256 hash for a file
# Simple powershell (built-in to Win7/8) utility script
# to compute sha256 (or md5, sha1 or sha512) of a file
#
# Usage:
# C:\> powershell
# PS .\hash filename.ext [sha|md5|sha256|sha512]
#
# May require: Control Panel/System/Admin/Windows Power Shell Modules, then: set-executionpolicy remotesigned
#
# Based on James Manning's and Mike Wilbur's get-hashes and get-sha256 MSDN scripts
@kennwhite
kennwhite / ptrace_stack_control.c
Created July 9, 2014 03:40
Ptrace stack control PoC CVE-2014-4699
/*
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>
@kennwhite
kennwhite / fix_postgres_initdb_error.md
Last active May 18, 2023 12:06
Postgres CentOS and Amazon Linux initdb error: Data directory is not empty! [FAILED]

If completely wiping & reinstalling a Postgres DB, when running initdb like:

service postgresql-9.2 initdb -E 'UTF8' --pgdata="/foo/bar/"

you can encounter this service error:

Data directory is not empty! [FAILED]

To fix it (and this is the nuclear option -- all db data is wiped!)

@kennwhite
kennwhite / snippets.sh
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}' \
/usr/share/dict/words