Skip to content

Instantly share code, notes, and snippets.

@jorgearimitsu
jorgearimitsu / timeout_stack_trace.rb
Created October 31, 2022 21:31
GoodJob ActiveRecord::ConnectionTimeoutError
ActiveRecord::ConnectionTimeoutError: could not obtain a connection from the pool within 5.000 seconds (waited 5.559 seconds); all pooled connections were in use
File /usr/local/bundle/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:210 in block in wait_poll
File /usr/local/bundle/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:199 in loop
File /usr/local/bundle/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:199 in wait_poll
File /usr/local/bundle/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:160 in internal_poll
File /usr/local/bundle/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:286 in internal_poll
File /usr/local/bundle/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:155 in block in poll
File /usr/local/lib/ruby/3.1.0/monitor.rb:202 in synchronize
File
@jorgearimitsu
jorgearimitsu / rails6-type-map-query.sql
Created October 24, 2022 13:51
Type map query from rails 6.1.7
SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
FROM pg_type as t
LEFT JOIN pg_range as r ON oid = rngtypid
WHERE
t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'text', 'varchar', 'char', 'name', 'bpchar', 'bool', 'bit', 'varbit', 'timestamptz', 'date', 'money', 'bytea', 'point', 'hstore', 'json', 'jsonb', 'cidr', 'inet', 'uuid', 'xml', 'tsvector', 'macaddr', 'citext', 'ltree', 'line', 'lseg', 'box', 'path', 'polygon', 'circle', 'time', 'timestamp', 'numeric', 'interval')
OR t.typtype IN ('r', 'e', 'd')
OR t.typinput = 'array_in(cstring,oid,integer)'::regprocedure
OR t.typelem != 0
@jorgearimitsu
jorgearimitsu / rails7-type-map-query.sql
Last active November 14, 2022 15:41
Type map query form rails 7.0.4
SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
FROM pg_type as t
LEFT JOIN pg_range as r ON oid = rngtypid
WHERE
t.typelem IN (16, 17, 18, 19, 20, 21, 23, 25, 26, 114, 142, 600, 601, 602, 603, 604, 628, 700, 701, 718, 790, 829, 869, 650, 1042, 1043, 1082, 1083, 1114, 1184, 1186, 1560, 1562, 1700, 2950, 3614, 3802, 8454524, 8454532, 8454550, 8454564, 21687326, 8454602, 8454610, 8454628, 8454642, 21682156, 8464954, 8454680, 8454688, 8454706, 8454720, 21684526, 19100713, 8454758, 8454766, 8454784, 8454798, 21683276, 8464968, 8464978, 8454836, 8454844, 8454862, 8454876, 21681786, 21678766, 8454958, 19211951, 8454972, 8454982, 21688916, 75500986, 75500994, 75501006, 8468528, 18835662, 18835670, 18835688, 18835702, 21674846, 8455148, 8455156, 8455174, 8455188, 21681566, 8455226, 8455234, 8455252, 8455266, 21689546, 8455304, 8455312, 8455330, 8455344, 21683396, 8455374, 19112166, 8455388, 8455398, 21681656, 8455434, 8455442, 8455460, 8455474, 21686696, 846532
[alias]
ci = commit
pl = pull
ps = push
df = diff
st = status
br = branch
co = checkout
@jorgearimitsu
jorgearimitsu / .vimrc
Last active November 13, 2019 15:46
Vim config
" Color scheme
colo desert
" Syntax highlight
syntax on
" Show line number
set number
" Use spaces instead of tabs
@jorgearimitsu
jorgearimitsu / .bash_profile
Last active November 13, 2019 16:30
Bash Shell Config
# --- Prompt ---
export PS1='\[\033[38;5;45m\]\u\[$(tput sgr0)\]@\[\033[38;5;214m\]\h\[$(tput sgr0)\]:\[\033[38;5;250m\]\W\[$(tput sgr0)\]\[\033[0;32m\]$(parse_git_branch)\[$(tput sgr0)\] \$ '
# --- Functions ---
# git highlight branch
parse_git_dirty() {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "*"
}