Skip to content

Instantly share code, notes, and snippets.


Pranav Sharma phraniiac

View GitHub Profile
View input_quick_tree.json
"id": "0",
"id": "1",
View docs.js
"trie": {
"/bucket_name": {
"/cluster-0": {
"/var-logs": {
View trie-node.js
class TrieNode {
constructor(node_val, is_leaf) {
this.node_val = node_val;
// Making this an object for fast lookups.
// Assuming unique nodes at all levels.
this.children = {};
// We incorporate that some element in the middle can also be a complete path.
this.is_leaf = is_leaf;
View mongo-doc-1.js
cluster_id: "cluster_id",
file_paths: [
View log-s3-structure.log
phraniiac /
Created Mar 21, 2020
Serve a react app.
import os
from flask import Flask, render_template, send_from_directory
app = Flask(__name__, static_folder="/app", template_folder="/app")
# Serve React App
@app.route('/', defaults={'path': ''})
def serve(path):
def lcs(str1, str2):
l = [[0] * len(str2) for i in range(len(str1))]
for r in range(len(str1)):
for c in range(len(str2)):
if r > 0 and c > 0:
l[r][c] = max(l[r-1][c], l[r][c-1])
if str1[r] == str2[c]:
l[r][c] = max(l[r - 1][c - 1] + 1, l[r][c])
if r == 0 or c == 0:
phraniiac / kube-registry.yaml
Created Dec 19, 2018 — forked from coco98/kube-registry.yaml
Docker registry on minikube
View kube-registry.yaml
apiVersion: v1
kind: ReplicationController
name: kube-registry-v0
namespace: kube-system
k8s-app: kube-registry
version: v0
replicas: 1
def process_and_insert(batch):
for tablename in tablenams:
# some processing for each typeof table.
db.insert(batch, tablename)
def insert_function(resultiterator, tablenames):
for batch in iterator_function(resultiterator):
process_and_insert(batch, tablenames)
def variable_summaries(var):
"""Attach a lot of summaries to a Tensor (for TensorBoard visualization)."""
with tf.name_scope('summaries'):
mean = tf.reduce_mean(var)
tf.summary.scalar('mean', mean)
with tf.name_scope('stddev'):
stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean)))
tf.summary.scalar('stddev', stddev)
tf.summary.scalar('max', tf.reduce_max(var))
tf.summary.scalar('min', tf.reduce_min(var))
You can’t perform that action at this time.