a tumblelog
week 15, 2019

Jsonnet: a data templating language

Today I learned that there is a templating language that is a superset of JSON: Jsonnet.

Finding hexadecimal color codes on macOS

Use the Digital Color Meter to find the hexadecimal color code of a specific color on macOS or OS X. The program shows default decimal values. Select "as Hexadecimal" in the "Display Values" submenu available under "View" to obtain hexadecimal values.

Switching the Digital Color Meter to hexadecimal
Switching the Digital Color Meter to hexadecimal.

Looking up user info on macOS

$ dscacheutil -q user -a name john
name: john
password: ********
uid: 501
gid: 20
dir: /Users/john
shell: /bin/bash
gecos: John Bokma

To look up information of all users, use:

dscacheutil -q user

Unique visitors per day

In the afternoon I used GoAccess to generate a HTML report with the access.log of this website as input.

Unique visitors per day as reported by GoAccess
Excerpt of the GoAccess report: unique visitors per day.

JSON as configuration files: please don't

I read Martin Tournoij's article on why you shouldn't use JSON as configuration files. To summarise the shortcomings:

  • Lack of comments
  • Readability
  • Strictness
  • Lack of programmability

Happy birthday Alice

Today our daughter Alice turns 12 years old. Happy birthday little princess!

More SEO friendly

The day pages of tumblelog now can have a title that can be defined via the Markdown input file by putting text behind the date. This update is available on GitHub. For more information please read SEO friendly titles for tumblelog.

Emacs font lock II

Today I refactored some Emacs Lisp for additional font locks in Emacs. The Markdown file in which I enter blog entries looks now much better.

Birthday girl

Alice Bokma at her birthday party
Alice at her birthday party at IHOP, Xalapa. Photo taken by Esme.

Emacs highlight-regexp

After some playing with font-lock in Emacs I was wondering how to highlight the entire line when it just has a % character on it in Markdown mode. Entire line as in all other columns, with a background color.

So I asked this question at the Emacs StackExchange and very soon got a helpful answer by Tobias which with some additional Googling led to the following solution:

(defface markdown-item-face
  '((t (:background "#364e7a")))
  "Used to highlight %")

(add-hook 'markdown-mode-hook

Now my blog posts in Emacs are separated by blue bars:

Emacs with highlight-regexp in Markdown mode showing blue bars
Emacs with highlight-regexp in Markdown mode showing blue bars.

Update, update!

I just pushed two updates to the tumblelog repository:

  • A new style has been added: thought-provoking.scss.
  • The label format for week can now be specified via the command line.

The default for the latter is 'week %V, %Y' with %V the ISO 8601 week as a decimal number with an optional leading zero and %Y the four digit year.

Garden centre "De Carlton"

In the afternoon I went with my mother to the garden centre "De Carlton" near to her house. We had a coffee and I took a few photos with my iPhone 5 of the plants on sale.

African daisies (Osteospermum) flowering
African daisies or daisybushes flowering; Osteospermum species.
Moth orchid (Phalaenopsis) flowering
Moth orchid flowering; Phalaenopsis species.
Tillandsia species for sale
Tillandsia species for sale, including Tillandsia ionantha, Tillandsia xerographica, and Tillandsia usneoides.
Treasure flowers (Gazania rigens) flowering
Treasure flowers, Gazania rigens, flowering.
Brachyscome angustifolia flowering
Brachyscome angustifolia flowering.

Firefox Copy as cURL

Select "Network" in the "Web Developer" submenu of "Tools". Reload the page. Right click on a URL and in the "Copy" menu select "Copy as cURL".

Safari Copy as cURL

Select "Show Page Resources ⌥⌘A", right click on a URL and select "Copy as cURL".

Even more style

Another tumblelog style has been added; adrift-in-dreams.scss, see my GitHub repository.

Screenshots of themes

I just made screenshots, using Firefox, of the themes I have created for the tumblelog program and added them to my GitHub repository.

SEO friendly titles are coming

I just finished an update to the Perl version of tumblelog which makes it possible to give each day page a title. This is more SEO friendly. Tomorrow, I'll port this to the Python version and make both available on GitHub

Emacs font lock

I have been playing with font lock in Emacs and managed to give a specific face to each line starting with an ISO date. I use this in Markdown mode in which I write this blog. I will blog about this on my main blog tomorrow.

More Style

I just pushed another update to of tumblelog. This time I modified both the HTML and SCSS to make styling of a tumblelog easier. I also made the HTML slightly more semantic. Enjoy!

Yello's Pocket Universe

Currently listening to one of my favorite Yello albums; Pocket Universe.

How to create a SOCKS tunnel

ssh -fNCqD 1080
  • -f - Fork in the background.
  • -N - No command is sent once the tunnel is up.
  • -C - Compress the data before sending it.
  • -q - Quiet mode.
  • -D - Dynamic application level port forwarding. Supports SOCKS protocol.

The above creates a SOCKS proxy listening on port 1080.

See also How To Route Web Traffic Securely Without a VPN Using a SOCKS Tunnel.

Importing a CSV into MySQL

I helped Paul out with the problem of importing a CSV file created in OpenOffice on Windows into an existing table on MySQL. After some reading I came up with a command similar to:

INTO TABLE tablename

Note the LINES TERMINATED value, which must be '\r\n' if the file was created on Windows. If on Linux, use just '\n'.

Don't forget the LOCAL otherwise MySQL can't execute the command if running with the --secure-file-priv option.

less and Unicode

To have less work correctly with UTF-8 files use:

LESSCHARSET='utf-8' less file.txt