Skip to content

Instantly share code, notes, and snippets.

View vivekannan's full-sized avatar

Vivek Kannan vivekannan

View GitHub Profile
@vivekannan
vivekannan / Crazy Queens.cpp
Last active August 29, 2015 14:03
A quick N-Queens solver.
#include <iostream>
#include <stdlib.h>
#include <time.h>
#define QUEENS 8
using namespace std;
class Board {
@vivekannan
vivekannan / Flowy.cpp
Last active August 29, 2015 14:06
Flowy generates (usually) solvable Flow Free levels.
//Has to be complied and built using the option -std=c++0x
//TODO: Beautify some of the functions. Introduce parameters to control the difficult of the generated board.
#include <tuple>
#include <ctime>
#include <vector>
#include <ctype.h>
#include <cstdlib>
#include <iostream>
typedef std::tuple<int, int, int> flow;
@vivekannan
vivekannan / 0hh1
Last active August 29, 2015 14:11
Solver solves 0hh1 levels.
10
...rr..brb
..b...r.bb
.r....b...
.b.r...b..
r.........
r.....r..r
.rb..r..rr
b..b...r..
.....r...r
@vivekannan
vivekannan / Juck.java
Created January 11, 2015 04:18
A BrainF**k intepreter in Java.
import java.util.Stack;
import java.util.Scanner;
import java.util.HashMap;
import java.io.FileReader;
import java.util.ArrayList;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
class Juck {
@vivekannan
vivekannan / 8051-8085.asm
Last active August 29, 2015 14:14
A 8051 assembly program that can execute the 8085 instruction set from external memory.
;Little Endian --> Lower bytes in lower address and higher bytes in higher address.
EQU LOOKUP #0FEH
EQU ACC 0E0H
EQU EPCL 14H
EQU EPCH 15H
EQU ESPL 16H
EQU ESPH 17H
EQU EL 18H
@vivekannan
vivekannan / batterdog.sh
Last active March 26, 2016 06:47
Simple BASH Script to mind battery charge level.
#!/bin/bash
if [[ $(cat /sys/class/power_supply/BAT0/status) == "Charging" ]]; then
exit
fi
charge=$(cat /sys/class/power_supply/BAT0/capacity)
icon="/usr/share/icons/HighContrast/32x32/status/battery-caution.png"
if [[ $charge < 10 ]]; then