Skip to content

Instantly share code, notes, and snippets.

View ifthenelse's full-sized avatar
🏎️
LIFE BE LIKE

Andrea Collet ifthenelse

🏎️
LIFE BE LIKE
View GitHub Profile
@ifthenelse
ifthenelse / git-prune-branches.zsh
Created April 19, 2026 15:46
Zsh script to prune locale branches already merged into the default branch
#!/usr/bin/env zsh
# Prune local Git branches that are already merged into the default base branch.
# The script skips the base branch, the current branch, and branches with related stashes,
# then asks for confirmation before deleting each eligible branch.
prune_local_branches() {
local version="1.0.0"
case "${1:-}" in
-h|--help)
@ifthenelse
ifthenelse / create-social-share-images.zsh
Created April 19, 2026 15:44
Zsh script to generate social share images from an image
#!/usr/bin/env zsh
# version
VERSION="1.0.0"
# --- functions ---
print_help() {
echo "Usage: $0 <input-image>"
echo ""
echo "Example:"
@ifthenelse
ifthenelse / create-favicons.zsh
Last active April 19, 2026 15:44
Zsh script to generate favicons from an image
#!/usr/bin/env zsh
VERSION="1.0.0"
print_help() {
echo "Usage: $0 <input-image>"
echo ""
echo "Example:"
echo " $0 logo.png"
echo ""
@ifthenelse
ifthenelse / zap-scan.zsh
Created April 5, 2026 19:14
Scan with [OWASP ZAP](https://www.zaproxy.org/) a website and save the report under `~/zap-work`
#!/usr/bin/env zsh
set -euo pipefail
# --- CHECK DEPENDENCIES ---
if ! command -v docker >/dev/null 2>&1; then
echo "ERROR: docker not found."
echo "Install Docker:"
echo " brew install --cask docker"
exit 1
@ifthenelse
ifthenelse / network-detect.zsh
Created April 5, 2026 19:12
List all the devices in the local network and their local IPs
#!/usr/bin/env zsh
set -e
# --- CONFIG ---
NMAP_BIN=""
BREW_BIN=""
# --- FUNCTIONS ---
function find_nmap() {
@ifthenelse
ifthenelse / brew-cleanup-advisor.zsh
Created April 5, 2026 19:04
Brew clenaup advisor
#!/usr/bin/env zsh
set -euo pipefail
# -----------------------------------------------------------------------------
# Homebrew cleanup advisor (read-only)
#
# Performs checks corresponding to points 1..5:
# 1) "Leaves" installed on request (explicit installs that nothing depends on)
# 2) Staleness signal via filesystem access time on the Cellar formula dir
# 3) Shell history frequency (what you actually run)
@ifthenelse
ifthenelse / msteams-transcript-extractor.js
Last active March 4, 2026 22:49
Microsoft Teams Transcript Extractor v1.6 - Extract transcripts from MS Teams chats ad download them as timestamped TXT files. Just open MS Teams for web, browse to the meeting transcript screen and run this script.
(async () => {
"use strict";
const CONFIG = {
selectors: {
statusTitle: '[data-testid="panel-status-page-title-text"]',
meetingTitle: '[data-tid="chat-title"] span[title]',
meetingTime: '[data-tid="intelligent-recap-header"] span',
meetingRecurrence: '[data-tid="recap-tab-list"] button[role="tab"][aria-selected="true"] span[dir="auto"]',
chatTab: 'button[data-tid="tab-item-com.microsoft.chattabs.chat"]',
@ifthenelse
ifthenelse / create-youtube-short.zsh
Created January 10, 2026 13:06
Zsh script to generate YouTube Shorts (1080×1920) from a static image with optional audio; supports custom output path, duration, CRF/preset, audio bitrate, overwrite and dry-run.
#!/usr/bin/env zsh
# create-youtube-short.zsh
# Create a YouTube Short (1080x1920) from a static image
# Audio is OPTIONAL: if missing, the video will be muted.
set -euo pipefail
SCRIPT_NAME="${0:t}"
VERSION="1.1.0"
@ifthenelse
ifthenelse / ncdu-top-dirs.zsh
Created January 1, 2026 10:30
ZSH script that scans a target path with ncdu, exports the full scan as JSON, then extracts the TOP N largest directories by *disk usage* (ncdu "dsize", not apparent size). Requires ncdu and jq
#!/usr/bin/env zsh
set -euo pipefail
# -----------------------------------------------------------------------------
# ncdu-top-dirs.zsh
#
# Scans a target path with ncdu, exports the full scan as JSON, then extracts
# the TOP N largest directories by *disk usage* (ncdu "dsize", not apparent size).
#
# Requirements:
@ifthenelse
ifthenelse / pdfunlock.zsh
Last active December 22, 2025 10:47
ZSH script to unlock all PDF files in the current directory using a single password
#!/usr/bin/env zsh
set -u
setopt extendedglob nullglob
SCRIPT_NAME=${0:t}
usage() {
cat <<EOF
Usage: $SCRIPT_NAME [options] [input_dir]