Skip to content

Instantly share code, notes, and snippets.

@ruudud
ruudud / casper.cookies.spec.js
Created January 23, 2014 09:47
Setting cookies before page load in a CasperJS test.
casper.test.setUp(function () {
casper.echo('Cookies enabled?: ' + phantom.cookiesEnabled);
phantom.addCookie({
domain: '.localhost',
name: 'sessionId',
value: '12345abcd6789efg'
});
casper.start("http://localhost:8000/test_index.html#pageRequiringLogin", function () {
casper.echo('Start callback has cookie: ' + JSON.stringify(phantom.cookies));
});
#!/bin/bash
# Source files so we can announce stuff
. /mnt/apps/scripts/setenv.sh
. /mnt/apps/scripts/hipchat_notify.sh
if [ $(pidof -x deploy_if_new.sh | wc -w) -gt 2 ]; then
echo "$(date +"%Y-%m-%d %H:%M:%S %Z") Cowardly exiting as deploy_if_new is already running"
exit -1
fi

Keybase proof

I hereby claim:

  • I am ruudud on github.
  • I am ruudud (https://keybase.io/ruudud) on keybase.
  • I have a public key whose fingerprint is EF97 8A63 DF96 F778 C0C2 263B 1911 C986 E3C1 E737

To claim this, I am signing this object:

@ruudud
ruudud / tmux-ssh
Created June 19, 2014 13:09
Poor-mans cssh
#!/bin/bash
# Based on https://github.com/dennishafemann/tmux-cssh/blob/master/tmux-cssh
tmux_session_name="multissh"
tmux new-session -d -s "${tmux_session_name}" "ssh $1"
shift
hosts="${@}"
@ruudud
ruudud / instructions.md
Created October 8, 2014 14:30
ios-webkit-debug-proxy on Ubuntu 14.04
$ mkdir ~/ios-proxy && cd $_
$ git clone https://github.com/google/ios-webkit-debug-proxy
$ sudo apt-get install \
      autoconf automake \
      libusb-dev libusb-1.0-0-dev \
      libplist-dev libplist++-dev \
      usbmuxd \
      libimobiledevice-dev
$ wget http://www.libimobiledevice.org/downloads/libplist-1.11.tar.bz2
@ruudud
ruudud / weechat.md
Last active October 15, 2015 12:19
weechat cmds

Default disable hilights

/set weechat.look.buffer_notify_default highlight

Enable hilights in specific channel

/set weechat.notify.irc.freenode.#go-nuts message

Hide nicklist

@ruudud
ruudud / deploy.sh
Created November 13, 2014 08:51
Zero-downtime deploy with Docker and Hipache
#!/bin/bash
set -eo pipefail
#set -x
port=3000
docker_opts="-v /srv:/srv:ro -p $port"
if [[ "$#" -ne 2 ]] || [[ "$1" =~ (^h(elp)?$) ]]; then
echo "Usage: $0 <vhost> <container name>"
exit 1
@ruudud
ruudud / ghpr
Last active August 6, 2018 09:44
GitHub Pull Request Applier
#!/bin/bash
# Motivation:
# http://blog.spreedly.com/2014/06/24/merge-pull-request-considered-harmful/
#
# This script aids in the process of getting a linear Git history when using
# GitHub Pull Requests.
# A special GitHub remote ref is added, which is fetched and used to create a
# patch of changes to be applied with `git am`. The PR is then closed.
#
# INSTALL
@ruudud
ruudud / notes.md
Last active April 15, 2016 10:00
gpg yubikey ssh

Preparing Yubikeys

Use neoman to change connection mode to OTP + UTF + CCID.

Setting up yubi with existing secret keys

Please note keytocard removes key from key ring, so you better have backup!

gpg --import /media/encrypted-media/mastersubkeys.txt
gpg --card-edit
> admin
> passwd
@ruudud
ruudud / example.ftl
Created January 18, 2016 13:59
Freemarker JSON dump
<#assign foo><@objectToJson object=data.myobj /></#assign>
${foo?html}
<#macro objectToJson object>
<@compress single_line=true>
<#if object?is_hash || object?is_hash_ex>
<#assign first="true">
{
<#list object?keys as key>
<#if first="false">,</#if>