Skip to content

Instantly share code, notes, and snippets.

View vincentchu's full-sized avatar

Vincent Chu vincentchu

View GitHub Profile
def someFuture(input: String): Future[String] = {
val promise = new Promise[String]
val javaFuture = someJavaFutureMethod(input)
// Use Timer to periodically check for return value of
timer.schedule(10.millis) {
if (javaFuture.isDone()) {
// Probably glossing over some edge cases around setting interrupts, timeouts, etc.. but you get the gist
░░░░░░░░░▄░░░░░░░░░░░░░░▄ Wow
░░░░░░░░▌▒█░░░░░░░░░░░▄▀▒▌
░░░░░░░░▌▒▒█░░░░░░░░▄▀▒▒▒▐ So serious
░░░░░░░▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐
░░░░░▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐ much asking
░░░▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌ Wow
░░▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌
░░▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐ very wonder
░▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌
░▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌ no joke
@vincentchu
vincentchu / matplotlib.py
Created June 14, 2013 04:12
Playing with matplotlib
rcOpts = {'figure.figsize': (6.0,4.0),
# play nicely with white background in the Qt and notebook frontend
'figure.facecolor': 'white',
'figure.edgecolor': 'white',
# 12pt labels get cutoff on 6x4 logplots, so use 10pt.
'font.size': 10,
# 72 dpi matches SVG/qtconsole
# this only affects PNG export, as SVG has no dpi setting
'savefig.dpi': 72,
@vincentchu
vincentchu / pom.xml
Created May 31, 2013 06:19
base pom file for some projects
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.vincentchu</groupId>
<artifactId>finagle-exp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>My Web App</description>
<inceptionYear>2013</inceptionYear>
<url>http://github.com/path/to/project</url>
#!/bin/bash
$@
CODE=$?
if [ "$CODE" = "0" ]
then
growlnotify --image /Users/vince/bin/images/doom_succ.png --message "$1" Command Succeeded!
else
import random
positions = [0, 1, 2, 3]
# Represents sequence ACTG
bases = {
0: "A",
1: "C",
2: "T",
3: "G"
vince@local → git commit -a
[0b51f2f] DON'T FUCKING TOUCH THIS -- BUILD IS STABLE DAMMIT GERGHAFDKJ H
4 files changed, 5 insertions(+), 4 deletions(-)
U R S A M O S H E P A L L
S A I S E A T E N A R I A
E G G S A T I L T I T E M
R U N O F T H E M I L L
C A L S E R E P A M
C A P I T O L T E A A V E
A R E A A I R P U R E R
B O L T O F L I G H T N I N G
L U T E S D O E S A G E
E S E A D S B L A T H E R
@vincentchu
vincentchu / gist:3006896
Created June 27, 2012 21:14
maven.sublime-build
{
"cmd": ["mvn", "clean", "compile"],
"working_dir": "${project_path:${folder}}",
"file_regex": "\\[ERROR\\] (\\/.*?):(\\d+):() (.*?)$"
}
@vincentchu
vincentchu / grr.sh
Created April 27, 2012 18:10
Growlnotifies you when your long running command is finished
#!/bin/bash
$@
if [ "$?" = "0" ]
then
growlnotify --image /Users/vince/bin/images/doom_succ.png --message "$1" Command Succeeded!
else
growlnotify --image /Users/vince/bin/images/doom_fail.png --message "$1" Command Failed!
fi