Skip to content

Instantly share code, notes, and snippets.

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

Ulysse Buonomo BuonOmo

🥊
—(ಠ益ಠ)ノ
View GitHub Profile
@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 / emojis.sh
Last active March 28, 2024 14:54
A list of all UTF-8 emojis in bash or zsh
# Obtained with the code written in next file
emoji_grinning_face=😀
emoji_grinning_face_with_big_eyes=😃
emoji_grinning_face_with_smiling_eyes=😄
emoji_beaming_face_with_smiling_eyes=😁
emoji_grinning_squinting_face=😆
emoji_grinning_face_with_sweat=😅
emoji_rolling_on_the_floor_laughing=🤣
emoji_face_with_tears_of_joy=😂
emoji_slightly_smiling_face=🙂
@BuonOmo
BuonOmo / no-cursor-script.zsh
Created October 23, 2018 09:22
hide cursor in shell script
show_cursor() {
tput cnorm
exit
}
hide_cursor() {
tput civis
}
trap show_cursor INT TERM
hide_cursor
@BuonOmo
BuonOmo / .gitconfig
Last active February 22, 2024 15:19
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 / 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 / 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 / wallpaper.sh
Created October 18, 2016 01:03
Change wallpaper randomly using unsplash.it API.
#!/bin/sh
#
# Change definition of the screen on line 6.
file=$(mktemp /tmp/wallpaper.XXX.jpg)
curl --output $file 'https://unsplash.it/1920/1080/?random'
gsettings set org.gnome.desktop.background picture-uri file://$file
@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 / time_ago.sh
Last active July 7, 2023 12:42
Time ago in words within bash
#!/usr/bin/env bash
# Copyright (c) 2019 Ulysse Buonomo <buonomo.ulysse@gmail.com> (MIT license)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@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"/>