RSSAmplifier

Blog

the codeartist — programmer and engineer based in Berlin

The personal page and weblog of Norman Köhring

koehr.ingRSS feed ↗21 posts

Latest posts

Node can run Typescript files now

It’s possible since a while with --experimental-strip-types flag, but since Node v22.18 it is possible just like this under many circumstances. Check the official docs on how to run typescript natively to learn more!

Javascript's Array.from is neat!

Because it simply executes a function arg1.length times, one can do things like: const randomNumbers = Array.from({ length: 75 }, Math.random)

Reading speed is 238 words per minute on average

And speech time averages at 183 wpm.

Sort list of strings in Javascript

users.sort((a, b) => a.firstname.localeCompare(b.firstname)) or reversed order: users.sort((a, b) => a.firstname.localeCompare(b.firstname) * -1)

Rob Pike's 5 Rules of Programming

You can’t tell where a program is going to spend its time. Bottlenecks occur in surprising places, so don’t try to second guess and put in a speed hack until you’ve proven that’s where the bottleneck is. Measure. Don’t tune for speed until you’ve measured, and even then don’t unless one part of the code overwhelms the rest. Fancy algorithms are slow when n is small, and n is usually small. Fancy…

Disallowed Focussed Tests and how it saved my day

Today I was about to push a focussed test. A focussed test, you ask? In Jest (and others) one can run only a specific test, by writing it.only(... . Pushing this to production might create some funny or not so funny side effects though. Luckily there is the no-focussed-tests linter rule in eslint-plugin-jest .

Jest mocks are ...different

If you want to mock an imported function in Jest in a way that allows you to check if it has been called, you can not do the seemingly straighforward: // mock prefix necessary btw const mockThatFunction = jest.fn(() => 'stuff') jest.mock('@/path/to/module', () => ({ thatFunction: mockThatFunction, })) // ...in test descriptions…

pwdx command shows the working path of a process

For example: % pwdx 1984 > 1984: /home/george/ttlctrl

There is a file system for EFI vars now

On kernel updates I saw a recurring “EFI variables are not supported on this system”, so I investigated and learned that the new EFI variables are provided via a file system that needs to be mounted first: mount -t efivarfs efivarfs /sys/firmware/efi/efivars

Adding aliases in vite with typescript needs the same alias in tsconfig

For example: The following vite.config.ts: import { fileURLToPath, URL } from "url" import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' // https://vitejs.dev/config/ export default defineConfig({ plugins: [vue()], resolve: { alias: { "~": fileURLToPath(new URL("./src", import.meta.url)), "~component":…

E-Mail that isn't spam is called ham!

git fetch repo_url remote_branch:new_local_branch

git fetch $repo_url $remote_branch:$new_local_branch

Bush refused offer to discuss Osama Bin Laden handover

There is a HTML tag for "Word Break Opportunity"

For example: Kauf<wbr&#x2F;>haus .

A store implementation from scratch using Vue3&#x27;s Composition API

This article is crossposted on dev.to . Feel free to join the discussion there. At some point I started moving a side project over to Vue3 (which is still in beta). The side project is in a rather early stage and so I decided to rebuild the whole underlying foundation of it from scratch making use of the new possibilities of Vue3, especially of course the composition API. 🔗 Nuisance One nuisance…

Freddy vs JSON: how to make a top-down shooter

A couple of years ago (Oh it’s almost a decade! Am I that old already?), when the Canvas API got widely adopted by most browsers, I started experimenting with it. The fascination was high and I immediately tried to use it for interactive toys and games. Of course, the games I made (and make) are usually not very sophisticated. That is mainly because I create them only for fun and without much…

Running writefreely 0.7 on Arm

This is a follow-up on The expected tutorial: How to install WriteFreely on a Raspberry pi 3 in 10 steps . I did it! I finally got WriteFreely to run on my Arm server (check out Scaleways baremetal cloud servers ). It wasn’t so easy because with 512MB of RAM I couldn’t simply download and build the source on my webserver. Only solution: Cross compiling. Easy especially in Go, right? If you read…

Use OpenBSDs Spleen bitmap font in Linux

The font is called Spleen , as mentioned in this BSD Journal article . To be totally honest, I stopped thinking about TTY (aka console) fonts a long time ago. It just happened to get interesting again when I got a HiRes screen and suddenly a magnifying glass was necessary to read the TTY. Yes I am one of those people who still deny the existence of graphical installers. If you want to change my…

Vuejs Reactivity From Scratch

NOTE: This is a copy of the original article from Aug 17th, 2017. You can read the archived original on archive.org The button click invokes a function that just assigns a new value to a property. Still the template gets automagically rerendered. But we all know there is no fairydust involved, right? So how does it actually work? 🔗 The magic of getters and setters With the ES5 standard JavaScript…

The Magic 0xC2

When I uploaded image files, they somehow got mangled. The uploaded file was bigger than the original and the new “file format” was not readable by any means. I got intrigued. What is it, that happens to the files? The changes seemed very random but reproducible, so I created a few test files to see what exactly changes and when. My first file looked like this: 0123456789…

The price to crack your password

You can find the original article on github (in German). So, times changed and I thought about a reiteration of that topic, but instead focussing on the amount of money you need to crack the password using Amazons biggest GPU computing instances p2.16xlarge , which – at the time of writing this - costs 14.4 USD per hour. I will also compare this with the much faster Sagitta Brutalis (nice name,…