This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sre_parse | |
h_rep, = sre_parse.parse(r'[^\S\n\v\f\r\u2028\u2029]') | |
def sre_parse_escape(source, escape, state): | |
if escape == r'\h': | |
return h_rep | |
else: | |
return original_sre_parse_escape(source, escape, state) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re, re_h_mod | |
p1=re.compile(r'test\s+stuff') | |
p2=re.compile(r'test\h+stuff') | |
print('p1', p1) | |
print('\t', p1.match('test \t stuff')) | |
print('\t', p1.match('test \n stuff')) | |
print() | |
print('p2', p2) | |
print('\t', p2.match('test \t stuff')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <fcntl.h> | |
#include <elfutils/libdwelf.h> | |
#include <dwarf.h> | |
/* | |
Bottom part of `objdump -Wi t3.o´ is: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import local_5strip, time, math, random, colorsys | |
lamp = local_5strip.LocalLamp(local_5strip.lamp, '/dev/ttyUSB0', 921600, auto_connect=True) | |
sub_frames = 7 #Because ... why not? =D | |
sub_frame_frequency = 2000 | |
#This is our internal buffer for the values for each lantern (5 lanterns, r, g, b per lantern) | |
lanterns = [[0, 0, 0] for l in range(5)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes, collections, struct | |
weapon_info = collections.namedtuple('weapon_info', 'id name comment') | |
class table_index: | |
def __init__(self, index): | |
self.name = None | |
self.index = index | |
def __set_name__(self, target, name): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#define table_length_bits 5 | |
//full_table_index_type have to be at least table_length_bits + 2 | |
#define full_table_index_type uint_least8_t | |
//table_index_type have to be at least table_length_bits | |
#define table_index_type uint_least8_t | |
#define storage_bits 15 | |
//Output will be +/- storage_bits so 15 bits storage will be 16 bit output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xml.etree.ElementTree, re, zipfile, collections | |
def get_ns(tag): | |
ns = re.findall(r'\{(.*)\}(.*)', tag)[0] #Assume only one | |
return ns | |
def one_or_default(it, default=None): | |
try: | |
result = it.__next__() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define BIT_0 6 | |
#define BIT_1 14 | |
#define FREQ 800000 | |
#define NUMBER_LEDS 6 | |
#define HUE_RANGE 0x6000U | |
#define HUE_SPREAD (HUE_RANGE / NUMBER_LEDS) | |
#define HUE_SPEED 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Project settings | |
PROJECT_NAME = led_böp | |
SOURCES = main.c | |
BUILD_DIR = build/ | |
OBJECTS = $(SOURCES:%.c=$(BUILD_DIR)%.o) | |
MACRO_DEFS = $(SOURCES:%.c=$(BUILD_DIR)%.macro_defs) | |
TARGET_ELF = $(BUILD_DIR)$(PROJECT_NAME).elf | |
TARGET_BIN = $(TARGET_ELF:%.elf=%.bin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
#encoding=utf-8 | |
import subprocess, os, sys, re, signal, threading, gi | |
from collections import defaultdict | |
gi.require_version('Notify', '0.7') | |
from gi.repository import Notify | |
Notify.init("Pulseaudio volume balance monitor") | |
#Volumes |