Skip to content

Instantly share code, notes, and snippets.

View ipalbeniz's full-sized avatar

Iñaki Pérez de Albéniz ipalbeniz

  • Palma de Mallorca
  • 04:56 (UTC +01:00)
  • X @ialbeniz
View GitHub Profile
@epicserve
epicserve / redis_key_sizes.sh
Last active November 18, 2025 16:07
A simple script to print the size of all your Redis keys.
#!/usr/bin/env bash
# This script prints out all of your Redis keys and their size in a human readable format
# Copyright 2013 Brent O'Connor
# License: http://www.apache.org/licenses/LICENSE-2.0
human_size() {
awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } '
}
@coderplay
coderplay / PBQvsThreadPool.java
Created April 8, 2013 08:18
Using PriorityBlockingQueue in thread pool
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.RunnableFuture;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;