Skip to content

Instantly share code, notes, and snippets.

View sritchie's full-sized avatar
🎯
Focusing

Sam Ritchie sritchie

🎯
Focusing
View GitHub Profile
1. Install VirtualBox on your machine
2. Disable login credential: $ VBoxManage setproperty websrvauthlibrary null
3. Download and uncompress the following image https://s3.amazonaws.com/vmfest-images/ubuntu-10-10-64bit-server.vdi.gz
4. Clone the image to the directory where you want it to be permanently stored and make it immutable:
* $ VBoxManage clonehd /path/to/downloaded/ubuntu-10-10-64bit-server.vdi /path/to/permanent/location/ubuntu...-server.vdi
* This should produce a uuid for your new image. Keep it around
* $ VBoxManage modifyhd /path/to/permanent/location/ubuntu-10-10-64bit-server.vdi --type immutable
5. Start VirtualBox (the GUI) and
1. Create an new image Linux - Ubuntu (64bit)
2. Select "Use existing hard disk" and if your newly cloned image doesn't appear in the drop-down list, click on the folder icon and find the image in your hard disk (the one you just cloned)
  1. Install VirtualBox on your machine
  2. Disable login credential: $ VBoxManage setproperty websrvauthlibrary null
  3. Download and uncompress the following image https://s3.amazonaws.com/vmfest-images/ubuntu-10-10-64bit-server.vdi.gz
  4. Clone the image to the directory where you want it to be permanently stored: $ VBoxManage clonehd /path/to/downloaded/ubuntu-10-10-64bit-server.vdi /path/to/permanent/location/ubuntu...-server.vdi
    • This should produce a uuid for your new image. Keep it around
  5. Start VirtualBox (the GUI) and:
    1. Create an new image Linux - Ubuntu (64bit)
  6. Select "Use existing hard disk" and if your newly cloned image doesn't appear in the drop-down list, click on the folder icon and find the image in your hard disk (the one you just cloned)
@sritchie
sritchie / money.clj
Created July 10, 2011 16:20 — forked from gfredericks/money.clj
mdeboard
(reduce
(fn [[amount-left coins] denom]
(let [{:keys [mod dividend]} (calc-coins amount-left denom)]
(if (pos? dividend)
[mod (assoc coins denom dividend)]
[amount-left coins])))
[amount {}]
denoms)
(fn [[amount {}] 20]
(defn do-join [root]
(let [common ["!pub" "!datestr" "!country" "!region" "!city" "!kw" "!ref" "!url"]
zeroed ["?pageviews" "?landings" "?new-visits" "?return-visits" "?bounces"]
pv (pageviews root)
lnd (landings root)
nv (new-visits root)
rv (return-visits root)
b (bounces root)]
(<- [?json]
(pv :>> (conj common !!pvs))
@sritchie
sritchie / shaper_tests.clj
Created October 2, 2011 21:06 — forked from sorenmacbeth/shaper_tests.clj
the first fact using provided suceeds, but the second using against-background fails
(ns ybot.shaper-tests
(:use cascalog.api
ybot.analytics.yb.shaper
[ybot datastores]
[midje sweet cascalog]))
(let [tag-data [["jmblog"
"07409273223006096"
"http://www.optimizeandprophesize.com/jonathan_mendezs_blog/2007/02/optimize_your_y.html"
"United States"
(defn top-n-seq [sample-name n]
(let [aa-seq-fields ["?aa" "?v" "?j" "?sn" "?nc" "?c" "?nf" "?rf" "?cdr3"]
sample-name-seqs (<- aa-seq-fields
(aa-seqs :>> aa-seq-fields)
(= ?sn sample-name))]
(<- aa-seq-fields ((c/first-n sample-name-seqs n :sort ["?nc"] :reverse true)
:>> aa-seq-fields))))
(defn top-n-seq [sample-name n]
(let [aa-seq-fields ["?aa" "?v" "?j" "?sn" "?nc" "?c" "?nf" "?rf" "?cdr3"]
sample-name-seqs (<- aa-seq-fields
(aa-seqs :>> aa-seq-fields)
(= ?sn sample-name))]
(<- aa-seq-fields ((c/first-n sample-name-seqs n :sort ["?nc"] :reverse true)
:>> aa-seq-fields))))
(let [aa-seq-fields ["?aa" "?v" "?j" "?sn" "?nc" "?c" "?nf" "?rf" "?cdr3"]]
(?<- (stdout) aa-seq-fields
(defn drop-every-nth
[n coll]
(keep-indexed (fn [idx val]
(when (pos? (mod (inc idx) n))
val))
coll))
@sritchie
sritchie / gist:1627929
Created January 17, 2012 18:16 — forked from danhammer/gist:1627819
timing matrix multiplication
import numpy as np
def test_my_mult(n):
A = np.random.rand(n*23).reshape(n,23)
At = A.T
t0 = time.time()
res = np.dot(A.T, A)
print time.time() - t0
print np.shape(res)
@sritchie
sritchie / matrix.py
Created January 17, 2012 18:11 — forked from danhammer/gist:1627807
timing matrix multiplication
(defn feature-vec [n]
(map (partial cons 1)
(for [x (range n)]
(take 22 (repeatedly rand)))))
(defn dot-product [x y]
(reduce + (map * x y)))
(defn transpose
"returns the transposition of a `coll` of vectors"