Skip to content

Instantly share code, notes, and snippets.

@x-yuri
x-yuri / 0001-Fix-line-breaks.patch
Created December 27, 2014 17:26
vagrant-1.7 patch (line breaks issue)
From 9d1834a3c98fcc5f413878bb1f3acd055b6fe90e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dou=C3=A9zan-Grard=20Guillaume?=
<silverwyrda@users.noreply.github.com>
Date: Sat, 13 Dec 2014 21:08:31 +0100
Subject: [PATCH] Fix line breaks
---
plugins/guests/arch/cap/configure_networks.rb | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
From 766623b7fe37d4de59ca02f7e58b5658724ab751 Mon Sep 17 00:00:00 2001
From: Mike <themike@libero.it>
Date: Thu, 30 Oct 2014 22:01:14 +0100
Subject: [PATCH] Add Nokia Lumia 630 device identifiers
---
src/music-players.h | 2 ++
1 file modificato, 2 inserzioni(+)
diff --git a/src/music-players.h b/src/music-players.h
@x-yuri
x-yuri / gist:0cfd472ca68505c8cf5ebd90841127bf
Last active August 23, 2018 14:42
ERROR: aggregate functions are not allowed in GROUP BY
$ psql db -c "select char_length(string_agg(legacy_id, ', ')) from products group by 1"
ERROR: aggregate functions are not allowed in GROUP BY
LINE 1: select char_length(string_agg(legacy_id, ', ')) from products...
^
$ psql db -c "select char_length(string_agg(legacy_id, ', ')) from products group by TRUE"
char_length
-------------
15666
(1 row)
@x-yuri
x-yuri / README.md
Created November 7, 2018 09:25
A script that let's you do partial PITR with Barman http://docs.pgbarman.org/release/2.5/#scope

Note. Test before putting to use.

With this script you don't set retention_policy in Barman's config, but run barman-clean-backups.sh periodically.

This script keeps files needed to restore to any point in time within the range of last x backups (--n-keep), plus y points in time before that (--n-keep-standalone).

@x-yuri
x-yuri / barman-clean.sh
Last active January 18, 2021 16:40
Barman scripts #pg #barman
#!/usr/bin/env bash
set -eu
. ~/lib/barman.sh
eval set -- "$(
getopt -o h --long n-base-backups:,n-standalone-base-backups:,dry-run,help \
-n "$(basename -- "$0")" -- "$@"
)"
p_n_base_backups=
p_n_standalone_base_backups=
@x-yuri
x-yuri / 1.py
Created January 6, 2019 17:37
python: substituting class
class A:
qux = 'A'
def __init__(self, name):
self.name = name
def foo(self):
print('foo')
class B:
qux = 'B'
def bar(self):
@x-yuri
x-yuri / description.md
Last active October 17, 2022 19:04
exim: verify HELO hostname

To verify you can send a test email to port25's authentication checker:

echo test email | exim check-auth@verifier.port25.com  # replies back
echo test email | exim check-auth2@verifier.port25.com  # replies back
echo test email | exim check-auth-jsmith=yourdomain.com@verifier.port25.com  \
    # replies to jsmith@yourdomain.com

In the recieved report there'll be a line:

Using traefik in a Docker Swarm

Deprecated. See Starting traefik.

docker-traefik.yml

version: '3'
@x-yuri
x-yuri / 1.md
Created June 29, 2019 12:52
debug iptables rules

rules.txt:

*security
-A INPUT -p icmp -j LOG --log-prefix "*** IPTABLES (sec/IN): "
-A FORWARD -p icmp -j LOG --log-prefix "*** IPTABLES (sec/FORW): "
-A OUTPUT -p icmp -j LOG --log-prefix "*** IPTABLES (sec/OUT): "
COMMIT

*mangle
@x-yuri
x-yuri / reset-iptables.sh
Last active September 5, 2023 12:26
Reset iptables
#!/usr/bin/env bash
set -eu
declare -A chains=(
[filter]=INPUT:FORWARD:OUTPUT
[raw]=PREROUTING:OUTPUT
[mangle]=PREROUTING:INPUT:FORWARD:OUTPUT:POSTROUTING
[security]=INPUT:FORWARD:OUTPUT
[nat]=PREROUTING:INPUT:OUTPUT:POSTROUTING
)
for table in "${!chains[@]}"; do