Skip to content

Instantly share code, notes, and snippets.

View robodhruv's full-sized avatar
🥑

Dhruv Shah robodhruv

🥑
View GitHub Profile
@robodhruv
robodhruv / bilayer_NN.py
Last active May 28, 2018 21:52
A simple bi-layer Neural Network to capture the features of XOR!
from numpy import exp, array, random, dot, sum, size, absolute
class NeuralNetwork():
def __init__(self, layer1, layer2):
self.layer1 = layer1
self.layer2 = layer2
@robodhruv
robodhruv / modelsim_installation.md
Last active July 21, 2024 23:06
Installing ModelSim on Ubuntu

ModelSim Installation issues

Ubuntu 14.xx and above

Ignore this if you have not encountered any issue with the installation and running of ModelSim and Quartus on your system. You are very lucky. (Just Kidding! You have surely had this issue, only sorted.)

Hence assuming you have been following the procedure given in this guide. Most certainly, Quartus will install jsut fine, and so will ModelSim. The issue is in launching due to inappropriate linking etc.

Stage 1

This is the simplest error you would encounter. Navigate to the modelsim_ase folder and run:

@robodhruv
robodhruv / DFS.cpp
Created April 9, 2017 19:30
Depth-First Search on Graph
// C++ program to print DFS traversal from a given vertex in a given graph
#include <iostream>
#include <vector>
using namespace std;
// Graph class represents a directed graph using adjacency vector representation
class Graph {
int V; // No. of vertices
void DFSUtil(int v, bool visited[]); // A function used by DFS
@robodhruv
robodhruv / sim.cpp
Created May 17, 2017 19:01
Multiple ROS publishers and subscribers in a single node
/*
* This can be seen as a sample node with 3 publishers
* and one subscriber, working perfectly. Hope this helps.
* Ignore the specifics, and marker topics etc. The heart of the
* program is the publish/subscribe statement. Full program at:
* https://github.com/PrieureDeSion/radiation-mapping/
*
* Copyright © 2017 by Dhruv Ilesh Shah
* [email protected] | [email protected]
* Robotics Institute, Carnegie Mellon University
@robodhruv
robodhruv / rosbag_extract.py
Last active November 18, 2022 12:40
Script to extract messages on desired topics, and save them in a CSV file. Easy to modify as per requirements.
"""
This script collects data from all the bag files in the directory passed as the first
argument when launching. In particular, it collects the rostopics listed in the
concerned list and generates a CSV file containing the same. The readings are triggered
by the trigger topic.
Author: Dhruv Ilesh Shah
[email protected] | [email protected]
"""
@robodhruv
robodhruv / udp_listener.py
Created August 27, 2017 13:30
Capture UDP packets on a port in JSON-like format.
# This program captures UDP packets on port identified in the variable
# port_no. The port will remain blocked until the script is killed.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
port_no = 5555;
class Echo(DatagramProtocol):
/*
Pure C code for multi-threaded matrix mutliplication of two
dynamically created and randomly instiated matrices.
Two different mutli-threading strategies are implemented, along
with the non-threaded multiplication kernel for comparison.
The functions are timed using system time.
CS347(M): Operating Systems, IIT Bombay (Autumn 2017)
*/
# include <cstdlib>
# include <iostream>
# include <iomanip>
# include <cmath>
# include <ctime>
# include <omp.h>
using namespace std;
int main ( void );
@robodhruv
robodhruv / lloyd-max.py
Created November 24, 2017 16:10
Lloyd Max Quantizer for optimal quantization of a random variable demonstrating a Gaussian PDF
"""
Lloyd Max Quantizer
This program implements a midrise lloyd-max quantizer, for optimal
quantization of a random variable demonstrating a Gaussian PDF.
The clustering mechanism used here equivalent to k-Means clustering.
Author: Dhruv Ilesh Shah
EE308 - Communication Systems, Autumn 2017
Indian Institute of Technology, Bombay
"""
@robodhruv
robodhruv / frequency_confusion.m
Created February 24, 2018 19:30
Visualise frequency confusing/aliasing due to sampling of a pure sinusoid as a video.
clear all; close all;
n = [0:0.1:50];
w = pi/2;
Ts = 0.2;
ks = [-200:200];
y = zeros(size(n))
frame_count = 1;