Skip to content

Instantly share code, notes, and snippets.

View numtel's full-sized avatar
🦓
Natural Ungulates Make Teeming Elephants Laugh

Ben Green numtel

🦓
Natural Ungulates Make Teeming Elephants Laugh
View GitHub Profile
@laverdet
laverdet / binlog-tailer.js
Created May 6, 2011 07:56
MySQL binlog tailer
"use strict";
this.MysqlBinlogTailer = MysqlBinlogTailer;
var EventEmitter = require('events').EventEmitter;
var fs = require('fs');
var path = require('path');
/**
* Tails a Mysql binlog and emits an event for every query executed.
*/
// polyfill window.getMatchedCSSRules() in FireFox 6+
if ( typeof window.getMatchedCSSRules !== 'function' ) {
var ELEMENT_RE = /[\w-]+/g,
ID_RE = /#[\w-]+/g,
CLASS_RE = /\.[\w-]+/g,
ATTR_RE = /\[[^\]]+\]/g,
// :not() pseudo-class does not add to specificity, but its content does as if it was outside it
PSEUDO_CLASSES_RE = /\:(?!not)[\w-]+(\(.*\))?/g,
PSEUDO_ELEMENTS_RE = /\:\:?(after|before|first-letter|first-line|selection)/g;
// convert an array-like object to array
@bendavis78
bendavis78 / gist:236fb890ba23b10e66fc
Created May 26, 2014 21:26
strapdown.js external load
<!DOCTYPE html>
<html>
<xmp id="README" theme="united" style="display:none;">
</xmp>
<script type="text/javascript">
var req = new XMLHttpRequest();
req.onload = function() {
var xmpNode = document.getElementById('README');
xmpNode.appendChild(document.createTextNode(this.responseText));
}
@chrismdp
chrismdp / s3.sh
Last active March 5, 2024 12:57
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@locktemp997
locktemp997 / traverser.py
Last active February 27, 2018 19:53
Nano Ledger/LMDB Account parsing (computes balance of account at every send and receive block, identifies send and receive address + amounts, stores to file)
######NOTE#######
#This script was written in python 2.7... no guarantees it works on python 3 without modification.
import lmdb
from pyblake2 import blake2b
import matplotlib.pyplot as plt
#CHANGE THIS TO YOUR DATABASE LOCATION (usually /home/user/RaiBlocks/)
#ALSO!! Python doesn't see the database unless it has extension .mdb
#however your nano-node/wallet won't see it unless it stays named as .ldb
#I suggest creating a symlink as follows: ln -s /PATH/TO/YOUR/DATABASE/data.ldb /PATH/TO/YOUR/DATABASE/data.mdb