Skip to content

Instantly share code, notes, and snippets.

View cgorshing's full-sized avatar
👋
Hey!

Chad Gorshing cgorshing

👋
Hey!
View GitHub Profile
@cgorshing
cgorshing / mouse-wheel-inverse-scroll.ps1
Created April 21, 2024 22:18
Mouse Wheel Inverse/Reverse Scroll in Windows (all or specific mice)
# Choose which ever way you want. Sometimes I want to do all mice connected.
# Othertimes, I only want to do a specific one
# I've taken these scripts from a couple places and tailored to fit me
# https://github.com/justinlhudson/Config-And-Setup/blob/master/Windows/MouseInvert.ps1
# https://answers.microsoft.com/en-us/windows/forum/all/reverse-mouse-wheel-scroll/657c4537-f346-4b8b-99f8-9e1f52cd94c2
# I have seen where a USB mouse plugged in doesn't have all the values specified under
# Device Parameters. I've had to add it manually in order
Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device Parameters" FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 }
<div class="avatar placeholder">
<div class="bg-secondary text-secondary-content rounded-full w-8 font-bold">
<span class="text-xs block md:hidden">sm</span>
<span class="text-xs hidden md:block lg:hidden">md</span>
<span class="text-xs hidden lg:block xl:hidden">lg</span>
<span class="text-xs hidden xl:block 2xl:hidden">xl</span>
<span class="text-xs hidden 2xl:block">2xl</span>
</div>
</div>
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()
$ErrorActionPreference = 'SilentlyContinue'
$wshell = New-Object -ComObject Wscript.Shell
$Button = [System.Windows.MessageBoxButton]::YesNoCancel
$ErrorIco = [System.Windows.MessageBoxImage]::Error
If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')) {
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
Exit
@cgorshing
cgorshing / cert-check.ps1
Created January 13, 2023 17:44
Powershell - Trusting a Specific Server Certificate
# https://gist.github.com/runtooctober/d810071e5efc90f7f0927c5669c72153
# https://gist.github.com/bender-the-greatest/26e758cd1ad7b8ae87c688301cac697e
# https://stackoverflow.com/questions/13732826/convert-pem-to-crt-and-key
# https://github.com/PowerShell/PowerShell/issues/7092 --- Reference for a new approach in more recent versions of .NET (not applicable, yet, to me)
$url = "https://your-url-to-hit/some/path"
# This helps get information about the server certificate returned
# $StackExAPIResponse = Invoke-WebRequest $url -TimeoutSec 3 -ErrorAction Stop
# $servicePoint = [System.Net.ServicePointManager]::FindServicePoint("https://your-url-to-hit")
# $servicePoint.Certificate.GetCertHashString()
server:
# If no logfile is specified, syslog is used
# logfile: "/var/log/unbound/unbound.log"
verbosity: 0
interface: 127.0.0.1
port: 5335
do-ip4: yes
do-udp: yes
do-tcp: yes
@cgorshing
cgorshing / love_you.md
Created February 12, 2022 14:28
I Love You Note - For Your Spouse

This is a note that is already shared with my wife to help her through when/if I should die. I store it in a vault in 1Password so my wife can see this at any time and I try to keep it updated. I'm posting this publicly so maybe others can use this as a starting point so their spouse knows how to get into all the digital accounts/persona's we have (financial or otherwise).

The PIN to my phone is ... (I hope your spouse already knows how to log into your phone)

For some of these instructions, they might be a bit technical ... or ya know, you just lost your husband and don't feel like going through this. But for help in getting these things in your control so you know how to access them. For technical help I would trust Joe Name or Suzie Name, their contact info is in my phone. I would trust them to help you get these where you can access things.

My Gmail password is in 1Password as well. You might need to use this. I have Two Factor Authentication (2FA) turned on so you will need to use the Goog

@cgorshing
cgorshing / local_accounts.rb
Created August 31, 2021 15:43
A custom Puppet Fact to find local accounts on a Windows Machine. The sid's will be used for HKEY_USERS\${sid}
Facter.add('local_account_sids') do
confine osfamily: 'Windows'
setcode do
# https://stackoverflow.com/questions/29330882/why-cant-i-include-win32-in-my-chef-recipe
# require 'win32/registry'
# include ::Win32
# https://www.lifewire.com/hkey-users-2625903
# Found someone reference that S-1-5-21 is only local users
local_user_prefix = 'S-1-5-21-'
@cgorshing
cgorshing / keybase.md
Created May 9, 2019 12:55
keybase.md

Keybase proof

I hereby claim:

  • I am cgorshing on github.
  • I am cgorshing (https://keybase.io/cgorshing) on keybase.
  • I have a public key whose fingerprint is 34FC 34B7 47BE F9B2 2EF9 03FC 8A5D E2F9 334B 0E60

To claim this, I am signing this object:

javascript:elem=document.getElementById("dev-outliner");if(elem){elem.parentNode.removeChild(elem);}else{document.body.insertAdjacentHTML('beforeEnd',%20'<style%20id="dev-outliner">*{outline:1px%20orange%20solid%20!important;}</style>');};void(0);
@cgorshing
cgorshing / flush-dns.sh
Last active September 1, 2020 02:43
Script I run when I'm having some weirdness with wifi (normally when traveling)
sudo ifconfig en0 down
sleep 5
sudo route flush
sudo ifconfig en0 up