Skip to content

Instantly share code, notes, and snippets.

@truemogician
truemogician / upgrading_postgresql_in_windows.md
Last active May 28, 2025 14:45
Upgrading PostgreSQL in Windows

Upgrading PostgreSQL in Windows

The official documentation for PostgreSQL provides a guide to upgrading using pg_upgrade. However, it can be a bit like a treasure hunt with hidden traps. This gist will walk you through a clear and robust method for upgrading PostgreSQL on Windows, using the upgrade from version 14 to 16 as an example.

1. Install the New Version of PostgreSQL

Before you embark on the upgrade journey, make sure you have the new version installed. This is because the pg_upgrade utility used during the upgrade process belongs to the newer version.

To get started, visit the official download page, download the installer, and run it. A word of caution: do not overwrite the old installation, as you'll need its binaries and data for the upgrade.

{
"$id": "https://json-schema.org/draft/2020-12/schema",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Core and Validation specifications meta-schema",
"$dynamicAnchor": "meta",
"allOf": [
{
"$ref": "meta/core"
},
{
@gaearon
gaearon / uselayouteffect-ssr.md
Last active May 2, 2025 03:01
useLayoutEffect and server rendering

If you use server rendering, keep in mind that neither useLayoutEffect nor useEffect can run until the JavaScript is downloaded.

You might see a warning if you try to useLayoutEffect on the server. Here's two common ways to fix it.

Option 1: Convert to useEffect

If this effect isn't important for first render (i.e. if the UI still looks valid before it runs), then useEffect instead.

function MyComponent() {
@iPublicis
iPublicis / myapp-node-watcher.path
Last active October 31, 2024 12:55
NODE.JS app as a systemd service with CI controller
#########
# File: myapp-node-watcher.path
#
# Save this to /etc/systemd/system/
# Run systemctl enable myapp-node-watcher.path && systemctl daemon-reload && systemctl start myapp-node-watcher.path
#
[Path]
PathModified=/home/myuser/myappdir/public_html
[Install]
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active June 23, 2025 16:29
Conventional Commits Cheatsheet
@mraaroncruz
mraaroncruz / steps.md
Last active May 16, 2025 16:40
Get the Telegram channel ID

To get the channel id

  1. Create your bot with botfather
  2. Make you bot an admin of your channel

Simplest way (via @anhtuank7c)

Go to Telegram web and open a channel, get the ID from -[channel id] from hash in the path

https://web.telegram.org/k/#-9999999999999

@nikhita
nikhita / update-golang.md
Last active June 7, 2025 02:17
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

'use strict';
class Abstract {
// A static abstract method.
static foo() {
if (this === Abstract) {
// Error Type 2. Abstract methods can not be called directly.
throw new TypeError("Can not call static abstract method foo.");
} else if (this.foo === Abstract.foo) {
// Error Type 3. The child has not implemented this method.
throw new TypeError("Please implement static abstract method foo.");
PASS src/isomorphic/classic/__tests__/ReactContextValidator-test.js
src/renderers/shared/shared/shouldUpdateReactComponent.js:26
Strict equal of different types: {"key":null,"ref":nu... (object) === false (boolean)
Strict equal of different types: [object Object] (object) === false (boolean)
src/renderers/shared/shared/shouldUpdateReactComponent.js:27
Strict equal of different types: {"key":null,"ref":nu... (object) === false (boolean)
Strict equal of different types: [object Object] (object) === false (boolean)
src/renderers/shared/stack/reconciler/ReactCompositeComponent.js:1258
@Ciantic
Ciantic / dirname-filename-basename.bat
Created April 1, 2016 15:11
How to get filename, dirname, and basename in bat?
set filepath="C:\some path\having spaces.txt"
for /F "delims=" %%i in (%filepath%) do set dirname="%%~dpi"
for /F "delims=" %%i in (%filepath%) do set filename="%%~nxi"
for /F "delims=" %%i in (%filepath%) do set basename="%%~ni"
echo %dirname%
echo %filename%
echo %basename%