Overlay an Image on Top of Another with GraphicsMagick


gm composite -resize 1920x1080 -dissolve 40 overlay_image.jpg base_image.jpg result_image.jpg

Break Down

The resize option resizes the overlay to the specified dimensions. You can specify just the height with x1080 or just the width with 1920. Typically you would want this to be the same width as the base image.

Continue reading

Create thumbnails of PDF’s with Node JS and GraphicsMagick

1. Install GraphicsMagick

On Ubuntu (14.04):

sudo apt-get install graphicsmagick


2. Install the Node library in your project

npm install gm


3. Write  a script

Below I show two ways of creating a thumbnail. The first way creates a JPG using various GraphicsMagick functions, I prefer this way because it gives me fine grained control over the thumbnail. The second uses a built in function for thumbnails, which is easy to use but isn’t as flexible.
Continue reading

How to Add a library file to EESchema

Recently I wanted to add an Arduino library to EESchema to make a schematic. Here’s how to do it.

Download the Library Files

First download the library from somewhere. I found the library I wanted on GitHub, but there are other places you can look, too.

Add the Library Files

Whether you downloaded a singled zip or multiple files, make sure you’ve located the .lib file. That’s what you’ll be adding. Open EESchema and open the Preferences > Library Menu. It should look like the window below.

from -home-jamil-Documents-KiCad-Arduino Schematics-RGB-RGB.pro_006

To the right of the Component library files pane, click Add. Locate your library file and add it. Click OK.

Now when you go to place a component, List All to see all your libraries and you should see your new library in the listing. Click on the library to choose your component and put it on your sheet.

Stop Accidentally deleting apps from your iPhone

If you’re like me, you don’t install many apps and you delete them even more rarely. But sometimes, like me, you might absent-mindedly hold your phone in your hand or pocket while it is on and your palm starts doing all sorts of crazy things.

Once I was talking to someone and briefly looked at my phone to see a confirmation asking me if I was sure I wanted to delete my mail app (one of my most frequently used apps on my phone)!

However, you can turn off the ability to delete apps with restrictions on your phone. Go to Settings > General > Restrictions > Deleting Apps and turn that off. If you’ve never used restrictions before, you’ll be asked to set up a new pin. This is a different pin from your lock code, so don’t get them confused.

2016-03-20 19.27.57 2016-03-20 19.28.18

Now when you leave this menu you will not be able to delete apps at all. If you want to delete an app, come back into this menu and turn this setting back on.

There are a lot of other useful things you can do in restrictions like restrict content on the web or location services, yadda, yadda, yadda. Useful if you have young’uns that have their own phones. If that’s the case, your poor parenting might be the subject of a future post.


Permission Denied when uploading a program to my Arduino

If you just started playing with Arduino on Linux, you may have run into an error uploading your very first program, similar to the following:

avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied
ioctl("TIOCMGET"): Inappropriate ioctl for device
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

Your Arduino is mapped to a character device file called /dev/ttyACM0 and it looks like the IDE does not have permission to write to it. That’s essentially the problem and the fix is simple enough.

Open up a terminal and follow these commands. First let’s figure out what the current permissions are on this file.

ls -lah /dev/ttyACM0

You should get output similar to the following:

crw-rw---- 1 root dialout 166, 0 Feb 28 10:47 /dev/ttyACM0

What this shows us is that the owner (root) has read and write permissions, the group (dialout) has read and write permissions and others have no permissions at all. The fix is to let others have read and write permission so that your IDE can upload the program.

sudo chmod 666 /dev/ttyACM0

As demonic as that permission code looks like, it is actually just giving everyone read and write permission for this file.

If you run the ls command again, you should see that the permissions have changed:

crw-rw-rw- 1 root dialout 166, 0 Feb 28 10:56 /dev/ttyACM0

I don’t know what the user is when the IDE tries to upload, but if you do, please leave a comment!

You should now be good to upload your sketch to your Arduino.

How to install Swift on Ubuntu and add syntax highlighting for Sublime Text

I recently started teaching myself Swift, the new Open Source Language from Apple that powers their latest iOS and MacOS apps. In this article, I’ll go over how I installed it on Ubuntu 14.04 and how I got Sublime Text 2 to recognize it’s syntax. Note that there may be better and more comprehensive ways of doing this, I’m just posting what worked for me. If you have any suggestions to improve this, please be sure leave a comment.

Directions adapted from this post.

Start by clicking here and downloading the latest snapshot for Linux. For me it was called Ubuntu 14.04 Swift Development Snapshot, posted on Feb 3, 2016.

Continue reading

How to Use Intel’s PIN program: A super simple tutorial

If you’re reading this, you probably already know what pin is for, but basically it is used to profile programs. You can use it to answer things like how many instructions does this executable have or how many branches occur, etc. It does this in most cases by inserting counters and other code while your executable is running. So let’s get to a quick demo.

I will be demonstrating with Linux, specifically with Ubuntu, because this was a headache on Windows. Note that you might need root permission to execute some of these commands, so if they don’t work, try re-running with sudo.

(1) Download the pin program tarball
Download the tool from here, making sure that you have a compatible version of gcc. Continue reading

Tech Review: Toshiba Canvio Slim 500 GB External Hard-drive

My Rating: 4.5 out of 5 What is it? The Toshiba Canvio Slim is an external hard-drive that can be used for sharing files, storing photos or making a backup of an entire internal drive.

The Toshiba Canvio Slim External Hard Drive with included SATA to USB cable.

The Toshiba Canvio Slim External Hard Drive with included SATA to USB cable.

The Good One of the first things you’ll notice when you take this HDD out of the box is it’s superb aesthetic design. If it wasn’t for the fact that it was black and gray, I’d say it was Apple inspired. Continue reading

A Cool Project that Needs Your Support: HabitRPG

Habit RPG

In life, there are things we have to do and there are things that we want to do. Rarely do these two categories overlap and I (like many of you out there) wish there was a way to get both types done. We can make lists, deadlines or whatever to put these goals in front of us, but at the end of the day we just don’t have the motivation to get it done! That is where Tyler Renelle’s HabitRPG comes in.

Continue reading

My Top 5 Mistakes in Ubuntu

Ubuntu Logo

While I love using Ubuntu, I’ve made my share of (sometimes disastrous) mistakes while using it and wanted to share them so no one else falls down the same dark paths that I have walked.

5. Not using the Long Term Support (LTS) Versions

Each version of Ubuntu just keeps getting better and better, but sometimes upgrading to the latest version isn’t the best choice. If you don’t have a lot of patience (or a slow internet connection) this could be problematic as an upgrade could take several contiguous hours, which not everyone can spare. Then of course there are the problems upgrading from one version to another, such as certain programs not working correctly or packages being corrupted, etc. Avoid it all by just sticking to the LTS versions. You’re not missing anything important by playing it safe; rather, you’re saving yourself hours of headache because you’ll only need to update every 5 years instead of every 6 months.

4. Using the command line for something that could have been done through the GUI easily

Learning how to use the command line is important, but if you know your stuff already it’s better to just take the GUI route when you can. Why? The GUI is usually robust enough to avoid making the mistakes you’d make if you were allowed free access to the guts of your Linux distro. The Software Center already knows everything that is has to do, so there is no guess work and no need to cross your fingers. A single mis-typed character on the command line could send your entire computer into utter chaos and you’d never know why.

Continue reading