Skip to content

Instantly share code, notes, and snippets.

@forgotpw1
forgotpw1 / gist:3103083
Created July 13, 2012 06:19
How many git commits have project contributors made
git shortlog -s -n
@forgotpw1
forgotpw1 / gist:7439518
Created November 12, 2013 21:57
Edit text in browser tab
data:text/html, <html contenteditable>
@forgotpw1
forgotpw1 / gist:2a55be5678a27001dac9
Last active August 29, 2015 14:09
Authorize.net Test Credit Card Numbers
For your reference, you can use the following test credit card numbers when testing your connection. The expiration date must be set to the present date or later:
- American Express Test Card: 370000000000002
- Discover Test Card: 6011000000000012
- Visa Test Card: 4007000000027
- Second Visa Test Card: 4012888818888
- MasterCard: 5555555555554444
- JCB: 3088000000000017
- Diners Club/ Carte Blanche: 38000000000006
(sudo -u postgres pg_ctl stop -D /usr/local/pgsql/data -m i -t 5 || true) && sudo stop postgresql
# start again with
sudo start postgresql
@forgotpw1
forgotpw1 / gist:9d6f0609f3cc44788d3e
Last active August 29, 2015 14:18
Terminate postgres connections for aborted processes.
SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE datname = 'DB'
AND pid <> pg_backend_pid()
AND state = 'idle in transaction (aborted)'
AND state_change < current_timestamp - INTERVAL '5' MINUTE
@forgotpw1
forgotpw1 / gist:67398debfa82bb0f820c
Last active August 29, 2015 14:18
Causes for hanging database transactions - Durascope

Any situation which causes a Context object to go out of scope (which can happen if additional context objects are created in the course of the processing) can leave a hanging transaction.

@forgotpw1
forgotpw1 / gist:4c2792a0c878d41c32ba
Last active August 29, 2015 14:18
Find out which database tables are locked
SELECT relation, transaction, pid, mode, granted, relname
FROM pg_locks
INNER JOIN pg_stat_user_tables
ON pg_locks.relation = pg_stat_user_tables.relid
WHERE pg_locks.pid='pid';
@forgotpw1
forgotpw1 / gist:2b73f61daadc5c66061d
Created April 17, 2015 19:53
Example ShopSense SKU
{:size=>nil, :size_id=>nil, :color=>"FUCHSIA", :color_id=>5639, :vendor_color_id=>1, :sku=>{"color_id"=>1, "no_returns"=>{"enabled"=>false, "message"=>""}, "price"=>{"alternate_copy"=>"", "list_price"=>"&#36;295.00", "list_price_label"=>"Was", "on_sale"=>true, "sale_price"=>"&#36;118.00", "sale_price_label"=>"Now"}, "size_id"=>-1, "sku_id"=>"1689949379079855", "status_alias"=>"waitlist", "status_label"=>"Sold Out > Add to Wait List", "status_message"=>"", "upc"=>"888246184384"}}
@forgotpw1
forgotpw1 / gist:c90178145a3cfbb13b7d
Created June 3, 2015 22:46
Find where disk space clutter accumulates on ubuntu
sudo ncdu /
@forgotpw1
forgotpw1 / gist:dc45e9588b6c95c0bdb9
Created October 24, 2015 20:11
Reference different versions of postgresql installed
psql --cluster 9.1/main --version