Skip to content

Instantly share code, notes, and snippets.

View gregdeane's full-sized avatar

Greg Deane gregdeane

  • Berlin, Germany
  • 07:59 (UTC +02:00)
View GitHub Profile
@gregdeane
gregdeane / postgres_queries_and_commands.sql
Created September 21, 2022 06:37 — 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%'
@gregdeane
gregdeane / .zshrc
Last active March 26, 2022 20:47 — forked from cjhowald/.zshrc
Zsh + oh my zsh config
# Path to your oh-my-zsh installation.
export ZSH=/Users/chowald/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion.
@gregdeane
gregdeane / ssh-known-hosts-mgmt.sh
Last active July 12, 2019 14:56 — forked from bradland/ssh-known-hosts-mgmt.sh
SSH known_hosts tools
# This is a short collection of tools that are useful for managing your
# known_hosts file. In this case, I'm using the '-f' flag to specify the
# global known_hosts file because I'll be adding many deploy users on this
# system. Simply omit the -f flag to operate on ~/.ssh/known_hosts
# Add entry for host
# ssh-keyscan -H github.com > /etc/ssh/ssh_known_hosts
ssh-keyscan -H github.com > ~/.ssh/known_hosts
# Scan known hosts
@gregdeane
gregdeane / bash-ps1.txt
Last active April 16, 2022 23:21
Customize BASH PS1 prompt to show current GIT repository and branch
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
__git_ps1 ()
{
local b="$(git symbolic-ref HEAD 2>/dev/null)";