This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# works on osx | |
bind '"\e[A": history-search-backward' | |
bind '"\e[B": history-search-forward' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "httpclient" | |
require "nokogiri" | |
require "pp" | |
hc = HTTPClient.new(:agent_name => "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.4) Firefox/1.5.0.4") | |
(1..2000).each { |i| | |
puts i.to_s + ":" | |
res = hc.get('http://www.v2ex.com/uid/' + i.to_s, :follow_redirect => true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
svn merge -c -[revision number] http://[svn address]/[file path on svn] [local file] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NAME=me | |
palm-generate -p "{'id':'com.$NAME.hello$1', 'version':'1.0.0', 'vendor':'$NAME', 'title':'Hello world'}" HelloWorld$1 | |
palm-package HelloWorld$1 | |
rm -r HelloWorld$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ANDROID_TOOLS_DIR=[android tools dir] | |
NAME=Me | |
mkdir $NAME$1 | |
$ANDROID_TOOLS_DIR/android -s create project --target 18 --name $NAME$1 --path $NAME$1 --activity $NAME$1 --package com.$NAME.android$1 | |
cd $NAME$1 | |
sed -i 's/android:versionName="1\.0"/android:versionName="1\.0\.0"/g' AndroidManifest.xml # force the version name three parts | |
sed -i '6i\\t\<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="15" android:maxSdkVersion="15" />' AndroidManifest.xml # add sdk versions | |
sed -i '7i\\t\<compatible-screens>\n\t\t\<screen android:screenSize="small" android:screenDensity="ldpi" />\n\t\t\<screen android:screenSize="small" android:screenDensity="mdpi\" />\n\t\t\<screen android:screenSize="small" android:screenDensity="hdpi" />\n\t\t\<screen android:screenSize="small" android:screenDensity="xhdpi" />\n\t\t\<screen android:screenSize="normal" android:screenDensity="ldpi" />\n\t\t\<screen android:screenSize="normal" android:screenDensity="mdpi" />\n\t\t\<screen android:screenSize="normal" android:s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'inotify' | |
require 'find' | |
require 'pp' | |
i = Inotify.new | |
t = Thread.new do | |
i.each_event do |ev| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import pyinotify | |
import sys | |
class MyEventHandler(pyinotify.ProcessEvent): | |
def process_IN_ACCESS(self, event): | |
print "ACCESS event:", event.pathname | |
def process_IN_ATTRIB(self, event): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff file file2 > ~/$(date '%F').diff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ps aux|grep "/usr/bin/php"|wc -l|awk '{print $1-1}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f | xargs ls -s | sort -rn | head |