Skip to content

Instantly share code, notes, and snippets.

View marschhuynh's full-sized avatar
🎯
Focusing

Marsch Huynh marschhuynh

🎯
Focusing
View GitHub Profile
#
#
#
# This example showcases usage of AsyncAPI for the purpose of describing a WebSocket API. It is based on a real public service maintained by company called Gemini that provides cryptocurency trading products. It uses AsyncAPI bindings.
#
# This AsyncAPI document describes their v1 of the API. The v2 is also available and changes in the way that it provides a multimessage channel, where you subscribe for messages by sending a subscription message instead of using query parameters. For example with multimessage channel check out this article https://www.asyncapi.com/blog/websocket-part2 about another real public API called Kraken
#
# All available learning materials about AsyncAPI and WebSocket are:
# - WebSocket, Shrek, and AsyncAPI - An Opinionated Intro article: https://www.asyncapi.com/blog/websocket-part1
# - Creating AsyncAPI for WebSocket API - Step by Step article: https://www.asyncapi.com/blog/websocket-part2
### Keybase proof
I hereby claim:
* I am marschhuynh on github.
* I am marschhuynh (https://keybase.io/marschhuynh) on keybase.
* I have a public key ASAURfaAvBgE6QZjHoRkr63Aop9b-W7w9u9juK-dd6tUrwo
To claim this, I am signing this object:
@marschhuynh
marschhuynh / fingerprint-setup
Last active September 12, 2022 06:25
Fingerprint setup for linux
You may try to use the work by @uunicorn (https://github.com/uunicorn/python-validity). It works for my Ubuntu 20.04.1.
$ sudo apt remove fprintd
$ sudo add-apt-repository ppa:uunicorn/open-fprintd
$ sudo apt-get update
$ sudo apt install open-fprintd fprintd-clients python3-validity
$ fprintd-enroll
If the last command prompt an error list_devices failed:, do
sudo systemctl status python3-validity
@marschhuynh
marschhuynh / machine.js
Created March 22, 2022 01:58
Generated by XState Viz: https://xstate.js.org/viz
const TRANSFER_DISPUTE = {
target: '#engagement.disputed',
actions: [assign((context, event, metaData) => {
return {
disputed_from_state: metaData && metaData.state.value,
disputed_by: event.disputed_by,
disputed_reason: event.disputed_reason
}
}),
assign({
@marschhuynh
marschhuynh / machine.js
Last active March 22, 2022 01:56
Generated by XState Viz: https://xstate.js.org/viz
const TRANSFER_DISPUTE = {
target: '#engagement.disputed',
actions: [assign((context, event, metaData) => {
return {
disputed_from_state: metaData && metaData.state.value,
disputed_by: event.disputed_by,
disputed_reason: event.disputed_reason
}
}),
assign({
@marschhuynh
marschhuynh / machine.js
Last active March 21, 2022 15:12
Generated by XState Viz: https://xstate.js.org/viz
const TRANSFER_REFUSE = {
target: '#engagement.cancelled',
actions: [assign((context, event, metaData) => {
const addition = context.buyer === event.cancelled_by
? { buyer_cancelled: true }
: { seller_cancelled: true }
return {
refuse_from_state: metaData && metaData.state.value,
cancelled_by: event.cancelled_by,
@marschhuynh
marschhuynh / machine.js
Last active January 4, 2022 16:41
Generated by XState Viz: https://xstate.js.org/viz
const TRANSFER_REFUSE = {
target: '#engagement.canceling',
cond: (context) => !context.buyer_cancelled && !context.seller_cancelled,
actions: [assign((context, event, metaData) => {
const addition = context.buyer === event.cancelled_by
? { buyer_cancelled: true }
: { seller_cancelled: true }
@marschhuynh
marschhuynh / machine.js
Last active July 26, 2021 17:18
Generated by XState Viz: https://xstate.js.org/viz
const depositAction = () => {}
const paymentMachine = Machine({
id: 'engagement',
initial: 'initial',
context: {
buyer: null,
seller: null,
buyer_confirmed: false,
seller_confirmed: false,
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions