Skip to content

Instantly share code, notes, and snippets.

@phan2410
phan2410 / patronitocnpg.md
Created July 16, 2025 09:52 — forked from aleksasiriski/patronitocnpg.md
Migrate Patroni PostgreSQL cluster to cloudnative-pg

Migrate Patroni PostgreSQL cluster to cloudnative-pg

Prerequisites

  • Stable connection to Patroni cluster from cnpg nodes
  • Same major PostgreSQL version (for example 15.1, cnpg image tag needs to correspond to that)
  • Empty files called custom.conf and override.conf inside pgdata folder on all nodes (folder where postgresql.conf is)
  • User named strictly streaming_replica with REPLICATION ROLE attached (if it's not streaming_replica cnpg will fail because it needs that user to exist)
  • Patroni dynamic config:
@phan2410
phan2410 / json.lua
Created March 26, 2024 09:22 — forked from tylerneylon/json.lua
Pure Lua json library.
--[[ json.lua
A compact pure-Lua JSON library.
The main functions are: json.stringify, json.parse.
## json.stringify:
This expects the following to be true of any tables being encoded:
* They only have string or number keys. Number keys must be represented as
strings in json; this is part of the json spec.
@phan2410
phan2410 / delete_git_submodule.md
Created August 3, 2023 06:47 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@phan2410
phan2410 / remove-nouveau.sh
Created June 18, 2023 13:32 — forked from sebastiaanfranken/remove-nouveau.sh
Removes the nouveau module/driver from Fedora 29+
#!/bin/bash
# Removes the xorg-x11-drv-nouveau package from this machine, because it's not needed
sudo dnf remove xorg-x11-drv-nouveau -y
# Blacklist the nouveau module as a module and in dracut
sudo echo 'blacklist nouveau' > /etc/modprobe.d/blacklist-nouveau.conf
sudo echo 'omit_drivers+=" nouveau "' > /etc/dracut.conf.d/blacklist-nouveau.conf
# Backup the current initramfs
------------------------------------
-- Script for Interactive Session --
------------------------------------
-- Have messages displayed in English
SET lc_messages TO 'en_US.UTF-8';
-- CREATE Employees -----------------------------------------------------------
@phan2410
phan2410 / notes-frequencies.json
Created September 11, 2021 11:08 — forked from i-Robi/notes-frequencies.json
Note-frequency values
{
"C0": 16.35,
"C#0": 17.32,
"Db0": 17.32,
"D0": 18.35,
"D#0": 19.45,
"Eb0": 19.45,
"E0": 20.60,
"F0": 21.83,
"F#0": 23.12,
@phan2410
phan2410 / pyRegExCheatSheet.rst
Last active April 19, 2021 07:41
pyRegExCheatSheet

Python Regular Expressions

Non-special chars match themselves. Exceptions are special characters:

\       Escape special char or start a sequence.
.       Match any char except newline, see re.DOTALL
^       Match start of the string, see re.MULTILINE
$       Match end of the string, see re.MULTILINE
[]      Enclose a set of matchable chars
@phan2410
phan2410 / HTML_Table_alt.html
Created December 29, 2020 02:39 — forked from damontallen/HTML_Table_alt.html
Less brittle HTML table converter of the quickref text.
<table border="1" cellpadding="3" cellspacing="0" style="border:1px solid black;border-collapse:collapse;">
<tr><td style="background-color:lightBlue;" colspan="2"; ><b>IPython -- An enhanced Interactive Python - Quick Reference Card</b></td></tr>
<tr><td colspan="2"; > </td></tr>
<tr><td style="border-bottom: 1px solid transparent;"> obj?, obj?? </td><td style="border-bottom: 1px solid transparent;"> Get help, or more help for object (also works as</tr>
<tr><td style="border-top: 1px solid transparent;"> </td><td style="border-top: 1px solid transparent;"> ?obj, ??obj).</tr>
<tr><td>?foo.*abc*</td><td> List names in 'foo' containing 'abc' in them.</td></tr>
<tr><td>%magic</td><td> Information about IPython's 'magic' % functions.</td></tr>
<tr><td colspan="2"; > </td></tr>
<tr><td colspan="2"; style="border-bottom: 1px solid transparent;">Magic functions are prefixed by % or %%, and typically take their arguments</td></tr>
<tr><td colspan="2"; style="border-top: 1px solid transparent; border-