Skip to content

Instantly share code, notes, and snippets.

Bharath Raja bigomega

View GitHub Profile
@bigomega
bigomega / mkcd.bash
Created Mar 12, 2020 — forked from rajeshg/mkcd.bash
mkcd command - how to create a directory using mkdir and cd in one step
View mkcd.bash
#
# mkcd command
# This is an improvised version of the mkcd command at http://superuser.com/questions/152794/is-there-a-shortcut-to-mkdir-foo-and-immediately-cd-into-it
# This function has to be added to the ~/.bashrc file
# After that you can run command like: mkdir abc, mkdir -p one/two/three
#
function mkcd {
last=$(eval "echo \$$#")
if [ ! -n "$last" ]; then
echo "Enter a directory name"
@bigomega
bigomega / himalayan-biking-trekking-camping-checklist.md
Last active Feb 28, 2018
Himalayan Biking + Trekking + Camping Checklist
View himalayan-biking-trekking-camping-checklist.md

Himalayan Biking + Trekking + Camping Checklist +

Utility

  • Tent
  • Sleeping bag
  • Blanket
  • Water bottles
  • Towel
  • Swiss army knife
  • An actual knife - emergencies
View keybase.md

Keybase proof

I hereby claim:

  • I am bigomega on github.
  • I am bigomega (https://keybase.io/bigomega) on keybase.
  • I have a public key whose fingerprint is 35B8 190F 23C3 8576 1E8C 8C8E 8EB4 BBCA 4DF5 E11C

To claim this, I am signing this object:

@bigomega
bigomega / draw_hexagon.js
Created Jun 25, 2016
render a hexagon of elements in DOM
View draw_hexagon.js
var hex_arrangement = [
'3333',
'32223',
'321123',
'3210123'
]
var hexval = {
0: [['profile', 'data-nav="home']],
1: [
['behance', 'https://www.behance.net/bigOmega'],
@bigomega
bigomega / guy-fawkes.html
Created Jun 1, 2016
Guy Fawkes mask html structure
View guy-fawkes.html
<div class="mask-container">
<div class="mask-shadow"></div>
<div class="mask-base"></div>
<div class="eye-brow">
<div class="pre-eye-brow-shadow-left"></div>
<div class="pre-eye-brow-shadow-right"></div>
<div class="pre-eye-brow-left"></div>
<div class="pre-eye-brow-right"></div>
<div class="eye-brow-left"></div>
<div class="eye-brow-right"></div>
@bigomega
bigomega / mini_scraper.py
Last active May 18, 2016
Dota International 2016 PrizePool scraper
View mini_scraper.py
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 / chain.js
Created Apr 16, 2016
Coding problem
View chain.js
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 / wordcrack.js
Last active Apr 15, 2016
Solving wordcrack
View wordcrack.js
'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 / _board-utils.js
Last active Mar 23, 2016
simple tic-tac-toe
View _board-utils.js
'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 / load-test.sh
Created Mar 3, 2016
A simple bash script to do load (performance) testing of a web service
View load-test.sh
max="$1"
date
echo "url: $2
rate: $max calls / second"
START=$(date +%s);
get () {
curl -s -v "$1" 2>&1 | tr '\r\n' '\\n' | awk -v date="$(date +'%r')" '{print $0"\n-----", date}' >> /tmp/perf-test.log
}
You can’t perform that action at this time.