Skip to content

Instantly share code, notes, and snippets.

View obsti8383's full-sized avatar

obsti8383 obsti8383

View GitHub Profile
@obsti8383
obsti8383 / Get-AdGroupMembershipChange.ps1
Last active February 10, 2017 18:43 — forked from anonymous/Get-AdGroupMembershipChange.ps1
Detect Changes to AD Group Members and Notify on Change
#requires -Module ActiveDirectory
<#
.SYNOPSIS
This script queries multiple Active Directory groups for new members in a domain. It records group membership
in a CSV file in the same location as the script is located. On the script's initial run it will simply record
all members of all groups into this CSV file. On subsequent runs it will query each group's member list and compare
that list to what's in the CSV file. If any differences are found (added or removed) the script will update the
CSV file to reflect current memberships and notify an administrator of which members were either added or removed.
.NOTES
@obsti8383
obsti8383 / md5_compare.py
Last active November 16, 2019 16:49
Compare two md5sum files (needs to be same filename format) and prints out which file have been changed/removed/added (example: python3 md5_compare.py oldmd5s.md5 newmd5s.md5))
#!/usr/bin/python3
import sys
def prRed(output): print("\033[91m{}\033[00m".format(output))
if len(sys.argv) < 3:
print("Not enough arguments. Need two files to compare (old first, new last).")
exit(1)
if len(sys.argv) > 3:
print("Too many arguments. Need two files to compare only (old first, new last).")
@obsti8383
obsti8383 / REST_GET_to_CSV.ps1
Last active December 17, 2023 02:17
Generic Powershell Script for getting JSON output from a REST API
# examples:
# .\REST_GET_to_CSV_ps7.ps1 https://api.github.com/repos/powershell/powershell/issues x x
$ErrorActionPreference = "Stop"
$url = $Args[0]
$headerName = $Args[1]
$headerContent = $Args[2]
$maxRelLink = $Args[3]
$dataname = $Args[4]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@obsti8383
obsti8383 / Check_Uniqueness.ps1
Last active April 10, 2021 07:12
Okta Mini Helper Script to iterate all users and find out which have the same attribute content (here employeeNumber) and list them. Can be used to find out if there are double entries for attributes that should be unique (but not configured as such in Okta)
# Okta: Check Uniqeness of employeeNumber
#Requires -Version 7.0
$ErrorActionPreference = "Stop"
########## helper functions ######
function iterateUsers($users){
$employeeNumberMap = @{}
foreach($user in $users){
$userId = $user.id # example: 00u4rruv8mIU5CvRz4234
if(!$userId){
@obsti8383
obsti8383 / Get_Auth_Factors.ps1
Last active April 10, 2021 07:10
Okta REST API Script to get a CSV that show the MFA factors that are assigned to all users (requires powershell core 7.0)
#Requires -Version 7.0
$ErrorActionPreference = "Stop"
########## helper functions ######
function iterateActiveUsers($users){
foreach($user in $users){
$userId = $user.id # 00u4rruv8mIU5CvRz4234
if(!$userId){
# something is wrong. exit.
Write-Host "No field 'id' found - exiting."
@obsti8383
obsti8383 / download_pdfs.js
Last active January 23, 2023 17:06 — forked from vdsabev/download.js
Bookmarklet - download all PDFs in links on a page
javascript:(() => {
const items = document.querySelectorAll('a');
let delay = 0;
for (let index = 0; index < items.length; index++) {
const item = items[index];
if (item.getAttribute('href') != null && item.getAttribute('href').endsWith('.pdf')){
/* only write last part of link to download element (filename) */
var downloadUri = item.getAttribute('href');
var n = downloadUri.lastIndexOf('/');
var result = downloadUri.substring(n + 1);
@obsti8383
obsti8383 / bookmarklet_youtube_rss_feed.js
Created January 22, 2022 10:06
Extracts the RSS Feed URL from a Youtube Channel page and show it in an alert() dialog.
javascript:(()=>{alert(ytInitialData.metadata.channelMetadataRenderer.rssUrl);})();
@obsti8383
obsti8383 / renamePictures.ps1
Created September 3, 2022 18:43
renamePictures PowerShell Script using exiftool
# Example calls:
# ./renamePictures.ps1
# ./renamePictures.ps1 -defaultDescription Holland2022
# ./renamePictures.ps1 -fixedDescription Hallo123
# ./renamePictures.ps1 -folder hallo\. -defaultDescription Holland2022
param(
[string]$folder=".",
[switch]$simulate,
[switch]$removeExistingDates,
##
## deletes all link files on Desktop and Common Desktop Directories, that link to Program Files.
##
# Get the desktop folder path
$desktopPath = [Environment]::GetFolderPath("Desktop")
$desktopPathPublic = [Environment]::GetFolderPath("CommonDesktopDirectory")
$ErrorActionPreference = "Stop"