chrisspeck.com

Chris' random ramblings

Archive for June, 2010

Neat things with find, LAME and sed in Bash

Just want to chronicle l some really neat, time saving tricks I’ve picked up today for handling files in bash.

The first, how to use the find command:

 find -type f -iname "*.txt"

Easy enough, right?

Let’s use find and cp to back up a bunch of text files:

 find . -name "*.txt" -execdir cp {} a_copy.txt  \;

NOTE: the above assumes that there is only one text file in each directory, and will create a file in the same directory being a copy of whatever file it is that the find command returns.

Let’s string find to sed, and use sed to replace all instances of “.ogg” to “.mp3″ within a collection of text files:

 find . -name "*.txt" -exec sed -i "s/.ogg/.mp3/g" '{}' \;

Let’s also use find and LAME together to convert a batch of wav files to mp3 files (I recommend you run the following from within a screen session):

  find -type f -name "*.wav" -execdir /usr/bin/lame -V3 {} \;

NOTE: The above will create mp3 files in the form of “somefile.wav.mp3″ in the same directory that “somefile.wav” is located.

Let’s use find to delete the remaining wave format files:

 find -type f -iname "*.wav" -delete

The above commands can save hours of messing around with a file manager.

posted by specky in Uncategorized and have No Comments

Contact Form Spam

I received this via the feed-back form a few days ago:

Do you want to grow your business ? Do you have serious , defined sales goals?

The funny part is, this is a non-commercial site. This is not about my work or what I do, nor am I trying to sell anything – there aren’t even any ads on display.

How disappointing that the first person trying to contact me since my redesign, a spammer non-the-less, doesn’t even bother to look at the site before spamming me.

Tags: , , ,
posted by specky in Uncategorized and have No Comments

Flash Card Printer (returns!)

I have noticed from my Google Analytics that a few people are landing here in search of my Flash Card Printer.

Well, here it is: Setup_Flash_Card_Printer_v1

It lets you create multiple paired lists, with entries in ‘Language 1′ matched against entries in ‘Language 2′.

When you print these lists, the items from the ‘Language 1′ column will be printed on the odd pages, according to a grid that you specify (from 1×1 to 10×10).

The alternate entries within the ‘Language 2′ column will be printed on the even pages, however their horizontal order will be flipped (so that the correct ‘Language 2′ cards are printed on the proper ‘Language 1′ cards).

It supports UTF8 character encoding and the Windows XP alternative Input Editors, so you should be able to use it to create Flash Cards in any language validly installed on your Windows XP system.

I made it to help me learn Italian (and Visual Basic.Net), however it is quite conceivable that you could use this to create flash cards for any subject that can be represented by text…such as mathematical formula, commerce concepts, legal case names etc etc.

You could also use it to print off your own games.

I had intended to incorporate the ability to share lists with other users, and if I can see that there is support for this idea I may spend some time on implementing that feature.

The license for this is “This is free to use for individual use, however use within a commercial setting for for a public purpose requires a license (see the ‘Contact’ page for details).” however I am contemplating changing this.

posted by specky in Downloads,Uncategorized and have No Comments

Setting Default Printer in Thunderbird

Saved here so I never need to look any further, instructions for setting/resetting the default printer in Thunderbird:

This worked for me:

If you can’t print from Thunderbird, or if Thunderbird won’t recognize the computer’s default printer:

1. In Thunderbird, go to Tools – Options.
2. Under Advanced, on the General tab, click on the Config Editor button.
3. Scroll down to the line starting with print.print_printer. If you don’t have that line, then everything should already be set correctly.
4. Right-click on the print.print_printer line & choose Reset.
5. Close the configuration window, then click OK to close the Options window.
6. Close Thunderbird.
7. Make sure that the correct default printer is selected. To do so, go to Start – Settings – Printers and Faxes. The one with the small checkmark is the default. To set a different printer as the default, right-click on it & choose Set as Default Printer.
8. Reopen Thunderbird.

Note that at step 4, if you name a specific printer printer at this step, then Thunderbird will ignore whatever the system default printer is.

Advice graciously taken from a post at this forum (Ars Technica).

posted by specky in Uncategorized and have No Comments

Joomla to Coppermine sync script

It appears that the Joomla to Coppermine sync script I wrote and gave away in September 2006 is quite popular (judging by the number of 404 errors logged on that particular file). Baring in mind the following points, I offer it to the world for download once more:-

  1. It is a one way synchronisation from the Joomla CMS 1.0.x series membership database to the Coppermine Gallery membership database. The proper way to use this would be to deactivate registrations in Coppermine, and instead rely on the system in Joomla.
  2. Backup your databases before testing it.
  3. I recommend using it only if you are proficient in SQL and PHP
  4. You will need to call this periodically to keep the database in sync (set up a cron job if able)
  5. It is released under the version 2 (or at your option any latter version) of the GPL license and is open source.
There are ten configuration parameters at the top of the script with descriptions of what they do, that you will need to review and change to get it to run on your server.
Your mileage may vary with the current version of Joomla, series 1.5.x. If you are running Joomla 1.5.x, and modify this script to make it run between that version of Joomla and the current version of Coppermine, I would welcome it if you decided to share your code with me – I would, with your permission, upload the same (and give you credit) and offer it for download here.
posted by specky in Downloads,Uncategorized and have No Comments