Skip to content

Instantly share code, notes, and snippets.

@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 26, 2024 18:34
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%'
@tsuharesu
tsuharesu / AddCookiesInterceptor.java
Last active June 8, 2024 07:30
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 {
@TimVelo
TimVelo / MultiSelectViewModeHelper.java
Last active July 8, 2017 05:11
Fast Adapter Multi Select View Helper
package com.orangelinephotography.athenaeum.ui.actionMode;
import android.os.Bundle;
import com.mikepenz.fastadapter.FastAdapter;
import com.mikepenz.fastadapter.IItem;
/**
* Created by tvelo on 7/7/2017.
* based on extension from mikepenz; will PR for this to help others with non Action Mode views like