Skip to content

Instantly share code, notes, and snippets.

View Tbruno25's full-sized avatar

Teejay Tbruno25

  • Bay Area
View GitHub Profile
@Tbruno25
Tbruno25 / tox.ini
Created April 5, 2023 17:32
Single tox config for multiple packages
[tox]
requires = tox>=4.4.10
isolated_build = true
pass_env = PWD
tox_root = {env:PWD}
env_list =
coverage
lint
test
type
@Tbruno25
Tbruno25 / timeout_context_manager.py
Created July 22, 2022 16:01
Simple python3 timeout
import time
from contextlib import contextmanager
from typing import Iterator
@contextmanager
def timeout(seconds: float = 5) -> Iterator:
"""
A simple context manager to enable timeouts.
@Tbruno25
Tbruno25 / Dockerfile
Last active July 31, 2021 18:08
Use cron inside ubuntu docker container
#assuming you have some script you want to run with cron
FROM ubuntu:latest
WORKDIR /app
COPY . .
RUN apt-get update
RUN apt-get install -y cron
RUN echo "* * * * * ./app/some-script" >> /etc/cron.d/app
RUN chmod 0644 /etc/cron.d/app
RUN crontab /etc/cron.d/app
@Tbruno25
Tbruno25 / cputemp.py
Created October 18, 2020 17:37
Visualize cpu temperature from a remote linux computer.
import streamlit as st
import paramiko
import time
from streamlit.report_thread import add_report_ctx
from getpass import getpass
ip = input("Please enter IP address: ")
user = input("Username: ")
// this sketch was brutally hacked together by TJ Bruno --- https://medium.com/@tbruno25
#include <mcp_can.h>
#include <SPI.h>
unsigned long int rxId;
unsigned char len = 0;
unsigned char rxBuf[8];
bool displayOnce;
@Tbruno25
Tbruno25 / automatic_button_programming.ino
Created September 3, 2019 03:24
Automatic Button Programming
// this sketch was brutally hacked together by TJ Bruno --- https://medium.com/@tbruno25
#include <Print.h>
#include <mcp_can.h>
#include <SPI.h>
#include <EEPROM.h>
#define CAN0_INT 2
MCP_CAN CAN0(10);
@Tbruno25
Tbruno25 / doublePress
Last active July 19, 2019 04:01
Medium Article
void loop()
{
if (!digitalRead(2))
{
CAN0.readMsgBuf(&rxId, &len, rxBuf);
delay(5);
if ((rxId == buttonId) && (rxBuf == buttonData))
{
buttonPress++;
if (buttonPress == 1)