Rick Cogley's Tech Logr

Short Technical Laser Bursts %%


Here be my pithy, short, technical nuggets. Maybe I’m the only one who cares. Who says Hugo can’t be used for microblogging‽

09 Jun 2020


Found a good utility called «yq», which aims to be the jq for yaml. You can easily convert json (say from a REST i/f) to yaml, and it is a dependency free single binary. Sweet! 🥳 Works really well in scripts in combination with jq or curl.

For example, this is how you would convert a json file to yaml:

yq r -P path/to/my.json

Yq read and pretty print. It just works.

RC Logr 20200609 172638 - Found a good utility called … Rick Cogley

06 Jun 2020


If you are doing any modern PHP dev on Mac, check out the Laravel ecosystem, especially «Laravel Valet». It makes things so easy, you get a myapp.test served locally. 🤩

  • Install php and composer via brew.
  • Edit your .zshrc (or equivalent) to add php and .composer/vendor/bin to your system path.
  • cd into your local PHP project.
  • Run valet link myapp and valet secure myapp.
  • Access your app via https://myapp.test.
  • Profit.

You can run Laravel Forge to connect, say, a Digital Ocean droplet to a git repo, so that when you push to master, Forge will just deploy to the server for you. So, do your dev locally via valet in a feature branch, then merge to master and Boom!

RC Logr 20200606 203447 - If you are doing any modern … Rick Cogley


I use some integrated AWS services to host some sites, including S3 for basic hosting, Cloudfront for CDN, Certificate Manager for SSL and Route 53 for DNS. Who doesn’t like automation? 🤖 A couple of notes:

  • Re ACM SSL certs, what worked well for me is to add the wildcard (*.cogley.info) as the basic cert name, and the apex as an additional name (cogley.info). Also, DNS validation is convenient because you don’t have to do anything but fail to delete the CNAME you need. If you use Route 53 it’s even better since there’s a big button that will create the CNAME for you. Once the CNAME is there, ACM will just happily renew for you. Ahhh, bask in the automation.
  • You can have multiple copies of a cert. It’s either in use or it’s not, so just get it right, then delete the ones you don’t need. Cloudfront will re-deploy within a few minutes anyway, so it’s really no big deal to make a mistake.
  • In your Cloudfront distribution edit screen, once your certificate is validated, you can just type *.mydomain... and it will show you the choices that match. There’s a UUID identifier you can get from the cert itself, which appears in the dropdown, just in case you have multiple certs that match.
  • Again in your Cloudfront distribution, make sure to choose TLS 1.2 (TLSv1.2_2018), which is the spec from 2008. At this point, so much time has passed that I think it’s safe to not pander to people with browsers from earlier than that.

RC Logr 20200606 061722 - I use some integrated AWS … Rick Cogley

05 Jun 2020


I updated MacOS to 10.15.5 yesterday via the combo updater (i.e. the non-delta updater), and my Mac was immediately crash-y, with several freezes in a row. And here I was expecting stability! 🥴

At any rate, I dug out the notes and did an NVRAM / PRAM and SMC reset. TL;DR: that fixed it. (Though admittedly it might just be voodoo-magick thinking)

NVRAM stores settings like your sound volume, display resolution or timezone. Reset it like this:

  • Shut down your Mac
  • Turn it on, while holding ⌥ + ⌘ + P + R.
  • On newer Macs (with the T2 chip) wait until the logo appears and disappears twice, then release. On older macs, wait until the second startup sound and then release.
  • Check system preferences for changed settings related to sound volume, startup disk, display resolution or time zone.

SMC or System Management Controller controls the power, fans and thermal management, battery, USB, indicators, lid opening and closing and so on. Reset it per Apple Instructions and here’s an subset example for a newish Mac notebook with a T2 chip:

  • Shut down your Mac
  • Press Left⌃ + Left⌥ + Right⇧, and the Mac turns on.
  • Hold the 3 keys for 7 sec, then hold down the power button as well. Your Mac will turn off.
  • Hold the 4 keys for another 7 sec, then release.
  • Wait 10 sec, then power on.

These took a few minutes but, I have not had a crash since I did it.

RC Logr 20200605 083345 - I updated MacOS to 10.15.5 … Rick Cogley

04 Jun 2020


When doing development on a Mac, you might discover the system is not finding something you installed via brew, and is rather defaulting to an older version included with MacOS stored in /usr/bin. 🤨 To fix, just specify the bin path of the app you installed, in your .zshrc (assuming zsh).

# use latest brew git and not the Apple one
export PATH="/usr/local/opt/git/bin:$PATH"

Prove it like this:

