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‽

03 Apr 2019


If you use Win 10 64 bit, you can install the «Windows Subsystem for Linux» from Control Panel, Program, Turn Windows Features On or Off. Select it, OK and restart, then install your Linux distribution from the Windows Store - Ubuntu, Debian, openSUSE, even Kali for pen testing. 🤖 What else?

  • Install Linux programs sudo apt-get install jq
  • Switch to zsh
  • Mount drives sudo mount -t ...
  • Run shell scripts
  • Use Windows Run, Open to run Linux commands bash -c "somebin"
  • Upgrade your selected Linux

You can even possibly run graphical Linux programs, although this subsystem is not designed for that.

RC Logr 20190403 093056 - If you use Win 10 64 bit, you … Rick Cogley

01 Apr 2019


The new Japan era name is «Reiwa» 令和, the 239th such era, which comprises daily-use kanji rei 令 and wa 和, which could be translated as auspicious or orderly or calm or command, and peace or harmony, respectively. 🇯🇵 A couple of data points about the two characters are as follows:

令 Rei和 Wa
Past Eras Containing020
JIS Code4E614F42
UTF16 Unicode4EE4548C
Old Variant
Taught in Grade34
JLPT Level22

These details come from Jim Breen’s awesome WWWJDIC and Wikipedia. Software people can note also that there is a Perl library Date::Japanese::Era for Japan era conversion, by Twitter user @miyagawa. And the Unicode blog has a post about character code U+32FF, the one-character representation of the new name.

There were a few eras which were only a couple years long and even 1 year or less in the case of the Genji era, but the average for the last four is about 37 years. Will I last another era?! 🙀

RC Logr 20190401 134646 - The new Japan era name is … Rick Cogley


I was disappointed in this incredible article by Hans van «Hook», because it mentions the low angle of the sun in winter, without citing the angle. It is 30~46 degrees from vertical in Tokyo, so position those solar arrays with abandon. 🌞

RC Logr 20190401 073544 - I was disappointed in this … Rick Cogley


Welcome to April. The color palette on my Logr site this month was picked thinking of the pinks of 桃 «Momo», Sakura and Plum blossoms as well as the beautiful greens of breaking spring. The birds are singing in our back yard and the uguisu is back too. Ah spring! 🌸

Hugo Pipes is what enables weaving Sass variables into site code, to make it super simple to change the color scheme with a couple variables to define the scheme for the month.

{{ else if eq $mnth "March" }}
$textHilite: #b385d6 !default;
$codeBgColor: #f3ecf8 !default;
$one: #66308e !default;
$two: #a0cf89 !default;
$three: #c804fe !default;
$four: #1c0d27 !default;
$topbannerimage: "Cogley-Banner-PapaBubble-Candy-2.jpg";

{{ else if eq $mnth "April" }}
$textHilite: #63fbef !default;
$textHilite: $yellow !default;
$codeBgColor: #fee9eb !default;
$one: #FB636F !default;
$two: #A9D14A !default;
$three: #f60619 !default;
$four: #230104 !default;
$topbannerimage: "Cogley-Banner-Hiratsuka-Beach-Windsurfers.jpg";

RC Logr 20190401 055127 - Welcome to April. The color … Rick Cogley

31 Mar 2019


An «L» on a sock is ambiguous as it could mean left or large assuming English, so if you pick one of a pair up and get an L, then the other must be checked. If you pick and get an R, chuck that puppy on your right foot. 🕵🏻‍

RC Logr 20190331 115301 - An «L» on a sock is ambiguous … Rick Cogley

28 Mar 2019


Ever need a super simple way to show hidden files in Mac Finder or a File Open dialog, just press cmd-shift-. to toggle. macOS and its predecessors are unix based, and unix hides files or folders that start with a period, hence its use in this binding. 🕵🏻‍

To make it permanent:

~$> defaults write com.apple.finder AppleShowAllFiles YES
~$> killall -kill Finder

Slap a NO on the defaults command to reverse it. Also, you can ctrl-opt-click the Finder icon in the Dock, to access the Relaunch command.

