Skip to content

Instantly share code, notes, and snippets.

View jaredhirsch's full-sized avatar
👋
migrating personal code to codeberg

Jared Hirsch jaredhirsch

👋
migrating personal code to codeberg
View GitHub Profile
@jaredhirsch
jaredhirsch / gist:7387687
Last active December 27, 2015 20:49
Web Components: digging in!

Web Components: wat?

Articles

@jaredhirsch
jaredhirsch / gist:7239724
Created October 30, 2013 20:32
MEATSONG BOOKMARKLET
//text-to-speech for your meatspaces
//
// instructions.
// 1. create a bookmarklet with the following contents:
javascript:(function(){document.body.appendChild(document.createElement('script')).src='https://rawgithub.com/6a68/6a68.github.com/meatsong/src/meatsong.js';})();
// 2. load chat.meatspac.es
// 3. when the page settles, click your button and behold roboty delight.
<!doctype html>
<script src="https://login.persona.org/include.js"></script>
<script>
navigator.id.watch({
onmatch: function() { console.log("onmatch") },
onlogin: function() { console.log("onlogin") },
onready: function() { console.log("onready") },
onlogout: function() { console.log("onlogout") }
});
@jaredhirsch
jaredhirsch / gist:6780620
Created October 1, 2013 15:49
aphyr/jepsen test run errors

jareds-partybus-4:aphyr-jepsen jhirsch$ lein test

lein test jepsen.load-test

lein test :only jepsen.load-test/map-fixed-rate-test

FAIL in (map-fixed-rate-test) (load_test.clj:32) more expected: (most? #{1} starts) actual: (not (most? #{1} (1 1 1 1 1 1 1 0 2 1 1 1 0 2 1 1 1 1 0 2 1 1 1 3 0 1 0 1 1 1 0 2 1 1 1 0 2 1 1 1 0 2 1 1 1 0 1 2 1 1 1 0 2 1 1 1 0 2 1 1 1 1 0 2 1 1 1 0 2 1 1 1 1 0 2 1 1 1 0 2 1 1 1 1 0 2 1 1 1 0 2 1 1 1 0 2 1 1 1 1 0 2 1 1 1 1 1 1 1 1 1 1 0 1 2 1 1 1 0 2 1 1 1 1 0 1 2 1 1 1 0 1 2 1 1 1 0 2 1 1 1 0 2 1 1 1 1 0 1 2 1 1 1 1 0 2 1 1 1 0 2 1 1 1 1 1 1 1 1 1 0 2 1 1 1 0 2 1 1 0 2 1 1 1 0 2 1 1 1 1 1 1 1 1 1 1 1 0 2 1 1 1 1 0 2 1 1 0 2 1 1 1 0 2 1 1 0 2 1 1 1 1 0 2 1 1 1 0 1 2 1 1 0 1 2 1 1 0 2 1 1 1 0 2 1 1 1 2 0 1 1 1 0 2 1 1 0 2 1 1 1 0 2 1 1 1 0 2 1 1 1 2 0 1 1 1 1 1 0 2 1 1 0 2 1 1 1 0 2 1 1 1 1 0 2 1 1 1 0 2 1 1 1 0 2 1 1 1 0 2 1 1 1 0 2 1 1 1 0 2 1 1 0 2 1 1 0 2 1 1 1 0 2 1 1 0 2 1 1 1 1 0 2 1 1 1 0 2 1 1 1 1 1 1 0 2 1 1 1 0 2 1 1 1 0 2 1 1 1 0 2 1 1 0 2 1 1 1 0 2 1 1 1 2 0 1 1 1 2 0

@jaredhirsch
jaredhirsch / gist:6690481
Created September 24, 2013 20:05
blog series related to cassandra move
  • let's plan a blog series here.
  1. selecting a data store: needs, options
  • factors that led us to consider cassandra
  • other data stores we rejected, rationale
  1. porting a mysql schema to cassandra
  • our schema is really simple, it's ideal for a blog post
  • nodejs clients, our experiences with helenus and node-cassandra-cli
  1. migrating mysql -> C* on AWS
  • use case: need rollback option, need to handle AWS destruction gracefully
@jaredhirsch
jaredhirsch / gist:6599831
Last active December 23, 2015 07:19
metaprogramming in JS for fun and profit
// remap exports.foo to exports._foo, log arguments
// passed to foo, then call _foo.
for (fun in exports) {
  (function(f) {
    // bail if it's not a function I added to the exports object
    if (typeof exports[f] !== 'function' || !exports.hasOwnProperty(f)) { return; }
 exports['_' + f] = exports[f];
@jaredhirsch
jaredhirsch / gist:6497404
Created September 9, 2013 15:41
moving blog to S3 + cloudfront

moving a blog to S3 + cloudfront

  1. have a static site generator
  2. move data into S3?
  3. make S3 bucket the cloudfront origin server?
  4. flip DNS?
  5. 🍻?
@jaredhirsch
jaredhirsch / gist:6471971
Last active December 22, 2015 12:19
helenus and node-cassandra-cql repl shortcuts
helenus at the node repl: (because i keep killing my session with uncaught exceptions...)
// start connection
h = require("helenus")
p = new h.ConnectionPool({hosts:['localhost:9160'],cqlVersion:'3.0.0'})
p.connect(console.log)
p.cql("USE browserid", console.log)
// couple of helpers
function getValue(r, key) { return r && r[0] && r[0].get(key) && r[0].get(key).value }
@jaredhirsch
jaredhirsch / gist:6299349
Last active December 21, 2015 11:29
So you want to migrate your relatively tiny MySQL database to Cassandra

linkdump

schema migration and data modeling

CQL catchup: http://www.slideshare.net/patrickmcfadin/become-a-super-modeler

great advice from @bbangert:

  • things to remember with C*:
    • writes are super cheap, everything is super denormalized, data is written for optimized reads
    • the last part implies that if you need different ways to access all or part of the data, you write it.... again, in the other style of access you need
  • on migrating existing data:
@jaredhirsch
jaredhirsch / gist:6226718
Last active December 21, 2015 01:19
MySQL replication: the initial brain dump + exploration

summary

Suppose we have a 5.1 cluster and are upgrading to 5.6

  • Cross-version incompatibilities to worry about
    • 5.5: backwards-incompatible binlog changes
      • you cannot put a 5.1 slave on a 5.5 master
    • 5.5: changed string/number conversion algorithm
    • 5.6.4: backwards-incompatible timestamp/datetime storage format changes.
      • upgrading isn't required, but restoring from backups is 'more difficult' unless you have a .frm file
  • todo figure out wtf this means