Skip to content

Instantly share code, notes, and snippets.

View allbinmani's full-sized avatar

origo allbinmani

  • Freelance
  • Sweden
View GitHub Profile
@allbinmani
allbinmani / urlencode.sh
Created February 21, 2016 06:44
urlencode using curl in bash
curl -Gso /dev/null -w %{url_effective} --data-urlencode @- "" | cut -c 3-
#!/bin/sh
# Base system
apt-get update -yq && apt-get upgrade -yq && apt-get dist-upgrade -yq
# WindowManager
apt-get install curl openbox build-essential module-assistant strace -yq
# NodeJS 4.x
curl -sL https://deb.nodesource.com/setup_4.x | bash -
#!/usr/bin/env node
/**
* Crude script to find images that are lingering and/or missing in the docker registry 2.0
*
* Finds all unreferences images in all repos, given the path to the registry-data
* directory (the one that contains 'storage'). Also lists all images that are referenced,
* but are missing on disk.
*
* License: GPL 2.0
@allbinmani
allbinmani / backbone.listenToAnyOnce.js
Created April 20, 2016 12:35
listenToAnyOnce handler for Backbone
/*
* listenToAnyOnce handler for Backbone.[View|Collection|Model]
*
* Call with space separated list of events to listenToOnce, and
* the callback will be called only once any of those events occur.
*
* Usage:
*
* - npm install gist:<this-gist-id>
*
@allbinmani
allbinmani / bling.js
Created April 22, 2016 16:21 — forked from paulirish/bling.js
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@allbinmani
allbinmani / setup_debian_docker.sh
Last active June 15, 2016 10:00
bash script to set up a new debian 8.2 with docker and docker-compose
#!/bin/sh
if [ -z $COMPOSE_VERSION ]; then
#1.8.0-rc1 exists
COMPOSE_VERSION=1.7.0
fi
if [ `whoami` = "root" ]; then
echo "Do not run as root!"
exit 2
@allbinmani
allbinmani / grunt_task_shortify_require_js.js
Last active June 12, 2016 12:22
Grunt task to replace file names for require-statements with shorter names, reducing final file size slighty.
/**
* Grunt task to replace file names for require-statements with shorter names
* reducing final file size slighty.
*
* (C) 2016 mattias@allbinary, All Binary AB
*
* Example configuration:
* shortify_js: {
* build: {
* options: {
@allbinmani
allbinmani / compiling_avrdude_6_on_raspbian.md
Created November 14, 2016 13:05
Step-by-step info for compiling / building / installing avrdude 6.1 on Raspberry Pi / Raspbian

Prerequisites

# apt-get install libusb-dev bison flex build-essential 

Download/extract avrdude source

# wget http://download.savannah.gnu.org/releases/avrdude/avrdude-6.1.tar.gz
# tar xfz avrdude-6.1.tar.gz
============= start.S ======================
.global start
.text
start:
lea.l _DemoBase(PC),a0
lea.l (PC,_DemoBase),a1
lea.l (_DemoBase,PC),a2
lea.l _DemoBase,a0
lea.l _DemoBaseEnd(PC),a3
@allbinmani
allbinmani / sqrttab_generator.js
Created April 10, 2017 19:46
A simple SQRT table generator
// A simple SQRT table generator
//
// Author: orIgo / iNSANE^C!S 2017
// License: Buy-Me-A-Beer License 1.0
//
// Produces a "stretched" sqrt table
// that fits in the range 0-RANGE
// and outputs an asm include file.
//
// Binary file generation is left