Skip to content

Instantly share code, notes, and snippets.

View kra3's full-sized avatar
🤠
I may be slow to respond.

Arun Karunagath kra3

🤠
I may be slow to respond.
View GitHub Profile
// no way to reset, at the moment
const get = (() =>{
let counter = 0;
return (url) => {
return new Promise((resolve, reject) => {
if(counter > 100) {
reject(false);
}

Keybase proof

I hereby claim:

  • I am kra3 on github.
  • I am kra3 (https://keybase.io/kra3) on keybase.
  • I have a public key ASDFa3YNbsbfrmC-8WfUOSMiBDUfYeRpU7-5-EDSFXrisgo

To claim this, I am signing this object:

@kra3
kra3 / The Technical Interview Cheat Sheet.md
Created February 17, 2017 18:57 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@kra3
kra3 / sublime_py_proj_with_venv.json
Created January 5, 2017 09:33
Sublime project settings - python project with virtualenv
{
"Python": {
"python": "~/.envs/<virtual_env_name>/bin/python",
"pythonExtraPaths": [
"~/.envs/<virtual_env_name>/lib/python3.5/site-packages/"
]
},
"folders": [
{
"path": "<relative_project_path_from_this_file>",
@kra3
kra3 / maven tips.sh
Last active November 6, 2018 10:53
Speed up maven build times.
# rip off from https://zeroturnaround.com/rebellabs/your-maven-build-is-slow-speed-it-up/
# in .bashrc
set MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
# add -DdependencyLocationsEnabled=false to retain fewer outgoing connections.
# compile all modules
mvn -T 1C install -offline
$ reset
# better way
$ stty sane
$ tput rs1
@kra3
kra3 / flatten.js
Created December 13, 2016 19:10
flatten a nested array
// function definition ES6
let flatten = (arr, res=[]) => {
for(let itm of arr){
Array.isArray(itm)? flatten(itm, res): res.push(itm);
}
}
// calling the function
let result = [];
flatten([1,2, [3, 4], [5, [6, 7, [8, 9]]]], result);
@kra3
kra3 / recover_tmux.sh
Created March 7, 2016 11:05
Try recovering a misbehaving tmux attach
# to try recover a closed tmux session
# if the attach is not working while the socket is still there
# at /tmp/tmux-XXX/<default>
killall -10 tmux
@kra3
kra3 / py_unquote.js
Last active August 29, 2015 14:27
urllib.unquote in JavaScript
// LICENCE: BSD 3 Clause
var _hexDig = "0123456789ABCDEFabcdef";
var _hexToChar = {};
var i, j;
// generate convertion map
for(i in _hexDig){
for(j in _hexDig){
var key = _hexDig[i] + _hexDig[j] ;
@kra3
kra3 / wiki_helper.py
Last active October 29, 2017 01:01
A generic script for text processing originally written specific to some usecases around wiki text.
# -*- coding: utf-8 -*-
__author__ = 'Arun KR (kra3) <the1.arun@gmail.com>'
__license__ = 'Simplified BSD'
import sys
"""
wiki_helper.py rules.txt data.txt > result.txt