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 โฆWelcome
Rick’s short, technical tip microblog built with Hugo, powered by Deno Deploy. See also my fabulous repository at Github for this site.
27 Mar 2019
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
:
|
|
Also, as a matter of convention, chmod 700
those 2 files to make them accessible to your user only.
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 โฆ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. ๐ค
|
|
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”.
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
:
|
|
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. ๐ต๐ปโ
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.
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
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. ๐ค
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 โฆ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:
|
|
Fix it like this:
|
|
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
.
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 โฆ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 โฆ17 Mar 2019
Happy St. Patrick’s day! Designers should note the official green and orange of the Irish flag are Pantone PMS 347: Hex #009a49 | RGB 0,154,73 | CMYK 100,0,53,40, and Pantone Orange PMS 151: Hex #ff7900 | RGB 255,121,0 | CMYK 0,53,100,0 respectively.
While you drink your green beer, did you know that the color associated with St. Patrick is blue? There are several associated shades including the one used behind the golden harp on the presidential flag: #23297a.
RC Logr 20190317 101817 - Happy St. Patrick’s day! โฆBeannachtaรญ na Fรฉile Pรกdraig ort!
16 Mar 2019
Heard about the #HHKBChallenge in the Bay Area by @taromatsumura? I have used PFU Happy Hacking HHKB keyboards for years, one at work and one at home. I love the form factor because desk space is at a premium here in Japan, the fact that they are not so heavy so you can schlep them on the train without too much trouble, and for the perfect-feeling Topre switches. You can buy a programmable controller to replace the original Topre one, from Hasu.
I’m using Japanese versions of the HHKB to get arrow keys in US English layout, with keycaps swapped to English, and the Hasu controller. A good fit! โจ๏ธ๐
In addition: note that the switches are Topre, so keycap availability is limited, unlike with Cherry MX type switches. They are not compatible, so you need to get keycaps from PFU or Topre. I wanted some color when I got my HHKBs, so I got a spare set of yellow Topre key caps in Akihabara, and a kit with just 4 keys in it from PFU - blue and red escape and ctrl keys. When I got the idea to switch to the US English layout, I got the English keycap set from PFU and swapped it in. Also, at first I tried the black on grey color scheme, but that was way hard for me to use. I guess I need the legends.
RC Logr 20190316 091856 - Heard about the #HHKBChallenge โฆHaha, is it wrong to get this giddy over software? ยซMonodrawยป is an ascii art editor for macOS by @milend, which is just so slick. Love it! ๐ค
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ SHOULD YOU ยซMAINSPLAINยป THE DIFFERENCE BETWEEN โ โ "VAGINA" AND "VULVA"? โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โDo you have orโ โDid they ask forโ โ did you ever โโโYesโโโ your learned โโโโYesโโโโโโ โhave a vagina?โ โ opinion? โ โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โ โ โDo you actually โ โ โ โโโโโโ know the โ โโโโโNoโโโโโ โโNoโโ โ โ difference? โ โ โ โ โโโโโโโโโโโโโโโโโโ โ โ โ โ โ โ No Yes โโโโโโโโโโโโโโโโ โ โ โโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโ โโShut up now.โโโโโโ โโโProceed but โโ โโโโโโโโโโโโโโโโ โโkeep it briefโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโRC Logr 20190316 000357 - Haha, is it wrong to get this โฆ
15 Mar 2019
Learn what ยซCAPTologyยป is so you can gird yourself against it (I do not care about likes, I do not care about likes). โ๏ธ
RC Logr 20190315 164306 - Learn what ยซCAPTologyยป is so โฆIf you tried using bc to do the quick pi calculation I mentioned yesterday, you can also use an internal value SECONDS to calculate elapsed seconds. The SECONDS only tracks whole numbers, so the time calculation is rather rough, but it works in a pinch.
This works in zsh or bash: SECONDS=0 ; echo "scale=3000; 4*a(1)" | bc -l ; echo $SECONDS
๐ค
This also works, using simple math to do date arithmetic (the $(())
triggers the math):
|
|
Or in zsh, this gives output like 1.92s user 0.02s system 99% cpu 1.954 total
:
|
|
In bash, just replace the ()
around the command you are timing with {}
. Calculating pi using this 4*atan(1)
formula is super slow, so anything more than a couple thousand digits will take tiiimeeee.
14 Mar 2019
Since it is March 14th and Pi day, here is an odd fact: you cannot ever know the exact circumference or area of a circle, due to the nature of Pi. I understand that even space shot calculations do not use all that many digits anyway, so if that is good enough for NASA, I won’t worry about it.
Congratulations to Emma Haruka Iwao and her team at Google for recently breaking the record of the most accurate value of pi, calculated out to 31,415,926,535,897 digits using a program called y-cruncher on 25 virtual cloud servers over four months, and using up 170 TB of data. Wow! ใ๏ธ๐
RC Logr 20190314 180352 - Since it is March 14th and Pi โฆHappy ฯ day. #piday #ๅๅจ็ใฎๆฅ It is trivial to approximate pi to say 100 digits using bc
, the command line calculator. echo "scale=100; 4*a(1)" | bc -l
will do it. Try scales of 1000 or 10000 as well. The former should be reasonable, and the latter will take quite a while. ๐