Skip to content

Instantly share code, notes, and snippets.

View jpdicosola's full-sized avatar

John-Patrick Di Cosola jpdicosola

View GitHub Profile
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active April 19, 2025 04:39
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%'
@coreyhaines
coreyhaines / .rspec
Last active August 15, 2024 15:13
Active Record Spec Helper - Loading just active record
--colour
-I app
@domgreen
domgreen / gist:961492
Created May 8, 2011 16:50
powershell commands
powershell Set-ExecutionPolicy RemoteSigned -Force
powershell -ExecutionPolicy Unrestricted .\CreateEventLog.ps1
mklink /D ".\WindowsPowershell" ".\My Dropbox\PowershellProfile"
# How to find out where a method comes from.
# Learned this from Dave Thomas while teaching Advanced Ruby Studio
# Makes the case for separating method definitions into
# modules, especially when enhancing built-in classes.
module Perpetrator
def crime
end
end
class Fixnum