Posts

  • | Source | Signature

    消失的《警察通例》第14章〈物料及配備〉

    比較香港警務處網頁《供公眾查閱的警察通例》之中文英文版 本,可見英文版目錄列有 “Chapter 14. STORES AND EQUIPMENT” 而中文版目錄 則未列有第14章;惟讀者仍可根據其他章節之超連結格式推斷第14章之URL 並下載該檔案。

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    塑膠含有氯氣

    港台記者,「塑膠含氯」,同「塑膠含氯氣」,係差好遠㗎喎…

    RTHK news screenshot

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Jekyll bug: incorrect timestamp

    Automating the posting process on shitpost, I have discovered a bug in Jekyll. If the post timestamp is exactly the same as the system time (correct to the nearest second), and the jekyll process is running with the --watch flag, then the post will be built with an incorrect timestamp, namely midnight on the current date.

    Example: Having jekyll build --watch running, run the following:

    cat << EOF > _posts/$(date -I)-test.md
    ---    
    layout: post
    title: test
    date: $(date "+%Y-%m-%d %H:%M:%S %z")
    ---
    test
    EOF
    

    Instead of e.g. 2017-09-06 22:10:00 +0800, the timestamp will show 2017-09-06 00:00:00 +0800.

    Too lazy to write up a formal bug report, I used a sleep 1 as a workaround in my automation script.

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Six inches

    Growing up with SI units, the only times I am forced to use Imperial units of length is when I help my parents with their parking.

    Today my father was reversing his car after my mother and I got off. “Half a foot,” I announced as I looked from the side, estimating the distance between the car and the wall. My mother quickly responded, “That’s clearly less, it’s more like three to four inches.”

    After my father got out of his car, I invited him to take a look. “About eight inches to a foot,” he estimated.

    I went inside and took out a tape measure. It was exactly six inches (plus or minus 1/4 inches).

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    IT9睇Steins;Gate – 回應中出羊子《IT人睇命運石之門的悲哀》

    羊子寫開,我又寫吓,Steins;Gate 中唔合邏輯嘅嘢。Spoiler alert,未睇過Steins;Gate 嘅人,睇完先好睇呢篇文。

    利申:未玩Steins;Gate 0(諗住等睇咗動畫先),呢度提出嘅嘢唔排除喺0入面已經解答咗。

    36 bytes + metadata D-mail

    Steins;Gate 入面,因為某啲原因,每次send D-mail 只可以send 到共36 bytes 內文,加埋普通e-mail 嘅metadata。但其實一個正常嘅e-mail,每次嘅metadata 長度都可以唔同(例如:sender/receiver e-mail address 長度唔同),咁點解e-mail 內文會有固定長度限制?而唔係metadata 少1 byte 內文可以send 多1 byte?

    其次,其實metadata 係可以好長:

    Return-Path: <me@adrianiainlam.tk>
    Delivered-To: me@adrianiainlam.tk
    Received: from adrianiainlam.tk
    	by ibn5100 (Dovecot) with LMTP id vzEgG5eZqVliVAAAYrSuEQ
    	for <me@adrianiainlam.tk>; Sat, 02 Sep 2017 01:32:07 +0800
    Received: from localhost (localhost [127.0.0.1])
    	by adrianiainlam.tk (Postfix) with ESMTP id 5BB546C01119
    	for <me@adrianiainlam.tk>; Sat,  2 Sep 2017 01:32:07 +0800 (HKT)
    X-Virus-Scanned: Debian amavisd-new at adrianiainlam.tk
    Authentication-Results: adrianiainlam.tk (amavisd-new);
    	dkim=pass (1024-bit key) header.d=adrianiainlam.tk
    Received: from adrianiainlam.tk ([127.0.0.1])
    	by localhost (adrianiainlam.tk [127.0.0.1]) (amavisd-new, port 10024)
    	with ESMTP id Zhglg4P_20XC for <me@adrianiainlam.tk>;
    	Sat,  2 Sep 2017 01:32:06 +0800 (HKT)
    Received: from [223.16.86.123] (unknown [223.16.86.123])
    	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
    	(No client certificate requested)
    	(Authenticated sender: me@adrianiainlam.tk)
    	by adrianiainlam.tk (Postfix) with ESMTPSA id 7256A6C005E6
    	for <me@adrianiainlam.tk>; Sat,  2 Sep 2017 01:32:06 +0800 (HKT)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=adrianiainlam.tk;
    	s=mail; t=1504287126;
    	bh=mV+Uarv6OWKOrBAKu7qk7/n4hFIO3UyDJqQiJD7YWAA=;
    	h=To:From:Subject:Date:From;
    	b=mp5lviODOsd23ViXB5korIInYAJKkjlptmh5WjsJ43ri/cViqEnpz3Z9W9DBAuFg7
    	 jLi/brhbRNgl0fGpSMTwcazzQUFDwSIqNkKFliCif7uusXKimQJkjNwP9oyJ4jakaV
    	 IQNwt3iuTA9EjXhy1xSYO/CwuGAoRyM9mUPcj9eE=
    To: me@adrianiainlam.tk
    From: Adrian I Lam <me@adrianiainlam.tk>
    Subject: Hey Mister
    Message-ID: <7711326e-2bfb-664e-0902-41543ec6d00e@adrianiainlam.tk>
    Date: Sat, 2 Sep 2017 01:32:05 +0800
    User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
     Thunderbird/52.2.1
    MIME-Version: 1.0
    Content-Type: text/plain; charset=utf-8
    Content-Transfer-Encoding: 7bit
    Content-Language: en-US
    
    I am mad scientist.
    It's so cool!
    Sonuvabitch.
    

    以上e-mail 為例,真正內文只有最尾 “I am mad scientist” 去到 “Sonuvabitch” 三行,其餘全部都係metadata。既然send 到咁多嘢,點解(以Super hacker Daru 對電腦嘅認識)會冇人諗過運用metadata 再send 多啲嘢?例如:自己host 個postfix+dovecot,send 出時用個DKIM-Signature 裝多啲嘢,收e-mail 時再decode 返。(當然只適用於send 到發明電話微波爐(偽)之後時間)。

    用黑洞壓縮information

    呢點應該唔使我多講,compress information 係要用algorithm(要計數),compress matter 要用力。黑洞係唔識計數嘅,只係有好大力啫。

    Time leap 到發明Time leap machine 之前

    呢點喺第一點亦略有帶過,即使假設佢哋有方法將兩日嘅記憶壓縮到36 bytes,請問佢哋解壓器喺邊?佢哋最多只可以喺發明Time leap machine 之後(或其間)先設計解壓器,亦即係話發明Time leap machine 之前,鳳凰院凶真部手機係冇可能將佢嘅記憶解壓,亦即係冇可能time leap 到發明Time leap machine 之前。

    結論

    睇Steins;Gate,唔係睇佢點樣發明部時光機,而係睇佢點樣部時光機。

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Planned Facebook account closure

    Now that my blog is up and running, I do not plan on keeping my Facebook account forever. As such, over the next two years I will progressively reduce my usage of Facebook. This can be summarized in two phases:

    Phase 1

    From now until 2018-09-01, I will gradually reduce the time I spend and the interactions I make on Facebook. I will delete (and in fact have already been deleting) a number of old posts. Interesting posts may be migrated to this blog. New posts will be posted here, and a link to the post will be posted on my Facebook account.

    Phase 2

    On 2018-09-01 I will enable Facebook’s email notifications. Afterwards I will not actively log on to Facebook, except to respond to notifications. On 2019-09-01 I will delete my Facebook account.

    Reasons

    Reducing third-party service dependence

    I would like to reduce my reliance on third-party centralised services. This is also the reason why I am hosting this blog on my own server (not on e.g. WordPress), and I am running my own email server and gradually switching from Gmail.

    Better functionality

    I have greater freedom here on how I want my posts to look like. I can bold text, colourize text, insert inline pictures, and much more. I can also easily find my old posts, either by time or by keywords.

    Facebook’s UX just sucks

    I’ve been using Facebook for 6 years, and have unfriended 100+ people. A few days ago as part of my plan to reduce my Facebook usage, I unfriended someone.

    Facebook decided to show me this. Six times. Six.

    Facebook unfriend notice

    This does not end here. Every time someone liked or commented on my public posts I get a notice to “review my privacy settings”. And every time I choose to read “Most Recent” stories on News Feed, it gets reset to “Top Stories” on page refresh.

    I am also getting tired of seeing all these “Sponsored” posts. I mean, I get it, you need to make money. But can you not show me the same post 10+ times? Once on my Kindle I’ve even had a page with more ads than actual posts.

    Waste of time

    I find that I waste too much time reading about things that I don’t care.

    Other ways of contact

    You may contact me using the following methods, listed in order of preference.

    Email

    My primary (preferred) email address is me@adrianiainlam.tk. This is hosted on my own server, so there may be downtimes. For really important emails you may consider ail30@cam.ac.uk (available for the next two years) or adrianiainlam@gmail.com.

    Where possible/reasonable I will sign my emails. You can also encrypt emails to me. My public key is available here and also on pgp.mit.edu.

    RSS

    If you want to follow my blog posts, you can do this via RSS. You are also more than welcome to send me a link to your own blog if you have a feed or a mailing list.

    IRC

    If you are looking for me to just chat and kill time, I am often online on Rizon, using the nick “ail30”.

    Instant messaging / VoIP / Video call

    I have started trying Ring, using the username “ring:adrianiainlam”. I have no idea how well it would work, and more downtime is expected as I run this on my notebook, not my server. Update 2019: Stopped using Ring, now using Matrix, with username @adrianiainlam:matrix.org.

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    People lie on Facebook

    20233107_1403052436438700_5587278572107577775_o_1403052436438700.jpg
    (Signature)

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    DoS via crafted response

    First in queue outside full restaurant. Parents waiting outside queue.

    Table for 2 becomes available.

    Waiter to me: Table for 2?

    Me: No, 3.

    Waiter to 4th person in queue: Table for 2?

    4th person: Yes.

    Waiter skipped the pair after me and brought the next pair in.

    Me: This restaurant is vulnerable to denial-of-service via crafted response.

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    HK Government public API

    19575170_1386513814759229_6583409030855907554_o_1386513814759229.jpg
    (Signature)

    Let’s host a public API without enabling CORS!

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Spinner on CSS

    1349639491779995.jpg
    (Signature)

    So I saw this article, and I thought… Why would someone make an app for this? What about people not using iOS or Android? Surely such a simple task can be done in a more cross-platform compatible way… And so here it is: Spinner on CSS.

    Preview clipped. Expand | Read full post in new tab

subscribe via RSS