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
import static java.util.Arrays.*; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Map.Entry; | |
public class Pizza { | |
public static void main(String[] args) { |
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 class Casting { | |
public static void main(String[] args) { | |
// Those below are objects that get autoboxed automatically | |
Integer i = 0; | |
Long l = 0L; | |
Double d = 0D; | |
Float f; | |
Float f2 = 1f; |
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
val map = scala.collection.mutable.HashMap[String,Int]() | |
// populating the Map | |
Range(1,10).foreach(x => map.put(x.toString, x)) | |
//removing all odd elements | |
map retain {(key,value) => value % 2 == 0} |
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
testing: | |
$ ./pants src/java/com/twitter/common/zookeeper:client | |
$ ./pants src/java/com/twitter/common/zookeeper:node | |
$ ./pants src/java/com/twitter/common/zookeeper:map | |
$ ./pants src/java/com/twitter/common/zookeeper:group | |
$ ./pants src/java/com/twitter/common/zookeeper:partitioner | |
$ ./pants src/java/com/twitter/common/zookeeper:candidate | |
$ ./pants src/java/com/twitter/common/zookeeper:lock | |
$ ./pants src/java/com/twitter/common/zookeeper:server-set | |
$ ./pants src/java/com/twitter/common/zookeeper:singleton-service |
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
$ for t in `pants list src/java/com/twitter/common/zookeeper`; do echo && pants depmap -im $t | grep zookeeper; done | |
com.twitter.common.zookeeper-client | |
com.twitter.common.zookeeper-node | |
com.twitter.common.zookeeper-client | |
com.twitter.common.zookeeper-map |
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 | |
# A command to extract PNG files from a MP4 video | |
# Write out 200 png format frames from video starting at 4 minutes, 40 seconds. | |
mplayer -vo png -ss 04:40 -frames 200 dvvideo.mp4 |
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/python | |
# This script converts a WMA file into a MP3 file. | |
# Requisites: mplayer e lame | |
# Disclaimer: it worked last time I checked, but it was a long time ago, | |
# so I put it here just to reference. Use it at your own risk. | |
import os | |
list = os.listdir(".") |
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
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \[\1\]/' | |
} | |
PS1='\[\033[01;37m\]\w\[\033[00;35m\]$(parse_git_branch)\[\033[00m\] \$ ' |
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
# Remove all the .svn directories below the current directory tree | |
# Credit: Zed Shaw, at the Mongrel mailing list. | |
#!/bin/bash | |
find . -name ".svn" -exec rm -rf {} \; |
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
# Register all files that were manually delete on SVN as deleted (sync) | |
#!/bin/bash | |
svn status | grep "^\!" | sed 's/^\! *//g' | xargs svn rm |
OlderNewer