Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
<test name="family">
<string>Ubuntu Light</string>
</test>
<edit name="family" binding="same" mode="prepend">
<string>Ubuntu</string>
</edit>
@s-zeid
s-zeid / silence
Last active May 16, 2020 05:55
Play silence via PulseAudio
#!/bin/sh
# no exec in order to allow checking if the script is running
paplay --raw /dev/zero >/dev/null 2>&1
@s-zeid
s-zeid / media
Last active June 5, 2020 05:30
raspberry pi media tmux window
#!/bin/sh
NAME=media
ACCENT_COLOR='#ab7fcc'
pane_cmd() { echo "echo '\$' $@; $@; PS1='\$ ' exec bash --posix"; }
setup_tmux() {
[Service]
TimeoutStopSec=5
@s-zeid
s-zeid / opkg-pkgs-from-image
Created July 16, 2020 07:36
Get installed packages from an OpenWrt image (requires p7zip-full)
#!/bin/sh
if [ $# -ne 1 ]; then
echo "Usage: $(basename -- "$0") <image-file>" >&2
exit 2
fi
7z -so e "$1" usr/lib/opkg/status \
| grep '^Package:' | cut -d' ' -f 2 | sort
@s-zeid
s-zeid / show-script-opt.lua
Last active July 30, 2020 11:18
custom command (script message) for mpv to show a script option on the OSD
-- input.conf usage: <key> script-message show-script-opt <opt-name> <default>
-- Example: t script-message show-script-opt osc-title "${media-title}"
mp.register_script_message("show-script-opt", function(name, default)
local value = mp.get_opt(name)
if not (value == nil or value == "") then
value = mp.command_native({"expand-text", value})
else
value = default or "(unavailable)"
end
MBTN_LEFT set pause no
MBTN_RIGHT cycle fullscreen
MBTN_RIGHT_DBL cycle fullscreen
WHEEL_UP add volume 2
WHEEL_DOWN add volume -2
WHEEL_LEFT ignore
WHEEL_RIGHT ignore
- add volume -2
= add volume 2
+ add volume 2
@s-zeid
s-zeid / ms_binary_test.rs
Last active August 16, 2020 04:17
Rust macros for reading types from binary streams
// Imports {{{1
use std::io;
extern crate byteorder; // 1
use byteorder::{/*ReadBytesExt,*/ LittleEndian};
extern crate num_traits; // 0.2
use num_traits::ToPrimitive;
@s-zeid
s-zeid / emoji-favicon.js
Last active February 22, 2021 12:26
Set a favicon from an emoji defined in an HTML attribute. Uses the Canvas API. — https://on.bnay.me/emoji-favicon/
"use strict";
//export default
class EmojiFavicon {
static DEFAULT_ATTRIBUTE_NAME() { return "data-emoji-favicon"; }
static set(emoji, shadowColor, size) {
shadowColor = (typeof shadowColor === "string") ? shadowColor : null;