Monthly Archives: October 2007

Bash Tip: Closing File Descriptors

I recently found that you can close bash file descriptors fairly easily, it goes like this: exec 0>&- # close stdin exec 1>&- # close stdout exec 2>&- # close stderr Which makes it easy to daemonize things using only bash (lets face it there are times when you JUST don’t need anything more than [...]

Throttle your Threads…

Lets say you want to run some command, such as /bin/long-command on a set of directories. And you have a lot of directories. You know it’ll take forever to complete serially, so you want to cook up a way to run these commands in parallel. You know the server CAN handle more than one command [...]

so-you-wanna-see-an-image

We’ve been asked how we manage serving files from Amazons very cool S3 service at WordPress.com… This is how. (covering a requested image already stored on S3, not the upload -> s3 process) A request comes into pound for a file. Pound hashes the hostname (via a custom patch which we have not, but may, [...]

Useful bash oneliner: List Server IP Addresses

for i in $(/sbin/ifconfig | grep addr: | cut -d’:’ -f2 | cut -d’ ‘ -f1 | grep -Ev ‘^$’); do echo -n $i”, “; done | sed -r s/’, $’/”/g; echo

I have to say

this is amazing: http://jan.kneschke.de/2007/10/7/wormhole-index-reads and I cant wait to try it somewhere!

Autumn Leaves Leaf #3: Commander

This leaf is capable of running a script on the local server in response to the !deploy channel command. For security you have to authenticate first. To do so you send it a message with a password. it then it http authenticates against a specific url with your nickname and the mesage text as the [...]

Autumn Leaves Leaf #2: Feeder

This handy little bot keeps track of RSS feeds, and announces in the channel when one is updated. (note: be sure to edit the path to the datafiles) Each poller runs inside its own ruby thread, and can be run on its own independent schedule require ‘thread’ require ‘rss/1.0′ require ‘rss/2.0′ require ‘open-uri’ require ‘fileutils’ [...]

Autumn Leaves Leaf #1: Announcer

This bot is perfect for anything where you need to easily build IRC channel notifications into an existing process. It’s simple, clean, and agnostic. Quite simply you connect to a TCP port, give it one line, the port closes, the line given shows up in the channel. eg: echo ‘hello’ | nc -q 1 bothost [...]

Autumn Leaves (a ruby framework for IRC bots)

What an awesome awesome thing for people who use IRC in their day to day lives!  I’ll post a couple of utility leaves here real quick. Link: http://www.shutupgeorge.com/al-docs/