Skip to content

Instantly share code, notes, and snippets.

View rodmoioliveira's full-sized avatar

Rodolfo Mói rodmoioliveira

View GitHub Profile
@rodmoioliveira
rodmoioliveira / .golangci.yml
Created March 5, 2025 22:15 — forked from maratori/.golangci.yml
Golden config for golangci-lint
# This file is licensed under the terms of the MIT license https://opensource.org/license/mit
# Copyright (c) 2021-2025 Marat Reymers
## Golden config for golangci-lint v1.64.6
#
# This is the best config for golangci-lint based on my experience and opinion.
# It is very strict, but not extremely strict.
# Feel free to adapt it to suit your needs.
# If this config helps you, please consider keeping a link to this file (see the next comment).
#!/bin/bash
declare TRACE
[[ "${TRACE}" == 1 ]] && set -o xtrace
set -o errexit
set -o nounset
set -o pipefail
set -o noclobber
posts() {
@rodmoioliveira
rodmoioliveira / performance_overview.md
Last active April 5, 2023 02:39
Performance Overview
 # generate index
bat performance_overview.md |
  rg '^#' |
  sd '#' '  -' |
  sd -- '-  ' '   ' |
  sd '(\w+.)' '[$1]' |
  sd '\]\[' '' |
  sd '(\w) (\w)' '$1-$2' |
 tr '[:upper:]' '[:lower:]' |
@rodmoioliveira
rodmoioliveira / 00README.md
Created February 6, 2023 01:56 — forked from natefoo/00README.md
Linux Distribution Detection

Distribution Detection

I am working on adding support for building and distributing (via PyPI) Python Wheels with C Extensions to the Python wheel and pip packages. The discussion on Distutils-SIG continues, but I believe it is fairly certain that some effort to correctly identify Linux distributions will need to be made. I've begun efforts to add this support to wheel.

How you can help

If you have a Linux distribution or version of a listed distribution not in this gist, or one of the ones I have not directly verified, I could use the following:

  • The contents of /etc/os-release, if it exists
@rodmoioliveira
rodmoioliveira / bitsets.go
Last active November 8, 2023 16:29
Bit sets in Golang
// https://rm-o.dev/blog/basic-set-operations-in-golang/
package main
import (
"fmt"
"math/bits"
)
const (
sat uint8 = 1 << iota // (0b0000001) -> {sat}
@rodmoioliveira
rodmoioliveira / sets.go
Last active November 19, 2021 07:41
Basic set operations in Golang
// https://rm-o.netlify.app/blog/basic-set-operations-in-golang/
package main
import (
"fmt"
"strings"
)
type (
SetItem interface{}
@rodmoioliveira
rodmoioliveira / fp.js
Created September 18, 2020 18:13
fp.js
const isFn = (fn) => fn && {}.toString.call(fn) === '[object Function]';
const groupBy = (key) => (xs) =>
xs.reduce((rv, x) => {
(rv[x[key]] = rv[x[key]] || []).push(x);
return rv;
}, {});
const flow = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args)));
const zipObject = (props, values) =>
props.reduce((obj, prop, index) => ((obj[prop] = values[index]), obj), {});
const zip = (...arrays) => {
@rodmoioliveira
rodmoioliveira / .block
Last active May 13, 2020 00:16 — forked from d3indepth/.block
Force layout (x foci)
license: gpl-3.0
height: 400
border: no
@rodmoioliveira
rodmoioliveira / get.js
Created September 25, 2019 22:08
Safely Accessing Deeply Nested Values In JavaScript
// https://medium.com/javascript-inside/safely-accessing-deeply-nested-values-in-javascript-99bf72a0855a
const props = {
user: {
posts: [
{ title: 'Foo', comments: ['Good one!', 'Interesting...'] },
{ title: 'Bar', comments: ['Ok'] },
{ title: 'Baz', comments: [] },
]
}
@rodmoioliveira
rodmoioliveira / get_in.py
Created September 25, 2019 21:38
Safely Accessing Deeply Nested Values In Python Dictionaries
# inspirado em https://clojuredocs.org/clojure.core/get-in
from functools import reduce
from numbers import Number
my_dict = {
"username": "rodmoi",
"profile": {
"name": "Rodolfo Oliveira",
"hobbies": ["programming", "chess"],