mcottondesign

Loving Open-Souce One Anonymous Function at a Time.

Keeping a secure password list

Keeping a secure password list should be an easy task but it isn't. This is the solution I am trying out.

  • Download keepass and install on your laptop.
  • Create a master password.
  • Create entries, for existing passwords you'll need to edit the generated password
  • Save it to a file and place in your Dropbox folder
  • Install and login into Dropbox on your iPhone
  • Install MiniKeePass on your iPhone
  • Open the encrypted keepass database on your phone from Dropbox.
  • It won't be able to display anything, but the 'action arrow' button and choose to open it with MiniKeePass
  • MiniKeePass will open and you'll be able to decrypt the archive with your master password.

Got a problem, python is usually the answer

We had an emergency where our EMR provider isn't output the needed government reports. This wouldn't be such a big deal if they weren't due on Monday.

The problem seems to be with the XML records and some information needed to be striped out and manually looked at.

Thankfully python has easy installers for Windows and the standard lib includes xml parsing and csv output.

##########################################
###   Get info from xml and make a csv ###
##########################################

# Simple use:
# pullInfo('C:\\Users\\mcotton\\Desktop\\xml\\431530.xml')

# loop through all xml in directory
# by default it runs in current directory and
# creates a file named out.csv

import os, glob
from xml.dom.minidom import parseString, parse
import csv

def pullInfo(fileName):
  """ Gets information from Aprima xml file"""

  datasource = open(fileName)

  dom = parse(datasource)

  firstName = dom.getElementsByTagName('given')[0].toxml()
  firstName = firstName.replace('<given>','').replace('</given>','')

  lastName = dom.getElementsByTagName('family')[0].toxml()
  lastName = lastName.replace('<family>','').replace('</family>','')

  street = dom.getElementsByTagName('streetAddressLine')[0].toxml()  
  street =     street.replace('<streetAddressLine>','').replace('</streetAddressLine>','')

  city = dom.getElementsByTagName('city')[0].toxml()
  city = city.replace('<city>','').replace('</city>','')

  state = dom.getElementsByTagName('state')[0].toxml()
  state = state.replace('<state>','').replace('</state>','')

  postalCode = dom.getElementsByTagName('postalCode')[0].toxml()    
  postalCode = postalCode.replace('<postalCode>','').replace('</postalCode>','')

  patient = [firstName, lastName, street, city, state, postalCode]

  return patient


# Example path on windows
# path = 'C:\\Users\\mcotton\\Desktop\\xml'

path = './'
output = 'out.csv'

writer = csv.writer(open (output, 'wb'))

for infile in glob.glob( os.path.join( path, '*.*')):
  writer.writerow( pullInfo( infile) )

exit()

Yay! for python

HP N40L and Power Failure

Problem

When I restart my HP N40L it does not always recognize both drives. ESXi is on a thumbdrive and has not problem booting. Because the two physical drives are seperate datastores hosting different VMs it leaves my system in a in consistent place on restart.

Solution

Don't have one yet. I am going to investigate a UPS that triggers a shutdown script.

How to replicate ubuntu vm on ESXi

I wanted to deploy multiple copies of a base ubuntu server, easy right?

