Skip to content

Instantly share code, notes, and snippets.

Puppet::Functions.create_function(:file_eyaml_lookup_key) do
unless Puppet.features.hiera_eyaml?
raise Puppet::DataBinding::LookupError, 'Lookup using function '\
'file_eyaml_lookup_key is only supported when the hiera_eyaml '\
'library is present'
end
dispatch :file_eyaml_lookup_key do
param 'String[1]', :key
param 'Hash[String[1],Any]', :options
@antaflos
antaflos / unrarer.sh
Created May 21, 2019 23:18 — forked from RobertDeRose/unrarer.sh
Transmission unrar script to handle Sonarr from prematurely moving files
#!/bin/bash
# The script could use more tesing, but it works well for my needs
function extract_rar() {
isRar=$(ls | grep *.rar)
if [ -n "$isRar" ]; then
# Handle an edge case with some distributors
isPart01="$(ls *.rar | egrep -i 'part01.rar|part1.rar')"
if [ -n "$isPart01" ]; then
@antaflos
antaflos / unrarer.sh
Created June 11, 2019 23:05 — forked from fmoledina/unrarer.sh
Transmission unrar script to handle Sonarr from prematurely moving files
#!/bin/bash
# The script could use more testing, but it works well for my needs
extract_rar() {
isRar=$(ls ./*.rar)
if [ -n "$isRar" ]; then
# Handle an edge case with some distributors
isPart01="$(ls ./*rar | grep -E part0*1.rar)"
if [ -n "$isPart01" ]; then
isRar=$isPart01
@antaflos
antaflos / postgres_recovery.md
Created July 10, 2019 19:37 — forked from supix/postgres_recovery.md
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.