Skip to content

Instantly share code, notes, and snippets.

@mikaello
mikaello / jsx-in-html.html
Last active May 22, 2019 07:51
Write JSX in HTML file
<!DOCTYPE html>
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
<!--
Credit: https://twitter.com/sophiebits/status/1129824393155080192
Also worth checking out: https://www.pikapkg.com/
-->
</head>

Trenger orienteringsløpere flåttvaksine?

Flått som kryper på arm

Bilde: John Tann

For alle som er mye i skogen er skogflåtten (skaumannen) noe man bør være obs på. Flåtten er en kjip skapning av typen edderkoppdyr, som kan være reservoar for viruset skogflåttencefalitt (tick borne encephalitis, TBE) og smittebærer av bakterien borrelia burgdorferi som kan gi sykdommen lyme borreliose (også kalt lyme eller borrelia) ved infeksjon.

Borreliainfeksjon kan man ikke vaksinere seg mot, men som en tommelfingerregel må en bakteriesmittet flått sitte fast på kroppen i 24 timer før man blir infisert. Så om du sjekker deg på kvelden etter endt o-løp og fjerner eventuelle flått er du mest sannsynlig try

@mikaello
mikaello / get-week-number.re
Last active August 1, 2019 13:46
Bucklescript: get week number of year
/* For a given date, get the ISO week number
*
* This is copied from
* https://stackoverflow.com/a/6117889/5550386
*
* ... which is based on information at:
*
* http://www.merlyn.demon.co.uk/weekcalc.htm#WNR
*
* Algorithm is to find nearest Thursday, it's year
@mikaello
mikaello / couchdb-docker-openstack.md
Last active April 18, 2020 13:51
How to get started with CouchDB through Docker on OpenStack

Setting up a CouchDB with Docker on OpenStack

I will be using the OpenStack provider NREC, which is available for free for all students at the University of Oslo and University of Bergen (among others).

Setting up an instance in OpenStack

Create a Linux Virtual machine with SSH access (see NREC-tutorial), and test that you can log in:

$ ssh centos@<your instance public ip>
Last login: Tue Mar 24 06:33:00 2020 from <your machine>
@mikaello
mikaello / emit-devices-info.md
Last active August 1, 2020 11:39
Information about EMIT devices

Device info for EMIT devices

Commands are executed on a Macbook Pro, OSX 10.14.6

250 and MTR4 are recognized as serial devices on OSX, while eScan is recognized as a USB only (while behaviour seems to be serial like).

https://i.ibb.co/X4mhJ63/20200801-133326.jpg

ioreg

@mikaello
mikaello / wsl2-troubleshooting.md
Last active March 4, 2021 07:32
Install WSL2 troubleshooting

Getting started with WSL2

Start by following this guide: https://docs.microsoft.com/en-us/windows/wsl/install-win10. Another nice resource is the blog post Setting up WSL2 and Oh My Zsh.

When running the dism.exe commands during setup you may get an error saying that you need elevated permissions, even if you run PowerShell as admin, you then need to run this command first to get elevated permissions:

Start-Process powershell -Verb runAs
@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>
@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 / 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 / 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(){