Skip to content

Instantly share code, notes, and snippets.

@jvarn
jvarn / makeicns.sh
Created March 18, 2026 13:56
Script to convert png icon to macOS icns
#!/bin/bash
# Usage: ./makeicns.sh iconimage.png
#
INPUT="$1"
SOURCE_IMAGE="${INPUT:r}"
mkdir -p "$SOURCE_IMAGE.iconset"
# Resize operations
@jvarn
jvarn / getepisodeinfo.sh
Created March 14, 2026 09:03
Example of how to use TheTVDB API
#!/bin/bash
# API Key Sign Up Page: https://www.thetvdb.com/api-information
# Official v4 API Documentation: https://thetvdb.github.io/v4-api/
# 1. Configuration
API_KEY="your-api-key-here"
SERIES_NAME="Star Trek Voyager"
SERIES_YEAR="1995"
SEASON_NUMBER="2"
EPISODE_NUMBER="1"
@jvarn
jvarn / sudo.sh
Last active March 8, 2026 12:21
Dummy sudo for proot-distro
#!/bin/bash
# -----------------------------------------------------------------------------
# sudo.sh
#
# Description:
# A lightweight "dummy" sudo wrapper designed for proot-distro, Termux, or
# containerized environments where the standard sudo binary is missing.
#
# Behaviour:
# - If running as root (EUID 0): Executes commands immediately and silently.
@jvarn
jvarn / wakeonlan.sh
Created March 5, 2026 12:30
Send a Wake-on-LAN (WOL) packet to a target machine via an always-on Linux host
#!/usr/bin/env zsh
# -----------------------------------------------------------------------------
# wakeonlan.sh
#
# Send a Wake-on-LAN (WOL) packet to a target machine via an always-on
# Linux host.
#
# Many computers that are powered off cannot receive WOL packets from
# outside their local network, e.g. when using Zerotier or Tailscale
# VPN. This script solves that problem by SSHing into a machine that
@jvarn
jvarn / getmacaddress.sh
Created March 5, 2026 12:11
Retrieve the MAC address of a network interface on a local or remote host (macOS or Linux)
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# getmacaddress.sh
#
# Retrieve the MAC address of a network interface on a local or remote host.
#
# The script connects to the specified host (via SSH if the host is not the
# local machine) and attempts to retrieve the MAC address of the specified
# network interface.
#
@jvarn
jvarn / getaudible.sh
Last active February 21, 2026 12:16
Quick setup for audible-cli on macOS (setup then download and convert)
#!/usr/bin/env bash
set -euo pipefail
OUTDIR="converted"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
# Load .env if present (simple KEY=VALUE lines)
ENV_FILE="$SCRIPT_DIR/.env"
@jvarn
jvarn / Instructions.txt
Created February 18, 2026 08:36
Fix the Arabic letter order in Arabic PowerPoint converted from PDF
Step-by-Step Instructions (macOS)
PowerPoint on Mac hides the coding tools by default. Here is how to set it up and use the script:
1. Enable the Developer Tab
Open PowerPoint.
Click PowerPoint in the top menu bar (top left of your screen) and select Preferences...
Click on Ribbon & Toolbar.
@jvarn
jvarn / usr-local-bin-weather
Created January 4, 2026 04:52
Weather from terminal
# https://github.com/chubin/wttr.in
# sudo nano /usr/local/bin/weather
# sudo chmod +x /usr/local/bin/weather
# ------- paste below then run with `weather` ------- #
#!/bin/bash
curl wttr.in
@jvarn
jvarn / .zshrc
Created December 14, 2025 12:28
zsh usability essentials (macOS)
# History prefix search
bindkey '^[[A' history-search-backward
bindkey '^[[B' history-search-forward
# Colourised commands
alias ls='ls -G'
alias grep='grep --color=auto'
alias diff='diff --color=auto'
export LESS='-R'
export LSCOLORS=GxFxCxDxBxegedabagaced
@jvarn
jvarn / reinstall_zotero.sh
Created October 23, 2025 05:37
Reinstall Zotero When the Safari Extension Disappears
#!/usr/bin/env bash
set -euo pipefail
APP_NAME="Zotero.app"
APP_PATH="/Applications/${APP_NAME}"
TMP_DMG="/tmp/Zotero_latest.dmg"
DOWNLOAD_URL="https://www.zotero.org/download/client/dl?channel=release&platform=mac"
# Quit Zotero if running