Skip to content

Instantly share code, notes, and snippets.

Avatar

Brady Shea bmatthewshea

View GitHub Profile
@bmatthewshea
bmatthewshea / get-product-key.ps1
Last active December 21, 2022 16:13
PowerShell script to calculate current "ProductKey"
View get-product-key.ps1
### "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)
View check-restart-windows-service.ps1
<#
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 / certbot_install_ubuntu20+.md
Last active December 28, 2022 18:14
Ubuntu 20 - CERTBOT without SNAP/SNAPD
View certbot_install_ubuntu20+.md

CERTBOT - Install using Python PIP

Install Certbot using Python PIP (Package Installer for Python) - without using SNAP, APT or SYSTEMD. (Debian/Ubuntu)


This guide will help you install LetsEncrypt / Certbot and a DNS plugin (certbot-dns-route53) using PIP under Debian/Ubuntu.

  • You should already be somewhat familiar with LetsEncrypt, Certbot and any plugin you might need.
@bmatthewshea
bmatthewshea / Collatz_Conjecture_Example.py
Last active August 17, 2021 18:42
Collatz Conjecture (Python Example)
View Collatz_Conjecture_Example.py
#!/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
@bmatthewshea
bmatthewshea / site_up_down.py
Last active August 5, 2021 02:55
Python script that does checks on apex domains from a text file. Checks status for bare apex / "www." subdomains and ssl / non-ssl. (4 checks on each domain). Outputs in CSV format.
View site_up_down.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
## Brady Shea - 04AUG2021 - (Python 3 script)
## This will read in a file list of plain APEX domains like:
## "example.com"
## If you want it in a file just pipe the script to a file.
## python3 -u ./sites-up-down.py | tee ./domain-check.csv
import requests
@bmatthewshea
bmatthewshea / copy-folders-filelist.cmd
Last active April 28, 2021 15:27
Copy/recurse folders/files using a text file. CMD / BATCH
View copy-folders-filelist.cmd
@ECHO off
SET FileList=.\pathlist.txt
SET LOGGING=.\robocopy-copy-logs
REM EDIT THESE TWO PATHS BEFORE RUNNING (NO QUOTES! NO TRAILING BACKSLASH!)
SET Source-Path=E:\folders-under-this-root-need-copying
SET Dest-Path=D:\folder-under-which-to-place-copied-folders-from-E
REM ** XCOPY WORKS **
@bmatthewshea
bmatthewshea / show-folder-sizes-fast.ps1
Last active April 9, 2021 13:41
Show data used by top level folders using fast FSO approach
View show-folder-sizes-fast.ps1
# Default Path can be an argument - otherwise it defaults to CWD/Get-Location
# Script breaks on long filenames/path and "special" folders like C:\Users\User\Documents - needs work.
# Examples:
# ./show-folders-fast
# ./show-folders-fast "C:\Windows"
#
param([String]$folder = "$(Get-Location)")
$output_hash_table = @{}
$folder_count = (Get-ChildItem -Directory -EA 0 $folder | Measure-Object).count
@bmatthewshea
bmatthewshea / spamassassin-ubuntu20.md
Last active December 10, 2020 16:38
Spamassassin/SpamD Installation Guide - Ubuntu/Debian
View spamassassin-ubuntu20.md

Spamassassin/SpamD Installation Guide

Ubuntu 18/20 or comparable Debian dedicated server

amavisd-new

IMPORTANT: This article assumes you do not have amavisd-new installed/running on the same system.

The Ubuntu/Debian amavisd-new package already uses and suggests Spamassassin be installed. If you installed the amavisd-new package, SA was probably already installed and should not need much more tinkering.

Other than checking that the daily cron job is being run to refresh the SA rules (see below), this guide should not be needed. spamd from the Spamassassin package should NOT be a parent process if you are using amavisd-new, BUT should be installed (The spamassassin.service should not be enabled).

@bmatthewshea
bmatthewshea / system_update.sh
Last active November 2, 2021 14:30
Ubuntu-Debian APT upgrade script
View system_update.sh
#!/bin/bash
#
# Brady Shea - 18SEP2020 - conversion of system_update alias to bash script
# https://www.holylinux.net/
#
# Place this script in "/usr/local/sbin/system_update" or similar location under your $PATH
# It needs root permissions (SUDO) to execute.
#
# Change these settings to your liking:
#################################
@bmatthewshea
bmatthewshea / start-ada-blocks.sh
Last active September 6, 2022 21:37
Cardano/ADA Node startup script
View start-ada-blocks.sh
#!/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