Skip to content

Instantly share code, notes, and snippets.

@thielemans
thielemans / routing.sh
Last active February 7, 2019 14:08
VPN routing script to only routes traffic for a specified user/group over VPN
File: routing.up (chmod 0775)
#!/bin/sh
iptables -t mangle -A OUTPUT -m owner --uid-owner vpnusername -j MARK --set-mark 3 #Change vpnusername
iptables -t nat -A POSTROUTING -o ${dev} -j SNAT --to-source ${ifconfig_local}
ip rule add fwmark 3 lookup 200
ip route add 192.168.1.0/24 dev eth0 table 200 # Change the IP to your LAN IP
ip route add default via ${route_vpn_gateway} dev ${dev} table 200
@thielemans
thielemans / ffmpeg-audioconvert
Last active November 1, 2024 01:29
Add a 5.1 DTS or AC3 audio stream from a 7.1 DTS-HD stream using ffmpeg to allow directplay
#Downconvert 7.1 DTS-HD to DTS 5.1:
ffmpeg -i in.mkv -strict -2 -map 0:a:0 -c dts -af "channelmap=channel_layout=5.1" dts.mkv
#Downconvert 7.1 DTS-HD to AC3 5.1:
ffmpeg -i in.mkv -map 0:a:0 -c ac3 -ac 6 -ab 640k ac3.mkv
#Add downconverted audio streams via ffmpeg:
ffmpeg -i in.mkv -i dts.mkv -i ac3.mkv -map 0:v -c:v copy -map 0:a -c:a copy -map 1:a -c:a copy -map 2:a -c:a copy -map 0:s -c:s copy out.mkv
#Or use MKVToolNix
@thielemans
thielemans / gist:4246df73d159985b16f0e87c72e2f332
Created May 31, 2019 09:37
Contiki setup on a new linux (virtual) machine
1. Installation
a. Install & update Linux
b. Optional: Install virtualbox guest additions
c. If using a minimal install, install common developer tools like java, git, etc…
i. sudo apt install openjdk-8-jdk git python build-essential
ii. Optional: Install Eclipse IDE for C/C++ Developers
2. Download Contiki from git
a. git clone https://github.com/contiki-os/contiki.git
b. git submodule update --init --recursive