Archive for the 'scripts' Category

Somniac and a UI scripting quickie

Posted by dre on August 4th, 2010

Just about every time I want an AppleScript to wait a second or two during script execution, I instinctively insert a “sleep x” statement, where x is some small number of seconds. Every time, I’m surprised when I test the script and my computer promptly… goes to sleep. The command to use is delay, not [...]

Cross-application URL cache searching!

Posted by dre on October 27th, 2008

I was out taking a (filesystem) walk, and wandered into /var/folders. Not remembering where / when this came from, I was pleased to find that the hier(7) manpage is aware of this directory, describing it as ‘per-user temporary files and caches’. More research reveals that this directory structure is created as defined by some code [...]

get notified!

Posted by dre on September 7th, 2008

Mac OS X makes extensive use of a variety of event notification mechanisms, as described here. One such mechanism is documented in the notify(3) man pages, and it is these types of libnotify notifications that are the focus of this post. Notifications can be posted and observed in a global namespace across all processes (with [...]

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 [...]

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 [...]

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 [...]

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 [...]

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 [...]

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 (base station ID lines are designated by ‘*’) -v verbose mode (stacks up to 3 times) –encode Specify plaintext to retrieve the base64 encoding. This should be used to store the SNMP community name near the [...]

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 [...]

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) Link Summaryhttp://www.dreness.com/bits/tech/adduser.htmlhttp://www.dreness.com/bits/tech/adduser

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 [...]