Instantly share code, notes, and snippets.

Wolf thonixx

View GitHub Profile
thonixx /
Last active May 4, 2017
Resize a VM disk online and on-the-fly
## Prerequisites:
## - already resized disk on the VM host
## Notes:
## - I assume that we have three partitions (primary (root fs), extended, logical (swap))
## - I assume that we move swap out of the extended partition and convert to a normal primary one
## - I also assume that we place swap at the end of the disk
thonixx / aaaa oneliner
Last active Sep 19, 2017
One liner collection (and short things)
View aaaa oneliner
# open gist for oneliner (or very short bash things) collection
thonixx /
Created Feb 20, 2017
Check a website with custom IP and ports
red="$(tput setaf 1)"
green="$(tput setaf 2)"
yellow="$(tput setaf 3)"
blue="$(tput setaf 4)"
bold="$(tput bold)"
reset="$(tput sgr0)"
thonixx / language-handling.conf
Created Jul 19, 2016
Language handling with RewriteRules only
View language-handling.conf
RewriteEngine on
# Language detection (Fallback is en)
RewriteCond %{HTTP:Accept-Language} ^de [NC]
RewriteCond %{ENV:lang} ^$
RewriteRule ^ - [E=lang:de]
RewriteCond %{HTTP:Accept-Language} ^fr [NC]
RewriteCond %{ENV:lang} ^$
RewriteRule ^ - [E=lang:fr]
thonixx / force-ruby-to-make-it-an-array.erb
Created Jul 19, 2016
Force Ruby to build an array of of an array-like string
View force-ruby-to-make-it-an-array.erb
# define things
orig='["item1", "item2"]'
orig=["item3", "item4"]
# force ruby to make it an array
if ! orig.respond_to?('each')
var=orig.gsub(/(^\[|\]$)/, "").gsub(/\"/, "").gsub(/\ */, "").split(",")
thonixx /
Last active May 10, 2017
Wait for a server and try to log in via SSH (public key)
# global ssh arguments
SSHARG="-o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null"
TIMEOUT="$(uname | grep -q Darwin && echo gtimeout || echo timeout)"
# get IP address from hostname
getIP() {
# return with failure if no server given
test -z "$1" && return 1
thonixx / remove-puppet-user.pp
Created Mar 24, 2015
Remove Puppet user which has running processes
View remove-puppet-user.pp
define your_class::user (
$user = $name,
$ensure = 'present',
# only call when user gets removed
if $ensure == 'absent' {
exec {
"killing ${user}":
command => "pkill -9 -u ${user}",
thonixx /
Last active Aug 29, 2015
PFX to PEM cert and key
# crt
openssl pkcs12 -in $file -out zertifikat.crt -clcerts -nokeys
# key
openssl pkcs12 -in $file -out schluessel.key -nocerts -nodes
# ca certs
openssl pkcs12 -in $file -out chain.crt-cacerts -nokeys

Keybase proof

I hereby claim:

  • I am thonixx on github.
  • I am thonixx ( on keybase.
  • I have a public key whose fingerprint is 7E0E 07A0 A16E FC84 257B 9F01 ED8D 4A44 9DDD 5DA4

To claim this, I am signing this object:

thonixx /
Created Sep 16, 2013
function stopwatch() for bash/zsh
# simple stopwatch function
# scripted by
function stopwatch () {
# config
# initialise seconds and start with second 1
# define maximum of dots to display