Skip to content

Instantly share code, notes, and snippets.

Joe Cefoli jcefoli

Block or report user

Report or block jcefoli

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jcefoli
jcefoli / pause-locally.ps1
Created Feb 4, 2020
Pause Script When Run Locally But not Remotely
View pause-locally.ps1
#Add to end of script
if ($PSSenderInfo) {
#Script was launched remotely. Do Not Pause
}
else {
#Script is running locally, pause
[void](Read-Host 'Press Enter to continue')
}
@jcefoli
jcefoli / zoom_mute_global_hotkey.ahk
Last active Nov 4, 2019
[AutoHotKey] Set Ctrl-M Global Hotkey to Mute/Unmute Zoom Calls
View zoom_mute_global_hotkey.ahk
^m::
IfWinExist, ahk_class ZPContentViewWndClass
WinActivate
Send, !a
Exit
IfWinExist, ahk_class ZPFloatVideoWndClass
WinActivate
Send, !a
@jcefoli
jcefoli / fizzbuzz.ps1
Created Oct 24, 2019
[Powershell Interview Question] The FizzBuzz Problem: Write a program that prints the numbers 1 to 100. For multiples of 3, print "Fizz". For multiples of 5, print "Buzz". FOr multiples of both 3 and 5, print "FizzBuzz".
View fizzbuzz.ps1
for ($x = 1; $x -le 100; $x++) {
$Output = ""
if ($x % 3 -eq 0) { $Output += "Fizz" }
if ($x % 5 -eq 0) { $Output += "Buzz" }
if ($Output -eq "") { $Output = $x }
Write-Output $Output
}
@jcefoli
jcefoli / isLocked.ps1
Created Oct 15, 2019
Conditionally Check for AD Locked Out User Account
View isLocked.ps1
[bool]$isLocked = (Get-ADUser 'username' -Properties LockedOut).LockedOut
if ($isLocked -eq $True) {
Write-Host "Account is locked"
} else {
Write-Host "Account is not locked"
}
@jcefoli
jcefoli / sendmail.ps1
Created Oct 14, 2019
Send Email in Powershell via .NET Net.Mail.SmtpClient & Net.Mail.MailMessage
View sendmail.ps1
$message = new-object Net.Mail.MailMessage;
$message.From = "YourName@gmail.com";
$message.To.Add('dev07-promotional@booker.local');
$message.Subject = "Test by Joe";
$message.Body = "Message body here";
$smtp = new-object Net.Mail.SmtpClient("smtp.server.local", "25");
$smtp.send($message);
@jcefoli
jcefoli / kickjenkins.ps1
Created Sep 24, 2019
Kick Jenkins Job With CSRF Protection Enabled [Powershell REST Request]
View kickjenkins.ps1
# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Basic Auth Credentials
$user = 'changeme'
$pass = 'insecure-password'
# Handle Basic Auth (Hacky in Powershell)
$pair = "$($user):$($pass)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
View keybase.md

Keybase proof

I hereby claim:

  • I am jcefoli on github.
  • I am jcefoli (https://keybase.io/jcefoli) on keybase.
  • I have a public key whose fingerprint is 1EEF B0D8 3F20 F83B 086B 888C CE34 4425 E18C 50B4

To claim this, I am signing this object:

@jcefoli
jcefoli / Disable-AeroShake.ps1
Created Sep 3, 2019
Disable Aero Shake (Idiotic Windows feature that minimizes all windows if you shake one window with the mouse. I do this when I'm thinking sometimes inadvertently and it annoys the hell out of me)
View Disable-AeroShake.ps1
#Run as Admin
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "DisallowShaking" -Value "0" -PropertyType "DWord"
@jcefoli
jcefoli / dns-loadbalancing-test.sh
Last active Oct 8, 2019
Performs 100 dns lookups against a domain and sorts the responses. Useful for testing DNS load balancing. (Bash one-liner)
View dns-loadbalancing-test.sh
for i in {1..100}; do dig mydomain.com @my.nameserver.com +short; done | sort | uniq -c
# replace mydomain.com with your domain name
# replace my.nameserver.com with the hostname of your domain's nameserver
@jcefoli
jcefoli / gist:f8002ffce3b0c1296d959b8d4ad0a471
Created Jul 25, 2019
Re-Enable IPv6 (My Company blocks it via reg key and this removes that key easily)
View gist:f8002ffce3b0c1296d959b8d4ad0a471
Get-Item -Path HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters | Remove-ItemProperty -Name "DisabledComponents"
You can’t perform that action at this time.