Skip to content

Instantly share code, notes, and snippets.

View agavra's full-sized avatar

Almog Gavra agavra

View GitHub Profile
@agavra
agavra / SKILL.md
Created February 6, 2026 21:05
Agent Skill: Prepare PR Review
name description argument-hint user-invocable
prepare-review
Break up branch changes into smaller, logically-grouped commits for easier code review
base-branch
true

Prepare Review

Break up the changes on the current branch into smaller, logically-grouped commits for easier code review.

@agavra
agavra / bitpacking.rs
Created February 5, 2026 20:30
bitpacking can cause byte-algined compressors to struggle
/// β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
/// β”‚ Scenario β”‚ Raw+zstd β”‚ Bitpacked+zstd β”‚ Winner β”‚
/// β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
/// β”‚ Uniform random 7-bit β”‚ 8837 β”‚ 8759 β”‚ Bitpack (-78) β”‚
/// β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
/// β”‚ Sorted 7-bit β”‚ 246 β”‚ 662 β”‚ Raw (+416) β”‚
/// β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
/// β”‚ Repeated runs 7-bit β”‚ 280 β”‚ 984 β”‚ Raw (+704) β”‚
/// β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
/// β”‚ Sequential 7-bit β”‚ 147 β”‚ 131 β”‚ Bitpack (-16) β”‚
@agavra
agavra / format-backtrace
Created February 2, 2026 21:40
rust backtrace table formatter
#!/bin/bash
# Rust Backtrace Formatter
# Usage: format-backtrace [-v] [-vv]
# (no flag): show short function name only
# -v: show truncated full path with ... prefix
# -vv: show complete full path
SCRIPT_DIR="$(dirname "$0")"
VERBOSE=0
@agavra
agavra / index.ts
Created March 6, 2024 20:36
Race Condition Log Analyzer
import * as fs from 'fs';
import * as rd from 'readline'
function getKey(result: RegExpExecArray) {
return result[1] + '/' + result[3]
}
const regex = /\[(transaction_id_store-[0-9]+)] Flushing ([0-9]+) records with batchSize=[0-9]+ to remote \(offset=([0-9]+)/
const regex2 = /\[(transaction_id_store-[0-9]+)] Flushed ([0-9]+) records to [0-9]+ table partitions with offset ([0-9]+)/
const reader = rd.createInterface(fs.createReadStream('<log file>'))
@agavra
agavra / ConsumerPartitionAssignor.java
Created November 15, 2023 17:28
Snippet from ConsumerPartitionAssignor
public interface ConsumerPartitionAssignor {
/**
* Return serialized data that will be included in the {@link Subscription} sent to the leader
* and can be leveraged in {@link #assign(Cluster, GroupSubscription)} ((e.g. local host/rack information)
*/
default ByteBuffer subscriptionUserData(Set<String> topics) {
return null;
}
@agavra
agavra / policy.yaml
Created November 1, 2023 03:12
Sample Responsive Autoscaling Policy
apiVersion: "application.responsive.dev/v1"
kind: "ResponsivePolicy"
metadata:
name: example-policy
namespace: responsive
spec:
applicationNamespace: responsive
applicationName: example
status: POLICY_STATUS_MANAGED
policyType: KAFKA_STREAMS
@agavra
agavra / ksql-demo.sh
Last active January 24, 2022 21:45
ksqlDB Pull Query Bash Demo
#
# Example Usage:
# ./get-and-subscribe.sh -t foo -s "user = 'User_6'" will get all rows with `user = 'User_6'` from the foo table
# ./get-and-subscribe.sh -f -t foo -s "user = 'User_6'" will issue the above query, and also subscribe to changes
usage() { echo "Usage: $0 [-f follow] [-t table] [-s <sql where clause>]" 1>&2; exit 1; }
while getopts "ft:s:" o; do
case "${o}" in
t)