| Sunday, December 6th, 2009 |
| 8:34 pm |
My code solution.
The following is my code which appears to work without problems in my test directory. I'll try it with 5 or 6 zip archives tomorrow before I let it loose on the live data. The script needs to be run at the same level as all of the zip archives so that I don't end up with subdirectories being encoded into the recursive paths that are zipped up. It's not pretty (the rm calls tend to produce warnings if there is nothing to delete), but it seems to be working OK.
#!/bin/bash
# init
function pause(){
read -p "$*"
}
dir1="__temp"
if [ -e "$dir1/" ]
then
echo "$dir1/ exists."
else
mkdir $dir1/
echo "Created $dir1/."
fi
pause 'Press RETURN to continue...'
for f in *.zip
do
if [ -e "$f" ]; then
echo "Processing $f file..."
unzip $f -d $dir1
z=0
for x in $dir1/._*
do
echo $x
let "z = 1"
done
if [ "$z"==1 ]; then
echo "Deleting .mac files."
rm $dir1/._*
cd $dir1
zip -r $f *.*
mv $f ..
cd ..
fi
rm $dir1/*
rm -R $dir1/*
pause 'Press RETURN to continue...'
else
echo "No files to process."
fi
done
echo "All finished." |
| Saturday, December 5th, 2009 |
| 6:28 pm |
Does my code suck?
I have a bunch of files which need to be cleaned of some Mac specific OS file parts and don't want to deal with the hassle of manually encoding them all. I have a little script I wrote and I want to make certain I am not mad or making any huge errors. This is to be run using bash on Apache. Are there any code people who might look at this and tell me if it will cause serious problems?
#!/bin/bash
# init
function pause(){
read -p "$*"
}
for f in `ls multipart/`
do
if [[ "$f" == *.zip ]]
then
echo "Processing $f file..."
mv multipart/$f multipart/__temp/ # Move zip file to temp dir.
unzip multipart/__temp/*.zip # Unzip archive.
rm multipart/__temp/*.zip # Remove the old zip archive.
rm multipart/__temp/._*.mp3 # Remove the Apple "._" files.
zip -r multipart/__temp/$f *.mp3 # Zip the mp3 files to a new archive.
mv multipart/__temp/$f multipart/ # Move the new archive back.
rm multipart/__temp/* # Remove any other temp files.
pause 'Press any key to continue...'
fi
done It's a huge hack and one of the more ambitious shell scripts I've built. |
| Thursday, November 12th, 2009 |
| 2:06 pm |
|
| Monday, November 2nd, 2009 |
| 4:54 pm |
|
| Tuesday, September 15th, 2009 |
| 9:11 am |
Car repairs.
Apparently the cam belt on a 1991 Toyota Camry wagon needs to be changed every 6 years or 100,000km. The belt on ours was last changed 6 years ago and drove only 23,000km in that time. And then it fell off day before yesterday while I was driving home. Fortunately it happened with a short walk of home and my AA Road Service tow to the local Toyota shop was free. A new cam belt is not an inexpensive repair, but I figure it's all in the course of a year's maintenance. Hopefully we will be on the road again this afternoon and can get on with collecting a door and sheathing for our chicken coop. |
| Tuesday, August 11th, 2009 |
| 12:23 pm |
|
| Tuesday, August 4th, 2009 |
| 12:33 pm |
Microbes that 'Poop' Electrons. http://www.sciencedaily.com/releases/2009/07/090729210821.htmNew Microbe Strain Makes More Electricity, Faster ScienceDaily (Aug. 3, 2009) — In their most recent experiments with Geobacter, the sediment-loving microbe whose hairlike filaments help it to produce electric current from mud and wastewater, Derek Lovley and colleagues at the University of Massachusetts Amherst supervised the evolution of a new strain that dramatically increases power output per cell and overall bulk power. It also works with a thinner biofilm than earlier strains, cutting the time to reach electricity-producing concentrations on the electrode. ( Read more... ) |
| Monday, August 3rd, 2009 |
| 2:46 pm |
Why Bernanke is in Panic Mode
Found at: http://www.lewrockwell.com/north/north739.htmlWhy Bernanke Is in Panic Mode by Gary North (link to page with video mentioned below) http://www.garynorth.com/public/5266.cfmBernanke video: He stutters; he stammers; he is in visible panic mode over Ron Paul's bill to audit the Federal Reserve. Watch it. You'll love it! Then send it to your friends. Usually, when Ben Bernanke is interviewed, he has the demeanor of a college professor in the presence of freshman students. Of course, as a full professor, he did not have to teach freshmen. That is for untenured assistant professors to do. Stammering and stuttering are therefore a real departure for him. There is a reason for this. For the first time since 1914, there is a public debate in Congress over the Federal Reserve's power. Never before has a majority of the House of Representatives called for what should always have existed: Congressional scrutiny over the FED's money. Bernanke says that Ron Paul's bill to audit the Federal Reserve is a bill to audit Federal Reserve policy. Yet the bill says nothing about auditing policy. So, what is he talking about? ( Read more... ) |
| 10:47 am |
|
| Sunday, July 26th, 2009 |
| 10:20 am |
|
| Monday, July 20th, 2009 |
| 4:44 pm |
Flying through the air = RICE
Or - don't get in a Judo match with a wheelbarrow, 60kg of cement and a hill. The wheelbarrow will always win. Was working on our chicken coop this afternoon and trundling the last of three trips of 2x 30kg sacks of readymix for setting the pilings in the clay when I started going a bit too quickly and just about almost negotiated the dog-leg onto the flat where the coop is going. The bar on the front of the wheel barrow bit into the dirt, pivoted on its nose and 60kg of readymix were flung into the side of wheelbarrow. I was thrown over the whole mess in what felt like a classic Judo move. I am very lucky I only have a bruise on the back of my left thigh, just above my knee from part of the wheelbarrow, a stump, or maybe a rock. I seem to have rolled into the fall as my left shoulder was covered with dirt. It is probably a good thing I was wearing a boiler suit over my regular clothes. So left leg is stiff and I am pretty sure I gave myself a touch of whiplash too. I'll know more as things color up and get sore tonight. I count myself very lucky that nothing is broken. |
| Tuesday, July 14th, 2009 |
| 8:34 pm |
|
| Monday, July 13th, 2009 |
| 3:44 pm |
|
| Sunday, July 5th, 2009 |
| 8:11 pm |
Blackspot - come see the film I worked on at the Embassy
The feature film I worked on is having a one-time-only New Zealand Premiere at the Embassy on 15th July, 2009 at 6:30pm. Come watch as I turn day to night and surprise you with amazing visual effects work! I literally worked my ass off on this film and haven't been the same since then. Come support local film making! For more details see the Blackspot web site. See you there? |
| Sunday, June 28th, 2009 |
| 8:58 am |
|
| Thursday, June 25th, 2009 |
| 9:43 am |
|
| Friday, June 19th, 2009 |
| 7:58 am |
|
| Tuesday, June 16th, 2009 |
| 9:38 am |
The Tragedy of the Commons
One cannot discuss economics if one has not read Hardin's "The Tragedy of the Commons". A friend of mine has written a long paper on "What is Money", but is not familiar with this. I have skimmed the Hardin paper after having a quick verbal summary provided by trickofthedark and found it very informative and look forward to a more thoughtful read of it. http://en.wikipedia.org/wiki/Tragedy_of_the_commonsThere are links off to the paper itself and the Garret Hardin society web site where there are a number of fascinating looking articles. |
| Tuesday, June 9th, 2009 |
| 10:14 am |
|
| Saturday, May 23rd, 2009 |
| 5:01 pm |
|