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
scala> val x: PartialFunction[String, Unit] = { case "foo" => println("Foo") } | |
x: PartialFunction[String,Unit] = <function1> | |
scala> x("foo") | |
Foo | |
scala> x("bar") | |
scala.MatchError: bar | |
scala> val y: PartialFunction[String, Unit] = { case "bar" => println("Bar") } |
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
// The way Scala for-comprehensions work is that: | |
for (x <- c) f(x) | |
// simply translates to: | |
c.foreach(x => f(x)) | |
// Likewise: |
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 ruby | |
if ARGV.size < 2 | |
$stderr.puts 'usage: monitor <path> <command> [arg1 arg2 ...]' | |
exit 100 | |
end | |
PATH = ARGV[0] | |
COMMAND = ARGV[1] | |
ARGS = ARGV[2..-1] |
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
easterEgg.BadWorder.list={ | |
"4r5e":1, | |
"5h1t":1, | |
"5hit":1, | |
a55:1, | |
anal:1, | |
anus:1, | |
ar5e:1, | |
arrse:1, | |
arse:1, |
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 ruby -w | |
# brew-services(1) - Easily start and stop formulas via launchctl | |
# =============================================================== | |
# | |
# ## SYNOPSIS | |
# | |
# [<sudo>] `brew services` `list`<br> | |
# [<sudo>] `brew services` `restart` <formula><br> | |
# [<sudo>] `brew services` `start` <formula> [<plist>]<br> |
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 | |
import gevent.monkey | |
gevent.monkey.patch_all() | |
import boto | |
import config | |
import gevent | |
import gevent.pool | |
import os |
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(d) { | |
var dl = d.createElement('a'); | |
dl.innerText = 'Download MP3'; | |
dl.href = "http://media.soundcloud.com/stream/"+d.querySelector('#main-content-inner img[class=waveform]').src.match(/\.com\/(.+)\_/)[1]; | |
dl.download = d.querySelector('em').innerText+".mp3"; | |
d.querySelector('.primary').appendChild(dl); | |
dl.style.marginLeft = '10px'; | |
dl.style.color = 'red'; | |
dl.style.fontWeight = 700; | |
})(document); |
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 sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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 | |
""" | |
simple example script for running notebooks and reporting exceptions. | |
Usage: `checkipnb.py foo.ipynb [bar.ipynb [...]]` | |
Each cell is submitted to the kernel, and checked for errors. | |
""" | |
import os,sys,time |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
OlderNewer