Helpful and Most Frequented Python References

I’ve never written a Python 2 module so several of these links go directly to the latest stable Python 3 (3.4 in this case). No worries though, you can simply manipulate the URL or select your version once you land on the page. Some of these links are for Python in General, like the style guide. While some of the more instructional links will use their respective authors choice. All is good in Python regardless of version 2 or 3, it’s relatively easy to move back in forth. But what do I know, I’ve only written Python 3 modules.

Any time I’m away from Python for any length of time, I find it helpful to review the “Style Guide for Python” (PEP 8) and the “Structure Your Project” Python Guide. I find that these two pages help me write more Pythonic code and avoid common pitfalls. I like to also think these help me write cleaner code and save me some embarrassment when I publish my code.

Even if others never ever use your Python modules, it is very important to provide meaningful feedback. I like to keep the Built In Exception Hierarchy listing close by so that I can generate the best possible exceptions. This helps make catch statements and traces relevant and informative.

Here are a few more pages I use so frequently that I wanted a nice place to collect them at.

Alex Martelli (Google) Python Design Patterns Video Series:


The Best of “The Amp Hour” Podcast

The Amp Hour Podcast Logo

The Amp Hour Podcast (Logo)

I listened to my first episode of “The Amp Hour” podcast as I drove from California to Texas on my way back from a summer internship at Sandia National Laboratories back in 2010. Now, that I have found myself commuting two hours everyday I started listening to the show again. Boy has this show come a long ways. Congratulations Chris and Dave! Keep up the great work.

I have had this post in draft for well over a year but I decided that even though it is grossly incomplete I would go ahead and make it live with hopes that I would update it as I come across episodes that peak my interest. With that said, here are some of my favorites that I have kept track of. Personally, I found that I prefer the episodes with guest interviews.

If you are looking for other high quality podcasts to fill your commute and headphones may I also suggest Elecia and Christopher White’s electronics podcast “Embedded”; and Steve Gibson and Leo Laporte’s security podcast “Security Now!”

Abstract Tree Lights Background Image

Photo of winter tree lights physically blurred by moving camera while shutter open.

Abstract Tree Lights (physical motion blur).

I’ve never been one to go all out with winter holiday decorations but here is a photo that I took that I have been using for years as my computer background this time of the year. I took this photo cutting through the Texas Tech University campus in Lubbock, Texas at the end of a group bicycle ride. There are others in the series but I don’t think they are published at this time.

Visit my flickr page to download the original (3008×2000) if you would like to use it as well. I linked to a nice page that will let you pick the actual size you would like to download.


Custom Tunnelblick/OpenVPN Configuration Settings for proXPN

Download proXPN Tunnelblick Configuration

Screenshot of Tunnelblick selecting proXPN server.

Select proXPN server with these configuration files.

After hearing proXPN marketed by Steve and Leo on the TWIT “Security Now” (SN) podcast for several months I decided to sign up for the service and take advantage of the SN promotional 50-percent off discount. By the way, if you have not been listening to the Security Now podcast or if you have never heard of it I encourage you to check it out. I had trouble connecting to the proXPN servers using the provided client software on Macintosh OS X 10.9.5 (other versions of OS or client were not tested) so I created a set of configuration files so that I could use an unbranded version of Tunnelblick.

When I realized that the proXPN OpenVPN client software was simply a rebranded version of the popular OS X OpenVPN client Tunnelblick I used the Tunnelblick instructions for removing rebranded versions of Tunnelblick. I then installed the standard Tunnelblick and attempted to configure it using Mark Lai’s instructions for using proXPN with Tunnelblick. After doing a few basic tests I confirmed that I could use proXPN’s service on my Macintosh running OS X 10.9.5 and Tunnelblick.

I wanted to keep all, or at least most, of the options/features offered by the proXPN client but using the standard non-branded Tunnelblick. By evaluating the OpenVPN documentation and the logs produced by OpenVPN packaged with Tunnelblick I decided to make a few modifications to the OpenVPN configuration files and to develop a set of configuration files so that I could utilize the various ports, servers and locations offered by the proXPN service. These configuration files utilize several security options documented by OpenVPN and do not utilize any up/down scripts supplied by proXPN. You may download and submit bugs/features against these configuration files at my github page. Installation instructions are provided there as well. These configuration files include the primary and secondary addresses off all the locations and will attempt to connect on ports 1194, 443, 80 and 8080 in that order. See screenshot above for what Tunnelblick looks like after these configuration files are installed.

I would also like to point out that I tried a competing paid ($9 USD) OpenVPN client for OS X titled “Viscosity.” Viscosity does not appear to be updated as often as Tunnelblick. For a security application this is a bit of a concern to me. Viscosity is not open source like Tunnelblick. Viscosity has a few bugs at the moment that prevented me from being able to use or test the product. These bugs prevent a user from importing existing OpenVPN configuration files. When I attempted to manually create and modify configurations from within Viscosity I was not able to connect. After getting Tunnelblick to work and spending some time on Viscosity I lost interest and patients. I have some UI complaints against Tunnelblick but they are mostly the same with Viscosity so I really was not that motivated to get Viscosity to work.

As a whole I feel pretty disappointed in the state and availability of OpenVPN clients for OS X but I’m happy I found a solution that appears to work well for me. I have decided to stay with paid/premium proXPN service for the next year instead of bailing out during the 7-day grace period. Hopefully the proXPN quality of service will overcome my OpenVPN client issues. I still have clients to configure for iOS 8, Arch Linux and Windows 7. By the time I am done configuring all of these clients, I expect to have a decent impression of how OpenVPN clients are implemented across various popular operating systems.

Download proXPN Tunnelblick Configuration

