Skip to content

Instantly share code, notes, and snippets.

@polymeris
polymeris / lisp.lua
Created September 15, 2015 15:10
Toy Lisp interpreter in Lua / LPEG
local lpeg = require'lpeg'
local P, R, S = lpeg.P, lpeg.R, lpeg.S --patterns
local C, Ct = lpeg.C, lpeg.Ct --capture
local V = lpeg.V --variable
local parser = P {
'program', -- initial rule
program = Ct(V'sexpr' ^ 0),
wspace = S' \n\r\t' ^ 0,
atom = V'boolean' + V'integer' + V'string' + V'symbol',
@Deraen
Deraen / 00_notes.md
Last active October 1, 2019 08:40
Compojure-api and Buddy
  • (:identity req) is auth backend independent way to access user data
  • login and logout implementation depends on auth backend
  • :current-user doesn't imply that authentication is required, route should also have :auth-rules if authentication is required
@lantiga
lantiga / archimedes-test.project.clj
Last active May 24, 2016 19:38
Working setup and sample Clojure code for Archimedes and Ogre (http://clojurewerkz.org/) on OrientDB 1.3 (http://orientdb.org/) via Blueprints (https://github.com/tinkerpop/blueprints/wiki).
(defproject archimedes-test "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[com.orientechnologies/orient-commons "1.3.0"]
[com.orientechnologies/orientdb-core "1.3.0"]
[com.tinkerpop.blueprints/blueprints-orient-graph "2.3.0"]
[clojurewerkz/ogre "2.3.0.1"]
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 22, 2024 23:19
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%'