Skip to content

Instantly share code, notes, and snippets.

View gdamjan's full-sized avatar

Дамјан Георгиевски gdamjan

View GitHub Profile
@gdamjan
gdamjan / zz-update-systemd-boot
Last active February 16, 2023 14:26
kernel postinstall script to update systemd-boot on debian/ubuntu
#!/bin/bash
#
# /etc/kernel/postinst.d/zz-update-systemd-boot
# 0755 root:root
#
# This is a simple kernel hook to populate the systemd-boot entries
# whenever kernels are added or removed.
#
set -euo pipefail
@gdamjan
gdamjan / pleroma.service
Last active December 15, 2022 18:18
pleroma setup
# /etc/systemd/system/pleroma.service
[Unit]
Description=Pleroma is a federated social networking platform
Documentation=https://docs-develop.pleroma.social/
After=network.target
[Service]
Type=simple
DynamicUser=yes
StateDirectory=pleroma
@gdamjan
gdamjan / fetch-continuous-stream.js
Last active June 26, 2023 00:41
fetch couchdb changes as stream
function asContinuousEventStream() {
const transformer = {
start() {
this.buffer = "";
},
transform(chunk, controller) {
this.buffer += chunk;
while (true) {
// parse full lines only
const [line, sep, rest] = this.buffer.split(/(\n)/, 3);
[package]
name = "rust-cgi"
version = "0.1.0"
edition = "2021"
[dependencies]
hyper_cgi= "22.4.15"
hyper = "0.14.23"
tokio = "1.21.2"
@gdamjan
gdamjan / default.nix
Last active November 26, 2022 12:19
A demo "Portable Service" for a shell program built with nix - https://systemd.io/PORTABLE_SERVICES/
{ pkgs ? import <nixpkgs> { } }:
let
demo-program = pkgs.writeShellScriptBin "helloWorld" "while sleep 3; do echo Hello World; done";
demo-service = pkgs.substituteAll {
name = "demo.service";
src = ./demo.service.in;
demoExe = "${demo-program}/bin/helloWorld";
};
demo-socket = pkgs.concatText "demo.socket" [ ./demo.socket ];
@gdamjan
gdamjan / README.md
Last active July 27, 2022 19:33
Replace grub2 with systemd-boot on Ubuntu 22.04
  1. remove grub
apt purge --allow-remove-essential grub2-common grub-pc-bin grub-pc grub-gfxpayload-lists grub-efi-amd64-bin grub-efi-amd64-signed grub-common os-prober shim-signed libfreetype6 
apt-get autoremove --purge
rm -rf /boot/grub/
rm -rf /boot/efi/EFI/ubuntu
  1. make sure it's not installed back
    • edit /etc/apt/apt.conf.d/01autoremove
  • add "grub*"; at the end of the Never-MarkAuto-Sections section
sudo udevadm info -a /sys/devices/pci0000:00/0000:00:02.1/0000:16:00.2/0000:20:08.0/0000:29:00.0/ieee80211/phy0
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/devices/pci0000:00/0000:00:02.1/0000:16:00.2/0000:20:08.0/0000:29:00.0/ieee80211/phy0':
KERNEL=="phy0"
.pdm.toml
__pypackages__/
*.egg-info/
# ignore some possible output files
cenovnik.json
cenovnik.csv
neksio.json
neksio.csv
output/
@gdamjan
gdamjan / soju-for-jammy.md
Last active January 11, 2023 18:18
compile soju & znc-playback for ubuntu 22.04

podman run -v $PWD:/exfiltrate --rm -it ubuntu:22.04

export DEBIAN_FRONTEND=noninteractive
apt update
apt upgrade -y
apt install -y --no-install-recommends git ca-certificates golang gcc make libsqlite3-dev scdoc

git clone https://git.sr.ht/~emersion/soju
cd soju
@gdamjan
gdamjan / commands.load
Last active February 3, 2022 10:02
pgloader script to migrate tt-rss from mysql to postgresql - https://pgloader.readthedocs.io/
LOAD DATABASE
FROM mysql://ttrss:ttrss@127.0.0.1:3306/ttrss
INTO postgresql://tt-rss:tt-rss@127.0.0.1:5432/tt-rss
WITH include no drop, create no tables, truncate
ALTER schema 'ttrss' rename to 'public'
CAST type datetime to timestamp,
type timestamp to timestamp,