Skip to content

Instantly share code, notes, and snippets.

View morten-olsen's full-sized avatar
🤖

Morten Olsen morten-olsen

🤖
View GitHub Profile
@morten-olsen
morten-olsen / CLA.md
Created April 15, 2026 19:23
Contributor License Agreement for the agentic project

Individual Contributor License Agreement

DRAFT — This document is pending legal review. Do not rely on it as a binding agreement until it has been reviewed and finalized by qualified legal counsel.

Thank you for your interest in contributing to the agentic project ("Project"), maintained by Morten Olsen ("Maintainer"). This Contributor License Agreement ("Agreement") defines the terms under which You submit Contributions to the Project.

docker run --rm -it -v $PWD:/app -v $HOME/.npmrc:/root/.npmrc --workdir /app -p 3000:3000 node /bin/bash

Creating my own hyper connected framework

So lately I have been sucked more and more into the Apple eco-system, and one of the major reasons that keeps happening (despite my best attempts not to) is the seamless connection between devices. They are definatly doing some magic to make low powered devices (ex. AirPods, AirTags) interconnect with high powered devices (ex. iPhones, MacBooks, Apple TVs) (mostly) reliable. It feels as if all their devices is able to create and maintain a stable two way connection regardless of the technology they use, and all with close to zero configuration.

So how do they do it? I decided to give this a go myself and create a "hyper connectivity framework" for allowing devices to seamlesly connect and maintain that connection reardless of the underlaying technology with a minimum of network overhead and without making writing applications any more complecated.

So first of is the list of requirements I came up with to validate my framework against to see if it is successful. T

@morten-olsen
morten-olsen / sqrt.js
Created May 4, 2021 09:33
Sqrt in pure JS
const guess = (x, maxRounds = 1000) => {
let max = x / 2;
let min = 0;
let precision = max - min;
let current;
for (let i = 0; i < maxRounds; i++) {
precision = max - min;
current = (max - min) / 2 + min;
const result = current * current;
#!/bin/bash
source "$PWD/.env"
SERVER_PUBLIC_KEY="foo"
CONFIG="${CONFIG:-/etc/wireguard/wg0.conf}"
CIDR="${CIDR:-32}"
DNS="${DNS:-1.1.1.1}"
[ -f "$CONFIG" ] || echo "Config not found" && exit 1
@morten-olsen
morten-olsen / server.sh
Last active June 30, 2020 22:19
Static HTTP server written in bash(-ish)
LOCATION="$1"
RES=/tmp/webreq
[ ! -p $RES ] && mkfifo $RES
function get_docment {
LOCATION=$(realpath .$(realpath "/$1"))
[ -d "$LOCATION" ] && echo "$LOCATION/index.html" || echo "$LOCATION"
}
function SEND {
@morten-olsen
morten-olsen / README.md
Last active May 9, 2020 10:03
Simple backup

Simple backup

A simple backup solution using docker and duplicati to perform remote encrypted incremental backups of a folder

Requirements

  • curl
  • docker

Installing

@morten-olsen
morten-olsen / self-signed-certificate-with-custom-ca.md
Created November 9, 2019 06:50 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
let steps = [];
let index = 0;
const middleware = () => (next) => (action) => {
const result = next(action);
const stepIndex = index++;
Promise.resolve(action).then((resolvedAction) => {
steps[stepIndex] = resolvedAction;
});
return result;
#!/bin/bash
if [ -n "$1" ]; then
password=$1
else
echo "Password"
read -s password
fi
SHA1_HASH=`printf $password | openssl sha1 | tr a-z A-Z | cut -d"=" -f2 | tr -d " "`
SHA_LOOKUP=`curl -s "https://api.pwnedpasswords.com/range/${SHA1_HASH:0:5}" | egrep -E "^${SHA1_HASH:5:${#SHA1_HASH}-5}"`
if [[ -n "${SHA_LOOKUP/[ ]*\n/}" ]]; then