Skip to content

Instantly share code, notes, and snippets.

View Main.cs
using System.Reflection;
using UnityModManagerNet;
using Harmony12;
using UnityEngine;
using System.Collections.Generic;
namespace FanService
{
public class FanServiceMod
{
@xZise
xZise / main.c
Last active Nov 30, 2016
christmas light
View main.c
#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 Oct 14, 2015
Testing green
View aspects.py
# -*- 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
@xZise
xZise / script.sh
Created Mar 5, 2015
owncloud backup
View script.sh
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 Jan 12, 2015
Convert PCRE regex into Python
View convert.py
#!/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 Aug 29, 2015
Remove branches which have been merged
View branch-status.py
#!/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 Aug 29, 2015
Line length analysis for ad6920135ef015855724ac660fa0dcfb1459cfda
View by-len.txt
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 Aug 29, 2015
Parser for advanced argparse values
View gist:75c482a5871f0b1cb55b
#!/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
View gist:43407277407c4aa33dd9
def interwiki_prefix_path(self, site, max_depth=2):
# all sites already checked
visited = set()
old_queue = [(self, [])]
new_queue = []
for depth in range(max_depth):
print('D{}'.format(depth))
print('Q{}'.format(old_queue))
for checked_site, path in old_queue:
print('-' * 30)