Skip to content

Instantly share code, notes, and snippets.

View venkatperi's full-sized avatar

Venkat Peri venkatperi

View GitHub Profile
['stateTimeout#*_#running', 'done/timeout']
props: {
taskTimeout: {
type: Number,
required: false,
},
},
data: function () {
return {
task: {
sm: {},
state: '',
error: {},
result: undefined,
},
}
},
@venkatperi
venkatperi / genpass.sh
Last active January 17, 2019 03:44
Generates base62 passwords/api keys
#!/bin/bash
SIZE=${1:-20}
curl -s https://apikey.now.sh/$SIZE | cut -d, -f1 | cut -d: -f2 | tr -d \"
@venkatperi
venkatperi / gist:d975cc768a6be9bff7615426643ef887
Created April 15, 2019 11:47
Crores & Lakhs for Rupee Currency in Google Sheets
₹* _(## ## ## ##0_);₹* (## ## ## ###);₹* 0_)
function toAsciiTree(tree: any, prefix = "", isTail = true): string | null {
if (!tree) {
return null
}
let children = tree.children || []
return [prefix, isTail ? "└" : "├", " ", tree.name, '\n']
.concat(children.map((c: any, i: number) => toAsciiTree(c,
prefix + (isTail ? " " : "│ "), i >= children.length - 1)))
.join('')
/**
* Given an array of size 'n' and a number 'r' (r <= n), this generator returns all
* nCr permutation subarrays of the array.
*
* @param arr - array
* @param r number
*/
function* permutations(arr, r, prefix = []) {
for (let i = 0; i < arr.length - r + 1; i++) {
let x = [...prefix, arr[i]]