Skip to content

Instantly share code, notes, and snippets.

Simon Chiang thinkerbot

  • Denver, CO
Block or report user

Report or block thinkerbot

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View schema_scope.sql
drop schema if exists a cascade;
create schema a;
drop schema if exists b cascade;
create schema b;
create table b.things (id int);
insert into b.things (id) values (1);
insert into b.things (id) values (2);
insert into b.things (id) values (3);

Note: cqlsh converts timestamps into current timezone

You can prove this manually:

$ cqlsh
cqlsh> CREATE KEYSPACE mykeyspace WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
cqlsh> use mykeyspace;
cqlsh> CREATE TABLE objects (id int PRIMARY KEY, name text, date timestamp);
cqlsh> INSERT INTO objects (id, name, date) VALUES (1, 'one', '2010-01-01T00:00:00Z');
cqlsh> SELECT * FROM objects;

I'm going to do my best to parrot things I picked up from the scala course... What you've done here by declaring functions with {} works but I don't think it is the intended syntax. Odersky presented it like this:

() is how you call a function, ie they wrap parameters just like you would expect. If one parameter is a function literal then you get the a form like this:

val nums = List(0,1,0)                          //> nums  : List[Int] = List(0, 1, 0) => {x.toString})                   //> res0: List[String] = List(0, 1, 0)
View dance_moves.rb
#!/usr/bin/env ruby
# ruby dance_moves.rb
string = "get down"
def dance(move, string)
string = string.send(move)
print "%s\r" % string
sleep 0.3
thinkerbot / madlib_example.sql
Last active Oct 5, 2016
MADlib install on ubuntu (partial)
View madlib_example.sql
create temporary sequence predictor_seq;
CREATE temporary TABLE linear_systems_test_data( id INTEGER NOT NULL, lhs DOUBLE PRECISION[], rhs DOUBLE PRECISION);
insert into linear_systems_test_data values (nextval('predictor_seq'), '{352137.0,84.7067061967771,-150.185137392799,122.050417659229,-74.0884874537119,99.7911494563722,-3.7907455558484,181224.690513009,106938.029173016,69336.1362009346,18335.0,12.7007088793537,-250.440511627437,-62.5561474971013,-292.703374755409,-167.012940969203,-78.511449979818,9451.24681999999,5585.85191537643,3628.50938401}'::float[], 88920344.0 );
insert into linear_systems_test_data values (nextval('predictor_seq'), '{84.7067061967771,176105.544243727,61.0252088296143,-73.1971959184637,7.54222162981446,-48.6063990056131,-37.7170700467655,-11006.0678697046,-11871.4874441653,-10787.6157862104,12.7007088793537,9313.85168737771,-31.2780737485506,-85.9645308238089,-89.8568249242787,-78.6462830692247,10.8622991388217,-566.613529886409,-617.49619500345,-565.289335368564}'::float[]
thinkerbot / Vagrantfile
Created Jan 29, 2014
Kafka round trip perf test
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at
thinkerbot / thisiswhatyouget.rb
Created Oct 28, 2013
Positive match for files not matching '.*\.example'
View thisiswhatyouget.rb
thinkerbot /
Created Oct 25, 2013
Rack streaming via puma.
# puma
# curl http://localhost:9292/
# Note chrome buffers like 1024 or so... meaning the first lots will look missing.
run lambda { |env|
body = lambda { |io|
io.sync = true
10.times do |i|
View example.rb
#!/usr/bin/env ruby
require "ffi-rzmq"
require "securerandom"
id = SecureRandom.uuid
n = 1000000
endpoint = "ipc://message"
def assert(rc)
thinkerbot / psdaisy
Created Sep 12, 2013
Processes blow away thread queues, for the record.
View psdaisy
# time ./test/benchmark/psdaisy
# real 0m0.238s
# user 0m0.095s
# sys 0m0.006s
# real 0m0.323s
# user 0m0.153s
# sys 0m0.035s
You can’t perform that action at this time.