Skip to content

Instantly share code, notes, and snippets.

@srathi-monarch
srathi-monarch / time_it.hpp
Created October 20, 2023 09:58
Simple scope based code execution time printer.
#include <chrono>
#include <iostream>
#include <string>
class TimeIt {
private:
std::string m_name;
std::chrono::time_point<std::chrono::high_resolution_clock> m_beg;
public:
@srathi-monarch
srathi-monarch / lanenet.launch
Created October 30, 2023 05:09
Example of using venvs with ROS.
<launch>
<node name="lanenet" pkg="lanenet" type="test_lanenet.py"
launch-prefix="$(find lanenet)/launch/with_venv.sh $(find lanenet)">
</node>
</launch>
from matplotlib.ticker import (AutoMinorLocator, MultipleLocator)
ax.xaxis.set_major_locator(MultipleLocator(10))
ax.yaxis.set_major_locator(MultipleLocator(10))
ax.xaxis.set_minor_locator(AutoMinorLocator(5))
ax.yaxis.set_minor_locator(AutoMinorLocator(5))
ax.grid(which='major', color='#CCCCCC', linestyle='--')
ax.grid(which='minor', color='#CCCCCC', linestyle=':')
@srathi-monarch
srathi-monarch / average_cpu.sh
Created March 21, 2024 10:43
Total average cpu percent
#! /usr/bin/sh
echo -e "import psutil\nwhile True: print('\\\\r{}%'.format(psutil.cpu_percent(interval=2)),end='');" | python3
@srathi-monarch
srathi-monarch / osm.xsd
Created May 8, 2024 11:46
Mirror of a XSD for the .osm file format
<?xml version="1.0" encoding="UTF-8"?>
<!-- Using optional BOM (0xEF 0xBB 0xBF) -->
<!-- From http://forum.openstreetmap.org/viewtopic.php?id=7186 -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://openstreetmap.org/osm/0.6"
xmlns="http://openstreetmap.org/osm/0.6">
<xs:element name="osm">
<xs:complexType>
<xs:sequence>
@srathi-monarch
srathi-monarch / clean_gitconfig.sh
Created May 21, 2024 09:22
Clean .gitconfig (removes comments),
IFS=$'\n'; for key in $(git config --global -l); do bash -c "git config --file=.gitconfig_new $(echo $key | tr '=' ' ')"; done
# Chekc both files and replace .gitconfig if it looks good!.
@srathi-monarch
srathi-monarch / install_cloudflare_cert.sh
Created May 28, 2024 08:38
Install Cloudlfare's `.pem` to the system certificate store.
sudo mkdir /usr/local/share/ca-certificates/cloudflare
cd !$
sudo cp ~/Downloads/Cloudflare_CA.pem ./Cloudflare_CA_1.crt # Note that the extension has changed.
sudo update-ca-certificates
@srathi-monarch
srathi-monarch / import_rosbag.py
Created June 5, 2024 07:05
Get rosbag on a newer python version
# python -m pip install rosbag rospkg pycryptodome gnupg
import sys
import Crypto
sys.modules['Cryptodome'] = Crypto
import rosbag
@srathi-monarch
srathi-monarch / join_bags.py
Last active July 8, 2024 04:53
Joins rosbags that are in chronological order into a single bagfile.
#! /usr/bin/python3
import sys
from pathlib import Path
import rosbag
from tqdm import tqdm
def main():
#! /usr/bin/zsh
set -euo pipefail
# Arguments
# -t | --tractor=TRACTOR_NAME
# -r | --run=RUN_NAME
DATA_HOME="${HOME}/kalibr_ws/sync_logs/"