Archive for the ‘Tutorials’ Category

Howto: Making Your Mac Talk Via Command Line

Thursday, May 15th, 2008

Did you know you can make your Mac speak out loud whatever you want via command line? I didn’t.

Here’s how:

  1. Open a terminal (Applications>Utilities>Terminal).
  2. Type in say eat my balls (or whatever you want, just put “say” in front of it).
  3. Sit back, listen, giggle and waste your entire day making your computer say really dirty things.
  4. Know you are really, really cool.

You can also have your mac read entire text files by using this command:
say -f PATH/TO/FILE.TXT

Sweet! You may find that for some words, in order for your Mac to pronounce them correctly, you’ll need to spell them phonetically, but whatever…

Type the command man say for the manual on how to use this command and the various options and things you can do with it.

Command Line Ejections

Tuesday, March 11th, 2008

Nice. I just figured out how to eject my CD/DVD drive on my Linux desktop (Xubuntu) via command line!

First, display your fstab file to see what the drive is named: ’sudo cat /etc/fstab’

Then look for your disc drive. Mine was called ‘cdrom0′.

Once you’ve found it, type ‘eject [name of drive]‘ and watch the magic.

I mapped that command to my keyboard. Gnome, Xfce and KDE all have a an interface to help you map keyboard shortcuts in their system preferences, or you can just edit the config files manually with a little googling. I mapped ‘ALT-Shift-F12′ to run ‘eject cdrom0′. Easy.

Getting Firefox’s “Send Link” working with Thunderbird and Ubuntu Linux

Monday, January 21st, 2008

I’ve been using Firefox, Ubuntu and Thunderbird for years now and one thing that always irked me was the fact that the “Send Link” option in Firefox was totally non-operational. Ideally, I’d ALT-F - E and bang, a new email would open up in Thunderbird with the page title in the subject and the link in the body of the mail, but no go. Nothing.

This morning, I wanted to email a buddy of mine a link and got to feeling like there must be some fix out there for this, so I did some Googling and after hitting on the sweet search string, I found the answer.

To get Firefox to open a compose window via the “Send Link” option, do this:

  1. Open firefox and in the address bar, type “about:config”
  2. Right-click within the body of the page that opens and select “New” and then “String”
  3. In the dialog box, where it says “Enter preference name”, paste: network.protocol-handler.app.mailto
  4. In the next dialog box, enter your path to Thunderbird. Mine is /usr/bin/thunderbird.
  5. Hit OK and restart Firefox. “Send Link” should now work with Thunderbird.

Sweet.

Hacking my series 2 TiVo

Friday, December 8th, 2006

[image: TiVo]I’m exceptionally pleased with myself after finally figuring out how to successfully hack my TiVo, transfer television shows to my Linux box and decrypt the .tivo file format into a friendly MPEG 2 so I can watch it on Linux or any other operating system for that matter.

Basically I point a browser at my TiVo using this address:

https://[YOURTIVOADDRESS]/nowplaying/index.html

You’ll get an authentication prompt where you should enter ‘tivo’ as the user and for the password, enter your Media Access Key (MAK), which you can find if you navigate to your TiVo settings. This will bring you to a page listing everything on your TiVo’s hard drive, with a link to download any of the files. I’ve read that getting them with wget causes problems. Most people recommended using cURL, but I was able to navigate and download the files just using Konqueror. I tried it with Firefox as well, but found that the browser would consistently crash after just a fraction of the way through a download each time I tried.

After transferring a file to my Linux box, I installed this command-line application. After I compiled the program, I tested it out like so:

tivodecode -m [Media Access Key] -o outputfile.mpg sourcefile.tivo

The result worked wonderfully and I am now watching Aqua Teen Hunger Force, kicked back in the bedroom with my laptop, running Kubuntu. I’ll be sure and transfer several episodes of Law & Order SVU for the airport wait and flight time when I take a vacation next week. Hot shit.

EXIF, jhead and the joys of hidden thumbnails

Friday, June 30th, 2006

I was doing some reading about EXIF data and came across a quirk that I’ve been having some fun fooling around with.

