Skip to content

Instantly share code, notes, and snippets.

View dropbox.service.md

Install Dropbox and Python script. Symlink Python script to /usr/local/bin/dropbox and make it executable.

#/etc/systemd/system/dropbox.service

[Unit]
Description=Dropbox Service
After=network.target

[Service]
@gilyes
gilyes / Kill connections to postgres database
Created Jun 16, 2016
Kill connections to postgres database
View Kill connections to postgres database
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'TARGET_DB'
AND pid <> pg_backend_pid();
@gilyes
gilyes / Backup, restore postgres in docker container
Last active Aug 25, 2021
Backup/restore postgres in docker container
View Backup, restore postgres in docker container
Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Restore:
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres
@gilyes
gilyes / After kernel update, this may need to be run for docker to start working again
Last active Jun 17, 2021
After kernel update, this may need to be run for docker to start working again
View After kernel update, this may need to be run for docker to start working again
sudo apt-get install linux-image-extra-`uname -r` && sudo modprobe aufs