Skip to content

Instantly share code, notes, and snippets.

@xZise
xZise / README.md
Created March 20, 2026 16:49
Toggle LEDs in OpenWRT routers

leds.sh — OpenWRT LED Control Script

A simple shell script for OpenWRT-based routers to turn all LEDs on or off on a schedule, e.g. to avoid light pollution at night.

Compatibility

This script was written for and tested on a Fritz!Box 7530/Fritz!Box 4040 running OpenWRT. It should work on other OpenWRT devices as well, but LED names and behaviour may differ. In particular, the line

echo default-on > /sys/class/leds/red:info/trigger
using System.Reflection;
using UnityModManagerNet;
using Harmony12;
using UnityEngine;
using System.Collections.Generic;
namespace FanService
{
public class FanServiceMod
{
@xZise
xZise / main.c
Last active November 30, 2016 21:18
christmas light
#include <stdint.h>
#include <stdlib.h>
#include <avr/io.h>
#include <avr/sleep.h>
#include <avr/interrupt.h>
#include "light_ws2812.h"
#define FPS (33)
#define NUM_OF_LEDS (10)
@xZise
xZise / aspects.py
Last active October 14, 2015 19:58
Testing green
# -*- coding: utf-8 -*-
"""
Test aspects to allow fine grained control over what tests are executed.
Several parts of the test infrastructure are implemented as mixins,
such as API result caching and excessive test durations. An unused
mixin to show cache usage is included.
"""
#
# (C) Pywikibot team, 2014-2015
nightly/core
2
2015-10-06T12:02:43
f67a7f5
@xZise
xZise / script.sh
Created March 5, 2015 20:26
owncloud backup
now=`date +"%Y%m%d"`
sudo tar -cf ./owncloud-$now.tar /var/www/owncloud/
sudo chown fabian:fabian ./owncloud-$now.tar
echo 'PostgreSQL password coming up...'
pg_dump owncloud -h localhost -U postgres -f owncloud-sqlbkp_$now.bak
tar -rf ./owncloud-$now.tar owncloud-sqlbkp_$now.bak
echo 'Compressing...'
xz owncloud-$now.tar
echo 'Encrypting...'
openssl aes-256-cbc -salt -in owncloud-$now.tar.xz -out owncloud-$now.tar.xz.aes
@xZise
xZise / convert.py
Created January 12, 2015 12:02
Convert PCRE regex into Python
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
if sys.version_info[0] > 2:
unichr = chr
def make_compatible(src):
delim = src[0]
@xZise
xZise / branch-status.py
Last active August 29, 2015 14:12
Remove branches which have been merged
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Clean up the git branches by removing branches whose change-id got merged."""
from __future__ import unicode_literals
import argparse
import collections
import itertools
import json
import re
@xZise
xZise / by-len.txt
Last active August 29, 2015 14:12
Line length analysis for ad6920135ef015855724ac660fa0dcfb1459cfda
Lines (line number in brackets) sorted for length
pywikibot/site.py 137 (l 3959)
pywikibot/site.py 126 (l 3958)
pywikibot/site.py 110 (l 3963)
pywikibot/site.py 108 (l 4458)
pywikibot/site.py 106 (l 588)
pywikibot/site.py 101 (l 3960)
pywikibot/site.py 095 (l 4380)
pywikibot/site.py 095 (l 4507)
@xZise
xZise / gist:75c482a5871f0b1cb55b
Last active August 29, 2015 14:11
Parser for advanced argparse values
#!/usr/bin/python
# -*- coding: utf-8 -*-
from collections import OrderedDict
def parse_value(value, parameters, allow_unknown=False):
"""
Parse the value of an argument into subarguments.
The value is basically a comma-separated string. Each comma-separated value
can be named which is separated by an equals sign. It is possible to escape