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 / YubiKey-GPG-SSH-guide.md
Last active March 16, 2024 13:18
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 / .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 / bitcoin-monitor.md
Last active February 17, 2023 01: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 / 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 / testdns.sh
Last active April 15, 2018 00:37
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 / 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 / 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 / get-figlet-fonts.sh
Last active August 31, 2022 17:04
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\)$"
Usage: apt-get -o "Dpkg::options==--option" --reinstall install <package>
$ dpkg --force-help
[!] all Set all force options
[*] downgrade Replace a package with a lower version
configure-any Configure any package which may help this one
hold Process incidental packages even when on hold
not-root Try to (de)install things even when not root
bad-path PATH is missing important programs, problems likely
bad-verify Install a package even if it fails authenticity check
@ageis
ageis / HTTP_Ubuntu_Mirrors.txt
Created February 22, 2018 15:15
List of Ubuntu Mirrors as of Feb 22, 2018
http://ubuntu.unc.edu.ar/ubuntu/
http://mirrors.asnet.am/ubuntu/
http://mirror.aarnet.edu.au/pub/ubuntu/archive/
http://mirror.waia.asn.au/ubuntu/
http://ubuntu.melbourneitmirror.net/archive/
http://ubuntu.mirror.solnode.io/ubuntu/
http://ftp.iinet.net.au/pub/ubuntu/
http://mirror.as24220.net/pub/ubuntu-archive/
http://mirror.as24220.net/pub/ubuntu/
http://mirror.intergrid.com.au/ubuntu/