Skip to content

Instantly share code, notes, and snippets.

@alxndr42
alxndr42 / docker-clean
Created September 12, 2022 21:20
Remove obsolete Docker containers and images
#!/bin/bash
echo "Removing exited containers:"
docker ps -f "status=exited" -q | xargs docker rm
echo "Removing dangling images:"
docker images -f "dangling=true" -q | xargs docker rmi
@alxndr42
alxndr42 / tor-onion-auth
Created October 3, 2019 18:47
Creates v3 hidden service authorization files.
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage: tor-onion-auth <onion_address> <client_name>"
echo ""
echo "Creates v3 hidden service authorization files."
exit
fi
ONION_ADDRESS=$(echo $1 | sed -e 's/\.onion//')
@alxndr42
alxndr42 / lxd-new-container
Last active August 29, 2021 15:10
Creates Debian-based LXD containers for Ansible management via SSH.
#!/bin/bash
# Creates Debian-based LXD containers for Ansible management via SSH.
#
# The user "ansible" is given password-less sudo access in the container
# and configured with the current user's Ed25519 or RSA key by default.
#
# Parameters:
# -k Use a different SSH key.
# -p Add the given profile.
@alxndr42
alxndr42 / tor
Last active April 29, 2018 16:13
Multi-instance Tor init script for pre-systemd installations. For information on config file naming and content, please see: https://www.torservers.net/wiki/setup/server#multiple_tor_processes
#! /bin/bash
### BEGIN INIT INFO
# Provides: tor
# Required-Start: $local_fs $remote_fs $network $named $time
# Required-Stop: $local_fs $remote_fs $network $named $time
# Should-Start: $syslog
# Should-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6