Skip to content

Instantly share code, notes, and snippets.

View bonelifer's full-sized avatar

William Jacoby bonelifer

View GitHub Profile
@bonelifer
bonelifer / mpd-notifications.py
Created May 4, 2024 05:26
This script monitors MPD for database update events and sends notifications accordingly to a local NTFY.sh instance.
#!/usr/bin/env python3
"""
MPD Database Update Notification Script
This script monitors MPD for database update events and sends notifications accordingly to a local NTFY.sh instance.
Usage:
Run the script without any arguments to monitor MPD updates in real-time.
Use the -t or --test flag to send a test notification regardless of MPD state.
@bonelifer
bonelifer / thelounge-user-managment.sh
Last active April 29, 2024 23:08
Bash script to add a user to The Lounge IRC web client Docker container, reset an existing users password, or remove a current user
#!/bin/bash
# Bash script to manage users in The Lounge IRC web client Docker container
# Function to add user to The Lounge IRC web client Docker container
add_user_to_container() {
local container_name=$1 # Name of the Docker container
local username=$2 # Username to be added to The Lounge
docker exec -it $container_name s6-setuidgid abc thelounge add $username
}
@bonelifer
bonelifer / installer.sh
Last active April 28, 2024 19:39 — forked from TehPeGaSuS/thelounge_purge.sh
Maintaince scripts for TheLounge IRC web client databases and text logs. Default systemd timer is 11pm. Includes installer script.
#!/bin/bash
################################################################################
# Name: installer.sh #
# Description: Install maintenance script for The Lounge IRC client. Cleans #
# SQLite db and text log files. #
# #
# Usage: ./installer.sh [options] #
# Describe how to use the script, including any options or flags. #
# #
@bonelifer
bonelifer / html_mail.py
Created April 24, 2024 22:24 — forked from ehrenfeu/html_mail.py
Use Python to send HTML emails with expand/collapse boxes working in TB and Android
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
def send_html_mail(subject, body, to_addr, from_addr):
"""Send an HTML email using the given subject, body, etc."""
# Create message container - the correct MIME type is multipart/alternative here!
message = MIMEMultipart('alternative')
message['subject'] = subject
@bonelifer
bonelifer / drive-backup.py
Last active April 23, 2024 20:48
Collection of Python scripts to backup Google Drive files. Created using chatGPT. These are not meant to be sync clients. As such edit docuements online, then download them. This is a one way process to backup your Drive contents locally.
#!/usr/bin/env python3
"""
Script: drive-backup.py
Description: Downloads the entire contents of a Google Drive using Google Drive API.
Requirements:
- Google Client Library: `pip install google-api-python-client`
- Create a project in Google Cloud Console, enable Drive API, and generate credentials (OAuth 2.0 Client IDs).
- Save the credentials JSON file as 'credentials.json' in the same directory as this script.
Usage:
@bonelifer
bonelifer / monitor_albums.sh
Created April 22, 2024 06:00 — forked from jordandrako/monitor_albums.sh
[Un]monitor Albums in Lidarr
#!/bin/bash
helpText="
# Usage:\n
#\n
# ./monitor_albums.sh -k 'apiKey' -b 'http://host:port' -t [Single|EP|Album] [-m|u|A|h][-n 'artist name'][-i artistId]\n
#\n
# Required Options:\n
# -k Your Lidarr API Key (defaults to \$apiKey env variable)\n
# -b Your Lidarr instance URL (defaults to \$baseUrl env variable)\n
#!/usr/bin/env bash
################ Description: ###################
# This script disables telemetry opt-out under
# Ubuntu 22.04 (Codename: Jammy Jellyfish).
# It resolves telemetry domains to 0.0.0.0 and removes
# telemetry services system-wide.
################ Parameter: #####################
# None

Automatic Sync Using udev

Phone Udev Rule Setup

Overview

This guide explains how to set up udev rules to automatically mount your phone at /mnt/phone and synchronize music files from a local directory to the phone when it's connected to your computer.

Installation

@bonelifer
bonelifer / commit.sh
Last active April 17, 2024 20:48 — forked from theHilikus/commit-alias.sh
alias to create empty commits
#!/bin/bash
# Function: commit
# Description: Commits changes to the current branch with an empty commit message containing the branch name.
commit() {
# Check if the current directory is within a Git repository
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
echo "Error: Not in a Git repository. Please navigate to a Git repository directory."
return 1