Rick Cogley's Tech Logr

Short Technical Laser Bursts %%


Rick’s short, technical tip microblog built with Hugo, powered by Deno Deploy. See also my fabulous repository at Github for this site.

21 Jul 2020


If you like Sudoku, you might also like «Hexologic», by Mythic Owl. ⬡

六角論理 in Japanese.

RC Logr 20200721 085228 - If you like Sudoku, you might … Rick Cogley

20 Jul 2020


«Zsh for Humans» (z4h by @romkatv on GitHub) is a configuration for z-shell that just works and works well. It has a killer ssh wrapper feature, that lets you auto-push your zsh environment up to a remote server, and is pre-configured with the most useful stuff. So sweet. 😎

That is not to even mention the awesome prompt it includes: powerlevel10k.

Use the ssh wrapper like this:

% z4h ssh myuser@thehost.com

If you are on MacOS, be sure to tweak some settings in your term so the bindings work as expected:

  • iTerm2:
    • iTerm, Prefs, Profiles (select your profile), Keys, then…
    • Right/Left option key: Esc+
  • Kitty:
    • in the config file: macos_option_as_alt yes

Now you can enter a command like history and before hitting Enter, press Alt-H to show help for that command.

RC Logr 20200720 211227 - «Zsh for Humans» (z4h by … Rick Cogley

19 Jul 2020


Today I sat and replaced cat with «bat». Bat is a fast (written in Rust) cat clone with syntax highlighting for programming and markup languages, integration with your $PAGER, and git index awareness. 🔥

Set defaults in a config stored in ~/.config/bat/config, which looks something like:

--pager="less --quit-if-one-screen --tabs=1"

I use most as my $PAGER and it appears to not play well with bat, so, setting the --pager in the config was required.

RC Logr 20200719 181054 - Today I sat and replaced cat … Rick Cogley

18 Jul 2020


«Exa» (@dot_slash_exa) is a superb modern and fast ls replacement that supports colors, file and filesystem info, tree view, git info, and wide view. You have plenty of compute power, so why not take advantage of it and use something better than ls. 🤖💌

It’s easily installed on mac (brew install exa) or linux (e.g. on fedora sudo dnf install exa).


% exa --long
% exa --classify
% exa --header --long --list-dirs
% exa -lh -t=mod --time-style=long-iso 
% exa --tree --level=2
% exa --long --git
% exa --long --extended some_pdf.pdf

RC Logr 20200718 203303 - «Exa» (@dot_slash_exa) is a … Rick Cogley

14 Jul 2020


Interesting project by Owen Ou «Upterm» (@owenthereal) is written in Go and makes remote pair programming or debugging, or simply accessing computers behind firewalls, a bit easier.

RC Logr 20200714 155907 - Interesting project by Owen Ou … Rick Cogley

10 Jul 2020


One way to hide the contents of a file, e.g. one containing environment variables containing secrets, is to use gpg symmetric encryption, which means encrypt and decrypt use the same secret. It is convenient, and you can supply the secret when you need it. 🤖

For example:

% gpg --symmetric --cipher-algo TWOFISH /path/to/vars.txt
  Password: ********
  Re-enter: ********
% gpg --output /path/to/working/vars.txt --decrypt /path/to/vars.txt.gpg
  Password: ********

The encrypt command will create a file vars.txt.gpg and if you list its contents you will see they are encrypted.

RC Logr 20200710 183207 - One way to hide the contents … Rick Cogley

06 Jul 2020


Trying a different zsh plugin system, «zplug». It is super simple and flexible, and I am testing out «liquidprompt» prompt with it (morphy goodness). So far I like this combo a lot. 🤩

You install zplug like this:

% curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh

Enable and configure it in your ~/.zshrc using some of the examples provided:

# Source zplug
source ~/.zplug/init.zsh

# Make sure to use double quotes
zplug "zsh-users/zsh-history-substring-search"

# Grab binaries from GitHub Releases
# and rename with the "rename-to:" tag
zplug "junegunn/fzf-bin", \
    from:gh-r, \
    as:command, \
    rename-to:fzf, \

# Supports oh-my-zsh plugins and the like
zplug "plugins/git",   from:oh-my-zsh

# Liquidprompt
zplug "nojhan/liquidprompt"

# Load if "if" tag returns true
zplug "lib/clipboard", from:oh-my-zsh, if:"[[ $OSTYPE == *darwin* ]]"

# Group dependencies
# Load "emoji-cli" if "jq" is installed in this example
zplug "stedolan/jq", \
    from:gh-r, \
    as:command, \
zplug "b4b4r07/emoji-cli", \
# Note: To specify the order in which packages should be loaded, use the defer
#       tag described in the next section

# Set the priority when loading
# e.g., zsh-syntax-highlighting must be loaded
# after executing compinit command and sourcing other plugins
# (If the defer tag is given 2 or above, run after compinit command)
zplug "zsh-users/zsh-syntax-highlighting", defer:2

# Install plugins if there are plugins that have not been installed
if ! zplug check --verbose; then
    printf "Install? [y/N]: "
    if read -q; then
        echo; zplug install

# Then, source plugins and add commands to $PATH
zplug load --verbose

# Self manage
zplug 'zplug/zplug', hook-build:'zplug --self-manage'

Except for liquidprompt, those are just copy-pasted from the docs. Then restart your terminal and answer the install prompts to install the plugins. Sweet zsh goodness. Thanks to Masaki Ishiyama for coding up a great system https://twitter.com/b4b4r07.

liquidprompt screenshot

RC Logr 20200706 060711 - Trying a different zsh plugin … Rick Cogley

27 Jun 2020


If you are using the aws cli tool, you can set the shell env var «AWS_PROFILE» to match your setup profile names linking to specific IAM credentials. 🍺 Here it is in a zsh function.

function hugodeploy-coolsite (){
    echo "====== Deploy coolsite.jp site to AWS S3 ======"
    cd ${_workingdir}
    export AWS_PROFILE="deploy-coolsite"
    echo "🍺 Confirm aws profile via \"aws configure list\""
    ${_awsbin} configure list
    echo "🍺 Build and deploy site"
    ${_hugobin} && ${_hugobin} deploy --invalidateCDN --target coolsitejp --verbose
    [[ -z "$_current_aws_profile" ]] && unset AWS_PROFILE || export AWS_PROFILE=${_current_aws_profile}

This function sets some local vars, sets AWS_PROFILE via export then confirms it is set, then builds and deploys the site via hugo and hugo deploy. The site has a config file with the “coolsitejp” target, and under that is specified which AWS S3 bucket to deploy to. Use export instead of a simple assignation like I am doing with _hugobin etc, because you want to have the variable ready for use when the script invokes hugo to build and deploy the site. The last line unsets AWS_PROFILE for good measure if it was not set already, or resets it to whatever it was set to initially.

RC Logr 20200627 103837 - If you are using the aws cli … Rick Cogley

25 Jun 2020


If you have AirPods Pro headphones there is a firmware update (from 2D15 to 2D27) with no details on what it does. How to update? 🤔 Nobody can say.

Apparently, if you listen to music for a minute or so, then put the headphones in their charger and connect to power, they update in a few minutes. It may be voodoo majick but it worked for me.

Confirm the before and the after:

  1. Connect to your iOS device.
  2. Open Settings, then go to General -> About.
  3. Find your AirPods and tap the name.
  4. Find the firmware version. (Take a screenshot which on my XS is: press big right button and volume up button simultaneously)

RC Logr 20200625 090929 - If you have AirPods Pro … Rick Cogley


I connected a new ELECOM WRC-X3000GS broadband router that supports «Wi-fi 6», or IEEE 802.11ax via an Intel WAV600 chipset, with high hopes for 9.6 Gbps goodness. It connected to my Docomo hikari line without any settings (convenient!) but kept dropping the connection. 👺 A call to Elecom support solved it straight away.

The support professional suspected she knew what it was, and had me check the PPP LED on the unit. It was off. She asked if I had entered the ISP credentials and I said no, it just connected. She told me that that kind of connection is kind of a test mode and recommended I check my ISP information again for login information. She directed me where to enter it, and sure enough, once I did that, the unit is stable and fast.

Still, I find it really odd that the installer would not mention this important fact. The Amazon reviews section is full of people grousing about how bad the router is and that it drops its connection, so I bet others are getting hit with this same thing and just giving up.

RC Logr 20200625 084815 - I connected a new ELECOM … Rick Cogley


Google released a way to automatically delete the data it stores on you more frequently. Log in to https://myaccount.google.com/data-and-personalization and find Auto-delete in «Activity Controls». 😌

You can set the auto-deletion period as short as 3 months, and the setting is separate for web and app, location and YouTube history.

RC Logr 20200625 054237 - Google released a way to … Rick Cogley

16 Jun 2020


Simon Fredsted @fredsted has been prolifically releasing new features for his fantastic webhook utility site https://docs.webhook.site/news.html. 🤖🦾 Now manipulate CSVs, upload to S3, ping Slack and Discord, schedule actions.

Some usage ideas:

  • Schedule sync of information between systems A and B
  • Receive jpg by email, upload to AWS S3 bucket
  • React to Slack “slash command”
  • Receive a CSV via web form, manipulate and upload it to a data table via REST
  • Receive inputs via web form, append to Google Sheet

Get the paid version; it’s well worth it.

Update for https://logr.cogley.info/2020/03/17/1584405754/

RC Logr 20200616 095855 - Simon Fredsted @fredsted has … Rick Cogley

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