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
Dynamo: How to Design a Key-value Store? | |
Amazon’s Dynamo : https://www.allthingsdistributed.com/2007/10/amazons_dynamo.html | |
Eventually Consistent : https://www.allthingsdistributed.com/2007/12/eventually_consistent.html | |
Bigtable : https://research.google/pubs/pub27898/ | |
DynamoDB : https://www.allthingsdistributed.com/2012/01/amazon-dynamodb.html | |
CRDT : https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type | |
A Decade of Dynamo : https://www.allthingsdistributed.com/2017/10/a-decade-of-dynamo.html | |
Riak : https://docs.riak.com/riak/kv/2.2.0/learn/dynamo/ | |
Dynamo Architecture : https://www.youtube.com/watch?v=w96lLsbI1q8 |
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
from typing import Tuple, List | |
from math import log | |
rates = [ | |
[1, 0.23, 0.25, 16.43, 18.21, 4.94], | |
[4.34, 1, 1.11, 71.40, 79.09, 21.44], | |
[3.93, 0.90, 1, 64.52, 71.48, 19.37], | |
[0.061, 0.014, 0.015, 1, 1.11, 0.30], | |
[0.055, 0.013, 0.014, 0.90, 1, 0.27], | |
[0.20, 0.047, 0.052, 3.33, 3.69, 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
from typing import Tuple, List | |
from math import log | |
rates = [ | |
[1, 0.23, 0.26, 17.41], | |
[4.31, 1, 1.14, 75.01], | |
[3.79, 0.88, 1, 65.93], | |
[0.057, 0.013, 0.015, 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
/* Priority Queue based Heap implementation in TypeScript */ | |
class BinaryHeap<T> { | |
private heapArray: T[] = []; | |
constructor(private lessThan: (a:T, b:T) => boolean) { | |
} | |
size() { | |
return this.heapArray.length; |
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 heapq as hq | |
def generate_time_series(trips): | |
trips.sort(key=lambda x: (x[0], x[1])) | |
series = {} | |
minStartTime = [] | |
for trip in trips: | |
if minStartTime and minStartTime[0] <= trip[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
import ldap3 | |
class Ldap: | |
"""Class for LDAP related connections/operations.""" | |
def __init__(self, server_uri, ldap_user, ldap_pass): | |
self.server = ldap3.Server(server_uri, get_info=ldap3.ALL) | |
self.conn = ldap3.Connection(self.server, user=ldap_user, password=ldap_pass, auto_bind=True) | |
def who_am_i(self): |
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
# Computing current rank of a node in a stream | |
class Node: | |
def __init__(self, val, left=None, right=None, left_size=0): | |
self.val = val | |
self.left = left | |
self.right = right | |
self.left_size = left_size | |
class Solution: |
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
# Computing Rank of a node in a stream | |
"""Source: https://www.geeksforgeeks.org/rank-element-stream """ | |
class Node: | |
def __init__(self, val): | |
self.val = val | |
self.left = None | |
self.right = None | |
self.left_size = 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
function findDuplicateTransactions (transactions = []) { | |
transactions.sort((a, b) => new Date(a.time) - new Date(b.time)); | |
let duplicates = [] | |
let match = [] | |
let src, dst; | |
while(transactions.length > 1){ | |
src = 0 | |
dst = 1 | |
match = [src] |
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
type Salutation = {greeting: string, name: string} | |
/** | |
* @param {Salutation} | |
* @return {string} | |
*/ | |
function greet1({greeting, name}: Salutation):string{ | |
return `${greeting}, ${name}` | |
} |
NewerOlder