Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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

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 / 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 / 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>