Skip to content

Instantly share code, notes, and snippets.

View rbellamy's full-sized avatar

Richard Bellamy rbellamy

View GitHub Profile
@rbellamy
rbellamy / podman_arch_rootless.md
Created January 6, 2024 16:32 — forked from lbrame/podman_arch_rootless.md
Running rootless unprivileged Podman containers on Arch Linux

Setting up podman rootless containers on Arch Linux

Podman is a container engine that is similar to and fully compatible with Docker that has the peculiarity of not requiring a daemon to run and to allow for rootless containers, which are often deemed safer than privileged containers running as root. Podman is a drop-in replacement for Docker that even supports the same syntax and it has good support from Red Hat.

However, running podman rootless containers on Arch Linux may not be obvious, so I'm writing the instructions I have used to achieve that here.

Podman works using control groups and users from which said containers need to be launched need to be assigned an appropriate range of subordinate user and group IDs. On Arch Linux, these files are not present and they need to be created.

From a root shell:

@rbellamy
rbellamy / boorkmarklet.md
Created June 4, 2023 16:45 — forked from 71/boorkmarklet.md
Lists all participants in a Google Meet meeting.

The following bookmarket shows a popup with the name of the participants separated by newlines.

javascript:-function(maxStrLength = 2000) { try { function findParticipants(current, depth = 0) { if (depth > 7) return; if (typeof current !== "object" || current === null || current === window) return; const descriptors = Object.getOwnPropertyDescriptors(current); for (const prop in descriptors) { if (prop.startsWith('["spaces/')) return Object.values(current); const item = findParticipants(descriptors[prop].value, depth + 1); if (item !== undefined) return item; } } const rootState = Object.entries(window).find(x => x[0].startsWith("closure_lm_"))[1], participants = findParticipants(rootState), names = []; function findName(obj) { for (const prop in obj) { const value = obj[prop]; if (typeof value === "object" && value !== null && typeof value[1] === "string") return value[1]; } } for (let i = 0; i < participants.length; i++) { const name = findName(participants[i]); if (names.indexOf(name) === -1) names.
@rbellamy
rbellamy / socks-create.sh
Created July 11, 2021 22:57 — forked from AfroThundr3007730/socks-create.sh
Create an on-demand SSH-based SOCKS5 proxy via systemd socket activation
#!/bin/bash
# These steps will allow the setup of an on-demand SSH proxy
# Three unit files will be created to serve this purpose:
# ssh-socks-helper.socket - The listening socket providing activation
# ssh-socks-helper.service - A systemd proxy to pass the socket fd
# ssh-socks.service - The actual SSH service providing the tunnel
cat <<'EOF' > ~/.config/systemd/user/ssh-socks-helper.socket
[Unit]
Description=Proxy Helper Socket for Bastion SOCKS5 Proxy
@rbellamy
rbellamy / postsplit.py
Created November 6, 2020 19:01
postway and postsplit - a FlyWay-like tool for raw psql and a DAG-based splitter for pg_dump
#!/usr/bin/env python
import argparse
import logging
import os
import re
from enum import Enum
from itertools import groupby, chain
# import matplotlib.pyplot as plt
import networkx as nx
docker load < ~/Downloads/edb-as-lite_ubi7-12.1.2-2.6.tgz
@rbellamy
rbellamy / btrfs-undelete
Created August 22, 2018 00:12 — forked from Changaco/btrfs-undelete
btrfs-undelete
#!/bin/bash
# btrfs-undelete
# Copyright (C) 2013 Jörg Walter <[email protected]>
# This program is free software; you can redistribute it and/or modify it under
# the term of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or any later version.
if [ ! -b "$1" -o -z "$2" -o -z "$3" ]; then
echo "Usage: $0 <dev> <file/dir> <dest>" 1>&2
echo
@rbellamy
rbellamy / postgres_queries_and_commands.sql
Created August 5, 2018 00:13 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- kill running query
SELECT pg_cancel_backend(procpid);
-- kill idle query
@rbellamy
rbellamy / check_python_interpreter.py
Last active November 8, 2017 20:44 — forked from vlasovskikh/check_python_interpreter.py
Information about Python interpreter and environment
import sys
import os
import pkg_resources
from pprint import pprint
pprint({
'sys.version_info': sys.version_info,
'sys.prefix': sys.prefix,
'sys.path': sys.path,
export function bufferFibonacci<T>(this: Observable<T>): Observable<T[]> {
return this.lift(new BufferFibonacciOperator<T>());
}
class BufferFibonacciOperator<T> implements Operator<T, T[]> {
call(subscriber: Subscriber<T[]>, source: any): any {
return source.subscribe(new BufferFibonacciSubscriber(subscriber));
}
}
@rbellamy
rbellamy / awless-git
Last active March 4, 2017 17:00
PKGBUILD for awless-git
pkgname=awless-git
pkgver=0.16.r12.g2604554
pkgrel=1
pkgdesc="A fast, powerful and easy-to-use command line interface (CLI) to manage Amazon Web Services."
_vendor="github.com/wallix/${pkgname/-git/}"
arch=('i686' 'x86_64')
url="https://${_vendor}"