Skip to content

Instantly share code, notes, and snippets.

@LikeCarter
LikeCarter / ignore_build_step.sh
Created August 26, 2025 19:38
Vercel's provided "ignore build step" command is incorrect. This command will build when changes are detected in .ts or .tsx files.
git diff HEAD^ HEAD --name-only | grep -E '.*\.(ts|tsx)$' | wc -l | xargs -I {} test {} -eq 0 && echo "Nothing found..." || exit 1"
$interfaceName = "Wi-Fi"
# Check if the interface is up and connected
$interface = Get-NetAdapter -Name $interfaceName -Physical | Where-Object { $_.Status -eq "Up" }
if ($interface) {
# Check for internet connectivity using Test-NetConnection
$test = Test-NetConnection -ComputerName 8.8.8.8 -InformationLevel Quiet
if (-not $test) {
@LikeCarter
LikeCarter / Reset-DNS-If-No-Internet.ps1
Last active June 2, 2025 15:36
Reset-DNS-If-No-Internet.ps1
<#
.SYNOPSIS
Resets DNS server addresses to automatic (DHCP) for all active network adapters using a UAC prompt for elevation.
.DESCRIPTION
This script identifies all active network adapters and then attempts to reset their DNS server
addresses to be obtained automatically via DHCP. If the script is not run with administrative
privileges, it will automatically prompt for elevation using a UAC dialog.
This eliminates the need to hardcode or explicitly prompt for administrator credentials within the script.
The new PowerShell window launched by 'runas' will remain open after execution, even if errors occur,
# Define URLs
$prepToolUrl = "https://github.com/microsoft/Microsoft-Win32-Content-Prep-Tool/raw/refs/heads/master/IntuneWinAppUtil.exe"
$acrobatMspUrl = "https://ardownload2.adobe.com/pub/adobe/acrobat/win/Acrobat2020/2000530748/Acrobat2020Upd2000530748.msp"
# Define output paths
$toolPath = "$env:TEMP\IntuneWinAppUtil.exe"
$appPath = "$env:TEMP\Win32AppPackageBuilder"
$acrobatMspPath = "$appPath\Acrobat2020Upd.msp"
$outputFolder = "$env:TEMP\Win32AppPackage"
@LikeCarter
LikeCarter / AI Rename.scpt
Last active February 23, 2025 02:12
DevonThink AI Rename
-- Rename Files Using OpenAI API with Verbose Logging and Progress Indicator
-- Based on (c) 1201 Apple, Inc. & (c) 1204-2019 DEVONtechnologies, LLC.
tell application id "DNtp"
try
set this_selection to the selection
if this_selection is {} then error "Please select some contents."
set itemCount to count of this_selection
set currentIndex to 0
# Fixing Stripped Exchange Online Role Permissions: A Step-by-Step Solution
When managing Exchange Online roles, it's easy to accidentally strip critical permissions while making modifications. Here's how I recently solved an issue where the Organization Management role lost most of its permissions, including the crucial Role Management permission.
## The Problem
During a routine task of adding Import PST permissions to the Organization Management role, most other permissions were inadvertently removed. The situation was particularly challenging because:
1. The Role Management permission was among those stripped
2. The 365 Admin Center's people picker wasn't functioning
# Step 1: Create a file with the new authentication line
echo "auth sufficient pam_tid.so" | sudo tee /tmp/pam_tid_line
# Step 2: Create a merged file by combining the new line with the existing config
sudo sh -c 'cat /tmp/pam_tid_line /etc/pam.d/sudo > /tmp/sudo_new'
# Step 3: Backup the original and move the new file into place
sudo sh -c 'cp /etc/pam.d/sudo /etc/pam.d/sudo.bak && mv /tmp/sudo_new /etc/pam.d/sudo'
$ASRRules = @(
"56a863a9-875e-4185-98a7-b882c64b5ce5" # Block abuse of exploited vulnerable signed drivers
"7674ba52-37eb-4a4f-a9a1-f0f9a1619a2c" # Block Adobe Reader from creating child processes
"d4f940ab-401b-4efc-aadc-ad5f3c50688a" # Block all Office applications from creating child processes
"9e6c4e1f-7d60-472f-ba1a-a39ef669e4b2" # Block credential stealing from lsass.exe
"be9ba2d9-53ea-4cdc-84e5-9b1eeee46550" # Block executable content from email client and webmail
"d3e037e1-3eb8-44c8-a917-57927947596d" # Block JavaScript or VBScript from launching executables
"3b576869-a4ec-4529-8536-b80a7769e899" # Block Office applications from creating executables
"75668c1f-73b5-4cf0-bb93-3ecf5cb7cc84" # Block Office applications from injecting code
"d1e49aac-8f56-4280-b9ba-993a6d77406c" # Block process creations from PSExec and WMI
# Uninstall GUI application
if (Test-Path "C:\Program Files (x86)\NextDNS\Uninstall.exe") {
& "C:\Program Files (x86)\NextDNS\Uninstall.exe" /S
} else {
Write-Output "File does not exist"
}
# Install CLI application
#!/bin/sh
env RUN_COMMAND=install FORCE_INSTALL_TYPE=bin sh -c \
'curl -sL https://nextdns.io/install \
| sed "/^[[:space:]]*configure[[:space:]]*$/d" \
| sh'
sudo /usr/local/bin/nextdns config set -auto-activate -report-client-info -detect-captive-portals -config <CONFIG_ID>
sudo /usr/local/bin/nextdns install