RSSAmplifier

Blog

Steven Kalt

Recent content on Steven Kalt

/RSS feed ↗46 posts

Latest posts

Improving Spring Boot Configuration Security with Hashicorp Vault

The problem If you&rsquo;re using Spring Boot with Spring Data JPA , you&rsquo;ve probably got a configuration file like this sitting near your server: # application.yml spring : datasource : url : jdbc:mysql://mysqldb:3306/mydb username : root # <-- credentials password : password123 # <-- If you&rsquo;re a fan of 12-factor apps , you might draw the app configuration/database credentials from…

Implementing Regular Expressions in TypeScript Types (Badly)

Summary This is a cautionary tale about how I ended up writing a (bad) regular expression parser and evaluator in pure TypeScript types. type HexStr < S extends string > = Recognize < "[0-9a-fA-F]+" , S > ; type IsMatch < S extends string > = HexStr < S > extends S ? true : false ; const isHex : IsMatch < "deadbeef" > = true const notHex : IsMatch < "nope" > = false The novelty here is parsing and…

Parsing docker image references for fun and 0 profit

The problem I wanted to parse docker-style container image references for a personal project I was writing in rust. Ideally, I&rsquo;d use the authoritative parser, distribution/reference , which is written in Go. FFI between Go and rust is nontrivial; the examples I found involved a custom build.rs with C bindings , custom assembly , or embedding WASM into your binary. Rather than deal with any…

translating types with `FastAPI` and `OpenAPI`

TL;DR: Using mypy , pydantic , and FastAPI , I generate an openapi.yaml , then I use openapi-generator to create a typescript API client. This means I get an API client for free, and (mostly) preserve type safety across my tech stack! See also: https://fastapi.tiangolo.com/advanced/generate-clients/ Exposition: why FastAPI? At $DAY_JOB , I write a full-stack application. I wrote the backend in…

SQL is a convention

SQL is a convention. There are many RDBMS s that behave similarly and call themselves &ldquo;SQL databases&rdquo;. However, it&rsquo;s difficult to tell whether an application that works on one SQL database will work on another SQL database. Similarly, validating a new RDBMS against the SQL specification ( ISO/IEC 9075 ) would cost a nontrivial amount of time, effort, and money. At this point,…

The Grug-Brained Developer

TL;DR: we&rsquo;re all operating on the same hardware that cavemen operated on. Here&rsquo;s one modern caveman distilling lessons any caveman can understand based from a career in software development.

How it feels to use AWS

TL;DW: an enormous speed boost followed immediately by crashing straight into IAM&rsquo;s guardrails.

Portable Rust SIMD Beginner's Guide

TL;DR: A SIMD value is called a vector . [&hellip;] A SIMD vector has a fixed size, known at compile time. [ A] vector is generally aligned to its entire size. A single element position within a [SIMD] vector is called a lane The extra-wide registers that are used for SIMD operations are commonly called vector registers, [&hellip;] &ldquo;SIMD registers&rdquo;, vendor names for specific features,…

parsing psql

TL;DR: I wrote a bad psql meta-command parser so you don&rsquo;t have to. Get it at https://github.com/skalt/psql_splitter . I&rsquo;ve received incredulous looks after saying that my preferred way to manually interact with a a postgres database is with command-line psql . To be clear, I earned those looks: anyone looking over my shoulder at me working would be as bewildered as I was while I…

Practical Data-Oriented Design

TL;DR: A CPU has several kinds of memory. CPUs cache data in faster and slower memory as the data is used in computation. Reading from a slower cache tends to be more expensive than doing several math operations, even multiplication. Reducing memory usage can vastly speed up an application When possible, 8- or 16-bit integers instead of 32- or 64-bit pointers Using a struct of same-sized arrays…

ARCHITECTURE.md

TL;DR: add an ARCHITECTURE.md document to make contributing to your codebase easier for newcomers A high-level map of the codebase architecture helps newcomers find where to start reading An ARCHITECTURE.md document should cover: how different sections of the codebase work together things that don&rsquo;t change often (once or twice a year at most) Do name important files, modules, and types. Do…

