Skip to content

Instantly share code, notes, and snippets.

View arthurbenemann's full-sized avatar

Arthur Benemann arthurbenemann

View GitHub Profile
from flask import Flask, render_template_string
import subprocess
import socket
app = Flask(__name__)
@app.route('/')
def index():
ip_a_output = subprocess.check_output(['ip', 'a'], text=True)
lspci_output = subprocess.check_output(['lspci'], text=True)
@arthurbenemann
arthurbenemann / sensor.sh
Last active December 19, 2023 17:24
linux sensor plotting
rm /tmp/sensor
while true; do
echo -ne "\r"
echo $1
cat $1 >> /tmp/sensor
tail -n 60 /tmp/sensor | gnuplot -p -e "set terminal dumb size 120, 30; set autoscale; plot '-' with lines notitle"
sleep 1
done
esphome:
name: wt32
includes:
- "Adafruit_LiquidCrystal.h" # copy from https://github.com/adafruit/Adafruit_LiquidCrystal/blob/master/Adafruit_LiquidCrystal.h into project folder with yaml
libraries:
- "Wire"
- "SPI"
- "Adafruit BusIO"
- "Adafruit MCP23017 Arduino Library"
- "Adafruit LiquidCrystal"
@arthurbenemann
arthurbenemann / ubled.py
Last active August 29, 2015 14:22
ubled
#!/usr/bin/env python
#
# This is a test code for UBLEDs, controlled by a raspberry pi 2.
# Photos and video at https://goo.gl/89iMrc
# PB3xx301V050A (http://goo.gl/0cyNxy)
#
# 1.Enable the raspberry SPI bus (https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/)
#
# 2.Connected to ubled chain to SPI pins on Raspberry (http://www.jameco.com/Jameco/workshop/circuitnotes/raspberry_pi_circuit_note_fig2a.jpg)
# 5V (1) - 5V (2)
# just copy the following into .bashrc
function parse_git_branch {
/usr/bin/git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local NORMAL="\[\033[0;0m\]"
local BLUE="\[\033[0;34m\]"
@arthurbenemann
arthurbenemann / ArduCopter.sublime-build
Created May 14, 2015 18:40
Sublime Build system for ArduCopter project
{
"shell_cmd": "make sitl -j8",
"file_regex": "^(\/...*?(?:.pde|.h|.cpp)):([0-9]*):?([0-9]*)",
"working_dir": "${project_path:${folder}}/ArduCopter",
}
module load gimbal
module load graph
module load gopro
@alias add g graph
@alias add ggimbaltilt graph MOUNT_STATUS.pointing_a/100.0 MOUNT_STATUS.pointing_b/100.0
@alias add ggimbalyaw graph MOUNT_STATUS.pointing_c/100.0 180*AHRS2.yaw/3.141592
@alias add ggimbaljoint graph GIMBAL_REPORT.joint_roll GIMBAL_REPORT.joint_el GIMBAL_REPORT.joint_az
vlc v4l2:///dev/video1:norm=NTSC:width=720:height=480:input=1 --sout '#duplicate{dst=display,dst="transcode{vcodec=mp4v,acodec=mpga,vb=10000}:standard{access-file,mux=ps,dst=test1.mpg}"}'
import cv2
v = cv2.VideoCapture('http://10.5.5.9:8080/live/amba.m3u8')
# v = cv2.VideoCapture('http://10.5.5.9:8080/live/aaba.m3u8')
i = 0
while True:
v.grab()
if i > 10:
i = 0
/* Primeiro Teste do Seguidor de Linha
João Pedro Scherer Cipriani
Equipe GaudérioBotz
COLÉGIO TÉCNICO INDUSTRIAL DE SANTA MARIA */
const int V_MAX = 255;
const int V_LENTA = 255;
// atribuição de pinos aos motores
int pinMotorEsq = 9;