> which git
> /usr/local/bin/git --version
git version 2.27.0
> whereis git
> /usr/bin/git --version
git version 2.24.3 (Apple Git-128)
> git --version
git version 2.27.0


RC Logr 20200604 111524 - When doing development on a … Rick Cogley

02 Jun 2020


A friend reminded me of a great GUI utility called «balenaEtcher», which lets you flash OS images to SD cards and USB thumb drives. Etcher is way easier than using diskutil and dd, that is for sure. It just works. 🤓

Here’s what you need to do, if you want to do it manually on a Mac:

  • Insert the SD card.
  • Run diskutil list in terminal and find the identifier.
  • Unmount the disk using diskutil unmountDisk /dev/diskN where N is the correct identifier. Don’t screw it up.
  • Copy the image using sudo dd bs=1m if=/path/to/OS_image.img of=/dev/rdiskN; sync where N is the correct identifier, noting that rdisk stands for raw disk, which speeds things up. If you screw it up you can munge your main drive…
  • Eject using sudo diskutil eject /dev/rdiskN.

Too many things can (and do) go wrong, so that’s why I like balenaEtcher.

RC Logr 20200602 201003 - A friend reminded me of a … Rick Cogley

01 Jun 2020


I like the Mac utility «ImageOptim» for crunching down my image sizes, and there is a good 3rd party app called «imageoptim-cli» that facilitates batch automation and incorporates other utils as well. Sweet! 🗜

RC Logr 20200601 190658 - I like the Mac utility … Rick Cogley

13 May 2020


Learned about two cool apps by Adam Newbold at @neatnikllc - «Salty», a simple secure encryption site and «omg.lol» an email forwarder and simple web page host. 😎 Lots more on their portfolio too, check it out: https://neatnik.net/work/

RC Logr 20200513 193429 - Learned about two cool apps by … Rick Cogley

11 May 2020


If you are making DNS changes, you may want to flush your local dns responder cache, so here is how to do it. 🤖

On a modern Mac, put it in a shell function (c.f. zsh):

