Skip to content

Instantly share code, notes, and snippets.

View teklynk's full-sized avatar

Ryan Jones teklynk

View GitHub Profile
@teklynk
teklynk / gist:32bf08b116f404e506ba9a8f5a612509
Created October 28, 2025 18:25
Record live streams using FFMPEG and the m3u8 url of the stream
#!/bin/bash
# Dependencies
# YT-DLP (YouTube Downloader)
# sudo wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp
# sudo chmod a+rx /usr/local/bin/yt-dlp
# ffmpeg: Install via apt (apt install ffmpeg)
# mpv: Install via apt (apt install mpv)
# Example: ./stream_record.sh -mpv https://listen.batstationrad.io/hls/1/stream.m3u8
@teklynk
teklynk / gist:b5a6a9fd30ae49629607917282c946a0
Last active October 25, 2025 17:25
Batch video file converter using ffmpeg
#!/bin/bash
convert_file() {
local input_file="$1"
local filename=$(basename "$input_file")
local output_dir="$HOME/Videos/converted"
local output_file="$output_dir/${filename%.*}.mp4"
# Create the output directory if it doesn't exist
mkdir -p "$output_dir"
@teklynk
teklynk / gist:85e4336a31b01230bebfb5c70c9ffae7
Created October 7, 2025 00:43
Bash scrip to remove dead links from your bookmarks
# Export your bookmarks from a chromium based browser as a html file
# Use the exported html bookmarks file as the <input_file>
# Run the script
# The script will use cURL to check if a link is dead. It will attempt a check 5 times before removing the link.
#!/bin/bash
# Function to display usage information
usage() {
echo "Usage: $0 -f <input_file>"
@teklynk
teklynk / gist:9247ed4b3c35052fae17d56df1ad7585
Created October 6, 2025 16:10
A Simple Bash Script to Toggle WiFi on and off - Linux Mint
#!/bin/bash
# Check the current status of WiFi using nmcli
status=$(nmcli -t -f WIFI g)
if [ "$status" = "enabled" ]; then
# WiFi is currently on, so turn it off
echo "Turning WiFi off..."
nmcli radio wifi off
play /usr/share/mint-artwork/sounds/unplug.oga
@teklynk
teklynk / gist:bc6234daf9a10ade13f75cc9522b1064
Created September 30, 2025 00:28
A Simple Bash Script to Toggle Bluetooth on and off - Linux Mint
#!/bin/bash
# You can bind it to a keyboard shortcut (on Linux Mint: Settings → Keyboard → Shortcuts → Custom Shortcuts). Written for the Cinnamon edition of Linux Mint, it should be easy to adapt to other Linux distributions.
# Check if Bluetooth is on or off
status=$(bluetoothctl show | grep "Powered: yes")
if [ -n "$status" ]; then
# Bluetooth is currently on, so turn it off
echo "Turning Bluetooth off..."
@teklynk
teklynk / gist:1ab826c1686a055fb9b77a10781b33d9
Created September 27, 2025 01:36
A Simple Bash Script to Toggle Audio Output on Linux Mint
#!/bin/bash
# pactl list short sinks
#61 alsa_output.usb-SteelSeries_SteelSeries_Arctis_1_Wireless-00.analog-stereo PipeWire s16le 2ch 48000Hz RUNNING
#63 alsa_output.pci-0000_00_1f.3.analog-stereo PipeWire s32le 2ch 48000Hz SUSPENDED
# Set your actual sink names here
SPEAKERS="alsa_output.pci-0000_00_1f.3.analog-stereo"
HEADSET="alsa_output.usb-SteelSeries_SteelSeries_Arctis_1_Wireless-00.analog-stereo"
@teklynk
teklynk / gist:a25e31fd40c0718c263feb95d73081c8
Created August 4, 2025 02:41
Automated Nginx, UFW, Cloudflare IP allow script
#!/bin/bash
# I use this script on a few NGINX servers that are behind Cloudflare. I use it to restrict access and to only allow access from a Cloudflare IP addresses.
# This means that clients must hit cloudflare's proxied DNS first before accessing your website, reventing clients from accessing your server via the host/server IP.
# The script downloads a list of Cloudflare IP addresses, generates a allow list file, restarts NGINX, creates firewall rules using UFW, restarts UFW.
# I run the script as a cron job on a weekly schedule.
# Add this line to your websites nginx config.
# include /etc/nginx/cloudflare_ips.conf;