Skip to content

Instantly share code, notes, and snippets.

View whoahbot's full-sized avatar

Dan Herrera whoahbot

  • Portland, Oregon
View GitHub Profile
@whoahbot
whoahbot / clojure-west-2015.org
Last active August 29, 2015 14:19
Clojure West 2015 Notes

Clojure Parallelism, beyond futures

intro

  • Leon Barrett
    • Wrote claypoole

example

  • Continuous rank probability score
  • model output produces a distribution of samples
  • want to compare observed to our model
  • fn crps
    • We map this crps fn for each timestep
@whoahbot
whoahbot / halp.md
Last active January 3, 2016 02:18 — forked from miah/halp.md

This is a sample from a tar file class I created for a chef cookbook. In this example I'm iterating over entries in the tar file. Because of the way tar handles filenames over 100 chars (././@LongLink) I have to do something to register that i'm dealing a longlink and treat the next entry differently.

I would love any advice on how to clean this up. Its a super long method, I especially don't like that I have to set full_name to nil and twice.

Code here

Tar Longlink

@whoahbot
whoahbot / gist:7255993
Created October 31, 2013 19:54
toggle fullscreen in railwaycat emacs
(defun toggle-fullscreen ()
"Toggle full screen"
(interactive)
(set-frame-parameter
nil 'fullscreen
(when (not (frame-parameter nil 'fullscreen)) 'fullboth)))
@whoahbot
whoahbot / errors.sql
Created October 22, 2013 23:09
errors with wal-e restore'd skyliner.
skyliner=# select count(transaction_id) from transaction_kv where when_created > '2013-10-22T00:00:00.000-00:00';
ERROR: could not read block 373028 in file "base/67212/90213.2": read only 0 of 8192 bytes
@whoahbot
whoahbot / treewalk
Last active December 21, 2015 06:19 — forked from rasmusto/treewalk
(ns async-playground.core
(:require [clojure.core.async :as async
:refer [go chan >! <! >!! <!! timeout close!
thread alts! alts!! sliding-buffer]]))
(defn walk [t]
(cond (nil? t)
nil
:else
(let [[l v r] t]
@whoahbot
whoahbot / clojure-west.org
Last active October 13, 2016 07:41
Clojure west notes

Clojure West

Domain driven design with Clojure

  • Organizing larger applications
  • Domain logic shouldn’t include handlers for bad/unclean data.
    • validateur, bouncer, clj-schema for checking data going into the pipeline.
    • domain-specific, semantic checks
    • TODO: Any better ways for doing this conditional validation.
    • Need to factor out common data cleaning utils into shared library.
@whoahbot
whoahbot / toQueryString.js
Created June 28, 2012 17:17
Change for serializing arrays to query params in MooTools.
Object.toQueryString({'buh':[1,2]});
"buh[0]=1&buh[1]=2"
On the server side, it looks like:
buh = {0 => 1, 1 => 2}
And we have to do buh.values in order to get it to return an array.
@whoahbot
whoahbot / gist:2815883
Created May 27, 2012 20:58
Typhoeus require
test → pwd
/Users/whoahbot/code/test
test → ls
Gemfile Gemfile.lock
test → cat Gemfile
gem 'typhoeus', '0.4.0'
test → bundle show
Gems included by the bundle:
* activesupport (3.2.3)
* bundler (1.1.1)
@whoahbot
whoahbot / statement.json
Created March 27, 2012 22:11
example statement json
{
"account_number":0123456789,
"period_start":YYMMDD,
"period_end":YYMMDD,
"starting_balance":9999.99,
"account_balance":9999.99,
"interest_rate":99.99,
"apy":99.99,
"interest_paid":99.99
}
select
s.relname,
s.seq_tup_read + s.idx_tup_fetch usage,
(s.idx_tup_fetch/s.seq_tup_read::float)::decimal(18,4) index_ratio,
s.seq_tup_read, s.idx_tup_fetch,
s.seq_scan, s.n_live_tup,
((io.heap_blks_hit + io.idx_blks_hit)/((io.heap_blks_read + io.idx_blks_read)::float))::decimal(18,4) cache_hit_ratio
FROM pg_stat_user_tables s
INNER JOIN pg_statio_user_tables io
ON s.relid = io.relid