Skip to content

Instantly share code, notes, and snippets.

@kiurtis
kiurtis / postgres_management_commands.sql
Last active February 25, 2021 12:11 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@kiurtis
kiurtis / gdrive_upload_folder_with_subfolders.py
Last active January 20, 2022 17:05 — forked from jmlrt/gdrive_upload_folder.py
Python script to upload folder to Google Drive
# -*- coding: utf-8 -*-
"""
Snippet based on pydrive allowing to upload full folders to Google Drive, replicating the same subfolders hierarchy.
Settings are set in the yaml files; don't forget to generate google api credentials and to put the client_secrets.json in the folder.
You should get first the id of the parent folder (the gdrive folder where you want to copy your folders), which is the
end of its url.
If the destination folder does not exist, it will be created.