Skip to content

Instantly share code, notes, and snippets.

View the4thdoctor's full-sized avatar

Federico Campoli the4thdoctor

View GitHub Profile
@NikolayS
NikolayS / pg_terminate_old.sql
Last active June 21, 2018 02:02
Terminate old Postgres sessions
-- This function terminates all Postgres sessions which state have been changed "age" minutes ago.
-- Usage example:
-- select * from flush_connections(60);
--
-- Or just (but result will be less readable):
-- select flush_connections(60);
--
-- By default, terminates only sessions with "state = 'idle'".
-- If needed, you can terminate ALL sessions, regardless of their states:
-- select * from flush_connections(60, true);
root@29f186d8a68f:/# python3 -m venv /pg_chameleon
root@29f186d8a68f:/# /pg_chameleon/bin/chameleon.py create_schema
Jun 18 02:24:21: [DEBUG] - mysql_lib.py (474): getting table metadata
Jun 18 02:24:21: [INFO] - mysql_lib.py (477): table copy limited to tables: dummy_user
Jun 18 02:24:21: [INFO] - pg_lib.py (583): Installing service schema base
root@29f186d8a68f:/# /pg_chameleon/bin/chameleon.py add_source --config default;
Jun 18 02:24:21: [DEBUG] - mysql_lib.py (474): getting table metadata
Jun 18 02:24:21: [INFO] - mysql_lib.py (477): table copy limited to tables: dummy_user
@thomasfr
thomasfr / backup.sh
Last active January 15, 2020 17:03
duplicity.backup Bash Script with Rollbar Notification
#!/bin/bash
export FTP_PASSWORD="123456"
FTP_USER="user"
FTP_HOST="user.your-backup.de"
BACKUP_TARGET="ftp://${FTP_USER}@${FTP_HOST}/$(hostname)"
DUPLICITY_LOGFILE="/var/log/duplicity.log"
DUPLICITY_TEMPDIR="/tmp/duplicity"
# Rollbar access token
ACCESS_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxx
@kra3
kra3 / eq.preset
Created March 26, 2014 12:11
Audacious presets: ~/.config/audacious/eq.preset
[Presets]
Preset0=Classical
Preset1=Club
Preset2=Dance
Preset3=Flat
Preset4=Live
Preset5=Laptop Speakers/Headphone
Preset6=Rock
Preset7=Pop