ninegene

tmux cheatsheet

Session Session groups one or more windows together. Each session has one current window, this is the window displayed when the session is attached and is the default window for any commands that target the session. Sessions do not have an index but they do have a name, which must be unique. Every window has …

tmux cheatsheet Read More »

MemTable, WAL, SSTable, Log Structured Merge(LSM) Trees

Taken from: Build a Database Pt. 2: MemTable MemTable – facebook/rocksdb wiki Write-Ahead Logging -SQLite Writing A Database: Part 2 — Write Ahead Log SSTable and Log Structured Storage: LevelDB Study Guide — Cassandra Reads and Writes On Disk IO, Part 3: LSM Trees Bigtable: A Distributed Storage System for Structured Data MemTable The MemTable …

MemTable, WAL, SSTable, Log Structured Merge(LSM) Trees Read More »

Linux: Open files (systemd, ulimit, netstat, lsof)

ulimit $ man limits.conf NAME limits.conf – configuration file for the pam_limits module DESCRIPTION The pam_limits.so module applies ulimit limits, nice priority and number of simultaneous login sessions limit to user login sessions. This description of the configuration file syntax applies to the /etc/security/limits.conf file and *.conf files in the /etc/security/limits.d directory. Also see: https://wiki.archlinux.org/title/Limits.conf …

Linux: Open files (systemd, ulimit, netstat, lsof) Read More »

Big O notation: Orders of common functions

constant Determining if a binary number is even or odd; Calculating  ; Using a constant-size lookup table double logarithmic Number of comparisons spent finding an item using interpolation search in a sorted array of uniformly distributed values logarithmic Finding an item in a sorted array with a binary search or a balanced search tree as well as all operations in a Binomial heap …

Big O notation: Orders of common functions Read More »

JavaScript: Number.EPSILON and Number.MAX_SAFE_INTEGER

EPSILON The Number.EPSILON property represents the difference between 1 and the smallest floating point number greater than 1 > Number.EPSILON == Math.pow(2, -52) true Use Number.EPSILON to test floating point number equality. x = 0.2; y = 0.3; z = 0.1; equal = (Math.abs(x – y + z) < Number.EPSILON); https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON MAX_SAFE_INTEGER & MIN_SAFE_INTEGER The MAX_SAFE_INTEGER constant has a …

JavaScript: Number.EPSILON and Number.MAX_SAFE_INTEGER Read More »

Non-cryptographic Hash Functions

See: List of non-cryptographic hash functions Pearson hashing Pearson hashing is a hash function designed for fast execution on processors with 8-bit registers. This hash function is a CBC-MAC that uses an 8-bit substitution cipher implemented via the substitution table. An 8-bit cipher has negligible cryptographic security, so the Pearson hash function is not cryptographically strong, but it is useful for implementing hash tables or as a data integrity check …

Non-cryptographic Hash Functions Read More »

Python: pearson_hashing.py

$ cat pearson_hashing.py from random import shuffle example_table = list(range(0, 256)) shuffle(example_table) def hash8(message, table): hash = len(message) % 256 for c in message: #hash = table[(hash+ord(c)) % 256] print(f’for c=\'{c}\’, ord(c)={ord(c)}: {hash} ^ {ord(c)} => {hash ^ ord(c)} and table[hash ^ ord(c)] = {table[hash ^ ord(c)]}’) hash = table[hash ^ ord(c)] return hash if …

Python: pearson_hashing.py Read More »

Bloom Filters in Redis

Probabilistic (P11C) data structure https://github.com/guyroyse/understanding-probabilistic-data-structures/blob/master/code/bloom-filter/javascript/bloom.js https://github.com/guyroyse/understanding-probabilistic-data-structures/blob/master/slides/understanding-probabilistic-data-structures.pdf

AWS CDK Cheat Sheet

