Skip to content

Instantly share code, notes, and snippets.

View lookfirst's full-sized avatar
💭
25 years of paving open source roads

Public Profile lookfirst

💭
25 years of paving open source roads
View GitHub Profile
###
Async.js is a collection of simple async patterns
built to combat callback hell
###
###
ASYNC SEQUENCE
Allows a user to define a sequence of async functions.
EXAMPLE:
async = require 'async'
@stickfigure
stickfigure / Scatter.java
Created November 10, 2015 22:43
Scatter mapping using Objectify
package com.foo.housekeeping;
import com.google.appengine.api.datastore.Entity;
import com.google.common.collect.Range;
import com.googlecode.objectify.Key;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static com.googlecode.objectify.ObjectifyService.ofy;
@nlwillia
nlwillia / plugin-translate-cache.js
Last active July 28, 2016 15:14
SystemJS translate hook that caches transpilation results of sources that haven't changed in IndexedDB storage.
/**
* SystemJS translate hook that caches transpilation results of sources that haven't changed in IndexedDB storage.
* In Chrome dev tools the cache is easily managed under Resources > IndexedDB > jspm
* There's a global dependency on Dexie.js (ex: //npmcdn.com/dexie@1.3.3/dist/dexie.min.js)
* Adapted from https://gist.github.com/ineentho/3ccaaec164e418f685d7
*/
;(function(){
var db = new Dexie("jspm");
db.version(1).stores({ files: "&url,format,hash,contents" });
db.open();
@nsfmc
nsfmc / doodler.py
Created April 3, 2012 18:49
a small utility script to rasterize an illustrator file with ghostscript and graphicsmagick
"""
doodler.py - (c) 2012 Marcos Ojeda <marcos@khanacademy.org>
--"Quis leget haec?"
requires
graphicsmagick - brew install graphicsmagick
ghostscript - brew install ghostscript
"""
angular.module('utils.filters', [])
.filter('removeAccents', removeAccents);
function removeAccents() {
return function (source) {
var accent = [
/[\300-\306]/g, /[\340-\346]/g, // A, a
/[\310-\313]/g, /[\350-\353]/g, // E, e
/[\314-\317]/g, /[\354-\357]/g, // I, i
/[\322-\330]/g, /[\362-\370]/g, // O, o
anonymous
anonymous / Makefile
Created December 15, 2013 11:53
Hedging client for Bitstamp
HEDGE = node bithedge
all:
npm install bitstamp
hedge:
$(HEDGE) old >|old.txt
cat old.txt
$(HEDGE) cancel `cat old.txt`
$(HEDGE) balance >|balance.txt
@lexrus
lexrus / enable-von-forward-nat.sh
Created June 15, 2016 12:44
Enable VPN forward for OpenVPN on Mac OS X El Capitan
#
# https://roelant.net/2015/share-your-vpn-mac-el-capitan.html
sleep 15
#
/usr/sbin/sysctl -w net.inet.ip.fw.enable=1
/usr/sbin/sysctl -w net.inet.ip.forwarding=1
/usr/sbin/sysctl -w net.inet6.ip6.forwarding=1
pfctl -d
pfctl -f /Users/lex/Dropbox/openvpn/pf.conf -e
@iwasaki-kenta
iwasaki-kenta / TriangularArbitrage.java
Last active January 14, 2018 16:12
Triangular Arbitrage - Java Implementation
package codeit.suisse;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.apache.http.client.fluent.Request;
import org.apache.http.entity.ContentType;
import org.json.JSONObject;
@tylerneylon
tylerneylon / keylog.c
Created July 2, 2015 21:59
log keyboard input to any shell command
// keylog.c
//
// Usage:
// ./keylog [command ...]
//
// This runs the given command, capturing all keyboard input in the file
// "outfile." This is currently written for mac os x. I'm guessing slight edits
// would allow it to work on other *nix systems as well.
//
// I learned how to do this by looking at the source of the "script" binary,
@jbrisbin
jbrisbin / gist:1444077
Created December 7, 2011 18:50
Reactor-based framework versus Node.js streaming

I've been hacking away recently at a JVM framework for doing asynchronous, non-blocking applications using a variation of the venerable Reactor pattern. The core of the framework is currently in Java. I started with Scala then went with Java and am now considering Scala again for the core. What can I say: I'm a grass-is-greener waffler! :) But it understands how to invoke Groovy Closures, Scala anonymous functions, and Clojure functions, so you can use the framework directly without needing wrappers.

I've been continually micro-benchmarking this framework because I feel that the JVM is a better foundation on which to build highly-concurrent, highly-scalable, C100K applications than V8 or Ruby. The problem has been, so far, no good tools exist for JVM developers to leverage the excellent performance and manageability of the JVM. This yet-to-be-publicly-released framework is an effort to give Java, Groovy, Scala, [X JVM language] developers access to an easy-to-use programming model that removes the necessity