Bash Cheatsheet
Things I keep doing in Bash
Things I keep doing in Bash
Some links and stuff for profiling node
General programming design patterns
What to do with pure ESM packages
What is go.mod?
A funny post I wanted to archive
I had a discussion with a colleague on how to persist a sorted (linked?) list in MySQL, and would like to write down my thoughts on this since this is likely a problem I will face in the future. There must be a better way of thinking about this than I’ve come up with. If you have an idea, don’t hesitate to send me an email. Problem description We have a sorted list of a generic length. It should be possible to reorder the items in a generic fashion (e.g you can drag and drop the items to change the list order from the GUI). This means supporting both swapping items and inserting items between two existing items. Then list should also gracefully handle growing and shrinking. ...
A simple docker command to start MySQL on a tmpfs. Things to note: Mounting localtime affects MySQL server timezone You need to have a my.cnf at the given location ($HOME/docker/mysql/my.cnf) You probably need to create /var/lib/mysql before running the command Setting sql_mode="" is probably not needed for most applications. sudo docker run -d \ --name mysql7 \ -v/usr/share/zoneinfo/Europe/Stockholm:/etc/localtime:ro \ -v$HOME/docker/mysql/my.cnf:/etc/my.cnf \ -e MYSQL_ROOT_PASSWORD=root \ -e MYSQL_ROOT_HOST='%' \ -p3306:3306 \ --mount type=tmpfs,destination=/var/lib/mysql \ mysql/mysql-server:5.7 \ --sql_mode=""
When you have an international database, how do you make sure that the collation is correct for all locales? Here are some thoughts. Note that you have to be careful when mixing collations in queries or SQL will complain. Table with virtual, generated columns CREATE TABLE `note` ( `id` bigint NOT NULL AUTO_INCREMENT, `text` varchar(256) DEFAULT NULL, `text_swedish` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci GENERATED ALWAYS AS (`text`) VIRTUAL, `text_danish` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_danish_ci GENERATED ALWAYS AS (`text`) VIRTUAL, ... PRIMARY KEY (`id`), KEY `text` (`text`), KEY `text_swedish` (`text_swedish`), KEY `text_danish` (`text_danish`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci There is support for generating columns from another column. I’m unsure how this affects memory usage. ...
Curated list of interesting talks / lessons Psychology Jonathan Blow - Techniques for dealing with lack of motivation, malaise, depression Lists Conf42: Cloud Native 2021 Logging Making Logs Work for you with Fluentd Caching Architectural Caching Patterns (for Kubernetes) - Good caching primer Docker Images Securing Containers by Breaking In - Good image security primer