Skew-T Meteorologist in Kansas City

Filed under Tech

fzf, ripgrep, git grep

Recent work has found me searching through large directory structures for files with sometimes less than obvious names. grep -r had become a go-to but it's not particularly speedy. Seeing a mention or two on Twitter led me to ripgrep which is specifically designed for such recursive file content searches. It also handily ignores files specified by gitignore and hidden files by default. Discovering ripgrep reminded me I had forgotten all about git grep which also allows for recursive searches, taking advantage of the git index, for files already in a repo.

fzf is a fuzzy finder, presenting an interactive way to search lists like filenames and git commits. Setting up aliases add useful interactivity to common tools, enabling quick full searching at the prompt in addition to the usual tab completion. As an example, searching recursively for a file, presenting a list of matches, and opening the selected in vim, bypassing the list if just one match.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
fe() {
  local IFS=$'\n'
  local files=()
  files=(
    "$(rg --files | fzf-tmux \
          --query="$1" \
          --multi \
          --select-1 \
          --exit-0
    )"
  ) || return
  "${EDITOR:-vim}" "${files[@]}"
}

Home Theater API

Taking advantage of a Black Friday sale, I upgraded my living room home theater with a new Onkyo receiver. I purchased my previous receiver, also an Onkyo, in grad school and it has served me well. It was lacking in some modern features, being connected entirely analog and required speaker wire pass-through to drive the subwoofer that was added to the setup a couple of years ago. The new unit features several HDMI inputs, HDMI-ARC output, and networked services like Spotify and Chromecast. Connected via wifi there is a phone app that can control most features.

Onkyo TX-NR676
Onkyo TX-NR676

Many such consumer devices rely on purely cloud based services so it was great to discover the API allows control over the local network. I'm only just starting to explore. There is a great Python module for accessing the API including device discovery, onkyo-eiscp. An MQTT bridge, onkyo2mqtt, is promising, able to transmit messages upon device actions like volume adjustment. The former also offers a straightforward command line tool:

onkyo --host x.x.x.x audio-muting=on

Discovering this ability to adjust audio remotely, it was nice to find pychromecast allows some measure of control over the diminutive media players. Apparently the Chrome dev tools can help determine app specific commands.

Late 2017 Desktop Build

Motherboard
Motherboard

I have increasingly taken advantage of hardware-assisted virtualization using KVM in Debian to run headless server applications. Using a desktop workstation for this task is less than ideal, taking resources away from graphical applications and incurring disruptions like occasional reboots. It hasn't quite been two years since building my last desktop machine and the experience gained made it quick to get a new box together.

Running the latest 8th gen Intel Core i5, I downsized certain areas like moving to a Micro ATX and installing just 16 GB of RAM while keeping the same NVidia graphics card. The old, larger machine has now been repurposed as a full time server residing in the basement and it should soon take responsibility for running Plex and MySQL away from the lightly specced standalone Synology NAS.

Specifications:

  • Fractal Design Define Mini C
  • Intel Core i5-8600K
  • 16 GB DD4 3200 memory
  • 500 GB Samsung EVO 960 M.2 SSD
  • ASUS RoG Z370-G motherboard
  • SeaSonic 520W 80 Plus Bronze

Termux

Screenshot of Termux
Screenshot of Termux

Termux is an Android app that provides a terminal emulator and Debian-like Linux environment. Smartphone screens are relatively small compared to a laptop or full computer monitor but screens continue to improve making terminal use increasingly viable. My Google Pixel XL has a 5.5 inch screen running at 2560x1440, the same resolution as one of my desktop 27 inch monitors.

Vertically the terminal is restricted to 57 columns but is surprisingly usable with the on screen keyboard. Held horizontally and paired with the Logitech K380 Bluetooth keyboard, it is an excellent text terminal. Features abound, from an API exposing hardware remotely via ssh, to style support including Powerline fonts.

GPS Clock

For some time I had sought out the ideal clock for the bedroom. Like many I've switched to using my smart phone as an alarm, but I still have the need for a clock to quickly find out the current time. While I've had clock radios that worked well, it proved difficult to find the ideal combination of features. Specifically I was seeking an LED display of twenty four hour time that set itself, eliminating the need to adjust for daylight saving and making the power outages I was experiencing a non-issue. The latter feature of automatic time setting proved especially difficult, as I was living in Fairbanks, Alaska at the time, outside of the signal range of the inexpensively received WWVB atomic clock backed time signal.

Peak signal coverage estimated for WWVB time signal
Peak signal coverage estimated for WWVB time signal

Already interested in the growing microcontroller hobbyist market, I looked into what time keeping parts might be possible. I had thought of perhaps having a NTP backed Ethernet or wifi connected device but at the time few components were available offering network interfaces and they required significant work to implement. I ended up going with a GPS receiver, something more frequently used for position information. The GPS system relies on very accurate time keeping, something a small receiver can take advantage of as well. Connected to an Arduino and a large digit display through a breadboard, the clock proved a very useful project that continues to work well to this day.

GPS Clock
GPS Clock

GPS devices have improved over time and the chip in the clock I ultimately created is able to display accurate, 24 hour time within seconds after being plugged in. I never have gotten around to enclosing the device so it continues to look like a science experiment, many years after it was first put together.

Arduino powering the clock
Arduino powering the clock