rubocop and rufo

I’ve been writing in the Ruby language since sometime in 2002, but if I was looking for a job, I don’t know enough to call myself a ruby programmer. I don’t know rails or anything of the other cool things people do with ruby. I’ve learned to use gems, but haven’t bothered to learn how to write them myself.

But I’m not opposed to learning. I just haven’t gotten around to it yet.

Or so I thought. Then I ran into rubocop, which is a sort of linter and style cop. Those can be helpful, so I thought I’d give it a try. And it’s mostly good. Except it’s opinionated, and some of their opinions are wrong. For example:

  • the indentation should be four spaces, not two as they suggest
  • parallel assignment is the bomb, despite what they say
  • I use double quotes (") pretty much everywhere I’m not forced to use single quotes ('). They want to save time for the compiler, I guess.
  • You need space inside parentheses (although I will grant the extra whitespace is less important with syntax highlighting than without it).
  • And if I’m declaring a RE that’s so complicated I’m using /x flag, then don’t tell me to use /.../ instead of %r<...>.
  • And speaking of which, go ahead and use $1 and $' when retrieving the results of an RE match. (In moderation.) Honestly, this is a tie. Go ahead and use named groups if you want to.

But you can’t fight city hall. If some younglings want to make Ruby over in the style of Python, well, that’s a crying shame. Ruby is supposed to occupy the perfect spot between Perl and Python. But these kids today! If they’re on your lawn, you might as well go along with their misguided project. And that brings us to rufo, the ruby reformatter. You can use it to do like 10% of the things that rubocop whinges about.

Spiderman Far From Home

I just saw it. It’s the best superhero movie I’ve seen in years, probably since Wonder Woman. The third act was only okay, but even so, it was significantly better than Avengers Endgame or Infinity War, Thor Ragnarok, or Guardians of the Galaxy 2. The mid credit scene detracted from this movie, at least for me, although my companion thought it was an enhancement.

Xcode and Bandwidth Caps

For a long time, I’ve been in the habit of installing Xcode on Macs, even though I wasn’t developing software. (Partly because I wasn’t sure what I needed to run Fink/MacPorts/Homebrew, and partly because I think FileMerge is pretty sweet, even if it’s the last thing on this list of features.) But lately, the typical Xcode update is like 7 GB, and I just don’t need it. 

7.6 GB worth of awesomeness. :-/

So I wanted to know how to get rid of these monstrous downloads. And I found out. First, you get rid of Xcode. But that’s only step one:

$ cc
xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
Use sudo xcode-select --switch path/to/Xcode.app to specify the Xcode that you wish to use for command line developer tools, or use xcode-select --install to install the standalone command line developer tools.
See man xcode-select for more details.

So, next, you have to get rid of the command line tools and reinstall them:

$ rm -rf /Library/Developer/CommandLineTools

$ xcode-select --install

UPDATE: When that doesn’t work, you read further down that page and find the correct answer:

$ sudo xcode-select -s /Library/Developer/CommandLineTools

Setting Up a Mac

Fixing mouse scroll direction, key bindings, setting up Exposé spaces, etc.

Installing Keynote, Numbers, and Pages plus any software previously purchased from the App Store.

Installing replacement browsers: Chrome, Firefox, and Brave, along with Xee and iTerm2 and Skim.

Installing MacPorts, then software starting with ImageMagick. Imagemagick because it’s a good test of everything working properly.

$ sudo port install imagemagick +graphviz -x11

Then adding some of my favorite utilities

$ sudo port install antiword bat colordiff exiftool jhead lame sox tree xz

$ sudo port install ffmpeg -x11

$ sudo port install nnn ranger

Then install software development languages: go, rust, and ruby. Follow them with some CLI utilities written in those languages:

$ cargo install broot cw du-dust dutree exa fd hexyl \
just lsd pastel ripgrep sd

$ go get -u github.com/gokcehan/lf

Another Old Computer

I picked up a new old computer. This one’s a Macbook Pro: the 17in model from early 2011. It’s pretty sweet.

The first screen I saw after logging in
About this Mac after upgrading to the last supported MacOSX.

It’s a behemoth. I can see how the modern Apple could never ship monsters like this. But it’s got a good, big screen and the HD is tolerably easy to upgrade.

And don’t overlook that super-useful ExpressCard/34 port, okay?

More of those CLI Utilities

I’ve found some more CLI utilities (via this thread) that look like they’re worth further investigation.

  • Zola, a static site generator
  • fd (a/k/a fd-find), an “80% replacement” for find; see also fselect
  • xsv, a tool for working with CSV files
  • broot, another disk analysis/tree replacement
  • sd, a sed replacement
  • cw, a wc replacement
  • hors, a combination of lynx and the technical web (which I couldn’t build on my Linux system because it’s running gcc instead of clang). (Ditto ‘bat’ btw.)
  • lolcate, a locate/updatedb replacement

I’m intrigued by topgrade but a little terrified of actually using it.

And I found the indispensable utility called genact.

Rust Command-Line Utilities

I’ve been learning (or maybe beginning to learn) the Rust programming language. (It was a toss-up between that and Go, and I probably picked wrong, but I won’t know until I know a lot more than I do now.)

  • Tokei (for counting source code lines) and
  • diffr as an alternative to colordiff
  • ripgrep as an alternative to ack (etc.)
  • just as a command runner (think “make”)
  • lsd and exa as replacements for ls
  • pastel for working with colors on the command line
  • skim (not to be confused with the excellent Skim) as a fuzzy finder
  • dust, dutree, and dua-cli as replacements for du
  • bat (“better cat”) and mdcat (cat for markdown)
  • starship (prompt)

I’m only beginning to play with these. But I was surprised to see so much activity developing command line utilities. There is some misunderstanding of the Unix philosophy, but it’s understandable (cat isn’t for viewing files, but of course that’s how most of us use it). Yay open source!

Duplicate Files

I’ve been hoarding data for more than 20 years. For backups, I used to burn a CD periodically, but I long since ran over those limits. Today, my backups are hard drives. One reason is that I’ve moved between computers several times during that period, and when I do, I find stuff I don’t know what to do with. So I copy all that data into a new folder, typically called something like temp/backup/that-system-name/tmp/old/save/keep/t.files/save.d.

After 20 years, that starts to add up. So I’ve been looking at programs to help me find and get rid of duplicates. (I’ve been using rsync -n, and occasionally diff -qr, to compare folders. But the problem is deciding what folders, at what places in the directory structure, to compare.)

So I’ve been looking to see what kind of tools are available to help. At this point, I looked at duff, jdupes, and dupd.

So far, I’ve focused on dupd. It does what I was thinking needed to be done: crawl the entire hierarchy and save the result as a database.