Documentation https://docs.aws.amazon.com/cdk/latest/guide/stack_how_to_create_multiple_stacks.html https://docs.aws.amazon.com/cdk/latest/guide/get_context_var.html https://docs.aws.amazon.com/cdk/latest/guide/testing.html CDK Constructs Library TypeScript API Reference Best Practices github.com/kevinslin/open-cdk Examples github.com/kolomied/awesome-cdk github.com/cloudcomponents/cdk-constructs/tree/master/examples github.com/aws-samples/aws-cdk-examples github.com/blndspt/aws-full-stack-template github.com/awslabs/aws-full-stack-template github.com/aws-samples/aws-bookstore-demo-app bobbyhadz.com/blog/how-does-aws-cdk-work bobbyhadz.com/blog/cdk-constructs-tutorial bobbyhadz.com/blog/aws-cdk-identifiers bobbyhadz.com/blog/how-to-use-context-aws-cdk bobbyhadz.com/blog/aws-cdk-parameters-example bobbyhadz.com/blog/aws-cdk-vpc-example bobbyhadz.com/blog/aws-cdk-security-group-example Some Gotchas When synthesizing an AWS CDK stack, I get the message –app is required either in command-line, in cdk.json or in ~/.cdk.json This message usually means that you …

AWS CDK Cheat Sheet Read More »

Downloading Files using Google Drive API

See: Google Cloud SDK (gcloud CLI) Create project in https://console.cloud.google.com Enable Google Drive API in console https://developers.google.com/drive/api/v3/enable-drive-api Using gcloud cli: gcloud doesn’t provide command to access google drive. Install gdrive https://github.com/prasmussen/gdrive After entering verification code from browser: -q, –query <query> https://developers.google.com/drive/api/v3/search-shareddriveshttps://developers.google.com/drive/api/v3/ref-search-terms#operators –order <sortOrder> OrderBy sets the optional parameter “orderBy”: A comma-separated list of sort keys. …

Downloading Files using Google Drive API Read More »

Google Cloud SDK (gcloud CLI)

Installation options Home Brew: https://formulae.brew.sh/cask/google-cloud-sdk Official: https://cloud.google.com/sdk/docs/install gcloud CLI gcloud init – initialize or reinitialize gcloud See: https://cloud.google.com/sdk/docs/initializing gcloud auth – manage credentials  gcloud auth login – authorize gcloud to access Google Cloud Platform with Google user credentials gcloud auth list – lists credentialed accounts gcloud auth activate-service-account – authorize access to Google Cloud Platform …

Google Cloud SDK (gcloud CLI) Read More »

About YAML

Based on: https://www.json2yaml.com/convert-yaml-to-json JSON JSON stands for “javascript object notation” records separated by commas keys & strings wrapped by double quotes good choice for data transport YAML YAML stands for “YAML ain’t markup language” and is a superset of JSON lists begin with a hyphen dependent on whitespace / indentation better suited for configuration than …

About YAML Read More »

AWS Cloud Development Kit (CDK) – Big Picture

Big Picture Infrastructure as code in TypeScript and Python etc. CDK includes Command line interface (CLI) tool Language bindings to CloudFormation resources Construct Library A Construct is a logical grouping of one or more resources Constructs are reusable cloud components Types of CDK Constructs CFN Resources or L1 Construct (or L1, short for “level 1”) or …

AWS Cloud Development Kit (CDK) – Big Picture Read More »

screen CheatSheet

~/.screenrc Example screen config file: .screenrc Start a new screen session Start a new screen session with session name List screen sessions Attach a screen session <name> can be the part of the session name (search term) if there is no conflict. If the search term match multiple session names, the attach will fail. Detach …

screen CheatSheet Read More »

AWS CLI CheatSheet

Install aws-cli on macOS Based on: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-mac.html Configure default profile AWS Access Key ID AWS Secret Access Key Default region name Default output format Configure a specific profile List default profile information List all profile names Get Access Key ID List all profiles credentials Changing default profile https://github.com/awsdocs/aws-doc-sdk-examples/tree/master/aws-cli/bash-linux