Title photo
frugal technology, simple living and guerrilla large-appliance repair

Regular blog here, 'microblog' there

Many of my traditional blog post live on this site, but a great majority of my social-style posts can be found on my much-busier microbloging site at updates.passthejoe.net. It's busier because my BlogPoster "microblogging" script generates short, Twitter-style posts from the Linux or Windows (or anywhere you can run Ruby with too many Gems) command line, uploads them to the web server and send them out on my Twitter and Mastodon feeds.

I used to post to this blog via scripts and Unix/Linux utilities (curl and Unison) that helped me mirror the files locally and on the server. Since this site recently moved hosts, none of that is set up. I'm just using SFTP and SSH to write posts and manage the site.

Disqus comments are not live just yet because I'm not sure about what I'm going to do for the domain on this site. I'll probably restore the old domain at first just to have some continuity, but for now I like using the "free" domain from this site's new host, NearlyFreeSpeech.net.

Tue, 07 Nov 2017

Squarespace can be your online store and website

When Dan Benjamin mentioned that his Unwound watch podcast co-host Seth Roberts' website for his Hub City Vintage business is now running on Squarespace, a bell went off for me.

Not that there's anything wrong with Shopify, but it's nice to know that there's an alternative for the small (or maybe not-so-small) business to both have a website and offer fully integrated e-commerce for a reasonable monthly fee and without a lot of development cost and hassles.

Many say Shopify is a better choice, but if you want to keep it simple, Squarespace is a viable option.

Sat, 04 Nov 2017

Top 8 Van Halen songs

The top 8 Van Halen songs:

  1. (tie) Runnin' With the Devil
  2. (tie) Jump
  3. You Really Got Me
  4. Ain't Talking 'Bout Love
  5. Panama
  6. Dance the Night Away
  7. Hot for Teacher
  8. Beautiful Girls
Mon, 30 Oct 2017

IFTTT should send this post

This is not part of the /updates directory, and IFTTT should send it to Twitter.

Wed, 25 Oct 2017

Automatic social posts - the last mile

The last piece missing from the Blog Poster app is the ability to post directly to Twitter and eliminate the dependency on third-party services like dlvr.it and IFTTT. Shouldn't be too hard.

Expanding the Blog Poster app to allow for different target directories

I just coded a small feature for the Blog Poster app (a Ruby script) that allows the user to choose between two different directories when posting a "raw" update that isn't meant for the /updates/ directory that IFTTT taps for explicit social posts (using the body text instead of the title for the post). When making a "raw" post, the user can now choose the /now directory for timely posts that would be better with the traditional title-and-link style social posting that "normal" blog entries usually get when fed to social media accounts.

Mon, 23 Oct 2017

The Ruby Terminal Apps Toolkit could solve many problems

I'm not quite sure how I stumbled upon the Ruby Terminal Apps Toolkit, but the gems included can definitely speed your development of interactive Ruby apps on the command line.

I just coded a menu for my app, and these gems by Piotr Murach offer a lot of ways to do this easily and to solicit and process user input.

The next thing I'm looking at doing in my app is allowing users to open lines for editing in their text editor of choice, and these TTY gems definitely do that. I wasn't thinking that shelling out to an editor would be so hard (meaning that was something that Ruby can do with no gems), but maybe this is a better (or easier) way.

The "hard" part in allowing user editing in my app is that I am assembling files to upload from a series of variables, and I think I'll have to create temporary files for editing that only include the component being modified (i.e. title, text, link, filename) because my app knows how to turn variables into a file but not a file into a series of variables, though that is something I could code into it. (But I may not do this because I am thinking of going in another direction and not creating actual files on the system at all and using Ruby to stream the data via FTP.)

That's more detail without context about the app I'm working on than you need.

tl;dr: The Ruby Terminal Apps Toolkit can speed up development of command-line based apps. You can use single gems or the whole thing. It's up to you.

I got an automatic Java update in Windows

Since I installed the JDK instead of the JRE, I didn't know if automatic Java updates would come at all and would cover the development portion of the tools.

I got the update today, and as you can see from the image above of my Windows command line, all is updated.

Fri, 20 Oct 2017

My blog-posting program in Ruby

