Skip to content

Instantly share code, notes, and snippets.

View towo's full-sized avatar

Tobias Wolter towo

View GitHub Profile
@towo
towo / ping-ok.sh
Created December 18, 2014 21:11
Ping check for hosts
#!/bin/sh
# Takes a list of space-separated hosts, FQDN or IP, as parameters.
# Will check each host with just one ping, Vassily, to see if they respond.
# Will print reachability for each host.
# No input validation.
for host in $@; do
echo -n "$host: "
if ping -c1 $host > /dev/null 2>&1; then
echo reachable;
@towo
towo / pisg-euirc-mode-patch.diff
Created August 7, 2012 19:04
Patches pisg to respect euIRC modes
--- modules/Pisg/Parser/Format/irssi.pm.old 2008-02-13 21:40:25.000000000 +0100
+++ modules/Pisg/Parser/Format/irssi.pm 2010-03-16 02:29:42.000000000 +0100
@@ -10,7 +10,7 @@
my ($type, %args) = @_;
my $self = {
cfg => $args{cfg},
- normalline => '^(\d+):\d+[^<*^!]+<[@%+~& ]?([^>]+)> (.*)',
+ normalline => '^(\d+):\d+[^<*^!]+<[@%+~&! ]?([^>]+)> (.*)',
actionline => '^(\d+):\d+[^ ]+ +\* (\S+) (.*)',
thirdline => '^(\d+):(\d+)[^-]+-\!- (\S+) (\S+) (\S+) (\S+) (\S+)(.*)',
@towo
towo / xdg-open-scheme-handler.diff
Created November 8, 2012 14:08
Patches xdg-open to decode scheme:// URLs by querying xdg-mime
--- /usr/bin/xdg-open 2011-10-04 06:49:38.000000000 +0200
+++ /home/towo/bin/xdg-open 2012-11-08 15:05:36.632522149 +0100
@@ -446,8 +446,35 @@
fi
fi
+ if (echo "$1" | egrep -q '^[a-z]+:'); then
+ scheme=`echo "$1" | cut -d: -f1`;
+ handler=`xdg-mime query default x-scheme-handler/$scheme`;
+ if [ -n "$handler" ] ; then
@towo
towo / clean-rc-packages.sh
Last active December 25, 2015 12:57
Miscellaneous Debian cleanup actions
# Purges packages that are in state "removed, config-files"
if dpkg-query -W --showformat='${Status}\n' dctrl-tools | grep -q 'install ok installed'; then
dpkg --purge $(grep-status -n -sPackage -FStatus config-files)
else
echo "Package 'dctrl-tools' needs to be installed."
fi
@towo
towo / keybase.md
Last active January 4, 2016 21:18
Dat keybase auth

Keybase proof

I hereby claim:

  • I am towo on github.
  • I am towo (https://keybase.io/towo) on keybase.
  • I have a public key whose fingerprint is C9CB 139A CC36 30CC C167 265F 8757 DBCA 823D E210

To claim this, I am signing this object:

@towo
towo / dhcp6c.conf
Created January 28, 2016 09:50
dhcp6c for prefix delegation
interface pppoe0 {
send ia-pd 1;
};
id-assoc pd 1 {
prefix-interface vr1 {
sla-id 0;
sla-len 16;
};
};
@towo
towo / 10-loglevel.conf
Last active April 5, 2016 15:02
Stop icinga2 logging information-level garbage via systemd
# Copy to /etc/systemd/system/icinga2.service.d/ (create if needed)
# systemctl daemon reload
# systemctl restart icinga2.service
[Service]
# need to unset ExecStart once because it would try to array it.
ExecStart=
ExecStart=/usr/sbin/icinga2 daemon -e /var/log/icinga2/icinga2.err -x warning
@towo
towo / logcheck_local_towo
Last active September 10, 2016 12:47
List of common rules I'm supplementing to Debian/Ubuntu logcheck installations that suppress issues that arise with publicly available services that people try to exploit.
^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ ansible-apt: Invoked with dpkg_options=force-confdef,force-confold upgrade=dist force=False package=None purge=False state=present update_cache=True default_release=None install_recommends=True deb=None cache_valid_time=None$
^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ ansible-lineinfile: .*dest=/etc/logcheck/ignore.d.server/local.*$
^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ ansible-setup: Invoked with filter=\* fact_path=/etc/ansible/facts.d$
^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ avahi-daemon\[[[:digit:]]+\]: server\.c: Packet too short or invalid while reading response record. \(Maybe a UTF-8 problem\?\)$
^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ console-kit-daemon\[[[:digit:]]+\]: GLib-CRITICAL: Source ID [[:digit:]]+ was not found when attempting to remove it$
^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ console-kit-daemon\[[[:digit:]]+\]: \(process:[[:digit:]]+\): GLib-CRITICAL \*\*: g_slice_set_config: assertion .sys_page_size == 0. failed$
^\w{3} [ :[:digit:]]{11} [._
@towo
towo / .tmux.conf
Last active October 24, 2016 23:05
Updating shells in tmux for new X sessions, specifically GNOME shell
set -g update-environment 'DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY DBUS_SESSION_BUS_ADDRESS'
@towo
towo / dist-upgrade.yml
Last active March 13, 2017 22:45
"Oh, who needs more than 256MB on /boot, how silly"
tasks:
- name: purge-old-kernels
script: '/home/towo/bin/purge-old-kernels -qy'
with_items: "{{ ansible_mounts }}"
when: ansible_distribution == 'Ubuntu' and item['mount'] == '/boot' and item['size_available' ] < 128000000