This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if(typeof(ArrayBuffer.prototype.transfer) === "undefined") { | |
| ArrayBuffer.prototype.transfer = function transfer(old) { | |
| var dva, dvb, i, mod; | |
| dva = new DataView(this); | |
| dvb = new DataView(old); | |
| mod = this.byteLength%8+1; | |
| for(i = 0; i <= old.byteLength-mod; i+=8) dva.setFloat64(i, dvb.getFloat64(i)); | |
| mod = this.byteLength%4+1; | |
| if(i < old.byteLength-mod) { | |
| dva.setUint32(i, dvb.getUint32(i)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function memcpy (src, srcOffset, dst, dstOffset, length) { | |
| var i | |
| src = src.subarray || src.slice ? src : src.buffer | |
| dst = dst.subarray || dst.slice ? dst : dst.buffer | |
| src = srcOffset ? src.subarray ? | |
| src.subarray(srcOffset, length && srcOffset + length) : | |
| src.slice(srcOffset, length && srcOffset + length) : src |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is free and unencumbered software released into the public domain. | |
| // Marshals a string to an Uint8Array. | |
| function encodeUTF8(s) { | |
| var i = 0, bytes = new Uint8Array(s.length * 4); | |
| for (var ci = 0; ci != s.length; ci++) { | |
| var c = s.charCodeAt(ci); | |
| if (c < 128) { | |
| bytes[i++] = c; | |
| continue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // data comes from here http://stat-computing.org/dataexpo/2009/the-data.html | |
| // download 1994.csv.bz2 and unpack by running: cat 1994.csv.bz2 | bzip2 -d > 1994.csv | |
| // 1994.csv should be ~5.2 million lines and 500MB | |
| // importing all rows into leveldb took ~50 seconds on my machine | |
| // there are two main techniques at work here: | |
| // 1: never create JS objects, leave the data as binary the entire time (binary-split does this) | |
| // 2: group lines into 16 MB batches, to take advantage of leveldbs batch API (byte-stream does this) | |
| var level = require('level') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import sqlite3 | |
| from hashlib import md5 | |
| from time import time | |
| import simplejson as json | |
| from flask import Flask | |
| from flask.ext import restful | |
| from flask import g | |
| from flask import request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Licensed under MIT license. | |
| // (c) Lewin Bormann 2014 | |
| # include <string> | |
| # include <iostream> | |
| # include <list> | |
| # include <cstring> | |
| # include <algorithm> | |
| using std::string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git fetch upstream | |
| git reset --hard upstream/master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.mozilla.javascript.tools.jsc.Main; | |
| class Jsc { | |
| public static void main(String args[]){ | |
| Main.main(args); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Created by https://www.gitignore.io/api/c++,cmake | |
| ### C++ ### | |
| # Prerequisites | |
| *.d | |
| # Compiled Object files | |
| *.slo | |
| *.lo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from Foundation import NSKeyedUnarchiver | |
| from struct import unpack | |
| # This entire function is black magic of the highest order and I'll blog about it later | |
| def extract_share(bookmark_data): | |
| content_offset, = unpack('I', bookmark_data[12:16]) | |
| first_TOC, = unpack('I', bookmark_data[content_offset:content_offset+4]) | |
| first_TOC += content_offset | |
| TOC_len, rec_type, level, next_TOC, record_count = unpack('IIIII', bookmark_data[first_TOC:first_TOC+20]) | |
| TOC_cursor = first_TOC + 20 |