Skip to content

Instantly share code, notes, and snippets.

View christopherwxyz's full-sized avatar
👨‍💻

Christopher Wallace christopherwxyz

👨‍💻
View GitHub Profile
@christopherwxyz
christopherwxyz / activity-yesterday.sql
Created August 9, 2023 18:14
total and distinct farcaster activity yesterday
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;
@christopherwxyz
christopherwxyz / hubble-gce-deployment.yml
Created August 2, 2023 15:30
hubble GCE deployment steps
# 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 \
@christopherwxyz
christopherwxyz / hubble-test-deployment.yml
Last active February 12, 2024 09:07
hubble k8s deployment
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
@christopherwxyz
christopherwxyz / answer.js
Created August 24, 2022 19:45
possibleSums
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;
@christopherwxyz
christopherwxyz / answer.js
Created August 24, 2022 17:16
groupingDishes
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] = [];