Measure per-letter dimension of text in JavaScript TL;DR: Create a Range, set proper start and end points up to the text node with proper offset, then use Range.getBoundingClientRect() to get the dimensions. As a part of the Lyricova Jukebox, we wanted to support inline karaoke swipe animation. With the time tags in the data, it is easy to figure out the time when the animation must reach a certain character. Then we need to figure out a way measure per character dimension for the animation to work. Continue reading Measure per-letter dimension of text in JavaScript
How LyricsX keeps track of progress of media players LyricsX is an open source software for macOS to download and display lyrics of current playing track on Music (previously iTunes), Spotify, Audirvana, Vox, Swinsian, or the Now Playing indicator in the OS. It gets time-tagged lyrics files from local storage or internet, and then display the lyrics in sync with the player. As a crucial component of the development of Lyricova Jukebox, I have researched multiple implementations of real time lyrics display programs, and I found the mechanism behind LyricsX particularly interesting. Here in this article, I’d share with you how LyricsX tracking the player progress in a unique and resource-saving way. Continue reading How LyricsX keeps track of progress of media players
Tonguess: Solver and Traffic Analysis Similar to the last post I did on a mobile game, this time again is another online battle game from Baton and QuizKnock — Tonguess (Android, iOS). In short, Tonguess is a word version of Bulls and Cows, once played by members of QuizKnock in a video. Continue reading Tonguess: Solver and Traffic Analysis
Switch Galaxy Wearable Store Location using XPrivacyLua Update 6 July 2020: Added alternative method using Riru Location Report Enabler. Galaxy Wearable Store (GWS) is the app store for Galaxy wearable devices of Samsung. GWS is strongly region-dependent, just like other aspects of the device (you have to do some software hacking for a device purchased in one region to use Samsung Pay in another region). Being able to run with non-Samsung devices means that it cannot rely on the region-of-sale on the phone (and for some reason they didn’t choose to use the region of the device), GWS decided to use the region of your SIM card on the device to determine the store location. Continue reading Switch Galaxy Wearable Store Location using XPrivacyLua
Monitor Connected Devices to an ASUS Router Using Raspberry Pi Title should have explained it all. A simple Python script to monitor if a certain device has connected to the router via Wi-Fi, and send notifications accordingly. You can use this script for whatever purpose you want2I used it to monitor whether my parent has left home when I am “seemingly asleep”. , though probably you might not be able to find one like most of others. To use this script, you need SSH access to the router, something in your LAN that is always running (in my case, a Raspberry Pi), and the list of MAC addresses to monitor. In this example, I am using an Asus RT-AC1200GU as the router. Other brand or make might need a different command. Continue reading Monitor Connected Devices to an ASUS Router Using Raspberry Pi
Sync Tweets to a Telegram Channel Using Account Activity API Yet another post that has something to do with Telegram. Yeah, I know, but there’s never such thing as too much when you talk about blog articles. A lot of people around my Telegram circle has been maintaining their own channels, and a lot of them has had a few hundreds or even thousands of subscribers. I think that I may make one too, but I also don’t want to give up with my Twitter account which is more accessible to search engines. So why not sync my tweets to the channel? Given the openness of both Telegram and Twitter, this shouldn’t be much of an issue. Continue reading Sync Tweets to a Telegram Channel Using Account Activity API
Read and Write Tags of Music Files with FFmpeg In both my previous and recent projects, I have been working with tags (metadata) of music files. One of the reason being I am rather particular about having a nicely organised library with all tag data aligned to the same format. Until recently while I was seeking for a solution to read and write tags of (potentially) all music formats2I only have MP3, FLAC, AIFF and M4A in my library, so that’s kinda all for me., and I encountered FFmpeg, the Swiss Army Knife of media processing. FFmpeg has always been my go-to solution for processing media programmatically or in batch, and I have recently found the way to write into the tags of music files using it. The way of doing so might be a little verbose as everything have to fit into the command line interface with other components. Continue reading Read and Write Tags of Music Files with FFmpeg
Translate Text in Sphinx Templates and Configurations Weeks ago when I was playing around with the docs of EFB and the Crowdin translation widget, I realized that the default theme for Sphinx — Alabaster isn’t really doing well in term of translation. It seems like the author isn’t really confident on that (or simply didn’t care since 4 years ago). As the theme itself is open source, and Sphinx is flexible enough, couldn’t we just translate it ourselves? It turns out that things are not that complicated. Continue reading Translate Text in Sphinx Templates and Configurations
How to Write Integration Tests for a Telegram Bot This is my 6th article on Telegram, the IM platform of my preference. In this article I’m going to introduce about how I wrote the integration tests for my EFB Telegram Master channel — a Telegram interface for EFB, using a userbot-like strategy. To get started, you need to have a bot ready to be tested, and a Telegram client app key that is registered with your account. While alternative tools are available, we will be using Telethon and PyTest in this article. Continue reading How to Write Integration Tests for a Telegram Bot
Awesome Command Line Tools This is a list of awesome command line tools collected by SelfhostedServer. They have provided a detailed article for each of the tools in their paid membership subscriptions. The list below is based on the list of article titles from SelfhostedServer which are freely available, and attached with a short description from each project. If you are interested in reading more about these tools, I’d recommend you to subscribe to the articles on SelfhostedServer (in Chinese). Continue reading Awesome Command Line Tools