Skip to content

Instantly share code, notes, and snippets.

View tcbennun's full-sized avatar

Torin Cooper-Bennun tcbennun

  • Birmingham, UK
View GitHub Profile
@tcbennun
tcbennun / vl53l0x_platform.cpp
Created July 24, 2023 15:15
vl53l0x platform impl for ESP32
#include "vl53l0x_platform.h"
#include <driver/i2c.h>
static const i2c_port_t i2c_port = I2C_NUM_0;
static bool i2c_initialized = false;
static void i2c_init()
{
const i2c_config_t i2c_config =
@tcbennun
tcbennun / keybase.md
Created February 6, 2023 12:44
keybase.md

Keybase proof

I hereby claim:

  • I am tcbennun on github.
  • I am tcbennun (https://keybase.io/tcbennun) on keybase.
  • I have a public key ASDIcrEcmFhaLygIeOm1BE1vDgTHeZwYsnhnN6rX6ilwCwo

To claim this, I am signing this object:

@tcbennun
tcbennun / .bashrc
Created November 8, 2021 09:49
apt-history
function apt-history(){
case "$1" in
install)
cat /var/log/dpkg.log | grep 'install '
;;
upgrade|remove)
cat /var/log/dpkg.log | grep $1
;;
rollback)
cat /var/log/dpkg.log | grep upgrade | \
@tcbennun
tcbennun / CMakeLists.txt
Created September 24, 2021 12:53
Generate and flash NVS partition automatically in ESP-IDF project
# This example is for a file named nvs_initial.csv, living in the root of your project.
# Place this code after your project() command.
# Your NVS partition binary will be generated as part of the default build target,
# and will be flashed automatically when you perform `idf.py flash` (beware! see
# comment near bottom)
idf_build_get_property(idf_path IDF_PATH)
idf_build_get_property(python PYTHON)
@tcbennun
tcbennun / chunk.py
Created January 14, 2021 11:12
chunk.py
import os
from pathlib import Path
import sys
import numpy as np
def chunk(path, max_lines):
fd = open(path)
header = fd.readline()
@tcbennun
tcbennun / espflash.pl
Last active November 30, 2020 15:32
espflash
#!/usr/bin/perl
use feature qw(say);
# try to get correct Python (and detect system)
if ($^O eq "MSWin32" or ($^O eq "linux" and `uname -r` =~ /microsoft/)) {
$python = "python.exe";
$system = "windows";
}
else {
@tcbennun
tcbennun / zoho_oauth_demo.py
Created August 17, 2020 16:04
OAuth procedure for the Zoho Creator API
#!/usr/bin/env python3
import json
import sys
import requests
def get_secrets():
j = json.loads(open("secrets.json").read())
return (j["client_id"], j["client_secret"])
% requires `booktabs' package
\begin{tabular}{ccr}
\toprule
This & Is A & Test \\
\midrule
have some & numbers & 5.32 \\
wahoo & yahee & 55.80 \\
ddd & ddddddd & 0.10 \\
\bottomrule
\end{tabular}
@tcbennun
tcbennun / julia.py
Created December 22, 2018 22:32
Julia set plotting example (5k res, so kinda slow)
"""
Copyright (C) 2018 Torin Cooper-Bennun
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@tcbennun
tcbennun / dancing_flower_1.py
Created December 22, 2018 13:05
code used to create this video: https://youtu.be/7YmBSqWw7PY
"""
Copyright (C) 2018 Torin Cooper-Bennun
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of