Most digital cameras embed EXIF data into every image, listing such things as the type of camera, date and time the photo was taken and other details as well as a thumbnail of the image so that the file previews faster.

Most of the time, this information is lost or at least updated when an image is edited. However, sometimes the original EXIF data will carry over. Depending on the editing tool or circumstance, an image file that’s been cropped, re-sized, oriented or otherwise edited will sometimes still carry an embedded thumbnail of it’s original state, fresh off the digital camera.

There’s a few tools out there for pulling he thumbnails out of an image’s EXIF data. I decided to use jhead with my Kubuntu laptop (there are OSX and Windows clients as well, but I’ve never used them). After installing, fire up a terminal and type:

jhead -st 'thumbnail-output-filename' 'desired-image.jpg'

If there is a thumbnail embedded in the image it will be extracted to whatever filename you specify. You can then view it with whichever program you choose.

Now understand that there may not be a thumbnail and nine out of ten photos that do have them will be exact miniatures of their parent files. Still, one out of those ten photos can yield some interesting shit. Just take a minute to think of the various and plentiful reasons why a person or organization may need to edit, obscure or otherwise change an image’s original state and you might get the point of this.

To give an example, I took this image from Wikipedia, (mainly because of it’s not under some restrictive copyright and work safe) and after saving it locally, used jhead to extrat the EXIF thumbnail giving me the image below.

[image: An example of an EXIF thumbnail.]If you compare the thumbnail below to the image linked in the paragraph above, you can clearly see that it has been rotated ninety degrees right with parts of two additional statues and a window being completely cropped out of the image.

Here’s a link to a page where someone uses a script to search the internet, checking for and displaying images with EXIF thumbnails whose dimensions are not perfectly scaled (like the file has been cropped or otherwise changed since it’s creation) and displays them for your amazement/boredom.

So many wacky possibilities. Go spend some time on Flickr, Friendster, or MySpace. Try it on documents that have had sections digitally blacked out for confidential reasons. Go forth and be snoopy.

Secure proxy tunnelling with SSH and Squid

Wednesday, May 17th, 2006

Web filters are retarded. The only times I ever butt against a company’s web filter seem to be when in search of legitimate, non-offensive information. I’m not into breaking the law. I’m not into downloading porn at work. Why penalize me when I try and look up some technical information because an application like SmartFilter or SonicWall considers some geek’s tutorial on getting an Open Source application up and running, “Free Software/Downloads—Forbidden”, even though no actual software or source code is stored on the site? Or blocking a website as pornography because the author of the page has the unfortunate last name of “Dyke”. SmartFilter kind of seems like one big oxymoron. Perhaps StupidFilter is more appropriate. I could give a rat’s ass whether it kept kids away from pornography, all I know is that it often keeps me from accessing harmless, legal and innoffensive information—usually technical in nature. Fuck that.

Sick of being hamstrung by obtuse internet filters I set up a proxy on my server using squid that I tunnel to via SSH. Once connected, I bypass all web filtering wherever I am and as a bonus, all information sent to and from my browser and my server is encrypted and therefore private to anyone snooping on the local network. Here’s how.

(more…)

Secure Gmail sessions using https

Friday, May 12th, 2006

[image: Gmail icon]While I’ve known that Gmail uses SSL to log in, someone recently pointed out to me that while my password is sent to Google fully encrypted, once logged in, all pages that I view are sent via http, meaning that all the emails I read and send can be scooped right out of the ether at any open hotspot.

One remedy I found is to manually change the address from
http://mail.google.com/mail/ to https://mail.google.com/mail/
and for that session, you should be using https and all the pages you view in Gmail will be encrypted. Very cool, but I have to remember to manually check this every time I log in. I smoked way too much weed as a teenager. Half the time I don’t even know what day of the week it is. No lie. How am I supposed to consistently remember this?

Looking further, I found this great extension for Firefox that takes care of the problem for me. CustomizeGoogle lets you set a whole mess of options for a variety of Google services. I won’t get into most of the details since they don’t apply, but check them out because a lot of them are pretty cool. One option that is relevant is that once installed, you can set an option for Gmail to always use https by default. Just check off that one option and from that point on, you have worry-free, encrypted Gmail sessions as a default. Pretty damn useful. CustomizeGoogle also lets you set an https default option for Google Calendar as well. Even sweeter.

