Adding an additional IP in OSX

Read more →

Backgrounding a shell task from PHP

Read more →

Bootstrapping a Debian Lenny server with puppet from backports

Initial bootstrap make sure lsb-release is installed aptitude install lsb-release add the backports key /usr/bin/wget -O - http://backports.org/debian/archive.key | /usr/bin/apt-key add and repository source cat > /etc/apt/sources.list <<EOF deb http://ftp.au.debian.org/debian lenny main contrib non-free deb-src http://ftp.au.debian.org/debian lenny main contrib non-free deb http://security.debian.org/ lenny/updates main contrib non-free deb-src http://security.debian.org/ lenny/updates main contrib non-free deb http://www.backports.org/debian lenny-backports main contrib non-free EOF do an update to get the backports packages in your package list
Read more →

Creating an XFS partition for best performance

Read more →

Finding group and other writable files and directories

Read more →

Getting the full fingerprint for a gpg key for apt sources in puppet

If you have ever seen the error Warning: /Apt_key[Add key: 25E010CF from Apt::Source freeswitch]: The id should be a full fingerprint (40 characters), see README. And wondered how to get the full fingerprint, here’s how. On a test box, import the key manually using the instructions from whoever the key is for, then on that machine run the command (as root) apt-key adv –list-public-keys –with-fingerprint –with-colons That will list the keys currently installed.
Read more →

Getting the list of root name server IP addresses

Read more →

Getting the port of a KVM guest

Read more →

Git Cheatsheet For Some Not So Common Activities

Post Receive Hook to Update The Checked Out Copy #!/bin/sh cd .. env -i git reset –hard Add a remote Note: There is no : between the host and the path git remote add origin ssh://[email protected]/path/to/repo/.git Undo the last commit If you want the changes to stay in the working directory but just want to undo the actual commit. git reset –soft HEAD^ If you want to get rid of the last change completely then to.
Read more →

Measuring a web server’s response time

Read more →

MySQL Permissions Cheat Sheet

Some useful mysql commands
Read more →

PostgreSQL tips

Get the size of a database SELECT pg_size_pretty(pg_database_size('somedatabase')) As fulldbsize; Get the size of a table (excluding the indexes) SELECT pg_size_pretty( pg_relation_size('your_table') ); Get size of a table (including the indexes) SELECT pg_size_pretty( pg_total_relation_size('your_table') ); Get the list of all databases including their sizes SELECT tablename,pg_size_pretty(pg_total_relation_size(tablename)) AS total_usage FROM pg_tables WHERE schemaname != 'pg_catalog' AND schemaname != 'information_schema' Get list of tables in information schema ‘database’ SELECT * FROM information_schema.tables; Get a list of all the db sizes for all the dbs on a server SELECT datname as "DB Name", pg_size_pretty(pg_database_size(datname)) AS "Full DB Size" FROM pg_catalog.
Read more →

Reverse proxy with mod proxy

Read more →

SSL Cheat Sheet

Read more →

Undo an SVN commit

Read more →

Using linux software raid

Get current raid status cat /proc/mdstat Replace a degraded disk in an array First work out which disk it is in the array (e.g. /dev/sda), then use lshw to get the serial number of the disk. Now mark all the partitions on the disk as degraded mdadm –manage /dev/md0 –fail /dev/sda1 mdadm –manage /dev/md0 –remove /dev/sda1 Now power down the machine and replace the failed drive using the serial number from lshw to identify it if necessary
Read more →