`git-cc`: a TUI for conventional commits

a TUI for creating conventional commits.

Git scraping: track changes over time by scraping to a Git repository

I&rsquo;ve enjoyed using this technique! So far, I&rsquo;ve used it to monitor the changes to AWS&rsquo;s IAM action documentation .

No Hello

TL;DR: Instead of texting &ldquo;hi&rdquo; and waiting for a response, say &ldquo;hi&rdquo; and ask your question in one message.

submodule of a local branch

Ever wanted to check in your build artifacts into a build-specific branch? I used to do that to deploy my Github pages ( demo in my git history ). I had a git submodule in my website repo that pointed at a specific branch of my website repo. I&rsquo;d dump my built css/js/html into the subrepo and push it to deploy. This workflow let me get my static site online without messing with CI or figuring…

building HTML for each version of the linux man pages

If you want a dataset of HTML versions of the linux man pages.

microservices

TL;DR: a video of a typical microservices architecture meeting.

Hyrum's Law

With a sufficient number of users of an API, it does not matter what you promise in the contract: all observable behaviors of your system will be depended on by somebody. See also: https://xkcd.com/1172/

2019 holiday card: canvas pixel-art snow

My 2019 holiday card. I took inspiration from pixel art such as the Living Worlds series .

Parse, don’t validate

TL;DR: parsers take less-structured data and try to turn it into more-structured data. They don&rsquo;t always succeed, so all parsers need to handle failure. validating throw s away information as exceptions/errors, while parsing holds onto that information parsing inputs as early as possible helps you trust the validity of data once it reaches your business logic. Beware of &ldquo;shotgun…

What do executives do, anyway?

TL;DR: &ldquo;to define and enforce culture and values for their whole organization, and to ratify good decisions.&rdquo; That&rsquo;s all.

`jekyll_asset_map`

A set of jekyll _includes that allow you to use hashed assets from webpack or another asset wrangler in Jekyll without a plugin. Since Github pages don&rsquo;t allow custom plugins, this is the closest you&rsquo;ll get to using rails-webpacker in Jekyll. UPDATE : As of 2022-08-10 , you can build your GitHub pages with customized jekyll or other static site generators using GitHub actions.

Rewriting this site with Jekyll

Why bother? I wanted to clean up my previous site, and I wanted to try out Jekyll. I built the previous iteration of my site with minimalism in mind. This led to an unfortunate experiment in using emoji as icons. For posterity: that experiment failed. Different browsers support different emoji, display the same emoji differently, and apply CSS font color to emoji differently. I selected Jekyll for…

Monkey-testing Vue.js applications

monkey-see-monkey-vue exposes methods for finding events that Vue.js will react to. It&rsquo;s still a work in progress. Inspired by the excellent gremlins.js and Generating Software Tests by Zeller et al. .

`yapf-diff`: Incremental python formatting

A tool to help my team incrementally adopt consistent python style by formatting only changed lines.

Parallax snow globe

Inspired by the beautiful parallax of the Firewatch website , I made a SVG+SCSS parallax snow globe as a 2018 holiday card.

`flask-webpack`

Webpack and compilers can produce hashed asset bundles ( like index.bundle.md5h4sh3d.js ). Flask-Webpack provides global jinja2 templates that look up your your hashed bundles by name in an asset map.

Build Systems a la Carte

TL;DR: All build systems vary on the following axes: when the build system learns about dependencies (in the build specification or after doing some work) what information the system stores about previous builds where information about previous builds can be stored how build steps are scheduled (e.g. suspending, restarting, start-to-finish) whether the system does the minimum amount of work to…

Why Do Keynote Speakers Keep Suggesting That Improving Security Is Possible?

TL;DR: an in-depth talk by tenured Harvard professor James Mickens describing why unexplainable ML models will always be a security risk.

