Skip to content

Instantly share code, notes, and snippets.

View nevalsar's full-sized avatar
🎯
Focusing

Nevin Valsaraj nevalsar

🎯
Focusing
View GitHub Profile
@nevalsar
nevalsar / morse_installer.sh
Created November 5, 2014 12:54
Installer bash script for MORSE
#!/bin/bash
#=======================================================================
# Author : Nevin Valsaraj <nevin[dot]valsaraj32[at]gmail[dot]com>
# Distributed under the MIT License.
# (See full license at http://opensource.org/licenses/MIT)
#=======================================================================
#In short, I can't be held accountable if you wreck your computer.
echo -e "\nAlright, let's begin."
read -p "Is this the directory you cloned morse? [y/n]" -n 1 -r
@nevalsar
nevalsar / dbbook_slides_download.py
Last active August 29, 2015 14:15
Downloader script for companion slides from http://db-book.com/
#!/usr/bin/env python
# script to download all study material slides from http://db-book.com/
# =======================================================================
# Author : Nevin Valsaraj <nevin[dot]valsaraj32[at]gmail[dot]com>
# Distributed under the MIT License.
# (See full license at http://opensource.org/licenses/MIT)
# =======================================================================
@nevalsar
nevalsar / _setup_util.py
Created February 14, 2015 21:01
ROS setup files for workspace environment overlay on zsh
#!/usr/bin/python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@nevalsar
nevalsar / github_contribution.py
Created February 17, 2015 16:17
Get contribution count of user on GitHub
#!/usr/bin/env python
# Python script to get the day's contribution count from user's GitHub account
# Use flag -h for parameter information
import urllib2
from bs4 import BeautifulSoup
import argparse
# parse args and set parameter details
parser = argparse.ArgumentParser(description='Get GitHub contribution data')
@nevalsar
nevalsar / mux-debug-auv-core.log
Created February 19, 2015 13:12
Output of `tmux debug auv-core`
#!/bin/zsh
# Clear rbenv variables before starting tmux
unset RBENV_VERSION
unset RBENV_DIR
tmux start-server\; has-session -t auv-core 2>/dev/null
if [ "$?" -eq 1 ]; then
cd /home/routeaccess
#include <ros/ros.h>
#include <ros/console.h>
#include <std_msgs/String.h>
#include <cv_bridge/cv_bridge.h>
#include <image_transport/image_transport.h>
#include <sensor_msgs/image_encodings.h>
#include <opencv2/opencv.hpp>
#include <topicheaders/topicheaders.h>
#define CAMERA_ID 0 // 0: front camera, 1: bottom camera
@nevalsar
nevalsar / trackbar_mono.cpp
Last active December 29, 2015 18:19
Thresholding of a binary image using trackbar
#include "opencv2/opencv.hpp"
#define PIX(img,i,j,k) (((uchar*)img->imageData)[i*img->widthStep+j*img->nChannels+k])
IplImage* createbinary(IplImage *img, int thresh)
{
int i,j,ht,wd;
ht=img->height;
wd=img->width;
@nevalsar
nevalsar / adaptivethresholding.cpp
Last active December 29, 2015 18:19
Adaptive thresholding for binary video from live camera feed
#include "opencv2/opencv.hpp"
#define PIX(img,i,j,k) (((uchar*)img->imageData)[i*img->widthStep+j*img->nChannels+k])
int findmedian(IplImage* img)
{
int intensities[256];
int i,j,temp=0;
for(i=0;i<256;i++)
intensities[i]=0;
@nevalsar
nevalsar / stack-and-queue-using-structure.cpp
Last active December 29, 2015 20:39
Linked list implementation of Stack and Queue.
#include <iostream>
#include <stdlib.h>
using namespace std;
struct NODE{
int val;
struct NODE *next;
};
@nevalsar
nevalsar / blobdetectrecursion.cpp
Last active December 30, 2015 00:29
Blob detection using recursion
#include <stdio.h>
#include "opencv2/opencv.hpp"
#define PIX(img,i,j,k) (((uchar*)img->imageData)[i*img->widthStep+j*img->nChannels+k])
void dfsrecursion(IplImage* img, int x, int y, int **status, int blobcount)
{
int i,j;
//traverse all connected pixels and start dfs if encounter a black unvisited pixel