Skip to content

Instantly share code, notes, and snippets.

View gicmo's full-sized avatar
💭
🧠

Christian Kellner gicmo

💭
🧠
View GitHub Profile
@gicmo
gicmo / caps.py
Created April 6, 2022 08:27
Capability experiments
import ctypes
import ctypes.util
import enum
import errno
from collections.abc import Generator
from collections import OrderedDict
from typing import Dict, Iterable, Optional
import osbuild
@gicmo
gicmo / path.py
Created June 15, 2021 11:18
path fd resolution
#!/usr/bin/python3
import contextlib
import os
def find_entry(dir_fd: int, target) -> os.DirEntry:
with os.scandir(dir_fd) as it:
for entry in it:
info = entry.stat(follow_symlinks=False)
#!/usr/bin/python3
import argparse
import json
import os
import sys
import tempfile
import dnf
@gicmo
gicmo / resolve.py
Created January 29, 2021 10:25
Resolve package list for osbuild
#!/Usr/bin/python3
import json
import os
import sys
from urllib.parse import urlparse
def main():
#!/usr/bin/python3
import re
import sys
example = "[Renne, Julius; Gutberlet, Marcel; Voskrebenzev, Andreas; Kern, Agilo; Kaireit, Till; Hinrichs, Jan; Wacker, Frank; Vogel-Claussen, Jens] Hannover Med Sch, Dept Intervent & Diagnost Radiol, Hannover, Germany; [Renne, Julius; Gutberlet, Marcel; Voskrebenzev, Andreas; Hinrichs, Jan; Warnecke, Gregor; Braubach, Peter; Jonigk, Danny; Vogel-Claussen, Jens; Zinne, Norman] Integrated Res & Treatment Ctr Transplantat IfB T, Hannover, Germany; [Zardo, Patrick; Warnecke, Gregor; Krueger, Marcus; Haverich, Axel; Zinne, Norman] Hannover Med Sch, Clin Cardiothorac & Transplantat Surg, Hannover, Germany; [Braubach, Peter; Jonigk, Danny] Hannover Med Sch, Dept Pathol, Hannover, Germany; [Wacker, Frank; Vogel-Claussen, Jens] German Ctr Lung Res, BREATH, Hannover, Germany"
@gicmo
gicmo / osbuild-config.py
Created April 1, 2020 18:11
Create osbuild pipelines from OSTree Treefile-like inputs
#!/usr/bin/python3
import argparse
import configparser
import json
import os
import sys
import tempfile
import urllib.request
import yaml
#!/usr/bin/python3
import os
import json
import sys
all_partitions = [
{"start": 2048, "size": 972800, "type": "C12A7328-F81F-11D2-BA4B-00A0C93EC93B",
"filesystem": {"type": "vfat", "uuid": "46BB-8120", "label": "EFI System Partition",
"mountpoint": "/boot/efi"}},
@gicmo
gicmo / ci.sh
Created September 18, 2019 16:44
Local CI for bolt
#!/bin/bash
set -e
set -x
OS=${1:-fedora}
ROOT=$(pwd)
echo "$OS @ $ROOT"
mkdir -p "$ROOT/build-$OS"
@gicmo
gicmo / cfr.c
Created March 11, 2019 17:53
Copy a file via copy_file_range and print the file mappings
/* gcc -Wall -o cfr cfr.c */
#define _GNU_SOURCE
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
@gicmo
gicmo / dns-bridge.go
Last active September 21, 2018 15:46
// curl -u username:password "http://localhost:5000/post?hostname=test.xatom.net"
package main
import (
"encoding/base64"
"fmt"
"flag"
"io/ioutil"
"log"
"net/http"