An intro to Python

This month I have an active subscription to cbtNuggets (http://www.cbtnuggets.com), a training site for IT stuff.  Once I finished my mission, I found that I have some time left in which I can learn something else.  Since there isn’t a course for git, I chose the next best thing:  a course in Python taught by Ben Finkel.

So far the material is basic and can be learned from many web sources, so I’m not repeating it here.  There are a couple chewy nuggets that I’d like to remember though – which is what this blog is about!

  1. The online python documentation can be found at https://docs.python.org.
  2. There is a library of python code and stuff located at https://pypi.python.org/pypi
  3. Python 2.x is preinstalled on OS X (I love Apple!).  To find the version running on your Mac, use the command python –version or python -V at a command line.  Mine is running 2.7.6.
  4. Launch python’s interactive mode from the terminal using the command python.
  5. Execute a python program file from the terminal using the command python <filename>.

That’s all for tonight.  I’m off to beg my lovely financial officer for a copy of the UltraEdit Studio!

Git Setup

Yesterday I ‘installed’ git on another MacBook – the process is pretty easy.  Simply open a terminal session & type the command “git“.  Follow the prompts as OS X installs the Command Line Tools.  Be sure to update them by visiting the App Store once the install is complete.

The harder thing is to initialize the git installation.  Here is what I am doing, based upon the suggestions found in Pro Git (link below).  I’m sanitizing some of the fields – they should obviously be set to appropriate values for other environments.

  1. Set username & email address
    1. git config –global user.name “Tim Armstrong”
    2. git config –global user.email tima@tims-zone.info
  2. Set the default text editor
    1. The default default text editor is typically Vim.  I like this and don’t change it, but it can be changed.
    2. git config –global core.editor <text editor>
  3. Verify the settings
    1. git config –list

Now that git is initialized, I should initialize a repository so that I can begin using git.  Within a terminal session, either create a new directory or change to an existing one that contains (or will contain) files to manage.  Once there type the command “git init“.  The next step is to begin tracking any files that are in the directory, using the following commands:

  1. git add *
  2. git commit -m ‘initial project version’

That gets things started.  I think that I’ll setup separate posts for each major action to be taken while managing the files/projects.

Lastly, here is a link to find the current version of the open source book on git, which can be downloaded for free and details everything that I’m doing.

https://progit.org

OSX tftp Daemon Control

Tonight I’ve upgraded the operating system and ASDM image on my ASA5505 firewall.  The toughest part always seems to be putting the files in the right place, and controlling the tftp daemon on my laptop.  So here is a post with the critical information.

First, the default location for tftp server activity on OSX is /private/tftpboot.  Files in this location must be world-writeable in order for the daemon to write to them, so a chmod may be necessary if you are backing up configurations.  Reading files should require no modification.

Second, the configuration file for the tftp daemon is /System/Library/LaunchDaemons/tftp.plist.  This is where you can define a different location for the server activity or add other command line parameters to the daemon.

Next we should start the daemon.  This is best done using the following command:

sudo launchctl load -w /System/Library/LaunchDaemons/tftp.plist

Ensure that the firewall is either disabled or allowing inbound tftp connections (udp/69) or things get messy.

When finished with the work it is a good idea to stop the daemon.  tftp isn’t known for being a well secured service!  Shut it down with this command:

sudo launchctl unload -w /System/Library/LaunchDaemons/tftp.plist

And there we go, a functional tftp server on OSX.

Password Management

I’ve collected a huge number of username/password combinations over the years, and some time ago gave up trying to keep up with them all in my head.  Once you give up trying, the freedom is a great thing.  On the other hand this means finding some other process for managing account credentials.  The best process I’ve found is to use a Password Manager.

I follow the advice of one of the Three Wise Men of Cybersecurity, Bruce Schneier, on this topic.  His favorite password manager (which he did help to develop) is Password Safe.  More information can be found at this location:

https://www.schneier.com/passsafe.html

Sadly for me, it doesn’t support OS X.  Consequently I followed more of his advice and did some reading.  My personal favorite is Dashlane, which can be found at this location:

 https://www.dashlane.com

Here are some articles which led me to it (if I remember correctly):

https://www.schneier.com/blog/archives/2010/11/changing_passwo.html

https://www.schneier.com/blog/archives/2013/06/a_really_good_a.html

http://www.nytimes.com/2013/06/06/technology/personaltech/too-many-passwords-and-no-way-to-remember-them-until-now.html?_r=0

 

Lastly, I need to comment on how to manage the ‘super-password’ – the one which opens the password manager.  If that one gets lost, we experience a denial of service attack against ourselves.  That would be embarrassing!  Somewhere on Mr. Schneier’s site I read that a really good idea is to write the all-important passwords down on something the size of a business card, laminate the card, and then store it with your drivers’ license.  How often do you lose your driver’s license?  Not often, I hope.  If someone steals your wallet you may want to have a backup copy with your passport (or whatever) so that you can maybe login to your password manager when you get home and change the password.  Fast.

Raspberry PI Hardware

Today I’ve bumped across a couple of interesting tidbits for Raspberry PI Hardware.

First, the general purpose supplier (as opposed to Amazon, of course):
http://www.modmypi.com/

Second, the Raspberry PI does not include a real time clock in the base package. Naturally one can be added:
https://www.modmypi.com/blog/installing-the-rasclock-raspberry-pi-real-time-clock

Lastly, I may be developing a love for good keyboards.  Here is a source of a premium keyboard:

http://www.pckeyboard.com/page/category/UKBD

As I discover future useful resources I’ll either edit this entry, or add comments to it.  I sense a new category coming on too!