Skip to content

Instantly share code, notes, and snippets.

Avatar

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

View GitHub Profile
View pleroma.service
# /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 Nov 22, 2022
fetch couchdb changes as stream
View fetch-continuous-stream.js
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);
View Cargo.toml
[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 Nov 26, 2022
A demo "Portable Service" for a shell program built with nix - https://systemd.io/PORTABLE_SERVICES/
View default.nix
{ 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 Jul 27, 2022
Replace grub2 with systemd-boot on Ubuntu 22.04
View README.md
  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
View gist:ac7137bd6230b0e188b89cc5bab0eaec
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"
View README.md

Usage

PYTHONUSERBASE=$PWD/py-env pip install --user -r requirements.txt
PYTHONUSERBASE=$PWD/py-env python get-data.py

You should get a neksio.csv file

@gdamjan
gdamjan / soju-for-jammy.md
Last active Jan 11, 2023
compile soju & znc-playback for ubuntu 22.04
View soju-for-jammy.md

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 Feb 3, 2022
pgloader script to migrate tt-rss from mysql to postgresql - https://pgloader.readthedocs.io/
View commands.load
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,
@gdamjan
gdamjan / future-vs-task.py
Created Dec 23, 2021
futures are lazy, tasks are eager (in async python)
View future-vs-task.py
import asyncio
async def test(s, n):
print(f' {s} started')
await asyncio.sleep(n)
print(f' {s} ends')
async def main():