Instantly share code, notes, and snippets.

View gist:b24bd8f3de5f1854db32
# squash git commits
# https://wincent.com/wiki/Squashing_all_Git_commits_into_a_single_commit
git update-ref -d refs/heads/master
git commit -s -m shovel
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
View gist:e28bd7507bd8c9033eb1
/**
* HDS File parser
*
* @todo add 64 bit value parsing.
*/
var loadHDS = function(binary, filename)
{
try
{
View gist:d2248dbb2c8411e03034
function Uint8ArrayListWriter(contentSize, filename)
{
var output, that = this, offset, errored;
function init(callback)
{
output = [];
offset = 0;
View gist:b3c26ddeb1f36c3f82ae
/**
* @class custom Writer; zipjs one breaks in chrome for large binary files
*/
function ArrayBufferWriter(contentSize, filename)
{
var output, that = this, offset, errored;
function init(callback)
{
output = new Uint8Array(contentSize);
View gist:4dd4e3ae2eb40954f0f6
/**
* @author Nahid Akbar
* @date 19/10/14
*/
"use strict";
var singleton = function(BaseClass, instanceParent, instanceVarName)
{
instanceParent = instanceParent !== undefined ? instanceParent : BaseClass;
instanceVarName = instanceVarName !== undefined ? instanceVarName : 'instance';
return function()
View encoding decoding cells into a single number inside fixed dimension discrete rectangular grid
var dx = 10;
var dy = 10;
var dz = 3;
var decode = function(v)
{
var z = v % dz;
var xy = (v - z) / dz;
var y = xy % dy;
var x = (xy - y) / dy;
View gist:a0de7a3e6b2b99d5bf5c
import os
import random
# INSERT INTO `dataset_album` (`pic_id`, `pic_cat_id`) VALUES
dataset_album = [
(1, 1),
(2, 1),
(3, 1),
(4, 1),
(5, 1),