Illustration for Troubleshooting a Linux Memory Leak

Troubleshooting a Linux Memory Leak

Root Cause I recently developed a VPS monitoring system using PHP, consisting of both server-side and client-side components. At 3 PM today, I added a service monitoring feature to check running services on VPS instances. Since all my VPSes run Debian 8, I used service --status-all to retrieve service statuses. After successful testing, I moved on to other tasks. Around 9 PM, I received an alert email from NodeQuery indicating high memory usage on one of my VPS instances since 7 PM. Checking my monitoring system, I found this VPS consuming 400M/500M memory. Another VPS showed even higher usage at 600M/1G, though it didn't trigger alerts due to larger total memory. The mystery was:...

Bilibili Danmaku Filter Tool

With the growing number of Bilibili users, many elementary school students have joined the platform and posted a large volume of danmaku that violates etiquette, significantly impacting other users' viewing experience. Many users have even turned off danmaku entirely because of this, but what's the point of using Bilibili without danmaku? I wrote a small program in Python 3 to filter out elementary school-level danmaku (this program also served as practice for a recent Python programming class). The code can be found at https://github.com/xddxdd/bilibili-dmshield . To use the filtering feature, you can either: Point the IP of comment.bilibili.com to 127.0.0.1 via the hosts file, or Use browser extensions like FoxyProxy or SwitchyOmega to route comment.bilibili....

Bilibili Bottom Danmaku to LRC Tool

Bilibili is never short of amazing works from talented creators, including original music, covers, and captivating "guichu" remixes. Sometimes we want to save these to devices that can play music with lyrics but not video (like certain MP3 players), or use them as background music while displaying lyrics on our desktop. The problem is, many excellent works can't be found in mainstream music apps. Even when available (e.g., on NetEase Cloud Music, rumored to have close ties with Bilibili), some tracks lack lyrics—especially new releases. But when you turn on Bilibili's danmaku, you'll find many volunteer "subtitle masters" have created bottom-aligned danmaku. By extracting the timestamps and content of these danmaku, we can quickly generate lyric files (like LRC)....

GetIPIntel Plugin for Typecho

An introduction to GetIPIntel can be found in this recent article . I've developed a Typecho plugin that blocks visitors using proxies from commenting or sends their comments directly to the spam bin. Features: Multiple mode options (Blacklist only, Quick Check, Full Check) Various handling measures (Manual review, Send to spam bin, Submission failure) Custom threshold The plugin can be downloaded at https://github.com/xddxdd/typecho-getipintel . Simply place the GetIPIntel folder into the usr/plugins directory....

GetIPIntel Anti-Fraud Service

You never know whether the person chatting with you online is a human or a dog. The anonymity of the internet greatly facilitates online fraud. A few years ago, several webmasters in a student webmaster alliance had their email addresses leaked. Troublemakers then used Go^_^Agent to impersonate them, using their common usernames and email addresses to harass other bloggers in the alliance, causing widespread chaos. The widely used Akismet clearly failed to help, and blocking IPs afterward proved ineffective (the troublemaker would hit-and-run). Popular anti-fraud services at the time, like MaxMind, required high fees that ordinary webmasters couldn't afford. But now,...

Illustration for Rummy Card Counting Program

Rummy Card Counting Program

In English class, our foreign teacher introduced us to the card game Rummy. This game has no official rules, so there are many variations among players. The rules our teacher taught us are as follows: The game requires at least one deck of playing cards, depending on the number of players, with all jokers removed. At the start, each player is dealt 7 cards. After dealing, flip the top card from the deck and place it aside. During each player's turn, they must perform the following actions: Choose to take the top card from the face-down deck or take any number of cards from the face-up discard pile. When taking cards from the discard pile, you must use the bottommost card you picked up during this turn according to condition 2 below. (Cannot keep it in hand or discard it)...

WoSign, Why Don't You Just Fly to the Sky!

Just saw on V2EX that someone exploited a vulnerability in WoSign's certificate issuance system to successfully issue a certificate for GitHub's main domain. https://crt.sh/?id=29647048 Certificate: Data: Version: 3 (0x2) Serial Number: 5d:8f:2b:91:ef:b8:dd:65:af:4c:c1:2b:15:ef:4b:6e Signature Algorithm: sha256WithRSAEncryption Issuer: commonName = WoSign CA Free SSL Certificate G2 organizationName = WoSign CA Limited countryName = CN Validity Not Before: Jun 10 05:42:44 2015 GMT Not After : Jun 10 06:03:35 2018 GMT Subject: commonName = schrauger.github.io Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (2048 bit ) Modulus: 00:e4:3b:a1:76:73:3c:b1:62:8d:53:6d:ef:a8:e9: 5b:9e:0e:15:63:e6:57:ac:cc:31:b3:48:2b:01:74: ae:d8:7d:1c:6b:ed:2a:40:45:36:62:83:ac:d7:a5: 80:...

A Javascript for time crowdfunding calculation

In the ancient Eastern land imbued with mysterious magical powers, each minute passes in 59 seconds. var toad = new Date () var secondsDonated = Math . floor (( toad . getTime () + 1368835200000 ) / 59000 ) toad . setTime ( toad . getTime () + secondsDonated * 1000 ) toad . toLocaleString () -1368835200 is the UNIX timestamp of his birthday, with additional zeros appended since JavaScript calculates time in milliseconds. By donating your time, you become equivalent to someone living in outside China. You and every individual have collectively donated seconds. This translates to years, days, hours, minutes and seconds. function crowdFund() { var toad = new Date(); var secondsDonated = Math.floor((toad.getTime() + 1368835200000) / 59000); $('#time-crowdfund-donated').text(secondsDonated)...

Support WebP on IE and Firefox

I wrote a PHP snippet to fetch high-resolution images from the website of the Himawari 8 satellite and combine them into one high-resolution image. The way to fetch satellite images is available here . However... The combined 4d resolution PNG image (2200x2200) is over 7 MB in size, and due to the bad connectivity between China and the US, it takes over a minute to load the image (from my server). Way too slow! Google provided a solution: the WebP image format. WebP is famous for its high compression ratio on lossless compression scenarios. After converting the 7 MB earth photo PNG file to WebP, the resulting file size is less than 700 KB. For a photo with resolution 2200x2200, this is pretty small. But... Some browsers, including IE and Firefox, don't support WebP,...

Illustration for Configuring Hurricane Electric IPv6 Tunnel on OpenVZ, Enabling the Entire Address Pool and Using it Alongside Native IPv6

Configuring Hurricane Electric IPv6 Tunnel on OpenVZ, Enabling the Entire Address Pool and Using it Alongside Native IPv6

AlphaRacks is a cost-effective hosting provider, offering VPS with 1 CPU, 512MB RAM, and 10GB storage for just $9.9/year. However, this provider is quite stingy with IPv6 addresses, requiring users to justify their need for IPv6. It's said they provide up to 20 addresses? But they may not allocate the full amount. For example, when I explained I needed IPv6 to serve IPv6-only users, the provider replied: We've added 1 IPv6 address to your VPS. A single IPv6 address is insufficient for my needs. Fortunately, Hurricane Electric in the US offers IPv6 tunneling services , providing each user with 5 tunnels. Each tunnel includes a /64 address pool, and users can instantly activate a /48 address pool with one click. Despite this generous service, using it on OpenVZ VPS requires extra effort....