Skip to content

Instantly share code, notes, and snippets.

View Jimbly's full-sized avatar

Jimb Esser Jimbly

View GitHub Profile
@Jimbly
Jimbly / jimb_util.py
Last active August 29, 2015 13:55
Jimbly's Sublime config snapshot
[
// Rebind mac to be like windows
{ "keys": ["ctrl+n"], "command": "new_file" },
{ "keys": ["ctrl+s"], "command": "save" },
{ "keys": ["ctrl+shift+s"], "command": "prompt_save_as" },
{ "keys": ["ctrl+alt+s"], "command": "save_all" },
{ "keys": ["ctrl+f4"], "command": "close" },
var domain = require('domain');
var assert = require('assert');
var DELAY = 10;
function doerr() {
var fired = false;
setTimeout(function () {
fired = true;
@Jimbly
Jimbly / DefaultKeyBindings.dict
Last active April 2, 2025 20:48
Mac OSX keybindings to more closely match Windows
/* ~/Library/KeyBindings/DefaultKeyBinding.Dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more closely
match default behavior on Windows systems.
You must log out and back in to see these changes.
Here is a rough cheatsheet for syntax.
Key Modifiers
^ : Ctrl
$ : Shift
@Jimbly
Jimbly / gist:10771051
Last active August 29, 2015 13:59
Page scraping with login
var request = require('request').defaults({ jar: true });
var config = require('./config.json');
var log = console.log.bind(console);
function wrapcb(orig_url, cb) {
return function(err, res, body) {
if (res && res.statusCode === 302) {
var url = require('url').resolve(orig_url, res.headers.location);
log('Redirect from ' + orig_url + ' to ' + url);
@Jimbly
Jimbly / gist:11302619
Last active August 29, 2015 14:00
Periodic beacon firing
<html>
<head>
<script>
var beacon = (function() {
function fireBeacon(url, cb) {
//debug('Firing beacon ' + url);
var beacon = new Image();
beacon.onload = function() {
cb();
};
@Jimbly
Jimbly / webroot.js
Last active March 13, 2019 17:38
Node.js app combining virtual hosts, proxies, mapped subdirectores, and static sites, with WebSockets support.
// Companion Blog Post about architecture:
// http://jimbesser.wordpress.com/2014/10/20/its-node-js-all-the-way-down/
// Companion Blog Post about dealing with legacy requests:
// http://jimbesser.wordpress.com/2014/11/29/the-horrible-things-peoples-routers-do-to-my-packets/
//
// Routing handled by this app:
// [www.]bigscreensmallgames.com -> static site: /var/data/smb_web/bigscreensmallgames.com/
// fanime.info -> node app running entire site on port 4001
// [default site]/app1: replace URL and redirect to single page app on 192.168.0.127:21022
// [default site] -> static site: /var/data/smb_web/dashingstrike.com/
@Jimbly
Jimbly / gist:ec6126da15bf0e6f9a63
Created February 12, 2015 19:13
PROXY protocol preparse event
function requestPreParse(preparse_params) {
// Requires https://github.com/Jimbly/node/commit/e8952eb
// and https://github.com/Jimbly/node/commit/13cfb39
var data = preparse_params.preparse_data;
if (!data.did_haproxy || (data.is_haproxy && !data.did_haproxy_data)) {
var len = preparse_params.end - preparse_params.start;
if (len >= 6) {
data.did_haproxy = true;
if (preparse_params.d.toString('utf8', preparse_params.start, preparse_params.start + 6) === 'PROXY ') {
data.is_haproxy = true;
GOOD
DEBUG: Local ident: 'SSH-2.0-ssh2js0.0.18'
DEBUG: Client: Trying staging.dashingstrike.com on port 22 ...
DEBUG: Client: Connected
DEBUG: Parser: IN_INIT
DEBUG: Parser: IN_GREETING
DEBUG: Parser: IN_HEADER
DEBUG: Remote ident: 'SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3'
DEBUG: Outgoing: Writing KEXINIT
DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
GOOD
Client :: ready
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/mscdex/.ssh/id_rsa type -1
debug1: identity file /home/mscdex/.ssh/id_rsa-cert type -1
@Jimbly
Jimbly / codejam.js
Last active January 8, 2017 19:07
Generic parallel CodeJam Problem Runner
/*
* This file contains the generic file loading, test parsing, dispatching code
* used in all of my solutions, other than the last lines specifying which problem module
* and possibly different delimiters being used, this file remains unchanged.
*/
'use strict';
var assert = require('assert');
var child_process = require('child_process');
var fs = require('fs');