Skip to content

Instantly share code, notes, and snippets.

View gdamjan's full-sized avatar

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

View GitHub Profile
@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"]
@gdamjan
gdamjan / Dockerfile
Last active August 2, 2024 15:23
uwsgi-cgi docker image for running scripts in /cgi-bin
FROM alpine:3.20
RUN apk add --no-cache uwsgi-cgi uwsgi-ugreen
COPY cgi-server.ini /etc/uwsgi/cgi-server.ini
VOLUME /cgi-bin
EXPOSE 8000
ENV HTTP_PORT=8000
ENV UWSGI_UID=nobody
@gdamjan
gdamjan / Dockerfile
Created May 21, 2024 17:44
my nix docker image
FROM nixos/nix:latest
RUN echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
16:02:48:fa:33:a2:04:36:4e:0a:bd:f8:86:6c:87:39:76:06:78:60
Signature Algorithm: ecdsa-with-SHA384
Issuer: O=sigstore.dev, CN=sigstore-intermediate
Validity
Not Before: Mar 30 23:02:02 2024 GMT
Not After : Mar 30 23:12:02 2024 GMT

Starting state

# br1.netdev 
[NetDev]
Kind=bridge
Name=br1
# br1.network 
[Match]
@gdamjan
gdamjan / README.md
Last active December 29, 2023 18:25

Network topology

[Router] === wifi nework domain 1 === [VM server] === bridge0, network domain 2 === VM1, VM2, Container1, Container2
  • VM Server is Archlinux with systemd networkd
  • Router is Edgerouter X with Openwrt

TODO:

  • mDNS with Avahi Reflector
@gdamjan
gdamjan / keybindings.json
Last active December 9, 2023 14:02
vscode settings
// Place your key bindings in this file to override the defaultsauto[]
// ~/.config/Code/User/keybindings.json
[
{
"key": "ctrl+g",
"command": "editor.action.nextMatchFindAction",
"when": "editorFocus"
}
]
@gdamjan
gdamjan / languages.toml
Created December 7, 2023 17:03
helix + pyright and ruff
# ~/.config/helix/languages.toml
# add the language server
[language-server.pyright]
command = "pyright-langserver"
args = ["--stdio"]
# will get "Async jobs timed out" errors if this empty config is not added
config = {}
# tie python files to pyright