Skip to content

Instantly share code, notes, and snippets.

@surajRathi
surajRathi / print_pkgs.zsh
Last active August 9, 2023 09:16
Extract dependencies from ROS package launch files
#!/usr/bin/zsh
cat **/**.launch | grep -oE '\$\(find [^)]*\)' | cut -d ' ' -f 2 | cut -d ')' -f 1 | sort | uniq
cat **/**.launch | grep -oE 'pkg="[^" ]*?"' | cut -d '"' -f 2 | sort | uniq
# (cat **/**.launch | grep -oE '\$\(find [^)]*\)' | cut -d ' ' -f 2 | cut -d ')' -f 1 | sort | uniq; cat **/**.launch | grep -oE 'pkg="[^" ]*?"' | cut -d '"' -f 2 | sort | uniq) | sort | uniq
@surajRathi
surajRathi / SSH Reverse Tunneling .md
Created October 25, 2022 11:45
SSH Reverse Tunneling

SSH Reverse Tunneling

  1. Start a SSH Server on you local machine.

  2. Someone with cu access must do:sh -fN -R 7090:localhost:23 keerthi@your_public_ip

    • -f: Fork to background # I think we can drop this flag
    • -N: Dont execute any command
    • -R: Do port forwarding This will bind 7090 on your machine to 22 on the CU.
#! /usr/bin/bash
# Installing ROS
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt install curl -y # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo apt update -y
@surajRathi
surajRathi / format.sheets
Created August 12, 2022 12:49
Google Sheets Indian Currency Custom Number Format
[$₹][>9999999]##\,##\,##\,##0.00;[$₹][>99999]##\,##\,##0.00;[$₹]##,##0.00
function copyStylesInline(destinationNode, sourceNode) {
const containerElements = ["svg", "g"];
for (let cd = 0; cd < destinationNode.children.length; cd++) {
const child = destinationNode.children[cd];
if (containerElements.indexOf(child.tagName) !== -1) {
copyStylesInline(child, sourceNode.children[cd]);
continue;
}
const style = sourceNode.children[cd].currentStyle || window.getComputedStyle(sourceNode.children[cd]);
if (style === "undefined" || style == null) continue;
@surajRathi
surajRathi / ros_costmap_subscriber.py
Created July 12, 2022 12:54
Subscribes to the ROS 'costmap', i.e. `nav_msgs/OccupancyGrid` and the linked `map_msgs/OccupancyGridUpdate`
#! /usr/bin/python3
from typing import Optional
import numpy as np
import rospy
from map_msgs.msg import OccupancyGridUpdate
from nav_msgs.msg import OccupancyGrid
from rospy.numpy_msg import numpy_msg
import os
import select
import sys
import time
if os.name == 'nt':
import msvcrt
else:
import tty
#! /usr/bin/python3
import time
from math import pi
from typing import List, Optional, Tuple
import serial
# Received garbage
class InvalidResponse(Exception):
@surajRathi
surajRathi / serial_tunnel.sh
Created April 20, 2022 13:35
USB Serial over ssh
#! /usr/bin/zsh
socat PTY,link=$HOME/myserialline,raw,echo=0 EXEC:'ssh suraj@rathi socat - /dev/ttyACM0'
@surajRathi
surajRathi / cc_setup.zsh
Created March 22, 2022 07:12
Integrate clion with multi package catkin tools setup
export ROS_HOSTNAME=$(hostname -I | awk '{print $1}' | head -c -1 -)
source ./devel/setup.zsh
export CATKIN_PROFILE="$(catkin profile list | awk '/\(active\)/{print $2}')"
echo -ne "[\n]" > $ROS_WS_DIR/.catkin_tools/CATKIN_BUILD_DUMMY.json
catkin_build() {
catkin build $@