Skip to content

Instantly share code, notes, and snippets.

View bandwith_bits
#!/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 / gist:7a3087f8ca37873b8813ea1da0dfdb89
Created Aug 14, 2016
XMLHttpRequest reference implementation
View gist:7a3087f8ca37873b8813ea1da0dfdb89
var req;
function loadXML(url) {
req = false;
// native JavaScript XMLHttpRequest Objekt
if (window.XMLHttpRequest && !(window.ActiveXObject)) {
try {
req = new XMLHttpRequest();
} catch (e) {
req = false;
View keybase.md

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 / set-tmux-title
Created Apr 21, 2015
Set tmux pane title to short hostname on ssh connections
View set-tmux-title
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
}
@florianbeer
florianbeer / hostup
Created Apr 20, 2015
Alert if host is back up
View hostup
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
}