Skip to content

Instantly share code, notes, and snippets.

View Trimad's full-sized avatar
😡
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

Scream Skellygore Trimad

😡
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
View GitHub Profile
@Trimad
Trimad / Calendar Permissions.ps1
Created November 18, 2022 13:14
Calendar Permissions
# Hunt for the owner of the mailbox:
Get-MailboxFolderStatistics "theuser@domain.com" | ft Name, Identity, folderpath, foldertype > folderstats.txt
# Using the name of the mailbox owner, get the CalendarSharingOwnerSmtpAddress and SharingOwnerRemoteFolderId properties:
Get-MailboxFolderStatistics -Identity "theuser" | ForEach-Object {
If ($_.FolderPath -match "/Calendar/Advisory Team Calendar"){ # Example calendar, needs to be changed
@Trimad
Trimad / rename.py
Created November 13, 2022 02:19
Renames a folder of .png files to be sequential with leading zeros.
import os
import pathlib
collection = os.getcwd()
#print(collection)
for i, filename in enumerate(os.listdir(collection)):
file_extension = pathlib.Path(filename).suffix
#print("File Extension: ", file_extension)
if(file_extension == ".png"):
os.rename(collection +"\\"+ filename, collection +"\\"+ str(i).zfill(4) + ".png")
@Trimad
Trimad / install-choco-script.bat
Last active June 30, 2022 18:03 — forked from zaccb/install-choco-script.bat
Chocolatey install script
:: Install choco .exe and add choco to PATH
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
:::: Browsers
:: choco install brave -fy
:: choco install googlechrome -fy
:: choco install firefox -fy
:::: Text editors / IDEs
:: choco install atom -fy
@Trimad
Trimad / purge-emails.ps1
Last active June 9, 2022 17:54
Purge Phishing Emails from MS365
Connect-IPPSSession -UserPrincipalName user@company.com
New-ComplianceSearchAction -SearchName "name of the content search" -Purge -PurgeType SoftDelete
Get-ComplianceSearchAction -Identity "name of the compliance action"
function Get-Temperature {
$t = Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi"
$returntemp = @()
foreach ($temp in $t.CurrentTemperature)
{
$currentTempKelvin = $temp / 10
$currentTempCelsius = $currentTempKelvin - 273.15
$currentTempFahrenheit = (9/5) * $currentTempCelsius + 32
$returntemp += $currentTempCelsius.ToString() + " C : " + $currentTempFahrenheit.ToString() + " F : " + $currentTempKelvin + " K"
}
@Trimad
Trimad / ForceDirSyncADConnectElevated.ps1
Created June 1, 2022 12:58
Expedite syncing Active Directory with O365
# Get the ID and security principal of the current user account
$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
# Get the security principal for the Administrator role
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
# Check to see if we are currently running "as Administrator"
if ($myWindowsPrincipal.IsInRole($adminRole))
{
$Folder = "S:\path\to\folder"
$User = "Jane Doe"
$userPermissions = @()
$userPermissions += (Get-ADPrincipalGroupMembership $User).name
$folderPermissions = @()
$folderPermissions += (((Get-Acl $Folder).Access).IdentityReference).Value
$match = 0
@Trimad
Trimad / 0_Kruskal_Processing.pde
Last active May 12, 2022 01:54
Kruskal_Processing
import java.util.Collections;
import java.util.Comparator;
final int N_NODES = 128;
int nodeCount = 0;
ArrayList<Node> nodes = new ArrayList();
ArrayList<Edge> edges = new ArrayList();
ArrayList<Edge> mst = new ArrayList();
void setup() {
@Trimad
Trimad / dump-wifi-passwords.ps1
Last active April 28, 2022 16:29
Dump WiFi Passwords
# Tristan Madden
# 2022-04-11
# trimad.github.io
$cmd= @(netsh wlan show profile)
$profiles = @()
foreach ($line in $cmd)
{
$skip = 27
if($line -Match "All User Profile")
@Trimad
Trimad / barnsley_fern.pde
Created April 8, 2022 03:32
Barnsley Fern
float x = 0;
float y = 0;
float[][] magicX = {
{0.00, 0.00},
{0.85, 0.04},
{0.20, -0.26},
{-0.15, 0.28}
};