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
public static List<Status> findReplies() { | |
Query query = new Query("iluzcit"); | |
List<Status> tweets = new ArrayList<Status>(); | |
Twitter twitter = new TwitterFactory().getInstance(); | |
try { | |
QueryResult result; | |
do { | |
result = twitter.search(query); |
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
# contents of ~/.gitconfig file | |
[user] | |
name = my user name | |
email = my email | |
[http] | |
sslVerify = false | |
[alias] | |
tree = log --graph --decorate --pretty=oneline --abbrev-commit |
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
class PhoneNumberFormat { | |
public static void main (String[] args) { | |
System.out.println("21436587".replaceAll("^([0-9]{4,5})[^0-9]*([0-9]{4})$", "$1-$2")); // outputs "2143-6587" | |
System.out.println("2143-6587".replaceAll("^([0-9]{4,5})[^0-9]*([0-9]{4})$", "$1-$2")); // outputs "2143-6587" | |
System.out.println("921436587".replaceAll("^([0-9]{4,5})[^0-9]*([0-9]{4})$", "$1-$2")); // outputs "92143-6587" | |
System.out.println("92143-6587".replaceAll("^([0-9]{4,5})[^0-9]*([0-9]{4})$", "$1-$2")); // outputs "92143-6587" | |
} | |
} |
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
<?php | |
if (preg_match('/^([a-zA-Z\[\]]+)\s*=\s*(.+)$/', $line, $matches)) { | |
// $matches[0]: whole line matched | |
// $matches[1]: property name | |
// $matches[2]: property value | |
} |
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/bash | |
BASE_DIR=`pwd` | |
for D in $(find . -mindepth 1 -maxdepth 1 -type d) ; do | |
cd $BASE_DIR/$D; | |
echo "Updating git repository at $D" | |
git pull | |
done |
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
alias pysyntaxcheck="python -m py_compile" | |
# Usage: pysyntaxcheck /path/to/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
#!/usr/bin/env bash | |
FOLDER=$1 | |
if [ -z "$FOLDER" ]; then | |
echo "Usage: cleanup-bulkloader-logs.sh </path/to/dir>" | |
exit 1 | |
fi | |
echo "Recursively cleaning up bulkloader-log* files under ${FOLDER}" |
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
# 1/0.25 reduces video velocity by 4. 1/2 would double the velocity. | |
avconv -i <video-in> -vf "setpts=(1/0.25)*PTS" <video-out> |
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
avconv -i <video-in> -acodec mp2 <video-out> |
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
alias adb-kill-monkey=$'adb shell ps | awk \'/com\.android\.commands\.monkey/ { system("adb shell kill " $2) }\'' |
OlderNewer