Skip to content

Instantly share code, notes, and snippets.

@liuzhoou
liuzhoou / my git shell prompt
Created February 10, 2009 03:41
my git shell prompt
parse_git_branch() {
RSLT=''
GIT_BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' | awk '{print $2}'`
if [ "$GIT_BRANCH" ]
then
GIT_STATUS=`git status 2> /dev/null | grep 'working directory clean'`
CLR='2'
if [ "$GIT_STATUS" ]
then
CLR='2'
@liuzhoou
liuzhoou / twitter.sh
Created February 24, 2009 07:17
command twitter update
msg=$(echo $@ | sed 's/+/%2B/g;s/ /+/g')
curl --silent --user "username:password" --data-ascii \
"status=$msg" "http://twitter.com/statuses/update.json" > /dev/null
@liuzhoou
liuzhoou / gist:73142
Created March 3, 2009 02:29
Mac finder AppleShowAllFiles
# show all
defaults write com.apple.finder AppleShowAllFiles -bool true
# hidden .
defaults write com.apple.finder AppleShowAllFiles -bool false
POST http://rubyurl.com/api/links
<link>
<website_url>http://github.com/robbyrussell</website_url>
</link>
@liuzhoou
liuzhoou / Greasemonkey
Created April 23, 2009 01:56
Greasemonkey
// ==UserScript==
// @name reload
// @namespace reload
// @description reload pages
// @include http://*
// ==/UserScript==
setTimeout("location.href=window.location.href", 5000);
@liuzhoou
liuzhoou / css hacks
Created July 25, 2009 07:18
css hacks
.e{
color:#FFF;/* FF,OP */
[;color:#0F0;]/* Sa,CH */
color:#FFF\9;/*IE6、7、8*/
*color:#FF0;/* IE7、6 */
_color:#F00;/* IE6 */
}
@media all and(min-width:0){
.e{
background-color:#FF5500;/* OP */
@liuzhoou
liuzhoou / cleanup
Created September 23, 2009 09:05
cleanup
#! /bin/csh -f
rm -rf C*/*/build
rm .DS_Store
rm C*/.DS_Store
rm C*/*/.DS_Store
rm -rf C*/*/*.xcodeproj/ericasadun.*
#!/usr/bin/env ruby
# Script that wraps grabbing and selecting stuff from HTML page via CSS selectors
# Created 2009-10-01 by Jesper Rønn-Jensen, www.justaddwater.dk
#
# For usage, run parsepage.rb without arguments.
#
# Feel free to modify, fork and improve as long as you commit your changes back to me :)
def usage
<<-EOF #.gsub(' ', '')
=== USAGE ===
@liuzhoou
liuzhoou / sendmailforgmail.rb
Created July 19, 2010 09:58
sendmailforgmail
#!/usr/bin/env ruby
#use Unicode
$KCODE = 'u'
require 'jcode'
require 'rubygems'
require 'action_mailer'
require 'tlsmail' #need install tlsmail gem to support TLS connect
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
/*
project: http://github.com/livid/v2ex
file: http://github.com/livid/v2ex/blob/master/static/css/desktop/style.css
*/
#Navigation {
float: right;
text-align: right;
font-size: 14px;
color: #fff;
margin-top: 14px;