Archive for the 'scripts' Category

Hacking Time Machine

Posted by dre on August 8th, 2008

It’s “hack some shit up” Friday. Everybody ready?
Have a Time Capsule or Mac OS X Server configured to provide network time machine backups? Of course you do! Let’s examine the client / server interaction.
The Time Machine preference pane provides a list of available backup volumes. This list includes local volumes as well as network volumes. [...]

disksleep

Posted by dre on November 15th, 2007

The purpose of this script is to add a bit of granularity and intelligence to the energy saver settings in Mac OS X for disk sleep.
Problem: I want to let my disks sleep, but I HATE having to wait for a spinup while I’m working.
Solution: Allow the disks to spin down only when I’m not [...]

Tiger Server servermgrd library for Python

Posted by dre on June 11th, 2007

motivation
I finally found a reason to write some Python. Being something of a monitoring and data junkie, I’ve had a fair amount of experience with snmp, data mining scripts, etc. After writing this post to the server list, I figured I’d make some templates for snmp that published interesting pieces of data about the server. [...]

DNS Zone File record generation script

Posted by dre on June 7th, 2007

In wrote the following as part of my response to this.
#!/usr/bin/perl -w
use strict;

# Place the first three octets here.
my $AddressPrefix = “10.0.1″;

# Define the range of numbers, inclusive.
my $range = “2 .. 10″;

# Your fqdn suffix here, e.g. “foo.com” or “k12.fl.us.gov”
my $tld = “937″;

# Need a backwards representation for PTR records
my $octets = join(”.”, reverse(split(/\./, [...]

Eggdrop TCL using Google’s SOAP API

Posted by dre on May 27th, 2007

Link to google-soap
I was helping my brother with a script called incith-google used by one of his IRC bots. It acts as a bridge between IRC and google, allowing IRC users to perform queries against google from the comfort of their IRC client. The script performs the search on the IRC user’s behalf and returns [...]

Apple airport base station monitor

Posted by dre on April 27th, 2007

Download.

{1} andre@dude [~] % airport -h
Program Options:
-h print this help
-d output in comma delimited format
[...]

Installing perl modules locally

Posted by dre on December 6th, 2006

Dealing with CPAN has always felt a little weird. Today I found a nice shortcut for getting perl modules installed in a home directory, which is really useful for when you don’t have admin on the box, or if you simply prefer to keep your custom perl stuff all cinched up in a tidy homedir [...]

Spotlight indexes on read-only media

Posted by dre on September 8th, 2006

Here’s a way to let spotlight do a full content index of a read only CD. It can even persist across uses :)
#!/bin/sh
# pass in the name of the r/o volume, e.g. DiskWarriorCD
# this is proof of concept only. seriously :)
if [ ! $1 ] ; then echo “supply a volume name” ; exit 1 [...]

adduser script for Mac OS X / Mac OS X Server

Posted by dre on July 9th, 2006

http://www.dreness.com/bits/tech/adduser.html (syntax colored)
http://www.dreness.com/bits/tech/adduser (raw)

Automated backups of Open Directory databases

Posted by dre on June 1st, 2006

# Automated backups of Open Directory databases (ldap / kerberos / password server)
# This needs to run as root and should be mode 700 due to embedded password

# Get current date
TODAY=`/bin/date +’%m-%d-%y_%H:%M:%S’`

# Set destination directory (do not include trailing slash!)
DSTDIR=/path/to/backups

# Set archive password (needed to restore from / unlock the resulting dmg)
PASS="the_foo"

# Feed a [...]