Skip to content

Instantly share code, notes, and snippets.

@waltman
waltman / gist:2971abe8aa4b4c7ea46b
Created April 23, 2015 02:14
Your script needs to send this to sendmail
From: foo@bar.com
To: root@backupserver.com
Subject: blah blah blah
stdin
@waltman
waltman / gist:fbf45f147f32ea8d2b9a
Created July 1, 2015 02:13
Looks like the leap second broke uptimed!
% uprecords -M -m50
# Uptime | System Boot up
----------------------------+---------------------------------------------------
1 89 days, 00:04:15 | Linux 3.0.0-1-686-pae Tue Aug 30 22:59:50 2011
2 75 days, 06:42:11 | Linux 3.2.0-3-686-pae Mon Aug 20 14:50:03 2012
3 58 days, 02:26:16 | Linux 3.2.0-4-686-pae Tue Jan 15 17:57:14 2013
4 53 days, 15:48:59 | Linux 3.2.0-4-686-pae Sat Nov 3 21:33:00 2012
5 51 days, 00:27:25 | Linux 3.10-3-686-pae Tue Oct 1 22:28:43 2013
6 50 days, 02:02:33 | Linux 3.2.0-4-686-pae Fri Apr 26 07:03:47 2013
7 44 days, 23:15:57 | Linux 3.16.0-4-686-pae Wed Apr 29 22:06:30 2015
@waltman
waltman / gist:c210b440898d7e2d60e9
Created August 15, 2015 01:57
Errors and warnings starting gnucash
$ gnucash
;;; note: source file /usr/share/guile/2.0/language/tree-il.scm
;;; newer than compiled /usr/lib/i386-linux-gnu/guile/2.0/ccache/language/tree-il.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /usr/share/guile/2.0/language/tree-il.scm
;;; WARNING: compilation of /usr/share/guile/2.0/language/tree-il.scm failed:
;;; ERROR: no such language scheme
;;; note: source file /usr/share/guile/2.0/language/value/spec.scm
;;; newer than compiled /usr/lib/i386-linux-gnu/guile/2.0/ccache/language/value/spec.go
@waltman
waltman / decimal2dms.pl
Created August 3, 2012 02:59
How to convert a floating point number to degrees, minutes and seconds
sub decimal2dms {
my ($decimal) = @_;
my $sign = $decimal <=> 0;
my $degrees = int($decimal);
# convert decimal part to minutes
my $dec_min = abs($decimal - $degrees) * 60;
my $minutes = int($dec_min);
my $seconds = ($dec_min - $minutes) * 60;
sub decimal2dms {
my ($decimal) = @_;
my $sign = $decimal <=> 0;
my $degrees = int($decimal);
# convert decimal part to minutes
my $dec_min = abs($decimal - $degrees) * 60;
my $minutes = int($dec_min);
my $seconds = ($dec_min - $minutes) * 60;
@waltman
waltman / 2012-08-25-hello-mpsig.markdown
Created August 26, 2012 02:07
Segfault in 'rake generate' trying to load a gist
layout title date comments categories
post
Hello MPSIG
2012-08-25 21:26
true

This is my first post.

@waltman
waltman / gist:3956515
Created October 26, 2012 01:56
ssh -vv cryonet.no-ip.org
% ssh -vv cryonet.no-ip.org
OpenSSH_6.0p1 Debian-3, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /home/waltman/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to cryonet.no-ip.org [96.245.7.108] port 22.
debug1: connect to address 96.245.7.108 port 22: Connection timed out
ssh: connect to host cryonet.no-ip.org port 22: Connection timed out
%
@waltman
waltman / gist:5467771
Created April 26, 2013 14:33
Log messages from this morning's kernel panic
syslog
------
Apr 26 02:32:02 caspar kernel: [1742643.008084] ata3.00: exception Emask 0x0 SAct 0xf SErr 0x0 action 0x6 frozen
Apr 26 02:32:02 caspar kernel: [1742643.008093] ata3.00: failed command: READ FPDMA QUEUED
Apr 26 02:32:02 caspar kernel: [1742643.008100] ata3.00: cmd 60/40:00:00:9a:69/00:00:08:00:00/40 tag 0 ncq 32768 in
Apr 26 02:32:02 caspar kernel: [1742643.008102] res 40/00:00:00:4f:c2/00:00:00:00:00/40 Emask 0x4 (timeout)
Apr 26 02:32:02 caspar kernel: [1742643.008107] ata3.00: status: { DRDY }
Apr 26 02:32:02 caspar kernel: [1742643.008110] ata3.00: failed command: READ FPDMA QUEUED
Apr 26 02:32:02 caspar kernel: [1742643.008117] ata3.00: cmd 60/08:08:b8:09:e2/00:00:03:00:00/40 tag 1 ncq 4096 in
Apr 26 02:32:02 caspar kernel: [1742643.008119] res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
@waltman
waltman / rewind 30 seconds.applescript
Created May 5, 2013 01:46
This rewinds the current track in iTunes 30 seconds. I usually use it to go back a little bit when I'm listening to podcasts.
on run {input, parameters}
tell application "iTunes"
set player position to (player position - 30)
end tell
return input
end run
@waltman
waltman / findMinMax.pl
Created July 31, 2017 18:43
findMinMax.pl
#!/usr/bin/env perl
use strict;
use warnings;
use feature ":5.10";
use feature 'signatures';
no warnings "experimental::signatures";
use Algorithm::Combinatorics qw(permutations);
my @ints = @ARGV;