Skip to content

Instantly share code, notes, and snippets.

View elundmark's full-sized avatar
💭
I may be slow to respond.

elundmark

💭
I may be slow to respond.
View GitHub Profile
@elundmark
elundmark / mms.py
Last active February 13, 2020 04:33
Magic Media Sorter - Sort your media correctly! (Tested in: Python v3.8+ on Linux)
#!/usr/bin/env python3.8
"""Magic Media Sorter - Sort your media correctly!"""
import argparse
import operator
import sys
import re
def main(imported=None, importedList=None):
"""main function"""
@elundmark
elundmark / mpv_remote.sh
Last active September 12, 2020 09:21
Remote control for MPV (mpv_remote.sh [play|pause|...] [all])
#!/bin/sh
# License: CC0 <https://creativecommons.org/choose/zero/>
# Author: elundmark@posteo.se
# Link: https://gist.github.com/elundmark/a7e491a1a3b26834972adeeb4962a955
# Using dbus and the mpv-mpris script:
# Targets either the frontmost player,
# or every instance of mpv (all),
# or one or more specific mpv processes by PID,
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history
@elundmark
elundmark / vsleep.js
Last active November 28, 2018 01:33
vsleep - verbose sleep for when you want a progress meter (written for linux+nodejs)
#!/usr/bin/env node
/*
$ vs 10s
vsleep: 10s (current time: 2018-11-28 02:23:22 - ends: 2018-11-28 02:23:32 - length: 0.003 hours)
│ 10s 2ms [100%]
└─ Done ─ Timer reached 10s 4ms [100%] ┐
^C^C 1s 25ms [10%]
└─ CANCELLED!!
@elundmark
elundmark / set_locked_prefs_in_firefox.md
Last active December 11, 2018 04:59
Set locked preference values in Firefox (this guide applies to Linux)

Set my default settings in Firefox

First install dos2unix

This piece of software will convert unix-like text-files to Windows-like text-files, and is recommended by Mozilla when using this method. I have however found that it will work using plain utf8 and unix line-endings (FF 63+).

Now create a file called FIREFOX_INSTALL_DIRECTORY/defaults/pref/local-settings.js with the content:

@elundmark
elundmark / make_m3u_youtube_playlist.sh
Last active April 9, 2023 11:40
Make m3u playlist of a Youtube Playlist (youtube-dl & jq must be installed)
#!/usr/bin/env bash
# $ ./make_m3u_youtube_playlist.sh [-d OUTPUT-DIR] URL [URL ...]
if ! which jq &>/dev/null || ! which youtube-dl &>/dev/null; then
echo "'youtube-dl' and 'jq' must be installed in \$PATH, exiting." 1>&2
exit 1
fi
declare log_file="$HOME/.make_m3u_youtube_playlist.log"
@3v1n0
3v1n0 / pulse-audio-hdmi-switch.sh
Last active February 11, 2021 12:05
Script to automatically switch audio to HDMI using PulseAudio in Linux
#!/bin/bash
USER_NAME=$(who | grep tty$(sudo fgconsole) | cut -f1 -d' ')
USER_ID=$(id -u "$USER_NAME")
HDMI_STATUS=$(</sys/class/drm/card0/*HDMI*/status)
HDMI_CARD="pci-0000_00_03.0"
HDMI_PROFILE="hdmi-stereo-extra1"
INTERNAL_CARD="pci-0000_00_1b.0"
@avih
avih / equalizer.lua
Last active April 17, 2024 23:56
Visual equalizer script for mpv
--[[
mpv 5-bands equalizer with visual feedback.
Copyright 2016 Avi Halachmi ( https://github.com/avih )
License: public domain
Default config:
- Enter/exit equilizer keys mode: ctrl+e
- Equalizer keys: 2/w control bass ... 6/y control treble, and middles in between
- Toggle equalizer without changing its values: ctrl+E (ctrl+shift+e)
@elundmark
elundmark / default.conf
Last active May 12, 2016 02:40
CMUS in LilyTerm 0.9.9.4 (2016-05-11) config - demo/background further down
[main]
# Auto save settings when closing window.
auto_save = 1
# The version of this profile's format. DO NOT EDIT IT!
version = 0.9.9.3
# The default font name of vte terminal.
font_name = Rubik Mono One 10
@elundmark
elundmark / vsleep
Last active August 12, 2022 05:25
Verbose Sleep - echo the progress to stderr
#!/usr/bin/env bash
get_ms () {
date +'%s%N' | grep -oP '^[0-9]{13}'
}
show_usage () {
# *******************************************************************
read -d '' help_text <<- EOF
vsleep - verbose sleep