This file contains hidden or 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
#pragma once | |
#include <cstdint> | |
#include <utility> | |
#include <type_traits> | |
#define ASSERT_SIZE(x, sz) static_assert(sizeof(x) == sz, "Wrong size in " #x) | |
#define ASSERT_STANDARD_LAYOUT(x) static_assert(std::is_standard_layout_v<x>, #x "is not standard layout") | |
struct rgb565_t { |
This file contains hidden or 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 python | |
import asyncio | |
from contextlib import contextmanager | |
import datetime | |
import RPi.GPIO as GPIO | |
import http | |
import random | |
import signal | |
import socket |
This file contains hidden or 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/python3 -u | |
import asyncio | |
import sh | |
from systemd import journal | |
from systemd.daemon import notify | |
GATEWAY_IP = "192.168.10.1" |
This file contains hidden or 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
from contextlib import contextmanager | |
import pyudev | |
from select import select | |
import threading | |
import select, os, queue, socket | |
class PollableQueue(queue.Queue): | |
def __init__(self): | |
super().__init__() | |
# Create a pair of connected sockets |
This file contains hidden or 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
"""OAuth2Support for aiohttp.ClientSession. | |
Based on the requests_oauthlib class | |
https://github.com/requests/requests-oauthlib/blob/master/requests_oauthlib/oauth2_session.py | |
""" | |
# pylint: disable=line-too-long,bad-continuation | |
import logging | |
from oauthlib.common import generate_token, urldecode | |
from oauthlib.oauth2 import WebApplicationClient, InsecureTransportError |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 inspect | |
from functools import wraps | |
def privatemethod(func): | |
"""decorator for making an instance method private by dispatching on whether the name 'self' in the local namespace of the calling frame is a reference to the same object as the first positional argument (the self argument when invoking an instance method.) the decorated function will have a 'public' member which is a decorator for specifying an alternate implementation to dispatch calls from outside of the instance.""" | |
pubfunc = None | |
privfunc = func | |
@wraps(func) | |
def func_wrapper(*args, **kwargs): |
This file contains hidden or 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
/** | |
* Compare color difference in RGB | |
* @param {Array} rgb1 First RGB color in array | |
* @param {Array} rgb2 Second RGB color in array | |
*/ | |
export function deltaRgb (rgb1, rgb2) { | |
const [ r1, g1, b1 ] = rgb1, | |
[ r2, g2, b2 ] = rgb2, | |
drp2 = Math.pow(r1 - r2, 2), | |
dgp2 = Math.pow(g1 - g2, 2), |
This file contains hidden or 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 <iostream> | |
#include <map> | |
#include <algorithm> | |
#include <functional> | |
#include <memory> | |
using namespace std; | |
/*** | |
* A base class for event arguments |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.