| account_id {String} | nonce {Integer} | updates {Integer} | balance {Integer} | previous {Integer} | Description {String} |
|---|---|---|---|---|---|
| 0000001 | 0 | 0 | 0 | 0 | Initialization |
| 0000001 | 1 | 10 | 10 | 0 | Deposit from .... |
- UNIQUE(AccountId, Nonce) prevent double spending
| require File.expand_path('../linear_equation', __FILE__) | |
| le = LinearEquation.new do | |
| x - 2.y + z = 9 | |
| 2.x - y = 4 | |
| y + z = 12 | |
| end | |
| puts(le.solution) |
| class LinearEquation | |
| attr_reader(:eq) | |
| extend Memoist | |
| def initialize(&eq) | |
| raise ArgumentError, "equation must be passed" unless block_given? | |
| @eq = eq | |
| end | |
| def raw_equations |
| # x - 2.y + z = 9 | |
| # 2.x - y = 4 | |
| # y + z = 12 | |
| [x] [1, -2, 1] [9] | |
| [y] * [2, -1, 0] = [4] | |
| [z] [0, 1, 1] [12] | |
| # if we want to find out the x, y, and z, we can just |
| const FundData = require('./FundData'); | |
| class FundBalancer { | |
| constructor(){ | |
| this.state = { data: [] } | |
| }; | |
| insert({ owner, current, expected }){ | |
| const fd = new FundData({ owner, current, expected }); | |
| this.data().push(fd); | |
| } |
| import { Readable, Transform, Writable } from 'stream'; | |
| export type Callback = (error: Error | null | undefined) => void; | |
| export type TCallback = (error?: Error | undefined ) => void; | |
| export abstract class GReadable<T1> extends Readable { | |
| constructor(props: any = {}){ | |
| super({ ...props, objectMode: true }); | |
| }; | |
| _read(){} |
| import Axios, { AxiosInstance } from 'axios'; | |
| abstract class BaseRequest { | |
| abstract request(): AxiosInstance; | |
| } | |
| class Host1 extends BaseRequest { | |
| request(): AxiosInstance { throw new Error('not implemented'); } | |
| // todo | |
| buyProduct() { |
| class MySet<T> extends Set<T> { | |
| static of<T>(...xs: T[]): MySet<T> { | |
| return new this<T>(xs); | |
| } | |
| intersect(other: MySet<T>): MySet<T> { | |
| const result = new MySet<T>(); | |
| for (const entry of this.values()) { | |
| if (other.has(entry)) { result.add(entry); } | |
| } |
| interface IGuess { | |
| word: string; | |
| score: string; | |
| }; | |
| const A = 'a'.charCodeAt(0); | |
| export class Wordle { | |
| /** | |
| * 0 = possible | |
| * 1 = impossible |
| sudo tee /etc/yum.repos.d/mongodb-org-5.0.repo << EOF | |
| [mongodb-org-5.0] | |
| name=MongoDB Repository | |
| baseurl=https://repo.mongodb.org/yum/redhat/8/mongodb-org/5.0/x86_64/ | |
| gpgcheck=1 | |
| enabled=1 | |
| gpgkey=https://www.mongodb.org/static/pgp/server-5.0.asc | |
| EOF | |
| sudo tee /etc/yum.repos.d/pritunl.repo << EOF |