Skip to content

Instantly share code, notes, and snippets.

View Jonathan727's full-sized avatar

Jonathan Jonathan727

  • Minnesota, United States
View GitHub Profile
@Jonathan727
Jonathan727 / customize_windows_settings.ps1
Last active August 23, 2023 20:19
Customize New Windows Install
function Get-CurrentRegistryValue ($path, $name) {
$value = Get-ItemProperty -Path $path -Name $name -ErrorAction SilentlyContinue
if ($value -ne $null) {
Write-Host "Current value of '$name': $($value.$name)"
} else {
Write-Host "The registry entry '$name' does not currently exist."
}
}
function Confirm-Change ($settingName, $path, $name, $value) {
@Jonathan727
Jonathan727 / install-np++.ps1
Last active August 23, 2023 18:50
Download and install the latest version of notepad++
# Define the GitHub repository and release URL
$repo = "notepad-plus-plus/notepad-plus-plus"
$releaseUrl = "https://api.github.com/repos/$repo/releases/latest"
# Get the latest release information using the GitHub API
$releaseInfo = Invoke-RestMethod -Uri $releaseUrl
# Find the x64 installer asset
$installerAsset = $releaseInfo.assets | Where-Object { $_.name -like "*x64.exe" }
@Jonathan727
Jonathan727 / excel2csv.ps1
Created August 10, 2023 19:28
Powershell command to convert all xlsx files in a directory to csv files.
$excelApp = New-Object -ComObject Excel.Application;`
$excelApp.DisplayAlerts = $false;`
Get-ChildItem -File -Filter '*.xlsx' | ForEach-Object { `
$workbook = $excelApp.Workbooks.Open($_.FullName);`
$csvFilePath = $_.FullName -replace "\.xlsx$", ".xlsx.csv";`
<# If Microsoft.Office.Interop.Excel.XlFileFormat, try running from Visual Studio Developer Powershell #>`
$workbook.SaveAs($csvFilePath, [Microsoft.Office.Interop.Excel.XlFileFormat]::xlCSV);`
$workbook.Close();`
}
@Jonathan727
Jonathan727 / .bashrc
Created December 21, 2022 21:24
my .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@Jonathan727
Jonathan727 / parseml.py
Last active September 30, 2022 19:36 — forked from urschrei/parseml.py
Extract attachments from EML files in the current dir, and write them to the output subdir
#!/usr/bin/env python
"""
2022 update:
- recurse attached eml files
2020 update:
- More iterators, fewer lists
- Python 3 compatible
- Processes files in parallel
(one thread per CPU, but that's not really how it works)
@Jonathan727
Jonathan727 / UDF_VALIDATE_VIN.sql
Last active January 25, 2022 15:25 — forked from dvysotskiy/UDF_VALIDATE_VIN.sql
SQL Server function to validate vehicle identification numbers (VIN) using length, format, and checksum rules.
CREATE FUNCTION [dbo].[UDF_VALIDATE_VIN](
@VIN varchar(MAX)
)
RETURNS @RESULT TABLE
(
IS_VALID BIT NOT NULL,
LENGTH_VALID BIT NOT NULL,
FORMAT_VALID BIT NOT NULL,
CHECKSUM_VALID BIT NOT NULL,
CHECK_DIGIT CHAR(1) NULL,
@Jonathan727
Jonathan727 / lgdryercommunicationsdump.pcap
Created May 20, 2020 23:03
LG Dryer Communications Dump
17:36:28.294725 IP (tos 0x0, ttl 64, id 167, offset 0, flags [none], proto UDP (17), length 328)
0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 44:cb:8b:92:8a:85, length 300, xid 0x13ba5265, secs 1342, Flags [none] (0x0000)
Client-Ethernet-Address 44:cb:8b:92:8a:85
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Discover
MSZ Option 57, length 2: 1500
Parameter-Request Option 55, length 5:
Subnet-Mask, Time-Zone, Default-Gateway, Domain-Name-Server
SMTP