Specify a different ssh key for each host


The ~/.ssh/config file can be edited to specify a different key/identity for each host. This is useful when you have different ssh keys setup on different git servers.

Host mycompany
    HostName mycompany.com
    User fooey
Host github.com
    IdentityFile ~/.ssh/github.key

If you specify a HostName that is different from Host, the .git/config file should use the name specified in Host. That should also be the host name used in git commands such as clone and remote.

See Simplify Your Life With an SSH Config File for more.

Gifting e-books


Not all e-book retailers allow gifting. At work, we’re using gifting so that our centralized purchase department can pay for books and gift back to whoever requested the purchase.

Here’s a list of retailers that allow gifting:

  • amazon.com
  • smashwords.com
  • iTunes Store

Mac OS X tips


This is an ever expanding list of tips for Mac OS X. Leave a comment below if you have tips of your own to share.

Go to a folder in Finder

Hit Command-Shift-G and type in or right click and paste the folder path.

Go to a folder in Terminal from Finder

Start Terminal. Type “cd ” without quotes. Drag folder from Finder (or its status bar) to Terminal. You can also open Terminal directly from Finder. Head over to System Preferences, Keyboard, Shortcuts, Services, and enable New Terminal at Folder and/or New Terminal Tab at Folder. Selected option will appear under the Services context menu of an item in Finder when you right click on it.

Goto to a folder in Finder from Terminal

Type the command

open .

Connect to WiFi and continue using your wired internet connection

Head over to System Preferences, Network, Set Service Order, and raise Thunderbolt Ethernet (or any other interface) above WiFi.

Live webcam feed in a web meeting

To show a live webcam feed on your screen, try Photo Booth (comes preinstalled). Most off-the-shelf USB webcams work just fine with Mac OS X and Photo Booth.

Combine multiple PDF documents

You can use to Preview to combine multiple PDF documents, rearranging and leaving out pages you don’t need…

Go to folder in Spotlight Search

Once you’ve searched for the document and it is highlighted, keying Enter will open the document, keying Command+Enter will take you to the folder where the document is located.

Keyboard Shortcuts

Fn+F11 reveals the desktop. Useful to quickly drag some files on to the Desktop or vice-versa.

PPI calculation


Have the screen resolution (width and height) in pixels and the diagonal length in inches, and want to calculate the PPI? Pretty simple really. Let’s use a concrete example. The iPad 4 has a screen resolution of 2048 by 1536 pixels, and a diagonal length of 9.7 inches. Thus we calculate its PPI as

20130222-212656.jpg

The calculation above was performed using the wonderful MyScript Calculator, and the result captured by taking a screenshot.

Here’s the same formula using WordPress’ \LaTeX renderer, in a more generalized form: \sqrt{w^2 + h^2} \over L, where w is the screen width in pixels, h is the screen height in pixels, and L is the diagonal length of the screen in inches.

Merge pdf files using ghostscript


To merge or join pdf files with ghostscript, from the command line:

"c:\Program Files\gs\gs9.06\bin\gswin64.exe" -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=join.pdf -dBATCH ch01.pdf ch02.pdf ch03.pdf ch04.pdf ch05.pdf ch06.pdf ch07.pdf ch08.pdf ch09.pdf ch10.pdf ch11.pdf ch12.pdf ch13.pdf AppA.pdf AppB.pdf

Change the command appropriately for your operating system and files.

A pity gsview does not provide a GUI for doing that.

First time on Mac OS X


If you have never used a Mac, you’ll rightfully feel lost about several key aspects. As a first time Mac OS X user, after almost two decades with the PC, I required some time to adapt.

Mouse

Mouse on a Mac has only one button. To get the context menu or the right-click menu you’ll need to hold the control key while you press the mouse button. On the Dock, you can hold the mouse button for a while and get the context menu for an app. From that context menu you can pin or unpin the icon for the app.

The trackpad supports multi-finger gestures. Slide down two fingers over the trackpad for the content to scroll up, slide up for the content to scroll down.

Keyboard

The keyboard is again different on the Mac, more so the keyboard shortcuts. The command key behaves more like the control key on the PC. Thus, command-c copies, command-v pastes, command-x cuts and command-z undoes. Some commonly used keys are missing, here are the alternatives.

Key on PC Alternative on Mac
backspace delete
Home command-left arrow
End command-right arrow
Page Up control-up arrow
Page Down control-down arrow
Delete control-d

Common Applications

Apple has unleashed the App Store on Mac OS X after its success on iOS. It has tons of free and paid apps.

I use Skype and Chrome almost on a daily basis and several hours a day. Luckily both are available for Mac OS X from their respective sites. Use Safari to download the installers. App installers in Mac have the extension dmg. Double click on a dmg file in Finder and you can install the app. Installed applications can be found in the Applications place in the Finder app. The Finder app itself is always available when you are on the Desktop, or from the Dock.

Command Line

If you’re familiar with the command line you’ll find yourself at home in the Terminal app. It provides a command line interface based on the Bash shell. Mac OS X has a fully capable Unix system underneath all the eye candy. Here’s one example of how you can use the curl command to resume a broken download

curl -C - -O  

Use the Motorola Symbol CS3070 barcode scanner on a PC


This post shows the different means to read scanned barcodes using a CS3070 barcode scanner, on a Windows 7 PC. These instructions may also serve as breadcrumbs for Windows XP and other operating systems.

We recommend downloading and printing the CS3000 Series Quick Reference Guide (QRG). It has some barcodes we’ll need in the procedures below.

Using the Bluetooth Serial Port Profile

Follow these steps so that the barcode scanner can be read over a Serial (COM) Port:

  1. Turn on the scanner by pressing the + button.
  2. Scan the barcode for Serial Port Profile (SPP) from the QRG (page 10).
  3. The scanner should be in Bluetooth discoverable mode. If you delayed a while and it is not discoverable, press the Bluetooth (Motorola logo) button for 5 seconds till it starts to blink rapidly.
  4. On PC, in the Bluetooth control panel applet choose Add a Device (Windows 7). Choose device with name starting with CS3070.
  5. Choose the option to provide a pairing code and enter 1234.
  6. PC should pair with the scanner, the scanner will emit a beep and the blue LED (Bluetooth button) will start blinking less rapidly. PC will and add a COM port, you can obtain the port number in Device Manager.
  7. Use a serial port terminal (like putty or teraterm) to read data from the serial port, set the baud rate to 9600.

Pair as a Bluetooth Keyboard (HID)

Follow these steps to add to a PC as a Bluetooth Keyboard (aka HID – Human Interface Device):

  1. Turn on the scanner by pressing the + button.
  2. Scan the barcode for Bluetooth Keyboard Emulation (HID) from the QRG.
  3. The scanner should be in Bluetooth discoverable mode. If you delayed a while and it is not discoverable, press the Bluetooth (Motorola logo) button for 5 seconds till it starts to blink rapidly.
  4. On PC, in the Bluetooth control panel applet choose Add a Device (Windows 7). Choose device with name starting with CS3070.
  5. Allow the PC to generate a pairing code.
  6. Scan the individual numbers of the pairing code using the Bluetooth scanner. Use the number barcodes in the QRG.
  7. Scan the barcode for Enter.
  8. PC should pair with the device and add a HID (keyboard).
  9. Test the scanner works by opening Notepad and scanning a barcode.