Skip to content

Instantly share code, notes, and snippets.

Avatar

Jan Moesen janmoesen

View GitHub Profile
View maga-ivago.php
<?php
/**
* Script to Make Afvalophalingskalender Great Again for Ivago (the municipal
* waste management company for Ghent, Belgium):
* - make events last all day (so they appear on top of the calendar on
* Google Calendar, for instance)
* - do not use ALL CAPS for event summaries
*
* 1. Go to https://www.ivago.be/nl/particulier/afval/ophaling
* 2. Download the ICS for your street.
@janmoesen
janmoesen / override-ssh-for-identities.sh
Created Oct 23, 2013
Override "ssh" to specify IdentityFile based on the host, but not in ~/.ssh/config. See http://serverfault.com/questions/450796/how-could-i-stop-ssh-offering-a-wrong-key/450807 for some background. Not really tested. Also, this is very naive and assumes your host does not appear in the other arguments.
View override-ssh-for-identities.sh
# A wrapper for "ssh" to avoid having multiple keys sent. Leave the
# IdentityFile options out of your host sections in ~/.ssh/config. This
# function adds them based on the arguments.
function ssh {
local new_args=();
local arg;
for arg; do
if [ "$arg" = 'purplepixelhost' ]; then
new_args+=(-i ~/.ssh/purplepixelhost.id_rsa);
elif [ "$arg" = 'qiwib0xorz' ]; then
@janmoesen
janmoesen / camper-top-down-overview.js
Created Aug 21, 2013
Use this on http://www.camper.com/en_BE/men/shoes/shoe to change the thumbnails to the top-down view. Useful for people with wide feet.
View camper-top-down-overview.js
javascript: (function () {
// Use this on http://www.camper.com/en_BE/men/shoes/shoe to change the
// thumbnails to the top-down view. Useful for people with wide feet.
var images = document.querySelectorAll('img[src*="JGVzaG9wNiQ="]');
Array.prototype.slice.call(images).forEach(function (img) {
img.src = img.src.replace('_L.jpg', '_C.jpg');
});
})();
@janmoesen
janmoesen / over9000.sh
Last active Dec 20, 2015
Not sure if I can ever forgive myself for this, but here goes: "automatically" creating "useful" aliases for "cd ../../../" etc. See https://twitter.com/padolsey/status/364416098474541056
View over9000.sh
stack=('');
for i in {1..10}; do
printf -v alias_name '.%s' "${stack[@]}";
printf -v path '../%s' "${stack[@]}";
alias ".$alias_name"="cd $path";
stack+=('');
done
View utterly-useless.sh
function manneke {
:;:;:;:;:;:;:
:;:;:;:;:;:;:
<. :;:;:;:;:;:;:;:;:
[ ! ] ; [ ! ]
: :
: _ :
[ \_____/ ]
@janmoesen
janmoesen / bookmarklets → search → maps → bike.js
Created Feb 3, 2013
New way to "parametrise" my bookmarklets now that E4X is dead everywhere.
View bookmarklets → search → maps → bike.js
/**
* Search Google Maps for a bicycle route.
*
* @title Google Maps (for cyclists)
*/
(function ride() {
/* Try to get the parameter string from the bookmarklet/search query. */
/* Fall back to the current text selection, if any. If those options
/* both fail, prompt the user. */
var s = (function () { /*%s*/ }).toString()
@janmoesen
janmoesen / varDump.php
Created Oct 16, 2012
Get the output of var_dump() for better legibility
View varDump.php
<?php
/**
* Get the output of var_dump() for better legibility.
*
* @param mixed $arg1..N
*/
function getVarDump() {
$output = array();
@janmoesen
janmoesen / sporza.sh
Created Sep 24, 2012
Download Sporza videos based on web page URL
View sporza.sh
#!/bin/bash
function log {
echo "$@" 1>&2;
}
for page_url; do
log "Now processing page: $page_url";
# Assemble the playlist URL. It is stored in two JavaScript properties in
# the HTML page.
@janmoesen
janmoesen / twatspam.pl
Created Apr 19, 2012
Twatspam for Irssi: expand tweets in channels
View twatspam.pl
# == WHAT
# Expand the tweets mentioned in a channel, as well as the tweets those tweets refer to.
#
# == WHO
# Jan Moesen, 2012
#
# == INSTALL
# Place these files in `~/.irssi/scripts/`.
# /script load twatspam.pl
@janmoesen
janmoesen / switcheroo.sh
Created Nov 1, 2011
Atomic symlink switcheroo test script for GNU mv
View switcheroo.sh
#!/bin/bash
# Make a temporary directory for our little test.
mkdir linkage.tmp || exit $?;
cd linkage.tmp;
# Create two directories and a symlink to the first.
rm -rvf v1 v2 current;
mkdir v1 v2;
ln -s v1 current;