Rick Cogley's Tech Logr

Short Technical Laser Bursts %%

Welcome

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

05 Mar 2019

«09:50:19»

The EFF has a subdomain «fixitalready» about the privacy problems being long ignored by big tech companies. Do your part and make some noise where relevant. 👍

RC Logr 20190305 095019 - The EFF has a subdomain … Rick Cogley

«09:22:40»

Making a bulk email template with the excellent and popular mjml, guess which mail client causes problems‽ Outlook, of course (smh)! I need to add exception code to have that POS render correctly. Burn it with FIRE! 🔥

RC Logr 20190305 092239 - Making a bulk email template … Rick Cogley

04 Mar 2019

«15:34:30»

Neat zsh trick which I understand works in bash too, replace text of your last issued command. Type caret then the text to find, and caret then the text to replace. «^findtext^replacetext»

RC Logr 20190304 153429 - Neat zsh trick which I … Rick Cogley

03 Mar 2019

«20:14:23»

I like keybase.io for secure file sharing, but bashupload.com also looks like a cool tool, because it appears to not need an account and it allows you to share up to 25GB. Check out dat project as well. 🗂

RC Logr 20190303 201422 - I like keybase.io for secure … Rick Cogley

«08:09:35»

I am tempted to try Nix over the fairly standard Homebrew on my Macs (anyone remember MacPorts?), because I am interested in NixOS and functional programming, but I wonder if it will end up being fragile. 🤔

RC Logr 20190303 080935 - I am tempted to try Nix over … Rick Cogley

01 Mar 2019

«19:17:17»

I integrated holiday name display in Logr, pulling the needed holiday data in json format from my ops db, then parsing it when building the site with Hugo. The gist is, with the post date in a format that is the same as one of the fields in the data, read the data in, and match the post date to the record that has that date, then pull the holiday text from that record and show it. 🏖

The json data looks like:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
...
{
  "@row.id": 312,
  "Date": "2019-02-11T00:00:00+00:00",
  "Date in YYYYMMDD": "20190211",
  "Day of Week": "Monday",
  "Date with Month Name": "11 Feb 2019",
  "Name": "National Foundation Day",
  "Name Jp": "建国記念の日"
},
...

And the Hugo template that pulls it looks like:

1
2
3
4
5
6
7
8
...
{{ $dt := .Key }}
{{ range where $.Site.Data.holidays ".Date with Month Name" $dt }}
{{ with (index . "Name") }}
<p class="three bg-near-white br3">🗓 "<strong><i>{{ . }}</i></strong>" in Japan</p>
{{ end }}
{{ end }}
...

RC Logr 20190301 191716 - I integrated holiday name … Rick Cogley

«19:11:49»

The open source «fsnotes» is macOS and iOS only, but looks really solid! 📓

RC Logr 20190301 191149 - The open source «fsnotes» is … Rick Cogley

«15:40:45»

If you are using ssh or rsync, one important setup tip is to make sure your permissions are correct locally and on any remote. Home directory is at most 755, .ssh directory is 700, public keys are 644, private keys are 600, and the authorized_keys file is 644. 😎

RC Logr 20190301 154044 - If you are using ssh or rsync, … Rick Cogley

«12:32:12»

I hate corporate email systems that tack on a massive disclaimer or insert [EXTERNAL] or <EXT> in the Subject line like a scarlet letter when someone replies to your email (seriously, who thought that was a good idea‽), or signatures with an inordinate number of attachments. 👿

RC Logr 20190301 123212 - I hate corporate email systems … Rick Cogley

«11:43:55»

Well, the month-based color palette changed as expected with the previous post, and my logr site is now rocking the 壺菫 «tsubosumire» color scheme for March. Sass and Hugo Pipes for the win! 💐

RC Logr 20190301 114354 - Well, the month-based color … Rick Cogley

«08:27:11»

Was pleasantly suprised at how easy it is to get syntax highlighting going in Hugo, since its inclusion of the fast Golang-based «Chroma» library, and even making it backward compatible with most pygments settings. My config.toml contains the following:

1
2
3
4
pygmentsOptions = "linenos=table"
pygmentsCodeFences = "true"
pygmentsCodefencesGuessSyntax = "true"
pygmentsStyle = "tango"

… and to get it to work you just use a code fence (three backticks) specifying the language like:

1
2
3
```toml
pygmentsStyle = "monokailight"
```

RC Logr 20190301 082710 - Was pleasantly suprised at how … Rick Cogley

28 Feb 2019

«19:19:50»

In bash or zsh, do cd - to pop back to your previous location. Say you are deep in your file system and do a cd to jump to $HOME. If you want to jump back to the deep location, just do cd -. 🚀

