Skip to content

Instantly share code, notes, and snippets.

View bonelifer's full-sized avatar

William Jacoby bonelifer

View GitHub Profile
"""
Small script that syncs the current now playing (MPD) with Icecast
By Melan
"""
import time
import os
import requests
from mpd import MPDClient
@bonelifer
bonelifer / mpd_notifs.sh
Created February 24, 2024 01:38 — forked from bruhgettei/mpd_notifs.sh
Script for MPD notifications using gdbus and mpc
#!/bin/sh
notify () {
echo "$(gdbus call --session \
--dest org.freedesktop.Notifications \
--object-path /org/freedesktop/Notifications \
--method org.freedesktop.Notifications.Notify \
MPD \
$1 \
"" \
"Now Playing:" \
@bonelifer
bonelifer / managing_laptop_power_usage.md
Created February 23, 2024 08:53 — forked from jvalduvieco/managing_laptop_power_usage.md
A quick guide to manage laptop power usage with udev and systemd

Managing laptop power usage

Create systemd targets and services

Create AC target (/etc/systemd/system/ac.target):

[Unit]
Description=On AC power
DefaultDependencies=no
StopWhenUnneeded=yes
@bonelifer
bonelifer / ak70.sh
Created January 28, 2024 03:35 — forked from sayoder/ak70.sh
rsync to Astell&Kern AK70 over mtp
#!/bin/bash
# Requirements: go-mtpfs, rsync, fuse2
MUSICDIR="/home/<USER>/Music/"
DEVICEMUSICDIR="/mnt/ak70/Internal storage/Music/"
MOUNTPOINT="/mnt/ak70/"
print_usage() {
echo "Usage: $0 mount|umount|drysync|fullsync|hardsync|sync"
#!/usr/bin/python3
import csv
import beets.library
from termcolor import colored
import beets.ui
LIBRARYDB = '/home/MYUSER/.config/beets/library.db'
EXPORTIFY_CSV = './spotify.csv'
@bonelifer
bonelifer / AutoFanControl.yaml
Created January 13, 2024 22:36 — forked from WillCodeForCats/AutoFanControl.yaml
HA Blueprint: Auto Fan Temperature Control for 3-Speed Fan
blueprint:
name: Auto Fan Temperature Control for 3-Speed Fan
author: WillCodeForCats
description:
"This sets the fan speed for a 3-speed fan based on aroom temperature
sensor entity. Any fan entity with 3 speeds will work with this blueprint.
There are action selectors for both the cycle loop and the shutdown loop for adding
control of heating / cooling sources, or anything else you want Home Assistant
to do.
@bonelifer
bonelifer / bt-addr.sh
Created December 2, 2023 12:10 — forked from PieGuy314/bt-addr.sh
Update/Create ALSA config file with updated BD_ADDR
#!/bin/sh
#
# Update alsa config file with new BD_ADDR
# Backup original
# Create a new config file if one doesn't exist
usage() {
echo "Usage: $0 xx:xx:xx:xx:xx:xx"
}
@bonelifer
bonelifer / gist:5b9e7e38ce6f732b953129d5959aad2c
Created December 2, 2023 12:06 — forked from emmaly/gist:8267078
Bash script to automatically switch PulseAudio sink to Bluetooth headset on connect with A2DP profile and 50% volume.
#!/bin/bash
sink_name="bluez_sink.00_42_1B_AD_FA_CE"
if [ -z "$1" ]; then
dbus-monitor --system "path=/org/bluez/777/hci0/dev_00_42_1B_AD_FA_CE, interface=org.bluez.AudioSink, member=Connected" | while read line; do
echo $line
$0 1
done
else
@bonelifer
bonelifer / pipewire-bluetooth-headphone-manager
Created December 2, 2023 12:01 — forked from abdullahkhalids/pipewire-bluetooth-headphone-manager
A bash script that helps reliably connect to bluetooth headphones. Just bind the three possible inputs to different keyboard shortcuts.
#!/bin/bash
#sudo systemctl start bluetooth.service
connect() {
bluetoothstatus=`bluetooth | cut -c 13-`
if [ "$bluetoothstatus" == "off" ]; then
bluetooth on
#!/bin/bash
if [ "$1" == "-h" ] || [ "$1" == "--help" ]
then
me=`basename "$0"`
echo "Find information about TCP/IP ports."
echo -e "Usage:\n\t./${me} [port|service]"
echo -e "Example:\n\t./${me} snmp\n\t./${me} 3389"
exit 1
fi