Skip to content

Instantly share code, notes, and snippets.

View kmpm's full-sized avatar

Peter Magnusson kmpm

View GitHub Profile
@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"
@kmpm
kmpm / nats-setup-linux.sh
Last active March 10, 2023 15:19
install various nats.io tools on linux
#!/bin/bash
# curl -fsSL https://gist.githubusercontent.com/kmpm/a83912c95009561ff6c6dcc9a2373751/raw/nats-setup-linux.sh | bash
export DEBIAN_FRONTEND=noninteractive
apt-get install -y unzip curl
echo "Downloading nsc install script"
curl -fsSL https://raw.githubusercontent.com/nats-io/nsc/master/install.sh -o /tmp/nsc-install.sh
echo "Running nsc install script"
@kmpm
kmpm / nats-setup-win.ps1
Last active March 20, 2023 19:17
A skeleton of a PowerShell Script that install the lates nats.io tools on windows
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[String]$Destination,
[Parameter(ValueFromPipelineByPropertyName)]
[Switch]$WithServer,
[Switch]$WithNsc
)
$ErrorActionPreference = 'Stop'
@kmpm
kmpm / lowrance_sl2.hexpat
Last active February 17, 2023 15:12
imhex pattern file for parsing lowrance .sl2 files
#include <std/mem.pat>
#include <std/io.pat>
#include <std/math.pat>
#pragma endian little
#define MAX_RECORDS 1024
#define POLAR_EARTH_RADIUS 6356752.3142
@kmpm
kmpm / install-weasyproxy.sh
Last active March 23, 2023 00:21
Small file that installes ad uses weasyprint instead of wkhtmltopdf on linuxserver bookstack containers..
#!/bin/bash
# SPDX-FileCopyrightText: 2022 Peter Magnusson <me@kmpm.se>
#
# SPDX-License-Identifier: CC0-1.0
#
# This file installs weasyprint and creates a script that
# tries to proxy calls from bookstack to what it believe is
# wkhtmltopdf.
#
# put this file in /custom-cont-init.d and restart the container
@kmpm
kmpm / main.go
Last active July 27, 2022 05:31
bun-check for has-many relations with composite keys
package main
import (
"context"
"database/sql"
"fmt"
"os"
_ "github.com/denisenkom/go-mssqldb"
"github.com/uptrace/bun"

openSuSE Tryout

This document is my personal notes from getting back into SuSE again from years using debian and ubuntu.

Replacement for build-essential

SuSE/Zypper uses something called patterns to group packages together. The deb equivalent to patters would be meta-packages I guess. There is a pattern called devel_basis that sort of matches build-essential.

@kmpm
kmpm / README.md
Last active August 12, 2021 09:04
Difference between Caddy and dig DNS Lookup

Attached to this will be a pcap with 2 different request/response sequences. The first is the one that Caddy does and the second comes from dig.

@kmpm
kmpm / Gitea-Swedish.md
Last active March 15, 2021 07:51
Gitea Swedish

Gitea Swedish

Detta dokument beskriver hur olika termer har översatts till svenska i Gitea. Rubrikerna innehåller det engelska ordet sen kan det komma förklaringar, översättningar exempel med mera.

Termer

Body

  • repo:issues.reference_issue.body > Innehåll

Branch