Here are things I learnt when building applications using serverless functions (primarily Cloudflare Workers, previously GCP Functions) and edge/distributed databases (Turso, Cloudflare D1, Neon).
Cloudflare Worker's Bindings in tRPC
When using Cloudflare Workers, the main selling point is you can integrate with a lot of other Cloudflare APIs, like D1 (database), R2 (storage) and Durable Objects (websockets), and more. However, there isn't any documentation on how to do that.
Why you shouldn't pay into a pension
I've been opting out of my pension within a few months of starting a job at any company. Every time, it's taken considerable thought and confusion. It seems like every few months a ridiculous event occurs, related to pensions. I wanted to share why I stopped contributing to pensions so others can make a more informed decision. I wish I had seen such an article in the past.
tRPC, Astro and Cloudflare Workers
I haven't seen if Astro, tRPC and Cloudflare Workers go well together. I found myself asking: must tRPC be in a separate package/deployment (e.g. packages/
in a monorepo, or separate Cloudflare Worker). I also managed to get Cloudflare bindings to work (e.g. D1, environment variables, R2). I'm pleased to say it's relatively straight forward - there are a few options.
Alternative Cargo Registry authentication workaround
This is a workaround to authenticating with an alternative cargo registry like Artifactory, a feature that is not yet available in Cargo.
Docker Compose, quickly
This is a quick, practical guide to get you started. A common issue I notice in projects that use Dockerfile
's is that they don't easily run on developer machines and don't work across operating systems and IDEs (Visual Studio Code, vs. PyCharm, vs. Command line).
Replacing SSH over Cloudflare with Tailscale
I wrote SSH into your private machines from anywhere, for free, using Cloudflare Tunnel in April which led to a lot of discussion on Hacker News. A lot of people started mentioning alternatives (Tailscale, ZeroTier and issues with Cloudflare).
Syncing Obsidian Vault on macOS and Android, for free, using git
Motivation 💪
You have been using Obsidian to store your notes. I highly recommend it if you don't - in that case, come back to this page later.
Your current solution to write notes is to use a separate app or separate Obsidian Vault on your phone. After you reach your computer, you manually copy and paste data into your primary Obsidian Vault. I previously used Google Keep for temporary notes, which were moved into Obsidian Vault when I found the time.
Update: I no longer use git to sync my Obsidian Vault. This is because manually resolving conflicts between my notes and
.obsidian
files using git and Termux is tedious on a small screen and a touch keyboard. Now, I pay for Obsidian Sync. I am planning on trying Syncthing soon. I also now trust GitHub (Microsoft) less with my private notes. See Copilot regurgitating Quake code, including sweary comments for some discussion.
SSH into your private machines from anywhere, for free, using Cloudflare Tunnel
Outcome
By the end of this post, you'll be able to run: ssh $machine_name
from anywhere in the internet-connected planet, using SSH keys. It is free and requires no future maintainance. This guide uses Cloudflare Tunnel, a service by Cloudflare with a free-tier. It will filter traffic to your machines through Cloudflare's network, including authenticating you. Because of this, your machines won't directly be exposed to threat actors and "1337 haxors".
This was discussed on Hacker News.
Playing Android device audio on macOS
Why?
Update: scrcpy 2.0+ supports Audio forwarding. You don't need sndcpy
anymore. Thanks Romain Vimont.
I want to listen to the instructor playing on an Android app (Fiit) on my speakers which are connected to my MacBook. I am already sharing the screen of my Android on my MacBook by using scrcpy
, a tool by Romain Vimont. sndcpy
lets us to do this, also a tool made by Romain Vimont. The naming of these tools were inspired by C library function, strcpy
, which copies strings between memory locations.
You want to play music or app sounds on your Android device on your macOS, and
- You are displaying your Android screen on the mac already, but you want sound too
- Your Android device doesn't have an audio jack
- Your speakers aren't bluetooth
- You don't want to use your headphones
- I do not want to sweat onto my headphones, or
- I want to share my music with others
- Your macOS is connected via AUX cable (or USB-C/HDMI) to speakers, so let's use them instead