Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block mooware

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mooware /
Last active Dec 1, 2018
Script for the Pi Hut 3D Xmas Tree
from gpiozero import LEDBoard
from time import sleep
import random
tree = LEDBoard(*range(2, 28), pwm=True)
# first led is the top one in the star
tree[0].value = 0.6
leds = range(1, len(tree))
mooware /
Created Oct 13, 2017
Colorization for MSVC warnings and errors
import sys, re
COMPILE_PATTERN = re.compile(r'^.+\(\d+\) ?: (fatal )?(error|warning|note)( C\d+)?: .+$')
LINK_PATTERN = re.compile(r'^.+ : (fatal )?(error|warning) LNK\d+: .+$')
OTHER_PATTERN = re.compile(r'^.+ : (general |Command line )?(error|warning) \w+ ?: .+$')
class WinColorStream:
# wincon.h
mooware /
Last active Jul 18, 2019
Simple application to play streams through HTML5 video
# uses as web framework, livestreamer for getting the stream URL
# and hls.js to play the HLS stream in an HTML5 video tag
from bottle import *
from livestreamer import Livestreamer
import sys, re, json
if sys.version_info.major >= 3:
from urllib.request import urlopen
def u(s):
mooware / snake.ino
Created Jun 30, 2017
Snake for Arduino on a LED matrix
View snake.ino
// snake on a MAX7219 led matrix
// NOTE: assuming the chip and pins are on the left side of the led matrix,
// row = 0, col = 0 is at the upper left corner
#include <LedControl.h>
// we're using a membrane keypad as controller
#include <Keypad.h>
mooware / tiny_string.h
Created Sep 6, 2016
An experimental "very short string optimization"
View tiny_string.h
// a fun little experiment i came up with:
// similar to the classic "short string optimization", we could actually use
// the bytes of the pointer itself as the short string buffer.
// a "tagged pointer" is used to distinguish between the internal buffer
// and a heap-allocated string.
#include <cassert>
#include <cstdint>
#include <cstring>
mooware / measure.cpp
Created Mar 3, 2016
Similar to the "time" or "timeit" commands, for Windows.
View measure.cpp
#include <Windows.h>
#include <Psapi.h>
#include <stdio.h>
#include <stdint.h>
uint64_t fileTimeToUsec(const FILETIME &ft)
return ((uint64_t(ft.dwHighDateTime) << 32) | ft.dwLowDateTime) / 10;
mooware / print-exception-text.cpp
Created Feb 12, 2016
An example program to show that FormatMessage() cannot properly return the text for an exception code.
View print-exception-text.cpp
#include <windows.h>
#include <stdio.h>
int main()
HMODULE hMod = LoadLibrary("ntdll.dll");
char buf[1024];
DWORD id = 0xc0000005; // code for access violation
mooware / changeres.cpp
Last active Feb 14, 2016
Simple program to change the display resolution on Windows
View changeres.cpp
// prebuilt for VC14/VS2015 here:
#include <iostream>
#include <sstream>
#include <Windows.h>
int main(int argc, char **argv)
bool reset = false;
mooware / foo_up_down_mix_dsp.cpp
Created Oct 20, 2015
foobar2k channel mixer plugin to only play on a single of multiple channels
View foo_up_down_mix_dsp.cpp
// foobar2k plugin that mixes a multi-channel stream down to mono,
// and then up to multiple channels again, but with all channels but one empty.
// this can be used to play several different tracks simultaneously over a
// multi-channel audio output.
// pre-built version can be found here:
// to build locally, just add this source file into the SDK sample plugin.
mooware / cdb-show-dump.cmd
Last active Sep 5, 2016
print lots of windows minidump information with CDB
View cdb-show-dump.cmd
@echo off
:: used cdb commands:
:: !sym noisy -> prints verbose output when searching PDBs
:: .symopt+0x40 -> accept mismatching PDBs
:: .lines -e -> enable source file and line information
:: .kframes 100 -> set max number of display stack frames to 0x100
:: lmv -> list all loaded modules with version information
:: | -> show process status
:: !peb -> show process environment block (command line arguments, environment variables)
You can’t perform that action at this time.