Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
"""
Dynamic and Adaptive Python Environment in a Bubblewrap Sandbox
Overview:
This project demonstrates a minimal, safe, and self-contained Python execution
environment using bubblewrap (bwrap) and uv. The goal is to provide a lightweight
alternative to Docker for running agent code—in this case, dynamically generated
Python code along with its dependencies—within an isolated sandbox.
@braindevices
braindevices / xfs-cow-vs-btrfs-cow.md
Last active February 26, 2025 10:19
XFS reflinks vs btrfs snapshots

XFS reflinks vs BTRFS snapshots

reflinks in XFS

reflinks can be used as CoW mechanism for XFS since 4.17.0-2.el8

This feature enables two or more files to share a common set of data blocks. When either of the files sharing common blocks changes, XFS breaks the link to common blocks and creates a new file.

so with cp --reflink we can create CoW blocks already. This is similar to btrfs CoW. We can simply do following to mimic the snapshot:

find /root -mindepth 1 -maxdepth 1 -not -name "backup" -exec cp -r --reflink {} /root/backup/$(date)/ ;
@jpsutton
jpsutton / toggle_touchpad.sh
Last active May 31, 2024 16:53
Bash script to toggle the enabled status on your touchpad while running under KDE Plasma 5
#!/bin/bash
SERVICE="org.kde.KWin"
DBUS_PATH="/org/kde/KWin/InputDevice"
INTERFACE="org.kde.KWin.InputDevice"
METHOD_GET="org.freedesktop.DBus.Properties.Get"
METHOD_SET="org.freedesktop.DBus.Properties.Set"
function find_touchpad {
DM_INTERFACE="org.kde.KWin.InputDeviceManager"
@braindevices
braindevices / #btrfs benchmark for daily used desktop OS
Last active June 10, 2025 08:59
which file sytem to use for daily work? should we turn on btrfs compression?
#btrfs benchmark for daily used desktop OS
@salotz
salotz / move_axes.py
Created March 1, 2019 20:22
Move a matplotlib Axes from one figure to another.
import matplotlib.pyplot as plt
def move_axes(ax, fig, subplot_spec=111):
"""Move an Axes object from a figure to a new pyplot managed Figure in
the specified subplot."""
# get a reference to the old figure context so we can release it
old_fig = ax.figure
# remove the Axes from it's original Figure context
@yzchen
yzchen / macro.c
Created January 9, 2019 19:48
how to use macro to generate function names like a factory
#define CONCAT_2_EXPAND(A, B) A ## B
#define CONCAT_2(A, B) CONCAT_2_EXPAND(A, B)
#define CONCAT_3_EXPAND(A, B, C) A ## B ## C
#define CONCAT_3(A, B, C) CONCAT_3_EXPAND(A, B, C)
#define Vector_(NAME) CONCAT_3(Num, Vector_, NAME)
#define Vector CONCAT_2(Num, Vector)
#define num float
#define Num Float
@mcastelino
mcastelino / qemu_netdev_socket_vlan.md
Last active December 16, 2024 19:18
QEMU usermode virtual vlan using -netdev socket

Goal

How to launch multiple QEMU based VM's that can communicate with the outside world and between each other other without any setup on the host.

This uses two features available in qemu

  • User Mode Networking stack - SLIRP
  • Socket networking backend allows you to create a network of guests that can see each other

This allows us to have