Skip to content

Instantly share code, notes, and snippets.

View dakrone's full-sized avatar

Lee Hinman dakrone

View GitHub Profile
@dakrone
dakrone / core.clj
Created February 25, 2011 02:59
Collapse page results into a lazy-seq that only fetches when needed
(ns lazywindow.core)
;; Lazily fetch page results as needed
;; How many results in a page
(def page-size 5)
(defn get-page*
"Retrieve a vector of results for a page"
[page-num]

The great Stateless merge of 2011

Stateless needs to become the new master somehow/eventually

Have to keep old branches around for hotfixes

We need to keep topic branches around not only for merging into stateless-master, but maybe merging into things like rackspace and webroot until those companies are on the stateless deployment.

Need to merge UA into new master and back into stateless

Have to finish work for elasticsearch on stateless

This is the biggest piece of work

(defcommand catchup [channel args]
(let [msg (format "yum: %s" (doall (remove nil? (map :text (select @db :message nil)))))]
(spit "/tmp/foo.log" msg)
(send-to-client channel 777
msg)))
‹ ~ › ∴ cat /tmp/foo.log
yum: clojure.lang.LazySeq@ebcedf87%
[
%% Riak Core config
{riak_core, [
{web_port, 8098},
{seed, false},
{volume_size, 128},
{web_ip, "10.252.89.235"},
{ring_state_dir, "/mnt/riak/data/ring"},
{cluster_name, "default"},
{stripe_action, create}
#!/bin/env ruby
require 'socket'
count = `curl -s "http://localhost:9200/_count?q=*:*" | cut -d : -f 2 | cut -d , -f 1`.chomp
hostname = 'ec2-50-16-13-174.compute-1.amazonaws.com'
port = 2003
s = TCPSocket.open(hostname, port)
#!/usr/bin/env ruby
tests = 0
assertions = 0
failures = 0
errors = 0
args = ARGV.join(" ")
IO.popen("lein test #{args}").each_line do |line|
29749 @ 3:18am sat
20348 @ 9:37am sun
9401 in that time
12 + 6 = 18 hrs, 19 minutes
18 * 60 + 19 = 1099 minutes
9401 / 1099 =
$ rm -rf ~/.m2/repository/org/clojars/technomancy/clj-stacktrace
$ lein test!
Cleaning up.
[INFO] snapshot org.clojars.technomancy:clj-stacktrace:0.2.1-SNAPSHOT: checking for updates from sun(oracle?)
[INFO] snapshot org.clojars.technomancy:clj-stacktrace:0.2.1-SNAPSHOT: checking for updates from lambda
[INFO] snapshot org.clojars.technomancy:clj-stacktrace:0.2.1-SNAPSHOT: checking for updates from sonatype
[INFO] snapshot org.clojars.technomancy:clj-stacktrace:0.2.1-SNAPSHOT: checking for updates from jboss
[INFO] snapshot org.clojars.technomancy:clj-stacktrace:0.2.1-SNAPSHOT: checking for updates from modularity
[INFO] snapshot org.clojars.technomancy:clj-stacktrace:0.2.1-SNAPSHOT: checking for updates from central
[INFO] snapshot org.clojars.technomancy:clj-stacktrace:0.2.1-SNAPSHOT: checking for updates from clojure
Testing safe.test.export.lotus
FAIL in (test-db-to-eml) (lotus.clj:95)
expected: (= 1166026897000 (.getTime (:sentDate msg-map)))
actual:
11660
- 08
+ 26
897000
"Elapsed time: 18756.183165 msecs"
;; This is proof-of-concept, it's not idiomatic and needs a lot of refactoring, take it with a block of salt.
(ns gradient-descent.core)
;; Thetas with starting values
(def theta0 (atom 1))
(def theta1 (atom 1))
(def theta2 (atom 1))