RC Logr 20190328 172846 - Ever need a super simple way … Rick Cogley


I love the zsh configuration framework «prezto». Browse the runcoms folder for all the basic rc-type config files, and the modules folder for functions that you can load. 🤠 Switch into a module folder to display its readme. Edit the zpreztorc runcom to select modules to load and make settings. Run the built-in function zprezto-update to update. It:

enriches the command line interface environment with sane defaults, aliases, functions, auto completion, and prompt themes.

RC Logr 20190328 165103 - I love the zsh configuration … Rick Cogley

27 Mar 2019


When there is a new macOS point release available like today, before you update I recommend running Maintain Cocktail first to clear caches, cruft and so on, and then install via the «Combo Update». The combo contains all the patches since the last major release, and maybe it is voodoo but I have always had better luck installing the combo. 🗿

RC Logr 20190327 160702 - When there is a new macOS … Rick Cogley

26 Mar 2019


When you use bash as your shell, normally your .bash_profile is run once when you log in, and your .bashrc runs for every new shell. But using bash on macOS is a bit odd, because Terminal app will run .bash_profile every time you open a tab or window. 🤔 To make it act more normal on Mac, source your .bashrc from your .bash_profile, and put all your settings in .bashrc:

~ $> cat .bash_profile
if [ -f ~/.bashrc ]; then
   source ~/.bashrc

Also, as a matter of convention, chmod 700 those 2 files to make them accessible to your user only.

RC Logr 20190326 193800 - When you use bash as your … Rick Cogley

25 Mar 2019


macOS often lets you set the default app for something, from preferences in their canonical app for that function. For example, you can set the the default browser as Firefox in Safari.app prefs, the default email client as MailMate from within Mail.app, BusyCal as default in Calendar.app, and even the default shell as say zsh in Terminal.app. 👍

It doesn’t work 100% but it is a common Apple design pattern.

RC Logr 20190325 182919 - macOS often lets you set the … Rick Cogley


The zsh that is installed by default on macOS is 3 years old, but you can use homebrew to install the latest. Add the brew installed one to your shells whitelist, and set your login shell to it using chsh. Use the prefix switch on brew to find the path of the shell you installed. 🤓

$> brew install zsh zsh-completions
$> sudo echo $(brew --prefix zsh) >> /etc/shells
$> cat /etc/shells
$> chsh -s $(brew --prefix zsh)
$> sudo dscl localhost -read /Local/Default/Users/$(whoami) shell
$> echo $SHELL

Using brew --prefix zsh to find the path of the brew-installed zsh is the most precise, but you may know about whereis or which as well. Bonus trivia - whereis zsh will return the original macOS one since it does not look in your path, whereas, which zsh does look in your path and will find the one installed by brew (try also which -a zsh to see them all).

The above dscl command will reliably return your user shell, but you can confirm your settings in the GUI too. Just ctrl-click on your user in System Prefs, Users and Groups, and select Advanced Options. The echo $SHELL shows the shell at login, but may be misleading because the act of changing shells will not update it.

Update: Rudi mentions that it might work to set the history file’s perms to 700 or the like; a valid point. However, the man file bash shell builtins says the file that source is executing “need not be executable”.

RC Logr 20190325 150523 - The zsh that is installed by … Rick Cogley

24 Mar 2019


Saw this tweet in which .bash_history was accidentally re-executed using source. D’oh! You can prevent this by making an alias to redirect that to an innocuous function. 😥 Not tested yet but I am pretty sure it would be something like this in your .bashrc:

  echo "Stop. You probably should not do that." >&2

alias source ~/.bash_history="oh_no_you_dont"
alias scarycmd --silent --killdrive="oh_no_you_dont"

RC Logr 20190324 091526 - Saw this tweet in which … Rick Cogley

22 Mar 2019


Vim lets you search in normal mode by simply pressing slash followed by the search word and enter, like /Toranomon. Then, n finds the next while N finds the previous occurrence, and ggn finds the first while GN finds the last occurrence. Using a question mark instead of slash goes the opposite direction. Also, use / or ? then the arrow keys, to check the search history. 🕵🏻‍

