Skip to content

Instantly share code, notes, and snippets.

View romange's full-sized avatar
🇮🇱

Roman Gershman romange

🇮🇱
View GitHub Profile
@romange
romange / sim_cluster_load.py
Created June 11, 2025 14:03
cluster load simulation
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
from scipy.stats import zipfian
# --- Constants ---
NUM_SLOTS = 16384
@romange
romange / go.mod
Last active October 5, 2024 09:18
upload 100m members in golang
// go.mod
module upload
go 1.16
require (
github.com/go-redis/redis/v8 v8.11.5
)
@romange
romange / upload_100m.py
Created October 4, 2024 06:16
uploads 100M set members
#!/usr/bin/env python3
import redis,secrets
# Connect to Redis server
r = redis.Redis(host='localhost', port=6379, db=0)
# Initialize variables
total_numbers = 100_000_000
@romange
romange / bins.py
Last active September 3, 2024 12:43
Simulation shows how the load variability affects loads between shards
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
import webbrowser
def uniform_bin_filling(N_balls, K_bins):
bins = np.zeros(K_bins, dtype=int)
for i in range(N_balls):
bins[np.random.randint(0, K_bins)] += 1
#!/bin/bash
# run it via
# wget -O - https://gist.github.com/romange/a082bef5636f994b63e2239ecff28abc/raw/setup_ws.sh 2> /dev/null \
# | sudo -E bash -
apt-get update
apt-get -y upgrade
# for Dev prerequisites
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
"os"
"strconv"
"time"
@romange
romange / mmap_any_address.c
Created April 13, 2020 11:54
mmap example
#include <sys/mman.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* On 48-bit addressing schemes you can mmap any non-reserved address between
0 and 0x7FFFFFFFFFFF. You can try to pass 0x7fffffffe000 or 0 when running this program.
*/
int main(int argc, char* argv[]) {
@romange
romange / README.md
Last active April 24, 2020 13:26
Gifs

Hello