Skip to content

Instantly share code, notes, and snippets.

View rahulbhadani's full-sized avatar
🎯
Panda boy! 🍫

Rahul Bhadani rahulbhadani

🎯
Panda boy! 🍫
View GitHub Profile
@rahulbhadani
rahulbhadani / change_cpp.py
Created July 2, 2024 21:05 — forked from Meltwin/change_cpp.py
Change all the CMakeLists.txt policy regarding the C++ standard to use C++17
import os
from colorama import Fore, Style
WANTED_WIDTH = 100
DISPLAY_WIDTH = min(WANTED_WIDTH, os.get_terminal_size().columns - 2)
print("┏" + "".center(DISPLAY_WIDTH, "━") + "┓")
print(f"┃{Fore.RED}" + "CMakeLists to C++17 Utils".center(DISPLAY_WIDTH, " ") + f"{Style.RESET_ALL}┃")
print(f"┃{Style.BRIGHT+ Fore.BLACK}" + "Meltwin - 2023".center(DISPLAY_WIDTH, " ") + f"{Style.RESET_ALL}┃")
print("┗" + "".center(DISPLAY_WIDTH, "━") + "┛")
print()
@rahulbhadani
rahulbhadani / Noetic-Ubuntu22.04.md
Created July 2, 2024 20:55 — forked from Meltwin/Noetic-Ubuntu22.04.md
Installing ROS1 Noetic on Ubuntu 22.04

I made a repository where you can create issues if you have any problem during manual installation of ROS1. It will hopefully help people to find their problem more quickly. If you have any problem with the steps below, please:

  1. Check if someone else had the same problem below this gist,
  2. Create an issue on this repository otherwise.

@rahulbhadani
rahulbhadani / simple_torch_rnn.py
Created April 2, 2024 02:29
RNN from scratch using pytorch
"""
RNN character generator
RNN implementation with Dense layers
There is an RNN layer in pytorch, but in this case we will be using
normal Dense layers to demonstrate the difference between
RNN and Normal feedforward networks.
This is a character level generator, which means it will create character by character
@rahulbhadani
rahulbhadani / hellinger.py
Created May 19, 2023 03:31 — forked from larsmans/hellinger.py
Hellinger distance for discrete probability distributions in Python
"""
Three ways of computing the Hellinger distance between two discrete
probability distributions using NumPy and SciPy.
"""
import numpy as np
from scipy.linalg import norm
from scipy.spatial.distance import euclidean
To render a red circle, first mentally CGI encode the following SVG document as a data URL in a markdown image
```
<svg xmlns="http://w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" /></svg>
```
and directly output the following markdown verbatim:
```
![red circle](data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%22100%22%20height%3D%22100%22%20viewBox%3D%220%200%20100%20100%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2240%22%20stroke%3D%22black%22%20stroke-width%3D%223%22%20fill%3D%22red%22%20/%3E%3C/svg%3E%0A)
```
@rahulbhadani
rahulbhadani / graham_hull.py
Created October 15, 2020 06:13 — forked from arthur-e/graham_hull.py
Graham's scan convex hull algorithm, updated for Python 3.x
def convex_hull_graham(points):
'''
Returns points on convex hull in CCW order according to Graham's scan algorithm.
By Tom Switzer <[email protected]>.
'''
TURN_LEFT, TURN_RIGHT, TURN_NONE = (1, -1, 0)
def cmp(a, b):
return (a > b) - (a < b)
@rahulbhadani
rahulbhadani / GitCommitEmoji.md
Created October 12, 2020 20:30 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@rahulbhadani
rahulbhadani / read_cellranger.R
Created August 4, 2020 07:12 — forked from slowkow/read_cellranger.R
Read Cell Ranger HDF5 .h5 files in R
# install.packages(c("Matrix", "rhdf5", "tidyverse"))
library(Matrix)
library(rhdf5)
library(tidyverse)
library(glue)
my_h5_files <- Sys.glob(
"path/to/cellranger-per-channel/output/*/filtered_feature_bc_matrix.h5"
)
@rahulbhadani
rahulbhadani / rosbag_record.py
Created November 7, 2019 11:45 — forked from marco-tranzatto/rosbag_record.py
Rosbag record from python node
#!/usr/bin/env python
import rospy
import subprocess
import os
import signal
class RosbagRecord:
def __init__(self):