Skip to content

Instantly share code, notes, and snippets.

View gdamjan's full-sized avatar

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

View GitHub Profile
@gdamjan
gdamjan / README.md
Last active November 20, 2025 20:25
Migrate HDDs to NVMEs

Migrate Btrfs and LVM from HDD to NVME

Old state:

  • 2x HDD, 2TB each (sda, sdb) - TOSHIBA P300 (HDWD120)
  • both have the same partitions: 1MB BIOS boot, 256MB EFI System, 1TB btrfs, 838GB LVM
  • btrfs (sda3, sdb3) is set to mirror (btrfs raid1), mounted on /var/lib (and some other places)
  • LVM (sda4, sdb4) has a thin-pool, mirrored (dm raid1), and different LVs with no specific configuration, used as disks for libvirt VMs. Volume groups is called vg.
@gdamjan
gdamjan / user_configuration.json
Last active November 7, 2025 02:35
archinstall pre-configured
{
"app_config": {},
"archinstall-language": "English",
"auth_config": {},
"bootloader": "Systemd-boot",
"custom_commands": [
"curl https://github.com/gdamjan.keys > /root/.ssh/authorized_keys"
],
"disk_config": {
"btrfs_options": {
@gdamjan
gdamjan / README.md
Created November 2, 2025 12:01
thinkpad X9-14 Gen Aura Edition (2025) notes

Thinkpad X9-14 Gen 1 Aura Edition (2025)

BIOS history

DMI: LENOVO 21QA0048RM/21QA0048RM, BIOS N4DET25W (1.08 ) 12/31/2024
…
DMI: LENOVO 21QA0048RM/21QA0048RM, BIOS N4DET30W (1.13 ) 04/02/2025
…
DMI: LENOVO 21QA0048RM/21QA0048RM, BIOS N4DET32W (1.15 ) 06/27/2025
…
@gdamjan
gdamjan / config
Last active November 2, 2025 11:57
v6.18-rc3 kernel config for thinkpad x9-14
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 6.18.0-rc3 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (GCC) 15.2.1 20250813"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=150201
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=24500
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "requests<3",
# "rich",
# ]
# ///
import requests
from rich.pretty import pprint
@gdamjan
gdamjan / README.md
Last active May 28, 2025 20:47
Archlinux install

Archlinux install

Base install

fdisk /dev/nvme0n1
# 1gb efi, 32gb swap, 150gb root, rest home

cryptsetup luksFormat /dev/nvme0n1p3
cryptsetup luksFormat /dev/nvme0n1p4
systemd-cryptsetup attach root /dev/nvme0n1p3
@gdamjan
gdamjan / remount.c
Created December 29, 2024 17:32
remount a filesystem with libmount from util-linux
#define _GNU_SOURCE
#include <libmount/libmount.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
/*
* gcc -o remount-rw remount.c `pkgconf --libs mount`
*/
@gdamjan
gdamjan / aiohttp-socks-proxy.py
Last active November 13, 2024 16:17
use the ssh socks5 proxy with aiohttp, requests, httpx
#!/usr/bin/env -S uv run
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "aiohttp",
# "aiohttp-socks",
# ]
# ///
from aiohttp_socks import ProxyType, ProxyConnector, ChainProxyConnector
import aiohttp
@gdamjan
gdamjan / drop-packets-per-cgroup.nft
Created September 17, 2024 22:31
nftables to drop packets incoming for a cgroup
table ip myservice
delete table ip myservice
table ip myservice {
chain incoming {
type filter hook input priority filter; policy accept;
# `level 5` must match the number of levels of directories in the cgroup
socket cgroupv2 level 5 "user.slice/user-1000.slice/[email protected]/app.slice/[email protected]" counter
socket cgroupv2 level 5 "user.slice/user-1000.slice/[email protected]/app.slice/[email protected]" drop
@gdamjan
gdamjan / pyproject.toml
Created September 10, 2024 16:37
Zed setup for python (mostly) + relevant parts of pyproject.toml for ruff and pyright
[tool.ruff]
line-length = 120
[tool.ruff.lint]
extend-select = ["I"]
[tool.pyright]
venvPath = "."
venv = ".venv"
include = ["src"]