Skip to content

Instantly share code, notes, and snippets.

View keroro520's full-sized avatar
🏠
Working from home

Kero keroro520

🏠
Working from home
View GitHub Profile
(define a 1)
(+ (define a 2) b)
a
(define a 1)
(+ (define a 2) b)
a
在fsm里,有大致下面几种状态转移方式,大家在选择状态转移方式时会基于什么考虑? 谈谈经验,最近有点疑惑..
1. 借助于timeout
{:ok, state_name, state, 0}
2.
{:next_state, state_name, state}
3.
{:ok, state_name, state}
@keroro520
keroro520 / iterate_proposals_customers.exs
Last active November 28, 2017 07:53
How can I iterate two list of maps at once?
defmodule IterateProposalsCustomers do
def input do
proposals = [
%{customer_id: "5202845", other: "foo"},
%{customer_id: "9778978", other: "foo"}
]
customers = [
%{id: "5202845", name: "foo"},
%{id: "5643635", name: "bar"},
%{id: "9778978", name: "baz"},
@keroro520
keroro520 / riak.sh
Created August 28, 2018 08:53
riak
#!/bin/sh
# -*- tab-width:4;indent-tabs-mode:nil -*-
# ex: ts=4 sw=4 et
# installed by node_package (github.com/basho/node_package)
# Pull environment for this install
. "/usr/lib/riak/lib/env.sh"
@keroro520
keroro520 / executor.rs
Created October 18, 2018 10:12
executor
# 执行线程
stage = "idle"
LOOP {
CASE stage {
"idle" => state = stage_idle();
"executing_proposal" => state = stage_executing_proposal();
}
}
FUNCTION stage_executing_proposal() {
#!/usr/bin/env bash
# Set bash environment
set -e
if [[ `uname` == 'Darwin' ]]
then
SOURCE_DIR=$(realpath $(dirname $0)/../..)
SED="gsed"
else
SOURCE_DIR=$(readlink -f $(dirname $0)/../..)
#!/usr/bin/env bash
# Set bash environment
set -e
if [[ `uname` == 'Darwin' ]]
then
SOURCE_DIR=$(realpath $(dirname $0)/../..)
SED="gsed"
else
SOURCE_DIR=$(readlink -f $(dirname $0)/../..)
lock_arg,total_reward_in_shannons,mainnet_cake_reward
0x658236f8ef602ff80407402927e668b31dd04a34,2424335796838416,468922
0x95006587a511a885b8657733f1613485845e0652,1592004032844969,307930
0x1ae499a635cedae3f19e01d7bfce32863f2629e4,1075827268047660,208089
0xe7ed34e337b2451d16c38cda7a08bed5114c3512,885881155093363,171349
0x940be07c58aea04459506bcf9f456a34ceb12cda,811294887374977,156923
0x4a346517b678829dd6b64b797117e5c3dbe471c3,620929915010940,120102
0x36757473b212b6d82cdc14c68aa245f67e126ed5,525792056176432,101700
0x0001acc717d6424ee6efdd84e0c5befb8e44a89c,421903570813213,81605
0x6adbc02d964324f83bf715f3d2dc88322a8addcc,364773734959053,70555