Skip to content

Instantly share code, notes, and snippets.

View johannilsson's full-sized avatar

Johan Berg johannilsson

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
function Animal(name) {
this.name = name;
this.move = function() {
return this.name;
};
}
var a1 = new Animal('a');
var a2 = new Animal('a');
a1.move === a2.move
// false
var HID = require('node-hid');
var devices = HID.devices()
console.log(devices);
// Set path here.
var path = '';
var device = new HID.HID(path);
@johannilsson
johannilsson / spotify-raspberry.md
Created December 7, 2013 13:19
Notes for getting Spotify to run o a Raspberry Pi.

Spotify on Raspberry Pi

Notes for getting libspotify to run on a RPi.

sudo apt-get install libasound2-dev
sudo apt-get install alsa-utils

Not completly sure if this was needed but found it in my history. But should allow playback using the rca cable.

amixer cset numid=3 1

@johannilsson
johannilsson / build.sh
Last active December 27, 2015 22:29
Templating with Browserify, domify & brfs.
browserify index.js -o bundle.js -t brfs
@johannilsson
johannilsson / make-sprite.sh
Created October 18, 2013 07:26
Make a sprite & a debug sprite of a set of png image.
#!/bin/sh
echo Creating output.
rm -rfv out
mkdir -vp out
echo Making tiled version.
montage *.png -tile x1 -geometry '1x1+0+0<' -alpha On -background transparent -quality 100 out/out.png
echo Making tiled debug version
montage -label '%t\n%[width]x%[height]' -font 'Arial' *.png -tile x1 -geometry '1x1+0+0<' -alpha On -background transparent -quality 100 out/out-debug.png
echo Running optipng
optipng out/out.png -out out/out-opt.png
@johannilsson
johannilsson / resize.sh
Created October 18, 2013 07:23
Helper that resize all png images in the given directory.
ROOT=$1
OUT=$ROOT/out
rm -rf $OUT
mkdir -p $OUT
for i in `ls $ROOT | grep .png`; do
#convert $ROOT/$i -resize 40% $OUT/$i
convert $ROOT/$i -resize 185x185 $OUT/$i
done
@johannilsson
johannilsson / sthlmtraveling.user.js
Last active December 20, 2015 19:29
STHLM Traveling + IITC
// ==UserScript==
// @id iitc-plugin-sthlmtraveling@johannilsson
// @name IITC plugin: STHLM Traveling.
// @category Portal Info
// @version 0.0.1
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @description [johannilsson-2013-08-08-1546] Adds a link to the portal details to open and plan a trip to the portal using the app STHLM Traveling.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
@johannilsson
johannilsson / tosprite.sh
Created March 1, 2013 16:45
Quick and dirty tile sprite image from a set of pngs.
#!/bin/sh
echo Creating output.
rm -rfv out
mkdir -vp out
echo Making tiled version.
montage *.png -tile x1 -geometry '1x1+0+0<' -alpha On -background transparent -quality 100 out/out.png
echo Making tiled debug version
montage -label '%t\n%[width]x%[height]' -font 'Arial' *.png -tile x1 -geometry '1x1+0+0<' -alpha On -background transparent -quality 100 out/out-debug.png
echo Running optipng
optipng out/out.png -out out/out-opt.png
for i in `find /opt/graphite/storage/whisper/servers -name *.wsp`; do whisper-resize.py $i 60:90d $i; done;