Skip to content

Instantly share code, notes, and snippets.

with table_stats as (
select psut.relname,
psut.n_live_tup,
1.0 * psut.idx_scan / greatest(1, psut.seq_scan + psut.idx_scan) as index_use_ratio
from pg_stat_user_tables psut
order by psut.n_live_tup desc
),
table_io as (
select psiut.relname,
sum(psiut.heap_blks_read) as table_page_read,
@jscorales
jscorales / AddCookiesInterceptor.java
Created April 7, 2017 02:56 — forked from tsuharesu/AddCookiesInterceptor.java
Handle Cookies easily with Retrofit/OkHttp
/**
* This interceptor put all the Cookies in Preferences in the Request.
* Your implementation on how to get the Preferences MAY VARY.
* <p>
* Created by tsuharesu on 4/1/15.
*/
public class AddCookiesInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
@jscorales
jscorales / AddCookiesInterceptor.java
Created April 7, 2017 02:56 — forked from tsuharesu/AddCookiesInterceptor.java
Handle Cookies easily with Retrofit/OkHttp
/**
* This interceptor put all the Cookies in Preferences in the Request.
* Your implementation on how to get the Preferences MAY VARY.
* <p>
* Created by tsuharesu on 4/1/15.
*/
public class AddCookiesInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Hex Opacity Values
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
70% — B3
65% — A6
@jscorales
jscorales / gist:fc81dd593dfe369b39b60fda177e7992
Created September 10, 2016 02:16
Display Git Branch to Bash Prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
@jscorales
jscorales / happy_git_on_osx.md
Created November 10, 2015 15:02 — forked from trey/happy_git_on_osx.md
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@jscorales
jscorales / alloy.jmk
Created April 10, 2015 22:10
Use coffeescript in Titanium Alloy
task("pre:load", function(event,logger) {
var wrench = require("wrench"),
fs = require("fs"),
jade = require("jade"),
view_root = event.dir.views,
path = require("path"),
coffee = require("coffee-script");
event.alloyConfig.xml = [];
event.alloyConfig.coffee = [];