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
| (defn levenshtein [vec1 vec2] | |
| (cond (empty? vec1) (count vec2) | |
| (empty? vec2) (count vec1) | |
| :else | |
| (let [distance (make-array Integer (count vec1) (count vec2))] | |
| (doseq [i (range (count vec1))] | |
| (aset distance i 0 i)) | |
| (doseq [j (range (count vec2))] | |
| (aset distance 0 j j)) | |
| (doseq [i (range 1 (count vec1))] |
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 numpy import argmax | |
| from scipy import arange | |
| from scipy.io import wavfile | |
| from scipy.fftpack import fftfreq, rfft, fftshift | |
| import pylab | |
| sample_rate, signal = wavfile.read("goodnight.wav") | |
| N = len(signal) |
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
| (require '[net.cgrand.enlive-html :as html]) | |
| (defn fetch-url [url] | |
| (html/html-resource | |
| (java.net.URL. url))) | |
| (defn fetch-twss [n] | |
| (drop-last 2 | |
| (map #(second (re-find #"\"(.+?)\"" (html/text %))) | |
| (html/select |
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 re | |
| print [g.start() for g in re.finditer("AT", "CAAATATGAGACATAGACATAGACAGATACG")] | |
| #to match any base (really, any character), use a dot: | |
| print [g.start() for g in re.finditer("G.G", "CAAATATGAGACATAGACATAGACAGAGACG")] | |
| #to match a subgroup: | |
| print [g.start() for g in re.finditer("[AT][AT]", "CAAATATGAGACATAGACATAGACAGAGACG")] |
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
| --- a/Rakefile | |
| +++ b/Rakefile | |
| @@ -163,7 +163,7 @@ desc "deploy public directory to github pages" | |
| task :push do | |
| puts "## Deploying branch to Github Pages " | |
| (Dir["#{deploy_dir}/*"]).each { |f| rm_rf(f) } | |
| - system "cp -R #{public_dir}/ #{deploy_dir}" | |
| + system "cp -R #{public_dir}/* #{deploy_dir}" | |
| puts "\n## copying #{public_dir} to #{deploy_dir}" |
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
| Religiosity negatively correlated with: | |
| - IQ [1] | |
| - Societal health (homicide, suicide, life expectancy) [2] | |
| - hippocampus (part of the brain involved in memory) size [7] | |
| and positively correlated with: | |
| - abortion rates (!) [2] | |
| - poverty [3] | |
| - teen pregnancy [4] |
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
| extern mod std; | |
| fn main() { | |
| let s = @"foo bar baz"; | |
| // similar results with ~"foo bar baz" | |
| // These work | |
| s.substr(1, 5); | |
| s.slice(1,5); |
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 app1; | |
| import std.stdio; | |
| import lib1; | |
| void main() { | |
| add(2,3).println; | |
| } |
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 | |
| cat <<EOF | ftp | |
| open hgdownload.cse.ucsc.edu | |
| anonymous | |
| [email protected] | |
| cd goldenPath/mm9/database | |
| prompt | |
| mget chr*rmsk.txt.gz | |
| bye |
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 os | |
| import psutil | |
| import numpy as np | |
| import sklearn.decomposition | |
| def memory_usage(): | |
| return psutil.Process(os.getpid()).memory_info().rss / 1024 ** 2 | |
| def pca(X): |
OlderNewer