Skip to content

Instantly share code, notes, and snippets.

View jaredhirsch's full-sized avatar
:octocat:
pretty excited firefox is moving from hg to github!

Jared Hirsch jaredhirsch

:octocat:
pretty excited firefox is moving from hg to github!
View GitHub Profile
@jaredhirsch
jaredhirsch / gist:5224013
Created March 22, 2013 19:26
weird npm-lockdown behavior
diff --git a/lockdown.json b/lockdown.json
index 9f12177..a9441b3 100644
--- a/lockdown.json
+++ b/lockdown.json
@@ -27,7 +27,7 @@
"0.4.2": "ed0a831f7b39156b63ae2e9d95e7c1289bb5c73e"
},
"bcrypt": {
- "0.7.3": "7523db1fdd8b0bda337bade63b5b90a7ee9c448a"
+ "0.7.3": "*"
@jaredhirsch
jaredhirsch / gist:5239644
Last active December 15, 2015 09:39
weinre on yer android 2.2 phone

this supposes your computer + phone are behind the same wifi.

initial setup

on the computer:

  1. npm install -g weinre
  2. create .weinre/server.properties following docs, except inserting your computer's LAN IP (eg 192.168.0.5):

boundHost: 192.168.0.5 <-- your compy's local IP here

@jaredhirsch
jaredhirsch / rawdata.js
Last active December 16, 2015 08:49
looking at the 2g/3g performance gains for bidbundle stuff
/*
First column: test name
Second column: time until onready is fired from communication_iframe
Third column: time until "can_interact" from button press (dialog ready time)
*/
var data = {};
// 2G
// ======
{
"state": {
"name": "first-try",
"defaultGraphParams": {
"width": 400,
"from": "-30minutes",
"until": "now",
"height": 250
},
"refreshConfig": {
@jaredhirsch
jaredhirsch / README.md
Last active April 1, 2016 07:25
ELB dashboard JSON.

This gist explains how to create a generic ELB monitoring dashboard in graphite 0.9.10, which allows import/export, but not via dashboard UI.

The python script attached to this gist should work, but it didn't immediately work for me, so I just did the following via the python repl:

Python 2.7.2 (default, Oct 11 2012, 20:14:37) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
&gt;&gt;&gt; import sys
@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
@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: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: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: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];