Skip to content

Instantly share code, notes, and snippets.

@brett6320
brett6320 / Enable-Bitlocker-AD-Escrow.ps1
Created October 21, 2025 03:57
Enable BitLocker for C: with escrow to Active Directory
# Enable BitLocker on C: with TPM protector and escrow to AD
# Run as Administrator
$MountPoint = "C:"
# Check if already encrypted
$BLStatus = Get-BitLockerVolume -MountPoint $MountPoint -ErrorAction SilentlyContinue
if ($BLStatus.VolumeStatus -eq "FullyDecrypted") {
Write-Host "Enabling BitLocker on $MountPoint..." -ForegroundColor Yellow
@brett6320
brett6320 / Remove-Default-Apps.ps1
Created October 20, 2025 20:47
Remove default apps from Windows 11.
# PowerShell Script to Remove Specified Windows 11 Apps
# Run this script as Administrator
# List of apps to remove with their package names
$appsToRemove = @(
"Microsoft.549981C3F5F10", # Cortana
"Microsoft.WindowsFeedbackHub", # Feedback Hub
"Microsoft.WindowsMaps", # Maps
"Microsoft.Messaging", # Messaging
"Microsoft.BingNews", # Microsoft News
@brett6320
brett6320 / disable_strict_rfc5280_verification.py
Created October 14, 2025 17:35
This sample disables the strict CA compliance verification against RFC 5280 introduced in the SSL module with Python 3.13.
### This sample disables the strict CA compliance verification against RFC 5280
### introduced in the SSL module with Python 3.13.
import ssl
import warnings
warnings.warn("Disabling VERIFY_X509_STRICT for compatibility")
_original_create_default_context = ssl.create_default_context
def relaxed_create_default_context(purpose=ssl.Purpose.SERVER_AUTH, **kwargs):
@brett6320
brett6320 / SwiftDefaultApps.md
Created October 11, 2025 21:59
Manage default apps through a single PrefPane on macOS - this is helpful for changing default mail client when Mail is blocked by corporate endpoint policies.

ANNOUNCEMENT: I have recently noticed Apple has introduced replacements for the deprecated APIs used in this prefpane. As a result, slow as it may be, I plan to resume development. I will be taking PRs as well, if somebody wishes to contribute.

SwiftDefaultApps

This Preference pane is chiefly intended to be a modern replacement for the amazing RCDefaultApp developed way back when by Carl Lindberg, which stopped working in 10.12 due to deprecation of ObjC Garbage collection. Additionally, I guess it was a good way to teach myself Swift.

Feel free to contribute, comment or report issues at https://github.com/Lord-Kamina/SwiftDefaultApps.

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
# Path to your Oh My Zsh installation.
if [ -d ~/.oh-my-zsh ]
then
export ZSH="$HOME/.oh-my-zsh"
fi
# Set name of the theme to load --- if set to "random", it will
function duckdb-start () {
if [ -f "$PWD/.duckdb_startup.sql" ]
then
duckdb -init "$PWD/.duckdb_startup.sql" ${@}
elif [ -f "$HOME/.duckdb/startup.sql" ]
then
duckdb -init "$HOME/.duckdb/startup.sql" ${@}
fi
}
aws-clear-identity () {
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
unset AWS_SESSION_TOKEN
unset AWS_SECURITY_TOKEN
unset AWS_PROFILE
}
aws-assume-role() {
" Convert tabs to spaces when typing
" Documentation: https://neovim.io/doc/user/options.html#'expandtab'
set expandtab
" Set tab width to 2 columns (visual display width of tab character)
" Documentation: https://neovim.io/doc/user/options.html#'tabstop'
set tabstop=2
" Set indentation width to 2 spaces for << and >> operations
" Documentation: https://neovim.io/doc/user/options.html#'shiftwidth'
@brett6320
brett6320 / Invert Scrolling.applescript
Created October 8, 2025 19:54
This AppleScript can be run as Shortcut to invert scrolling when switching between Trackpad and traditional mice/pointing devices.
-- This AppleScript can be run as Shortcut to invert scrolling when switching between
-- Trackpad and traditional mice/pointing devices.
tell application "System Settings"
activate
end tell
tell application "System Events"
tell process "System Settings"
delay 0.5
click menu item "Trackpad" of menu "View" of menu bar 1
@brett6320
brett6320 / run.tpl
Created May 28, 2022 16:18 — forked from efrecon/run.tpl
`docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name {{printf "%q" .Name}} \
{{- with .HostConfig}}
{{- if .Privileged}}
--privileged \
{{- end}}
{{- if .AutoRemove}}
--rm \
{{- end}}
{{- if .Runtime}}