Skip to content

Instantly share code, notes, and snippets.

@sealor
sealor / posix-mq-cli.py
Created July 10, 2025 15:38
POSIX Message Queue CLI in Python
#!/usr/bin/env python3
import os
import sys
import ctypes
from ctypes.util import find_library
# Load the C library
libc = ctypes.CDLL(find_library("rt"), use_errno=True)
#!/usr/bin/env bash
[ "root" != "$USER" ] && exec sudo $0 "$@"
set -eux
# cleanup and upgrade APT Packages
apt --purge -y autoremove
apt update
apt upgrade -y
from __future__ import annotations
import textwrap
import unittest
import yaml
class NamespaceWrapper:
def __init__(self, source: dict | list, root):
cat>rpm.spec<<EOF
Name: fake-rpm
Version: 1.0.0
Release: 1
Summary: provides fake dependencies
License: AGPL
Provides: /bin/sh
Provides: glibc
Provides: /bin/bash
@sealor
sealor / OpenSSL.md
Last active May 28, 2021 13:13
Useful OpenSSL commands
  • generate self-signed certificate:
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -batch -keyout privateKey.key -out certificate.crt
@sealor
sealor / jenkins
Last active March 22, 2021 11:09
Start/Stop Script for Jenkins
#!/bin/bash -e
cd "$(dirname "$0")"
export JENKINS_HOME="$PWD/data"
COMMAND="java -jar jenkins.war --httpPort=1234"
LOGFILE="jenkins.log"
PIDFILE="jenkins.pid"
case "$1" in
@sealor
sealor / unix-shell-examples.md
Last active August 27, 2024 14:58
Unix Shell Examples
#!/bin/bash
# works with Windows Sub-System for Linux on Win10
FILES_XML=
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for LINUX_FILENAME in ./Notepad++/backup/*; do
BASE_NAME=$(basename "$LINUX_FILENAME")