Skip to content

Instantly share code, notes, and snippets.

@surajRathi
surajRathi / .zshrc.local
Created December 19, 2022 05:56
Ubuntu nspawn Container's Shell config.
HISTSIZE=10000000
SAVEHIST=10000000
# setopt BANG_HIST # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
@surajRathi
surajRathi / CMakeLists.txt
Created January 7, 2023 18:08
Simple ros node to render polynomials as markers in rviz.
cmake_minimum_required(VERSION 3.0.2)
project(virat_msgs)
add_compile_options(-std=c++11)
find_package(catkin REQUIRED
roscpp
rospy
std_msgs
message_generation
<table id='m_-3490595658229054110u_body'
style='border-collapse:collapse;table-layout:fixed;border-spacing:0;vertical-align:top;min-width:320px;Margin:0 auto;background-color:#eff4ff;width:100%'
cellpadding='0' cellspacing='0'>
<tbody>
<tr>
<td
style='display:none!important;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden'>
Do you have what it takes to build India's first Driverless Campus Shuttle
</td>
</tr>
#! /usr/bin/python3
from time import sleep
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from matplotlib.lines import Line2D
import numpy as np
import serial
import matplotlib.pyplot as plt
def parse_line(line):
try:
line = bytes([b for b in line if b != 0]).decode('ascii').strip()
@surajRathi
surajRathi / no_print.py
Created March 30, 2023 18:08
Blocks printing by remapping sys.stdout and/or sys.stderr.
# Use this as a context manager,
# with NoPrint(stdout=True, stderr=False):
# code_to_run()
class NoPrint:
def __init__(self, stdout=True, stderr=False):
self.stdout = stdout
self.stderr = stderr
def __enter__(self):
@surajRathi
surajRathi / use_minted.tex
Last active April 29, 2023 11:25
When using minted for displaying highlighted code, you need to set the outputdir.
\usepackage[outputdir=../out]{minted}
@surajRathi
surajRathi / clear_chrome_cache.sh
Created June 2, 2023 09:33
Clear the cache type of directories of Google Chrome in the ~/.config directory.
rm -r ~/.config/google-chrome/Default/{Service\ Worker,File\ System,IndexedDB} ~/.config/google-chrome/Profile\ 2/{Service\ Worker,File\ System,IndexedDB} ~/.config/google-chrome/Profile\ 3/{Service\ Worker,File\ System,IndexedDB} ~/.config/google-chrome/Profile\ 8/{Service\ Worker,File\ System,IndexedDB} ~/.config/google-chrome/Profile\ 11/{Service\ Worker,File\ System,IndexedDB}
@surajRathi
surajRathi / .zshrc.local
Last active July 14, 2023 20:17 — forked from srathi-monarch/.zshrc.local.zsh
Zsh config to be used on top of GRML zsh config. Includes ros, fzf.
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}}
# HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000000
SAVEHIST=10000000
# setopt BANG_HIST # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
@surajRathi
surajRathi / fix_timestamps.sh
Last active October 8, 2024 06:31
Fix timestamps for photos saved via whatsapp, to have them show up correctly in Google Photos. Enable backup of both of the Cleansapp folders in Google Photos.
#! /usr/bin/sh
# For Whatsapp saved photos.
adb pull -a -z zstd /storage/emulated/0/Pictures/Whatsapp ./
cd Whatsapp
exiftool '-FileCreateDate<${Filename; s/IMG-([0-9]{4})([0-9]{2})([0-9]{2})-.*\.jpg/$1:$2:$3 12:00:00+5:30/}' '-Exif:DateTimeOriginal<${Filename; s/IMG-([0-9]{4})([0-9]{2})([0-9]{2})-.*\.jpg/$1:$2:$3 12:00:00+5:30/}' *.jpg
cd ..
mv Whatsapp Cleansapp
adb push -z zstd ./Cleansapp /storage/emulated/0/Pictures/
rm -r Cleansapp