Welp. I guess I’m done working on this thing.
http://www.horoscopicbollocks.com
Now, to get back to work on that OTHER thing I was working on before I got distracted by this thing.
Jebus.
Welp. I guess I’m done working on this thing.
http://www.horoscopicbollocks.com
Now, to get back to work on that OTHER thing I was working on before I got distracted by this thing.
Jebus.
Columbo has always been a hero of mine, and the sad death of Peter Falk at the age of 83 left me hugely upset. With very little deliberation a few weeks ago, I decided I needed to have some tangible memento of him. Pretty much as far back as I can remember, I wanted to be Columbo. He showed that you could be a hero without violence – sometimes all you needed was a brain.
So a good few weeks ago at work I gave a learning group on “British Stuff” – broken down into some general British trivia, some of the differences I’ve encountered over what’s called what, the history of the english language, and then a short introduction to Cockney Rhyming slang.
I finally got around to getting the videos, so here they are!
If you hit play on both at the same time, you should be good to go – either that, or go here and let youtube doubler take care of (basically) everything for you.
Hmm… I get the feeling that I spend a lot of time moving stuff around…
In a previous post I talked about creating a load of image thumbnails by running a custom script. Each time you added a new image to the directory, it would be necessary to run the script again.
Suppose that the images and thumbnails are being kept on a remote server – transferring the images from your local machine to the remote machine using scp might be one way you could do it, but if what you really want to do is have your remote folder in sync with your local folder, then it rsync is probably the tool you’re after.
1 | rsync -rv local_image_folder/ you@your_remote_server:~/path/to/remote/image_folder |
now you only have to worry about keeping your local folder in order, and your remote one will be happypants.
So a long while ago, I bought a Chumby. Interesting little device, for a while at least – its primary function right now is that of an alarm-clock/mp3 player.
When I’m going to sleep, I usually need something to listen to. The Chumby has a usb socket in the back which allows you to stick a thumb-drive in there and play mp3s off it. As much as I love the portability of thumbdrives, sometimes you just want to be lazy efficient and sit on the couch transferring the relevant mp3s from your laptop to the chumby.
1 | scp some_audio_file.mp3 root@DuncChumby:/mnt/usb |
So let’s say you’ve got a folder with a load of images, and you want to display them as thumbnails.
One thing you certainly DON’T want to do is just load up the images and shrink them in the HTML – assuming that the images are large, this is a bandwidth hog, and an annoying experience for the user. Ideally, you’d want to use actual thumbnails – they’re smaller in terms of both filesize and dimensions.
I hacked together a little script to do this for me:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #!/usr/local/bin/python2.6 import Image import os PICDIR = './pics' THUMBDIR = '%s/thumbs' % PICDIR ratio = 0.8 THUMB_W = 125 THUMB_H = int(ratio * THUMB_W) THUMBSIZE = (THUMB_W, THUMB_H) #1 - delete everything under /thumbs all_thumbs = os.listdir(THUMBDIR) remove_count = 0 for thumb in all_thumbs: thumbpath = '%s/%s' % (THUMBDIR, thumb) os.remove(thumbpath) print 'removed %s' % thumbpath remove_count += 1 print 'Removed %d thumbnails' % remove_count #2 - for each image in the pic directory, generate a new thumbnail all_files = os.listdir(PICDIR) jpgs = [file for file in all_files if file.endswith('.jpg')] for jpg in jpgs: original = Image.open('%s/%s' % (PICDIR, jpg)) thumb = original.resize(THUMBSIZE, Image.ANTIALIAS) thumbpath = "%s/%s" % (THUMBDIR, jpg) thumb.save(thumbpath) print "wrote %s" % thumbpath |
now whenever I rsync image files from my local machine to my webserver, I can just run the script, et voila!: thumbnails ahoy!
I bought a new macbook pro recently and almost immediately installed Ubuntu 10.10 on it. Was then left with the issue of moving over my fairly small, but partially substantive mp3 collection… turned out to be fairly simple!
on the source machine, in the appropriate directory:
1 | python -m SimpleHTTPServer |
and then on the destination machine:
1 | wget -r veronica:8000 |
Let’s do some resolutions:
That’ll do it for now.
Spent a little while over the last few days moving stuff between webservers, and I noticed that a few of my image files end in .jpg, and some end in .JPG.
This is unacceptable.
The following did the trick though.
1 2 3 | for fname in *.JPG do mv $fname `basename $fname .JPG`.jpg done |
It seems as if every other day or so, I discover an easy way to do something that once would’ve been very annoying.
Needed to copy all the music off my phone into my music directory. The directory structure on my phone was Album_name/music_file – I didn’t really want that.
This command finds all the mp3s in/below the current folder and copies them to ~/Music.
1 | find . -name *.mp3 -exec cp {} ~/Music/ ';' |
Seeing as this was all done over USB on a bit of an old phone, it was (is – it’s still going.) hugely slow.
This allows me to see how many mp3s are in the Music directory – so I can more-or-less keep track of progress.
1 | watch "ls -la ~/Music | grep mp3 | wc -l" |
fun times.