Well it is now, but it took me a while to get it right. The whole problem comes from not having 'sysprep' for linux. (They probably have a much better way and I just don't know it). Because ESXi makes up a fake MAC address for the network interface, it is smart enough to make up a new MAC for the new machine. Your old VM is still expecting the old network settings and needs a minor change. I'm not changing the hostname, ssh keys, users, or any of that other jazz; just getting the network up and running.

  • browse the datastore
  • find the Ubuntu directory
  • make a new folder
  • copy the VM to the new folder
  • right click on the vmx file and 'add it to inventory'
  • start the new VM
  • vSphere will ask if you moved or copied it, answer that you copied it
  • log into your new VM from the console
  • figure out what the new interface is: ifconfig -a | grep 'eth'
  • it will most likely be eth1
  • sudo vi /etc/network/interfaces and change eth0 to the new interface eth1
  • save, reboot

You know have a clone of the first machine with a new MAC and IP address. I will revise this as I learn more and my process becomes more automated.

Finally got it working

I finally got my HP Proliant N40L doing something useful.

Except for trying something new, it only runs a single instance of windows 7. I have it configured as two logical drives residing on a single 2TB disk. In my testing I had better performance keeping both logical drives on the same disk. Weird, it shouldn't work like that but it does.

I wasn't able to stream movies from iTunes until I tried a million things, the last being adding a new ethernet card as a VMXNET3 instead of E1000.

It is currently able to stream a movie to the appletv while uTorrent grabs more content. Handbrake is also crunching away at the completed downloads and getting them ready for iTunes.

I am still trying to understand what windows is doing with the 7GB of RAM I gave it. Using the performance monitor I haven't ever seen it go above 2.41. Usually it doesn't go about 1GB. The memory usage stays consistant so it must be doing something.

What do you do with a home server?

A home server seems like such a good idea, until you get one and wonder, what the hell am I going to do with this?

RIght now I have an instance of Windows 7 running iTunes to sync with the AppleTVs. This was harder than it should be because I couldn't add anything to the library without the system thinking it had a sound card. I found something to fake it and now it works.

Amahi is a really light Linux implementation of WHS2011. It is the network share that I am storing my iTunes library. This makes it accessible from all over.

Still not sure what else to do with it

HP Proliant Microserver N40L

My wife bought me a new toy yesterday. A HP Proliant Microserver N40L. I upgraded the RAM (8GB) and after some fighting, installed ESXi from a USB drive. The fighting was because of installing from a USB drive, ESXi recognized all the hardware just fine.

I intend on running it headless, so I am using a tv as a monitor. My little sharp LCD only had dvi. My Samsung plasma has vga, but I can't turn off the power saving mode and it goes to sleep whenever it loses video signal. This means that during a reboot the screen powers down and takes ~5 seconds to come back on. It is really annoying when I was trying to figure out how to get into the BIOS.

I don't know what I am going to use it for other than getting more VMWare experience. I would like to run FreeNAS and Win7 (or Server 2008R2). If nothing else, I can use so of the dev boards I have lying around (phidgets, netburner, synapse-wireless).

Installing VMWare ESXi

I have wanted to install ESXi for a long time now, thankfully we have a spare Dell PowerEdge 1950 for me to use.

I am going to install FreeNAS and pfSense to get the hang of using it. Later I will install some real machines.

Here is a quick audio-less screencast showing how to connect with the vSphere client and create a new virtual machine.

Adventures in IT

We have an older medical office that we need to upgrade. It is using XP as a server and several Win2000 boxes as the clients. The practice management software is not compatible with Windows 7. We couldn't upgrade the software nor could we downgrade the new boxes to XP.

I suggest VMWare (my answer for most everything lately) but this time Microsoft's Virtual PC and XP mode came to the rescue. We were able to test and configure the first machine, shut it down, save it to a network share and copy it to the other machines.

We were able to get a shortcut of the XP Mode application on the host's desktop, connect to a network printer and then still get better performance than before.

I still haven't learned to use sysprep but was able to make it work. Thumbs up to Virtual PC.

How to write a bookmarklet

Problem: I have to use a punch clock webapp for work. It doesn't have jQuery already included and I would like it to work from the iPhone.

Solution: Write a bookmarklet in javascript. Fill-in the text fields and click the submit button.

(function(){  
  // Grab the username and password input fields
  user = document.getElementById('txtUserName'); 
  pass = document.getElementById('txtPassword');

  // Grab the submit button, oddly named 'punch'
  punch = document.getElementById('btnPunch'); 

  // Assign them values and simulate clicking the 'punch' button
  user.value = 'foo'; 
  pass.value = 'bar';
  punch.click()

// Wrap it up in parens so it is a self-calling function
})();

Now you need to make a new bookmark and edit the URL to look like this:

 javscript:<function goes here>

In mobile safari, use the action button (square box with an arrow escaping) to add the original URL to your home screen. Once the page loads you will open up your saved bookmarks and choose this bookmarklet. You can find it and fork it on github [https://gist.github.com/1332353]