Skip to content

Instantly share code, notes, and snippets.

View kmpm's full-sized avatar

Peter Magnusson kmpm

View GitHub Profile
@kmpm
kmpm / Git-and-SCM-in-Swedish.md
Last active November 24, 2025 13:35
Git och kodhantering på svensk-engelska

Git och kodhantering på svensk-engelska

Det har funnints många försök att översätta terminologin som man använder i git och kodhantering, a´la github, gitlab och gitea, till svenska utan att man enligt mitt tycke träffat rätt. Nu kommer det här bli ytterligare ett inlägg i historien som inte heller träffar rätt men jag gör ett försök ändå.

Min huvudtanke är att behålla engelskan i ganska lång utsträckning vad det gäller själva programmet gitdå man annars kommer ifrån det som kommandon, hjälptexter och google-sökningar faktiskt använder som terminiologi och detta tycker jag är olyckligt.

@kmpm
kmpm / README.md
Last active November 5, 2025 00:37
openSUSE MicroOS, combustion, rancher and proxmox

openSUSE MicroOS, combustion, rancher and proxmox

This document is a work in progress to help me keep track of stuff while trying to get Rancher running on openSUSE MicroOS in a virtual machine on a Proxmox host.

Setup

proxmox host

# import a qcow2 as a disk to an existing vm
@kmpm
kmpm / do-backup-glpi.se
Last active October 16, 2025 13:29
Restore glpi to docker swarm service setup
#!/bin/bash
# back up files and database from a glpi instance running on a debian host
set -e
WORKDIR=./work
DATE=$(date +"%Y%m%d_%H%M%S")
GLPI_HOME=/opt/glpi
@kmpm
kmpm / adding-pixel-to-raspbian-lite.md
Last active August 25, 2025 03:33
Adding PIXEL to Raspbian Lite

Adding PIXEL/GUI to Raspbian Lite

These 'notes' were primarily intended for my own consumption but since there have been surprisingly many comments to it over the years I wanted to do some updates and clarifications. Thanks for all comments.

These instructions will require you to have connection to internet from your pi, WiFi, Ethernet or by some other means like a 3G USB dongle or something.

Preparations

Codesys RPI HOWTO

This describes how you could configure your Raspberry PI to work, hopefully, better with Codesys.

Instructions

  • Based on raspbian image
@kmpm
kmpm / README.md
Last active May 28, 2025 06:22
Neovim stuff

Useful stuff for neovim

Go

mkdir -p ~/.config/nvim
alias vimgo='nvim -u ~/.config/nvim/go_init.vim'
echo "alias vimgo='nvim -u ~/.config/nvim/go_init.vim'" >> ~/.profile
@kmpm
kmpm / rclone config failure with jottacloud.md
Last active May 15, 2025 16:53
rclone config failure with jottacloud

on headless computer

rclone config

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
@kmpm
kmpm / norminv.js
Last active July 31, 2024 11:58
Compute the quantile function for the normal distribution. - like Excel NORMINV
/// Original C++ implementation found at http://www.wilmott.com/messageview.cfm?catid=10&threadid=38771
/// C# implementation found at http://weblogs.asp.net/esanchez/archive/2010/07/29/a-quick-and-dirty-implementation-of-excel-norminv-function-in-c.aspx
/*
* Compute the quantile function for the normal distribution.
*
* For small to moderate probabilities, algorithm referenced
* below is used to obtain an initial approximation which is
* polished with a final Newton step.
*
* For very large arguments, an algorithm of Wichura is used.
@kmpm
kmpm / incus.py
Created February 18, 2024 18:02
Incus inventory for ansible
#!/usr/bin/env python3
import json
import httpx
target_host = "localhost"
socket_path = "/var/lib/incus/unix.socket"
transport = httpx.HTTPTransport(uds=socket_path)
@kmpm
kmpm / lock.go
Created March 29, 2023 14:24
Using NATS KV for creating locks.
package lock
import (
"context"
"errors"
"strings"
"sync"
"time"
"testapp/logger"