Skip to content

Instantly share code, notes, and snippets.

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

Ulysse Buonomo BuonOmo

🥊
—(ಠ益ಠ)ノ
View GitHub Profile
@BuonOmo
BuonOmo / editorconfig2zedsetting.rb
Created September 25, 2023 00:35
Generate a `.zed/settings.json` file from `.editorconfig`
# frozen_string_literal: true
require "bundler/inline"
gemfile(true, quiet: 1) do
source "https://rubygems.org"
gem "editorconfig"
end
require "json"
@BuonOmo
BuonOmo / sequence.js
Last active April 8, 2024 11:51
Keybinding for a sequence in your browser
// ```
// sequenceKeyBinding('hello', () => { console.log('world') })
// ```
const sequenceKeyBinding = (seq, action, timeoutMs=3000) => {
let curr = 0
let timeout = null
document.body.addEventListener('keydown', (e) => {
if (seq[curr] == e.key) {
if (!timeout) {
@BuonOmo
BuonOmo / ruby-gcc-flags.sh
Last active September 27, 2023 15:48
Ruby flags for compiling and running ruby in C
// See also https://silverhammermba.github.io/emberb/embed/
ruby-gcc-flags() {
[[ "$(rbenv version)" = "system" ]] && return 1
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(rbenv prefix)/lib/pkgconfig" \
pkg-config --cflags --libs ruby-$(rbenv version | cut -d. -f1-2)
}
@BuonOmo
BuonOmo / stringer.opml
Created November 10, 2022 09:56
My stringer feeds
<?xml version="1.0"?>
<opml version="1.0">
<head>
<title>Feeds from Stringer</title>
</head>
<body>
<outline text="Without boats, dreams dry up" title="Without boats, dreams dry up" type="rss" xmlUrl="https://without.boats/index.xml"/>
<outline text="Vanguard Consulting Ltd" title="Vanguard Consulting Ltd" type="rss" xmlUrl="https://beyondcommandandcontrol.com/feed/"/>
<outline text="Paul Ramsey" title="Paul Ramsey" type="rss" xmlUrl="http://blog.cleverelephant.ca/atom.xml"/>
<outline text="Tags from geos" title="Tags from geos" type="rss" xmlUrl="https://github.com/libgeos/geos/releases.atom"/>
@BuonOmo
BuonOmo / redis-command-by-acl.html
Last active August 23, 2022 10:43
Filter REDIS commands by ACL
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>REDIS Commands By ACL Category</title>
@BuonOmo
BuonOmo / shared_ptr.h
Last active September 12, 2022 08:32
Simple shared pointer lib in C
#ifndef SHARED_PTR_H
#define SHARED_PTR_H
#include <stdlib.h>
#include <stdio.h>
#include <stdatomic.h>
#ifdef TEST
#include <assert.h>
#include <string.h>
@BuonOmo
BuonOmo / clone.zsh
Last active September 3, 2021 07:47
Clone from github into your dev folder respecting user/repo architecture
function clone {
local all user repo
(( $# != 1 )) && echo "usage: clone <url>" && return 1
all="$1"
all="${all#'https://github.com/'}"
all="${all#'git@github.com:'}"
all="${all%'.git'}"
IFS='/' read -r user repo <<< "$all"
# @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 26, 2024 21:06
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