Skip to content

Instantly share code, notes, and snippets.

View timdp's full-sized avatar

Tim De Pauw timdp

View GitHub Profile
@timdp
timdp / retry.js
Created June 20, 2016 16:49
retry with async/await
import delay from 'delay'
const createAttempter = (worker) => async () => {
let retval, error, time
const startTime = Number(new Date())
try {
retval = await worker()
} catch (err) {
error = err
}
@timdp
timdp / highlight-json.js
Created May 1, 2016 10:30
Minimal JSON highlighter
var encodeString = (function () {
var reReserved = /[<>&"]/g
var entities = {
'<': '&lt;',
'>': '&gt;',
'&': '&amp;',
'"': '&quot;'
}
var encodeEntity = function (entity) {
@timdp
timdp / list.sh
Created April 3, 2016 13:04
List npm dependents for all your packages
# Requirements:
# - curl
# - pup (https://github.com/ericchiang/pup)
# - npm-dependents (https://www.npmjs.com/package/npm-dependents)
curl -s 'https://www.npmjs.com/~timdp' | \
pup '.collaborated-packages a text{}' | \
xargs -n1 -I % sh -c 'echo -n %:\ ; npm-dependents % --list'
@echo off
set host=172.16.0.18
set port=80
set username=kodi
set password=kodi
set file=%1%
echo {"id":1,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"%file%"}}} | http ^
-pb -a %username%:%password% ^
#!/bin/bash
set -e
[[ -f package.json && -d node_modules ]] || exit 1
export PATH="/c/Program Files/Git/bin:$PATH"
linked=$(find node_modules -maxdepth 1 -type l -printf '%P\n')
echo "Linked modules:"
@timdp
timdp / mopidy-twitter.sh
Created September 24, 2015 11:34
/etc/init.d/mopidy-twitter
#!/bin/bash
#
# An init.d script for running a Node.js process as a service using Forever as
# the process monitor. For more configuration options associated with Forever,
# see: https://github.com/nodejitsu/forever
#
# This was written for Debian distributions such as Ubuntu, but should still
# work on RedHat, Fedora, or other RPM-based distributions, since none of the
# built-in service functions are used. So information is provided for both.
#
@timdp
timdp / s3cmd.cmd
Created June 10, 2015 07:53
s3cmd wrapper for Windows
@echo off
setlocal
"%~dp0..\python" "%~dp0s3cmd" %*
endlocal
@timdp
timdp / blog.md
Created February 7, 2015 22:14
io.js week van 6 februari 2015

io.js: week van 6 februari 2015

Atom & nw.js adopteren io.js, Linux Tracing en veel meer.

Voortaan posten we elke vrijdag een wekelijkse update over de activiteit rond io.js.

We blikten terug op de bijdragen in de maand januari en stelden vast dat dit de op twee na meest actieve maand in de geschiedenis van Node was (294 commits). Bovendien was het de meest actieve maand in bijna drie jaar (308 commits in februari 2012). Gezien de huidige evolutie in het aantal bijdragen verwachten we dat februari nóg actiever wordt.

  1. We brachten versie 1.1.0 uit. Bekijk de wijzigingen.
  2. Simplified Stream Construction (vereenvoudigde streamconstructie) door Sam Newman wordt voortaan meegeleverd.
@timdp
timdp / .bashrc
Created February 1, 2015 13:32
.bashrc for use with nvmw
export PATH="$PATH:~/.nvmw/latest"
alias npm='node ~/.nvmw/latest/node_modules/npm/bin/npm-cli.js'
@timdp
timdp / Main.as
Created January 14, 2015 14:05
Animated path as mask for an image
package {
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Point;
public class Main extends Sprite {
public const POINTS:uint = 15;
public const OUTER_SCALE:Number = 0.9;