Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Pranav Sharma phraniiac

🎯
Focusing
View GitHub Profile
View input_quick_tree.json
[{
"id": "0",
"parentId":"-1",
"meta1":"val1",
"meta2":"val2",
"meta3":"val3"
},
{
"id": "1",
"parentId":"0",
View docs.js
{
"cluster_id":"cluster-0",
"parent_path":"/",
"key":"root",
"trie": {
"/bucket_name": {
"/cluster-0": {
"/var-logs": {
"subtrie-keys":["log-1"],
}
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: [
"/bucket_name/cluster-0/test-log/service1/logs-1.log",
"/bucket_name/cluster-0/test-log/service1/logs-2.log",
"/bucket_name/cluster-0/test-log/service1/logs-3.log",
"/bucket_name/cluster-0/test-log/service2/logs-1.log",
"/bucket_name/cluster-0/test-log/service3/logs-1.log",
"/bucket_name/cluster-0/env-log/service1/logs-1.log",
"/bucket_name/cluster-0/env-log/service1/logs-2.log",
View log-s3-structure.log
/bucket_name/cluster-0/test-log/service1/logs-1.log
/bucket_name/cluster-0/test-log/service1/logs-2.log
/bucket_name/cluster-0/test-log/service1/logs-3.log
/bucket_name/cluster-0/test-log/service2/logs-1.log
/bucket_name/cluster-0/test-log/service3/logs-1.log
/bucket_name/cluster-0/env-log/service1/logs-1.log
/bucket_name/cluster-0/env-log/service1/logs-2.log
/bucket_name/cluster-0/env-log/service1/logs-3.log
/bucket_name/cluster-0/env-log/service2/logs-1.log
/bucket_name/cluster-0/env-log/service3/logs-1.log
@phraniiac
phraniiac / serve.py
Created Mar 21, 2020
Serve a react app.
View serve.py
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': ''})
@app.route('/<path:path>')
def serve(path):
print(path)
View lcs.py
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
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
metadata:
name: kube-registry-v0
namespace: kube-system
labels:
k8s-app: kube-registry
version: v0
spec:
replicas: 1
View func_insertion1.py
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)
View summaries_tensorflow_template.py
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.