Skip to content

Instantly share code, notes, and snippets.

@steveruizok
steveruizok / isUserSponsoringMe.ts
Created June 20, 2021 17:38
Use the GitHub API to check whether a given user is sponsoring you.
/**
* A function that will return whether the given user is sponsoring you.
* Requires a personal access token from GitHub.
* See https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token
*
* @param userA The sponsoring user.
*/
async function isUserSponsoringMe(username: string) {
const res = await fetch('https://api.github.com/graphql', {
method: 'POST',
@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.