This file contains hidden or 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
use std::collections::HashMap; | |
use tokio::sync::Mutex; | |
use tonic::transport::Server; | |
use tracing::info; | |
tonic::include_proto!("bank"); | |
#[derive(Default)] | |
pub struct MyBank { | |
accounts: Mutex<HashMap<String, u64>>, |
This file contains hidden or 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
``` | |
If an app invokes 1000 RPC calls to proceed, | |
and the 99th percentile delay for all of those | |
calls is 100ms, what is the likelihood that your | |
app will need to wait <=100ms to proceed? | |
``` | |
Let's assume that the app needs all RPC to | |
return before displaying something. (which is | |
not necessarily the case) |
This file contains hidden or 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
WITH | |
poss AS ( | |
SELECT x, y, x*y AS p, x+y as s | |
FROM | |
GENERATE_SERIES(2,100) as x, | |
GENERATE_SERIES(2,100) as y | |
WHERE x + y <= 100 AND y > x | |
), | |
poss_after_sue_2 AS ( | |
SELECT * |
This file contains hidden or 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 collections import Counter, defaultdict | |
import heapq | |
import pickle | |
import os | |
FIRST_GUESS = "aloes" | |
NUM_GUESS = 5 | |
CACHE_FILE = "wordle.pickle" | |
def dictionary(): |
This file contains hidden or 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
First of all I am not very familiar with Elasticsearch settings, | |
but fairly familiar with what stock Lucene does. | |
I haven't any experience of NRTDirectory... | |
Lucene simply writes immutable segments files. | |
The NRTDirectory does not sync, in order to minimize the cost of commit. | |
The OS will eventually flush these pages to disk. | |
On the read side, the file is mapped into memory. | |
On first access, the OS will experience a page fault. |
This file contains hidden or 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
Leader election on top of Scuttlebutt. | |
----------------------------------------------- | |
The following makes it possible to cheaply get a leader election | |
on top of a Cassandra-like membership using scuttlebutt + phi accrual detection. | |
# TDLR about Scuttlebutt and phi accrual detection | |
Scuttlebutt is a anti-entropy gossip algorithm. | |
It makes it possible for every node in a cluster to |
This file contains hidden or 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
# Quickwit Individual Contributor License Agreement | |
Thank you for your interest in contributing to Quickwit ("We" or "Us"). | |
This contributor agreement ("Agreement") documents the rights granted by contributors to Us. To make this document effective, please sign it and send it to Us by electronic submission, following the instructions at https://cla-assistant.io/quickwit-inc/quickwit. This is a legally binding document, so please read it carefully before agreeing to it. The Agreement may cover more than one software project managed by Us. | |
## 1. Definitions | |
"*You*" means the individual who Submits a Contribution to Us. |
This file contains hidden or 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
# Quickwit Individual Contributor License Agreement | |
Thank you for your interest in contributing to Quickwit ("We" or "Us"). | |
This contributor agreement ("Agreement") documents the rights granted by contributors to Us. To make this document effective, please sign it and send it to Us by electronic submission, following the instructions at https://cla-assistant.io/quickwit-inc/quickwit. This is a legally binding document, so please read it carefully before agreeing to it. The Agreement may cover more than one software project managed by Us. | |
## 1. Definitions | |
"*You*" means the individual who Submits a Contribution to Us. |
This file contains hidden or 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
# The point of this program is to demonstrate why | |
# supporting negative indices can be error-prone. | |
# | |
# The example was voluntarily made simple. | |
# Of course this is not the most optimized algorithm to answer | |
# the question... | |
# | |
# Real life example are typically more intricate | |
# and may occur sporadically. | |
def longest_stay(hotel_rates, budget): |
This file contains hidden or 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 Tree: | |
def __init__(self, base, left, right): | |
self.base = base | |
self.left = left | |
self.right = right |
NewerOlder