Posts

  • | Source | Signature

    O記

    ocb.jpg
    (Signature)

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    TATP

    tatp.png
    (Signature)

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Apple Daily login bypass -- GreaseMonkey

    Released under WTFPL.

    HK

    // ==UserScript==
    // @name        HK Apple Daily login bypass
    // @namespace   0x97ED093989537541
    // @description HK Apple Daily login bypass
    // @include     https://nextplus.nextmedia.com/article/*
    // @include     https://hk.video.appledaily.com/actionnews/*
    // @include     https://hk.*.appledaily.com/*/realtime/article/*
    // @version     1.0.1
    // @run-at      document-end
    // @grant       none
    // ==/UserScript==
    
    var node = document.createElement('script');
    node.innerHTML = 'function uReadDisplayMsgBox() {}';
    document.head.appendChild(node);
    

    TW

    // ==UserScript==
    // @name        TW Apple Daily login bypass
    // @namespace   0x97ED093989537541
    // @description TW Apple Daily login bypass
    // @include     https://tw.appledaily.com/*
    // @version     1.0.1
    // @run-at      document-start
    // @grant       none
    // ==/UserScript==
    
    var node = document.createElement('script');
    node.innerHTML = 'const paywall = function(){};';
    document.head.appendChild(node);
    

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Octave vs MATLAB

    Top mysteries of the world:

    1. Octave can export plots to LaTeX, MATLAB can’t.

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    When you're cold but the radiators are broken

    ace@e520:~$ python3
    Python 3.5.2 (default, Nov 12 2018, 13:43:14)
    [GCC 5.4.0 20160609] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> while True:
    ...  pass
    ... 
    
    

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Reed-Solomon code on a chessboard

    Prisoners smart enough to use Reed-Solomon code with rate 3/7 bits/symbol and erasure probability > 13%, not smart enough to use a subset of inputs to get rate 2 bits/symbol and erasure probability = 0?

    rs1.jpg
    (Signature) rs2.jpg
    (Signature)

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Odd one out

    odd-one-out.jpg
    (Signature)

    A because all the other shapes are convex, B because it has no right angles, and C because it only has four sides? How am I supposed to know what criteria to use?

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Musical Christmas lights on Arduino

    (Signature) | Video released under CC BY 4.0.

    The nice thing about Christmas holidays is that you actually have the time to make shower thoughts a reality.

    Materials

    • 1 × Arduino Uno. It will also work on other Arduinos (subject to pin number changes), and should also work on other boards, as long as there are 3 digital GPIO pins that can sink ~30mA, 1 PWM output pin, and a 5V rail.
    • 3 × red LEDs, 3 × yellow LEDs and 3 × green LEDs. I’m using whatever comes with the Arduino kit. It should work if it drops ~2V drawing ~10mA each. The code can be easily adapted if you want to add more colours, as long as you have three LEDs for each colour.
    • 3 × 100Ω resistors. I don’t have them so I’m using two 220Ω resistors in parallel to replace each 100Ω.
    • 1 × passive buzzer or speaker. I’m using a KC-1206 which came with the Arduino kit, but I’ve also tested an AST-030C0MR-R (which came with the Chaotic Oscillator kit) and a 4Ω 3” speaker (part number starts with EAS8 but the rest is illegibe due to rust) which I scavenged from an FM radio receiver.
    • A breadboard and a bunch of breadboard wires.
    • A power supply. I’m using USB.

    Schematics

    schematic.png
    (Signature)

    gEDA schematics: xmas.sch (Signature), arduinoUNO.sym (Signature), speaker.sym (Signature).

    Code

    A score for the song was looked up and its melody was written out as an array of the standard pitches in int song[]. int durations[] has the same length as song and denotes the relative length of each note. int durationScaleFactor controls the tempo of the song.

    Arduino code: xmas.ino (Signature), pitches.h (Signature).

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    磁能線,連政府都玩啲咁嘅嘢

    comment-for-file.jpg
    (Signature)

    佢俾人comment插完,兩個post後直接貼咗條link出嚟。如果唔係我真係寫公開資料request都唔會comment

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Thunderbird 60, RSS feeds, HTTP 429, and `close_connection`

    So, Ubuntu finally pushed Thunderbird 60 to the repos.

    Which was great, because it broke so much stuff for me.

    Setting aside the new icon theme (unusable due to clashing colors with a lightweight theme), the most major problem was a behavior change in how the RSS feeds were updated.

    I had two groups of feeds, one for news / security notices etc. which is configured to update every 30 minutes, and another for blogs / leisure reading, updating every 24 hours. This new version decided for some reason to change them all to 100 minutes…

    But that’s not all. I had a website in my daily feeds that provides multiple feeds, i.e. /rss?user=alice, /rss?user=bob, /rss?search=keyword, etc. They have also configured rate limiting in their server, which means that every 5 or so request would get an HTTP 429 (Too Many Requests). Previously this wouldn’t be a problem – due to network latency or other factors, it would probably not be the same feed getting the 429 every time. So perhaps I’ll see it a few days late, but no big deal.

    But Thunderbird 60 decided that when a feed receives a network error, it should “pause” a.k.a. disable the feed, meaning that it would not check for updates for that feed ever again. Like, what?

    So I figured the easiest way to “fix” this, would be to just write an HTTP proxy running on localhost, which would throttle the requests (ensure at least 100ms between each) to the server. This was done quite easily using Python.

    Half an hour of coding and reading the docs later, I changed the URLs of the feeds to point to my proxy, and tried again. It didn’t work. Specifically, only the first 4 feeds worked, and the later feeds all timed out for some reason. It turned out that the BaseHTTPRequestHandler class doesn’t automatically close connections, and I never realised it because I’ve almost always run it multi-threaded.

    Preview clipped. Expand | Read full post in new tab

subscribe via RSS