Skip to content

Instantly share code, notes, and snippets.

# This restores the countdown timer feature (a.k.a. beer o'clock) to Erco's rather fabulous nixieclock
# <http://seriss.com/people/erco/unixtools/nixieclock/>
# Seems my original patch has been partially reverted.
--- nixieclock.C.orig 2009-10-28 03:53:28.000000000 +0000
+++ nixieclock.C 2010-09-03 16:37:43.000000000 +0100
@@ -68,8 +68,7 @@
" -t # test pattern for alphanumeric display\n"
" -n # no background mode (don't fork)\n"
" -geometry <pos> # sets geometry (x windows style positions)\n"
#!/bin/sh
CFS="key zomo"
for C in ${CFS} ; do
DMG=${HOME}/cfs/${C}.dmg
if [ ! -f ${DMG} ] ; then
echo no ${DMG} for ${C}
next
fi
#!/bin/sh
SPESHUL=0
START=1582 # start of Gregorian
END=2010
RANGE=$(( ${END} - ${START} ))
for YEAR in $( jot - ${START} ${END} ) ; do
# cal outputs fixed positioned columns, but need to ditch header and blank lines
FRI=$( cal 10 ${YEAR} | cut -c16,17 | tail +3 | grep -v '^\s*$' | wc -l )
@jonyesno
jonyesno / tar-write-exit-status.patch
Created October 11, 2010 06:25
Make tarsnap return same exit codes as bsdtar. Helps with detecting transient v fatal errors.
--- tarsnap-autoconf-1.0.32.orig/tar/write.c 2012-02-22 13:10:53.000000000 +0100
+++ tarsnap-autoconf-1.0.32/tar/write.c 2012-06-28 02:10:21.000000000 +0200
@@ -683,7 +683,7 @@
if (!tree) {
bsdtar_warnc(bsdtar, errno, "%s: Cannot open", path);
- bsdtar->return_value = 1;
+ bsdtar->return_value = 2;
return;
}
--- /var/tmp/exim_mailstats 2010-10-25 09:45:38.000000000 +0100
+++ ./exim_mailstats 2010-10-25 09:59:10.000000000 +0100
@@ -106,8 +106,8 @@
my ($LOGFILE, $rotated) = tail_open($fname, $start);
- if ($rotated) {
- # Reset everything if the log has been rotated
+ if ($rotated || $received eq 'U') {
+ # Reset everything if the log has been rotated or we've just initialized
@jonyesno
jonyesno / parsed.rb.patch
Created October 29, 2010 10:04
Patch to make Puppet also assume the target user's group when writing authorized_keys
--- /usr/lib/ruby/site_ruby/1.8/puppet/provider/ssh_authorized_key/parsed.rb.orig 2010-10-29 10:55:56.000000000 +0100
+++ /usr/lib/ruby/site_ruby/1.8/puppet/provider/ssh_authorized_key/parsed.rb 2010-10-29 11:12:59.000000000 +0100
@@ -64,12 +64,13 @@
def flush
raise Puppet::Error, "Cannot write SSH authorized keys without user" unless user
raise Puppet::Error, "User '#{user}' does not exist" unless uid = Puppet::Util.uid(user)
+ raise Puppet::Error, "Can't obtain gid for user '#{user}'" unless gid = Puppet::Util.gid(user)
unless File.exist?(dir = File.dirname(target))
Puppet.debug "Creating #{dir}"
Dir.mkdir(dir, dir_perm)
@jonyesno
jonyesno / htracr.patch
Created November 26, 2010 12:10
Patch to htracr to accept interface name on commandline
--- htracr.js.orig 2010-11-26 11:36:51.000000000 +0000
+++ htracr.js 2010-11-26 12:08:49.000000000 +0000
@@ -16,13 +16,14 @@
server_names: {},
pcap_session: undefined,
drop_watcher: undefined,
+ device: '',
start_capture: function() {
var self = this
@jonyesno
jonyesno / latest-rpm-filter.rb
Created December 9, 2010 10:00
filter ls(1) output for just the highest version of each RPM package
#!/usr/bin/env ruby
# filter ls(1) output for just the highest version of each RPM package
# naively splits the filename into name / version on the first hyphen-followed-by-digit
# "tactical"
stash = {}
while l = gets
l.chomp!
begin
@jonyesno
jonyesno / surprise.pl
Created January 20, 2011 13:32
Things that surprise me about Perl
#!/usr/bin/env perl
my @a = undef ;
if (@a) { print "YES!\n"; } else { print "NO\n"; }
my $a = undef ;
if ($a) { print "YES!\n"; } else { print "NO\n"; }
my @a = ();
@jonyesno
jonyesno / defer-mail.sh
Created February 17, 2011 13:52
Exim mail defer script
#!/bin/sh
# http://www.exim.org/exim-html-current/doc/html/spec_html/ch29.html
#
# script to run under Exim's pipe transport that returns the magic
# exit code such that exim defers delivery
#
# relies on defaults for temp_errors setting
#
# useful to put piped mail handling on hold during maintenance
exit 75