Posts

  • | 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

  • | Source | Signature

    自願無償捐血

    blood-donation.jpg
    (Signature)

    之前有人捐活肝,有某NGO 捐十萬俾佢,俾人鬧到媽媽聲 (e.g. see the comments in https://www.facebook.com/tang.earthquake/posts/1344050939003853) 而家有人破壞香港恆之以久嘅無償捐血制,危害血液安全,某網媒竟然大肆宣揚,話係「員工福利」,出埋公司全名幫人賣廣告,「高層嘅回應相當幽默!」將一件相當危險嘅事加以美化

    Ignorance can kill.


    World Health Organization (2010). Towards 100% voluntary blood donation: A global framework for action. Ch. 2 (excerpt). ISBN: 978 92 4 159969 6. Available: http://www.who.int/bloodsafety/publications/9789241599696_eng.pdf

    A voluntary non-remunerated blood donor gives blood, plasma or cellular components of his or her own free will and receives no payment, either in the form of cash or in kind which could be considered a substitute for money. This would include time off work other than that reasonably needed for the donation and travel. Small tokens, refreshments and reimbursements of direct travel costs are compatible with voluntary, non-remunerated donation.
    […]
    Voluntary blood donors, particularly regular donors, are the first line of defence in preventing the transmission of HIV, hepatitis viruses and other bloodborne infections through the route of transfusion. A number of studies have reported significantly lower prevalence of transfusion-transmissible infection markers among voluntary donors compared with other types of donors, with the lowest rates among regular donors.
    […]
    People who accept payment for their blood are primarily motivated by the prospect of monetary gain rather than a desire to help save lives. The need to protect their income from blood “donation” compromises issues of honesty in the donor interview and they are highly unlikely to reveal reasons why they may be unsuitable to donate blood.

    (Emphasis mine)

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    On the legality of torrent trackers tracking copyrighted materials

    A: Hey have you seen my wallet? It has the words “Bad Motherfucker” on it.
    B: Yes the person over there with the gun told me he has it. The person next to him told me he wants it too.
    A: Thanks man.

    C: Hey have you seen my CD pirated as a torrent? It has the info-hash “a8fdc205a9f19cc1c7507a60c4f01b13d11d7fd0”.
    D: Yes the computer over there at IP address “101.202.3.4” told me it has it. The computer at “203.4.37.1” told me it wants the CD too.
    C: sends cease-and-desist letter to D

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Recycling a tin can

    recycling-tin-can.jpg
    (Signature)

    We ignore that the claim has no source cited and assume it is true. I arbitrarily chose the Samsung UA32K4000ARLXL. Its maximum power usage is 72 W.[1] Accounting for older (and thus presumably less energy efficient) models we estimate the average power usage of a TV to be 100 W. Operating for 3 hours, this TV would consume 300 Wh of electricity. The total energy consumption per person in the UK is estimated to be 125 kWh per day.[2] This implies that recycling the tin can saves 0.24% of the energy we use daily. In alternative units, one needs to recycle more than 400 tin cans per day to be “energy neutral”. Cf. PET plastic water bottles, which we need to recycle 255 per day.[3] The two values having the same order of magnitude gives some credit to the original claim.

    [1]: http://www.samsung.com/in/tvs/hd-k4000/ [2]: Mackay, D., Sustainable Energy - without the hot air (2008). [3]: Shercliff, H.R., Part IA Paper 2: Structures and Materials - Materials Examples Paper 4 - Strength-limited Design, Process Selection, and Environmental Impact of Materials (2014). CUED.

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    A0 -> O1 -> A1 ??

    其實呢個encoding 究竟係邊個發明,點解可以咁on9

    點解A 個domain 係ℕ 但係O 個domain 係ℤ₊

    點解A0 之後唔係O0 而係O1

    A0 跳O0 嘅話一個ripple carry adder 就得

    每次state change 就加1,LSB 拆出黎分A/O,淨低做value

    init() { status = 0; }
    onStateChange() { status++; }
    decode() {
        state = status & 1;
        value = status >> 1;
    }
    

    A0 跳O1 嘅話

    一係就要skip 一個status (init 做1 或者0 skip 去2)

    一係就改decode logic

    前者少咗一個representable value,後者用多咗logic gate

    Preview clipped. Expand | Read full post in new tab

subscribe via RSS