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
require 'json' | |
require 'uri' | |
require 'httpclient' | |
require 'redis' | |
require 'mw-irc' | |
# First, get an access token for your account on the command line | |
# curl -d '{"scopes":["repo"],"note":"Post-Receive Hooks"}' -u 'username:******' https://api.github.com/authorizations | |
# Paste your access token here |
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
/* | |
In a child process, each of the stdio streams may be set to | |
one of the following: | |
1. A new file descriptor in the child, dup2'ed to the parent and | |
exposed to JS as a Stream object. | |
2. A copy of a file descriptor from the parent, with no other | |
added magical stuff. | |
3. A black hole - no pipe created. |
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 translate(tx, ty, func){ | |
return function(x,y){ | |
var xprime = x-tx; | |
var yprime = y-ty; | |
return func(xprime,yprime); | |
} | |
} | |
function rotate(theta, func){ |
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
var ED = ED || {}; | |
// Utility functions | |
ED.util = (function() { | |
// Data structure functions | |
function each(object, callback) { | |
if (object === null) return; |
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
// run with "node --expose_gc" | |
var weak = require('weak') | |
, util = require('util') | |
var count = 0 | |
, countGc = 0 | |
function dec () { | |
count-- |
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
"use strict"; | |
var fs = require("fs"), | |
https = require("https"), | |
url = require("url"), | |
zlib = require("zlib"); | |
/** | |
* Process HTTP responses. Handle compressed streams and convert to objects as | |
* appropriate. |
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 numpy as np | |
from scipy.spatial import KDTree | |
from fiona import collection | |
def nearest_features(datasource, x, y, n=1): | |
""" | |
datasource: The ogr datasource path | |
x, y: coordinates to query for nearest | |
n: number of features (default = 1 or the single nearest feature) |
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
var cluster = require('cluster') | |
if (cluster.isMaster) { | |
// spawn worker bees | |
cluster.fork() | |
cluster.fork() | |
cluster.fork() | |
cluster.fork() | |
} else { | |
// worker bees only need root to listen, and then downgrade |
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
// Execute method for js:split process expects polygon and line geometries as input | |
run: function(inputs) { | |
var merger = new LineMerger(); | |
merger.add(inputs.poly._geometry); | |
merger.add(inputs.line._geometry); | |
var collection = merger.getMergedLineStrings(); | |
var union = new UnaryUnionOp(collection).union(); | |
var polygonizer = new Polygonizer(); | |
polygonizer.add(union); |
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
Here's some more perf analysis: what was the limiter for node.js in the original fs.readFile benchmark, | |
causing large performance difference? | |
Examining thread microstates using prstat (SmartOS): | |
# prstat -mLcp 92432 1 | |
Please wait... | |
[...] | |
PID USERNAME USR SYS TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS/LWPID | |
92432 root 90 10 0.0 0.0 0.0 0.0 0.0 0.0 7 9 42K 0 node/1 |