Kazu's Log

A software developer in Seattle

How was 2017 for you? Have you learned Rust? Have you invested in Bitcoin? Was it the year of Linux desktop (again)?

In this post, I’d like to see how was the last year for fellow hackers, through Hacker News’ public dataset on Google BigQuery.

Google BigQuery has interesting public datasets and Hacker News is one of them. Deedy Das already did a lot of interesting analysis in 2015, that covered 9 years from 2006. Most of the SQL queries below are taken from his post.

Technically people can upvote/downvote last year’s stories on Hacker News. There is no “archive” mode like Reddit as far as I know. If you run the queries again, the numbers would be a bit different.

Top Stories

Let’s start from the simplest one. What was the most upvoted stories in 2017?

I mainly used Google Cloud Datalab to get the numbers. %%bq query lets Datalab (which is basically Jupyter Notebook) interrepts a cell as a SQL on BigQuery. If you use BigQuery’s console, you may need #standardSQL instead.

%%bq query
SELECT title, url, score, id, timestamp FROM `bigquery-public-data.hacker_news.full`
WHERE type = 'story' AND extract(year FROM timestamp) = 2017
ORDER BY score DESC LIMIT 30

Here is the result. Apparently, it was the year of Silent Breakers, even for Hacker News.

TitleScoreTimestamp
1Reflecting on one very, very strange year at Uber41072017-02-19 21:16:33
2F.C.C. Repeals Net Neutrality Rules33842017-12-14 18:13:35
3Cloudflare Reverse Proxies Are Dumping Uninitialized Memory32382017-02-23 23:05:08
4Announcing the first SHA-1 collision30302017-02-23 13:01:08
5macOS High Sierra: Anyone can login as “root” with empty password30012017-11-28 19:41:10
6W3C abandons consensus, standardizes DRM, EFF resigns27352017-09-18 19:45:08
7CIA malware and hacking tools26992017-03-07 13:10:56
8Ask HN: Is S3 down?25892017-02-28 17:45:58
9Relicensing React, Jest, Flow, and Immutable.js22802017-09-22 21:51:56
10Seven earth-sized planets discovered circling a star 39 light years from Earth22562017-02-22 18:02:28
11How Firefox Got Fast Again21802017-11-13 14:18:26
12I am an Uber survivor21682017-02-27 20:02:00
13Uber Founder Travis Kalanick Resigns as C.E.O.21192017-06-21 05:24:13
14Get started making music21062017-05-09 13:06:39
15Firefox is on a slippery slope20212017-12-16 16:16:40
16Accidentally Stopping a Global Cyber Attack19812017-05-13 12:13:44
17Google Maps' Moat19332017-12-19 23:51:17
18Launch HN: 70MillionJobs (YC S17) – Job board for people with criminal records18792017-08-02 15:46:39
19Atlassian acquires Trello for $425M18572017-01-09 14:01:49
20GitHub lets staff own IP developed for personal projects using company resources18412017-03-21 12:05:44
21SpaceX to Send Privately Crewed Dragon Spacecraft Beyond the Moon Next Year17472017-02-27 21:27:32
22Tim Berners-Lee wins Turing Award17352017-04-04 11:29:30
23Uber Paid Hackers to Delete Stolen Data on 57M People17202017-11-21 22:02:05
24Google Fires Employee Behind Controversial Diversity Memo16972017-08-08 01:31:15
25Firefox 57.0 Released16922017-11-14 13:52:34
26Amazon to Acquire Whole Foods for $13.7B16872017-06-16 13:03:09
27It’s time to give Firefox another chance16742017-09-29 19:27:58
28Net Neutrality Day of Action: Help Preserve the Open Internet16642017-07-12 17:51:25
29Sublime Text 3.016532017-09-13 13:13:32
30Machine Learning 101 slidedeck: 2 years of headbanging, so you don't have to16512017-12-14 00:54:14

(More...)

tmux 2.6 introduced choose-tree which is the new way of choosing windows/sessions. However, you can’t use Emacs-like Ctrl-n/Ctrl-p on choose-tree.

The issue has been reported, and addressed already. The only problem here is that the latest version is 2.6 which doesn’t have the fix.

My workaround on macOS is installing the latest, non-released version from Homebrew.

% brew install tmux --HEAD
==> Cloning https://github.com/tmux/tmux.git
Cloning into '/Users/kazuyoshi/Library/Caches/Homebrew/tmux--git'...
remote: Counting objects: 227, done.
remote: Compressing objects: 100% (218/218), done.
remote: Total 227 (delta 53), reused 37 (delta 9), pack-reused 0
Receiving objects: 100% (227/227), 710.69 KiB | 3.47 MiB/s, done.
Resolving deltas: 100% (53/53), done.
==> Checking out branch master
==> sh autogen.sh
==> ./configure --disable-Dependency-tracking --prefix=/usr/local/Cellar/tmux/HE
==> make install
==> Downloading https://raw.githubusercontent.com/imomaliev/tmux-bash-completion
######################################################################## 100.0%
==> Caveats
Example configuration has been installed to:
  /usr/local/opt/tmux/share/tmux

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/tmux/HEAD-cd46568: 10 files, 695KB, built in 32 seconds
%

