Skip to content

Instantly share code, notes, and snippets.

@mikaello
mikaello / outback-wheel-spec.md
Last active April 23, 2024 18:48
Hamax Outback wheel specification

Specification for the wheels on Hamax Outback.

Wheel: 16"

Spokes: 165mm, J-bend, G14 (2mm)

Bearing:

Material: Rubber Bearing Number: 1616 2RS

@mikaello
mikaello / Brunskrubber.md
Last active April 9, 2024 17:55
Skrubber og deres kjennetegn

Brunskrubber

Art Hattfarge Skrubbfarge Fargeendring Trær
Brunskrubb
Leccinum scabrum
Brun, lærbrun Gråsvarte, blir grovere nedover stilken Ingen, svakt rødnende Bjørk
Rødnende brunskrubb
Leccinum roseofractum
Brun Svart Rosa Bjørk
Svartskrubb
Leccinum variicolor
Mørk gråbrun/svart, spettet Grove gråbrune til gråsvarte Rosa øverst, blågrønn i basis Bjørk
Sotskrubb
Leccinum melaneum
Svart Mørk brun til svart Ingen, gråhvit, rosa, blå i basis Bjørk
Myrskrubb
Leccinum bolopus
Lys gråbrun Hvite til oker til grålig/svart Grønn, blågrønn mot basis Bjørk
Fjellskrubb Leccinum rotundifoliae Lys brun Hvite til brune Ingen Dvergbjørk
@mikaello
mikaello / install-npm-dependencies-globally.mjs
Last active February 28, 2024 14:07
Install NPM dependencies in package.json globally
/**
* It is not possible to install a package.json globally with NPM natively, so this script
* fascilitates such a workflow. This could be handy if you wan't e.g. Renovate to maintain the
* versions in the package.json.
*/
import { execSync } from "child_process";
import fs from "fs";
const packageJson = JSON.parse(fs.readFileSync("package.json"));
@mikaello
mikaello / group-objects-by-property.md
Last active December 9, 2023 11:15 — forked from JamieMason/group-objects-by-property.md
Group Array of JavaScript Objects by Key or Property Value

Group array of JavaScript objects by keys

This fork of JamieMason's implementation changes the key parameter to be an array of keys instead of just a single key. This makes it possible to group by multiple properties instead of just one.

Implementation

const groupBy = keys => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = keys.map(key => obj[key]).join('-');
@mikaello
mikaello / slack_workspace_view_tampermonkey.js
Last active September 21, 2023 07:33
Enable slick Slack Workspace view in browser, add script in Tampermonkey extension
// ==UserScript==
// @name Enable Slack Workspace Switcher on Desktop
// @namespace slack.com
// @version 1
// @author /u/Karasuni
// @description Enable the otherwise chromebook-only Slack workspace switcher
// @match https://app.slack.com/*
// @match https://app.slack.com/
// @grant none
// @run-at document-start
@mikaello
mikaello / jsChrome.scpt
Last active October 28, 2022 04:56
Pipe JS from a file in terminal to be executed in Chrome via AppleScript
(* Save this script as (e.g.) jsChrome.scpt and run it as follows
in a terminal:
osascript jsChrome.scpt someJSFile.js
The content of someJSFile.js will now be run in the active tab of
what is considered your "window 1" of a running Chrome instance.
If this is your first time running JavaScript in Google Chrome from
AppleScript, you will need to enable this in
@mikaello
mikaello / readStdin.kt
Last active September 30, 2022 07:25
Read stdin with Kotlin, util for Kattis input parsing
fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readInts() = readStrings().map { it.toInt() }
fun readLong() = readString().toLong()
fun readLongs() = readStrings().map { it.toLong() }
fun readDouble() = readString().toDouble()
fun readDoubles() = readStrings().map { it.toDouble() }
fun main(){
@mikaello
mikaello / un-urn-json.kt
Created September 18, 2021 14:23
Un URN JSON
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.node.ObjectNode
import com.fasterxml.jackson.databind.node.TextNode
private val typeMap = mutableMapOf<String, String>()
private fun parseReferences(jsonNode: JsonNode, path: String) {
val ITEMS = "items"
val ID = "id"
@mikaello
mikaello / git-commit-change-author-email.md
Last active April 19, 2021 07:36
Change Git commit author / email in existing commits

Docs: https://github.com/newren/git-filter-repo/blob/main/Documentation/converting-from-filter-branch.md#changing-authorcommittertagger-information and https://htmlpreview.github.io/?https://github.com/newren/git-filter-repo/blob/docs/html/git-filter-repo.html#_filtering_of_names_amp_emails_see_also_name_callback_and_email_callback

git filter-repo \
  --email-callback ' return email if email != b"OLD_EMAIL" else b"NEW_EMAIL" ' \
  --name-callback 'return name.replace(b"OLD_AUTHOR", b"NEW_AUTHOR")' \
  --force \
  --refs HEAD~<NUMBER_OF_COMMITS>..<BRANCH_NAME> # This line is optional, remove to do the change in all commits (will rewrite complete history)
@mikaello
mikaello / IOF_v2.xsd
Last active April 5, 2021 06:26
IOF v2 DTD converted to XSD with W3 tool dtd2xsd.pl
<schema
xmlns='http://www.w3.org/2000/10/XMLSchema'
targetNamespace='http://www.w3.org/namespace/'
xmlns:t='http://www.w3.org/namespace/'>
<element name='IOFVersion'>
<complexType>
<attribute name='version' type='string' use='fixed' value='2.0.3'/>
</complexType>
</element>