| 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
| class ActionGenerate { | |
| .... | |
| workDone() { | |
| return this.props.workDone; | |
| } | |
| workToDo(): IPromptParam[] { | |
| const notDone: IPromptParam[] = []; | |
| for (const r of this.props.resource){ | |
| if (state.skipped < this.props.workDone) { |
| interface IActionQueue<T> { | |
| jobId: string; // primary key | |
| currentStatus: 'pending' | 'running' | 'completed' | 'cancelled'; // GSI PK | |
| priorityScore: number; // timestamp, GSI SK (default value = createdAt) can be overriden. | |
| createdAt: number; // the real createdAt (although not really) | |
| resource: T; | |
| } | |
| // IPromptParam = { seed, sampler, prompt, negative, n_iter, ... } | |
| interface IGenerateQueue extends IActionQueue<IPromptParam[]> { |
| # ~/.bashrc: executed by bash(1) for non-login shells. | |
| # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
| # for examples | |
| # If not running interactively, don't do anything | |
| case $- in | |
| *i*) ;; | |
| *) return;; | |
| esac |
| 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 |
| interface IGuess { | |
| word: string; | |
| score: string; | |
| }; | |
| const A = 'a'.charCodeAt(0); | |
| export class Wordle { | |
| /** | |
| * 0 = possible | |
| * 1 = impossible |
| 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); } | |
| } |
| import Axios, { AxiosInstance } from 'axios'; | |
| abstract class BaseRequest { | |
| abstract request(): AxiosInstance; | |
| } | |
| class Host1 extends BaseRequest { | |
| request(): AxiosInstance { throw new Error('not implemented'); } | |
| // todo | |
| buyProduct() { |
| 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(){} |
| 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); | |
| } |