Below are some things that I want to keep a record of. I stopped updating this site long ago, with so little content, it does not deserve a blog. However, there are some bits of data that I do want to keep.
If you have any questions about anything on this pge, please feel free to send me an email.
If you are OCD like me, then you need all my contact details for your mobile device. This is a standard vCard 3.0 format file with notes and pictures ommitted..
A long time ago I took a lot more photographs, these are some of the ones I liked the most. Currently, I am storing the photos on my photoblog at photoxicated.com.
My girlfriend and I started a Macintosh help site called OS X Help.
For reason not worht explaining, I ended up with a directory of about 15,000 images in it. Many of those images were duplicates with different names. I had a hard enough time finding a application that would allow me to even look at all those images, let alone manage them. There were a few shareware apps that claimed to help me, but they were crippled beyond use, or they would not allow me to perform an action like delete on the duplicates unless I sprung for a $20.00 application.
First change directory into the area where all your images are
cd /Volumes/vorbis/images
pwd
The `pwd` should show you where you are just to be sure.
Next up, we run `ls -la`, but send it to `wc -l` which will count all the lines in the `ls -la` so we get a idea of how many images we are working with here. This can take a few seconds depending on your computer
ls -la | wc -l
We need to work on a temp file, so just in case there happens to be one there from a past effort, it needs to be removed
rm /tmp/filelist
I wanted to run `cksum` on the list of all the files, but that is too much data/args to send to the shell, and it will barf on you. In this case, I use `xargs` to send it in 100 item chunks. All that is sent to a new temp file.
find . -maxdepth 1 -type f | xargs -n 100 cksum > /tmp/filelist
Now, we have this beautiful list of cksum data on each file sitting in /tmp/filelist. It is the checksum and some other data. We only really care about the checksum and the file name. If I read in that file (`cat`) then send it to sort so that the files are all in checksum order, and tell awk to do some fancy stuff to it, I am left with a list of only subsequent duplicates. This means it leaves one original behind. Just what I needed.
rm -v `cat /tmp/filelist | sort | awk 'BEGIN {c=0} {if ($1 == c) print $3; c=$1}'`
I wish I could explain the `awk` portion a little better, but that is where I was given great help from others on the forums. Finally, we can delete the temp file and get a ne wrunning count of how many files there are.
rm /tmp/filelist
ls -la | wc -l
This is going to be a quick and dirty explanation, so excuse any spelling errors... I wanted to get MRTG to be able to graph the incoming and outgoing emails per minute on my EIMS email server. Of course, EIMS has it's own way of doing things, and there is no direct way to get at this data.
You need to have MRTG running, and know how to set it up for any of this to make sense. With that said, here goes...
Run this as a startup item or as a launchd item depending on your OS version:
tail -f -n0 /path/to/EIMS/mail.log >> /Applications/EIMS/mrtg/running_log
So that runs all the time, non stop. Now, this bash script will either be called by MRTG if on the same box, or you will have to find some other way to get this data to be picked up by MRTG on the remote box. I wrapped the below up in php's passthough() function and simply let MRTG pick it up via curl
#!/bin/bash
# make a copy of the file and also clear it
cd /Applications/EIMS/mrtg
cat running_log > stale_log && echo "" > running_log
# note, those are real tabs ie: \t
# Get the count of "sent:" items
sent=`grep --text '^sent ' stale_log | wc -l`
# Get the count of "from:" items
from=`grep --text '^from ' stale_log | wc -l`
# uptime
seconds=`uptime | awk '{ print $3 }'`
echo $from
echo $sent
echo $seconds Days
echo eims
Here are your mrtg config options for eims.cfg
Options[eims]: growright,perminute,gauge,nolegend,pngdate,logscale
Target[eims]: `curl -s http://example.com/eims_stats.php`
MaxBytes[eims]: 12500000
YLegend[eims]: emails / minute
ShortLegend[eims]: email / minute
Title[eims]: EIMS incoming/outgoing emails --