Skip to content

Instantly share code, notes, and snippets.

View michael-johansen's full-sized avatar
🍔

Michael Johansen michael-johansen

🍔
View GitHub Profile
@michael-johansen
michael-johansen / minidox.json
Last active May 2, 2023 20:50
Modified Miryoku - qwerty, homerowmods shifted down, inverted-T navigation (for https://config.qmk.fm)
{
"version": 1,
"notes": "",
"documentation": "\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n",
"keyboard": "maple_computing/minidox/rev1",
"keymap": "minidox-v1",
"layout": "LAYOUT_split_3x5_3",
"layers": [
[
"KC_Q",
@michael-johansen
michael-johansen / create-word-list
Last active October 14, 2025 13:03
Norwegian dictionary for apps (Intellij, etc)
#!/bin/bash
set -xeuo pipefail
mkdir -p /tmp/create-word-list
declare -r tmp_dir=/tmp/create-word-list
declare -r file="$tmp_dir/ordlister.tar.gz"
declare -r file_etag="$tmp_dir/ordlister.tar.gz.etag"
declare -r remote='https://www.nb.no/sbfil/leksikalske_databaser/ordbank/20190123_norsk_ordbank_nob_2005.tar.gz'
curl -sLo "$file" "${zflag[@]}" \
--etag-compare $file_etag \
# custom properties
suppress.focus.stealing=false
# ~/.config/i3/config
# avoid randomly focusing other windows and closing nav-popups
focus_follows_mouse no
# presently not required?
for_window [class="^jetbrains-.+"][window_type=dialog] focus
@michael-johansen
michael-johansen / n7m
Last active July 22, 2021 09:45
Ever wondered what words like i18n, l10n, and a11y might mean?
#!/bin/bash
if [ "$#" != 1 ]; then
printf '
Usage: n7m [word]
Will find possible solutions for a numeronym https://en.wikipedia.org/wiki/Numeronym
- i18n - internationalization
- l10n - localization
Example:
~ $ n7m i18n
\n
import java.math.BigInteger
import java.math.BigInteger.ONE
import java.math.BigInteger.ZERO
fun memoFibonacci(): (Int) -> BigInteger {
val memo: MutableMap<Int, BigInteger> = mutableMapOf()
fun fibonacci(n: Int): BigInteger = when (n) {
1, 2 -> ONE
else -> memo.getOrPut(n) { fibonacci(n - 2) + fibonacci(n - 1) }
}
@michael-johansen
michael-johansen / post-checkout
Created February 15, 2016 14:08
git hook for npm install
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` or `git checkout` if a specified file was changed
# Run `chmod +x post-checkout` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id HEAD@{1} HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && echo " * changes detected in $1" && echo " * running $2" && eval "$2"