Skip to content

Instantly share code, notes, and snippets.

View akruis's full-sized avatar

Anselm Kruis akruis

View GitHub Profile
@akruis
akruis / altnetworking.sh
Last active March 3, 2024 07:06 — forked from level323/altnetworking.sh
Run a command inside a customised networking environment (using cgroups)
#!/bin/bash
# === INFO ===
# altnetworking.sh
# Description: Run the specified application in a custom networking environment.
# Uses cgroups to run process(es) in a network environment of your own choosing (within limits!)
VERSION="0.2.0"
# Author: John Clark
# adapted for cgroups v2 by Anselm Kruis
# Requirements: Debian 11 bullseye
@akruis
akruis / pyctypes.py
Created May 7, 2021 06:27
Using ctypes to access the type object, set object dictionaries
'''
Created on 27.02.2021
@author: anselm
'''
# Some code copied from
#
# forbiddenfruit - Patch built-in python objects
#
@akruis
akruis / pickled_task_poc.py
Created February 10, 2021 16:29
A prove of concept for pickling / unpickling an asyncio.Task object
'''
A prove of concept for pickling / unpickling an asyncio.Task object
Limitations of this demo code:
- Requires Stackless Python 3.7, because this Python implementation can pickle coroutine objects.
- Uses the pure python task implementation asyncio.tasks._PyTask
Copyright (C) 2021 Anselm Kruis