Skip to content

Instantly share code, notes, and snippets.

# posted partly as an aide-memoire, but more usefully, as a prompt
# for me to make this into a proper stop-start daemon
# hopefully, one that won't have hardcoded machine names...
IPADDR=`ifconfig en0 | grep 'inet ' | awk '{print $2}' | sed 's/addr://'`
ssh house.husk.org -N -f -L *:3698:foil:3689
dns-sd -P "foil" _daap._tcp. local 3698 foil.local. $IPADDR txtvers=1 "Database ID=BC2C8AD5" "Machine ID=BC2C8AD5" &
@sheepmaster
sheepmaster / cleanup.pl
Created February 10, 2010 19:59
cleanup.pl
#! /usr/bin/perl
use strict;
use warnings;
use File::Path;
sub folder($) {
my $file = shift;
my (undef, undef, undef, $day, $mon, $year) = localtime((stat($file))[10]);
$year += 1900;
#!/usr/bin/perl
use strict;
use warnings;
my $headref = `git symbolic-ref HEAD`;
my $head;
unless (($head) = ($headref =~ m!^refs/heads/(.*)!)) {
die "invalid HEAD ref '$headref'";
}
#!/usr/bin/perl
use strict;
use warnings;
my $headref = `git symbolic-ref HEAD`;
if (my ($head) = ($headref =~ m!^refs/heads/(.*)!)) {
my $fh;
unless (open($fh, '-|', qw[git branch -r --no-merge HEAD])) {
print STDERR "Couldn't execute 'git branch -r --no-merge HEAD': $!\n";
@sheepmaster
sheepmaster / distcc
Created June 17, 2010 13:00
distcc shim
#!/bin/sh
# Wraps distcc compiler calls in ccache.
# Install at /Developer/usr/bin.
DISTCC=/usr/bin/distcc
export CCACHE_PREFIX="$DISTCC"
if [ "$1" == "--host-info" ]; then
#!/bin/bash
# Given a grep expression, create a graph of occurrences of that expression
# in your code's history.
set -e
expr="$1"
datafile=$(mktemp)
@sheepmaster
sheepmaster / symirror
Created December 13, 2010 17:31
Perl Cookbook, recipe 9.11
#!/usr/bin/perl -w
# symirror - build spectral forest of symlinks
use strict;
use File::Find;
use Cwd;
my ($srcdir, $dstdir);
my $cwd = getcwd();
die "usage: $0 realdir mirrordir" unless @ARGV == 2;
#!/usr/bin/perl
use strict;
use warnings;
my $mirror_branch = '__mirror';
for (<>) {
chomp;
my ($old, $new, $branch) = split / /;
#!/usr/bin/perl
use strict;
use warnings;
my $ref = `git stash create`;
chomp($ref);
$ref ||= 'HEAD';
#!/bin/sh
USAGE='[-b <branch>] [--interactive | -i] [-v] [--quiet | -q] <base> [<target>]'
SUBDIRECTORY_OK=Yes
. git-sh-setup
rebase_options=
set -e