Skip to content

Instantly share code, notes, and snippets.

View joekim's full-sized avatar

Joseph Kim joekim

View GitHub Profile
// Script to Generate Random Graphics for Moo Cards
// Example: http://www.flickr.com/photos/jpick/3335073434/
// Modified from Google example - same license as Top Draw (Google BSD-style)
var name = "Jim Pick";
//var fontName = "Data70SH-Regular";
var fontName = "Helvetica";
// Fill with desktop with Colored rect with same top left and bottom right colors
var db = new Rect(0, 0, 1040, 696);
@somic
somic / udp_hole_punch_tester.py
Created November 3, 2009 04:13
UDP Hole Punching test tool
#!/usr/bin/env python
#
# udp_hole_punch_tester.py - UDP Hole Punching test tool
#
# Usage: udp_hole_punch_tester.py remote_host remote_port
#
# Run this script simultaneously on 2 hosts to test if they can punch
# a UDP hole to each other.
#
# * remote_port should be identical on 2 hosts.
@ryanflorence
ryanflorence / static_server.js
Last active June 10, 2024 02:37
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
JSDot: http://code.google.com/p/jsdot/
Graph Dracula: http://www.graphdracula.net/
Protovis: http://vis.stanford.edu/protovis/ex/
Rubyvis: http://rubyvis.rubyforge.org/
Infovis: http://thejit.org/
Arbor: http://arborjs.org/
BINViz: http://binviz.sourceforge.net/
NodeBox: http://nodebox.net/code/index.php/Home
Springy: https://github.com/dhotson/springy
Flare: http://flare.prefuse.org/
@joericioppo
joericioppo / gist:1805302
Created February 12, 2012 00:28
An Objective-C PSD writer that got shelved. Nick Paulson and Gus Mueller helped me out with this.
#import <Foundation/Foundation.h>
@interface FOOPSDWriter : NSObject {
NSMutableData *data_;
NSUInteger location_;
}
- (void) writeInt64:(UInt64)value;
- (void) writeInt32:(UInt32)value;
@lacostej
lacostej / FileSystemUtil.cs
Created March 29, 2012 09:15
Unity3d / Editor build with pre/post process operations, including code generation using antlr string template
public static IEnumerable<string> GetFiles(string path) {
Queue<string> queue = new Queue<string>();
queue.Enqueue(path);
while (queue.Count > 0) {
path = queue.Dequeue();
foreach (string subDir in Directory.GetDirectories(path)) {
queue.Enqueue(subDir);
}
string[] files = null;
files = Directory.GetFiles(path);
@jboner
jboner / latency.txt
Last active June 16, 2024 08:12
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@johan
johan / svg2png
Last active September 15, 2016 02:20
Rasterizes svg images to (alpha) png with phantomjs
#! /usr/bin/env phantomjs
// -*- js2 -*-
var webpage = require('webpage')
, system = require('system')
, URL, FILENAME, W, H;
;
if (system.args.length < 2 || system.args.length > 5) {
console.log('Usage: svg2png source.svg output.png [width||?] [height||?]');
@anantn
anantn / firebase_create.js
Last active November 20, 2023 23:17
Firebase: Creating data if it doesn't exist. This snippet creates a user only if it doesn't already exist.
function go() {
var userId = prompt('Username?', 'Guest');
var userData = { name: userId };
tryCreateUser(userId, userData);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userCreated(userId, success) {
if (!success) {
@starbugs
starbugs / main.m
Created February 24, 2013 00:11
Just a small program to test Objective-C blocks, GCD and GUI on Ubuntu
//
// main.m
// Just a little test case for Objective-C 2.0 on Ubuntu
//
// Created by Tobias Lensing on 2/22/13.
// More cool stuff available at blog.tlensing.org.
//
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>