Skip to content

Instantly share code, notes, and snippets.

View mizhka's full-sized avatar

Michael Zhilin mizhka

  • PostgresPro
  • Moscow
View GitHub Profile
@hideshi
hideshi / sqlite3.awk
Created December 28, 2013 11:43
How to use SQLite3 in Awk.
#!/usr/bin/awk -f
BEGIN {
db = "test.db"
command = "sqlite3 -noheader -separator \" \" " db " \" %s \""
create_table = "create table employee (id, name, age)"
insert1 = "insert into employee values (1, 'taro', 20)"
insert2 = "insert into employee values (2, 'hanako', 18)"
insert3 = "insert into employee values (3, 'ichiro', 26)"
select = "select * from employee order by age"
drop_table = "drop table employee"
@supix
supix / postgres_recovery.md
Last active June 6, 2024 18:46
Postgres error: Missing chunk 0 for toast value in pg_toast

The problem

In some cases, it is possible that PostgreSQL tables get corrupted. This can happen in case of hardware failures (e.g. hard disk drives with write-back cache enabled, RAID controllers with faulty/worn out battery backup, etc.), as clearly reported in this wiki page. Furthermore, it can happen in case of incorrect setup, as well.

One of the symptoms of such corruptions is the following message:

ERROR: missing chunk number 0 for toast value 123456 in pg_toast_45678

This almost surely indicates that a corrupted chunk is present within a table file. But there is a good way to get rid of it.

# Configuration for Alacritty, the GPU enhanced terminal emulator
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty it self.
env:
# TERM env customization.
#
# If this property is not set, alacritty will set it to xterm-256color.
#
@probonopd
probonopd / Wayland.md
Last active July 3, 2024 18:20
Think twice about Wayland. It breaks everything!

Think twice before abandoning Xorg. Wayland breaks everything!

Hence, if you are interested in existing applications to "just work" without the need for adjustments, then you may be better off avoiding Wayland.

Wayland solves no issues I have but breaks almost everything I need. Even the most basic, most simple things (like xkill) - in this case with no obvious replacement. And usually it stays broken, because the Wayland folks mostly seem to care about Automotive, Gnome, maybe KDE - and alienating everyone else (e.g., people using just an X11 window manager or something like GNUstep) in the process.

The Wayland project seems to operate like they were starting a greenfield project, whereas at the same time they try to position Wayland as "the X11 successor", which would clearly require a lot of thought about not breaking, or at least providing a smooth upgrade path for, existing software.

In fact, it is merely an incompatible alternative, and not e

@sts10
sts10 / rust-command-line-utilities.markdown
Last active July 3, 2024 18:29
A curated list of command-line utilities written in Rust

A curated list of command-line utilities written in Rust

Note: I have moved this list to a proper repository. I'll leave this gist up, but it won't be updated. To submit an idea, open a PR on the repo.

Note that I have not tried all of these personally, and cannot and do not vouch for all of the tools listed here. In most cases, the descriptions here are copied directly from their code repos. Some may have been abandoned. Investigate before installing/using.

The ones I use regularly include: bat, dust, fd, fend, hyperfine, miniserve, ripgrep, just, cargo-audit and cargo-wipe.

  • atuin: "Magical shell history"
  • bandwhich: Terminal bandwidth utilization tool