Skip to content

Instantly share code, notes, and snippets.

@rgmz
rgmz / 1_stripe-schema.md
Created February 5, 2025 04:18 — forked from FGRibreau/1_stripe-schema.md
Stripe database schema (extracted from their sigma product) as of 2019-10-09
jqn -r markdown-table 'map(x => "## " + x.name + "\n\n" + markdownTable(x.columns.map(y => [y.name, y.type]))  ) | join("\n\n")' < /tmp/stripe.json

accounts

id varchar
business_name varchar
business_url varchar
@rgmz
rgmz / idempotent.scala
Created February 11, 2022 18:18 — forked from somdoron/idempotent.scala
Idempotency Postgres
def lock(idempotencyKey: String) = {
// Producing 64bit key which is required for postgres advisory lock
val key1 = MurmurHash3.productHash(idempotencyKey))
val key2 = MurmurHash3.productHash(idempotencyKey, seed)
sql"""SELECT pg_advisory_xact_lock($key1, $key2)""".query[Unit].unique
}
def fetch[T](idempotencyKey: String) =
readonlyTransaction {
(sql"""SELECT result
@rgmz
rgmz / GitHub-Forking.md
Created March 24, 2020 17:14 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@rgmz
rgmz / 0. Synology RAID Expansion-Resync Performance.md
Created August 30, 2019 18:11 — forked from fbartho/0. Synology RAID Expansion-Resync Performance.md
Walkthrough of what I did to increase performance on my Synology NAS box during an expansion, and afterwards.

Performance on Synology RAIDs

(especially while expanding)

Warning: The exact commands may not match for your particular linux OS / Synology(NAS) device. I had to customize the commands after exploring my particular system's setup.

If you're new to linux, or this is a new piece of hardware / a new synology device, jump down to the section called "Inspecting a setup"

Contents