Skip to content

Instantly share code, notes, and snippets.

@s-zeid
s-zeid / qisprint.cc
Last active April 14, 2020 17:15
Print whether Qt 5's `QChar::isPrint()` is true for one or more code points
// g++ -fPIC -I/usr/include/qt5 -lQt5Core qisprint.cc -o qisprint
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <QtCore/qchar.h>
@s-zeid
s-zeid / gtk-3.0_light-font.css
Last active March 14, 2020 13:43
Force light font in GTK+ 3 windows
window {
font-weight: 300;
}
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 / tt-rss.css
Last active March 14, 2020 12:17
Custom colors, fonts, and scrollbars for Tiny Tiny RSS
/* Options */ :root {
--accent-normal: #642792;
--accent-light: #642792cc;
--accent-dark: #642792;
--scrollbar-thumb-normal: #ccc;
--scrollbar-thumb-sidebar: #d8d8d8;
--scrollbar-thumb-inactive: #e6e6e6;
--scrollbar-track: transparent;
--font-family-sans: "Ubuntu", "Droid Sans", "Trebuchet MS", "DejaVu Sans", "Bitstream Vera Sans", "Verdana", sans-serif;
@s-zeid
s-zeid / disable-wakeups.service
Created March 8, 2020 09:52
Disable USB and lid wakeup triggers in /proc/acpi/wakeup. Adapted from <https://bbs.archlinux.org/viewtopic.php?pid=1575617#p1575617> by 9233.
[Unit]
Description=Disable USB and lid wakeup triggers in /proc/acpi/wakeup
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'for i in EHC1 EHC2 XHC LID0; do echo $i > /proc/acpi/wakeup; done'
ExecStop=/bin/sh -c 'for i in EHC1 EHC2 XHC LID0; do echo $i > /proc/acpi/wakeup; done'
RemainAfterExit=yes
[Install]
@s-zeid
s-zeid / tst-separator.url
Last active September 7, 2022 07:09
Tree Style Tab separator data: URI (public domain / Creative Commons Zero)
data:text/html;charset=utf-8,<html id="separator" data-string="\u2013" data-length="35" data-background="GrayText" data-opacity="0.125"> <link rel="help" href="https://gist.github.com/f4c51606f99e990774133e9eb46905ee" /><script>addEventListener("load", () => { const html = document.documentElement; document.title = JSON.parse(`"${html.dataset.string.replace('"', '\\"')}"`).repeat(Number(html.dataset.length) || 1); const background = document.querySelector("[id='background']"); background.style.background = html.dataset.background || "unset"; background.style.opacity = html.dataset.opacity || "1"; });</script><style>body, [id="background"] { height: 100%; margin: 0; }</style><link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA
@s-zeid
s-zeid / bw-session.sh
Last active May 14, 2022 14:52
Shell function to automatically manage the BW_SESSION environment variable for the Bitwarden CLI. Public domain via CC0.
# Shell function to automatically manage the BW_SESSION environment variable
# for the Bitwarden CLI. Public domain via CC0.
# <https://gist.github.com/c0acd6bcafbc8af3dafefc90d1e0765d>
bw() {
local cmd="$1"
[ $# -ge 1 ] && shift || true
if [ x"$cmd" = x"unlock" ] && [ $# -eq 0 ]; then
local session="$(FORCE_COLOR=$(_bw_force_color) _bw_run "$cmd" --raw "$@")"
if [ x"$session" != x"" ]; then
@s-zeid
s-zeid / 7zt
Last active January 28, 2022 05:44
(moved to https://gitlab.com/s-zeid/bin/) Use Vim to browse archives supported by p7zip
#!/usr/bin/env python3
"""A tar(1)-like interface for 7z(1)."""
import argparse
import os
import subprocess
import sys
@s-zeid
s-zeid / get-sessionstore-json.js
Last active April 8, 2020 07:49
Get sessionstore JSON for a single Firefox window (including private windows)
// Run in Browser Console (Ctrl+Shift+J; ≡ menu → Web Developer → Browser Console),
// then right click on the JSON output and click Copy object.
// Use (eg.) <https://code.s.zeid.me/bin/blob/master/sessionstore2html> to convert to HTML.
SessionStore.getWindowState(window);
@s-zeid
s-zeid / 80-udisks2-ignore-loop.rules
Last active October 6, 2018 08:48
udev rules file to make udisks ignore loop devices
KERNEL=="loop*", ENV{UDISKS_IGNORE}="1"