LINUX skills

I started interacting with UNIX systems before Linux came out. I have never been a LINUX developer though. I’ve had at least LINUX box up and operating for a couple decades. They are handy to have around and useful for odd tasks. The GUI’s have come a long way, but as a UNIX admin told me mumble years ago, “If you aren’t using the command line, you’re doing it wrong.”

If you want to improve your LINUX skills, here is a good, and relatively cheap method. Pick up a Raspberry Pi, load Raspbian LINUX (or Ubuntu is another option), and work your way through “The LINUX Command Line by William Shotts.

I’m going with Raspbian. This way you can learn to fill in the gaps (example: no ‘cal’ command, so it’s ‘sudo apt install ncal’ for you).

Advertisement

Low Power FM Transmission

I decided to muck about with a low power private FM transmission. The goal was to pump my local and streaming music over an open FM frequency so I can listen on a radio, which I have several, including nice Bose Wave radios. The FM transmitter was just under $150 with shipping and taxes. This is a fairly easy to use model. I set the frequency, plugged in the input, and started listening.

I have it plugged into an old Sonos device (the Connect device, which has stereo output jacks). I had playlists with local and streaming music I could easily load and put in a looping random mix. An old smart phone or mp3 player with a mic/headphone jack and power supply would work also.

There is also a long wire antenna included in the package. The documentation clearly states that this is not for use in the United States, since it would boost your range well past the 300 feet allowed by the federal government.

Travel Tip

I recently saw a list of travel trips for nerds.  One was that TVs in hotels have USB ports that are typically powered ports, so you can use them to charge your various devices.

Good tip. I would still advise using a USB condom, because like most devices in the IoT world, most Internet capable TVs  lack even basic Cyber Security features.

Sorting pictures

I’ve been backing up my iPhone photos to my Windows 10 desktop using Microsoft’s OneDrive.  The photos are on my local drive as well as the cloud.  The downside is that all the photos, movies, and screen shots are dumped into a single directory, and there are a lot of them.

I prefer to have them sorted by date into directories.  A directory for each year, with sub-directories for each month.  I could do this by hand, but that’s a pain, and I have to remember to do it on a regular basis.  Plus I’ll probably want to do the same for my wife’s iPhone photos.  So I decided to write a python script to scan the camera roll directory, and copy the files to a directory in my photo archive section.  The scrip will create directories if needed and skip files that are already in place.

That part was pretty straight forward. I used os.chdir() to get to source directory and os.listdir() to get the directory contents.  Don’t want to create month directories for directories, just files, so I used os.path.isfile() to filter out non-files, and then check the file extension.  I only want jpg, mov, png, and tiff files.  I use Camera+ most of the time, which produces tiff files instead of jpg files. The png files are screenshots.

I used os.stat() to get the create time, and found files I exported to the camera roll from Camera plus had a create time of when they were exported, not the time the photo was taken. (Once I started having Camera+ dump straight to the camera roll, I didn’t have this problem).

So, I dug a little deeper and found I could get an image created time stamp with a getImageDate() call.  Downside was this didn’t work for png, tiff, or mov files.   So I had to do some extra sorting, and wrote another function to use on just the jpg files. I called the open() function from the Image library, and extracted the exif data using the _getexif() function. This works most of the time, so when it fails I had it return a ‘?’ rather than the time stamp string.  Seeing that caused a fall back to the getImageDate() function.

This extra call to the Image library made the placement of the files more accurate.  I had the base time function return the month as a three character string and the year as a 4 characters string.  This required some basic string manipulation. Those two parameters were added to predetermined destination and passed to a function I had written for another project that checks if directory exits, and creates it if it does not.

Next was to have the program check to see if the file already existed in the correct destination directory.  If it did, don’t bother copying it again. This will make the incremental runs faster and save on unneeded file transfers.

Now I have a functional script that I can set up to automatically run once a week.  Once the files are archived off OneDrive, I can removed them there and on the iPhone is order to free up space.

Update: Source Code

The tricky part is getting the time stamps.  Here are the three routines that handle that.  Wordpress mucks with the spacing, but you should be able to figure it out.

def getImageDate(sPath,file):
    'Get the image created time stamp'
    img = Image.open(sPath + "\\" + file)
 
    tTime = "?"
    imgData = img._getexif()
 
    if 306 in imgData and imgData[306] < tTime: # 306 = DateTime
        tTime = imgData[306]
     if 36867 in imgData and imgData[36867] < tTime: # 36867 =                             DateTimeOriginal
         tTime = imgData[36867]
     if 36868 in imgData and imgData[36868] < tTime: # 36868 =         DateTimeDigitized
          tTime = imgData[36868]
      return tTime
def getTime2(file,sPath):
    'If the file is not a jpg, get the last modified time, which is close enough'
    os.chdir(sPath)
    (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime) = os.stat(file)
    year = time.ctime(mtime)[-4:]
    month = time.ctime(mtime)[4:7]

return month, year

def getTime(sPath,dPath,file):
     'Most files are jpg files, so this is the default path'
      month = "Jan"
     year = "1956" #If we see this year, we know there is a problem
     months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
     ext = file[-3:].lower()
     if ext == 'jpg':
          cTime = getImageDate(sPath,file)
           if cTime != '?':
                   year = cTime[0:4]
                    monthNum = cTime[5:7]
                    month = months[(int(monthNum)) - 1]
            else:
                       month,year = getTime2(file,sPath)
    else:
            month,year = getTime2(file,sPath)
    return month,year

Rocket City Rednecks

I discovered this show by reading one of Travis Talyor’s non-fiction books, A New American Space Plan.   While this post is about the TV show, pick up this book as well.  It’s a well laid out case of why American should be serious about getting into space again and how to do it.

