Skip to content

Instantly share code, notes, and snippets.

// For options and giggles:
// https://github.com/ai/autoprefixer
var autoprefixer = require('autoprefixer');
var fs = require('fs');
var url = require('url');
var path = require('path');
var filesMap = {};
/*
Superfast Blur - a fast Box Blur For Canvas
Version: 0.5
Author: Mario Klingemann
Contact: mario@quasimondo.com
Website: http://www.quasimondo.com/BoxBlurForCanvas
Twitter: @quasimondo
@tmslnz
tmslnz / Sift3B.js
Created September 21, 2014 13:31
String distance
// http://siderite.blogspot.com/2007/04/super-fast-and-accurate-string-distance.html
function sift3B(s1, s2, maxOffset, maxDistance) {
if (s1 == null||!s1.length) {
if (s2 == null) {
return 0;
}
return s2.length;
}
@tmslnz
tmslnz / nmap+grep.sh
Created October 15, 2014 11:25
List all network devices on a range
# Use -n -sn to tell Nmap to ignore hostnames
nmap -sn 192.168.1.0/24 -oG - | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'
@tmslnz
tmslnz / git-serve.md
Last active August 29, 2015 14:07 — forked from datagrok/git-serve.md

Launch a one-off git server from any local repository.

I [tweeted this already][1] but I thought it could use some expansion:

Enable decentralized git workflow:

git config alias.serve "daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/"

Say you use a git workflow that involves working with a core "official" repository that you pull and push your changes from and into. I'm sure many companies do this, as do many users of git hosting services like Github.

@tmslnz
tmslnz / the-workers.txt
Created November 6, 2014 11:45
The Workers ASCII Art
________ _ __ __ ___
/_ __/ /_ ___| | / /___ _____/ /_____ __________ / /
/ / / __ \/ _ \ | /| / / __ \/ ___/ //_/ _ \/ ___/ ___/ / /
/ / / / / / __/ |/ |/ / /_/ / / / ,< / __/ / (__ ) _/ ./
/_/ /_/ /_/\___/|__/|__/\____/_/ /_/|_|\___/_/ /____/ / ./
.net / /
. /./
.. | // .
. \\ | /' .' .
~-. ` ' .-~
@tmslnz
tmslnz / process-from-id.sh
Last active August 29, 2015 14:23
Get the process name from its id
# To know what process has id 1
stat /proc/1/exe
@tmslnz
tmslnz / basic-promise.js
Last active August 29, 2015 14:24 — forked from rc1/gist:b556844e290997b447e4
A most simple promise system, to explain promises
// A most simple promise system, to explain promises
var p = promise( function ( resolve, reject ) {
// do async stuff here
fs.readFile( function ( err, file ) {
if ( err ) {
reject( new Error( 'it mucked up' ) );
} else {
resolve( file );
}
@tmslnz
tmslnz / node-compile-rpi.sh
Created July 12, 2015 10:49
Compile Node.js on Raspberry Pi
export CC='gcc -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon'
export CXX='g++ -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon'
./configure --without-snapshot
make -j4
sudo make install
@tmslnz
tmslnz / ios-refresh.md
Last active August 29, 2015 14:24
How to free space and fully back up iOS
  1. Connect to computer via USB
  2. Backup via iTunes (make sure you choose encrypted backup)
  3. Transfer purchases via iTunes
  4. Ensure iCloud backup for Docs and Data is on for the apps that need their data restored
  5. Force-trigger an iCloud backup (fromthe Settings, on Wi-Fi and connected to power)
  6. Erase all content and Settings on iOS
  7. Connect to iTunes and use Restore from Backup