Unfortunately, Safari, Konqueror and other browser users are out of luck (IE users, you deserve what you get.) with this extension, so unless there’s something else out there, they have to manually check the session every time or set a bookmark using https in the URL and be consistent about accessing Gmail through that bookmark.

Ask daveb!: How do I resize large groups of photos?

Wednesday, January 4th, 2006

Jesus bleedin’ nuts! I’ve got reader-submitted questions coming out of my ears. I’ve had to backlog a few, so don’t worry, I’ll get to you. This next question is right up my alley.

Clutch wrote:
Q:

Here’s a question that may actually be within your realm of experience; I have a bunch of images I’d like to resize, smaller, for uploading. Is there an easy way to do this to many images at once, say, in photoshop? Or perhaps another, preferably free application I could get my grubby little hands on? Thank you, oh wise and gratuitous davebgimp!

A: Easy as your mom! I’m going to answer this a bit backwards by first addressing the issue of software. Yes, you can do this in PhotoShop or the slightly neutered and cheaper PhotoShop Elements. PhotoShop’s a great program. I use it daily at work, but it costs an ass-load so most people end up pimping out Grandma to buy it or they steal it. Personally, I think that for most users, especially those who are working primarily in an RGB (red, green and blue) color space — web publishing for example, it’s not necessary.

Another option is to take the free route. There’s a few more steps involved but it costs several hundred dollars less… actually it costs nothing. There’s an Open Source, free image editing alternative called GIMP, which stands for GNU Image Manipulation Program. It’s available cross platform, so is accessible to anyone. I use it at home on Linux and having used PhotoShop professionally and otherwise for the past six or so years, I find it meets and exceeds all my home-use needs. Experienced PhotoShop users making the switch might get a bit annoyed at first, as I did, at the learning curve involved. I chalk it up to the fact of using one program exclusively for so long and getting used to the tricks and shortcuts and then trying out a new application with different tools, names and ways to get things done. But once I got past this (it was a quick transition), I found myself impressed and not missing much. If you’re new to either program, I highly doubt you will share this temporary and arguably unnecessary frustration.

The GIMP does have limitations in it’s lack of CMYK (Cyan, Magenta, Yellow and Black - a color space normally used with professional printing and presses) support and a rather huge learning curve if you want to install some plug-ins and know nothing about compiling from source code. Unless, you’re designing for print on a professional scale, you won’t be missing the CMYK support though. I have heard that there’s a CMYK plug-in available, but as of the latest version, the color space is not natively supported. No biggie for me or you other average home users. As far as having to compile programs for GIMP plug-ins, if you’re using Linux, you either know how to do this, or could stand to learn for your own good.

You should at least check out the GIMP. Since it’s free, you don’t have the problem of shelling out for a program that updated with a new version almost yearly (which means more $$$ or more pirating if you want to keep up with the latest). GIMP will always be free of charge and there’s plenty of documentation, tutorials and communities to help you get the hang of it, or you can always ask daveb.

Now, on to the first half of your question. I’ll explain how to do batch resizing with both PhotoShop and the the no-cost method. Let’s start with PhotoShop.

(more…)

Right-click this, bitch!

Wednesday, December 28th, 2005

image: No right-clicking allowedEvery once and a while, I come across a website where some bumblefuck idiot tries to stop visitors from right-clicking on their page, usually in a sad little attempt to prevent people from downloading their images. They copy and paste the little Javascript trick to disable right-clicking and sleep peacefully, under the impression that their dearest little JPEGS are safe and secure.

Anyone with half a brain cell should know that if you’re going to insist on controlling your content and being a greedy little fuck, putting your crap on a website is not the way to go. By viewing a web page , your computer is requesting and downloading the files that create the page to it’s hard drive and then displaying them in your browser. If you put an image in a web page, anyone who views it has already downloaded it. Disabling the right-click is not only pointless and retarded, it’s really fucking annoying and a bit insulting. Who the fuck tells you what you can or cannot right-click on? Screw that!

