Skip to content

Instantly share code, notes, and snippets.

View jessearmand's full-sized avatar

Jesse Armand jessearmand

View GitHub Profile
@jessearmand
jessearmand / fleet-hub-init.sh
Created May 10, 2013 02:44
fleet hub init script from @tblobaum
#!/bin/bash
SET_USER="node"
SET_NODE_VERSION="v0.6.14"
SET_HUB_PORT="1024"
SET_HUB_SECRET="beepboop"
[ -d /etc/node ] || mkdir /etc/node
cat > /etc/node/fleet-hub.conf <<EOT
#!/bin/sh
#
# fleet-drone
#
# chkconfig: - 85 15
# description:
# processname: fleet-drone
# config: /etc/node/fleet-drone.conf
# pidfile: /var/run/fleet-drone.pid
#!/bin/bash
CWD=$(cd $(dirname $0); pwd)
HOME_DIR=$HOME
BASE_DIR="${HOME_DIR}/dev"
echo "Creating dev directory ${BASE_DIR}"
mkdir "${BASE_DIR}"
echo "Creating dev directory ${BASE_DIR}"
@jessearmand
jessearmand / unfuckbootstrap.sh
Created January 4, 2013 12:44
unfuckbootstrap from mikeash, when the simulator refused to launch your app
#!/bin/sh
launchctl list|grep UIKitApplication|awk '{print $3}'|xargs launchctl remove
@jessearmand
jessearmand / osm_maps_downloader.py
Created November 6, 2012 14:26
Download map tiles from MapQuest open street map source
#!/usr/local/bin/python
from sys import argv
import os
import math
import urllib2
def deg2num(lat_deg, lon_deg, zoom):
lat_rad = math.radians(lat_deg)
n = 2.0 ** zoom
@jessearmand
jessearmand / parse_json.py
Created October 29, 2012 13:05
Streaming JSON parser with ijson
#!/usr/local/bin/python
from sys import argv
import ijson
script, filepath = argv
f = open(filepath, 'r')
parser = ijson.parse(f)
for prefix, event, value in parser:
print "%r: %r - %r" % (event, prefix, value)
@jessearmand
jessearmand / find_delete
Created September 25, 2012 08:07
Delete found files with "keyword" as a filename inside "dir" interactively.
#!/bin/sh
dir = "$1"
keyword = "$2"
find "$dir" -name '$keyword' -exec rm -i {} \;
@jessearmand
jessearmand / cleanupfinder
Created September 9, 2012 14:32
To clean up the "Open With" in Finder context menu
#!/bin/sh
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
@jessearmand
jessearmand / config
Created February 13, 2012 15:31
This config solved my SSH connection problem with M1 fibre broadband network (on a Huawei HG256 residential gateway device) that I'm currently using
# SSH Connection pooling for faster additional connections to a machine
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r
# This makes subsequent connections go faster
ControlPersist 2h
# Make it so ssh-ing from one server to another passes keys around automagically
Host *
ForwardAgent yes
@jessearmand
jessearmand / BaseViewController.m
Created October 19, 2011 09:11 — forked from boctor/BaseViewController.m
A base view controller class that when running on the simulator in debug mode, will auto simulate a memory warning every time the view controller's viewDidAppear is called
//
// BaseViewController.m
//
// Created by Peter Boctor on 5/4/11.
//
// Copyright (c) 2011 Peter Boctor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights