Skip to content

Instantly share code, notes, and snippets.

View aaronup's full-sized avatar

Aaron aaronup

  • Austin, TX
View GitHub Profile

Keybase proof

I hereby claim:

  • I am aaronup on github.
  • I am aaronup (https://keybase.io/aaronup) on keybase.
  • I have a public key ASA8AVJTqXwIZyGc4qjcd_-p0BNLjtgfPflSnYGB0JThfwo

To claim this, I am signing this object:

# Thank you code_nomad: http://9m.no/ꪯ鵞
#################################
#
# Backend
#
#################################
# Backend to use: "xrender" or "glx".
# GLX backend is typically much faster but depends on a sane driver.
Verifying that "aaronup.id" is my Blockstack ID. https://onename.com/aaronup
@aaronup
aaronup / appDelegate.swift
Created July 6, 2015 14:43
Register with Device Token
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
Intercom.setDeviceToken(deviceToken)
}
@aaronup
aaronup / caress-0.1.0.js
Last active August 29, 2015 14:05
Caress Client 0.1.0
/*! caress-client - v0.1.0 - 2012-11-01
* https://github.com/ekryski/caress-client
* Copyright (c) 2012 Eric Kryski; Licensed MIT */
(function(namespace) {
/**
* Boilerplate to make Caress compatible with AMD,
* CommonJS 'require' (NodeJS) and vanilla JavaScript.
*
#!/bin/sh
#Here are some shell shortcuts you can use to slow down your localhost.
#based on: http://www.railsillustrated.com/simulating-a-web-experience.html
#Sourced from: https://plus.google.com/106413090159067280619/posts/1K9fgqfn8zY
function slowport {
# Choose whatever speed you like in the first line.
sudo ipfw pipe 1 config bw 50KByte/s;
sudo ipfw add 1 pipe 1 src-port $1;
@aaronup
aaronup / coffeetojson.sh
Created April 8, 2014 14:00
Coffeescript to JSON
#!/bin/bash
coffee --print --bare $1.coffee | sed '1s/&.//' | sed 's/});/}/' | sed 's/({/{/' | sed "s/\([^ '\"].*[^ '\"]\): /\"\1\": /1" | sed "s/'\(.*\)'/\"\1\"/" > $1.json
@aaronup
aaronup / start-local-mongo-replica-set.sh
Last active December 23, 2015 17:29
Control a 3 member local replica set of MongoDB daemons Usage: mongo-repl.sh [start|stop|restart] It assumes you've created and setup all your repl directories and configs
#!/bin/bash
mongod=`which mongod`
db0_config='/usr/local/etc/mongo/mongod-db0.conf'
db1_config='/usr/local/etc/mongo/mongod-db1.conf'
db2_config='/usr/local/etc/mongo/mongod-db2.conf'
prog=${BASH_SOURCE[0]}
RETVAL=0
if [ ! -f "${mongod}" ]; then
echo "MongoDB binary not found"
@aaronup
aaronup / ObjectIDTS.js
Created September 10, 2013 16:24
Create an ObjectID with a timestamp for MongoDB Created date queries
function ObjectIDTS(timestamp) {
// Convert string date to Date object (otherwise assume timestamp is a date)
if (typeof(timestamp) == 'string') {
timestamp = new Date(timestamp);
}
// Convert date object to hex seconds since Unix epoch
var hexSeconds = Math.floor(timestamp/1000).toString(16);
// Create an ObjectId with that hex timestamp
@aaronup
aaronup / convert
Created August 30, 2013 23:15
Shell, convert File to UTF-8
iconv -f {encoding_type} -t UTF-8 {in.txt} > {out.txt}
# EG: ISO-8859-15