This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shell + Perl one-liner to sort and show the sizes of your pwd. | |
du -k | sort -n | perl -ne 'if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf ("%6.1f\t%s\t%25s %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x (1.5*$l),$2);}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# | |
# Useful for making maps like the one at http://backspace.com/mapapp/javascript_world | |
# | |
use XML::TreeBuilder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem: We have a log line that includes a perl class that we want to log the class | |
and method in their respected fields. An example class and method in perl: | |
Animal::Dog::bark | |
In this example, "bark" is the method. "Animal::Dog" is the class. | |
After some searching and hacking, I found a solution that works with Logstash 1.4.2 | |
Assume the input is "Animal::Dog::bark". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby { | |
code => "event['_logstash_host'] = Socket.gethostname" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On the host | |
============= | |
lxc config set openvpn raw.lxc 'lxc.cgroup.devices.allow = c 10:200 rwm' | |
lxc config device add openvpn tun unix-char path=/dev/net/tun | |
# In the container | |
================== | |
1. mknod /dev/net/tun c 10 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://www.simpleprecision.com/ubuntu-16-04-lxd-networking-simple-bridge/ |