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
#ifndef _RING_BUFFER_ | |
#define _RING_BUFFER_ | |
// Source: https://embeddedartistry.com/blog/2017/4/6/circular-buffers-in-cc | |
#include <memory> | |
#include <mutex> | |
template <class T> | |
class RingBuffer { |
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
/* | |
* Play duo melody with Arduino | |
* ============================ | |
* | |
* Description: | |
* This sketch simultaneously plays two separate melodies on two (passive) | |
* speakers or buzzers. This creates effect of a "choir". | |
* For simplicity, it uses function play2Tones(), which only plays two notes | |
* of equal duration simultaneosly. | |
* The actual melody here is the Anthem of Ukraine. |
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/python | |
## Percentage area overlap between circles in Python. | |
## Inspired by PHP code by JP Hastings-Spital: | |
## https://gist.github.com/jphastings/316058 | |
import math | |
def circle_overlap(centers_distance, radius1, radius2): | |
# Make sure the larger circle is left-most (for convenience) |
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 python3 | |
''' | |
A script to recursively compare two directories (including file size and file hash changes) | |
Usage: python3 compare_dirs.py DIR1 DIR2 | |
''' | |
import os, sys, hashlib, unicodedata | |
COMPARE_FILES = True # should file sizes be compared if their names are the same? |
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 python3 | |
import os, sys, hashlib | |
MD5 = True | |
def md5sum(fn): | |
hasher = hashlib.md5() | |
with open(fn, 'rb') as f: | |
hasher.update(f.read()) |
NewerOlder