Skip to content

Instantly share code, notes, and snippets.

Avatar

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

View GitHub Profile
View znc-site.conf
# nginx https config
server {
server_name znc.ie.mk;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
add_header Strict-Transport-Security max-age=15768000;
#add_header X-XSS-Protection "1; mode=block";
add_header X-Permitted-Cross-Domain-Policies none;
View scrape1.py
import lxml.html
odluki = 'http://ustavensud.mk/?cat=82'
def iterate_pages_from_category(start_page):
page_url = start_page
while True:
p = lxml.html.parse(page_url)
root = p.getroot()
yield from [ el.attrib['href'] for el in root.cssselect('h3.gdlr-blog-title a') ]
@gdamjan
gdamjan / README.md
Last active Jun 6, 2020
libvirt with ipvtap over wifi
View README.md

ipvtap over wifi for libvirt

ipvtap is similar to macvtap, but works over wifi too, since it uses the same mac address as the wifi interface.

libvirt doesn't support ipvtap, so we have to configure everything manually. Important data we need before we start:

  • the name of the wifi interface, wlan0 in my case (it's already connected - use NM or networkd+iwd).
  • the mac address of the wifi interface (it must be the same in the guest too)

On the host:

@gdamjan
gdamjan / Dockerfile
Last active Apr 27, 2020
ubuntu 20.04 + rustyd base docker image (https://github.com/KillingSpark/rustysd)
View Dockerfile
FROM rust:1-alpine as rust-builder
### Compile a static binary of rustysd
ARG RUSTYSD_VER=v0.2.0
WORKDIR /src
RUN rustup target add x86_64-unknown-linux-musl && \
wget https://github.com/KillingSpark/rustysd/archive/${RUSTYSD_VER}.tar.gz && \
tar xf ${RUSTYSD_VER}.tar.gz -C /src --strip-components=1
@gdamjan
gdamjan / program.py
Last active Apr 1, 2020
safe python micro-template
View program.py
# see also:
# - https://docs.python.org/3/library/string.html#string.Template
# - https://docs.python.org/3/library/string.html#string.Template.safe_substitute
# - https://docs.python.org/3/library/stdtypes.html#str.format_map
class _identity_format(dict):
def __missing__(self, key):
return f'{{{key}}}'
class T:
@gdamjan
gdamjan / update-riot-web.sh
Last active Feb 19, 2020
update riot-web
View update-riot-web.sh
#! /bin/bash
set -eE
set -o pipefail
[ -z "$1" ] && { echo "Usage: $0 <version>" ; exit 1; }
set -u
VER=$1
URL=https://github.com/vector-im/riot-web/releases/download/$VER/riot-$VER.tar.gz
@gdamjan
gdamjan / fcos.yaml
Last active Jan 19, 2020
Fedora CoreOS ignition config
View fcos.yaml
variant: fcos
version: 1.0.0
passwd:
users:
- name: core
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA9N7SvvPh6I1aDZGFuQ4434MVMAfZiRarohBri2k7mo damjan
groups:
- wheel
- podman
@gdamjan
gdamjan / README.md
Last active Jun 14, 2020
run a minimal alpine based initramfs in VM machine
View README.md

in 5 easy steps

1

get cloud-hypervisor or firecracker

2

compile a kernel (use the provided x_kernel_config file), you'll need the stripped ELF file in arch/x86/boot/compressed/vmlinux.bin or the compressed bzImage for cloud-hypervisor.

@gdamjan
gdamjan / semaphore.py
Last active Jan 17, 2020
python multi-process semaphore
View semaphore.py
'''
a multi-process quasy semaphore
multiple processes start at mostly the same time, one becomes the leader
does some initialization, then all of them start doing some work
at the end, the leader does the cleanup.
TODO: make it a proper python context manager
'''
View .SRCINFO
pkgbase = nextcloud-uwsgi-service
pkgdesc = run nextcloud as a DynamicUser=yes, socket activated uwsgi service
pkgver = 0.4
pkgrel = 1
url = https://aur.archlinux.org/packages/nextcloud-uwsgi-service/
arch = any
license = MIT
depends = nextcloud>=17.0.0
depends = uwsgi-plugin-php
depends = nginx
You can’t perform that action at this time.