This file contains 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
# POE NFG Tag reader | |
# this is a slight modification of https://github.com/adonno/tagreader to use POE with the ESP32-POE dev board | |
substitutions: | |
name: tagreader-poe | |
friendly_name: TagReaderPOE | |
esphome: | |
name: $name | |
friendly_name: $friendly_name | |
# Automatically add the mac address to the name |
This file contains 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
""" | |
FastAPI uses pydantic models to validate the API request body and also generate the swagger documentation. Since the schema | |
generated by pydantic only comply to JSON schema specification and not to openAPI specification, swagger documentation | |
generated from pydantic models do not support adding multiple examples for a request body. | |
Ref: https://fastapi.tiangolo.com/tutorial/schema-extra-example/#technical-details | |
In the following code, I have extended fastAPI openAPI schema to include multiple request body examples. | |
""" | |
import json |
This file contains 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
#!/bin/bash | |
xxd -i binary_file > binary_file_as_c_header.h |
This file contains 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
grep -zo "START.*END" File |
This file contains 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
#!/bin/bash | |
# run bash command x number of times | |
# ie. 'runx 10 echo "Hello"' will print Hello 10 times | |
# partially from: https://stackoverflow.com/questions/3737740/is-there-a-better-way-to-run-a-command-n-times-in-bash | |
function runx() { | |
for _ in $(seq "$1"); do | |
eval ${*:2} | |
done | |
} |
This file contains 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
<?xml version="1.0"?> | |
<launch> | |
<!-- List of things to lookup in dict, in our case sensors --> | |
<arg name="sensors" value="s1,s2" /> | |
<!-- Actual python dictionary. In our case this maps sensors to topics --> | |
<arg name="sensor_topics" value="{ | |
's1':'t1', | |
's2':'t2', | |
's3':'t3' | |
}" /> |
This file contains 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
#!/bin/bash | |
# these ideas was used during conversion from C code to C++ | |
directory_whitelist="dir1 dir2" # directories to replace files in | |
for dir in $(directory_whitelist); do | |
pushd $dir; | |
# do replacement but use prefix to make sure replacement only happens once (in this case prepending std::) | |
# \1 in the replace portion of the sed command is used to keep the character before the match (typically a space or '(') |
This file contains 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
# parameter tests | |
if [ INSERT_TEST_HERE ] ; then | |
return 2>/dev/null || exit | |
fi | |
# do real stuff |
This file contains 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
#!/bin/bash | |
read -p "compiler version: " version | |
if [ ! -e /opt/microchip/xc32/v$version ] ; then | |
echo "directory /opt/microchip/xc32/v$version not found" | |
echo "not an installed version" | |
return 2>/dev/null || exit | |
fi | |
mkdir -p /opt/microchip/xc32/v${version}/pic32-libs/include/lega-c |
This file contains 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
<?xml version="1.0"?> | |
<launch> | |
<arg name="play_bag" default="true"/> | |
<arg name="uut" default="my_node"/> | |
<param name="use_sim_time" value="true"/> | |
<arg name="bag_file" value="$(env HOME)/.ros/my_bag.bag"/> | |
<node pkg="my_pkg" type="$(param uut)" name="$(param uut)_node" output="screen"/> | |
<!-- NOTE: standard rosbag published clock rate of 100Hz, was too slow for my ros timer callbacks --> | |
<!-- Produce a clock, using the bagfile, at 1KHz to make timer callbacks up to a KHz work! --> |
NewerOlder