Install KiCad on Arch Linux

I’ve been using KiCad on and off for a few years now. I like KiCad reasonably well but it doesn’t always play well with Mac OS X so I usually run it in a Linux Virtual Machine. Here are the install steps for Arch Linux assuming that the X Windows System, graphical interface environment, is already installed.

Screen capture of KiCad running on Arch Linux inside Virtual Box on Mac OS X

KiCad running on Arch Linux inside Virtual Box on Mac OS X

Install Instructions

# Update Pacman and download dependencies
sudo pacman -Syy
sudo pacman -S cmake bzr wxgtk glew

# Configure bzr username... 
# Even though I would prefer not to...
bzr whoami paretech

# Change into Arch User Repository download directory 
# or wherever the download should go.
cd ~/aur

# Download Bzr Tools (includes the necessary Bzr Patch plugin)
curl --remote-name

tar -xzvf bzrtools.tar.gz

cd bzrtools

# Inspect PKGBUILD first!

sudo pacman -U bzrtools*.xz

# Download Kicad AUR and name file same as remote name
curl --remote-name

tar -xzvf kicad-bzr.tar.gz

cd kicad-bzr

# Inspect PKGBUILD first!

sudo pacman -U kicad-bzr*.xz

That’s all there is to it on Arch. Good luck on your next PCB and Happy Hacking!

Hacking Apple Headphones for Assistive Technology

A while back I took opportunity to hack together a piece of Assistive Technology (AT) for a good friend of mine using a damaged pair of Apple Earphones with Remote and Mic. The first version, pictured on the right, is constructed with a three button array found on ebay.

The second version, pictured at the bottom, is constructed with large arcade buttons from Sparkfun and a custom enclosure that I made with sheet metal, a breaker bar and pop (blind) rivets. This version should be easier to use than the first as it has larger softer buttons, less dangling wires and a case that can withstand being squished between an electric wheel chair and a door frame.


If you are interested in what is inside the Apple Earphone controller, there is a wonderful tear down post.Image



Install Arch Linux as VirtualBox Guest OS

When I was an intern at Sandia National Laboratories I was introduced to the concept of using virtual machines to sandbox my projects. I have found this to be very helpful for many software experiments and development environments. I even use virtual machines to run my day-to-day Linux install. Here I give my notes on how to use Virtual Box to run an Arch Linux guest install on Mac OS X. Once a base install is complete it’s easy to make snapshots and spin up and destroy clones from the base install as needed.

Create New Virtual Machine

  • Download Arch Linux ISO Live CD

  • Create VirtualBox Disk Image (VDI) with desired settings.

  • Load the Arch Linux ISO as a CD/DVD image and select the “Boot Arch” option when the live CD boots.

Partition the drive(s)

# gdisk /dev/sda

Name Cmd # Start Stop Code Type
Boot n 1 0 +250M 8300 (Linux Filesystem)
Swap n 2 0 +2G 8200 (Linux Swap)
Root n 3 0 -0M 8300 (Linux Filesystem)
  • Use the n command and values (above) to create partitions using gdisk.
  • Print the the gdisk partition table with the p command.
  • Write the gdisk partition table with the w command.

Install and Configure System

# Format Partitions
mkfs.ext4 /dev/sda1
mkswap /dev/sda2
mkfs.ext4 /dev/sda3

# Mount Partitions
mount /dev/sda3 /mnt

mkdir /mnt/boot
mount /dev/sda1 /mnt/boot

swapon /dev/sda2

# Configure Mirrors

# Install Base System
pacstrap /mnt base base-devel linux

# Generate File System Table
genfstab -p /mnt >> /mnt/etc/fstab

# Set hostname
echo 'myarch' > /etc/hostname

# Change Root Directory
arch-chroot /mnt

# Configure language
echo LANG="en_US.UTF-8" >> /etc/locale.conf
echo LC_COLLATE="C" >> /etc/locale.conf
echo LC_TIME="en_US.UTF-8" >> /etc/locale.conf
echo "en_US.UTF-8 UTF-8" >>/etc/locale.gen


ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
hwclock --systohc --utc

# Generate Ram Disk
mkinitcpio -p linux

# Install and Configure Bootloader
pacman -S syslinux gdisk
syslinux-install_update -iam

# Exit CHROOT, Unmount Drives and Reboot
umount -R /mnt

Post Install

The following isn’t really intended to be executed as a script.

# Setup Network
systemctl start dhcpcd
systemctl enable dhcpcd

# Virtual Box Guest Utilities
pacman -S virtualbox-guest-utils --noconfirm

modprobe -a vboxguest vboxsf vboxvideo

echo vboxguest >> /etc/modules-load.d/virtualbox.conf
echo vboxsf >> /etc/modules-load.d/virtualbox.conf
echo vboxvideo >> /etc/modules-load.d/virtualbox.conf

groupadd vboxsf

systemctl enable vboxservice
systemctl start vboxservice

# X Windows System
pacman -S xorg-server xorg-server-utils xorg-xinit xterm ttf-dejavu --noconfirm

pacman -S awesome

# User Configuration
pacman -S sudo --noconfirm

# use visudo to add  under "User privilege specification" before
# using sudo as 

# Replace user_name with desired user name.
useradd -m -g users -G optical,power,storage,vboxsf -s /bin/bash user_name

chown root.vboxsf /media

# Set  password using "# passwd "
# Set root password using "# passwd"

# Update Packages and System
pacman -Syy
pacman -Syu

Per User Config

Configuration for users other than root.

echo /usr/bin/VBoxClient-all >> ~/.xinitrc
echo "exec awesome" >> ~/.xinitrc

ln -s /media/sf_share_name/* ~/share_name