Skip to content

Instantly share code, notes, and snippets.

@baopham
baopham / RunScript.scpt
Created February 22, 2012 18:29
Textmate's Python bundle modified script to run in iTerm
#!/bin/bash
TPY=${TM_PYTHON:-python}
esc () {
STR="$1" ruby <<"RUBY"
str = ENV['STR']
str = str.gsub(/'/, "'\\\\''")
str = str.gsub(/[\\"]/, '\\\\\\0')
print "'#{str}'"
RUBY
@baopham
baopham / autovivification.py
Created April 18, 2012 17:45
Python Autovivification
class AutoVivification(dict):
"""Implementation of perl's autovivification feature."""
def __getitem__(self, item):
try:
return dict.__getitem__(self, item)
except KeyError:
value = self[item] = type(self)()
return value
a = AutoVivification()
@baopham
baopham / Monaco for Powerline.otf
Last active April 16, 2023 03:57
Patched font Monaco for OSX Vim-Powerline
@baopham
baopham / PDFMerger.java
Created May 9, 2012 22:37
Serve merged PDF on servlet
package testPackage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.itextpdf.text.Document;
@baopham
baopham / .gitconfig
Last active November 10, 2016 05:39
.gitconfig
; GistID: 4223990
[user]
name = Bao Pham
email = "(none)"
[github]
user = baopham
[color]
ui = auto
branch = auto
diff = auto

Keybase proof

I hereby claim:

  • I am baopham on github.
  • I am baopham (https://keybase.io/baopham) on keybase.
  • I have a public key whose fingerprint is 7E4B 6841 4C2F 3D3A 29F0 5F92 55A5 06F4 9EB1 1FE1

To claim this, I am signing this object:

@baopham
baopham / git_commands.md
Created February 23, 2012 19:32
git commands notes

To delete a commit

Assuming you are sitting on that commit

git reset --hard HEAD~1

Or

#
# Sets Prezto options.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
#
# General
#
@baopham
baopham / .zshenv
Created March 19, 2013 08:39
zshenv for Prezto
#
# Defines environment variables.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# GistID: 5194548
#
# Browser
@baopham
baopham / .ackrc
Created December 24, 2012 22:39
.ackrc
# GistID: 4370896
# Only search with case sensitivity if there is mixed case
--smart-case
# Follow symlinks
--follow
# Colors
--color-filename=bold green