Skip to content

Instantly share code, notes, and snippets.

@JLeine
JLeine / sitemap.py
Last active May 5, 2023 14:11
Crawls a page and generates a list of found internal URLs
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
from urllib.parse import urlparse
import re
import sys
# Get the URLs from the command-line arguments
url = str(sys.argv[1])
@JLeine
JLeine / link_checker.py
Last active May 5, 2023 13:40
Selenium Script scraping all links, validating them and generating a CSV report afterwards
@JLeine
JLeine / normalizeFilenames.sh
Last active April 21, 2023 12:14
Replace WS with '-' in all filenames
#!/bin/bash
# Search for filenames with whitespaces in the current directory and its subdirectories
find . -type f -name "* *" -print0 | while read -d $'\0' file
do
# Replace whitespace with -
new_file=$(echo "$file" | tr ' ' '-')
# Rename file
mv -v "$file" "$new_file"
@JLeine
JLeine / drawiotopng.sh
Created April 19, 2023 12:53
Convert all drawio Files into PNGs and embedded the diagram into it
#!/bin/bash
# check if the directory path is provided
if [[ $# -eq 0 ]]
then
echo "Usage: $0 <directory_path>"
exit 1
fi
# set the path to the drawio command line tool
@JLeine
JLeine / keycloak-access-token.sh
Created March 27, 2023 18:33
Keycloak Shell Script to request an AccessToken
#!/bin/bash
KEYCLOAK_URL=$1
REALM=$2
if [[ $3 == "client" ]]; then
CLIENT_ID=$4
CLIENT_SECRET=$5
RESPONSE=$(curl -s -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
@JLeine
JLeine / github-org-repos-to-csv.sh
Last active January 3, 2024 12:35
Exports all Repositories from a GH Org to a CSV
#!/bin/bash
# Set the name of the organization
org_name=$1
# Generate a timestamp to include in the filename
timestamp=$(date "+%Y%m%d_%H%M%S")
# Define the output filename with the timestamp included
output_filename="repo_list_${org_name}_${timestamp}.csv"