Skip to content

Instantly share code, notes, and snippets.

@srathi-monarch
srathi-monarch / rosmode.zsh
Created June 27, 2023 06:29
Disable fzf for roscompletion
alias ros='touch ~/.roscomp && zsh ; exit'
export FZF_DEFAULT_OPTS="--reverse"
source /usr/share/doc/fzf/examples/key-bindings.zsh
source /usr/share/doc/fzf/examples/completion.zsh
if [ ! -f ~/.roscomp ] ; then
source /home/srathi/.local/share/fzf-zsh-completion.sh # Breaks ROS Completion
else
rm ~/.roscomp
fi
@srathi-monarch
srathi-monarch / .zshrc.local.zsh
Last active July 31, 2024 13:34
Zsh config to be used on top of GRML zsh config. Includes ros, fzf.
xmodmap -e "keysym Print = Menu" 2> /dev/null
# Setup Paths
export PATH="${PATH}:${HOME}/.local/bin:${HOME}/.cargo/bin"
export PATH=/usr/local/cuda-11.7/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# export LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}:${HOME}/.local/opt/glibc/glibc232/lib
export PATH=$PATH:/home/srathi/.spicetify
@srathi-monarch
srathi-monarch / .clang-format
Created July 12, 2023 08:31
The default clang-format config used in clion
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: None
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="SubstitutionType">
<xs:restriction base="xs:string">
<xs:pattern value="$\(anon .*|$\(arg .*|$\(dirname .*|$\(env .*|$\(eval .*|$\(find .*|$\(optenv .*"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="BoolType">
<xs:union memberTypes="SubstitutionType">
@srathi-monarch
srathi-monarch / fake_clock.cpp
Last active August 1, 2023 06:56
(Unnecessarily complicated?) fake clock publisher for ROS
#include <ros/ros.h>
#include <rosgraph_msgs/Clock.h>
template <typename T> auto to_ros(const T &t) {
auto dur = std::chrono::duration_cast<std::chrono::nanoseconds>(t);
return std::make_pair(int32_t(std::chrono::duration_cast<std::chrono::seconds>(dur).count()),
int32_t(dur.count() % 1000000000UL));
}
int main(int argc, char **argv) {
@srathi-monarch
srathi-monarch / wc.py
Created August 7, 2023 06:24
Node to count the number of messages on topics.
#! /usr/bin/env python3
from sys import argv
import rospy
def cb(msg, cb_args):
counters, i = cb_args
counters[i] += 1
@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
@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 / 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 / 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