RC Logr 20190322 183601 - Vim lets you search in normal … Rick Cogley


Ever boneheadedly pasted a password into a terminal command? Restart your terminal, find your history file with echo $HISTFILE, edit it and delete the offending line, then reload. That should do it. 🏁

More options:

You can delete all lines with a specific string from your history file using sed -i '/badstring/d' $HISTFILE.

Add the zsh builtin option setopt histignorespace to your ~/.zshrc. Now if you enter a single space before a command, it will not be logged in history.

RC Logr 20190322 072545 - Ever boneheadedly pasted a … Rick Cogley

21 Mar 2019

🗓 "Vernal Equinox Day" in Japan


Email newsletters have to cater to various email clients that parse HTML differently, using fairly archaic techniques that you ignore at your peril. E.g. you need to set fixed sizes and widths for things in px not rems. Even a cool builder like MJML will ultimately convert to px from its intermediate language, skillfully finding a way to make the result relatively device-responsive. The resulting HTML is complex, but at least it is not horrific like what MS Word generates! 🙀😱✉️

Rules I could discern:

  • Container width: 600 or 700px
  • Banner width: same as container, or that less any padding
  • Base text size: 12-14px

RC Logr 20190321 082138 - Email newsletters have to … Rick Cogley

20 Mar 2019


I posted about how to remove a key from ~/.ssh/known_hosts using vim, when you have StrictHostKeyChecking yes set in your ssh options and you get the WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED error. Other options: you can do it with sed -i '83d' $HOME/.ssh/known_hosts or more directly with ssh-keygen -R tried.host.com, replacing the hostname with the one that is failing. 🤖

RC Logr 20190320 083743 - I posted about how to remove a … Rick Cogley

19 Mar 2019


Today I learned about Input Club mechanical keyboards, and the KLL keyboard input language. Looks like another brand of keyboard that has good quality with a good configurator. We are spoiled for choice! ⌨︎🔣

RC Logr 20190319 124917 - Today I learned about Input … Rick Cogley

18 Mar 2019


Sys admins you will have seen those messages you get from ssh servers sometimes, saying IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY, and saying the fingerprint for a key is incorrect and cannot be verified. It is easy to fix with a vim one-liner. 🤓

The error looks like:

Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
Please contact your system administrator.
Add correct host key in /path/to/.ssh/known_hosts to get rid of this message.
Offending RSA key in /path/to/.ssh/known_hosts:83
RSA host key for [ip]:port has changed and you have requested strict checking.
Host key verification failed.

Fix it like this:

vim $HOME/.ssh/known_hosts +"83d|x"

You can have a look at the manual, but the +"??" bit is a plus command, which tells vim to execute “Ex commands” separated by the pipe.

Simply put, it is just a kind of macro that acts on the specified file to press colon, followed by a vim command. In this case, in vim’s “command” mode (enter a colon to switch to it), it is doing :83d deleting the 83rd line in the file, then :x which exits. Note that, because you are running the d in normal mode, the file is saved and you just need x. This is easier to figure out than sed.

RC Logr 20190318 195558 - Sys admins you will have seen … Rick Cogley


Is your Japan branch using Era Year Names (元号, げんごう, gengou) in any apps? If so, you should look into whether a patch or upgrade is needed, for the upcoming name change in May, from Heisei to something new. My firm eSolia can help, so please do not hesitate to ask us. 🇯🇵

RC Logr 20190318 103738 - Is your Japan branch using Era … Rick Cogley


The chips that power our devices rely on EUV or «extreme ultraviolet lithography», to draw circuit lines e.g. less than 7 nm in width in the case of the Apple A12 Bionic chip. That is, less than 7 billionths of a meter. The Japan Times introduces Lasertec, the Yokohama firm that makes the equipment to test the needed chip stencils.

And all most of us are doing on our devices is clicking Like and Share! 🤪

RC Logr 20190318 082725 - The chips that power our … Rick Cogley