Cheatsheet: Data Structures
    Array / List
    Map / Dict
    Set
    Tuple
    Struct / Data Class
    Stacks
    Other Data Structures
    Collection Conversions
Cheatsheet: Control Flow
Cheatsheet: Class

Polyglot CheatSheet - Built-in Constants/Variables/Keywords

Updated: 2022-04-25

Bash

  • $# - Denotes the number of arguments you have passed to the shell script from the command line.
  • [email protected] - All arguments, as separate words.
  • $* - All arguments, as one word.
  • $$ - ID of the current process.
  • $? - Exit status of the last command.
  • $0,$1,..$9,${10},${11}…${N} - These are positional parameters. After “9″ you must use the ${k} syntax.

Node / JavaScript

Global Objects

  • process: the global object in Node, similar to window in browser.
    • process.env: environment variables defined and exported in ~/.bash_profile or ~/.bashrc
    • process.argv: Stores commandline arguments.
    • process.exit(): Exit program.
  • window: the global object in the browser.

Get num of CPUs:

var numCPUs = require('os').cpus().length;

Python

>>> import keyword
>>> keyword.kwlist
['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
>>> len(keyword.kwlist)
33

async and await were added in 3.7

Rust

https://doc.rust-lang.org/reference/keywords.html

Kotlin

kotlin keyword/operator: https://kotlinlang.org/docs/keyword-reference.html#operators-and-special-symbols