Skip to content

Instantly share code, notes, and snippets.

View Vonr's full-sized avatar
🪖
Conscripted 🇸🇬

Qther Vonr

🪖
Conscripted 🇸🇬
View GitHub Profile
@Vonr
Vonr / ringboard-rofi.sh
Last active July 4, 2026 11:51
Rofi dmenu dialog for Ringboard (SUPERCILEX/clipboard-history)
#!/bin/sh
tmp="$(mktemp --suffix '.ringboard')"
if [ "$?" -ne 0 ]; then
exit 1
fi
trap "rm -rf \"$tmp\"" EXIT
menu() {
@Vonr
Vonr / CachedSort.java
Last active May 14, 2026 09:03
CachedSort for Java, BSD-0
// Copyright (C) 2026 by Qther <qther@tuta.io>
//
// Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.*;
@Vonr
Vonr / main.rs
Last active August 15, 2023 16:22
Function Overloading Macro for Nightly Rust (180dffba1)
#![feature(unboxed_closures)]
#![feature(fn_traits)]
/// Please do not actually use this.
/// This was only made as a proof-of-concept.
macro_rules! idents_to_tuple {
() => {
()
};
@Vonr
Vonr / rofi-nerdfont.sh
Last active May 8, 2022 11:45
NerdFont picker for rofi
#!/usr/bin/env sh
# Requires: curl, htmlq, sed, grep, xargs, rofi, xclip
([ -f '/tmp/nerdfont-icons.md' ] \
|| (curl -s 'https://raw.githubusercontent.com/ryanoasis/nerd-fonts/gh-pages/_posts/2017-01-04-icon-cheat-sheet.md' \
| htmlq --text '#glyphCheatSheet' \
| sed 's/\W//g' \
| grep . \
| sed 's/\(.*\)\(.\{4\}\)$/\2 \2 \1/g' \
| xargs -I {} printf '\u{}\n' \
@Vonr
Vonr / orphanage.sh
Last active March 20, 2022 12:28
Easy-to-use orphaned package remover
#!/bin/bash
# DISCLAIMER: I have learnt after publishing this script that it is much easier to run
# pacman -D --asexplicit <packages you wish to keep>
# This script is used to individually check
# and remove orphaned packages from the system.
# Optional depedencies: rg (replaces grep),
# doas (replaces sudo)
@Vonr
Vonr / 8mb
Last active October 28, 2021 03:13
8mb video compressor
#!/bin/sh
stripped=$(echo $1 | sed 's/ //g')
rmdir /tmp/8mb
mkdir -p /tmp/8mb/
cp "$1" /tmp/8mb/
mv "/tmp/8mb/$1" /tmp/8mb/$stripped
vbr=$(echo "8*8192/$(ffprobe -i /tmp/8mb/$stripped -v quiet -show_entries format=duration -hide_banner -of default=noprint_wrappers=1:nokey=1)-128-2" | bc -l)
ffmpeg -y -i /tmp/8mb/$stripped -c:v libx264 -b:v ${vbr}k -pass 1 -an -f null /dev/null
ffmpeg -y -i /tmp/8mb/$stripped -c:v libx264 -b:v ${vbr}k -pass 2 -c:a aac -b:a 128k /tmp/8mb/out.mp4