Skip to content

Instantly share code, notes, and snippets.

View fabiolimace's full-sized avatar

Fabio Lima fabiolimace

View GitHub Profile
@fabiolimace
fabiolimace / snowflake-id.sql
Created April 18, 2024 20:13 — forked from beginor/snowflake-id.sql
Twitter Snowflake ID for PostgreSQL
CREATE SEQUENCE public.global_id_seq;
ALTER SEQUENCE public.global_id_seq OWNER TO postgres;
CREATE OR REPLACE FUNCTION public.id_generator()
RETURNS bigint
LANGUAGE 'plpgsql'
AS $BODY$
DECLARE
our_epoch bigint := 1314220021721;
seq_id bigint;
@fabiolimace
fabiolimace / Entity.java
Last active April 3, 2024 20:36 — forked from rajivrnair/Entity.java
Custom Hibernate UUID Generator
// Before
@Id
@Column(name = "entity_id")
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid2")
private String entityId;
// After
@Id
@Column(name = "entity_id")
@fabiolimace
fabiolimace / run_test_uuid.sh
Created February 4, 2024 00:55 — forked from ardentperf/run_test_uuid.sh
UUID benchmark driver script
#!/bin/bash
INIT_TABLE_ROWS=20000000
PGBENCH_TRANSACTIONS_PER_CLIENT=100000
PGBENCH_CLIENTS=10
run_test() {
echo "$(date +%y%m%d.%H%M) STARTING TEST $1"
pg_stop
@fabiolimace
fabiolimace / ThreadLocalWeakRefTest.java
Created December 14, 2023 23:09 — forked from chrisvest/ThreadLocalWeakRefTest.java
ThreadLocals and weak references
import org.junit.Test;
import java.lang.ref.WeakReference;
import static org.junit.Assert.assertNull;
public class ThreadLocalWeakRefTest {
/**
* Many Java web servers and containers go out of their way to find and null
* out ThreadLocals that an application might have created. Question is, is
@fabiolimace
fabiolimace / markdown-flavors.md
Created November 25, 2023 23:29 — forked from vimtaai/markdown-flavors.md
Comparison of features in various Markdown flavors

Comparison of syntax extensions in Markdown flavors

I created a crude comparison of the syntax of the various common Markdown extensions to have a better view on what are the most common extensions and what is the most widely accepted syntax for them. The list of Markdown flavors that I looked at was based on the list found on CommonMark's GitHub Wiki.

Flavor Superscript Subscript Deletion*
Strikethrough
Insertion* Highlight* Footnote Task list Table Abbr Deflist Smart typo TOC Math Math Block Mermaid
GFM
@fabiolimace
fabiolimace / pt_br.affix
Created November 14, 2023 19:20 — forked from CauanCabral/pt_br.affix
Dicionários Hunspell PT-BR preparados para busca textual (FTS) com Postgresql. Fonte: https://cgit.freedesktop.org/libreoffice/dictionaries/tree/pt_BR
This file has been truncated, but you can view the full file.
SET UTF-8
TRY áàãâéêíóõôúüçesianrtolcdugmphbyfvkwjqxz
# VERO - Verificador Ortográfico Livre - Versão 3.2
# Copyright (C) 2006 - 2013 por Raimundo Santos Moura
# <raimundo.smoura@gmail.com>
# Brasil - outubro 2013
# Este é um dicionário para correção ortográfica da língua Portuguesa
# para o Hunspell.
# Este programa é livre e pode ser redistribuído e/ou modificado nos
@fabiolimace
fabiolimace / defrag_ext4_filesystem.md
Created October 28, 2022 11:13 — forked from rmi1974/defrag_ext4_filesystem.md
How to optimize / defrag ext4 filesystem #ext4 #commandlinefu

How to optimize / defrag ext4 filesystem

Make sure the target filesystem is sane

Open up the terminal and run:

sudo fsck.ext4 -y -f -v /dev/<disk/partition>
http://www.oreilly.com/data/free/files/2014-data-science-salary-survey.pdf
http://www.oreilly.com/data/free/files/2015-data-science-salary-survey.pdf
http://www.oreilly.com/data/free/files/Data_Analytics_in_Sports.pdf
http://www.oreilly.com/data/free/files/advancing-procurement-analytics.pdf
http://www.oreilly.com/data/free/files/ai-and-medicine.pdf
http://www.oreilly.com/data/free/files/analyzing-data-in-the-internet-of-things.pdf
http://www.oreilly.com/data/free/files/analyzing-the-analyzers.pdf
http://www.oreilly.com/data/free/files/architecting-data-lakes.pdf
http://www.oreilly.com/data/free/files/being-a-data-skeptic.pdf
http://www.oreilly.com/data/free/files/big-data-analytics-emerging-architecture.pdf
@fabiolimace
fabiolimace / markdown-text-101.md
Created February 22, 2022 03:47 — forked from matthewzring/markdown-text-101.md
A guide to Markdown on Discord.

Markdown Text 101

Want to inject some flavor into your everyday text chat? You're in luck! Discord uses Markdown, a simple plain text formatting system that'll help you make your sentences stand out. Here's how to do it! Just add a few characters before & after your desired text to change your text! I'll show you some examples...

Sweet Styles

Italics *italics* or _italics_

Underline italics __*underline italics*__

@fabiolimace
fabiolimace / System Design.md
Created February 22, 2022 03:32 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?