Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View msassak's full-sized avatar

Mike Sassak msassak

View GitHub Profile
@msassak
msassak / postgres_queries_and_commands.sql
Created July 13, 2018 20:23 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), 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(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'

Keybase proof

I hereby claim:

  • I am msassak on github.
  • I am msassak (https://keybase.io/msassak) on keybase.
  • I have a public key ASAjH89ED49tJq0n3SVB4nLP0y08oTs2wQC-JDEtM8UfsQo

To claim this, I am signing this object:

@msassak
msassak / eunit_run.erl
Created April 8, 2014 17:10
eunit test runner script
#!/usr/bin/env escript
-define(dbg(X), io:format("DEBUG: ~p~n", [X])).
-record(args, {primitives = [],
patha = [],
pathz = [],
unrecognized = [],
verbose = false,
help = false}).
@msassak
msassak / demo.clj
Last active August 29, 2015 13:56
core.async demo
(ns demo
(:require [clojure.core.async :as a :refer [go
go-loop
chan
>!
<!
close]]))
(defn int-producer
"Return a channel containing the integers from 0 to n.
(deftest test-with-spy
(let [state (atom [])
spy (fn [& args] (swap! state into (vec args)))]
(with-redefs [foo.bar.ns/side-effecting-fn spy]
(fn-that-calls-side-effecting-fn :foo 1 {:whatever "hi"}))
(is (= [:foo 1 {:whatever "hi"}] @state))))
acc_func(Xs) ->
acc_func(Xs, []).
acc_func([], Acc) ->
lists:reverse(Acc);
acc_func([X|Xs], Acc) ->
acc_func(Xs, [X * 2|Acc]).
(defn acc-func [xs]
(loop [my-xs (seq xs) acc []]
This is a test
%% From "Why Functional Programming Matters" by John Hughes
-module(tree).
-include_lib("eunit/include/eunit.hrl").
-export([fold/4,
map/2]).
-type label() :: any().
-type tree() :: {label(), [tree()]}.
export PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[36m\]\w\[\033[00m\]$(__git_ps1 "(%s)") \$ '
# This:
respond_to do |format|
format.html do
# generate html
end
format.js do
# generate javascript
end
end