- Julia - http://julialang.org/downloads/
- LLVM, GCC, make etc. - Xcode
- iTerm2 - http://www.iterm2.com/#/section/downloads
- Popcorn Time - http://popcorntime.io/
- Node.js - http://nodejs.org/
- VLC Player - http://www.videolan.org/vlc/index.html
- Git - http://git-scm.com/
- MacTex - http://tug.org/mactex/
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
var alg = require("algorithms"), | |
sort = alg.mergeSort; | |
/* | |
* Huffman coding. | |
* | |
* @api public | |
*/ | |
var huffman = function(alphabet){ |
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 Base.open | |
import Base.close | |
import Base.readlines | |
@vectorize_1arg String open | |
@vectorize_1arg IOStream close | |
@vectorize_1arg IOStream readlines | |
# map a dict into an array | |
function dict_map(f::Function, d::Dict) |
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
importall Base | |
immutable ModInt{N} <: Integer | |
val::Int | |
ModInt(x) = new(mod(x,N)) | |
end | |
-{N}(x::ModInt{N}) = ModInt{N}(-x.val) | |
+{N}(x::ModInt{N}, y::ModInt{N}) = ModInt{N}(x.val + y.val) | |
-{N}(x::ModInt{N}, y::ModInt{N}) = ModInt{N}(x.val - y.val) |
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
macro ordered(ex::Expr) | |
if ex.head == :dict | |
ex.head = :vcat | |
ex.args = map(ex.args) do x | |
:(($(esc(x.args[1])),$(esc(x.args[2])))) | |
end | |
elseif ex.head == :typed_dict | |
ex.head = :vcat | |
shift!(ex.args) | |
ex.args = map(ex.args) do x |
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 | |
for i in {3..229} | |
do | |
curl -s "http://twssstories.com/node?page=$i" | perl -n -e '/"([^"]*)" TWSS/ && print "$1\n"' >> twss_test.txt | |
done | |
cat eng-ca_web_2002_100K-sentences.txt | perl -n -e '/^[0-9]+\s+([A-Z].*\.)$/ && print "$1\n"' | grep " I " >> normal.txt | |
cat eng-uk_web_2002_100K-sentences.txt | perl -n -e '/^[0-9]+\s+([A-Z].*\.)$/ && print "$1\n"' | grep " I " >> normal.txt |
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 m(word::String) | |
str = split(word, "") | |
seeking = true | |
sawvowel = false | |
sawconsonant = false | |
count = 0 | |
for w in str | |
if seeking && isvowel(w) | |
seeking = false |
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 min_edit_distance(a :: String, b :: String) | |
m = length(a) | |
n = length(b) | |
D = Array(Uint, m + 1, n + 1) | |
F = Array(Uint, m + 1, n + 1) | |
for i = 1:m + 1, j = 1:n + 1 | |
D[i, 1] = i - 1 | |
D[1, j] = j - 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Gaussian Distributions</title> | |
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<style> | |
.chart div { | |
background-color: steelblue; | |
font: 10px sans-serif; | |
border: 2px solid white; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<script> | |
navigator.webkitGetUserMedia({audio:true}, function(s){ | |
window.AudioContext = window.AudioContext || window.webkitAudioContext; |