Skip to content

Instantly share code, notes, and snippets.

@ftk
ftk / notification-watch.sh
Last active June 27, 2024 10:55
check for one-time codes coming as notifications via KDE connect and copy them to clipboard
#!/usr/bin/env bash
# check for one-time codes coming as notifications via KDE connect and copy them to clipboard
# requirements: qdbus(qt-tools), dbus-monitor, kde-connect, klipper
# the script must be run in user session
set -euo pipefail
shopt -s lastpipe
if [[ $# -eq 0 ]]
then
@ftk
ftk / mpv-playlist-kdialog.lua
Last active June 5, 2024 15:32
open mpv playlist in kdialog or zenity (default: Ctrl+L)
-- ==UserScript==
-- @name mpv-playlist-kdialog
-- @version 0.1
-- @description Display mpv playlist and select playlist entry in KDE's kdialog or Gnome's zenity.
-- @author ftk
-- @license 0BSD
-- @downloadURL https://gist.githubusercontent.com/ftk/5e26656a2ec9a6cb0fef46918f741d0a/raw/mpv-playlist-kdialog.lua
-- ==/UserScript==
local options = {
-- window dimensions
@ftk
ftk / Cargo.toml
Last active July 1, 2024 04:38
http mitm proxy. Simple http proxy to modify Range: http headers. Can be used to speed up youtube in mpv
# To generate mitm cert and key:
# openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -passout pass:"third-wheel" -subj "/C=US/ST=private/L=province/O=city/CN=hostname.example.com"
# see: https://github.com/campbellC/third-wheel
[package]
name = "http-ytproxy"
version = "0.1.0"
edition = "2021"
@ftk
ftk / build.sh
Created May 22, 2024 11:46
libspnav example controlling mouse using spaceball (uinput)
# build with spnav
gcc simple.c `pkg-config spnav --cflags --libs` -lm -O3 -flto -osimple_uinput
# build without spnav
gcc simple.c spnav.c proto.c -O3 -lm -flto -osimple_uinput
@ftk
ftk / win2lin.cpp
Last active February 3, 2019 14:52
Wrapper for windows subsystem for linux: run ubuntu applications from windows
// Wrapper for windows subsystem for linux (Bash on Ubuntu on Windows)
// It allows running native ubuntu applications from Windows
// 1. Compile (on windows, the command below is for mingw-gcc):
// g++ -O3 -flto -fwhole-program -fvisibility=hidden -fno-exceptions -fno-rtti -s win2lin.cpp -o win2lin.exe
// 2. make a copy for each program
// for i in git python perl; do cp win2lin.exe ${i}.exe; done
// 3. put directory with exes in windows PATH
// 4. example (from cmd.exe):
// cat "c:\test 1.txt"
// will be translated to: bash -c "exec cat \"/mnt/c/test 1.txt\""