This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"id": "0", | |
"parentId":"-1", | |
"meta1":"val1", | |
"meta2":"val2", | |
"meta3":"val3" | |
}, | |
{ | |
"id": "1", | |
"parentId":"0", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cluster_id":"cluster-0", | |
"parent_path":"/", | |
"key":"root", | |
"trie": { | |
"/bucket_name": { | |
"/cluster-0": { | |
"/var-logs": { | |
"subtrie-keys":["log-1"], | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
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", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: kube-registry-v0 | |
namespace: kube-system | |
labels: | |
k8s-app: kube-registry | |
version: v0 | |
spec: | |
replicas: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
NewerOlder