Plex on an Old Laptop

When I first started a previous job in 2007, I was issued a used Dell D600 laptop.  The machine was outdated when I got it.  The machine had a Centrino processor, 256MB of RAM and no wireless card.  I used the computer at work for a year or two before I was issued a more modern machine.  When I left the company, the gentleman in IT told me not to return the machine.  The laptop sat in a closet for five years slowly losing value.

“Keep it.  If you send it back, I’m just going to throw it in the dumpster.”

I had a 2TB external hard drive plugged into my router to serve as a network folder, but I found the solution unstable.  One time while copying files from my computer to the drive, the copy failed a lot of the data on the drive got corrupted.  I blamed the router, so I unplugged the drive.

I had the idea to use the old Dell as a networked linux computer where I could use the external drive as a network folder.  As a bonus, I would be able to finally install Plex for my Roku.  I reformatted the laptop’s hard drive and went to work.

I tried to install Ubuntu, but the OS was too cumbersome for the old machine.  It wouldn’t ever boot into the graphical installer.  When using text installer, it would freeze while trying to install packages.

I ended up using a distribution I hadn’t heard of – CrunchBang.  The OS is meant to run with very low overhead, and other people have had success running it on the D600 as well.  The distro defaults are great – the desktop shows computer resources in use and updates them in real time.  For such a weak machine, I found this information invaluable.

I installed Plex, setup a Samba share onto the external drive, and mapped the Plex library to the shared folder.  When I went to stream home movies to the Roku, the videos played for a couple seconds before pausing, buffering, playing, and pausing again.  The memory was maxed out, so I ordered and installed 1GB of RAM from Amazon for $16.

The memory issue was fixed, but I was still getting buffering issues on the videos.  I dug further and found the CPU was maxed out.  I found the Plex client was requesting the server to transcode the videos in real time.  My network is fast enough that I can stream the videos in real time at full resolution, so I switched the Plex default client video quality from 720p to “Direct Play”.  The videos are playing nearly perfectly now.

I am happy to have resurrected an otherwise worthless machine to use as a network server.  If I want to physically get on the machine, it’s convenient to have a built-in monitor, keyboard, and mouse, but I rarely do this.  The machine plugs into the router with ethernet, so it’s hidden out of view anyway.  All of my network administration is done via SSH, and I load files onto the computer with the network share.  The only time I’ve opened the machine was one time when it froze.


Converting GIFs to Video

I’m still working on the digital picture-frame.  The frame downloads animated GIFs from the internet onto a Raspberry Pi and displays them on a screen.  The GIF should loop for a period of time before move onto the next image.  The script currently pulls the top-ten animated gifs from Reddit’s GIFs forum.  For an example, I am using this image, pulled at random:

Downloaded from Reddit
Downloaded from Reddit

I am having severe performance issues displaying the GIFs on the Raspberry Pi, and it seems my best option is to convert the GIF to a video format.  I want to play the video in a loop – and hopefully the Raspberry Pi can handle video better than the animated GIFs.  Installing ffmpeg on the Raspberry Pi was trivial.  I am loving package managers these days.

$ apt-get install ffmpeg

I tried to convert the GIF files directly to an AVI, but the videos were all coming out one frame.  I found some discussions online showing I should convert the Gif into component frames – then convert the frames to video.  I ran:

$ convert 0.gif out%05d.jpg

The command separated the GIF into components, but only the first frame looked right.  The rest of the frames contained severe artifacts like this:

8th Frame with bad artifacts
8th Frame with severe artifacts

I used the -coalesce flag to correct the issue, and the frame came out without any severe artifacts.

$ convert -coalesce 2.gif out%05d.jpg
8th Frame without severe artifacts
8th Frame without severe artifacts

I ran ffmpeg on the resulting JPG frames with an AVI output.

$ ffmpeg -r 25 -i out%05d.jpg -y -an test.avi

The video runs smoothly in VLC on my PC.  You can see the results here.

Still to do:

  • Bake the GIF -> Video conversion into the ruby script
  • Write the display script to loop the video on the Raspberry Pi
  • Dynamically change the frame-rate depending on the properties of the GIF

Digital Ocean WordPress Setup

I’ve owned this domain for years, and I wanted to put a blog back on the address.  I looked at hosted sites like WordPress and Tumbler, but I ultimately decided to host my own.  I want to have a dedicated server on the Internet I can install software on and run any sites or tools I want.  I’ve used Heroku and EngineYard professionally, but those servers are far more expensive than what I wanted to spend for a personal site.  My friend Loren Norman pointed me to a service I hadn’t heard of – DigitalOcean.

I am impressed.  It’s cheap ($5 a month and nice promo codes for first time users), and I have decent Linux server at my disposal.  I chose which flavor of linux I wanted to create, and within minutes, I Digital Ocean handed me the keys .  Their documentation for setting up WordPress is superb.  I am a professional instructional designer, and I love step-by-step instructions.  The instructions were clear, concise, and best of all, they worked.

Rails Development: Mac vs Linux

My employer recently upgraded my work laptop to a late-model Macbook Pro. I maintain an internal Rails application with a colleague, and we needed to setup our development environments on the new machines. We went through the process of installing RVM, Ruby, Postgres, and supporting software. Building the environment took us more than a day after all was said and done. We ran into one issue after another – nothing we couldn’t solve with a little Googling – but it was still a lot of incremental steps.

At the same time, I am working on a small hobby project and needed to build a from-scratch Rails 4 application. I was going to install the server on my personal Windows computer. At the same time, I’ve been working on a separate Raspberry Pi project. The Raspberry Pi sits on my network, so I decided to install the rails server on the RasPi instead of my Windows machine. The Linux installation was easy, and almost everything worked on the first try.

The Macbook Pro is ubiquitous in Rails development circles, and I’ve been developing Rails on my Mac for a couple of years. I always assumed the ubiquity of Macs was due to the ease of environmental management on the Mac compared to Linux. I’m starting to believe the opposite. The installation on Linux was painless compared to the Mac install. I haven’t used much linux in a number of years, and I was barely proficient when I was a regular user. I am shocked by how easy package management has become. I installed RVM, Ruby 2.1, and Rails without any hassle. The installation was not fast, but I believe this is because I was compiling source on my wimpy RaspberryPi. As RVM said:

this may take a while depending on your cpu(s)...