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
apply plugin: 'java' | |
apply plugin: 'scala' | |
// For those using Eclipse or IntelliJ IDEA | |
apply plugin: 'eclipse' | |
apply plugin: 'idea' | |
def findPlay20(){ | |
def pathEnvName = ['PATH', 'Path'].find{ System.getenv()[it] != null } | |
for(path in System.getenv()[pathEnvName].split(File.pathSeparator)){ | |
for(playExec in ['play.bat', 'play.sh', 'play']){ |
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 Serializer { | |
public static byte[] serialize(Object obj) throws IOException { | |
ByteArrayOutputStream b = new ByteArrayOutputStream(); | |
ObjectOutputStream o = new ObjectOutputStream(b); | |
o.writeObject(obj); | |
return b.toByteArray(); | |
} | |
public static Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException { | |
ByteArrayInputStream b = new ByteArrayInputStream(bytes); |
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
mkdir $BRANCH | |
cd $BRANCH | |
git init | |
git remote add -t $BRANCH -f origin $REMOTE_REPO | |
git checkout $BRANCH |
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
$ git clone [email protected]:username/username.github.com.git | |
$ cd username.github.com | |
$ git checkout source | |
$ mkdir _deploy | |
username.github.com$ cd _deploy | |
username.github.com/_deploy$ git init | |
username.github.com/_deploy$ git remote add origin [email protected]:username/username.github.com.git | |
username.github.com/_deploy$ git pull origin master |
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 time | |
start = time.time() | |
tic = lambda: 'at %1.1f seconds' % (time.time() - start) |
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 multithreaded operations using concurrent.futures. | |
# | |
# The concurrent.futures library was introduced in Python 3.2, but if you want to run it in 2.x, | |
# you can download the backport of this library from http://pypi.python.org/pypi/futures | |
# | |
from concurrent.futures import ThreadPoolExecutor | |
import requests |
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
from operator import itemgetter | |
a = [('Ant', 1), ('Elephant', 2), ('Cow', 3), ('Deer', 4)] | |
print "List sorted according to animal name: ", sorted(a, key=itemgetter(0,1)) | |
print "List sorted according to number: ", sorted(a, key=itemgetter(1,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
{ | |
"color_scheme": "Packages/User/Tomorrow-Night.tmTheme", | |
"detect_slow_plugins": false, | |
"draw_white_space": "all", | |
"find_selected_text": true, | |
"fold_buttons": false, | |
"folder_exclude_patterns": | |
[ | |
".svn", | |
".git", |
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 datetime | |
datetime.datetime.utcnow().replace(microsecond=0) | |
#Example Output: datetime.datetime(2013, 4, 18, 8, 23, 29) |
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 | |
d1 = dict(a=1, b=2, c=3) | |
d2 = dict(d=4, e=5, d=6) | |
dict_new = dict(d1, **d2) | |
print dict_new |
OlderNewer