Skip to content

Instantly share code, notes, and snippets.

View ctrl-freak's full-sized avatar

Bryce Sheehan ctrl-freak

View GitHub Profile
@ctrl-freak
ctrl-freak / mirror-logins.sql
Created April 8, 2024 07:40
Generate SQL to create MSSQL logins with same SID and password
-- SQL Server Logins
select
'create login [' + sp.[name] + '] with password=0x' + CONVERT(nvarchar(max), l.password_hash, 2) + ' hashed, sid=0x' + convert(nvarchar(2000), sp.[sid], 2) + ', default_language = [us_english];'
from
master.sys.server_principals sp
inner join master.sys.sql_logins l on sp.[sid] = l.[sid]
where
sp.type_desc = 'SQL_LOGIN'
and sp.is_disabled = 0
and sp.default_language_name = 'us_english' -- helps target the specifically created logins
@ctrl-freak
ctrl-freak / gatekeeper-webhook-nodejs.js
Last active April 8, 2024 07:41
Gatekeeper Webhook Challenge Response in NodeJS (on PipeDream)
// https://www.gatekeeperhq.com/
// The Vendor & Contract Lifecycle Management (VCLM) Platform
// Webhook 'documentation' on Settings page is for Ruby, incomplete and does not include that the crc_response is to be base64 encoded.
// Video on Knowledgebase contains Python script which shows this is the case:
// https://knowledge.gatekeeperhq.com/en/docs/webhooks
import * as crypto from "crypto";
export default defineComponent({
async run({ steps, $ }) {
@ctrl-freak
ctrl-freak / purestorage-hdparm-secure-erase.sh
Created October 1, 2023 11:55
Clear ATA Security Lock (Encryption) on ex-Pure Storage array drives
# Done successfully on a Toshiba THNSNJ512GCSY
# WARNING: ALL DATA ON THE DRIVE WILL BE LOST; DON'T DO THIS UNLESS YOU KNOW ITS WHAT YOU NEED
# This is a series of shell commands, not a functional script
# Once unlocked, the drive should be able to be initialized/MBR written and partitions created.
sudo -s
# Identify drives
lsblk
@ctrl-freak
ctrl-freak / Kill-HungGS.ps1
Created May 18, 2023 03:35
Check whether process hung and kill or return non-zero
param (
[String] $Process = 'gswin64c',
[Int] $MaxRunTime = -5
)
try{
Get-Process $Process -ErrorAction Stop | Where StartTime -lt (Get-Date).AddSeconds($MaxRunTime) | Stop-Process -Force
} catch {
# No process to kill, good to go
# Exit as non-zero so Boomi takes Try-Catch route and continues processing
@ctrl-freak
ctrl-freak / windows_software.md
Created May 12, 2022 05:46
Windows Desktop Software
Name License Source
7-Zip Open Source
Audacity Open Source
Audiveris Open Source
Autodesk Fusion 360 Free License
AutoIt Freeware
Battle.net Platform
Blender Open Source
@ctrl-freak
ctrl-freak / terraform_cloud_0.13upgrade.md
Created May 11, 2022 05:10
Terraform Cloud Replace Provider in Remote State for 0.13 Upgrade

Background

When upgrading to Terraform 0.13 where runs driven by VCS and state is stored remotely (in this case Terraform Cloud)

I had an issue where a public Github module I was using included versions.tf which fails on older terraform versions.

I'd never used terraform locally, only connected the repository to Terraform Cloud.

The terraform 0.13upgrade is only in the 0.13 binaries, I had to download the old binary for my OS and run that specifically.

@ctrl-freak
ctrl-freak / marleyspoon_mealie.workflow.js
Created April 25, 2022 12:44
Reformat Marley Spoon API Recipe for insert to Mealie via n8n
var recipe = {};
recipe.name = item.name_with_subtitle;
recipe.recipe_yield = '4 Servings';
var ingredients = [];
item.ingredients.forEach((ingredient) => {
ingredients.push(ingredient.name_with_quantity);
});
item.assumed_ingredients.forEach((ingredient) => {
ingredients.push(ingredient.name);
@ctrl-freak
ctrl-freak / raspbian_openalpr.sh
Last active January 6, 2022 04:04
OpenALPR on Raspbian buster
## Prep SD card
# wpa_supplicant.conf
touch /boot/ssh
echo "enable_uart=1" >> /boot/config.txt
## Boot, ssh
uname -a
# Linux gatelpr 5.10.63+ #1496 Wed Dec 1 15:57:05 GMT 2021 armv6l GNU/Linux
@ctrl-freak
ctrl-freak / apk_zipalign_resign.md
Created July 24, 2020 02:01
Modifying Android APK and Resign on Windows
@ctrl-freak
ctrl-freak / rtl8188eus.sh
Created July 15, 2020 02:19
TP-Link TL-WN722N v2 Monitor Mode
# https://github.com/aircrack-ng/rtl8188eus
sudo apt update
sudo apt install bc
sudo rmmod r8188eu.ko
git clone https://github.com/aircrack-ng/rtl8188eus
cd rtl8188eus
sudo -i
echo "blacklist r8188eu.ko" > "/etc/modprobe.d/realtek.conf"
exit