Skip to content

Instantly share code, notes, and snippets.

@ruudud
ruudud / ExecTest.java
Created June 18, 2016 21:13
Working with streams, futures, threads and executor service in Java
package com.github.ruudud.exectest;
import com.google.common.base.Stopwatch;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.List;
import java.util.concurrent.*;
import java.util.stream.Collectors;
const blessed = require('blessed');
const STATUS = {
pending: "PENDING"
};
class Character {
tick() {
if (Math.random*2 > 1) {
this.fight();
@ruudud
ruudud / .eslintrc
Created April 22, 2016 10:36
npm scripts build system
{
"extends": "airbnb/base"
}
@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>
@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 / 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 / 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 / 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 / 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 / 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="${@}"