If someone’s decided to go all control freaky and disable right-clicking, they should know that it takes me all of a few seconds to open my browser cache to get at it. Easy shit.

So fuck this anti-right-clicking shit. It pisses me off. I rarely make a habit of using images from other websites and if I do, it’s a site that has an explicit Creative Commons license encouraging me to do so. So why be such a hater? Loosen that sphincter! Your shitty Photoshop Elements pixel vomit is hardly worth stealing anyway.

It’s possible that at this point, dearest reader, that you may be picking up on the fact that this stupid little practice seriously irritates me. Okay, okay, I admit it. It makes me want stab things and fling poop like an irate Rhesus monkey. So is daveb the type of punk-ass bitch to take this no right-clicking shit by bending over, grabbing his ankles and reciting the Lord’s Prayer? Fuck no, people of the world! You can disable that shit permanently and he’s going to show you how. This wild man we call daveb rules!

First off, this tutorial assumes you are using Firefox 1.5. If you’re not using it, you should be, so switch. Do it. Do it now. It’s the dog’s fucking balls, daveb swears. Got it? Cool.

Disabling right-click blocking with Firefox

  1. Open Firefox (duh)
  2. Get all up in your options/preferences. It varies by OS. For Linux, it’s Edit>Preferences. OSX is Firefox>Preferences. Windows hides it in Tools>options.
  3. From there, get your ass into the section named “Content” and find the little checkbox named “enable Javascript” and click the “Advanced” button that’s next to it. This will pop up a new little options window.
  4. In this window, you will see a checkbox named “Disable or replace context menus“. Uncheck that shit!

That’s it!

Daily backups for WordPress with Gmail

Thursday, August 11th, 2005

Yesterday, I switched to a new web host after my old one proved to be way too sketchy and unreliable. My new host seems to be great so far, but the experience of finding my site crashed at least once a week through no fault of mine had me thinking about backup options. I did a little research and have set up a system for backing up my blog that’s working great so far, so I thought I’d relate the details for anyone else that might be interested. Please note this applies to WordPress users.

Daily WordPress backups using Gmail

  1. First off, get a Gmail account. Why Gmail? Because it’s free, wicked handy and has the highest free storage rate out there that I know of. Since the point of this is to back up your blog in case your site should crash and die, you don’t want to be using any email address associated with your domain as that could also fail with the rest of your site. It’s not too hard to get a Gmail account. Find someone that has one and ask for an invite. I have something like 50 invites, so email me if you need one. I created one called davebgimp.backup for this purpose.
  2. Now, there’s two ways to do this, manually setting up a CRON job, which is more trouble than a lot of people want to deal with, or you can download these handy WordPress plugins, WP-DB-Backup and WP-Cron written by Scott Merrill. Thanks Scott! Download both plugins, unzip and upload them to your WordPress plugins folder and then activate them on your WP plugin management page. You’ll notice WP-Cron comes with a whole bunch of different plugins. Just activate the ones called WP-Cron and WP-DB-Backup.
  3. Now, with the plugins activated, click the “Manage” tab in WordPress. You’ll see a menu item called “Backup”. Click that bitch! You’ll see various settings for doing a manual backup. Skip those and go to the bottom section, titled “Scheduled Backup”. If you don’t see it, you don’t have WP-Cron enabled, so double check that. In the settings for this section, set the schedule to “Daily”. Where it says “Email backup to:”, enter that Gmail address you created. Lastly, you’ll have the option to include non-core WP SQL tables. That’s up to you. The plugin, by default, will backup all native WP tables. After you’ve decided about the tables, if in fact you have any others, hit “Submit”.
  4. You’re finished! Daily SQL backups should be emailed to you every day. Check the account later and view the magic! I set up a filter, telling Gmail to automatically archive any email sent to my backup address from my site, however you don’t really need to do that. You can now walk away and let it do all the work. Check the account every once in a while if you have a really large database. You might want to delete older backups as time goes on.