Skip to content

Instantly share code, notes, and snippets.

View dvliman's full-sized avatar

David Liman dvliman

View GitHub Profile
@dvliman
dvliman / README.md
Created July 31, 2016 22:57 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


Index:

@dvliman
dvliman / States-v3.md
Created July 30, 2016 18:08 — forked from andymatuschak/States-v3.md
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,

@dvliman
dvliman / redis_leaky_bucket.py
Created February 26, 2016 08:37 — forked from jdunck/redis_leaky_bucket.py
leaky bucket queue - redis 2.6 + lua + python
#cribbed from http://vimeo.com/52569901 (Twilio carrier call origination moderation)
# The idea is that many fan-in queues can enqueue at any rate, but
# dequeue needs to happen in a rate-controlled manner without allowing
# any individual input queue to starve other queues.
# http://en.wikipedia.org/wiki/Leaky_bucket (second sense, "This version is referred to here as the leaky bucket as a queue.")
#
# requires:
# redis 2.6+
# redis-py>=2.7.0
# anyjson
00:48:34 <'wpool_pool-devapi_connection_worker-1'> {devapi_router,
route_user_dir,
[{get_user,
"wMWGi39ZrWGVCTqJYe6Siyb1",
"2a731b46-ed7e-4b84-86b3-bcb8a497e184",
<<"57ca0933-b7f1-47f4-bf80-bf1d4483bf23">>},
{state}]}
00:48:35 <'wpool_pool-devapi_connection_worker-1'> devapi_router:route_user_dir/2 -> {ok,
[{full_view,
type Item struct {
Id int `json:"id" db:"id"`
Maker string `json:"maker" db:"maker"` // komatsu, hitachi; fixed
Model string `json:"model" db:"model"` // SK815; non unique
Serial string `json:"serial" db:"serial"` // 37BF00l74; unique
Kind string `json:"kind" db:"kind"` // forklift, loader, crane
Year int `json:"year" db:"year"` // 1988
Description string `json:"description" db:"description"`
@dvliman
dvliman / gist:73a0da5c90e2d940a792
Created October 7, 2015 18:17
unsent-count-flow
unsent_count(Config) ->
Org = proplists:get_value(org, Config),
ok = tt_devapi_test_utils:xmpp_call(tt_org_data, set_billing, [Org, "active"]),
ok = tt_devapi_test_utils:xmpp_call(tt_pubsub_data, publish_organization, [Org]),
User2 = proplists:get_value(token2, Config),
User3 = proplists:get_value(token3, Config),
Auth = {basic_auth, proplists:get_value(impersonate_auth, Config)},
https://www.groupon.com/deals/sea-stallion-scuba-outfitters-6
$189, http://www.seastallion.com/
21098 Bake Pkwy # 108, Lake Forest, CA 92630
two 4-hours classroom sessions, two 4-hour pool session
5 open water dives. certification upon passing exam
https://www.groupon.com/deals/beach-cities-scuba-centers-2
2 weekends. 1st: classrom session & wednesday night orientation
4 dives in open ocean from edge of boat / beach
$239 for a semiprivate PADI Open Water Diver certification course (a $575 value)
@dvliman
dvliman / persistent_pipes_linux.md
Last active September 9, 2015 23:50 — forked from CAFxX/persistent_pipes_linux.md
Persistent pipes/circular buffers for Linux

Persistent "pipes" in Linux

In a project I'm working on I ran into the requirement of having some sort of persistent FIFO buffer or pipe in Linux, i.e. something file-like that could accept writes from a process and persist it to disk until a second process reads (and acknowledges) it. The persistence should be both across process restarts as well as OS restarts.

AFAICT unfortunately in the Linux world such a primitive does not exist (named pipes/FIFOs do not persist

➜ personal2 dig http://www.starlite-creations.com/
; <<>> DiG 9.8.3-P1 <<>> http://www.starlite-creations.com/
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 30122
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;http://www.starlite-creations.com/. IN A
@dvliman
dvliman / validation.erl
Created August 3, 2015 19:15
functional approach in validation. erlang.
-module(validation_utils).
-export([validate_until_first_error/2]).
-export([validate_all_errors/2]).
-type validation_args() :: [term()].
-type validation_funs() :: [{function(), atom()}].
-spec validate_until_first_error(validation_args(), validation_funs()) -> ok | {error, atom()}.
% validate_until_first_error/2 applies list of validation_funs() to each element in args