Skip to content

Instantly share code, notes, and snippets.

View jiranonotif.js
let bob = () => {
let count = 0;
for (let e of Array.from(document.querySelectorAll('.NotificationItem__clearIconButton___3pU15'))) {
e.click();
++count;
}
if (count)
setTimeout(bob, 5000);
};
bob();
@Hashbrown777
Hashbrown777 / ServerCheck.ps1
Last active Apr 12, 2021
Give a detailed report on the ping and tcp status of servers.
View ServerCheck.ps1
#recognised protocols
$protocols=@{
http =80 ;
https=443;
}
$names=@{
teratext='Content Server';
smb ='Network share' ;
ssh ='Remote shell' ;
rdp ='Remote desktop';
@Hashbrown777
Hashbrown777 / selfElevate.ps1
Created Mar 26, 2021
when put at the top of a script ensures it is [re]ran as admin
View selfElevate.ps1
#at top of script
if (!
#current role
(New-Object Security.Principal.WindowsPrincipal(
[Security.Principal.WindowsIdentity]::GetCurrent()
#is admin?
)).IsInRole(
[Security.Principal.WindowsBuiltInRole]::Administrator
)
) {
@Hashbrown777
Hashbrown777 / Utilities.ps1
Last active Mar 11, 2021
Useful utils for pwsh
View Utilities.ps1
#just to name the gist as per https://stackoverflow.com/a/19904644/2518317
@Hashbrown777
Hashbrown777 / client.ps1
Last active Apr 12, 2021
Listen and send basic messages over TCP to see if your ports are open
View client.ps1
$socket = $NULL
$stream = $NULL
try {
$socket = [System.Net.Sockets.TCPClient]::new(
[System.Net.IPAddress]::Parse(
[System.Net.Dns]::GetHostAddresses($ADDRESS)
),
$PORT
)
$stream = $socket.GetStream()
@Hashbrown777
Hashbrown777 / emails.ps1
Last active Jun 15, 2021
Gets all your unread emails from all your accounts and subdirectories in outlook and presents them to you in a table
View emails.ps1
. ./async.ps1
. ./asynclet.ps1
. ./unicode.ps1
. ./windows.ps1
. ./wrap.ps1
$_TABLE_TITLE = 'The powershell window will show progress. You can email or run again by making a selection'
$timer = [system.diagnostics.stopwatch]::StartNew()
$selection = [Asynclet]::new(
'Out-GridView',
@Hashbrown777
Hashbrown777 / romannumerals.ps1
Last active Apr 12, 2021
The most succinct and elegant hardly-hard-coded [standard]RomanNumeral converter you've probably ever seen
View romannumerals.ps1
Filter FromRoman {
$output = 0
if ($_ -notmatch '^(M{1,3}|)(CM|CD|D?C{0,3}|)(XC|XL|L?X{0,3}|)(IX|IV|V?I{0,3}|)$') {
throw 'Incorrect format'
}
$current = 1000
$subtractor = 'M'
$whole = $False
@Hashbrown777
Hashbrown777 / dedupe.ps1
Last active Mar 9, 2021
Deduplicates identical files with preferences for which filenames to choose between the options.
View dedupe.ps1
$dirs='.'
Get-ChildItem -Path 'dedupe' | Remove-Item -Recurse
$dirs = $dirs | %{ ($_ | Get-Item).FullName }
$matchDirs = '^(' + (($dirs | %{ [Regex]::Escape($_) }) -join '|') + ')'
$preferences = (
('Act \d{4}( No \d+| \(\d{4} No[. ]\d+\))? - \d{1,2}\.\d{1,2}\.\d{4}\.pdf$', 'Act,( \d{4},?)?( No \d+| \(\d{4} No[. ]\d+\))? - \d{1,2}\.\d{1,2}\.\d{4}\.pdf$' ),
('Act \d{4} No \d+ - \d{1,2}\.\d{1,2}\.\d{4}\.pdf$' , 'Act( No \d+)? - \d{1,2}\.\d{1,2}\.\d{4}\.pdf$' ),
('Act \d{4} No \d+ - \d{1,2}\.\d{1,2}\.\d{4}\.pdf$' , 'Act,? \d{4},? No\.\d+ - \d{1,2}\.\d{1,2}\.\d{4}\.pdf$' ),
@Hashbrown777
Hashbrown777 / audioTabBbCode.ps1
Created Aug 15, 2020
Grab all music metadata and output it in bbcode
View audioTabBbCode.ps1
Function Bbcode-Row {
Param ([switch]$Heading, $From)
Begin {
'[tr]'
}
Process {
('[th]','[td]')[!$Heading]
if ($From) {
$_ = $From."$_"
}