Skip to content

Instantly share code, notes, and snippets.

@mikaello
mikaello / jsx-in-html.html
Last active May 22, 2019
Write JSX in HTML file
View jsx-in-html.html
<!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>
View Trenger orienteringsløpere flottvaksine?.md

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 Aug 1, 2019
Bucklescript: get week number of year
View get-week-number.re
/* 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 / jsChrome.scpt
Last active Oct 14, 2019
Pipe JS from a file in terminal to be executed in Chrome via AppleScript
View jsChrome.scpt
(* 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 / couchdb-docker-openstack.md
Last active Apr 18, 2020
How to get started with CouchDB through Docker on OpenStack
View couchdb-docker-openstack.md

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 Aug 1, 2020
Information about EMIT devices
View emit-devices-info.md

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 Mar 4, 2021
Install WSL2 troubleshooting
View wsl2-troubleshooting.md

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 Apr 5, 2021
IOF v2 DTD converted to XSD with W3 tool dtd2xsd.pl
View IOF_v2.xsd
<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 Apr 19, 2021
Change Git commit author / email in existing commits
View git-commit-change-author-email.md

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)
View un-urn-json.kt
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"