Skip to content

Instantly share code, notes, and snippets.

View rolfvreijdenberger's full-sized avatar

Rolf Vreijdenberger rolfvreijdenberger

View GitHub Profile
@rolfvreijdenberger
rolfvreijdenberger / gist:6b6c9b269d0bb30183be
Created February 8, 2015 12:35
cleaning up torrents from transmission-daemon
#!/bin/bash
#set username and password for authentication
user=transmission
password=transmission
host=127.0.0.1
port=9091
# get the list of 100% Done and Stopped or Finished torrents. the last sed command removes the * from a torrent id that indicates an error.
list=$(transmission-remote $host:$port --auth=$user:$password --list | sed -e '1d;$d;s/^ *//' | grep -e '100%.*Done.*\(Stopped\|Finished\)' | cut --only-delimited --delimiter=' ' --field=1 | sed 's/*//')
@rolfvreijdenberger
rolfvreijdenberger / gist:af6b2a7527263b8c8200
Last active August 29, 2015 14:03
no-ip.org no-ip.com automatic updater for bash/linux with host parameter and examples
#!/bin/bash
# original: https://github.com/AntonioCS/no-ip.com-bash-updater/blob/master/noipupdater.sh
# this file: https://gist.github.com/rolfvreijdenberger/af6b2a7527263b8c8200
# more info on no-ip.com api: http://www.noip.com/integrate/request
# usage:
# 1. put it somewhere in your filesystem
# 2. make the file executable
# 3. adjust the parameters provided below:
@rolfvreijdenberger
rolfvreijdenberger / xdebug.ini
Created May 9, 2014 08:27
xdebug.ini (php) and some configuration specs for activating xdebug
;file: /etc/php5/mods-available/xdebug.ini
;cd /etc/php5/conf.d/ && ln -s ../mods-available/xdebug.ini xdebug.ini
zend_extension=/usr/lib/php5/20121212/xdebug.so
;the next lines were added, so they are enabled for each php environment
;like cli and apache2 and we don't have to add that to their specific env settings
;in /etc/php5/<apache2|cli>/php.ini
;this file is /etc/php5/mods-available/xdebug.ini and it is actived
;by the symlink in /etc/php5/conf.d
@rolfvreijdenberger
rolfvreijdenberger / phpunit-xdebug
Last active February 23, 2016 12:14
phpunit-xdebug (/usr/local/bin/phpunit-debug)
#!/bin/bash
# /usr/local/bin/phpunit-debug
# a wrapper around phpunit with xdebug enabled for eclipse
# make sure the debug session is started in the debug client (eclipse, netbeans, choose one of the settings below)
# see component diagram on https://en.wikipedia.org/wiki/Xdebug
# export XDEBUG_CONFIG="idekey=ECLIPSE_DBGP"
export XDEBUG_CONFIG="idekey=netbeans-xdebug"
phpunit --colors $@
@rolfvreijdenberger
rolfvreijdenberger / gist:8635153
Created January 26, 2014 16:18
bitcoin brain wallet private key generator. enter the seed / brain wallet phrase and it returns the private key in hex
#!/bin/bash
# creates a private key from a 'brain wallet'
if [ -z "$1" ]; then
echo "provide the bitcoin brain wallet seed to get the private key:";
read SEED;
else
SEED=$1;
fi
echo "seed (brain wallet): $SEED";
echo -n "bitcoin private key: ";
@rolfvreijdenberger
rolfvreijdenberger / gist:7634714
Created November 25, 2013 01:05
fill an existing file filled with a string of choice to the exact filesize the file currently has. using bash and dd
size=`wc -c test.txt | cut -f6 -d" "` && while true; do echo -n "x"; done | dd of=~/test.txt bs=$size count=1
@rolfvreijdenberger
rolfvreijdenberger / gist:5141792
Created March 12, 2013 10:20
php snippet to easily get a list of constant key/values from a class. easy in a util class for reuse.
/**
* gets the constants from a class. this is useful if the constants are part
* of a logical group (especially when prefixed with the same value)
* @param string $from the classname (can be __CLASS__)
* @param string $prefix the prefix for the constants
* @param string $values_only do we want a key=>value array or values only
* @return array
*/
public static function getConstants($from, $prefix = null, $values_only = false)
{
package nl.vreijdenberger.tests.fixtures;
import java.math.BigInteger;
import java.net.URL;
import java.security.SecureRandom;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import nl.vreijdenberger.model.Registry;