Skip to content

Instantly share code, notes, and snippets.

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

Ulysse Buonomo BuonOmo

🥊
—(ಠ益ಠ)ノ
View GitHub Profile
@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 / .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)
@pyrsmk
pyrsmk / service.rb
Last active July 2, 2020 20:01
Example of a pipe implementation in a service, from the functional programming world 🤖
class SomeService
def call(some_value, bypass_some_method4 = false)
pipe(
some_value,
:some_method1,
:some_method2,
-> (value) { value * 2 },
bypass_some_method4 ? :noop : :some_method4,
:some_method5
)
@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
@agrberg
agrberg / environment.js
Created April 11, 2020 16:40
Getting webp images and autogeneration working in Rails 6
const IMAGE_REGEXP = /\.(?:jpe?g|png)$/; // https://regexper.com/#%2F%5C.%28%3F%3Ajpe%3Fg%7Cpng%29%24%2F
const ImageminWebpWebpackPlugin = require('imagemin-webp-webpack-plugin');
const { environment } = require('@rails/webpacker');
environment.plugins.prepend('ImageminWebpWebpackPlugin', new ImageminWebpWebpackPlugin({
silent: false,
detailedLogs: true,
}));
const manifest = environment.plugins.get('Manifest')
@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
@jclosure
jclosure / bidirectional_clipboard.md
Last active March 25, 2025 13:40
Setup a bi-directional shared clipboard between client macos and linux server for remote terminal emacs.

Using netcat and ssh tunnels, create a shared clipboard allowing client and server clipboards to be fused

Serve pbcopy and pbpaste on Mac's localhost

NOTE: That we are making the assumption that the clipboards are sending and receiving UTF-8 encoded bytes

~/Library/LaunchAgents/pbcopy.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@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 <[email protected]> (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:
#
@gabrielbarros
gabrielbarros / github-keys.txt
Created March 8, 2019 23:33
Github SSH key and GPG
https://github.com/USER.keys
https://github.com/USER.gpg