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
#!/bin/bash | |
# Function to display usage information | |
usage() { | |
echo "Usage: $0 /path/to/input.mp4 [ /path/to/output_directory ]" | |
exit 1 | |
} | |
# Check if at least one argument (input file) is provided | |
if [ $# -lt 1 ]; then |
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
func (mp *MessageProcessor) processBatch(batch []*pb.Message) { | |
if len(batch) == 0 { | |
return | |
} | |
startTime := time.Now() | |
defer func() { | |
if mp.metrics != nil { | |
mp.metrics.batchProcessingTime.Observe(time.Since(startTime).Seconds()) | |
} |
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
SELECT | |
(SELECT COUNT(*) FROM casts WHERE DATE(timestamp) = CURRENT_DATE - INTERVAL '1 day') AS total_casts_sent_yesterday, | |
(SELECT COUNT(DISTINCT fid) FROM casts WHERE DATE(timestamp) = CURRENT_DATE - INTERVAL '1 day') AS distinct_casts_sent_yesterday, | |
(SELECT COUNT(*) FROM reactions WHERE DATE(timestamp) = CURRENT_DATE - INTERVAL '1 day') AS total_reactions_sent_yesterday, | |
(SELECT COUNT(DISTINCT fid) FROM reactions WHERE DATE(timestamp) = CURRENT_DATE - INTERVAL '1 day') AS distinct_reactions_sent_yesterday; |
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
# Set the GCP project and zone where you want to create the instance | |
PROJECT_ID={YOUR_PROJECT_ID} # e.g. hubble-123456 | |
ZONE={YOUR_ZONE_ID} # e.g. us-central1-a | |
# Create the GCE instance | |
gcloud compute instances create hubble-instance \ | |
--project=${PROJECT_ID} \ | |
--zone=${ZONE} \ | |
--image-family=debian-10 \ | |
--image-project=debian-cloud \ |
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
apiVersion: storage.k8s.io/v1 | |
kind: StorageClass | |
metadata: | |
name: gce-pd-retained | |
reclaimPolicy: Retain | |
provisioner: kubernetes.io/gce-pd | |
parameters: | |
type: pd-standard | |
replication-type: none |
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
function solution(coins, quantity) { | |
let s = new Set([0]); | |
for (let i in coins) { | |
for (let entry of [...s]) { | |
for (let j = quantity[i]; j; ) { | |
s.add(coins[i] * j-- + entry); | |
} | |
} | |
} | |
return s.size - 1; |
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
function solution(dishes) { | |
let dishMap = {}; | |
let ingredientsMap = {}; | |
dishes.forEach((_, i) => { | |
dishMap[dishes[i][0]] = new Set(dishes[i].slice(1)); | |
}); | |
[...new Set(dishes.map((x) => x.slice(1)).flatMap((x) => x))].map((x) => { | |
for (const key in dishMap) { | |
if (dishMap[key].has(x)) { | |
if (ingredientsMap[x] === undefined) ingredientsMap[x] = []; |