Hacktoberfest 2017

Oct 22, 2017

Hacktoberfest is a month-long event organized by DigitalOcean. The rules are,

  • Sign-up at the Hacktoberfest website
  • Open four pull requests on any GitHub-hosted repositories between October 1st and October 31th
  • Get a t-shirt!

And I opened four pull requests and all of them are merged! Woo-hoo!

I initially wanted to learn and contribute to Rust. The issues were nicely labelled and organized. But learning the new language and contributing to the language itself were too hard to do in a month.

Instead I was looking Hugo, which I had worked during Hacktoberfest 2014.

There was this interesting issue – Hugo’s Polish support seemd half-working. But the root cause was that, Polish’s plural form has 4 categories (one, few, many and other) and the reporter didn’t define the 4 forms.

Then, through this issue, I realized that there were at least two TOML parsers; BurntSushi/toml and pelletier/go-toml. Hugo switched to go-toml once, but reverted back to BurntSushi’s.

Can I make go-toml better/faster to be the TOML parser for Hugo again?

go-toml

I ended up having 4 pull requests

  1. Support single quoted keys
  2. Add fuzz.sh to do fuzzing with go-fuzz
  3. Fix typos
  4. Unmarshal should report a type mismatch as an error

The first one was good. I simplified inQuote and escapeNext by having state. The only problem here was what I wrote was very similar to lexString(). I probably should send a follow-up PR.

The second one was interesting, but I didn’t find any interesting issues through fuzzing yet. Probably due to the corpus?

The third one was easy. I just checked go-toml’s report card where misspell reported these typos.

The last one was so Go. Don’t panic. Return an error. I missed Scala’s match syntax where I can combine case and if though.

Also, short dates support is work in progress. The blocker was that, there were no civil types in Go’s stdlib. Tom recommended to use cloud.google.com/go/civil. So I will.

Lesson Learned

I’m not a first-time open source contributor. I probably can claim “seasoned” (kids, I know SourceForge and Google Code). But I didn’t do much these days after getting married and having a baby. That is legitimate and will continue. I’m the only husband/dad for them, whereas I’m just a yet another software developer.

However it is still good to see I can code in my spare time, relatively quickly understand codebase and contribute to the world. It is fun!

New Macbook Pro

Oct 6, 2017

I bought MacBook Pro (13-inch, 2017). I had thought that having MacBook Pro for personal use was luxury. Then I realized that MacBook Pro’s price was the same as MacBook 1. So, what’s the point of having the slower one?

Refurbished

To save some money, I bought a refurbished model. Refurbished models sometimes don’t have the latest macOS. My one had Sierra and I had to upgrade that to High Sierra. But I’m happy to do the errands for $200.

What I Need

I copied my SSH keys and 1Password’s vault from my old MacBook Air (11-inch, Mid 2012) to the MacBook Pro through USB. 1Password has a nice guide page to migrate passwords (a valut) from an old computer to a new computer.

Then dotfiles and this blog are managed by Git, on BitBucket’s private repos. So, I just cloned both of them. I also installed Homebrew to have Emacs, tmux and some others.

I would install other heavy apps such as IntelliJ IDEA later.

System Preferences

The below are minimal tweaks I need.

  • Keyboard

    • Keyboard > Modifier Keys… > Caps Lock as Control
    • Keyboard > Key Repeat > Fast
    • Keyboard > Delay Until Repeat > Short
    • Shortcuts > Input Sources > Check “Select the previous input source” and change the shortcut as Option-Space 2.
  • Sharing

    • Computer Name
  • Language & Region

    • Adding Japanese as the secondary language
  • Display

    • Night Shift > Schedule > Sunset to Sunrise

Dock

  • Dock Preferences… > Automatically hide and show the Dock

Then I removed various apps from Dock.

Safari

I’ve been using Chrome but I started trying Safari on this MacBook Pro. I’m worrying a bit about Google’s dominance.

  • Preferences…
    • AutoFill > Uncheck “User names and passwords” because of 1Password
    • Advanced > Show Develop menu in menu bar
    • Websites > Auto-Play > iknow.jp > Allow All Auto-Play

Then I installed WasteNoTime and 1Password.

Terminal

  • Preferences… > Profiles > Basic
    • Shell > When the shell exits: > Close if the shell exited cleanly

  1. To be honest, I noticed that after ordering MacBook and returned the one. [return]
  2. The original shortcut is Ctrl-Space, which is Emacs’ set-mark-command. [return]

My Blog Setup

Sep 23, 2017

My blog setup is quite complex. This post is a reminder to myself. I’m currently using the below;

The half of the complexity is coming from the fact that I was using blog.8-p.info for my blog from 2005 to 2011. It was on Mephisto, WordPress and some other blog engines. Now I’m running none of them, but the contents are stored as static HTML files and served as like before. Even nobody read them, cool URIs don’t change.

Therefore there are 2 S3 buckets for blog.8-p.info. One of them is for Hugo and another is for the old files. API Gateway is routing some traffic to the former, and some traffic to the latter. This might not be “API” but it works for me.