20100913

DIY - fixing the gear on a Gaucho Rockin' Electric kid's car

My neighbor came over the other day after cleaning out his garage and asked if the kids wanted a Gaucho Rockin' Electric car. Of course they did.

One small problem however. The gear-shift didn't work, the build quality was just not very good, and it needed a replacement.

I found a couple of online retailers selling what looked almost what I needed. However they were quite pricey, and I had to wait for overseas postage & handling. I drew up the schematics after having disassembled the gear-shift, and it boiled down to two functionalities:
  • switch between having the 2 engines coupled in parallel or in series to allow for 2 seperate speeds.

  • switch the polarity to allow for reverse gear.
The first part could be handled by a twin SPCO* (nor: dobbel endevender**), the latter by a four-way switch* (nor: kryssvender**). These are the kind of switches you normally use to have a set of switches control a single light-source (the SPCO are at the end of the wiring, the 4-way-switches are between them).

Wiring it all up: Luckily these were both stock parts at my local DIY-store, Clas Ohlson***, so I went rigth their way and bought one of each. I screwed the switches to a small piece of plywood, which I mounted were the original gear-shift was mounted. Finally a picture on how it looks: The original shift didn't allow for high-speed while dringing in reverse, however the modified version does. I don't have any problem however seing that this might not be such a good idea :-).

* Wikpedia: switches (english)
** Wikpedia: switches (nor)
*** Clas Ohlson product-page

If you have any ideas on how this could have been done otherwise, don't hesitate to make a comment of it.

20100607

Billa Benny

Yeaahh! My picture won this week's #TwPhCh which was "Macro/close-up"! Read about how I took this picture on the #twphch blog.

20100127

Random file-names using bash/perl

A couple of times I've wanted to sort files in a random fashion, and allways worked around it someway sorting for size, dates or other things.

I needed a random sorting of pictures when making a slide-show for my mother.

run the following command to give the files a unique "random" 10-digit number.
ls | perl -ne 'if (/.jpg$/i) {chomp;while(-e ($n = (int(rand(10**10-1)).".jpg")) || length($n) < 14) {print "Too short: $n (" . length($n) . ")\n";} rename $_, "$n";'}
(it prints out names being to short just as info)

I also needed to group these files into some subdirectories. Run the following command to create a number of sub-directories:
for i in `seq 1 8`; do echo "creating $i"; mkdir $i; done
(it prints out the directory-names)

run this command to move the files into the sub-directories:
ls | perl -ne 'if (/.jpg$/i) {chomp; $dir = ($dir++ % 8 + 1); print "$dir\n"; rename $_, "$dir\/$_"; }' | sort -n | uniq -c
(it prints out the number of files and the name of the directories)