Skip to content

Instantly share code, notes, and snippets.

View ninlith's full-sized avatar

Okko Hartikainen ninlith

View GitHub Profile
@ninlith
ninlith / namespaced-openvpn.sh
Created November 6, 2019 15:53
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>.
sudo ip netns add protected
sudo ip netns exec protected ip link set lo up
sudo 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