Skip to content

Instantly share code, notes, and snippets.

View bigomega's full-sized avatar

Bharath Raja bigomega

View GitHub Profile
@bigomega
bigomega / gist:3869102
Created October 10, 2012 23:01
BrainFuck Javascript Compiler
var strip=[0];
var index=0;
var loopStack=new Array();
var loopFlag=0;
var innerLoopCount=0;
input=document.getElementById('inp').value;
for(i=0;i<input.length;i++){
var element=input[i];
if(loopFlag==1){
if(element=='[')
@bigomega
bigomega / nde.py
Last active December 18, 2015 00:29
ND Encryption Algorithm
# **************************************************
# ND Encription algorithm (nde)
# - derived from phonetics of words
# - replacing the first two consonent sounds of every word
# - works best for tamil words written in english
# Authors:
# Bharath => Rabhath
# Dhinesh => Nidhesh
# **************************************************
@bigomega
bigomega / 07day.js
Last active December 20, 2015 12:56
Advent of Code problem solutions
// - If a is not found
// - iterate through the input
// - If it output doesn't exist
// - Check if inputs have value
// - If so calculate output and add value
// - Else add the equation
// - If the output has value(number), ignore
// - If the output has equation, try to calculate
// - Reapeat
@bigomega
bigomega / JQuerySahi.java
Last active February 3, 2016 17:45
jQuery helper for sahi
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sf.sahi.client.Browser;
import net.sf.sahi.client.ElementStub;
public class JQuery {
protected Browser browser;
@bigomega
bigomega / .gitignore
Last active February 7, 2016 16:44
Tic Tac Toe
/node_modules
npm-debug.log
@bigomega
bigomega / _board-utils.js
Last active March 23, 2016 22:27
simple tic-tac-toe
'use strict'
const _utils = require('./_utils')
function getColumns(game) { return game.board }
function getRows(game) { return _utils.inverse2D(game.board) }
function getNWDiagonals(game) {
return _utils.range(game.width + game.height - 1).map(edge => {
@bigomega
bigomega / wordcrack.js
Last active April 15, 2016 14:18
Solving wordcrack
'use strict'
const fs = require('fs')
// util function modified from github.com/bucaran/sget
function readLineSync(message) {
message = message || ''
const win32 = () => 'win32' === process.platform
const readSync = function(buffer) {
var fd = win32() ? process.stdin.fd : fs.openSync('/dev/stdin', 'rs')
var bytes = fs.readSync(fd, buffer, 0, buffer.length)
@bigomega
bigomega / chain.js
Created April 16, 2016 11:42
Coding problem
dict = ['cat','cot','cog','bog','bat','bap','map', 'mat'];
start = 'cat';
end = 'map';
isLinked = function(w1, w2){
var flag = false;
for (var i = 0; i < w1.length; i++) {
if(w1[i] != w2[i]){
if(flag)
return false;
flag = true;
@bigomega
bigomega / mini_scraper.py
Last active May 18, 2016 00:49
Dota International 2016 PrizePool scraper
import urllib2, re, time, json, os
import gspread
from oauth2client.client import SignedJwtAssertionCredentials
html = urllib2.urlopen('http://www.dota2.com/international/battlepass').read()
prizepool = re.search('id=[\'"]prizepool[^>]*>[\n\r\t]*([^<\t\r\n]*)', html, re.IGNORECASE).group(1)
print(time.strftime('%H:%M - %m/%d/%Y'), prizepool)
print("Update it in Google sheets")
json_key = json.load(open(os.path.join(os.path.dirname(__file__), 'Personal hacks-0e20089bab35.json')))
@bigomega
bigomega / draw_hexagon.js
Created June 25, 2016 04:55
render a hexagon of elements in DOM
var hex_arrangement = [
'3333',
'32223',
'321123',
'3210123'
]
var hexval = {
0: [['profile', 'data-nav="home']],
1: [
['behance', 'https://www.behance.net/bigOmega'],