RSSAmplifier

Blog

Kashyap’s blog

Kashyap's Blog

kgrz.ioRSS feed ↗10 posts

Latest posts

Rewrites outside location blocks in Nginx are bad!

Here's a PSA of sorts: 1. Try not to have `rewrite` rules outside of a location block in Nginx. 2. Prefer named routes for jumps or internal redirects in configs like `error_page` instead of normal URLs/paths. These cause multiple rounds of regex matches that tank system performance even (and especially) in the simplest cases.

Go can only read 1GiB per Read call

There's a 1GiB limit for a single `Read` call for an `os.File` entity (object? struct?) in Go, and this seems to be a deliberate choice.

classnames library composes well!

I love classnames library!

Node has native CLI argument parsing

I knew this was in the works, but wasn't aware this was shipped with v16! (released in 2022). This is so useful for small cli scripts.

Using CSP in report-only and enforcement mode

I wanted to test out and understand how multiple CSPs on a single page work, and this post is about that. Not only can you use multiple CSPs, but it can be used to kind of pseudo-monitor everything that happens on the page.

TIL: Vim’s search is backed by a register!

When you search for a pattern in Vim, it’s stored to the / register. This then can be used to store the query in some variable for some Vim command, or perhaps paste the pattern as text. For example, the following invocation in normal mode:

The state in Ansible’s docker container module

present in Ansible's state setting in docker_container module means create container, started means run the container

Minus zero in Ruby and JavaScript

From Daniel Lemire’s recent-ish blog post on this topic:

Safari custom user agent CSS overrides using webfonts

Safari doesn't allow loading local user-installed fonts, so you can't add a custom stylesheet with that font. Easy way to circumvent this is to use a webfont.

Flattening and Filtering JSON for Cleaner Types in Go

Before I grokked the `Unmarshaler` interface, it was hard to know how to parse a complex JSON string into a type in one-shot, with or without preprocessing. I go through an example to demonstrate one technique.