Skip to content

Instantly share code, notes, and snippets.

@baopham
baopham / Monaco for Powerline.otf
Last active April 16, 2023 03:57
Patched font Monaco for OSX Vim-Powerline
@baopham
baopham / gist:1868420
Created February 20, 2012 08:27
FizzBuzz oneliner
#Rosetta Code
for x in range(1, 101):
print ''.join(['' if x%3 else 'fizz', '' if x%5 else 'buzz']) or x
@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 / .bashrc
Created February 22, 2012 18:34
.bashrc
# Show git branch in bash prompt
__git_ps1 ()
{
local b="$(git symbolic-ref HEAD 2>/dev/null)";
if [ -n "$b" ]; then
printf " (%s)" "${b##refs/heads/}";
fi
}
alias la='ls -A'
alias ll='ls -l'
@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

@baopham
baopham / mvim.sh
Created February 23, 2012 20:32
Modified mvim script to have options of opening files in tabs or new windows
#!/bin/sh
#
# This shell script passes all its arguments to the binary inside the
# MacVim.app application bundle. If you make links to this script as view,
# gvim, etc., then it will peek at the name used to call it and set options
# appropriately.
#
# Based on a script by Wout Mertens and suggestions from Laurent Bihanic. This
# version is the fault of Benji Fisher, 16 May 2005 (with modifications by Nico
# Weber and Bjorn Winckler, Aug 13 2007).
@baopham
baopham / .bash_profile
Created February 23, 2012 20:35
bash_profile
# bash prompt
if [ -n "$SSH_CONNECTION" ] ; then
export PS1="\[\033[G\]\[\033[0;32m\]\u@\h\[\033[0;32m\] \w\$(__git_ps1) \$\[\033[00m\] "
else
if [ "$USER" != "baopham" ] ; then
export PS1="\[\033[G\]\[\033[0;32m\]\u \w\$(__git_ps1) \$\[\033[00m\] "
else
export PS1="\[\033[G\]\[\033[0;32m\]\w\$(__git_ps1) \$\[\033[00m\] "
fi
fi
@baopham
baopham / bash_completion.sh
Created April 1, 2012 01:12
bash_completion
#
# bash_completion - programmable completion functions for bash 3.2+
#
# Copyright © 2006-2008, Ian Macdonald <[email protected]>
# © 2009-2011, Bash Completion Maintainers
# <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
@baopham
baopham / .git-completion.sh
Created April 1, 2012 01:13
git-completion
#!bash
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@baopham
baopham / .osx
Created April 4, 2012 17:45
Defaults commands for OSX
# GistID: 2304197
# Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# Enable subpixel font rendering on non-Apple LCDs
defaults write NSGlobalDomain AppleFontSmoothing -int 2
# Enable the 2D Dock
defaults write com.apple.dock no-glass -bool true