Andrew Latham

Cleaning up a postfix mail queue is both dangerous and important when situations require it.

There will come a time when every admin needs to preform magic. This is some magic to remove emails from a Postfix queue when you have hundreds of thousands of emails and the mailq command can't finish.

mailq | awk 'BEGIN { RS = "" } /domain.com/' | sed 's/!//' | postsuper -d -

In laymans terms, this script runs the mailq program and starts working on the output. This is both dangerous and fast. AWK jumps in and gets the mail ID and then SED will trim out the ! character if it is present, lastly the postsuper -d will delete what ever it gets. Change domain.com for whatever source of spam you are getting. If it is a country code you are having problems with you can do ".cc" for the TLD. Please use with caution.

Andrew Latham

Sparse files are handy but at times difficult to work with.

When you need to move large sparse files across the network there are many issues related to support of this new FS method. Sparse files are files that say they are size X but only allocate blocks on the file system that are actually used. This is a great use of space and very nice for virtualization. In the past methods like COW to only use space as it was needed. These solutions worked. Sparse file support was integrated into the Linux Kernel and now it is the preferred way to handle images.

Andrew Latham

Just a hobby

I enjoy tangible activities after a day of the virutual work that I do. Software development, systems management and architecture don't give a great amount of clousure on day to day work. Gluing, screwing or just cutting something to the proper size is often a great feeling of completion or closure. I make small simple things mainly and don't worry about perfection. The picture of the box is a utilitarian box for tools, junk and what ever else is needed. It is also built very strong so it could be stood upon or used in bracing something in the future.

Andrew Latham

High Level Systems Architecture Borrowing from http://sts.ono.at/blog/2012/02/01/a-systems-policy/ I shall attempt to narrow the scope of a given architecture to a higher level view.

Systems Architecture Planning, designing, and construction technology systems is a process, fluid in nature. This architecture of many systems fit together in an effort to provide a solution becomes a conflict over resources verses cost. Systems are collections of various funtions with dependency models and recursion which maintain complexity at every level.

Andrew Latham

Wood Gas To stay warm, look to the colder areas of the world for help.

Wood gas generators and heaters comprise some amazing technology in the creation of warmth and energy in residential and comercial buildings.

Linky: http://volter.fi/technology/

Andrew Latham

Developers on various platforms can often unknowingly introduce encoding issues on files. Here is a solution to one problem.

Simple one liner to remove all ^M line returns from files in a directory. I use this on an Open Source project I work on mainly for PHP files. Type "CTRL v" then "CTRL m" to get the system ^M char. The character will not copy and paste. The filter for SVN is optional and insert CVS or git for your SCM of choice.

grep -IUrl "^M" * | grep -v svn | xargs sed -i 's/^M$//' Easy! Search the directory recursively. Filter out the SVN files. Run SED against the files in the list.

Andrew Latham

Python CLI Webserver

If you ever need or want to create a webserver with the files in the current directory listed then just use this little snippet.

python -m SimpleHTTPServer

It will inform you of the address it is listening at or you can set the port via

python -m SimpleHTTPServer 8080

With Python 3 you might want to use:

python3 -m http.server

The same method of setting the port with Python 3 too

python3 -m http.server 8080