Skip to content

Instantly share code, notes, and snippets.

View ageis's full-sized avatar
💭
available for hire in Bay Area https://cointel.pro/resume

Kevin M. Gallagher ageis

💭
available for hire in Bay Area https://cointel.pro/resume
View GitHub Profile
@ageis
ageis / get-figlet-fonts.sh
Last active January 23, 2025 01:58
Grab all Figlet fonts in existence (WIP)
#!/bin/bash
# Installs as many fonts for Figlet/Toilet as possible from multiple sources.
# Author: Kevin M. Gallagher (@ageis)
#set -u
#set -x
export FIGLET_FONT_DIR=$(figlet -I2)
export TMP_FONT_DIR="$(pwd)/fonts"
export TMP_DEST_DIR="$(pwd)/tmp"
export FONT_REGEX=".*\.\(flf\|tlf\|flc\)$"
@ageis
ageis / tor_monitor.py
Created February 12, 2018 17:57
Simple Prometheus exporter in Python for traffic metrics from a running Tor daemon.
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" Simple Prometheus exporter for traffic metrics
from a running Tor daemon. """
import re
import time
import sys
from prometheus_client import start_http_server, Gauge
import stem
from stem.control import Controller
@ageis
ageis / updateall.sh
Last active February 9, 2018 07:15
Update gems, nodejs, Perl, PyPi modules and apt packages
function updateall() {
#set -o pipefail noclobber erexit
set -v
#set -e
#set -x
function exit_error() {
echo "You can only run updateall() once at a time." >&2
}
function status() {
echo "Exit code is $1"
@ageis
ageis / testdns.sh
Last active October 30, 2024 10:38
Bash script that measures ICMP and DNS latency to many popular public nameservers.
#!/bin/bash
# Measures ICMP and DNS latency to many popular public DNS servers.
# Works concurrently or in parallel.
# Author: Kevin M. Gallagher (@ageis)
#set -x
#set -e
#set -o nounset
#set -v
export ERRFILE="./testdns_errs.txt"
@ageis
ageis / zcash-monitor.md
Last active September 16, 2019 16:41
Prometheus exporter for monitoring statistics of Zcash daemon

zcash-monitor.py

This is a script written in Python intended to run alongside a Zcash node and export statistics for monitoring purposes. It assumes the existence of zcash-cli in the PATH and access to the RPC interface over localhost.

It tracks stuff like: block height, difficulty, number of peers, network solutions per second, errors, mempool size, size of recent blocks, number of transactions within blocks, chaintips, total bytes received and sent, transaction inputs and outputs, and the make-up of transactions in terms of JoinSplits, shielded, unshielded or mixed. These Zcash metrics are refreshed once every 2 minutes.

How it works

Prometheus is a monitoring system and time-series database.

@ageis
ageis / bitcoin-monitor.md
Last active March 31, 2026 18:25
Prometheus exporter for monitoring statistics of Bitcoin daemon

bitcoind-monitor.py

This is a script written in Python intended to run alongside a Bitcoin node and export statistics for monitoring purposes. It assumes the existence of bitcoin-cli in the PATH and access to the RPC interface over localhost.

It tracks stuff like: block height, difficulty, number of peers, network hash rate, errors, uptime in seconds, mempool size, size of recent blocks, number of transactions within blocks, chaintips, total bytes received and sent, and transaction inputs and outputs. These Bitcoin metrics are refreshed once every 5 minutes.

How it works

Prometheus is a monitoring system and time-series database.

@ageis
ageis / .bash_functions
Last active August 27, 2017 06:32
systemd service unit management in minimal keystrokes.
#!/bin/bash
function stop () {
sudo systemctl stop "$1"
sleep 3s
}
function start () {
sleep 3s
sudo systemctl start "$1"
@ageis
ageis / YubiKey-GPG-SSH-guide.md
Last active February 22, 2026 15:25
Technical guide for using YubiKey series 4 for GPG and SSH

YubiKey 4 series GPG and SSH setup guide

Written for fairly adept technical users, preferably of Debian GNU/Linux, not for absolute beginners.

You'll probably be working with a single smartcard, so you'll want only one primary key (1. Sign & Certify) and two associated subkeys (2. Encrypt, 3. Authenticate). I've published a Bash function which automates this slightly special key generation process.

@ageis
ageis / smartcard-reset.txt
Created August 25, 2017 20:48
Raw hex gpg-agent commands to reset OpenPGP smartcard(s) to factory defaults
/hex
scd serialno
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
@ageis
ageis / systemd_service_hardening.md
Last active April 29, 2026 14:26
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict