Skip to content

Instantly share code, notes, and snippets.

#include <IRremote.h> //include the IR library
//#define DEBUG 0 //enable debug mode
#define LED_PIN 13 //the pin showing the output
int IR_pin = 4; //digital pin connected to output of the TSOP
unsigned long currentCode=0,storedCode=0; //to store the recieved code for comparison
bool outputState = 0; //stores the default output state of the lED that is OFF
@navin-mohan
navin-mohan / sketch.ino
Last active May 12, 2016 12:26
Arduino Based Automatic Plant Watering System Using Soil Moisture Sensor
/*
Automatic Plant Watering System Using Soil Moisture Sensor
-------------------------------------------------------------
This is an Arduino based Plant watering system that uses a soil moisture sensor
to monitor the garden soil and automatically water the plants when the moisture
level falls below a threshold value. The minimum moisture level can be set using
a Potentiometer.
Arduino Pin Config:
-> A0 : The analog output from the moisture sensor
@navin-mohan
navin-mohan / bracket_matching.cpp
Created January 21, 2017 13:37
Bracket Matching C++ code
#include <iostream>
#include <stack>
using namespace std;
class bracket_matcher: public stack<char>{
public:
bracket_matcher(): stack<char>() { matching = 1;}
void push_bracket(const char &arg){
@navin-mohan
navin-mohan / ship.cpp
Created February 12, 2017 07:36
Arduino Leonardo Joystick Library
#include <Joystick.h>
Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,
JOYSTICK_TYPE_MULTI_AXIS, 32, 0,
false, false, false, false, false, false,
true, true, false, false, false); // only rudder and throttle
const int rudderPin = A1;
const int throttlePin = A2;
@navin-mohan
navin-mohan / kernel.sh
Last active April 2, 2017 11:15
Configure Debian
#!/bin/bash
cat << EOF > ~/src
deb [arch=amd64] http://mirror.cse.iitk.ac.in/debian/ jessie main contrib non-free
deb-src [arch=amd64] http://mirror.cse.iitk.ac.in/debian/ jessie main contrib non-free
deb [arch=amd64] http://mirror.cse.iitk.ac.in/debian/ jessie-updates main contrib non-free
deb-src [arch=amd64] http://mirror.cse.iitk.ac.in/debian/ jessie-updates main contrib non-free
deb [arch=amd64] http://security.debian.org/ jessie/updates main contrib non-free
#!/bin/bash
if [ -e ~/.nvm/nvm.sh ]; then
. ~/.nvm/nvm.sh
fi
if [ -e ~/.profile ]; then
. ~/.profile
fi
if [ -e ~/.bashrc ]; then
. ~/.bashrc
@navin-mohan
navin-mohan / debian.md
Last active April 22, 2017 15:16
installing and setting up debian

Installing and Setting Up Debian

A quick guide on installing and setting up debian.

Getting Debian

You can download the Debian ISO image from the official debian website. It's available for download over HTTP, FTP and BitTorrent. The 64-bit CD version should work on most systems, get the DVD image if you need more packages preinstalled.

Installing Debian

In a Virtual Machine

To install Debian on a VM, create a new VM and choose the downloaded Debian ISO file as the start-up disk. The VM should boot up with the installation screen.

On an Actual Machine

@navin-mohan
navin-mohan / vm.md
Created April 22, 2017 16:01
setting up vm ware and virtualbox on ubuntu

Installing VM Ware on Ubuntu

Getting VM Ware

Download the VM Ware Player bundle from here.

Install Dependencies

VM Ware requires the build tools to compile it's kernel modules. So let's install them.

@navin-mohan
navin-mohan / bankers.ipynb
Last active May 30, 2017 18:40
Banker's Algorithm
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@navin-mohan
navin-mohan / WordCount.java
Last active June 4, 2017 14:01
Count the number of words in a file using Regex in Java
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.*;
public class WordCount{
public static void main(String[] args) {