RC Logr 20190228 191950 - In bash or zsh, do cd - to pop … Rick Cogley

«15:19:33»

In bash or zsh, you can recall the last argument using !$. For example, if you execute ls /crazy/path/to/some/remote/part/of/your/disk/file.txt, to edit it you could just do vim !$, instead of using your arrow keys to navigate all the way to the ls. 👻 (thx Rudi)

RC Logr 20190228 151933 - In bash or zsh, you can recall … Rick Cogley

«07:47:44»

Finally had time to experiment with the Hugo SSG pipeline feature for real, which lets you process sass easily, and without too much reliance on npm. Make /myproject/assets/main.scss, import your scss files at the top (say from a library like tachyons), and then use Hugo template code in it to do some interesting stuff. I tried pulling params from config.toml, and a conditional month check to set colors per the season, and it works a treat!

In your <head> (assumes postcss-cli and autoprefixer are installed via npm):

1
2
{{ $styles := resources.Get "main.scss" | resources.ExecuteAsTemplate "style.scss" . | toCSS | postCSS | minify | fingerprint }}
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}">

In your main.scss:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
@import "tachyons-sass/tachyons.scss";
$textHilite: {{ .Site.Params.style.textHilite | default "goldenrod" }} !default;
{{ $mnth := now.Format "January"}}
{{ if eq $mnth "January" }}
$one: #658248 !default;
$two: #a0cf89 !default;
{{ else if eq $mnth "February" }}
{{ end }}
...
.one { color: $one; }
.two { color: $two; }
.bg-one { background-color: $one; }
.bg-two { background-color: $two; }
...

Then just use the classes in your templates.

RC Logr 20190228 074744 - Finally had time to experiment … Rick Cogley

27 Feb 2019

«12:37:08»

You can use the dd command to write a downloaded .iso file to a USB stick, for booting and installing and so on. You need to be careful when using dd, because it is possible to overwrite an entire drive (hence the nickname: disk destroyer). A GUI alternative is «balenaEtcher», a cross-platform app written to make the OS flash-to-media process easy and safe. (It is an electron app, so I should say it is brought to you by 10,000 javascript files… 🙀)

On Mac, the non-GUI, old fashioned dd style command sequence is something like:

1
2
3
4
diskutil list
diskutil unmountDisk disk2 (substitute the correct one)
sudo dd if=/path/to/theLinux.iso of=/dev/disk2 bs=8m
diskutil eject disk2

On Linux:

1
2
3
4
fdisk -l (do before and after usb insertion)
umount /dev/sdb1
sudo dd if=/path/to/theLinux.iso of=/dev/sdb bs=8M
qemu -hda /dev/sdb

RC Logr 20190227 123708 - You can use the dd command to … Rick Cogley

26 Feb 2019

«17:29:42»

Today I saw the phrase «security theatre» used to describe not setting a passphrase on your private keys. Bruce Schneier coined the term to describe things like random searches on the subway, or what the TSA does in general. (But, we paid good money for it, so it must be effective right‽) 🕵🏻‍

RC Logr 20190226 172942 - Today I saw the phrase … Rick Cogley

«15:01:32»

If you use zsh «and you should», you can use many vim key bindings to edit the command line. Just chuck bindkey -v in your .zshrc and then source it to test. Esc, then b, b, b will jump the cursor back word by word for instance. 🤓

RC Logr 20190226 150132 - If you use zsh «and you … Rick Cogley

«08:14:30»

Linux distro comparison lists are misleading, for instance counting the number of packages. RPMs might have more bundled software than do debs for example. Rather, decide what you need to do, and then assess how easy or hard it will be to install what you need on your selected distro, or on a unix like BSD for that matter. 🔁

RC Logr 20190226 081429 - Linux distro comparison lists … Rick Cogley

25 Feb 2019

«07:35:06»

Want an easy way to reload your shell? Do: exec $SHELL --login. Alias it with a shell function for easy remembering.

1
2
3
relogin () {
	exec $SHELL --login
}

RC Logr 20190225 073505 - Want an easy way to reload … Rick Cogley

24 Feb 2019

«21:41:08»

macOS users, if you are using Hammerspoon for your windows management, be sure to check out the intuitive miro-window-manager module. This is available as a «spoon» meaning, the code is pre-written for you so you can easily install and use. Just a little configuration is needed in your lua.init. Once installed, you just repeatedly press ctrl-opt-cmd plus arrow key combinations to move your windows around. Really intuitive! 🥄🖼

RC Logr 20190224 214108 - macOS users, if you are using … Rick Cogley