Skip to content

Instantly share code, notes, and snippets.

View jcrugzz's full-sized avatar

Jarrett Cruger jcrugzz

View GitHub Profile
@juliangruber
juliangruber / 1.md
Last active November 21, 2021 21:13
@max-mapper
max-mapper / index.js
Last active May 9, 2021 02:20
fast loading of a large dataset into leveldb
// 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')
@DrHayt
DrHayt / cloud-config.yml
Last active January 20, 2021 12:03
CoreOS Container Linux etcd3 cluster cloud-config with SSL on peer, server, and client configs.
#cloud-config
ssh_authorized_keys:
- ssh-rsa PutYourKeysHere
coreos:
locksmith:
endpoint: "https://127.0.0.1:2379"
etcd_cafile: /etc/ssl/certs/ca.pem
etcd_certfile: /etc/ssl/client/client.pem
etcd_keyfile: /etc/ssl/client/client.key
/* WebRTC consist of a few moving pieces
- A signal mechanism for peers
- A signal mechanism to send offers & answers
- A simplified peerConnection function
*/
var uuid = require("node-uuid")
, assert = require("assert")

In other words, the following asynchronous code:

var d = Domain.create()

d.on("error", function (error) {
    console.error("Error with the twitterverse:", error)
})

d.enter()
@max-mapper
max-mapper / Websocket.java
Created September 7, 2012 21:42
android websocket wss:// plugin (not done)
package com.phonegap.plugins.websocket;
import android.os.Bundle;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.apache.cordova.api.Plugin;
import org.apache.cordova.api.PluginResult;
import java.net.URI;
@indexzero
indexzero / git-commit-prefixes
Created April 20, 2011 22:09
Short list of Git commit prefixes used at Nodejitsu
[api]: New apis / changes to apis
[test]: Update test/* files
[dist]: Changes to submodules, version bumps, updates to package.json
[minor]: Small changes
[doc]: Updates to documentation
[ux]: Updates to UX
[fix]: Bug fixes
[bin]: Update binary scripts associated with the project
[merge]: Resolved git merge from upstream or otherwise
[refactor]: Refactor of existing code with no external API changes
@indexzero
indexzero / styleguide.md
Last active June 27, 2016 21:29
A working draft of an "official" Nodejitsu Javascript style guide.

Javascript Styleguide

If you have comments on this or disagree about rules then please reach out to me directly. I want to hear it!

Table of Contents

Basics

@dominictarr
dominictarr / README.md
Last active February 15, 2016 14:30
expandable buffers pool

a pool of expandable buffers

pool noodles, thanks @maxogden

anyone who has played around with getting performant IO in node will tell you to get really great performance you need to avoid unnecessary memory allocations and memory copying.

Working on pull-file I could get about 1gb/s read on a warm cache, but if I just reused the same buffer over and over I could get 2gb/s!

reusing memory is easy to do in a benchmark, but in an a real system when you read data in order to do something with it. maybe you write it to another file or socket, or maybe you encrypt it? maybe you pass it to a multiplexer which adds framing and then writes that to a socket?

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: