Skip to content

Instantly share code, notes, and snippets.

View BuonOmo's full-sized avatar
🥊
—(ಠ益ಠ)ノ

Ulysse Buonomo BuonOmo

🥊
—(ಠ益ಠ)ノ
View GitHub Profile
# @param job_name [nil | #call | Regexp | String] name or proc to filter on
# @param tally_by [Symbol | #call] either a Sidekiq::SortedEntry method or a
# thing that responds to #call and takes the entry as argument
# @return the filtered jobs
# @example
# sidekiq_stat("ApplyReferrals.call", ->(j) { j.item["error_message"].gsub(/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/, "UUID") })
def sidekiq_stat(job_name = nil, tally_by = :display_class)
jobs = Sidekiq::DeadSet.new.select do |sorted_entry|
case job_name
when nil then true
@BuonOmo
BuonOmo / clean-ruby-versions.bash
Last active June 1, 2021 07:18
Clean old rbenv ruby versions with care ⭐️
cd ~/.rbenv/versions/
du -sh *
cd ~/Dev
ruby -e 'pp `fd --no-ignore --hidden '.ruby-version'`.split.group_by { IO.read(_1).strip }'
rbenv uninstall --force ... # remove versions that seems useless to you.
@BuonOmo
BuonOmo / .gitconfig
Last active April 9, 2025 09:38
Git blame color scale from 20 month ago to now (https://stackoverflow.com/a/66250482/6320039)
[color "blame"]
highlightRecent = 234, 23 month ago, 235, 22 month ago, 236, 21 month ago, 237, 20 month ago, 238, 19 month ago, 239, 18 month ago, 240, 17 month ago, 241, 16 month ago, 242, 15 month ago, 243, 14 month ago, 244, 13 month ago, 245, 12 month ago, 246, 11 month ago, 247, 10 month ago, 248, 9 month ago, 249, 8 month ago, 250, 7 month ago, 251, 6 month ago, 252, 5 month ago, 253, 4 month ago, 254, 3 month ago, 231, 2 month ago, 230, 1 month ago, 229, 3 weeks ago, 228, 2 weeks ago, 227, 1 week ago, 226
[blame]
coloring = highlightRecent
date = human
@BuonOmo
BuonOmo / mass-archive-trello-columns.js
Last active November 5, 2020 17:56
Archive trello columns all at once (using web, or api)
function timeout(time = 200) {
return new Promise((resolve) => {
setTimeout(resolve, time);
})
}
/**
* Prepare archiving, making sure columns are the correct ones.
*
* @param contents every column names to treat (may be only a part)
@BuonOmo
BuonOmo / scrap-heroku-dataclips.js
Last active October 16, 2020 11:08
Retrieve every Heroku dataclips at once.
// Go to the dataclip listing (https://data.heroku.com/dataclips).
// Then execute this script in your console.
// Be careful, this will focus a new window every 4 seconds, preventing
// you from working 4 seconds times the number of dataclips you have.
// Retrieve urls and titles
let dataclips = Array.
from(document.querySelectorAll('.rt-td:first-child a')).
map(el => ({ url: el.href, title: el.innerText }))
  1. Install the ruby extension pack.
  2. bundle install --binstubs to have bin/<executable>
  3. create a launch.json and add the configuration:
    {
      "name": "TODO",
      "type": "Ruby",
      "request": "launch",
      "program": "${workspaceRoot}/bin/TODO",

"cwd": "${workspaceRoot}",

@BuonOmo
BuonOmo / pre-commit.zsh
Last active November 23, 2021 10:04
Git pre-commit hook that detects non-breaking spaces
#!/usr/bin/env zsh
# Look for non-breaking spaces hidden in code, refuse
# to commit if there are some. This hook depends on the
# great ripgrep (https://github.com/BurntSushi/ripgrep).
# You can use bash if you prefere it over zsh, and ag
# over rg.
! rg --colors 'match:bg:yellow' -C 1 ' ' $(git ls-files) && exit 0
@BuonOmo
BuonOmo / aws-dynamo-db-delete-all-items.zsh
Last active September 8, 2023 15:07
Delete all items in a dynamo db table
#!/usr/bin/env zsh
# I'm using jq to parse json. I really suggest using it.
# I'm using parallel for faster results, you could use xargs or a for loop if you don't have parallel.
main() (
set -eux
local options="--profile some-profile"
local key='id'
local table='table'
@BuonOmo
BuonOmo / talkie.js
Last active April 10, 2020 14:39
Hangout push to talk.
// ==UserScript==
// @name talkie
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Safe talking on hangout
// @author You
// @match https://hangouts.google.com/u/*/call/*
// @grant none
// ==/UserScript==
@BuonOmo
BuonOmo / most-starred-repos.sh
Last active January 16, 2020 14:51
Most starred public repositories on GitHub.
# Forked from: https://gist.github.com/jdennes/7013672.
#
# I improved the request output!
curl -G https://api.github.com/search/repositories \
--data-urlencode 'q=stars:>1000' \
--data-urlencode 'sort=stars' \
--data-urlencode 'order=desc' \
-H 'Accept: application/vnd.github.preview' \
| jq --raw-output '.items | .[] | (.full_name + " (" + (.stargazers_count | tostring) + ")")' \
| cat -n