Skip to content

Instantly share code, notes, and snippets.

View emailrhoads's full-sized avatar

John Rhoads emailrhoads

View GitHub Profile
@emailrhoads
emailrhoads / Pry but for python.md
Created June 29, 2020 17:51
Python's binding.pry #python

import code; code.interact(local=dict(globals(), **locals()))

@emailrhoads
emailrhoads / symlink_em_all.sh
Last active June 7, 2022 19:51
[symlink all dl scripts] #linux
@emailrhoads
emailrhoads / row_counts.sql
Created June 2, 2020 21:43
[Row count for all tables] #postgres
SELECT
nspname AS schemaname,relname,reltuples
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE
nspname NOT IN ('pg_catalog', 'information_schema') AND
relkind='r'
ORDER BY reltuples DESC;
@emailrhoads
emailrhoads / Investigate SSL issues.md
Last active June 1, 2020 19:11
[Fix SSL issues] #linux
  1. Confirm some SSL cert is busted
domain_name = "fmsso.fanniemae.com"
uri = URI::HTTPS.build(host: domain_name)
response = Net::HTTP.start(uri.host, uri.port, { 
  :use_ssl => true, 
  # :verify_mode => OpenSSL::SSL::VERIFY_NONE,
})
cert = response.peer_cert
@emailrhoads
emailrhoads / remove_old_cluster_entirely.sh
Created April 29, 2020 21:19
[Fully remove old version] #postgres
sudo apt purge postgresql-12
@emailrhoads
emailrhoads / see_file_commit_history.sh
Created April 29, 2020 18:23
[See history of changes for a file] #git
git log -p -- Gemfile
@emailrhoads
emailrhoads / create_new_user_with_password.md
Last active June 4, 2020 19:43
[Create new user] #postgres
  1. sudo su - postgres
  2. createuser --interactive --pwprompt -p 5434 where 5434 is the port of your PG cluster
sudo su - postgres
psql
CREATE USER railsuser WITH PASSWORD 'railsuser' SUPERUSER CREATEDB;
@emailrhoads
emailrhoads / install_different_pg_versions.md
Last active April 28, 2020 15:09
[Install different PG versions] #postgres

Version 9.6: sudo apt-get install postgresql-9.6 postgresql-contrib

@emailrhoads
emailrhoads / branches_and_last_commit_date.sh
Created April 24, 2020 18:37
[see branches and last commit dates] #git
git for-each-ref --sort='-committerdate:iso8601' --format=' %(committerdate:iso8601)%09%(refname)' refs/heads
@emailrhoads
emailrhoads / list_pg_enums.sql
Created April 22, 2020 21:37
[List PG Enums] #postgres
select n.nspname as enum_schema,
t.typname as enum_name,
e.enumlabel as enum_value
from pg_type t
join pg_enum e on t.oid = e.enumtypid
join pg_catalog.pg_namespace n ON n.oid = t.typnamespace