Skip to content

Instantly share code, notes, and snippets.

@baopham
baopham / cmd.md
Created May 7, 2012 20:23
Command Line Notes

List Process IDs for a specific port

lsof -w -n -i tcp:8080

Hide/Show file on OSX

chflags hidden ~/Library
chflags nohidden ~/Library

@baopham
baopham / custom.theme
Created May 23, 2012 05:34
Custom theme for bpython in dark terminal
[syntax]
keyword = y
name = c
comment = m
string = g
error = r
number = G
operator = Y
punctuation = y
token = C
@baopham
baopham / password.module
Created May 25, 2012 22:46
Drupal module to remove forgotten password link
<?php
// $Id$
/**
* @file
* Module to remove the forgotten password link
*/
/**
@baopham
baopham / modal.html
Created May 28, 2012 19:35
Popup form -JQuery UI
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.20/themes/base/jquery-ui.css" type="text/css" media="all" />
<link rel="stylesheet" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css" type="text/css" media="all" />
<style>
body { font-size: 62.5%; }
label, input { display:block; }
input.text { margin-bottom:12px; width:95%; padding: .4em; }
fieldset { padding:0; border:0; margin-top:25px; }
@baopham
baopham / firstUniqueChar.py
Created June 1, 2012 17:21
Get first unique character - Python one liner
def firstUniqueChar(st):
return [x for x in list(st) if list(st).count(x) == 1][0]
print firstUniqueChar("chickheni")
@baopham
baopham / apache.md
Created June 5, 2012 17:14
Apache notes

To set up a new domain name

$ sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mynewsite
  • Change the line DocumentRoot /var/www/ to DocumentRoot /var/www/mynewsite

  • Create an alias in /etc/apache2/sites-enabled:

@baopham
baopham / Messages.applescript
Created July 28, 2012 07:33
Quicksilver + Messages
using terms from application "Quicksilver"
on process text im_text
set im_command to parseCommand(im_text)
runCommand(contact of im_command, message of im_command)
end process text
end using terms from
on parseCommand(im_text)
repeat with im_delimiter_position from 1 to (length of im_text)
set ch to character im_delimiter_position of im_text
@baopham
baopham / gist:4090093
Created November 16, 2012 19:23
Powerline for Undotree
diff --git a/autoload/Powerline/Matches.vim b/autoload/Powerline/Matches.vim
index 5cce475..3218228 100644
--- a/autoload/Powerline/Matches.vim
+++ b/autoload/Powerline/Matches.vim
@@ -10,4 +10,6 @@ let g:Powerline#Matches#matches = {
\ 'minibufexplorer' : Pl#Match#Add('bufname("%")', '\-MiniBufExplorer\-'),
\ 'tagbar' : Pl#Match#Add('&ft' , 'tagbar'),
\ 'nerdtree' : Pl#Match#Add('&ft' , 'nerdtree'),
+ \ 'undotree' : Pl#Match#Add('bufname("%")', 'undotree'),
+ \ 'diffpanel' : Pl#Match#Add('bufname("%")', 'diffpanel'),
@baopham
baopham / Adium.applescript
Created November 26, 2012 09:02
Adium applescript for Quicksilver
registerGrowl()
using terms from application "Quicksilver"
on process text im_text
set im_command to parseCommand(im_text)
runCommand(command of im_command, message of im_command)
end process text
end using terms from
on parseCommand(im_text)
repeat with im_delimiter_position from 1 to (length of im_text)
@baopham
baopham / prompt_bpm_setup
Created December 7, 2012 04:54
Prezto bpm theme
#
# Based on sorin theme
#
# Authors:
# Bao Pham <gbaopham@gmail.com>
#
# Screenshots:
# http://cl.ly/image/0O3y120B0T1z
# http://cl.ly/image/111H2O170z0Q
#