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 | |
# | |
# Usage: | |
# ./github_numstat.sh https://github.com/YOUR_ORG/some_repo.git | |
# | |
# Batch Usage with GitHub: | |
# time curl -s -H "Authorization: token YOUR_TOKEN" https://api.github.com/orgs/YOUR_ORG/repos | grep ssh_url | sed 's/.*: [^"]*"\([^"]*\).*/\1/' | xargs -I {} -P 10 ./github_numstat.sh {} | |
# # delete unwanted repos (like unused forks) from the 'git_numstat' by simply deleting the appropriate lines | |
# cat git_numstat | awk '/^[0-9]/ { inserted += $1; removed += $2 } END { print inserted - removed " total lines. " inserted " inserted, " removed " removed" }' |
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
((fn [s] (print (list s (list (quote quote) s)))) (quote (fn [s] (print (list s (list (quote quote) s)))))) |
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
[unfiltered] (master)$ sbt -mem 3500 | |
Detected sbt version 0.13.0 | |
Starting sbt: invoke with -help for other options | |
Using /Users/toby/.sbt/0.13.0 as sbt dir, -sbt-dir to override. | |
[info] Loading project definition from /Users/toby/work/scala/unfiltered/project | |
[warn] Multiple resolvers having different access mechanism configured with same name 'sbt-plugin-releases'. To avoid conflict, Remove duplicate project resolvers (`resolvers`) or rename publishing resolver (`publishTo`). | |
[info] Set current project to Unfiltered (in build file:/Users/toby/work/scala/unfiltered/) | |
[info] Defining */*:logLevel | |
[info] The new value will be used by no settings or tasks. | |
[info] Reapplying settings... |
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 | |
# encoding: utf-8 | |
""" | |
cmsketch.py | |
An implementation of count-min sketching from the paper due to Cormode and | |
Muthukrishnan 2005 | |
""" |
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
object Plugins extends Build { | |
lazy val plugins = Project("root", file(".")) | |
.dependsOn(uri("git://github.com/your-org/your-project.git#0.8")) | |
} |
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 Foo(value: String = "default") | |
object Foo extends Foo("object here") { | |
println("companion object loaded!!!") | |
} | |
class Bar extends Foo | |
class Baz extends Foo("this works") |
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 MySpec extends org.specs2.mutable.Specification { | |
def serviceSpec[T](spec: JobTrackingService => T): T = MyDatabase.withTransaction { db => | |
val svc = new MyService | |
spec(svc) | |
} | |
"service" should { | |
"test using transactions" in serviceSpec { svc => | |
svc.foo must_== "foo" | |
} |
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
function! CommaFormatNumber() | |
" 0. start position is in current word. We assume we are in normal mode. | |
" Use 'viw' to visually select the word as a hack to move the cursor to the | |
" end of the current word (prevents accidentally moving off the number). | |
" 1. go mark the beginning of the number | |
" 2. go mark the end of the number | |
" 3. apply the search/replace-with-commas the correct number of times. | |
exe "normal viw\<Esc>bmaemb" | |
let startpos = getpos("'a")[2] | |
let endpos = getpos("'b")[2] |
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
" Find current word scala main sources. | |
" Requires Ack plugin. | |
function! FindUsagesScala() | |
:Ack --scala -G main -w <cword> | |
endfunction | |
nmap <F7> :call FindUsagesScala()<CR> |
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 | |
lsof -a -p $1 -d cwd -Fn | tail -1 | sed 's/.//' |