Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Sam Ritchie sritchie

🎯
Focusing
View GitHub Profile
View pallet-vmfest.txt
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)
View pallet-vmfest.md
  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)
    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)
View money.clj
(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]
View gist:1112505
(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 Oct 2, 2011 — forked from sorenmacbeth/shaper_tests.clj
the first fact using provided suceeds, but the second using against-background fails
View shaper_tests.clj
(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"
View Is there a way to pass a cascalog variable to limit or first-n
(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))))
View Is there a way to pass a cascalog variable to limit or first-n
(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
View gist:1592781
(defn drop-every-nth
[n coll]
(keep-indexed (fn [idx val]
(when (pos? (mod (inc idx) n))
val))
coll))
@sritchie
sritchie / gist:1627929
Created Jan 17, 2012 — forked from danhammer/gist:1627819
timing matrix multiplication
View gist:1627929
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 Jan 17, 2012 — forked from danhammer/gist:1627807
timing matrix multiplication
View matrix.py
(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"
You can’t perform that action at this time.