This file contains hidden or 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
// Main.scala | |
class C { | |
var x = 0 | |
} | |
object Main extends App { | |
val c = new C() | |
println("c = " + c.x) | |
} |
This file contains hidden or 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
" version control blame of selected lines | |
"vmap <Leader>b :<C-U>!svn blame <C-R>=expand("%:p") <CR> \| sed -n <C-R>=line("'<") <CR>,<C-R>=line("'>") <CR>p <CR> | |
vmap <Leader>g :<C-U>!git blame <C-R>=expand("%:p") <CR> \| sed -n <C-R>=line("'<") <CR>,<C-R>=line("'>") <CR>p <CR> | |
vmap <Leader>h :<C-U>!hg blame -fu <C-R>=expand("%:p") <CR> \| sed -n <C-R>=line("'<") <CR>,<C-R>=line("'>") <CR>p <CR> |
This file contains hidden or 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 com.google.inject.AbstractModule; | |
import com.google.inject.Guice; | |
import com.google.inject.Inject; | |
import com.google.inject.name.Named; | |
import com.google.inject.name.Names; | |
import java.io.FileInputStream; | |
import java.io.IOException; | |
import java.util.Properties; |
This file contains hidden or 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 argparse | |
import mmap | |
import random | |
def get_line_count(filename): | |
linecount = 0 | |
with open(args.filename, "r+b") as f: | |
mm = mmap.mmap(f.fileno(), 0, prot=mmap.PROT_READ) |
This file contains hidden or 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
/** | |
* Black magic to tell sbt to choose the first duplicate class when resolving dependency collisions instead of just | |
* failing out. | |
*/ | |
mergeStrategy in assembly <<= (mergeStrategy in assembly) { | |
(old) => { | |
case x if Assembly.isConfigFile(x) => | |
MergeStrategy.concat | |
case PathList(ps@_*) if Assembly.isReadme(ps.last) || Assembly.isLicenseFile(ps.last) => | |
MergeStrategy.rename |
This file contains hidden or 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
package main | |
import "fmt" | |
import "net/http" | |
import "io/ioutil" | |
import "encoding/json" | |
func main() { | |
resp, err := http.Get("https://graph.facebook.com/sproutsocialinc") |
This file contains hidden or 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
package main | |
import "fmt" | |
import "time" | |
func consume(c chan int) { | |
for { | |
fmt.Println("sleeping for a second...") | |
time.Sleep(1000 * time.Millisecond) | |
fmt.Println("consumed:", <-c) |
This file contains hidden or 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
# NOTE: the hide('warnings', 'running', 'stdout', 'stderr') quiets the | |
# dumping of the commands fabric runs and its responses, which I find | |
# rather annoying. | |
def is_running(pidfile, pidpath): | |
with cd(pidpath): | |
if exists(pidfile): | |
with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True): | |
return run('ps -p $(cat %s) --no-header' % pidfile).succeeded | |
else: |
This file contains hidden or 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 | |
# Will create a table in JIRA markup from a tab-delimited copy-paste buffer from | |
# SequelPro so you can embed a SQL query results easily in a JIRA ticket in table | |
# form. | |
pbpaste | tr '\t' '|' | sed 's/^/|/' | sed 's/$/|/' | pbcopy |
This file contains hidden or 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
# | |
# Put your-service.conf in /etc/init/your-service.conf | |
# | |
# Then tell upstart about your new service: | |
# $ sudo initctl reload-configuration | |
# | |
# Then these commands all work as expected: | |
# $ sudo start your-service | |
# $ sudo stop your-service | |
# $ sudo status your-service |