How to run synchronous code with asyncio

[2023-09-29 Fri 12:17] Suppose you’re experimenting with Playwright through Jupyter for HTML scraping, you’ll notice that Playwright offers two types of APIs: sync_api and async_api. (Playwright | Playwright Python) from playwright.sync_api import sync_playwright import asyncio from playwright.async_api import async_playwright The trend is towards using the async API, but several libraries are yet to catch up or might prefer to stick to sync. There’s no inherent issue with sync API. The idea is to understand and utilise the APIs differently to suit our needs.
Read more →

Firestore maintainance

Recently, while working on a Firebase project, I realized the need for a tool that can perform backup and restore for Firestore databases, as well as extract production data for local or staging environments. While there is a commercial project, Firefoo - The Powerful GUI Client for Firebase Firestore, which is easy to use, it’s quite slow and automation may not be possible. However, there is an official way to achieve this by using the gcloud command.
Read more →

Decluttering org headings: Removing extranous IDs

If you’ve ever tried to use dengste/org-caldav: Caldav sync for Emacs orgmode to synchronize your org calendar, you may have noticed that it adds an ID to all headings by design. For some, these extra PROPERTIES blocks can be quite distracting. To address this, I proposed a patch to create IDs for only relevant headings here: https://github.com/dengste/org-caldav/issues/227. However, if it’s already too late, here is a script to clean things up.
Read more →

A fennel REPL for Hammerspoon

The Fennel programming language is one of my favorite programming languages. It gets a lot of things done right: Modern syntax (Clojure-like, but better) Immutable by default Excellent pattern matching If I ever find myself working with a Lua interpreter (Hammerspoon, Neovim, TIC-80, etc.), Fennel is often my go-to for concise and efficient code. The question is, can I have a REPL for Hammerspoon? There are multiple options available, like nREPL via jeejah, but I find it limited compared to the REPL that comes with fennel-mode.
Read more →

One-liner to enable Touch ID for sudo

You may already know how to enable Touch ID for sudo already, but it’s constantly getting disabled after each update of macOS. This one-liner is a no-brainer to enable it again. Basically, type it once in your terminal, and type ‘^R pam.d ENTER’ to enable it again once needed and it will be enabled again. sudo sed -i '' '2i\ auth sufficient pam_tid.so ' /etc/pam.d/sudo
Read more →