I'm actually doing it. I'm writing a blog-posting program that will take an http link, extract the remote page's title and create a social-media-style blog post (title, body text and link) that can be easily uploaded to my flat-file blogging system's server.

The idea is to make it as easy to post a "social"-style update to my own blog as it is to post to Twitter (or Facebook or Google+).

(I use IFTTT -- and formerly dlvr.it -- to post these social entries on Twitter, but I could see this program taking over that task as well.)

Back to my application. I could have gone several different ways from a conceptual standpoint.

  • I could have done this idea as a web app, but in order to get the files to upload to the blog, I'd either have to write a server component on that side, or create a backend service -- with some measure of security -- to handle the upload (I'm using FTP, but it doesn't have to be that).

  • I thought about a desktop GUI. I want this to be a true cross-platform app. I seriously considered using the now-ancient Tk framework with Ruby. I less-seriously considered Java FX, though I did successfully hack together code to upload via FTP using Java. (At least it was a worthwhile programming exercise.) I could have gone with QT. Maybe I could have done the whole thing with QML.

I'm not ruling out any of these GUI solutions, but I needed to start coding, and the easiest, quickest thing for me to do (or so I thought) is a menu-driven console app. I could have gone with Java, JavaScript, Ruby, even Perl. I did tests of various components in three of those languages.

I'm writing the app for the console with an eye toward re-using the code in a future GUI app, and for that reason maybe I should have used JavaScript.

But I really wanted to use Ruby. I'm trying to grasp object-orientated programming, and there is a whole lot of web-based help for Ruby programmers that often acknowledges that there are beginners out there who need a helping hand.

And I really would love to eventually port this code to Tk, or even as a Sinatra or Rails app. I should want to do it in JavaScript. But Ruby is so friendly, and it's made for use in the console.

So I'm writing it in Ruby. And I have some 190 lines of code that do the following:

  • Display a menu of tasks and wait for input
  • When a URL is entered, grab the HTML title
  • Create a simple document with a title and text derived from the remote HTML title
  • Add a Markdown-formatted link back to the original HTML page
  • Save all as a text file with an auto-generated file name incorporating the current date and text derived from the title
  • Allow user to enter different text for the title or body
  • Let user choose not to include the source site's URL
  • Save all to a text file
  • Upload to website via FTP and "tell" blog to index the new entry

I have all of these features working, and while the app is very far from perfect, it is functional. The code isn't ready for public consumption -- it needs lots of cleanup before I publish it, and it's really meant more for Ode users and blogs that work in a similar way (files are uploaded to a server, from which the blog software renders them for the reader) than it is for flat-file systems such as Hugo, where a dedicated program builds the blog locally and sends files on their way, but the concepts and code used in this app can certainly be modified for that workflow -- and I'm not at all above doing that in the future.

Aside from adding more features, primarily the ability to edit elements instead of re-typing them (maybe by invoking the vi editor), I want to make the code more modular. Right how it's a huge procedural hack, and modularity (and object orientation) will make it cleaner and more flexible. That's the idea anyway.

Before that I need to clean up the configuration, which is all over the place.

Still, I wanted to make an app, I used the skills I had (and Googled and read plenty), and now I have something that works, however ugly it may look on the back end.

Fri, 13 Oct 2017

How to back up your /home directory in the Windows Subsystem for Linux without losing permissions before killing your old WSL and installing a new one from the Windows Store

The Windows Subsystem for Linux - which is no longer being referred to officially as "Bash on Windows" - has grown up.

You no longer need to put your Windows 10 system into Developer Mode to use the WSL.

And now there are three different WSLs: Ubuntu, openSUSE and SUSE Linux Enterprise Server. Fedora is supposed to be on the way, but I haven't heard anything about progress toward that happening in a long time.

According to Microsoft, you can copy your current Ubuntu files to /mnt/c/tmp/WSL-backup, or a similar directory, and then use lxrun /install from the Windows command line to remove the old WSL. Then you can install a new WSL and move your files back after that.

Fellow Redditors suggested that I create a tar archive of my files, stow it anywhere, and then unpack it in my new /home directory when I remove the old WSL and install the new one via the Windows Store.

The only thing keeping me from doing it is what always keeps me from switching Linux distros: The need to re-install all of my packages.

