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.
I'm looking into this very thing -- using .htaccess
to force trailing slashes at the end of URLs requested on the Apache web server.
Stack Overflow may have the answer:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)([^/])$ /$1/ [L,R=301]
The
RewriteCond
will check to make sure there's no files with that name, and if not, perform theRewriteRule
. More future-proof than having a manual list of extensions!
I don't have time right now to hack this onto a server, but I will for sure be giving it a try.
Rubyguides.com does a great job presenting all the things you can do with strings in Ruby.
I have a situation where I want all of the directories in my project to have 755 permissions while all files have 644 permissions.
All of the files have the same extension, so it's easy to single them out:
$ chmod 644 *.txt
But what do you do for directories? I did a search, and a Linux Questions thread gave me the answer:
$ find . -type d -exec chmod 755 {} \;
Works like butter.
Two very helpful (and very readable) articles by Ricardo J. Méndez of Numergent. I will be watching for future articles in what I hope will be a series.
I have been experimenting with the Twitter API and using dlvr.it and IFTTT less (ironically because this post will Tweet via IFTTT). My purposefully social posts use a script and the API.
My systems and scripts are all focused on publishing content to my sites. Mirroring them on social media, currently Twitter, is optional and can be modified or pulled altogether at any time.
I'm doing my Linux due diligence by trying out Ubuntu 17.10 now that Canonical has issued new ISOs that won't brick a BIOS. That's a bit of nasty business, to be sure, but it's not enough to put me off of Ubuntu for good.
It's unfortunate that Canonical/Ubuntu made the kind of mistake that would brick a computer, and I can't see Fedora doing this kind of thing, even though the Red Hat-sponsored distro is closer to the bleeding edge.
Not coincidentally I just tried Fedora 27, and I liked it. I don't see much different in Ubuntu 17.10. Both distros use GNOME 3, feature Firefox as their default browser (good because since FF 57/Quantum, it's also my default browser) and offer the LibreOffice suite.
Sure there are major differences in package management (dnf vs. apt) and firewall (firewalld vs ufw), but it's still more similar than different.
The distros both look fairly similar on my 1920x1080 screen, and the fonts seem about the same in both, though Ubuntu features its own font in places where Fedora offers Cantarell. Both are interchangeable, so it's horses for courses, as they say.
The GNOME-ified Ubuntu made its debut in 17.10, so there will be no GNOME-powered Ubuntu LTS until 18.04 (which, now that I look at the calendar, is due in 4/2018, which is only a few months from now).
Until Ubuntu dropped GNOME 2 for Unity back in 11.04, all of the "top" distros shipped GNOME as a default. By that I mean Debian, Ubuntu, Fedora, Red Hat/CentOS and Suse. So there was a great deal of uniformity that made the distro "wars" seem kind of stupid since the desktop is such a major part of a user's experience, and every major distro pretty much offered all of the major desktops (GNOME, KDE, Xfce, Cinnamon, Mate, LXDE). It was notable that only Ubuntu shipped (or even offered) Unity (to the best of my not-comprehensive knowledge).
Now that Unity is dead and Ubuntu is back to GNOME, I hope that there will be more emphasis placed on not just tweaking GNOME but actually developing it to have more of what "power" users want (like actual knobs, levers and buttons to tweak to get the behavior we want).
Hey, as I write this in the Ubuntu 17.10 live environment, my screen keeps momentarily turning upside down and blanking for a moment. This is on an HP Envy with an Intel i7 processor. Hmm. Hopefully that's a byproduct of the live session and not something that will persist in a full installation. I hope not. I didn't experience that behavior in Fedora 27 or Debian 9.3.
To sum up, I'd say that Ubuntu 17.10 and Fedora 27 are more similar than different, with six-month upgrade cycles unless you opt for the Ubuntu LTS in a few months' time. Both are much more "polished" than stock Debian, with less setup pain, though probably more maintenance pain, as Debian Stable is exactly what the second word in its name says it is.
It all comes down to how new you want your packages to be. This really only matters (to me) for the purposes of software development. I think you can either run Fedora, or Ubuntu (possibly the latter with PPAs), and have things be acceptably new. If you need a newer stack, you'll probably be managing it outside of distro package management anyway, so it all comes down to personal preference and what works.
How to get a free static website with SSL from Gitlab https://rolodato.com/2018/01/14/static-websites-for-hackers.html
You don't have to use Jekyll. Gitlab provides a list of a bunch of other static-site-generators it supports, including Middleman, Octopress (which is really just Jekyll with extras), Hexo, Metalsmith, Hugo, Pelican and Nikola.
I have a couple of points in my BlogPoster Ruby script where an error can cause the program to end, and I have been at odds as to how to deal with it.
I had been looking at the various Ruby Gems that I am using for tips on how they might handle errors more gracefully and didn't gain any insight.
Turns out I was looking in the wrong place.
Today I took a few minutes to search for how Ruby handles errors and exceptions, and I found the begin ... rescue ... else
methods. The Bastards Book of Ruby explains them very well.
I quickly wrote this little program to make sure it worked (it does). Though I'm in the middle of a method-based rewrite of the BlogPoster program, I might hack this into the old script to see if I can keep the program from stopping when the Nokogiri
and Twitter
Gems encounter problems (the former with unresolvable URLs, the latter with connectivity issues).
Here is my "test" of `begin ... rescue ... else:
#!/usr/bin/env ruby
# Handling potential errors in Ruby with begin/rescue/else
# The 'error' here is trying to divide by zero.
begin
1/0
rescue
puts "The expression 1/0 doesn\'t work"
else
puts "The expression 1/0 does work"
end
begin
1/1
rescue
puts "The expression 1/1 doesn\'t work"
else
puts "The expression 1/1 does work"
end
# Expected output:
#
# The expression 1/0 doesn't work
# The expression 1/1 does work
Update: I tried this with "real" code, and it works!
I just booted into a Fedora 27 live system on my HP Envy laptop with an HD screen, and already the fonts in Firefox look better than stock Debian, which is to be expected.
Just like with Debian, I'm astounded that everything works in Linux out of the box. This laptop is about nine months old, and I have been avoiding running Linux for that whole time, choosing to explore Windows 10 (which is not bad at all, in case you were wondering).
I'm very happy that Fedora (which I ran for pretty much the entire "run" of my old HP Pavilion g6 laptop, which is running F27 as we speak) is so good on what, for me is new hardware.
The improvement in font rendering on this HD screen (1920x1080) is enough for me to say that I could definitely make the switch from Windows 10 to Fedora. I'm not ready just yet, but it looks like I am able.
Maybe it's the new laptop talking, but GNOME 3 looks more polished and usable than ever. The first thing I did in the live environment (after pumping up my Firefox magnification to 140%) was installing GNOME Tweak Tool and changing to the Adiwata Dark Theme.
True for both Debian and Fedora: The laptop is running very cool, too.
Next up: A test of the new non-BIOS-bricking Ubuntu 17.10, where I hope the GNOME 3 experience will also be a good one.