Categories
Arduino Gadgets

Arduino Christmas

Categories
Arduino Projects Video

Arduino’d Gingerbread House

It’s not a serious competition until you’ve put a microcontroller inside your gingerbread house. Since we were going for the Charlie Brown theme, I ripped apart and adapted a musical card that played ‘Linus and Lucy’. I also rigged up some LEDs to blink with the music. Video below the pictures.

Categories
Tutorials

Ubuntu and PCMCIA card

After installing Ubuntu Server 10.04 LTS on an old laptop (don’t ask why) I found that it wouldn’t detect its PCMCIA wired Ethernet card (PCM100).

Solution:

  1. Copy over the packages pcmciautils and libsysfs2 (I had to download them and transfer via USB flash drive: pcmciautils, libsysfs2)
  2. Install the packages: sudo dpkg -i [name].deb
  3. Reboot

VoilĂ !

Categories
Scripts

Herp Derp YouTube comments

Herp Derp now has a dedicated page!

Categories
Technology

MacBook Air 13″ vs Dell Inspiron 6000

Two MacBook Airs could live inside the lid of the Dell Inspiron 6000.

Categories
Tutorials

Cloning a drive the ‘dd’ way

Here’s how I cloned a drive with bad sectors using ‘dd‘.

Since I did this on a Mac, I saved the output image file as a ‘.img’ file. This would give me the ability to mount the image after I created it if I needed to get individual files.

Clone the failing drive to an image file, skip bad sector errors with ‘noerror’:

  1. Connect the drive to a Unix / Linux machine – do not mount the disk
  2. Find the drive name in /dev (for me it was /dev/disk1)
  3. Verify the host system has enough local storage to create the image, and in a terminal type:
    sudo dd conv=noerror,sync if=/dev/disk1 of=disk.img
  4. Give it time to create the image. You may see errors when it hits bad sectors, but it’ll keep running thanks to ‘noerror’.

Copying from the image file to the new drive:

  1. Connect the new drive and make sure it isn’t mounted (if it’s really new it shouldn’t have any file system or partitions at all)
  2. Find the drive name in /dev (for me it was /dev/disk1)
  3. Type in a terminal:
    sudo dd conv=noerror,sync if=disk.img of=/dev/disk1
  4. Give it time to copy from the image to the new disk.

The nice thing is that it copies everything. For me, the MBR was still there along with all partitions. If you wanted to just copy a single partition you could just be more specific (/dev/disk1s1 or however your system represents them). If the new drive was larger than the original drive, you’ll notice that there will be unallocated space. You can either create a separate partition, or use a utility to grow an existing one. Recent versions of Windows and OS X have this capability built in.

On boot, the machine I was repairing recognized the filesystem was dirty (it was a Windows XP machine / NTFS), and immediately ran a SCANDISK. I also manually ran it again once I booted into the system, and also ran ‘sfc /scannow’ to verify the system files were intact.

That’s all you have to do. No expensive cloning software needed, just the power of Unix / Linux.

Categories
Arduino Gadgets

Arduino!

Pretty stoked to finally get one! So far I’ve dissected an old RC car and turned its wireless receiver board / remote into a volume controller for my Mac. I foresee many cool projects…

Categories
Tutorials

Nagios alerts using sSMTP

I’ve been running Nagios on my systems at home (yes, I’m that big of a nerd) for a week or so, but didn’t get around to setting up e-mail alerts until now. There are a few ways to go about doing this, but I’ll describe the way I got it going. Since I’m not running a mail server on any of my machines I use Google Apps to handle e-mail for my domains. I rather have ‘the Google’ deal with all of that for me (and they do a great job).

For this particular instance I was running Ubuntu Server 8.04.4 LTS, but these steps should work fine on other versions and distros.

1. Install sSMTP and mailx

sudo apt-get install ssmtp mailx

2. Configure sSMTP by editing /etc/ssmtp/ssmtp.conf

# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=[your user account]@[yourdomain.com]

# The place where the mail goes. The actual machine name is required no 
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587

# Where will the mail seem to come from?
rewriteDomain=

# The full hostname
hostname=[some hostname here]
UseTLS=YES
UseSTARTTLS=YES
AuthMethod=LOGIN
AuthUser=[your user account]@[your domain]
AuthPass=[your password]

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
# This is optional if you're going to use revaliases - I didn't
FromLineOverride=YES

3. Lock down /etc/ssmtp/ssmtp.conf to help protect your plaintext password

sudo chown root:nagcmd /etc/ssmtp/ssmtp.conf
sudo chmod 640 /etc/ssmtp/ssmtp.conf

4. Alter your Nagios commands.cfg file for the correct mail path (for Ubuntu at least)

sudo vim /usr/local/nagios/etc/objects/commands.cfg

And change all instances of /bin/mail to /usr/bin/mail. Be sure to reload your Nagios configuration after making these changes.

That should be it! If you’re having trouble, break things down to troubleshoot. First test out sSMTP by doing the following:

sudo -vvv ssmtp somebody@somedomain.com

Write a message, press enter, then hit CTRL+D. If that works successfully but Nagios still isn’t sending alerts, be sure to check the Event Log in the Nagios interface to see if there are any errors.

Categories
Coding

jQuery Nivo Slider + WordPress JavaScript error

I don’t know if you can really call this a bug, but it’s certainly something that needs to be dealt with. After implementing the jQuery Nivo Slider plugin (which is great when it works), I was getting the following error in the JavaScript console in Chrome during every image transition:

Uncaught TypeError: Cannot call method 'substr' of undefined

The transitions were working, but the previous image wasn’t ‘overlayed’ by the next image – it would just disappear and the new one would appear. It was almost like something else was there. Looking back at my ‘raw’ HTML code in the WordPress post, I had all three images in sequential order, but neatly aligned by pressing enter after each. What I didn’t know was that WordPress, even in HTML mode, was adding <br /> tags after I pressed enter, causing this problem.

Solution: Make the <img> tags back to back on the same line, thus removing the automatically generated <br /> tags.

Categories
Tutorials

Going back to the black Twitter app icon

It appears that with the latest update, Twitter has replaced their dock icon from the original sleek black color to a brighter blue. I really liked the original black, so this is how I went back to it.

1. Download the original icon here
2. Open up Applications and find the Twitter app
3. Right-click the app and select ‘Show Package Contents’
4. Go to Contents, then Resources
5. Locate ‘Icon.icns’ then copy and paste itself in the same folder (this is optional, but we’re creating a backup)
6. Put in your password if prompted
7. Take the file you downloaded in step 1 and paste it into the same folder
8. Click ‘Replace’ when prompted
9. Put in your password if prompted
10. Move the Twitter app out of the dock, then load it up

You’re done! You should now have the original black Twitter app icon.

Keep in mind that with any future updates, you’ll probably have to repeat this process.