Skip to content

Instantly share code, notes, and snippets.

View bmatthewshea's full-sized avatar

Brady Shea bmatthewshea

View GitHub Profile
@bmatthewshea
bmatthewshea / 99-unbound-custom.conf
Last active August 20, 2023 14:05
Unbound configuration file - Ubuntu 18.xx
## File location: /etc/unbound/unbound.conf.d/99-unbound-custom.conf (new file)
## I DO NOT USE UNBOUND.CONF - it can get overwritten.
# Logrotate needs this when using 'sharedscripts' command. You also need it to view stats afaik. Uses localhost only.
remote-control:
control-enable: yes
server:
access-control: 127.0.0.0/8 allow
access-control: 10.0.0.0/8 allow
@bmatthewshea
bmatthewshea / pflogsumm.sh
Last active August 7, 2023 14:28
pflogsumm cron.daily script
#!/bin/sh
# Save this script as:
# `/etc/cron.daily/pflogsumm`
# It should be owned by root.
# Then set permissions: `sudo chmod 755 /etc/cron.daily/pflogsumm`
# the script will also run directly if you wish to test it.
# Brady Shea 31Jul2023
test -x /usr/sbin/pflogsumm || exit 0
@bmatthewshea
bmatthewshea / sox-vox.sh
Created June 3, 2020 21:22
Sound activated recording using SOX
#!/bin/bash
tempfile1=/tmp/temp.mp3
# Baremetal/Realtek analog etc
AUDIODEV=hw:0,0
# Pi USB mic (usually):
# AUDIODEV=hw:1,0
set_filenames () {
NAME=`date +%Y-%m-%d_%H-%M-%S`
@bmatthewshea
bmatthewshea / show_ssl_expire
Last active March 1, 2023 22:13
Retrieve/Check SSL certificate expiration date(s)
#!/bin/bash
# By B Shea Dec2018 & Mar2020
# https://www.holylinux.net
# Test for OpenSSL - if not installed stop here.
if ! [[ -x $(which openssl) ]]; then
printf "\nOpenSSL not found or not executable.\nPlease install OpenSSL before proceeding.\n\n"
exit 1
fi
@bmatthewshea
bmatthewshea / get-product-key.ps1
Last active December 21, 2022 16:13
PowerShell script to calculate current "ProductKey"
### "get-product-key.ps1":
### (updated from https://superuser.com/a/1367165)
###
### To allow this script to run, execute one of these in admin PS:
###
### Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
### or
### Set-ExecutionPolicy RemoteSigned
###
### And then execute the following:
@bmatthewshea
bmatthewshea / check-restart-windows-service.ps1
Last active September 20, 2022 15:45
Query and restart a Windows service as needed. (PowerShell)
<#
Script: "check-restart-windows-service.ps1"
Query and restart service as needed.
Use task scheduler with this script.
Brady M. Shea - 16 Sep 2022
.Setting $ServiceName
.Find the service name to monitor by opening a PS command prompt and entering "GET-SERVICE"
@bmatthewshea
bmatthewshea / start-ada-blocks.sh
Last active September 6, 2022 21:37
Cardano/ADA Node startup script
#!/bin/bash
## Script to start a cardano "block producing"/"pool" node
## https://docs.cardano.org/projects/cardano-node/en/latest/stake-pool-operations/start_your_nodes.html
## Change "USER" to username needed below
# config area:
ada_bin_path=/home/USER/.local/bin
ada_config_path=/home/USER/.local/etc/cardano-node
ada_chain_path=/home/USER/cardano-blocks
ada_key_path=${ada_config_path}/keys
@bmatthewshea
bmatthewshea / sa-testemail.bash
Last active August 25, 2022 18:33
Spamassassin - Command Line Test Email
#!/bin/bash
def_filename="test.eml"
tmp1="/tmp/emailresults.txt"
tmp2="/tmp/emailresults.log"
usage="
$(basename "$0") [-h] [mailmessage]
Send email through Spamassassin manually and view output
Flags:
@bmatthewshea
bmatthewshea / nasa-earth-images-dscovr.py
Last active June 24, 2022 23:39
Python script to find images using the "Deep Space Climate Observatory" (DSCOVR) API for a given date.
#!/usr/bin/python3
# DSCOVR: Deep Space Climate Observatory :
# Earth Polychromatic Imaging Camera
# Daily Blue Marble API:
# https://epic.gsfc.nasa.gov/about/api
# Python Script by: Brady Shea
# 27 August 2019
import sys, json
@bmatthewshea
bmatthewshea / Collatz_Conjecture_Example.py
Last active August 17, 2021 18:42
Collatz Conjecture (Python Example)
#!/usr/bin/python
#
# Collatz Conjecture:
# x → x/2 (if x is even)
# x → 3x + 1 (if x is odd)
import sys, time
# Default seed if no arguments given
seed = 27