Skip to content

Instantly share code, notes, and snippets.

View dvliman's full-sized avatar

David Liman dvliman

View GitHub Profile
@dvliman
dvliman / kv.erl
Created October 22, 2017 17:34
erlang benchmark kv
% -*- coding: utf8 -*-
%% Benchmarking code samples.
%% Each benchmark is launched in it's own process to eliminate GC influence.
-module(benchmark).
-export([main/0]).
main() ->
% {Test name, TestFun1, TestFun2, Constructor}
% Constructor runtime isn't counted
user_token username user_email user_phone role_token stime etime
3dd92bb0-8b35-496d-b971-a2c0b9db4bc5 david [email protected] +17142532851 3dd92bb0-8b35-496d-b971-a2c0b9db4bc5 2017-09-19T20:55:38Z 2017-09-19T20:55:38Z
IPPUDO NYC Sale $85.00
RUSSIA HOUSE Sale $250.00
SLEEP NO MORE Sale $468.00
Founding Farmers DC Sale $95.00
PRESS LIQUORS Sale $80.01
DONBURI Sale $81.25
AIRBNB * HMREWFS8BW Sale $678.00 (do i have 2 airbnb accounts?)
@dvliman
dvliman / postgres_queries_and_commands.sql
Created September 6, 2017 00:12 — 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%'
curl "https://api.airtable.com/v0/appoAiBETQwaHoz04/creditcards?maxRecords=3&view=Grid%20view" \
-H "Authorization: Bearer keybVVN1Q7Zd7qvhE" | python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6700 100 6700 0 0 12175 0 --:--:-- --:--:-- --:--:-- 12181
{
"records": [
{
"createdTime": "2017-08-30T05:03:45.000Z",
"fields": {
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
This formula is keg-only, which means it was not symlinked into /usr/local.
@dvliman
dvliman / lmdb.tcl
Created April 30, 2017 19:48 — forked from antirez/lmdb.tcl
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <[email protected]>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@dvliman
dvliman / initial_calls.erl
Created March 25, 2017 00:54 — forked from rlipscombe/initial_calls.erl
Finding leaked processes in Erlang
lists:sort(fun({_, X}, {_, Y}) -> X > Y end,
dict:to_list(lists:foldl(
fun(Pid, Dict) ->
InitialCall = case erlang:process_info(Pid, initial_call) of
{initial_call,{proc_lib,init_p,A}} ->
case erlang:process_info(Pid, dictionary) of
{dictionary, D} -> proplists:get_value('$initial_call', D, undefined);
_ -> {proc_lib,init_p,A}
end;
{initial_call,{erlang,apply,A}} ->
@dvliman
dvliman / initial_calls.erl
Created March 25, 2017 00:54 — forked from rlipscombe/initial_calls.erl
Finding leaked processes in Erlang
lists:sort(fun({_, X}, {_, Y}) -> X > Y end,
dict:to_list(lists:foldl(
fun(Pid, Dict) ->
InitialCall = case erlang:process_info(Pid, initial_call) of
{initial_call,{proc_lib,init_p,A}} ->
case erlang:process_info(Pid, dictionary) of
{dictionary, D} -> proplists:get_value('$initial_call', D, undefined);
_ -> {proc_lib,init_p,A}
end;
{initial_call,{erlang,apply,A}} ->
@dvliman
dvliman / cassandra-notes
Created March 21, 2017 18:52
cassandra-notes
http://engblog.polyvore.com/2015/03/cassandra-compaction-and-tombstone.html
size tiered (need storage space, mixed read, update, delete workloads) vs.
level tiered compaction strategy (read heavy workloads, more resource intensive)
http://dbwrangler.blogspot.co.id/2012/10/cassandra-working-with-time-to-live-ttl.html
about ttl and compaction in cassandra with 3 nodes
http://www.sestevez.com/range-tombstones/
range tombstone