Skip to content

Instantly share code, notes, and snippets.

View stultus's full-sized avatar
💭

Hrishi stultus

💭
View GitHub Profile
@stultus
stultus / imdb.md
Last active July 1, 2021 17:47
IMDB top 250
  • The Shawshank Redemption (1994)

  • The Godfather (1972)

  • The Godfather Part II (1974)

  • The Good the Bad and the Ugly (1966)

  • Pulp Fiction (1994)

@stultus
stultus / postgress_locks.txt
Created December 18, 2019 14:46
See postgress locks
SELECT t.relname, l.locktype, page, virtualtransaction, pid, mode, granted
FROM pg_locks l, pg_stat_all_tables t
WHERE l.relation = t.relid ORDER BY relation asc;
@stultus
stultus / largest_posgtgress_tables.txt
Last active December 17, 2019 10:31
select 10 most largest postgress tables
select schemaname as table_schema,
relname as table_name,
pg_size_pretty(pg_total_relation_size(relid)) as total_size,
pg_size_pretty(pg_relation_size(relid)) as data_size,
pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid))
as external_size
from pg_catalog.pg_statio_user_tables
order by pg_total_relation_size(relid) desc,
pg_relation_size(relid) desc
limit 10;
@stultus
stultus / blocking_sessions_postgress.txt
Created December 17, 2019 06:45
script to find the cause of blocked transactions.
SELECT
pl.pid as blocked_pid
,psa.usename as blocked_user
,pl2.pid as blocking_pid
,psa2.usename as blocking_user
,psa.query as blocked_statement
FROM pg_catalog.pg_locks pl
JOIN pg_catalog.pg_stat_activity psa
ON pl.pid = psa.pid
JOIN pg_catalog.pg_locks pl2
@stultus
stultus / postgress_maitenence.txt
Created December 17, 2019 06:30
Handle idle trasnactions in postgress
See transactions that are idle for 15 mins
-----------------------------------------
SELECT
pid,
now() - pg_stat_activity.query_start AS duration,
query,
state
FROM pg_stat_activity
WHERE (now() - pg_stat_activity.query_start) > interval '15 minutes';
rm -rf 246
rm -rf 426
rm -rf 858
rm -rf 1280
rm -rf 1920
mkdir 246
mkdir 426
mkdir 858
mkdir 1280
mkdir 1920
@stultus
stultus / Malayalam-InScript.kms
Created July 18, 2016 11:26 — forked from junaidpv/Malayalam-InScript.kms
Keymagic rules source code for InScript typing
/*
@NAME = "Malayalam InScript 5.0"
@DESCRIPTION = "Malayalam InScript Layout"
@TRACK_CAPSLOCK = "TRUE"
@EAT_ALL_UNUSED_KEYS = "FALSE"
@US_LAYOUT_BASED = "TRUE"
@Icon = "i.png"
*/
// author: Junaid (http://junaidpv.in)
// version: 0.1
# Video: http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html
Hi everyone, I'm Chris Wanstrath.
When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But
then I took a few moments and thought, Wait, why? Why me? What am I supposed
to say that's interesting? Something about Ruby, perhaps. Maybe the
future of it. The future of something, at least. That sounds
keynote-y.