Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View florianbeer's full-sized avatar

Florian Beer florianbeer

View GitHub Profile
@florianbeer
florianbeer / hostup
Created April 20, 2015 20:35
Alert if host is back up
hostup() {
if (( $# != 1 )); then
echo "Usage: hostup HOSTNAME"
else
until $(which ping) -W1 -c1 ${1} > /dev/null; do sleep 5; done && $(which say) "${1} is up"
fi
}

Keybase proof

I hereby claim:

  • I am florianbeer on github.
  • I am azathoth (https://keybase.io/azathoth) on keybase.
  • I have a public key whose fingerprint is 9E4F 7BD3 0C55 4FF1 0888 DD54 2FCC 239A 37DA 392F

To claim this, I am signing this object:

@florianbeer
florianbeer / gist:7a3087f8ca37873b8813ea1da0dfdb89
Created August 14, 2016 21:42
XMLHttpRequest reference implementation
var req;
function loadXML(url) {
req = false;
// native JavaScript XMLHttpRequest Objekt
if (window.XMLHttpRequest && !(window.ActiveXObject)) {
try {
req = new XMLHttpRequest();
} catch (e) {
req = false;
#!/bin/bash
# Copyright (C) 2012 Stefan Breunig <stefan+measure-net-speed@mathphys.fsk.uni-heidelberg.de>
# Copyright (C) 2014 kaueraal
# Copyright (C) 2015 Thiago Perrotta <perrotta dot thiago at poli dot ufrj dot br>
# Copyright (C) 2017 Florian Beer <fb@42dev.eu> - modified to display kbps & Mbps instead of kB/s and MB/s
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
@florianbeer
florianbeer / set-tmux-title
Created April 21, 2015 10:47
Set tmux pane title to short hostname on ssh connections
ssh() {
if [ "$(ps -p $(ps -p $$ -o ppid=) -o comm=)" = "tmux" ]; then
tmux rename-window "$(echo $* | cut -d . -f 1)"
command ssh "$@"
tmux set-window-option automatic-rename "on" 1>/dev/null
else
command ssh "$@"
fi
}