Skip to content

Instantly share code, notes, and snippets.


Troy Kruthoff troyk

View GitHub Profile
emiller / git-mv-with-history
Last active August 16, 2023 11:16
git utility to move/rename file or folder and retain history with it.
View git-mv-with-history
# git-mv-with-history -- move/rename file or folder, with history.
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
rgreenjr / postgres_queries_and_commands.sql
Last active September 22, 2023 09:13
Useful PostgreSQL Queries and Commands
View postgres_queries_and_commands.sql
-- 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%'
ericallam / gist:1019446
Created June 10, 2011 18:35
How to log all queries for a PostgreSQL homebrew install on OS X
View gist:1019446

Open the postgresql.conf config file:

$> mate /usr/local/var/postgres/postgresql.conf

Uncomment the line with 'log_destination' and set it to 'syslog'

log_destination = 'syslog'

Open the syslog config: