Skip to content

Instantly share code, notes, and snippets.

View basperheim's full-sized avatar

Benji Asperheim basperheim

View GitHub Profile
@basperheim
basperheim / top-seo-keywords.csv
Created June 30, 2025 15:35
Some Popular SEO Keywords of 2024-25
We can't make this file beautiful and searchable because it's too large.
keyword,searches,visits
Chatgpt,24900000,8092500
chaat gbt,24900000,8092500
chaat gpt,24900000,8092500
chact gpt,24900000,8092500
chadgbt,24900000,8092500
chag gpt,24900000,8092500
chap gpt,24900000,8092500
chast gpt,24900000,8092500
chatb gpt,24900000,8092500
@basperheim
basperheim / create_video.sh
Created June 11, 2025 12:56
Use FFmpeg to create a video from an image and audio file
#!/bin/bash
# generate_video() {
# local config_file="$1"
# if [[ ! -f "$config_file" ]]; then
# echo "JSON config file not found: $config_file"
# return 1
# fi
@basperheim
basperheim / purge_docker_macos.sh
Created June 10, 2025 13:43
Removes Docker Desktop from macOS
#!/bin/bash
# Uninstall Script
if [ "${USER}" != "root" ]; then
echo "$0 must be run as root!"
exit 2
fi
while true; do
@basperheim
basperheim / ffmpeg_helpers.sh
Last active June 19, 2025 23:27
FFmpeg bash helper functions (should work well on macOS or Linux)
# Convert HH:MM:SS or HH:MM:SS.mmm to seconds with better handling
time_to_seconds() {
local time_str=$1
local IFS=':.'
read -r hours minutes seconds milliseconds <<< "$time_str"
# If milliseconds are not provided, set them to zero
local milliseconds=${milliseconds:-0}
# Ensure milliseconds are padded to three digits
while [ ${#milliseconds} -lt 3 ]; do
@basperheim
basperheim / find_dupes.py
Created May 27, 2025 22:24
Compares file hash for files in a directory and deletes certain duplicates
import os
import hashlib
import argparse
import logging
from difflib import SequenceMatcher
# Usage: python3 find_dupes.py ~/Downloads/audiobooks
# Set up logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
@basperheim
basperheim / find_large_files.py
Created May 27, 2025 22:22
Python script that finds large files in a directory
import os
import argparse
import logging
# Usage: python3 find_large_files.py ~/Movies
# Set up logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
# Directories to ignore while scanning
@basperheim
basperheim / compress_mp3s.py
Last active April 8, 2025 00:23
Compress MP3s Using Python
from concurrent.futures import ThreadPoolExecutor, as_completed
import subprocess
import os
import platform
from pathlib import Path
DEBUG = False
MAX_FILES = 200
TARGET_BITRATE = 128 # in kbps
@basperheim
basperheim / convert_quicktime.py
Created April 7, 2025 21:01
Converts Apple QuickTime Videos to MP4
import os, sys, time
import subprocess
from pathlib import Path
# Constants
CRF = "23"
PRESET = "medium"
AUDIO_BITRATE = "192k"
MIN_FILE_SIZE_MB = 10
NUM_THREADS = "4"
@basperheim
basperheim / pg_dump-backup-overview.md
Created June 29, 2024 17:36
Postgres 'pg_dump' overview to backup a database

Postgres 'pg_dump' backup overview

When using pg_dump to back up a PostgreSQL database, here are some important flags and options to consider:

  1. -d, --dbname=NAME: Specifies the name of the database to dump.

  2. -f, --file=FILENAME: Directs the output to the specified file or directory.

  3. -F, --format=c|t|p: Specifies the format of the output file (c for custom, t for tar, p for plain text SQL).

@basperheim
basperheim / compare_files.sh
Created June 29, 2024 16:58
Bash function that compares two files with color-coded printing
compare_files() {
if [ "$#" -ne 2 ]; then
echo "Usage: compare_files <file1> <file2>"
return 1
fi
local file1="$1"
local file2="$2"
if [ ! -f "$file1" ]; then