Skip to content

Instantly share code, notes, and snippets.

View bieli's full-sized avatar

Marcin Bielak bieli

View GitHub Profile
@msloth
msloth / client-lighting-example.c
Last active December 6, 2018 19:49
When light is on, also turns on a GPIO (DIO7). Light output via PWM on DIO5. Has a default schedule (see code).
#include "thsq.h"
#include "ti-lib.h"
#include "gpio-interrupt.h"
#include "lib/sensors.h"
#include "batmon-sensor.h"
#include "dev/leds-arch.h"
#include "dev/cc26xx-uart.h"
/*---------------------------------------------------------------------------*/
@darka
darka / png_out.py
Last active March 25, 2025 21:27
Generating a PNG in Python
import struct
import zlib
from typing import BinaryIO, List, Tuple
Pixel = Tuple[int, int, int]
Image = List[List[Pixel]]
BLACK_PIXEL: Pixel = (0, 0, 0)
WHITE_PIXEL: Pixel = (255, 255, 255)
#include <stdio.h>
#include <stdint.h>
// Philips Sonicare NFC Head Password calculation by @atc1441 Video manual: https://www.youtube.com/watch?v=EPytrn8i8sc
uint16_t CRC16(uint16_t crc, uint8_t *buffer, int len) // Default CRC16 Algo
{
while(len--)
{
crc ^= *buffer++ << 8;
int bits = 0;
do