Skip to content

Instantly share code, notes, and snippets.

@virusdave
virusdave / chromebook-nix.sh
Last active June 2, 2019 03:42 — forked from puffnfresh/chromebook-nix.sh
Installation script for Nix on ChromeOS
#!/bin/sh
sudo mount -o remount,exec /tmp
# I was unable to get nix 2.2.2 to install successfully on my chromebook.
NIX_VER=2.1.3
NIX_ID=nix-${NIX_VER}-x86_64-linux
NIX_LOC=/usr/local/nixstrap
if [ -x ${NIX_LOC}/proot-x86_64 ] && [ -h ~/.nix-profile ]; then
@virusdave
virusdave / postgres_queries_and_commands.sql
Last active January 27, 2022 21:33 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- CHECK TIMINGS ON ACTIVE AND EXPENSIVE QUERIES
SELECT activity.*
FROM (
SELECT
pid,
CASE WHEN state = 'active' THEN AGE(clock_timestamp(), query_start)
ELSE AGE(state_change, query_start)
END as query_duration, -- This is how long the most recent query was running (or is running so far, if still active)
AGE(clock_timestamp(), xact_start) as xact_duration, -- Same, but for the currently active transaction
CASE WHEN state = 'active' THEN INTERVAL '0'