Also take the time to watch the show, Rocket City Rednecks, either by streaming or on optical disk.   This show is about five self-identified Rednecks from Huntsville, AL, two of which are actual rocket scientists from NASA who actually build working gear.  Really cool gear that works.  OK, it works most of the time, but even when they fail, they learn from their mistakes so then can do it better the next time.  That is really one of the important lessons.  It’s OK to fail, as long as you learn from it.   Most of the gear is built in Travis’ father’s garage.   Charles Travis is a retired NASA machinist who worked on the Apollo program, and one of the five Rednecks who star in the show.

I’ve watched about a third of the first season so far, and they have built some really nifty gear so far.  These include a still in order to build a moonshine fueled rocket, the actual rocket, a balloon based observation platform, a working submarine, a radio telescope array using 18″ satellite dishes, under vehicle armor capable of withstanding an IED blast (they drove the pickup truck away afterwards), and a working “Iron Man” suit, that had armor capable of  stopping 9mm handgun rounds, lifting over 100 pounds with a single arm and fired rockets!

Just to add to the overall coolness of this, most of their projects are done over a single weekend with a budget of about $1000.  Keep in mind that three of these Rednecks are current or former NASA employees.  The two active ones have eight advanced degrees in science between them (Travis has five post-graduate degrees.  For those of you who know me, yes, that is one more than Amy currently has).  Rog (Rednect #4) doesn’t have any advanced degrees, but he does have a genius level IQ, and Michael (Travis’ nephew) is mechanically inclined and studying to be a machinist.   Still, if you know basic work working, basic welding, how to solder two wire together, and some basic programming, you and your friends could try some of this stuff.

Which is kinda the whole idea of the show.  To get kids off the XBox and out there building go carts, rockets, radio sets and other cool gear.

This is the kind of show my dad would have loved.  He was 22 year veteran of the Army Corps of Engineers, and would have been out teaching kids how to to build the things the Rednecks are building.

Building a Hackintosh Mini

Building my Windows Tower last year was fun, so I have been looking for another project.  Then I found this page at Tony Mac’s on building a Hackintosh Mini.

What I’m looking for is a small system to hook up to the TV in the Den.  The motherboard in the parts list has a HDMI port, and I already have a remote keyboard/trackball to use.  There is an Ethernet switch where I want to put it so, no need for a WiFi card either.  I figure I can build it for around $470.  That includes $20 for a copy of Mountain Lion MacOS.  Not bad considering low end Mac Minis start at $600, and that is with a 500 Gig HD and 4 Gig of RAM.  I’m planning on a 2 TB HD and 8 Gig of Ram.  The foot print is a little bigger than a Mac Mini, but I’m replacing a mini-tower, so the space isn’t a problem.

Here is the parts list I’m looking at:

Expanding the desktop…

No, I’m taking about monitors, screen size and resolution. I’m talking about the tower PC I built.

Running quite nicely.  I’ve got dual monitors set up, and it is handling just about anything I’ve tossed at it so far.

The thing has plenty of room for additional drives, but I decided to go with a Drobo for external storage.

The system has a 256 Gig SSD and a 1 TB Western Digital drive, but wanted something for storage that was going to give me some level of data redundancy.  Having it  not in the tower was a plus from the suspenders and belt viewpoint as well.  The only downside was the Drobo’s USB was USB 2.0 and the  ASUS Maximus IV Extreme Z-LGA 1155 Z68 motherboard is a USB 3.0 beast, with lots of USB 3.0 ports.  It also has a few ESATA ports, but the only Firewire port was on the front, and not well placed for what I wanted.

Easy enough to fix.  I’ve got open slots, so I added a Firewire card. That and an 800-800 Firewire cable and I’ve got much better transfer speeds from the Drobo.

System Building

I’ve been thinking about building a new desktop and finally bit the bullet and ordered a bunch of parts.

One of the first things to arrive was the Cooler master HAF 932 Advanced Full Tower Case.

w00t! This thing is big!  It comes with three 230mm fans.  One on front, one on the side and the last one on the top.  If that isn’t enough airflow, you can replace the side fan with four 120mm fans, and the top one with three 120mm fans.  I’m going to stick with the default fans for now.

The 800 Watt power supply also arrive, so I installed that. The Sandy Bridge processor and CPU cooler arrived, but not the thermal compound, so those are still in their boxes.

I figured this would have to last me a few years, so I went with the ASUS Maximus IV Extreme Z-LGA 1155 Z68 motherboard. Lots of I/O on this beast, including plenty of USB, 800 Firewire, ESATA and two Gig Ethernet ports.

Once the thermal paste and 8 Gig of RAM arrive, I’ll be able to install the motherboard.

The two other key components I’m waiting for is a  256 Gig SSD and a Samsung Blu-Ray reader/DVD writer optical drive.

Once I have those, I can fire it up and install Window 7 Ultimate, 64 bit.

Ya, I hear you.  No video card.  I’ll be cannibalizing  the NVIDIA GeForce GTX 460 out of my old system, which will have to get by with the on board graphics again. That and a 2 Gig 7200 RPM hard drive.

That should be enough to get me rolling and installing software.  I’ve also got a multi card reader on order, but I can always add that later on, especially since that seems to be the long pole in the shipping wait.  The old system will eventually end up in the basement, hooked up to the TV for the display and a wireless keyboard/trackball.  It’s got enough horse power to make a good music/movie server, and given the big screen on the TV, hopefully a decent device for stray web surfing.

The Rules of Building, Making and generally mucking about…

Something I found that I though was cool.

Originally posted at the Urbin Report.

Local backup of GMail

Wired has the details.  I’m already using the Thunderbird method.

I’ll probably use the GetMail method on the linux box as well.