Skip to content

Instantly share code, notes, and snippets.

View tunalad's full-sized avatar
🎸
tunalad.bandcamp.com

Новица tunalad

🎸
tunalad.bandcamp.com
View GitHub Profile
@tunalad
tunalad / bandcampReleaseIdentifier.js
Last active January 28, 2024 23:01
Helps with identifying if the release is a track or an album, right under the release's title
// ==UserScript==
// @name Bandcamp Release Identifier
// @version 1.1
// @description tells you if the release is a track or album under its title
// @author tunalad
// @match *://*.bandcamp.com/*
// @exclude *://bandcamp.com/
// @grant none
// ==/UserScript==
@tunalad
tunalad / fc-install.py
Created January 15, 2024 23:26
Helps with installing fonts on linux. You can install a font by either calling directly on the font file, or on archive where the font files can be found
#!/usr/bin/env python3
import os
import sys
import subprocess
import patoolib # `patool` package
import tempfile
import shutil
FONT_EXTENSIONS = (".ttf", ".otf")
// ==UserScript==
// @name Bandcamp Album Length
// @version 1.1
// @description adds text below the tracklist with the album's total length
// @author tunalad
// @match *://*.bandcamp.com/album/*
// @exclude *://bandcamp.com/
// @grant none
// ==/UserScript==
From 05befebe956d7e42e540bf86d0a6b938f7573e3c Mon Sep 17 00:00:00 2001
From: tunalad <28594843+tunalad@users.noreply.github.com>
Date: Mon, 6 Nov 2023 22:19:07 +0100
Subject: [PATCH] terminal-envvar patch
pretty much clone of dwm's `environmentvars` patch, it loads the name of the terminal emulator to be used as termcmd from the environment variable TERMINAL using getenv(3p).
example:
```sh
$ export TERMINAL="alacritty"
```
@tunalad
tunalad / ntfy.sh
Last active October 21, 2023 15:18
A wrapper script for curl to send push notifications via ntfy
#!/bin/bash
seed="your seed here"
random_string=$(echo "$seed" | sha256sum | cut -c 1-32)
url="ntfy.sh/$random_string"
message="example"
headers=()
data="-d \"$message\""
@tunalad
tunalad / notify-battery.sh
Last active October 9, 2023 16:33
Simple battery notification system using `dunst` for local notifications, and ntfy for mobile push notification. Create a cronjob that will run this script.
#!/usr/bin/bash
DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
export XDG_RUNTIME_DIR="/run/user/1000"
HOSTNAME=$(uname -n)
NTFY_TOPIC="your notify.sh topic here"
acpi -b | awk -F'[,%]' '{print $2, $4, $5}' | {
read -r capacity timeleft status
@tunalad
tunalad / toggle_osc.lua
Created July 4, 2023 16:17
In input.conf, put something like this: `B script-message toggle_osc`
--[[
Toggles OSC between "auto" and "always"
https://gist.github.com/tunalad/d00a8e6ba5e2e2cd16619df0ea8e785d
]]--
local osc_visible = false
local function toggle_osc()
osc_visible = not osc_visible
if osc_visible then
mp.commandv("script-message", "osc-visibility", "always")
@tunalad
tunalad / volumectl-pactl.sh
Last active January 26, 2024 20:02
Volume control script for pulseaudio. Here dunstify is being used, since it has some useful options that notify-send doesn't have.
#!/usr/bin/bash
DEFAULT_SINK="alsa_output.pci-0000_00_1b.0.analog-stereo"
drawVol(){
getVol=$(pactl get-sink-volume $DEFAULT_SINK | awk '{print $5}')
getVolTrim=${getVol::-1}
dunstify -u low -r 9993 -h int:value:"$getVolTrim" "Volume: ${getVol}" -t 2000
}
@tunalad
tunalad / dwm-session.sh
Created March 7, 2022 18:43
dwm login session script utilising dmenu (and slock for screen locking)
#!/usr/bin/bash
pick=$(echo -e " Power off\n Reboot\n Lock\n Logout" | dmenu -i -l 5)
case $pick in
" Power off") shutdown now ;;
" Reboot") reboot ;;
" Lock") slock ;;
" Logout") killall dwm ;;
*) exit 1 ;;
@tunalad
tunalad / screenshot.sh
Last active January 26, 2024 20:38
Screenshot script for taking EPIC screenshots, works for both wayland and x11
#!/bin/bash
# packages needed:
# For Wayland:
# grim - screenshot tool
# slurp - selection tool
# For X11:
# maim - screenshot tool for X11
#
# clipboard - cross platform clipboard tool (https://github.com/Slackadays/Clipboard)
# libnotify - sends notifications