Skip to content

Instantly share code, notes, and snippets.

@sgade
sgade / app.js
Last active December 16, 2015 14:09
Configure heroku socket.io.
io = io.listen(server);
io.configure(function() {
io.set('transports', [ 'xhr-polling' ]);
io.set('polling duration,', 10);
});
@sgade
sgade / mysvz.user.js
Last active August 29, 2015 13:56
Grooveshark userscript for SchülerVZ (http://www.schuelervz.net/, closed now)
// ==UserScript==
// @name My SchülerVZ
// @namespace http://sense.kilu.de/
// @description My SchülerVZ (v1.2.5) (24.02.2011-07.04.2011) (c) Sören Gade
// @include http://www.schuelervz.net/*
// ==/UserScript==
// By Sense ( Sören Gade)
// *** *** Einstellungen *** ***
@sgade
sgade / install.sh
Created February 13, 2014 20:50
Install nodejs on a raspberry pi
# Instead of building nodejs yourself (taking hours!)
# Use these commands, and you're done within 1 minute
# Get the latest file by https://github.com/nathanjohnson320/node_arm
wget http://node-arm.herokuapp.com/node_latest_armhf.deb
# Install the package
sudo dpkg -i node_latest_armhf.deb
@sgade
sgade / wlan.sh
Last active August 29, 2015 13:56
Get the current wireless link status
# Use this built-in tools
# May need to install watch
watch -n 1 cat /proc/net/wireless
# Or use wavemon (https://github.com/uoaerg/wavemon)
# Install via apt-get install wavemon
# This will be self-updating
sudo wavemon
@sgade
sgade / app.js
Last active August 29, 2015 13:56
mock-fs module test example
// endsWidth, see http://stackoverflow.com/questions/280634/endswith-in-javascript
String.prototype.endsWith = function(suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
};
var fs = require('fs'),
path = require('path'),
mock = require('mock-fs');
function showText(file) {
@sgade
sgade / keybase.md
Created April 10, 2014 22:11
Keybase verification

Keybase proof

I hereby claim:

  • I am sgade on github.
  • I am sgade (https://keybase.io/sgade) on keybase.
  • I have a public key whose fingerprint is DDA5 A73A C013 D418 8AE5 85EB E29C AA8B 349F 63B6

To claim this, I am signing this object:

# Takes any number of arguments and outputs
# the number that, to the power of 1/2 (or sqrt
# function), is equal to the input.
#
# Author: Soeren Gade
# Date: 04.05.2014
# License: MIT
# Imported stdlibs
import sys
@sgade
sgade / lettercounter.c
Created October 27, 2014 14:35
Lettercounter
// Count the number of letters in any given input
#include <stdio.h>
#define NUMBERS_IN_THE_ALPHABET 26
#define INPUT_BUFFER_LENGTH 1000
#define OUTPUT_BIG_LETTERS 1
// get an input line
@sgade
sgade / workflow.js
Last active August 29, 2015 14:11
Get content and information about Workflows.
/*
* Workflow.js
* by: Sören Gade
*
* Extracts information from Workflow's share URLs.
*
* For more information, see their website: https://my.workflow.is/.
*/
var http = require('http'),
@sgade
sgade / link-graph.js
Created February 3, 2015 23:35
Downlink/Uplink graph