Scraping Mozilla Developer Network compatibility tables

Background Coming into 2018-19, Mozilla Developer Network (MDN) had crowdsourced HTML tables of compatibility between browsers and features of web standards. They then crowdsourced the conversion of these tables into JSON. I wrote a bookmarklet to scrape MDN&rsquo;s old browser compatibility tables. To use it, go to a MDN documentation page which needs modernization click the bookmarklet in your…

Converting images to ascii art in the browser

A tone-based image to ascii art tool. This project extends Jonathan Petitcolas&rsquo; work with typescript support and vue-based controls.

Use Boring Technology

TL;DR: Use tech your team is familiar with if it gets the job done shiny new tech has lots of unknown unknowns

Slicing geojson into `.mvt`

A tool that transforms geojson to filesystem pyramids of mapbox vector tiles ( .mvt ) using node.js .

Searching for the right mapbox icon

Mapbox provides an excellent selection of symbols for map-making with its Maki icon set. I built a quick Vue app to help me search and select icons for map-making.

Writing a WFS-T library in 2.6kb min+gz of js

A lightweight javascript module to format WFS-T-2 statements from GeoJSON features.

`geojson-to-gml`

I wrote a lightweight javascript module to translate GeoJSON to GML 3 or 2. This helps newer web GIS tools talk to older tools that rely on OGC GML, i.e. GeoServer .

Visualizing relationships between univariate probability distributions

An experiment visualizing Leemis and McQueston&rsquo;s Univariate Distribution Relationships chart .

How to ask good questions

TL;DR: do research state what you know ask factual questions

you can take the derivative of a regular expression?!

But we can describe some of the ideas in words. Let&rsquo;s say we have a regular expression which is supposed to match the strings (&lsquo;a&rsquo;, &lsquo;abab&rsquo;, &lsquo;aaaabb&rsquo;, &lsquo;bbc&rsquo;). The derivative of those strings with respect to 'a' is (&rsquo;&rsquo;, &lsquo;bab&rsquo;, &lsquo;aaabb&rsquo;) – you strip off the a from every string. It turns out (which is not totally…

Is It Worth the Time?

TL;DR: quickly calculate how much time you&rsquo;d save before automating a task.

A Few Billion Lines of Code Later: Using Static Analysis to Find Bugs in the Real World

This article is an unflinching look at the realities of corporate software development as of 2010. Law: You can’t check code you can’t parse. Checking code deeply requires understanding the code’s semantics. The most basic requirement is that you parse it. Parsing is considered a solved problem. Unfortunately, this view is naïve, rooted in the widely believed myth that programming languages exist.…

A prettier printer

TL;DR: Follow these rules for acceptable pretty printing: if an expression is longer than the room left within a maximum length, fold it. else, don&rsquo;t. This paper inspired prettier and black .

Linus's law

A &ldquo;hacker&rdquo; is a person who has gone past using his computer for survival (&ldquo;I bring home the bread by programming&rdquo;) to the next two stages [(&ldquo;social life,&rdquo; and &ldquo;entertainment&rdquo;)]. &ndash; Linus Torvalds in &ldquo;What Makes Hacker’s Tick? a.k.a Linus’s Law&rdquo;, prologue to Pekka Himanen’s The Hacker Ethic, 2001 See also: This Rich to Open Source…

The Tyranny of Structurelessness

TL;DR: Lack of formal structure makes it harder for newcomers to participate in changing an organization. According to Seeing Like a State , that barrier might be intentional.

Raymond's Linus's Law

In The Cathedral and the Bazaar , Eric S. Raymond wrote: Linus [Torvalds] was behaving as though he believed something like this: Given a large enough beta-tester and co-developer base, almost every problem will be characterized quickly and the fix is obvious to someone. or, less formally, &ldquo;Given enough eyeballs, all bugs are shallow.&rdquo; I dub this: &ldquo;Linus&rsquo;s Law&rdquo;

Conway's law

Organizations tend to produce designs which mimic their internal communication structure