Skip to content

Instantly share code, notes, and snippets.

View TomCrypto's full-sized avatar

Thomas Bénéteau TomCrypto

  • Brisbane, Australia
View GitHub Profile
@TomCrypto
TomCrypto / lpc1114_baud.rb
Last active July 23, 2019 15:15
Find optimal UART configuration for a given baud rate on LPC1114
FRACTIONAL_DIVIDER_RANGE = [
[ 0, 1], [ 1, 2], [ 1, 3], [ 2, 3],
[ 1, 4], [ 2, 4], [ 3, 4], [ 1, 5],
[ 2, 5], [ 3, 5], [ 4, 5], [ 1, 6],
[ 2, 6], [ 3, 6], [ 4, 6], [ 5, 6],
[ 1, 7], [ 2, 7], [ 3, 7], [ 4, 7],
[ 5, 7], [ 6, 7], [ 1, 8], [ 2, 8],
[ 3, 8], [ 4, 8], [ 5, 8], [ 6, 8],
[ 7, 8], [ 1, 9], [ 2, 9], [ 3, 9],
[ 4, 9], [ 5, 9], [ 6, 9], [ 7, 9],
@TomCrypto
TomCrypto / control.sh
Last active October 25, 2016 09:09
A convenient Docker build environment control script
#!/usr/bin/env bash
# NOTE: make your dockerfile define the WITHIN_CONTAINER envvar:
# ENV WITHIN_CONTAINER yes
if [ ! -z ${WITHIN_CONTAINER+x} ]; then
printf "$0: Already within a container.\n" && exit 126
fi
DOCKER=$(which docker)