Skip to content

Instantly share code, notes, and snippets.

@austinhappel
austinhappel / Monokai-AH.tmTheme
Created June 6, 2012 05:13
Sublime Text 2 Mononkai theme that supports MarkDown
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Monokai</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@austinhappel
austinhappel / ssh-pubkey-commands.md
Created December 12, 2012 04:45
Simple commands for managing ssh keys on servers.

Overview

This is a basic walk through of how to generate an ssh key and how to set it up on a server so you can log in without having to type your password every time you want to log in.

Steps

  1. Generate ssh key
  2. Add your key to the authorized_keys file on your server.
@austinhappel
austinhappel / app.js
Last active December 10, 2015 18:58
Example bbb build contents re: https://github.com/tbranyen/backbone-boilerplate/issues/185. See readme for more information.
define([
"modules/testing",
"backbone.layoutmanager"
], function() {
// Provide a global location to place configuration settings and module
// creation.
var app = {
// The root path to run the application.
root: "/"
@austinhappel
austinhappel / installing_npm_locally.md
Last active December 11, 2015 16:58
Installing NPM (node package manager) into your home folder. For mac/*nix.

Installing NPM locally (to ~/local instead of /usr/local)

Install npm into ~/local instead of usr/local:

`curl https://npmjs.org/install.sh | npm_config_prefix=~/local sh`

Add this to your ~/.npmrc file:

prefix = ~/local
@austinhappel
austinhappel / remove_svn.py
Last active July 12, 2016 14:41
A few different ways to delete all .svn files from a git repository's history.
#!/bin/python
# USAGE:
# 1) cd /path/to/git/repository
# 2) execute the script with: `python /path/to/remove_svn.py`
# NOTE: By default this code does a dry-run. To actually delete files from history, remove the
# "n" flag from the 'git rm -rfn' around line 20.
import subprocess
p = subprocess.Popen(['find', '.', '-name', '*.svn'], stdout=subprocess.PIPE)

png optimization and filesize comparison

4 pngs were created, each 1000x1000 pixels in dimension 1 png, 80x80 pixels in dimension. It uses the same image as the one used in png-transparent-tinyimage.png

Images can be found here: https://dl.dropbox.com/u/416403/png-test/png-test.zip

  • png-image.png
    • full size photo
  • png-one-color.png
@austinhappel
austinhappel / cross-origin-images-with-canvas-and-toDataUrl.md
Created April 16, 2013 17:53
You're creating a `<canvas>` app and you're pulling images from external sources (e.g. http://notyourdomain.com/image/foo.jpg) and you want to create a bitmap of the new image via the canvas **toDataUrl**. You will get a **DOM security error 18** most likely. Here is a workaround.

Cross origin images with canvas and toDataUrl()

Problem:

You're creating a <canvas> app and you're pulling images from external sources (e.g. http://notyourdomain.com/image/foo.jpg) and you want to create a bitmap of the new image via the canvas toDataUrl. You will get a DOM security error 18 most likely.

Solution:

You must have control over what headers the image source sends.

@austinhappel
austinhappel / how-to-connect-an-iOS-device-to-your-computer-using-SOCKS.md
Last active September 25, 2023 22:56
How to connect an iOS device to your computer via a SOCKS proxy. Say you're running a virtual machine on your work computer. Say this machine, for whatever reason, can only connect to the internet over NAT - as in, it does not get it's own IP address. Say this VM is running a webserver, and you need a device outside of your computer to connect t…

How to connect an iOS device to your computer via a SOCKS proxy

Say you're running a virtual machine on your work computer. Say this machine, for whatever reason, can only connect to the internet over NAT - as in, it does not get it's own IP address. Say this VM is running a webserver, and you need a device outside of your computer to connect to it.

If only there was a way to get your work computer to 'share' it's network, so that you could get at that VM… Here's how you do it!

For all instructions, I assume your work computer is a mac

  1. Get your computer's IP address:
@austinhappel
austinhappel / throttle.sh
Created July 18, 2013 20:39
This is a very simple bash script to throttle your bandwidth for testing purposes. Right after writing this I discovered that someone else also wrote something similar: https://gist.github.com/j-manu/1409218
#/bin/bash
THROTTLE=200
PORT="any"
LINE="--------------------------------------------------------------------------------"
start()
{
echo "Throttling data from port $PORT to $THROTTLE KByte/s"
unit="KBytes/s"
@austinhappel
austinhappel / convertAudio.sh
Last active May 14, 2021 15:50
Converts wav, ogg, mp3 to al html5-friendly formats: wav, ogg, mp3. Requires ffmpeg to be installed globally and available via `ffmpeg`.
#!/bin/bash
printf "This baby converts your folder of .wav, .ogg, and .mp3 files into all the formats needed for HTML5 audio!\n\n"
printf "Usage: cd /folder/to/files && sh path/to/convertAudio.sh\n\n"
printf "Defaults to 128k bitrate.\n\n"
echo "Choose what format are your files in:"
echo "1) wav"
echo "2) ogg"
echo "3) mp3"