Skip to content

Instantly share code, notes, and snippets.

View jcefoli's full-sized avatar

Joe Cefoli jcefoli

View GitHub Profile
jcefoli / imds-fix-routes.ps1
Created June 7, 2024 23:35
Fix AWS IMDS Routes When Moving Subnets
Import-Module c:\ProgramData\Amazon\EC2-Windows\Launch\Module\Ec2Launch.psm1; Add-Routes
jcefoli / pkmnGoldEncounterModifier.ps1
Last active March 20, 2024 22:36
Generates Gameshark codes for Pokemon Gold/Silver/Crystal to encounter a specific Pokemon at a specific level
Generates Gameshark codes for Pokemon Gold/Silver/Crystal to encounter a specific Pokemon at a specific level
Takes user input for the Pokemon name and level and generates the codes
function ConvertTo-Hex {
param (
jcefoli / tstWan.ps1
Last active January 27, 2024 09:49
Windows Sandbox Connection Tester & Reboot
# This will ping google to test for a WAN connection and reboot if it fails
# Workaround to my Windows Sandbox always losing network
# The weird logging to write-host/write-output is designed to be used with Windows task scheduler (interactive logon) or via console directly
$host.ui.RawUI.WindowTitle = "Network Checker"
$dt = (get-date).toString()
Write-Host "Network Check Running. Logfile: C:\Users\$($env:username)\networkCheck.log"
Write-Output "[$dt] Network Check Running. Logfile: C:\Users\$($env:username)\networkCheck.log" | Out-File -FilePath "C:\Users\$($env:username)\networkCheck.log" -Encoding utf8 -Append
jcefoli / fix_windows_ssh_privkey_permission.ps1
Last active July 3, 2024 15:43
Fix OpenSSH private key permissions on Windows (Solves Windows SSH: Permissions for 'private-key' are too open)
param (
# Remove inheritance from the private key file to prevent inheriting permissions from parent directories
. icacls $privateKeyFilePath /c /t /Inheritance:d
# Grant full control to the current user for keys within the user profile directory
. icacls $privateKeyFilePath /c /t /Grant ${env:UserName}:F
jcefoli / asus-cheatsheet.txt
Last active August 31, 2023 17:15
[Asus Router] Useful SSH Commands
# Modify Hosts file (/jffs/configs/hosts.add)
service restart_dnsmasq
# Parse Custom Client List
nvram get custom_clientlist | sed 's/</\n/g; s/>/\t/g' | sed 's/^/custom\t/' | tail '+2' | sed 's/\(^.*\)\(\t.*\)\(\t[0-9A-F][0-9A-F]:.*$\)/\1\3\2/'
# Remove Logged in User restriction
nvram unset login_ip
nvram commit
jcefoli / random-ip-in-cidr.ps1
Last active July 25, 2023 21:33
[pwsh] Generate a random IP address in a given CIDR range
function Get-RandomIPAddressInCIDR {
param (
# Split the CIDR into network address and subnet mask
$networkAddress, $subnetMaskBits = $CIDR -split '/'
$subnetMaskBits = [int]$subnetMaskBits
if ($subnetMaskBits -eq 32) {
jcefoli / file_datetime.ps1
Created May 10, 2023 15:58
File DateTimeStamp Output
$outputFileName = "C:\Temp\File_{0:yyyyMMdd}_{0:HHmmss}.csv" -f (Get-Date)
jcefoli /
Created April 24, 2023 14:06
LolBanner Setup Script (Debian) - Create colorful text banners using the 3d.flf font, figlet and lolcat (wrapped by a bash function called lolcat)
#!/usr/bin/env bash
sudo apt install figlet lolcat --no-install-recommends -y
wget -P ~/.local/share/fonts/
sudo tee ~/.bashrc << 'EOF'
lolbanner ()
figlet -f ~/.local/share/fonts/3d.flf $@ | lolcat
jcefoli / Update-SessionEnvironment.ps1
Created January 27, 2023 19:53
Refresh Path In Powershell Session Using Chocolatey
# Use chocolatey to refresh the path
Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1"
Update-SessionEnvironment -Full
jcefoli / pwshIntellisense.ps1
Created December 19, 2022 17:05
Powershell Intellisense
## ##
# Get Configuration
## Get Intellisense Option
# Command History Path