Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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
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 / 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>
@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 / ssh_agent.zsh
Created October 20, 2023 07:26
TTY Wide SSH Agent (for ssh where your key has a password on the remote system)
#! /usr/bin/zsh
eval $(ssh-agent) ; ssh-add $ZDOTDIR/.ssh/id_rsa
@srathi-monarch
srathi-monarch / apt_installed.txt
Created October 19, 2023 04:51
List currently installed APT Packages
accountsservice-ubuntu-schemas/focal,focal,now 0.0.7+17.10.20170922-0ubuntu1 all [installed,automatic]
accountsservice/focal-updates,focal-security,now 0.6.55-0ubuntu12~20.04.6 amd64 [installed,automatic]
acl/focal,now 2.2.53-6 amd64 [installed,automatic]
acpi-support/focal,now 0.143 amd64 [installed,automatic]
acpid/focal,now 1:2.0.32-1ubuntu1 amd64 [installed,automatic]
adduser/focal,focal,now 3.118ubuntu2 all [installed,automatic]
adwaita-icon-theme/focal-updates,focal-updates,now 3.36.1-2ubuntu0.20.04.2 all [installed,automatic]
aisleriot/focal,now 1:3.22.9-1 amd64 [installed,automatic]
alsa-base/focal,focal,now 1.0.25+dfsg-0ubuntu5 all [installed,automatic]
alsa-topology-conf/focal,focal,now 1.2.2-1 all [installed,automatic]
@srathi-monarch
srathi-monarch / pc_publisher.h
Last active October 23, 2023 11:06
Point Cloud Publishing with sensor_msgs::PointCloudIterator
#include <memory>
#include <tuple>
#include <ros/ros.h>
#include <sensor_msgs/PointCloud2.h>
#include <sensor_msgs/point_cloud2_iterator.h>
template <bool RGB = false> class PCPublisher {
@srathi-monarch
srathi-monarch / add_workspace_shortcuts.sh
Last active August 31, 2023 04:30
Set keyboard shortcuts for workspaces with n > 4
# Disable default <Super>${i} behavior
gsettings set org.gnome.shell.extensions.dash-to-dock hot-keys false
for i in $(seq 1 9); do gsettings set org.gnome.shell.extensions.dash-to-dock "app-hotkey-${i}" '[]'; done
for i in $(seq 1 9); do gsettings set org.gnome.shell.keybindings "switch-to-application-${i}" '[]'; done
for i in {1..10}; do gsettings set "org.gnome.desktop.wm.keybindings" "switch-to-workspace-${i}" "['<Super>$([ ${i} -eq 10 ] && echo -n 0 || echo -n $i)']"; done
for i in {1..10}; do gsettings set "org.gnome.desktop.wm.keybindings" "move-to-workspace-${i}" "['<Super><Shift>$([ ${i} -eq 10 ] && echo -n 0 || echo -n $i)']"; done