Skip to content

Instantly share code, notes, and snippets.

View thecatontheflat's full-sized avatar
🇺🇦

Vitalii Zurian thecatontheflat

🇺🇦
View GitHub Profile

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@thecatontheflat
thecatontheflat / nginxproxy.md
Created May 19, 2016 08:14 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@thecatontheflat
thecatontheflat / .docker-private-registry-with-read-write-control.md
Created June 10, 2019 15:19
Run docker private registry with read/write access control
12:36:43 2691498 INFO Running pgcopydb version 0.11-1.pgdg22.04+1 from "/usr/bin/pgcopydb"
12:36:43 2691498 INFO cli_common.c:891 Using default origin node name "pgcopydb"
12:36:43 2691498 INFO cli_common.c:897 Using default logical replication output plugin "test_decoding"
12:36:43 2691498 INFO cli_common.c:970 [SOURCE] Copying database from "postgres://@localhost:11338/_source_db?"
12:36:43 2691498 INFO cli_common.c:971 [TARGET] Copying database into "postgres://@localhost:11338/_target_db?"
12:36:43 2691498 DEBUG cli_common.c:975 Using pg_dump for Postgres "15.2" at "/usr/bin/pg_dump"
12:36:43 2691498 DEBUG cli_common.c:979 Using pg_restore for Postgres "15.2" at "/usr/bin/pg_restore"
12:36:43 2691498 DEBUG copydb.c:524 Change Data Capture data is managed at "/var/lib/postgresql/.local/share/pgcopydb"
12:36:43 2691498 NOTICE copydb.c:87 Using work dir "/tmp/pgcopydb"
12:36:43 2691498 NOTICE copydb.c:359 Work directory "/tmp/pgcopydb" already exists
Custom Scan (Citus Adaptive) (cost=0.00..0.00 rows=100000 width=16) (actual time=343.932..343.952 rows=267 loops=1)
Output: remote_scan.id
Task Count: 192
Tuple data received from nodes: 4272 bytes
Tasks Shown: One of 192
-> Task
" Query: SELECT g.id FROM ((public.game_103983 g JOIN public.game_map_238328 gm ON ((gm.id OPERATOR(pg_catalog.=) g.game_map_id))) JOIN public.game_player_173679 gp ON ((gp.game_id OPERATOR(pg_catalog.=) g.id))) WHERE ((gp.s64_id OPERATOR(pg_catalog.=) '76561197969209908'::bigint) AND (gp.game_finished_at OPERATOR(pg_catalog.>=) '2019-06-18 11:11:22'::timestamp without time zone) AND (gp.game_finished_at OPERATOR(pg_catalog.<=) '2023-05-01 17:08:44'::timestamp without time zone) AND (g.status OPERATOR(pg_catalog.=) 'ready'::public.game_status_enum))"
Tuple data received from node: 48 bytes
Node: host=192.168.109.4 port=11338 dbname=leetify_sharded
-> Nested Loop (cost=1.11..56.92 rows=10 width=16) (actual time=0.078..0.328 rows=3 loops=1)
const { Client } = require('pg');
const losslessJson = require('lossless-json');
const SLOT_NAME = process.env.SLOT_NAME;
const SCHEMA_NAME = 'public';
const SHARDS_MAPPING = {};
async function processInsert(targetClient, change, tableName) {