Skip to content

Instantly share code, notes, and snippets.

View john-evangelist's full-sized avatar

Evangelista john-evangelist

View GitHub Profile
@john-evangelist
john-evangelist / Adb-PullAppData.ps1
Created February 27, 2024 23:55 — forked from chriskyfung/Adb-PullAppData.ps1
A PowerShell script interactively guides you pull app data from (/sdcard/Android/data/) to your local machine via Android Debug Bridge (adb)
<#
.SYNOPSIS
Pull Android App data from the internal storage of
a device via Android Debug Bridge (adb).
.DESCRIPTION
The Adb-PullAppData.ps1 script uses interavtive prompts to guide you pull app data
from (/sdcard/Android/data/$APPNAME) to the local machine.
@john-evangelist
john-evangelist / composing-software.md
Created April 7, 2021 21:23 — forked from Geoff-Ford/composing-software.md
Eric Elliott's Composing Software Series

Eric Elliott's "Composing Software" Series

A collection of links to the excellent "Composing Software" series of medium stories by Eric Elliott.

Edit: I see that each post in the series now has index, previous and next links. However, they don't follow a linear flow through all the articles with some pointing back to previous posts effectively locking you in a loop.

@john-evangelist
john-evangelist / EventMachines.md
Created January 14, 2020 14:38 — forked from eulerfx/EventMachines.md
The relationship between state machines and event sourcing

A state machine is defined as follows:

  • Input - a set of inputs
  • Output - a set of outputs
  • State - a set of states
  • S0 ∈ S - an initial state
  • T : Input * State -> Output * State - a transition function

If you model your services (aggregates, projections, process managers, sagas, whatever) as state machines, one issue to address is management of State. There must be a mechanism to provide State to the state machine, and to persist resulting State for subsequent retrieval. One way to address this is by storing State is a key-value store. Another way is to use a SQL database. Yet another way is event sourcing. The benefit of even sourcing is that you never need to store State itself. Instead, you rely on the Output of a service to reconstitute state. In order to do that, the state machine transition function needs to be factored into two functions as follows:

@john-evangelist
john-evangelist / akka_http_and_cats_validation.md
Created June 30, 2019 04:18 — forked from melvic-ybanez/akka_http_and_cats_validation.md
Request Validation with Akka-HTTP and Cats

Request Validation with Akka-HTTP and Cats

Greg Beech wrote an article on Akka HTTP Entity Validation. This post is on the same topic, except we are going to use typeclass instances, as opposed to subtyping, for form validations.

Sample Problem: User Regsitration

To start with, let us suppose that we are working on some sort of user management service using Scala/Akka. However, here we are only going to focus on the registration part, in which the client is expected to send a user data, in JSON format; and the server needs to validate them, and save the user if the validations succeed, or reject the request with all the errors detected. That said, we should keep in mind that our validations may be used through out the entire codebase, not just in the user registration endpoint.

The rules for our validation are as follows:

@john-evangelist
john-evangelist / akka_http_and_cats_validation.md
Created June 30, 2019 04:18 — forked from melvic-ybanez/akka_http_and_cats_validation.md
Request Validation with Akka-HTTP and Cats

Request Validation with Akka-HTTP and Cats

Greg Beech wrote an article on Akka HTTP Entity Validation. This post is on the same topic, except we are going to use typeclass instances, as opposed to subtyping, for form validations.

Sample Problem: User Regsitration

To start with, let us suppose that we are working on some sort of user management service using Scala/Akka. However, here we are only going to focus on the registration part, in which the client is expected to send a user data, in JSON format; and the server needs to validate them, and save the user if the validations succeed, or reject the request with all the errors detected. That said, we should keep in mind that our validations may be used through out the entire codebase, not just in the user registration endpoint.

The rules for our validation are as follows:

@john-evangelist
john-evangelist / gist:da2a7a613e62f3f4372b5590d6a4485f
Created June 1, 2019 04:30 — forked from pbailis/gist:5660980
Assorted distributed database readings

Context: I was asked for a list of interesting reading relating to "distributed databases, behavior under partitions and failures, failure detection." Here's what I came up with in about an hour.

For textbooks, "Introduction to Reliable and Secure Distributed Programming" is a superb introduction to distributed computing from a formal perspective; it's really not about "programming" or "engineering" but about distributed system fundamentals like consensus, distributed registers, and broadcast. Used in Berkeley's Distributed Computing course (and HT to @lalithsuresh) Book Site

Notes from courses like Lorenzo Alvisi's Distributed Computing class can be great.

There are a bunch of classics on causality, [Paxos](ht

@john-evangelist
john-evangelist / pure-impure.md
Last active February 25, 2019 19:17 — forked from tomekowal/pure-impure.md
Pure vs impure

Pure vs impure and why should I care?

Some of the most important advancements in programming came from adding restrictions to the way we program. Famous article by Edsger Dijkstra Go To Statement Considered Harmful shows how introducing one statement into programming language breaks many nice properties of that language. goto gives us freedom and solves couple of simple problems like breaking from nested loops easily, but it can make programs very hard to understand. This happens, because we cannot look at two pieces of code in separation. The execution can jump to some other place in code or even worse: it can jump from other piece of code to here and We need to keep that in mind.

import akka.actor.ActorRef;
import akka.dispatch.*;
import org.jctools.queues.MpscArrayQueue;
/**
* Non-blocking, multiple producer, single consumer high performance bounded message queue,
* this implementation is similar but simpler than LMAX disruptor.
*/
public final class MpscBoundedMailbox implements MessageQueue {
@john-evangelist
john-evangelist / observer.md
Created October 24, 2018 03:18 — forked from pnc/observer.md
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host