Skip to content

Instantly share code, notes, and snippets.

View ninlith's full-sized avatar

Okko Hartikainen ninlith

View GitHub Profile
@ninlith
ninlith / mouse-bind.sh
Created November 12, 2019 21:45
A hackish way to bind extra mouse buttons under Wayland.
#!/usr/bin/env bash
# -*- indent-tabs-mode: nil; tab-width: 4 -*-
#
# An ugly way to bind extra mouse buttons under GNOME/Wayland or otherwise.
#
# Prerequisites:
#
# Effectively unbind extra mouse buttons by modifying udev/hwdb rules:
# 1. Identify scancodes:
# sudo evemu-record /dev/input/by-path/*event-mouse \
@ninlith
ninlith / namespaced-openvpn.sh
Last active May 19, 2026 08:00
Transfers OpenVPN tunnel interface to a network namespace as its only non-localhost interface.
#!/usr/bin/env bash
# Transfers VPN tunnel interface to a network namespace as its only
# non-localhost interface.
#
# Based on <https://github.com/slingamn/namespaced-openvpn>.
ip netns add protected
ip netns exec protected ip link set lo up
openvpn "$@" --ifconfig-noexec --route-noexec --script-security 2 \
@ninlith
ninlith / tablet_mode.py
Last active November 13, 2021 18:08
Tablet mode (disable keyboard etc.) for a Crouton chroot
#!/usr/bin/env python3
# -*- indent-tabs-mode: nil; tab-width: 4 -*-
"""Enable/disable tablet mode in a Crouton chroot based on lid angle."""
import argparse
import logging
import logging.config
import math
import os