Skip to content

Instantly share code, notes, and snippets.

View mckoss's full-sized avatar

Mike Koss mckoss

View GitHub Profile
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active June 18, 2024 18:27
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
/**
* Here is the simplified version. Courtesy of Mike Koss.
*
* See, http://labnote.beedesk.com/the-pitfalls-of-html5-applicationcache
*/
function handleAppCache() {
if (applicationCache == undefined) {
return;
}
anonymous
anonymous / gource-multiple-repositories.sh
Created March 24, 2011 01:10
Generates gource video out of multiple repositories.
#!/usr/bin/env bash
# Generates gource video (h.264) out of multiple repositories.
# Pass the repositories in command line arguments.
# Example:
# <this.sh> /path/to/repo1 /path/to/repo2
i=0
for repo in $*; do
# 1. Generate a Gource custom log files for each repo. This can be facilitated by the --output-custom-log FILE option of Gource as of 0.29:
logfile="$(mktemp /tmp/gource.XXXXXX)"
var AmbTest = TestCase("AmbTest");
AmbTest.prototype.testBasic = function () {
function beats(ix, iy, jx, jy) {
return ix == jx || Math.abs(ix-jx) == jy-iy;
}
var result = ambRun(function (amb, fail) {
var queenPos = [];
for (var i = 0; i < 8; i++) {
var lastPos = amb([0,1,2,3,4,5,6,7]);
@mdornseif
mdornseif / replication.py
Created May 1, 2011 20:35
Replication of AppEngine & Minimal implementation for generating zipfiles. See also http://mdornseif.github.com/2011/05/01/writing-zipfiles-to-blobstore.html
#!/usr/bin/env python
# encoding: utf-8
"""
replication.py - extport data to external systems
Created by Maximillian Dornseif on 2011-05-01.
Copyright (c) 2011 HUDORA. All rights reserved.
"""
from __future__ import with_statement
@jhurliman
jhurliman / base64.js
Created September 29, 2011 06:39 — forked from Marak/base64.js
An extremely simple implementation of base64 encoding / decoding using node.js Buffers (plus url-safe versions)
/*
* base64.js: An extremely simple implementation of base64 encoding / decoding using node.js Buffers
*
* (C) 2010, Nodejitsu Inc.
* (C) 2011, Cull TV, Inc.
*
*/
var base64 = exports;
@paulirish
paulirish / data-markdown.user.js
Last active February 6, 2024 10:41
*[data-markdown] - use markdown, sometimes, in your HTML
// ==UserScript==
// @name Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/>
// @link http://git.io/data-markdown
// @match *
// ==/UserScript==
// If you're not using this as a userscript just delete from this line up. It's cool, homey.
@mckoss
mckoss / moved.md
Created December 30, 2011 00:28
A Bitcoin Primer
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@preshing
preshing / sort1mb.cpp
Created October 25, 2012 11:28
Sort one million 8-digit numbers in 1MB RAM
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef unsigned int u32;
typedef unsigned long long u64;
//-------------------------------------------------------------------------
// WorkArea
//-------------------------------------------------------------------------