The other thing keeping me from making this move is that my laptop hasn't yet received the Windows 10 Fall Creators Update. To successfully install the new WSL, your Windows build needs to be 16215.0 or higher. According to my About Windows 10 page, I'm on 15063.674. So not only can I wait, unless I opt to get the updates early (and I'm sure there is a way to do this), I must wait. And honestly, that doesn't bother me one bit.

Update: (July 4, 2018): Here is my Independence Day update to these instructions. The "original" instructions should work fine, but the "new" ones are better:

The original instructions

Originally I created the tar archive of my home directory in my home directory:

$ tar -zcvf steven.tar.gz /home/steven
$ cp steven.tar.gz /mnt/c/Users/steve/OneDrive/Documents/linux_backup/

And to open it up when your new WSL is set up, go to your home directory:

$ tar -zxvf /path/to/steven.tar.gz

Then you'll have a home directory within your home directory (i.e. for me /home/steven/steven, and you can copy what you want from one to the other). It's better not to overwrite everything in your "new" Linux /home directory because it might handle things in your dot files differently, and I can see conflicts arising from npm modules, ruby gems and whatever else you happened to install in the course of working in your Windows box's Linux side.

I'm not sure how much of a problem it is, but creating the tar archive while in your home directory causes tar to throw the following error:

tar: Removing leading `/' from member names
... (lots of output)
tar: Exiting with failure status due to previous errors

There are explanations of what this error message means on the Internet, but they didn't really help me understand it.

So I did things a different way. If you just want to know how to make the backup and restore it, start here:

The new instructions

First, on the Windows side, create a directory in which to hold this backup. I created one called linux_backup in my OneDrive Documents directory.

Then go into your WSL, which will put you in your home directory on the Linux side (which for me is /home/steven).

From there, to avoid the error message I go up one directory and do the tar operation from there. I use pwd a couple of times to confirm where I am in the filesystem, and I use chown to make sure the restored archive belongs to my Linux user and group.

Note: in all of these instructions, things after a $ are things you type at the command line. Lines that don't begin with a $ represent output in the terminal (and you don't have to type them).

Here is what my terminal session looks like:

$ pwd
/home/steven
$ cd ..
$ pwd
/home
$ sudo tar -zcvf steven.tar.gz steven
$ ls
steven steven.tar.gz
$ chown steven:steven steven.tar.gz
$ sudo cp steven.tar.gz /mnt/c/Users/steve/OneDrive/Documents/linux_backup/

Now you have your tar archive on the Windows side.

After you set up your "new" WSL, you can copy the tar archive from the Windows side into your new Linux /home directory. As before, I use a couple of pwd command to confirm where I am in the Linux filesystem. (And remember, use YOUR home directory and Windows path to your tar archive, not mine):

$ pwd
/home/steven
$ sudo cp /mnt/c/Users/steve/OneDrive/Documents/linux_backup/steven.tar.gz steven.tar.gz
$ sudo chown steven:steven steven.tar.gz
$ tar -zxvf steven.tar.gz
$ ls
steven
$ cd steven
$ pwd
/home/steven/steven

Now you have your "new" home directory at /home/steven, and your "old" files at /home/steven/steven. Copy what you want from old to new, and you should be ready to go.

Once you confirm that all your files are in there, you can blow away the old WSL and use your new one. And you should still have a copy of the tar archive on your Windows filesystem if anything goes wrong.

Before going forward, it's a good idea to read up on how to make a tar.gz archive.

My question (and maybe yours): Why do this from the Ubuntu/WSL shell when you could just copy/paste from the Windows file manager, or why not just copy the files via the Ubuntu shell to the Windows portion of the disk?

Answer (and I did test this): In both cases, even when using Bash to do the recursive cp of all the files, you lose your Linux file permissions. In my case, all of my rw-r--r-- files turned into rwxrwxrwx, which is NOT what you (or I) want.

Update on 4/23/18: This entry was written last October but not published until now. It kind of got lost, and I just found and finished it. Though the new WSL is out, and you can now install Debian (which I would) or SUSE (probably not), I'm leaning toward sticking with Ubuntu because it's working so well, though I'm a longtime Debian fan and user (though not so much lately).

Whatever I do, I probably need to move to the "new" WSL, though I haven't done it yet. Everything is working, so it's hard to muster the motivation to mess with what until now has been a successful installation of Ubuntu in Windows 10.

Update on 7/4/18: The new instructions for making an archive of the /home directory are more detailed and a little more roundabout. But they should work, and tar won't throw any errors.

Also, I still haven't moved to a new WSL. The current Ubuntu WSL is still on 16.04 LTS, and that's the same version as my "old" WSL. When the Ubuntu WSL moves to 18.04 LTS, then it'll be time to make the change.

Sun, 24 Sep 2017

I'm thinking about OpenBSD again

I received an email recently from Ewa Dudzic of BSD Magazine asking to interview me. I demurred because I'm barely using Linux right now, let alone a BSD. My "intense" BSD period was around 2008-09 when I had a laptop that wouldn't boot from CD, and OpenBSD's floppy image (you heard right) allowed me to get it up and running.

I blogged a lot about it. I had a lot of fun with OpenBSD, and I tried a couple of others with endings both catastrophic (FreeBSD, where updates puzzled me and broke the system) and anticlimactic (DragonFlyBSD, where too many applications didn't work).

I've done a few sporadic OpenBSD tests since then, but circumstances at both my work (needing Citrix) and personally (not so interested in operating systems or free software as a movement, seeing overall interest in free software wane considerably since Windows 7 came out, and my growing interest in programming) led me to the point where I was running Fedora on my "old" laptop and Windows 10 with the Windows Subsystem for Linux on my "new" laptop.

I'm still very much involved in programming, using Ruby, Java, the Bash shell and a little bit of Perl.

And in my day job, I can mostly leave my Citrix-delivered system behind in favor of a whole lot of WordPress.

And -- yes there is another and -- these days I mostly use an old Roku (with USB input) for video, so my laptops don't double as entertainment machines.

Could I set up my old laptop as a development machine using OpenBSD?

The one difference in favor of this is the JDK being available as a package. Installing the Java Development Kit back in 2009 was far from easy. I can't remember if I was even able to do it.

Adding Ruby and Node seem easy. Will Ruby gems and npm packages work? That's something I'll have to investigate as I go.

Whenever I look at the OpenBSD website, documentation and, more importantly, extensive list of available packages, I get hopeful about the system working for me.

I'm not afraid of a little maintenance, and the new syspatch utility promises to make updating the base system quicker and easier than ever before. Being OK with the same non-base packages for six months is potentially unsettling, but for a sane system that just works (just works is very, very important to me these days), I could be OK with it. What I don't want is problem after problem after problem with basic functionality (display, WiFi, sound, CPU heat, suspend/resume). I'm cautiously ... cautious.

I have learned that there are OpenBSD communities on Reddit and Facebook and probably in other places (obviously including openbsd.misc).

I've already started collecting links (mined from Reddit) to help me get an OpenBSD system installed and configured:

Since my old laptop (HP Pavilion g6 from 2010) has easily swappable drives, I can put test OSes on their own drive and not worry about partitioning or blowing out a production system.

I just got an OpenBSD 6.1 image on a USB drive using Win32 Disk Imager in Windows 10, and I'm ready to do the installation.

So am I a good candidate for a BSD-focused interview? I'm not an OS developer, or a serious sysadmin. (I do play at being a sysadmin, don't get me wrong. I run a CentOS system on the live Web, though I do have help when the going gets tough.)

I'm just a user, but I have blogged plenty about what I do with the software I use, and that's not as common as you'd think (and seeming to be out there alone did push me away from my steadfast commitment to open-source operating systems). So the answer is "maybe," and maybe in the days ahead I'll have something to say about OpenBSD in the late 2010s.

Updates (newest first):

  • I have done two OpenBSD 6.1 installations on my HP Pavilion g6. The internal Atheros WiFi doesn't work, so I'm using the wired network and an old Realtek-based USB WiFi stick. I blew up the first installation, and now I'm working on the second. I still can't believe that it's so easy to get the JDK installed and running (add the package, add the path to the JDK binaries -- /usr/local/jre-1.8.0/bin -- to your path in .profile ... and that's it).