Author Archives: jasonb

Quickly Sync JPG mtime with EXIF CreateDate

I borrowed a few things, made a few changes, and now all my photos have the correct timestamp on the filesystem. Hooray! The script expects to be in the root directory of the album hierarchy, but that is merely because I am lazy. And it was an excuse to learn about how to find where [...]

Opscode Chef Xtra: Obtaining network interface data

It is somewhat of a challenge to obtain interface information out of the data Ohai makes available for network interfaces. For information only about inet addresses, the following works: node_addresses = {} node[:network][:interfaces].each do |iface, vals| vals[:addresses].each do |addr, h| next unless h[’family’] == ‘inet’ && !addr.match(’127.0.0.1′) iface_data = Hash.new iface_data = h.dup iface_data[’address’] = [...]

Getting a little crazy with FileEdit

In case there is any doubt, you can go nuts with Chef::Util::FileEdit. If one is using search_file_replace, internally it is simply: new_contents << ((method == 1) ? replace : line.gsub!(exp, replace)) Meaning if need be, I can do something silly: ruby_block ‘fix remi.repo’ do action :nothing block do f = Chef::Util::FileEdit.new(’/etc/yum.repos.d/remi.repo’) f.search_file_replace(/\$releasever/, ‘%i’ % major) [...]

Opscode Chef Xtra: A Deletable Template via a Definition

While there is no delete action recognized by the Chef template resource, it is possible to fake it using a definition. For example, a definition for managing a configuration file for the multifaceted DNS server dnsmasq might look like the following: define :dnsmasq_conf, :enable => true, :template => ‘dnsmasq.conf.erb’ do include_recipe ‘dnsmasq’   conffile = [...]

Opscode Chef Xtra: Achieving Idempotence in execute Resource

The certainty of outcome offered by other Chef resources is notably lacking from the execute Resource, for Chef has no way of knowing the consequences of the provided shell script fragment. Fortunately, it’s possible to ensure idempotent behavior with the appropriate application of care. As an example, perhaps one needs to load several database dump [...]

Made the switch to Fedora 15 from Kubuntu 10.10

Finally happened. I made the switch to Fedora. I’d been a Kubuntu user since 2006, but since the switch to Pulse Audio I have had serious problems with sound under Kubuntu in 10.10, 11.04, and 11.10 beta. I have no such trouble with Fedora 15. I’ll likely be moving all systems I manage over from [...]

Chase Ink Business Card Rewards goes to Crap

For years, holders of Chase’s Business Card earned 3% cash back on meals, gas, and office supplies. No more, according to junk mail just received offering the new and improved Ink card! New card holders — and I’m sure existing holders eventually — are being subject to a new, crap reward program: Worthless rotational joke [...]

Google Docs Upload Broken in Opera 11.51

It’s been broken for at least a month, apparently. As long as it lasts, there is apparently a workaround: https://docs.google.com/?action=updoc Update, 17 June 2012. It works in Opera 12, thankfully!

Google Calendar Agenda Native PDF Generation

I am pleased to see Google Calendar now natively generates a PDF when printing out an agenda. In the past, the print version of an agenda was a clean HTML page. Now it has more colors and clean page breaks. Hooray!

Why is handling amortization so difficult to get right?

So fail boat on recording my student loan in both Gnucash and Moneydance. Years ago, I had success using Gnucash for this, but was forced to file a bug this time. Meanwhile, Moneydance has had a different issue that causes historical loans to calculate incorrect principal and interest, dating back to 2009. I cannot express [...]