Skip to content

Instantly share code, notes, and snippets.

View msilvey's full-sized avatar

Matthew Silvey msilvey

View GitHub Profile
@msilvey
msilvey / postgres_queries_and_commands.sql
Created April 9, 2021 23:14 — 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%'
@msilvey
msilvey / gist:eb0fa1d92d17288226a0
Created December 9, 2015 22:23
Issue with Java Driver and Netty
java.lang.RuntimeException: Error calling eventfd_write(...): Bad file descriptor
at io.netty.channel.epoll.Native.eventFdWrite(Native Method)
at io.netty.channel.epoll.EpollEventLoop.wakeup(EpollEventLoop.java:119)
at io.netty.util.concurrent.SingleThreadEventExecutor.shutdownGracefully(SingleThreadEventExecutor.java:561)
at io.netty.util.concurrent.MultithreadEventExecutorGroup.shutdownGracefully(MultithreadEventExecutorGroup.java:146)
at com.datastax.driver.core.NettyOptions.onClusterClose(NettyOptions.java:200)
at com.datastax.driver.core.Connection$Factory.shutdown(Connection.java:825)
at com.datastax.driver.core.Cluster$Manager$ClusterCloseFuture$1.run(Cluster.java:2303)
@msilvey
msilvey / pruneStagingDirs.sh
Created July 12, 2013 19:03
A loop to remove old staging dirs. This is a part of the workaround for a bug tracked here: https://issues.apache.org/jira/browse/MAPREDUCE-5351
#!/bin/bash
NOW=`date +%s`
SIXHOURSAGO=`echo "$NOW - 21600" |bc`
HADOOPBIN="/usr/bin/hadoop"
IFS=$'\n'
for i in `$HADOOPBIN fs -ls /user/root/.staging/`; do
IFS=' '
JOBDATE=`echo $i|awk '{print $6" "$7}'`