Skip to main content

Posts

How to keep extension service workers alive in Manifest V3

In version 3 of the Chromium extension platform, persistent background scripts were replaced with ephemeral service workers. Their ephemeral nature makes it impossible to retain global variables, with the solution being to use the new Storage APIs to persist data. However, this is not possible with some data (e.g. class instances obtained from another library), and this model also prevents using event listeners from non-Chrome services (such as Firebase's Realtime Database). Luckily, there are many workarounds to this problem. The cleanest one as of Chrome 114 is to create an offscreen document that has access to the chrome.runtime API, allowing it to periodically "ping" the service worker every 25 seconds, just enough to reset the service worker's 30-second idle timeout. Please do note that this solution will only work in Chrome 109 and above. Step 1 Create the HTML and JS file for the offscreen document. offscreen.html <! DOCTYPE html > < html > <

Don't use Zorin OS.

You may have heard of a GNU/Linux distro by the name of Zorin OS . Here's why you should not  use it. 1. It's Ubuntu Zorin OS 16 is simply Ubuntu 20.04 with a few themes and apps pre-installed. However, because it's technically a different distro, none of the Ubuntu forums will help you. 2. They steal other projects Zorin OS includes software such as "Zorin Software", "Zorin Windows App Support", and "Zorin Connect", among many others. These three in particular are GNOME Software, (a GUI wrapper for) Wine, and KDE Connect, each with the Zorin UI theme. They don't even mention anywhere that these are not their projects or credit their respective authors (e.g. you can only recognise that it's GNOME Software from the UI or launch it through the command line with "gnome-software" to figure that out, or how the About view in the Connect mobile app has been removed). 3. They charge for free stuff I bought the Pro edition because it

How to use the Swift Package Manager in Replit

So, this excuse for an IDE called Replit doesn't have packages for Swift like it does for Python. We're not having that. Step 1 Create a new Swift repl . We want to make a simple program that looks like this, using onevcat's Rainbow package.   Step 2 Create your Package.swift file. This file defines the products, dependencies, targets and so on for a Swift package. Check out Swift's Package Manager guide for more details.   Step 3 Swift Package Manager looks for your sources in the "Sources/{{Package}}" directory. For a package called Testing, move your main.swift file to "Sources/Testing/main.swift". Step 4 Modify the .replit file to use the SPM when building and running.   It should look something like this. The first two lines have been changed.   Step 5 Smash that Run button and you should be good to go! If you get any errors mentioning "error: PCH was compiled with module cache path" after renaming the Repl, or running from the co

How to mention slash commands in Discord

Discord just released a new feature that allows you to mention slash commands, the same way you mention people or channels. Here's how you do it.

How to import a custom Curseforge launcher modpack into MultiMC

Do you use the Curseforge launcher to make custom Minecraft modpacks, but despair that you can't use them on Linux? Or just want to switch to MultiMC? This post will detail how you can use packs you made, in MultiMC.

How to write a Discord bot in Python using discord.py

Discord is the biggest chatting platform for all gamers and people in general out there, and there's no doubt that if you have Discord, you've seen a Discord bot. Everyone's seen Dank Memer, Dyno, Carl-bot, Ticket Tool, and many other famous bots, as well as servers' own custom bots, but how do you make one yourself? This article will guide you through making a Discord bot in Python using discord.py, a popular library/wrapper for the Discord API. It's also my first blog post :) Note: this tutorial was written for discord.py 1.7.x. That version is now discontinued, and while it still works as I write, Discord may change things in their API that stop it from working and you'll have to upgrade to v2.0.x (which you should anyway). TLDR; until I update this tutorial, you might want to look somewhere else.