Skip to content

Instantly share code, notes, and snippets.

View victorhazbun's full-sized avatar
🚀
Work work work

Victor Hazbun Anuff victorhazbun

🚀
Work work work
View GitHub Profile
@victorhazbun
victorhazbun / .zshrc
Last active September 4, 2024 15:30
Settings for .zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
@victorhazbun
victorhazbun / Benchmark.rb
Created October 7, 2023 18:44 — forked from mperham/Benchmark.rb
Leaky bucket limiter usage with Sidekiq Enterprise
require 'benchmark'
require 'sidekiq-ent/limiter'
COUNT = 10_000
Benchmark.bmbm(30) do |x|
x.report("leaky") do
COUNT.times do |count|
lmt = Sidekiq::Limiter.leaky("leaky_#{count%100}", 10, 10, wait_timeout: 0, policy: :skip)
lmt.within_limit do
@victorhazbun
victorhazbun / int_to_base.rb
Created September 19, 2023 19:15
URL shortener
class IntToBase
def self.convert(int, base)
digits = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
result = ""
while int > 0
result += digits[int % base]
int /= base
end
result.reverse
end