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
from base64 import b64decode | |
import struct | |
from zlib import crc32 | |
b64alphabet = [] | |
b64alphabet.extend([chr(x) for x in range(ord('A'),ord('Z')+1)]) | |
b64alphabet.extend([chr(x) for x in range(ord('a'),ord('z')+1)]) | |
b64alphabet.extend([chr(x) for x in range(ord('0'),ord('9')+1)]) | |
b64alphabet.extend(['+', '/']) |
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
''' | |
Usage: python getHeart.py YOURCODE [email protected] someregex | |
The "someregex" matches against the link text. | |
For instance: | |
* "flac" will get all the FLAC downloads | |
* "flac|VIDEO" will get FLAC and video | |
and so on. | |
''' | |
import os |
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
load("ode.jl") | |
#load("winston.jl") | |
msdsys(t,y,m,b,k,Fext,xoff) = [0 1; -k./m b./m]*y + [0 0; sin(t.^2)./m k./m]*[Fext xoff]' | |
msdsys(t,y) = msdsys(t, y, 5, -0.5, 50, 0, 0) | |
function msd_analytic(t, m, b, k, x0) | |
wn = sqrt(k./m) | |
zeta = -b./m./2./wn | |
wd = wn.*sqrt(1-zeta.^2) |
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
module Total where | |
import Data.Char | |
import System.IO | |
main = do | |
contents <- readFile "numbers.txt" | |
print $ add_up contents | |
add_up :: String -> Double |
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
# in http://dmbates.blogspot.com/2012/03/pk-models-in-r-and-in-julia.html I describe | |
# the motivation behind these functions. The test data is extracted from an R data set | |
# Use semicolons between elements to ensure this is a vector | |
Time = [0; 0.25; 0.57; 1.12; 2.02; 3.82; 5.1; 7.03; 9.05; 12.12; 24.37; 0; 0.27; 0.52; 1; 1.92; 3.5; 5.02; 7.03; 9; 12; 24.3; 0; 0.27; 0.58; 1.02; 2.02; 3.62; 5.08; 7.07; 9; 12.15; 24.17; 0; 0.35; 0.6; 1.07; 2.13; 3.5; 5.02; 7.02; 9.02; 11.98; 24.65; 0; 0.3; 0.52; 1; 2.02; 3.5; 5.02; 7.02; 9.1; 12; 24.35; 0; 0.27; 0.58; 1.15; 2.03; 3.57; 5; 7; 9.22; 12.1; 23.85; 0; 0.25; 0.5; 1.02; 2.02; 3.48; 5; 6.98; 9; 12.05; 24.22; 0; 0.25; 0.52; 0.98; 2.02; 3.53; 5.05; 7.15; 9.07; 12.1; 24.12; 0; 0.3; 0.63; 1.05; 2.02; 3.53; 5.02; 7.17; 8.8; 11.6; 24.43; 0; 0.37; 0.77; 1.02; 2.05; 3.55; 5.05; 7.08; 9.38; 12.1; 23.7; 0; 0.25; 0.5; 0.98; 1.98; 3.6; 5.02; 7.03; 9.03; 12.12; 24.08; 0; 0.25; 0.5; 1; 2; 3.52; 5.07; 7.07; 9.03; 12.05; 24.15] | |
# Or use the columnization indexing trick, this also work |
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
type Link | |
name::String | |
linkFun::Function | |
linkInv::Function | |
muEta::Function | |
end | |
type Dist | |
name::String | |
variance::Function |
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
# Sample of struct.jl: Reading a .png header | |
load("struct.jl") | |
fpng = open(ARGS[1]) | |
# check the signature | |
signature = unpack(s"BcccBBBB", fpng) | |
@assert isequal(signature, struct(s"BcccBBBB", 0x89, 'P', 'N', 'G', 0x0D, 0x0A, 0x1A, 0x0A)) | |
# read the header |
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
VLRU w/MRU at vector end (same timings as 240590 but with this explanatory note) | |
UnboundedVLRU(), 50 items | |
Assignment: | |
elapsed time: 0.09535598754882812 seconds | |
Lookup, random access: | |
elapsed time: 0.015466928482055664 seconds | |
Random mixed workload: | |
elapsed time: 0.0009279251098632812 seconds | |
UnboundedVLRU(), 500 items | |
Assignment: |
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
LLRU | |
UnboundedLLRU(), 50 items | |
Assignment: | |
elapsed time: 0.09373784065246582 seconds | |
Lookup, random access: | |
elapsed time: 0.018180131912231445 seconds | |
Random mixed workload: | |
elapsed time: 0.0008568763732910156 seconds | |
UnboundedLLRU(), 500 items | |
Assignment: |