Skip to content

Instantly share code, notes, and snippets.

@fardjad
fardjad / exposing-ports-of-a-running-container.md
Last active December 2, 2025 23:45
[Exposing Ports of a Running Container] A method for exposing Ports of a running Docker container without having to recreate it #blog #docker #socat #stdio #tunnel

Exposing Ports of a Running Container

When running containers with Docker Compose, I sometimes want to access an unpublished port from a dependency container. For example, I sometimes need to connect directly to a database running inside a compose stack. The usual solution is to edit (docker-)compose.yml and recreate the container with a published port. This works, but it is disruptive when the service is already running.

After experimenting a bit, I discovered a simple trick to expose container ports without recreating the containers. I'll document that in this post.

Mapping Ports Through Standard Streams

Docker makes it easy to run arbitrary processes inside an existing container by using commands like docker exec or docker compose exec.

@fardjad
fardjad / !modern-typescript-app-no-build.md
Last active January 25, 2025 11:14
[Shipping A TypeScript Frontend App Without a Build Workflow] Exploring the idea of shipping a modern front-end application written in TypeScript without a build workflow #blog #frontend #typescript #nobuild #serviceworker

Shipping A TypeScript Frontend App Without a Build Workflow

I was once working with a client, and our team was facing a mix of technical and non-technical challenges in shipping a relatively simple web application. During one of our meetings, I cracked a silly joke: "At this rate, we might as well zip up the source code and send it to anyone who wants to try it." (note for the reader: our users were non-developer colleagues from the same organization)

Of course we chuckled and we moved on. But later, I found myself aching to try that silly idea out. Or a refined version of it:

@fardjad
fardjad / how-to-create-a-template-vm-disk-image.md
Last active January 4, 2025 17:32
[TIL: How to Create a Template VM Disk Image] A short guide to creating custom disk images using virt-sysprep #blog #til #vm #template #virt_sysprep

TIL: How to Create a Template VM Disk Image

While experimenting with dqlite, I needed to create multiple virtual machines from a custom template to manually test a few scenarios. cloud-init combined with one of the cloud images from here would have worked, but I wanted to avoid waiting for the VM to boot and configure itself each time I spun up a new instance.

After some research, I discovered virt-sysprep, which turned out to be the

@fardjad
fardjad / !simple-remote-backup-solution-for-linux.md
Last active September 14, 2024 22:33
[Simple Remote Backup Solution for Linux] Periodically backup a list of directories to an NFS share with Tailscale and Restic #linux #systemd #restic #nfs #tailscale #backup
@fardjad
fardjad / the-fence-is-in-your-mind.md
Last active September 3, 2024 09:35
[The Fence Is in Your Mind] A satirical depiction of an experience I had in an IT organization #blog #satire

The Fence Is in Your Mind

[!NOTE] This is a satirical depiction of an experience I had in an IT organization. The point is to share the same message with a broader audience. Obviously, convincing people to make big changes requires patience, perseverance, and long-term support.

Today, I had a conversation at work which reminded me of the 2000 animated adventure comedy, Chicken Run. Here’s how that conversation would look like if

@fardjad
fardjad / taming-an-onyx-tablet.md
Last active November 4, 2025 09:57
[Taming an Onyx Tablet] The documented process of securing my Onyx Boox tablet #blog #onyx #boox

Taming an Onyx Tablet

Onyx tablets reportedly phone home and send "data" to some servers in China. The manufacturer apparently refuses to publish the source-code modifications to the OS and the open-source apps they are using and they even go as far as violating GPL.

Of course I learned all that after buying this tablet. To ease my mind, I spent some time debloating it and then blocked the outgoing traffic to

@fardjad
fardjad / considerations-for-running-postgres-on-nfs.md
Last active November 3, 2025 18:49
[Considerations for Running Postgres on NFS] Considerations for running a Postgres database on an NFS share #blog #postgres #nfs #fsync #fsexport #mount

Considerations for Running Postgres on NFS

Background

Over the weekend, I decided to try running a Postgres database in my Homelab. In my current setup, the most convenient option for storage is NFS. However, NFS is especially tricky for databases. A misconfigured setup can lead to performance or data corruption issues.

After watching

@fardjad
fardjad / debugging-and-authoring-helm-charts-and-post-renderer-hooks-with-viddy.md
Last active July 28, 2024 14:33
[Debugging and Authoring Helm Charts and Post Rendering Hooks with Viddy] Efficient helm template writing and troubleshooting with Viddy #blog #helm #viddy #watch #kubernetes #yaml #less #pager

Debugging and Authoring Helm Charts and Post Rendering Hooks with Viddy

Helm CLI comes with a template sub-command that outputs the YAML it generates without installing the Chart. This is very useful for debugging templates and writing Post Renderer scripts.

Here is a basic example to illustrate its usage:

helm template --generate-name /path/to/your/chart/directory --post-renderer /path/to/your/post-render.sh
@fardjad
fardjad / faas-cli-multi-platform-run.md
Last active October 16, 2023 19:50
[faas-cli Multi-Platform Run] Example of running a function on open-faas/faasd with faas-cli #faas_cli #open_faas #faasd

Steps

DOCKER_REGISTRY="registry.example.com"
PROJECT_NAME="hello-world"

# List the templates
faas-cli template store list --official --recommended --verbose=true

TEMPLATE="node18"
@fardjad
fardjad / find-node-by-line-number-in-node-tree-sitter.md
Last active November 20, 2024 16:18
[Find node by line-number in node-tree-sitter] An example of finding a node by line-number with node-tree-sitter #TreeSitter #Node

Example

Requirements

  • Node.js 18+
  • tree-sitter
  • tree-sitter-cpp

index.mjs