Skip to content

Instantly share code, notes, and snippets.

View PeteDevoy's full-sized avatar

Pete PeteDevoy

View GitHub Profile
@tomdottom
tomdottom / 1-distributed-rate-limiting-of-message-queues.md
Last active May 19, 2022 13:27
Distributed rate limiting of multiple tasks queues (RabbitMQ) and the Kombu package

Basic task processing with distributed rate limiting

Proof of concept of distributed rate limiting multiple workers processing speed.

Rate limiting follows a leaky bucket algorithim. The bucket is implemented using a speical token-bucket queue. Max size of the bucket is enforced by using the max length of a token queue. The bucket is refilled by a single worker, which also is responsible for the refill rate.

Workers must get a token before fetching and processing any tasks.

@Remi-C
Remi-C / finding_useless_fil_in_postgres_data_folder.sql
Last active August 14, 2017 15:05
finding useless files in postgres data folder
DROP FUNCTION IF EXISTS find_useless_postgres_file(text);
CREATE OR REPLACE FUNCTION find_useless_postgres_file( database_name text)
RETURNS TABLE(file_name text, file_relative_path text,file_abs_path text,size bigint) AS
$BODY$
DECLARE
_useless record;
BEGIN
RETURN QUERY
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];