function flushdns (){
  echo "Flushing DNS, enter your user password if prompted:"
  sudo killall -HUP mDNSResponder
  sudo killall mDNSResponderHelper
  sudo dscacheutil -flushcache

On Windows, do this in a command prompt:

  > ipconfig /flushdns

On Linux, it can be app by app or, on Ubuntu/Debian, you can do either of:

  $ sudo systemd-resolve --flush-caches
  $ sudo /etc/init.d/dns-clean start

RC Logr 20200511 112219 - If you are making DNS changes, … Rick Cogley

10 May 2020


So Zoom acquired a beloved crypto app Keybase, and the announcement blog post is so fuzzy and laden with corporate double-speak, it feels almost certain that Zoom will sunlight the app. How unfortunate. Big windfall for @malgorithms and co, big fuck you to Keybase users. 🖕🏻

RC Logr 20200510 182623 - So Zoom acquired a beloved … Rick Cogley


Many static site generators like Hugo have a built in dev web server. If you are just building some html with css, and need a simple solution to serve the files from any folder, you have a few solutions. See a couple of options:

Node.js users can install and run http-server:

npm install -g http-server
cd /path/to/my/working/folder
http-server --help

Visit http://localhost:8080 and look at the help to change the port.

Python 3 users can run:

python -m http.server 8080

Or with php:

php -S localhost:8080

Then if you use zsh put it in a function in your ~/.zshrc:

function serve-it (){
  php -S localhost:8080

RC Logr 20200510 174559 - Many static site generators … Rick Cogley


An rsync command I was using in a git hook was giving an error regarding permissions not getting copied properly. I was copying to keybase kbfs, so it makes sense that it differs from standard Mac permissions. I fixed it by changing -a to -rlOtcv. 👍

In .git/hooks/pre-hooks:

rsync -rlOtcv  --exclude '.git' /Users/myuser/dev/myuser.keybase.pub/ "/Volumes/Keybase (myuser)/public/myuser/"
exit 0

RC Logr 20200510 173730 - An rsync command I was using … Rick Cogley


Twurl uses ruby and broke, so I switched to CLI tweeting via a little golang utility called «twty». 🤓

One of golang’s main ideas is to allow apps to be installed easily on any platform, without needing to hassle with dependencies (Ruby, Python, I’m looking at you here). It’s lovely. Assuming you have golang setup, you just do:

$ go get github.com/mattn/twty

… and boom.

RC Logr 20200510 062445 - Twurl uses ruby and broke, so … Rick Cogley

03 May 2020

🗓 "Constitution Day" in Japan


There’s a cool blocks-based editor project called «editor.js» that outputs clean json, which is predictable when integrating with other systems (similar to how Notion’s editor works). I was wondering if there is a list of sites that use it, or a showcase of some kind, and learned that I can view a list of repositories that use it, via the Github “dependency graph”. Slick! 😎

RC Logr 20200503 182144 - There’s a cool … Rick Cogley

28 Apr 2020


Today I upgraded a Drupal site with drush, a convenient cli utility for Drupal, but managed to munge the site up. Fortunately I followed the usual steps, and used ./bin/drush archive-dump to back up prior to upgrading. It gives you a “Backups were saved into /path/to/backups/2020…” message, telling you where the backups were saved. This is my usual procedure:

cd /path/to/drupal/site
./bin/drush archive-dump
./bin/drush ups
./bin/drush sset system.maintenance_mode 1
./bin/drush cr
./bin/drush up drupal
./bin/drush up bootstrap //(etc, for instance)
./bin/drush sset system.maintenance_mode 0
./bin/drush cr

The problem was, I upgraded to the latest without checking my php version, and the drush up failed with some weird error that some helpful soul posted about on Stack Overflow. Since upgrading php to 7.7 from my lowly 5.x is fairly involved, I just compared and restored the backup core files to the production site folder, and did:

./bin/drush cr
./bin/drush sset system.maintenance_mode 0
./bin/drush cr

That fixed it.

RC Logr 20200428 201445 - Today I upgraded a Drupal site … Rick Cogley

12 Apr 2020


Everyone is saying stay 2 meters apart and I mentioned this in a previous post, but research showed that COVID-19 virus can travel up to 4.5 meters. That’s something important to keep in mind.

So, correcting my earlier post, that’s one wavelength apart at 75 Mhz! Joking aside, that’s terrifying.

RC Logr 20200412 095433 - Everyone is saying stay 2 … Rick Cogley

29 Mar 2020


A geeky-funny Ham radio take on the idea of social distancing in this image from Twitter user @ai6yrham. 😂


λ = 300 / 𝑓 (in MHz)

Wavelength is c/𝑓 where c is the speed of light at 300,000,000 meters per second, so 300/144 ≅ 2 -ish. So stay 2m apart and stay safe, people.

RC Logr 20200329 154842 - A geeky-funny Ham radio take … Rick Cogley

20 Mar 2020

🗓 "Vernal Equinox Day" in Japan


We are not quarantined in Japan (yet), but here is an idea to squelch the boredom: get a radio that can pick up shortwave, and do some BCL or broadcast listening. Last night I heard Beijing news on «Peking Hoso 7220 Khz on 41mb» in Japanese, talking about Coronoavirus and newborn pandas! 🐼

I have a Tecsun S-8800 which is a well-regarded portable radio that will take external antennas if you want them, can receive FM, MW (AM), SW, LW. Tecsun makes the AN-200, an external AM antenna which you can connect with a stereo connector if your radio has an input for that, or (in the case of the S-8000) you just set behind the radio and tune via its knob. It’s pretty amazing and works to improve the sound of AM stations.

Other stuff I learned:

  • Some AM stations are also using “wide band” FM to transmit, so you get a much better sound.
  • There are tons of SW stations to check out, and shortwave will bounce off the ionosphere so you can hear it from far away (unlike FM or AM which seem to be regional). I heard a wide array of stations while surfing the SW stations, which were transmitting at night from Korea, China, Taiwan. A lot of news-sounding broadcasts, including Chinese lessons for foreigners on 7324 Khz.
  • SW’s hard to censor apparently, so a lot of people use it to transmit non-fake news from their countries.
  • Japan has news transmitted on SW out of various countries in Asia, in Japanese.
  • SW stations don’t transmit 24x7, and the Short-Wave.info site is easy to use to find what’s transmitting right now, and in addition has good basic info about this whole kaboodle.
  • If your radio or its remote can accept direct frequency input, you can input the station’s frequency instead of turning a dial again and again. Apparently SW radios have a main tuner knob that gets you to the main frequency area, then you use a fine tuning knob to clean up the signal.

RC Logr 20200320 114100 - We are not quarantined in … Rick Cogley

17 Mar 2020


I just love webhook.site. Simon Fredsted @fredsted has done such a great job on it, and the paid flavor is especially useful. 🤖🦾

It lets you set up a unique URL for receiving http actions POST, GET etc, and has a scripting language with which you can manipulate the inbound payload and take actions, parsing out json or xml. Really good stuff.

RC Logr 20200317 094234 - I just love webhook.site. … Rick Cogley


A little .gitignore tip: you can use regex to cover cases where reports you do not want in your repo have a date stamp. Nifty. 😎

# Diagnostic reports (https://nodejs.org/api/report.html)

RC Logr 20200317 092838 - A little .gitignore tip: you … Rick Cogley