panic
signals "the programmer has made a fundamental mistake and execution cannot continue safely", whereas os.Exit
signals "the programmer has decided that the process should terminate here" — different meanings. Also, important difference in behavior: panic
will unwind the callstack, which means it will call any pending defer
statements; os.Exit
will just do a hard kill, so it won't.
import { NetworkAdapter } from "@automerge/automerge-repo"; | |
import { PeerMetadata, Message } from "@automerge/automerge-repo"; | |
import { PeerId } from "@automerge/automerge-repo"; | |
export class FooWSNetworkAdapter extends NetworkAdapter { | |
sockets: Map<PeerId, WebSocket> = new Map(); | |
#ready = false; | |
#readyResolver?: () => void; | |
#readyPromise: Promise<void> = new Promise<void>((resolve) => { |
{ | |
"$schema": "https://json-schema.org/draft/2020-12/schema", | |
"title": "Person", | |
"type": "object", | |
"properties": { | |
"contact": { | |
"anyOf": [ | |
{ "$ref": "#/$defs/emailContact" }, | |
{ "$ref": "#/$defs/phoneContact" } | |
] |
package main | |
import ( | |
"fmt" | |
"os" | |
"os/exec" | |
) | |
func main() { | |
if len(os.Args) == 1 { |
// usage: | |
// go run waitfor.go <num> | |
// where, num can be 1 or 2 or 3 or 4. | |
package main | |
import ( | |
"context" | |
"encoding/json" | |
"fmt" |
Picking the right architecture = Picking the right battles + Managing trade-offs
- Clarify and agree on the scope of the system
- User cases (description of sequences of events that, taken together, lead to a system doing something useful)
- Who is going to use it?
- How are they going to use it?
PEM - Format type Base64 - content of the file encoding type
PEM (originally “Privacy Enhanced Mail”) is the most common format for X.509 certificates, CSRs, and cryptographic keys(public/private keys).
A PEM file is a text file containing one or more items in Base64 ASCII encoding, each with plain-text headers and footers (e.g. -----BEGIN CERTIFICATE----- and -----END CERTIFICATE-----).
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | |
# add bazel `golang` rules | |
http_archive( | |
name = "io_bazel_rules_go", | |
sha256 = "a8d6b1b354d371a646d2f7927319974e0f9e52f73a2452d2b3877118169eb6bb", | |
urls = [ | |
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.23.3/rules_go-v0.23.3.tar.gz", | |
"https://github.com/bazelbuild/rules_go/releases/download/v0.23.3/rules_go-v0.23.3.tar.gz", |
From official website, Elasticsearch is a distributed, RESTful search and analytics engine capable of addressing a growing number of use cases. As the heart of the Elastic Stack, it centrally stores your data for lightning fast search, fine‑tuned relevancy, and powerful analytics that scale with ease.
Data in Elasticsearch is organized into indices. Each index is made up of one or more shards. Each shard is an instance of a Lucene index, which you can think of as a self-contained search engine that indexes and handles queries for a subset of the data in an Elasticsearch cluster. For details on shards and indices, see here
# REDIS cheatsheet | |
### delete | |
1. delete all keys in ALL dbs | |
FLUSHALL | |
2. delete all keys in a specific DB |