Skip to content

Instantly share code, notes, and snippets.

@un-def
un-def / nmcli-toggle.py
Created June 24, 2015 08:43
Toggle network connection up/down using nmcli
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import subprocess
if len(sys.argv) < 2:
print("Usage: nmcli-toggle.py connection_id")
sys.exit()
conn_id = sys.argv[1]
active = subprocess.check_output(['nmcli', 'connection', 'show', '--active'])
up_down = ('up', 'down')[conn_id in active]
@un-def
un-def / openwrt-update-tz.sh
Created April 23, 2015 07:21
Update OpenWrt timezones from github.com/openwrt/luci
#!/bin/sh
cd /usr/lib/lua/luci/sys/zoneinfo
for f in tzdata.lua tzoffset.lua
do
mv $f $f.bak
wget -nv --no-check-certificate https://raw.githubusercontent.com/openwrt/luci/master/modules/luci-base/luasrc/sys/zoneinfo/$f
done