├── cheatsheets ├── index.md ├── rust │ ├── cli │ │ ├── index.md │ │ ├── rustup.md │ │ └── rustc.md │ ├── uninstall.md │ ├── install.md │ └── index.md ├── powershell │ ├── index.md │ ├── files.md │ ├── execution-policy.md │ └── shortcuts.md ├── sql │ ├── advanced │ │ ├── index.md │ │ └── update-table.md │ ├── rdbms │ │ └── index.md │ ├── basic │ │ ├── index.md │ │ ├── manage-tables.md │ │ ├── maths.md │ │ └── delete.md │ ├── index.md │ └── replace.md ├── shell │ ├── database │ │ └── index.md │ ├── commands │ │ ├── read-write │ │ │ ├── index.md │ │ │ ├── head.md │ │ │ ├── tail.md │ │ │ └── vis.md │ │ ├── date │ │ │ ├── index.md │ │ │ └── convert.md │ │ ├── index.md │ │ ├── dig.md │ │ ├── grep │ │ │ ├── regex-patterns │ │ │ │ └── index.md │ │ │ ├── match-types.md │ │ │ └── resources.md │ │ ├── ssh.md │ │ ├── scp.md │ │ └── fzf.md │ ├── files │ │ ├── index.md │ │ └── text-files │ │ │ ├── index.md │ │ │ ├── more.md │ │ │ ├── combine.md │ │ │ ├── clipboard.md │ │ │ ├── open.md │ │ │ ├── view.md │ │ │ ├── lines.md │ │ │ ├── dotenv.md │ │ │ └── head-and-tail.md │ ├── storage │ │ └── index.md │ ├── permissions │ │ ├── change-owner.md │ │ ├── change-group.md │ │ └── index.md │ ├── scripting │ │ ├── control-flow │ │ │ ├── index.md │ │ │ ├── and-or.md │ │ │ ├── if-else.md │ │ │ ├── negate.md │ │ │ ├── ignore.md │ │ │ └── true-false.md │ │ ├── index.md │ │ ├── size.md │ │ ├── copy.md │ │ ├── overview.md │ │ ├── docstring.md │ │ └── sequence.md │ ├── printing │ │ └── index.md │ ├── cross-language.md │ ├── hardware.md │ ├── ssh │ │ ├── index.md │ │ └── directory.md │ ├── architecture.md │ ├── compression │ │ └── view.md │ ├── batch.md │ ├── scheduling.md │ ├── searching.md │ └── network-manager.md ├── web │ ├── css │ │ ├── layouts │ │ │ ├── index.md │ │ │ └── align.md │ │ ├── pseudo-selectors │ │ │ ├── index.md │ │ │ ├── text.md │ │ │ ├── user-action.md │ │ │ └── overview.md │ │ ├── index.md │ │ ├── tables.md │ │ ├── github-pages.md │ │ ├── transform.md │ │ ├── boxes.md │ │ └── cursor.md │ ├── html │ │ ├── elements │ │ │ ├── index.md │ │ │ └── abbr.md │ │ ├── content-editable.md │ │ ├── selection.md │ │ ├── autofocus.md │ │ ├── open-graph.md │ │ ├── index.md │ │ ├── comments.md │ │ ├── encode-and-escape │ │ │ ├── html-entity-escaping.md │ │ │ └── index.md │ │ └── clickable.md │ ├── http-status-codes.md │ ├── index.md │ ├── seo │ │ ├── sitemaps.md │ │ └── index.md │ └── hosts.md ├── containers │ ├── docker │ │ ├── intro │ │ │ ├── index.md │ │ │ └── hello-world.md │ │ ├── index.md │ │ ├── dockerfile │ │ │ ├── aliases.md │ │ │ └── index.md │ │ ├── persist.md │ │ ├── volumes.md │ │ └── clean.md │ ├── kubernetes │ │ ├── cli │ │ │ ├── index.md │ │ │ ├── exec.md │ │ │ ├── logs.md │ │ │ └── replica-set.md │ │ ├── install.md │ │ └── index.md │ ├── podman │ │ ├── index.md │ │ ├── setup.md │ │ └── cli.md │ ├── index.md │ ├── colima │ │ └── index.md │ ├── docker-compose │ │ └── index.md │ └── docker-cli │ │ └── manage-volumes.md ├── data │ ├── json │ │ └── index.md │ ├── index.md │ ├── toml │ │ ├── index.md │ │ ├── data-types.md │ │ └── sample.md │ └── yaml │ │ ├── variable-names.md │ │ ├── file-formatting.md │ │ └── data-structures.md ├── go │ ├── code │ │ ├── networking │ │ │ └── index.md │ │ ├── index.md │ │ ├── printing │ │ │ ├── log.md │ │ │ └── index.md │ │ ├── cli-input.md │ │ └── structures.md │ ├── packages │ │ ├── index.md │ │ └── time.md │ ├── manage-packages │ │ └── index.md │ └── index.md ├── javascript │ ├── packages │ │ ├── vue │ │ │ ├── cli │ │ │ │ └── index.md │ │ │ ├── components │ │ │ │ ├── index.md │ │ │ │ └── conditional.md │ │ │ ├── directives │ │ │ │ ├── index.md │ │ │ │ └── v-bind.md │ │ │ ├── text.md │ │ │ ├── index.md │ │ │ ├── events │ │ │ │ ├── emit.md │ │ │ │ ├── key-modifiers.md │ │ │ │ ├── custom.md │ │ │ │ └── types.md │ │ │ └── white-space.md │ │ ├── dataviz │ │ │ ├── index.md │ │ │ └── apex-charts │ │ │ │ ├── index.md │ │ │ │ ├── installation.md │ │ │ │ ├── formatting.md │ │ │ │ ├── logarithm.md │ │ │ │ └── basic.md │ │ ├── react │ │ │ ├── hooks │ │ │ │ ├── importing.md │ │ │ │ ├── custom-hooks.md │ │ │ │ ├── index.md │ │ │ │ └── callback.md │ │ │ ├── basics │ │ │ │ ├── index.md │ │ │ │ └── component-lifecycle.md │ │ │ ├── index.md │ │ │ ├── download.md │ │ │ ├── refs.md │ │ │ └── setup.md │ │ ├── npkill │ │ │ └── index.md │ │ ├── esbuild │ │ │ ├── script.md │ │ │ └── formats.md │ │ ├── jquery │ │ │ └── index.md │ │ ├── index.md │ │ ├── express │ │ │ └── index.md │ │ └── http │ │ │ └── index.md │ ├── browser │ │ ├── events │ │ │ └── index.md │ │ ├── index.md │ │ ├── design-mode.md │ │ ├── clipboard.md │ │ ├── network.md │ │ └── styles.md │ ├── general │ │ ├── strings │ │ │ ├── index.md │ │ │ └── encoding │ │ │ │ └── index.md │ │ ├── timers │ │ │ └── index.md │ │ ├── functions │ │ │ └── index.md │ │ ├── control-flow │ │ │ ├── index.md │ │ │ ├── some.md │ │ │ └── switch.md │ │ ├── data-structures │ │ │ ├── index.md │ │ │ └── iterables.md │ │ ├── index.md │ │ ├── request │ │ │ ├── http.md │ │ │ └── index.md │ │ ├── object-shorthand.md │ │ ├── modules │ │ │ └── index.md │ │ ├── promises │ │ │ └── callback.md │ │ ├── variable-declaration │ │ │ └── reassign.md │ │ ├── es6.md │ │ ├── style-console-log.md │ │ └── printing.md │ ├── deno │ │ ├── cli │ │ │ ├── commands │ │ │ │ ├── index.md │ │ │ │ └── test.md │ │ │ ├── index.md │ │ │ ├── format.md │ │ │ └── releasing-asset.md │ │ ├── modules │ │ │ └── index.md │ │ ├── package-list │ │ │ └── index.md │ │ ├── managing-imports │ │ │ └── inline.md │ │ ├── code.md │ │ └── ignoring-rules.md │ ├── node │ │ ├── index.md │ │ ├── classes.md │ │ └── install.md │ ├── typescript.md │ └── format-and-lint │ │ ├── eslint │ │ ├── rules │ │ │ ├── index.md │ │ │ └── format.md │ │ ├── install.md │ │ ├── config-files │ │ │ ├── index.md │ │ │ └── main.md │ │ ├── index.md │ │ └── init.md │ │ ├── prettier │ │ ├── index.md │ │ ├── resources.md │ │ ├── options.md │ │ ├── ignoring-rules.md │ │ └── install.md │ │ └── index.md ├── maker-projects │ ├── index.md │ └── arduino.md ├── hugo │ ├── index.md │ └── installation.md ├── jekyll │ ├── themes │ │ └── index.md │ ├── liquid │ │ ├── conditionals │ │ │ └── index.md │ │ ├── posts │ │ │ └── index.md │ │ ├── comment.md │ │ ├── hashes.md │ │ ├── index.md │ │ ├── strings.md │ │ ├── variables.md │ │ └── paths.md │ ├── cli │ │ ├── index.md │ │ ├── commands │ │ │ └── index.md │ │ ├── container.md │ │ └── testing.md │ ├── configuration │ │ ├── index.md │ │ ├── null-values.md │ │ ├── load-multiple-configs.md │ │ ├── urls.md │ │ ├── resources.md │ │ └── build-settings.md │ ├── code-blocks │ │ └── index.md │ ├── templating │ │ ├── index.md │ │ ├── collections.md │ │ └── static-files.md │ ├── overview.md │ ├── plugins │ │ └── index.md │ ├── dependencies │ │ └── index.md │ ├── dashes.md │ └── windows.md ├── python │ ├── libraries │ │ ├── built-in │ │ │ ├── index.md │ │ │ └── http-server.md │ │ ├── database │ │ │ ├── redis │ │ │ │ └── data-types │ │ │ │ │ └── index.md │ │ │ └── index.md │ │ ├── index.md │ │ ├── boto3.md │ │ ├── queue-messaging │ │ │ ├── rq.md │ │ │ ├── celery.md │ │ │ ├── apache-kafka.md │ │ │ ├── zmq.md │ │ │ └── amazon-sqs.md │ │ └── ipython.md │ ├── strings │ │ ├── encoding │ │ │ ├── index.md │ │ │ └── html-escape.md │ │ ├── wrap.md │ │ ├── index.md │ │ ├── case.md │ │ ├── truncate.md │ │ └── regex.md │ ├── type-checks │ │ ├── basics │ │ │ ├── index.md │ │ │ └── union.md │ │ ├── data-structures │ │ │ ├── index.md │ │ │ ├── tuple.md │ │ │ └── no-structure.md │ │ ├── index.md │ │ └── install-and-run-mypy.md │ ├── linting │ │ └── index.md │ ├── formatting │ │ ├── index.md │ │ └── black.md │ ├── project-administration │ │ ├── index.md │ │ ├── linting │ │ │ └── index.md │ │ └── formatting.md │ ├── install │ │ └── index.md │ ├── builtins │ │ ├── data-structures │ │ │ ├── tuple.md │ │ │ └── deque.md │ │ └── index.md │ ├── databases.md │ ├── files-and-paths │ │ ├── index.md │ │ └── read-and-write │ │ │ └── index.md │ ├── tests │ │ ├── index.md │ │ └── nose.md │ ├── virtual-environments.md │ ├── configs │ │ ├── python.md │ │ ├── toml.md │ │ ├── index.md │ │ └── setup-cfg.md │ ├── challenges.md │ ├── resources.md │ ├── pitfalls.md │ ├── transpose-array.md │ ├── convert.md │ └── browser.md ├── version-control │ ├── git │ │ ├── branches │ │ │ └── index.md │ │ ├── submodules │ │ │ ├── index.md │ │ │ └── github-view.md │ │ ├── restore │ │ │ ├── index.md │ │ │ ├── unstage.md │ │ │ └── undo.md │ │ ├── count-files-in-repo.md │ │ ├── committing │ │ │ ├── skip-hooks.md │ │ │ ├── index.md │ │ │ ├── auto.md │ │ │ └── ci.md │ │ ├── commands │ │ │ ├── gc.md │ │ │ └── whatchanged.md │ │ ├── resources.md │ │ ├── search-stashes.md │ │ ├── permissions-error.md │ │ ├── changes-key.md │ │ ├── tags.md │ │ ├── log-tips.md │ │ └── index.md │ ├── github │ │ ├── api │ │ │ ├── v3 │ │ │ │ ├── index.md │ │ │ │ ├── limitations.md │ │ │ │ └── gists.md │ │ │ ├── index.md │ │ │ └── v4 │ │ │ │ └── index.md │ │ └── index.md │ └── index.md ├── graphql │ ├── index.md │ └── spread.md ├── package-managers │ ├── index.md │ ├── javascript │ │ ├── yarn │ │ │ ├── commands │ │ │ │ ├── index.md │ │ │ │ ├── add.md │ │ │ │ ├── install.md │ │ │ │ ├── create.md │ │ │ │ └── npm-vs-yarn.md │ │ │ └── index.md │ │ ├── npm │ │ │ ├── index.md │ │ │ ├── manage.md │ │ │ └── commands │ │ │ │ └── index.md │ │ └── index.md │ ├── php │ │ └── index.md │ ├── python │ │ ├── index.md │ │ ├── pip │ │ │ ├── uninstall.md │ │ │ ├── index.md │ │ │ ├── resources.md │ │ │ ├── overview.md │ │ │ ├── manage-pip.md │ │ │ ├── protect.md │ │ │ └── show.md │ │ └── pipenv.md │ ├── ruby │ │ ├── bundler │ │ │ ├── subcommands │ │ │ │ ├── index.md │ │ │ │ ├── clean.md │ │ │ │ └── add.md │ │ │ ├── env.md │ │ │ ├── clean.md │ │ │ ├── list.md │ │ │ ├── other.md │ │ │ ├── init.md │ │ │ └── upgrade.md │ │ ├── gem │ │ │ ├── remove.md │ │ │ ├── env.md │ │ │ ├── index.md │ │ │ └── show.md │ │ └── index.md │ └── os │ │ ├── index.md │ │ ├── snap.md │ │ └── homebrew │ │ ├── overview.md │ │ ├── install-homebrew.md │ │ ├── index.md │ │ └── services.md ├── typescript │ ├── data-types │ │ ├── index.md │ │ └── primitives.md │ ├── tsconfig.md │ ├── index.md │ ├── run.md │ ├── ignoring-rules.md │ ├── variables.md │ └── type-assertions.md ├── other │ ├── vscode │ │ ├── index.md │ │ ├── python-imports.md │ │ └── emmet.md │ ├── index.md │ ├── cli │ │ ├── index.md │ │ └── interface.md │ ├── vscode-extensions │ │ ├── workflows │ │ │ ├── index.md │ │ │ └── publish.md │ │ └── index.md │ ├── regex │ │ ├── repeat.md │ │ ├── insert.md │ │ ├── groups.md │ │ ├── index.md │ │ └── exclude.md │ ├── quick-links.md │ ├── indentation.md │ └── share-code.md ├── ruby │ ├── strings.md │ ├── gems │ │ ├── index.md │ │ └── user-directory.md │ ├── index.md │ ├── functions.md │ ├── types.md │ └── ruby-managers.md ├── make │ ├── index.md │ ├── variables │ │ ├── date.md │ │ ├── index.md │ │ ├── current-directory.md │ │ ├── access.md │ │ └── defaults-file.md │ ├── copy.md │ └── command-modifiers.md ├── ci-cd │ ├── index.md │ ├── netlify │ │ ├── functions │ │ │ ├── index.md │ │ │ ├── response-type.md │ │ │ └── function-params.md │ │ └── index.md │ ├── circleci │ │ ├── index.md │ │ └── definitions.md │ └── github-actions │ │ └── working-directory.md ├── tools │ ├── index.md │ └── helm.md ├── markdown │ ├── wiki.md │ ├── emojis.md │ ├── todo-list.md │ ├── flavors.md │ └── contact.md ├── terraform │ ├── index.md │ ├── code │ │ ├── conditionals.md │ │ └── index.md │ ├── atlantis.md │ ├── environment.md │ ├── tfenv.md │ └── cli-usage │ │ ├── import.md │ │ └── console.md ├── artificial-intelligence │ ├── deepseek │ │ └── index.md │ ├── ollama │ │ └── index.md │ └── index.md └── nosql │ └── mongodb │ └── advanced-features.md ├── 404.html ├── sample-shell.png ├── sample-cheatsheets.png ├── .gitignore ├── docs ├── usage.md ├── development.md ├── README.md ├── deploy.md └── installation.md ├── Gemfile ├── hooks └── pre-push ├── .editorconfig ├── .vscode └── settings.json └── Makefile /cheatsheets/index.md: -------------------------------------------------------------------------------- 1 | # Cheatsheets 2 | -------------------------------------------------------------------------------- /404.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: 404 3 | --- 4 | -------------------------------------------------------------------------------- /cheatsheets/rust/cli/index.md: -------------------------------------------------------------------------------- 1 | # CLI 2 | -------------------------------------------------------------------------------- /cheatsheets/powershell/index.md: -------------------------------------------------------------------------------- 1 | # PowerShell 2 | -------------------------------------------------------------------------------- /cheatsheets/sql/advanced/index.md: -------------------------------------------------------------------------------- 1 | # Advanced 2 | -------------------------------------------------------------------------------- /cheatsheets/shell/database/index.md: -------------------------------------------------------------------------------- 1 | # Database 2 | -------------------------------------------------------------------------------- /cheatsheets/sql/rdbms/index.md: -------------------------------------------------------------------------------- 1 | # RDBMS flavors 2 | -------------------------------------------------------------------------------- /cheatsheets/web/css/layouts/index.md: -------------------------------------------------------------------------------- 1 | # Layouts 2 | -------------------------------------------------------------------------------- /cheatsheets/web/html/elements/index.md: -------------------------------------------------------------------------------- 1 | # Elements 2 | -------------------------------------------------------------------------------- /cheatsheets/containers/docker/intro/index.md: -------------------------------------------------------------------------------- 1 | # Intro 2 | -------------------------------------------------------------------------------- /cheatsheets/containers/kubernetes/cli/index.md: -------------------------------------------------------------------------------- 1 | # CLI 2 | -------------------------------------------------------------------------------- /cheatsheets/data/json/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # JSON 4 | -------------------------------------------------------------------------------- /cheatsheets/go/code/networking/index.md: -------------------------------------------------------------------------------- 1 | # Networking 2 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/vue/cli/index.md: -------------------------------------------------------------------------------- 1 | # CLI 2 | -------------------------------------------------------------------------------- /cheatsheets/maker-projects/index.md: -------------------------------------------------------------------------------- 1 | # Maker projects 2 | -------------------------------------------------------------------------------- /cheatsheets/go/code/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Code 3 | --- 4 | -------------------------------------------------------------------------------- /cheatsheets/hugo/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Hugo 3 | 4 | --- 5 | -------------------------------------------------------------------------------- /cheatsheets/javascript/browser/events/index.md: -------------------------------------------------------------------------------- 1 | # Events 2 | -------------------------------------------------------------------------------- /cheatsheets/javascript/general/strings/index.md: -------------------------------------------------------------------------------- 1 | # Strings 2 | -------------------------------------------------------------------------------- /cheatsheets/javascript/general/timers/index.md: -------------------------------------------------------------------------------- 1 | # Timers 2 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/dataviz/index.md: -------------------------------------------------------------------------------- 1 | # Dataviz 2 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/themes/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # Themes 4 | -------------------------------------------------------------------------------- /cheatsheets/python/libraries/built-in/index.md: -------------------------------------------------------------------------------- 1 | # Built-in 2 | -------------------------------------------------------------------------------- /cheatsheets/python/strings/encoding/index.md: -------------------------------------------------------------------------------- 1 | # Encoding 2 | -------------------------------------------------------------------------------- /cheatsheets/python/type-checks/basics/index.md: -------------------------------------------------------------------------------- 1 | # Basics 2 | -------------------------------------------------------------------------------- /cheatsheets/shell/commands/read-write/index.md: -------------------------------------------------------------------------------- 1 | # Read and write -------------------------------------------------------------------------------- /cheatsheets/shell/files/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # Files 4 | -------------------------------------------------------------------------------- /cheatsheets/data/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Data formats 3 | --- 4 | -------------------------------------------------------------------------------- /cheatsheets/javascript/deno/cli/commands/index.md: -------------------------------------------------------------------------------- 1 | # Commands 2 | -------------------------------------------------------------------------------- /cheatsheets/javascript/deno/cli/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # CLI 4 | -------------------------------------------------------------------------------- /cheatsheets/javascript/general/functions/index.md: -------------------------------------------------------------------------------- 1 | # Functions 2 | -------------------------------------------------------------------------------- /cheatsheets/sql/basic/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Basic 3 | --- 4 | -------------------------------------------------------------------------------- /cheatsheets/version-control/git/branches/index.md: -------------------------------------------------------------------------------- 1 | # Branches 2 | -------------------------------------------------------------------------------- /cheatsheets/web/css/pseudo-selectors/index.md: -------------------------------------------------------------------------------- 1 | # Pseudo selectors 2 | -------------------------------------------------------------------------------- /cheatsheets/javascript/general/control-flow/index.md: -------------------------------------------------------------------------------- 1 | # Control flow 2 | -------------------------------------------------------------------------------- /cheatsheets/javascript/general/strings/encoding/index.md: -------------------------------------------------------------------------------- 1 | # Encoding 2 | -------------------------------------------------------------------------------- /cheatsheets/python/linting/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Linting 3 | --- 4 | -------------------------------------------------------------------------------- /cheatsheets/shell/storage/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # Space on disk 4 | -------------------------------------------------------------------------------- /cheatsheets/sql/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | logo: postgresql 3 | --- 4 | # SQL 5 | -------------------------------------------------------------------------------- /cheatsheets/version-control/git/submodules/index.md: -------------------------------------------------------------------------------- 1 | # Submodules 2 | 3 | -------------------------------------------------------------------------------- /cheatsheets/graphql/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | logo: graphql 3 | --- 4 | # GraphQL 5 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # Package managers 4 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/javascript/yarn/commands/index.md: -------------------------------------------------------------------------------- 1 | # Commands 2 | -------------------------------------------------------------------------------- /cheatsheets/python/formatting/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Formatting 3 | --- 4 | -------------------------------------------------------------------------------- /cheatsheets/python/libraries/database/redis/data-types/index.md: -------------------------------------------------------------------------------- 1 | # Data types -------------------------------------------------------------------------------- /cheatsheets/typescript/data-types/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # Data types 4 | -------------------------------------------------------------------------------- /cheatsheets/javascript/general/data-structures/index.md: -------------------------------------------------------------------------------- 1 | # Data structures 2 | 3 | -------------------------------------------------------------------------------- /cheatsheets/javascript/node/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Node 3 | logo: nodedotjs 4 | --- 5 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/php/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: PHP 3 | logo: php 4 | --- 5 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/python/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | logo: python 3 | --- 4 | # Python 5 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/ruby/bundler/subcommands/index.md: -------------------------------------------------------------------------------- 1 | # Subcommands 2 | 3 | 4 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/liquid/conditionals/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Truthy and falsy logic 3 | --- 4 | -------------------------------------------------------------------------------- /cheatsheets/python/project-administration/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # Project administration 4 | -------------------------------------------------------------------------------- /cheatsheets/rust/uninstall.md: -------------------------------------------------------------------------------- 1 | # Uninstall 2 | 3 | ```sh 4 | $ rustup self uninstall 5 | ``` 6 | -------------------------------------------------------------------------------- /sample-shell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelCurrin/dev-cheatsheets/HEAD/sample-shell.png -------------------------------------------------------------------------------- /cheatsheets/other/vscode/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: VS Code 3 | logo: visualstudiocode 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /cheatsheets/shell/files/text-files/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Working with text files 3 | --- 4 | 5 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/ruby/gem/remove.md: -------------------------------------------------------------------------------- 1 | # Remove 2 | 3 | ```sh 4 | gem uninstall GEM 5 | ``` 6 | -------------------------------------------------------------------------------- /cheatsheets/ruby/strings.md: -------------------------------------------------------------------------------- 1 | # Strings 2 | 3 | ## Join 4 | 5 | ```ruby 6 | File.join(foo, bar) 7 | ``` 8 | -------------------------------------------------------------------------------- /cheatsheets/go/packages/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Packages 3 | description: Recommended Go packages 4 | --- 5 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/cli/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Running Jekyll in the command-line 3 | --- 4 | # CLI 5 | -------------------------------------------------------------------------------- /cheatsheets/make/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Make 3 | description: Using GNU `make` with a `Makefile` 4 | --- 5 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/javascript/npm/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: NPM 3 | logo: npm 4 | 5 | --- 6 | 7 | 8 | -------------------------------------------------------------------------------- /cheatsheets/python/install/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Installing and managing Python 3 | --- 4 | # Install 5 | -------------------------------------------------------------------------------- /cheatsheets/shell/permissions/change-owner.md: -------------------------------------------------------------------------------- 1 | # Change owner 2 | 3 | ```sh 4 | $ chown USERNAME PATH 5 | ``` 6 | -------------------------------------------------------------------------------- /sample-cheatsheets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelCurrin/dev-cheatsheets/HEAD/sample-cheatsheets.png -------------------------------------------------------------------------------- /cheatsheets/jekyll/configuration/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: How to configure Jekyll 3 | --- 4 | # Configuration 5 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/python/pip/uninstall.md: -------------------------------------------------------------------------------- 1 | # Uninstall 2 | 3 | ```sh 4 | $ pip uninstall foo 5 | ``` 6 | -------------------------------------------------------------------------------- /cheatsheets/ci-cd/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CI/CD 3 | description: Continuous Integration / Continuous Deployment 4 | --- 5 | -------------------------------------------------------------------------------- /cheatsheets/javascript/browser/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: JavaScript guide for the browser 3 | --- 4 | # Browser 5 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/liquid/posts/index.md: -------------------------------------------------------------------------------- 1 | # Posts 2 | 3 | See [Posts](https://jekyllrb.com/docs/posts/) in the docs. 4 | -------------------------------------------------------------------------------- /cheatsheets/other/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Topics which don't fit into the other categories 3 | --- 4 | # Other 5 | -------------------------------------------------------------------------------- /cheatsheets/shell/permissions/change-group.md: -------------------------------------------------------------------------------- 1 | # Change group 2 | 3 | 4 | ```sh 5 | $ chgrp GROUPNAME PATH 6 | ``` 7 | -------------------------------------------------------------------------------- /cheatsheets/other/cli/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: General guide to designing Command-line Interfaces 3 | --- 4 | # CLI 5 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/os/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: OS level 3 | description: System dependency managers 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /cheatsheets/javascript/deno/cli/format.md: -------------------------------------------------------------------------------- 1 | # Format 2 | 3 | [Formatter](https://deno.land/manual/tools/formatter) in the docs. 4 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/cli/commands/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Reference for supported `jekyll` commands 3 | --- 4 | # Commands 5 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/ruby/gem/env.md: -------------------------------------------------------------------------------- 1 | # Environment 2 | 3 | Check the environment 4 | 5 | ```sh 6 | $ gem env 7 | ``` 8 | -------------------------------------------------------------------------------- /cheatsheets/shell/permissions/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Permissions 3 | description: Set permissions on a file or directory 4 | --- 5 | -------------------------------------------------------------------------------- /cheatsheets/version-control/github/api/v3/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: V3 REST 3 | description: About the GitHub V3 REST API 4 | --- 5 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/ruby/bundler/env.md: -------------------------------------------------------------------------------- 1 | # Environment 2 | 3 | Check the environment 4 | 5 | ```sh 6 | $ bundle env 7 | ``` 8 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/ruby/gem/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Working with the `gem` package manager command 3 | --- 4 | # gem 5 | -------------------------------------------------------------------------------- /cheatsheets/shell/commands/date/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # Date 4 | 5 | 6 | Note that `date` works differently on Linux and macOS. 7 | -------------------------------------------------------------------------------- /cheatsheets/data/toml/index.md: -------------------------------------------------------------------------------- 1 | # TOML 2 | 3 | - [Homepage](https://toml.io/) 4 | - [Wikipedia](https://en.wikipedia.org/wiki/TOML) 5 | 6 | -------------------------------------------------------------------------------- /cheatsheets/javascript/deno/cli/commands/test.md: -------------------------------------------------------------------------------- 1 | # test 2 | 3 | Example: 4 | 5 | ```sh 6 | $ deno test --unstable --allow-all 7 | ``` 8 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/code-blocks/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Code blocks 3 | description: Guide to displaying code snippets in Jekyll 4 | --- 5 | -------------------------------------------------------------------------------- /cheatsheets/shell/scripting/control-flow/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Control flow 3 | description: Conditional logic in shell scripting 4 | --- 5 | -------------------------------------------------------------------------------- /cheatsheets/version-control/git/restore/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # Restore 4 | 5 | See also the `restore` command in the Commands section. 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .jekyll-cache/ 2 | .sass-cache/ 3 | .jekyll-metadata 4 | 5 | .bundle/ 6 | vendor/ 7 | 8 | _site/ 9 | 10 | Gemfile.lock 11 | -------------------------------------------------------------------------------- /cheatsheets/go/manage-packages/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Package management 3 | description: Install Go packages globally or for a project 4 | --- 5 | -------------------------------------------------------------------------------- /cheatsheets/shell/files/text-files/more.md: -------------------------------------------------------------------------------- 1 | # More command 2 | 3 | `man less` and `man more` both go to less. But there is `more (1)` mentioned. 4 | -------------------------------------------------------------------------------- /cheatsheets/javascript/general/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: JavaScript guide that is not specific to the browser or Node.js 3 | --- 4 | # General 5 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/react/hooks/importing.md: -------------------------------------------------------------------------------- 1 | # Importing 2 | 3 | ```javascript 4 | import { useState, useEffect } from "react"; 5 | ``` 6 | -------------------------------------------------------------------------------- /cheatsheets/javascript/deno/modules/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # Modules 4 | 5 | 6 | See also online docs: 7 | 8 | - [deno doc](https://doc.deno.land/) 9 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/vue/components/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Components 3 | description: Handling `.vue` files, as views and components 4 | --- 5 | -------------------------------------------------------------------------------- /cheatsheets/shell/commands/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Info on Bash shell commands on Linux or macOS (builtin and installable) 3 | --- 4 | # Commands 5 | -------------------------------------------------------------------------------- /cheatsheets/shell/printing/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: How to use the `echo` and `printf` commands to show output in the terminal 3 | --- 4 | # Printing 5 | -------------------------------------------------------------------------------- /docs/usage.md: -------------------------------------------------------------------------------- 1 | # Usage 2 | 3 | ```sh 4 | $ make serve 5 | ``` 6 | 7 | Open the browser at: 8 | 9 | - http://localhost:4000/dev-cheatsheets/ 10 | -------------------------------------------------------------------------------- /cheatsheets/go/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | logo: go 3 | --- 4 | # Go 5 | 6 | See [Go](https://michaelcurrin.github.io/dev-resources/resources/go/) in Dev Resources site. 7 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/vue/directives/index.md: -------------------------------------------------------------------------------- 1 | # Directives 2 | 3 | See [Directives](https://v3.vuejs.org/api/directives.html) in the Vue 3 docs. 4 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/templating/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Cheatsheet for using Liquid templating and plain HTML in Jekyll projects 3 | --- 4 | # Templating 5 | -------------------------------------------------------------------------------- /cheatsheets/rust/install.md: -------------------------------------------------------------------------------- 1 | # Install Rust 2 | 3 | Follow the [Install Rust](https://gist.github.com/MichaelCurrin/6b619f1b035b922f4d883265b2ffcdcf) guide. 4 | -------------------------------------------------------------------------------- /cheatsheets/containers/docker/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Docker 3 | logo: docker 4 | description: Pack, ship and run any application as a lightweight container 5 | --- 6 | -------------------------------------------------------------------------------- /cheatsheets/hugo/installation.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | Follow the [Install Hugo](https://gohugo.io/getting-started/installing/) doc to install Hugo globally. 4 | -------------------------------------------------------------------------------- /cheatsheets/python/builtins/data-structures/tuple.md: -------------------------------------------------------------------------------- 1 | # Tuple 2 | 3 | Immutable. 4 | 5 | ```python 6 | p = (11, 22) 7 | 8 | p 9 | # => (11, 2) 10 | ``` 11 | -------------------------------------------------------------------------------- /cheatsheets/shell/scripting/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Scripting 3 | description: Guide to shell scripting for `.sh` scripts mainly but also command-line use 4 | --- 5 | -------------------------------------------------------------------------------- /cheatsheets/version-control/git/count-files-in-repo.md: -------------------------------------------------------------------------------- 1 | # Count files in repo 2 | 3 | Count files known to Git. 4 | 5 | ```sh 6 | $ git ls-files | wc -l 7 | ``` 8 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/react/basics/index.md: -------------------------------------------------------------------------------- 1 | # Basics 2 | 3 | Some content is from the [tutorial](https://reactjs.org/docs/hello-world.html) in the React docs. 4 | -------------------------------------------------------------------------------- /cheatsheets/python/builtins/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Built-ins 3 | --- 4 | 5 | See [Standard types](https://docs.python.org/3/library/stdtypes.html) in Python 3 docs. 6 | -------------------------------------------------------------------------------- /cheatsheets/python/type-checks/data-structures/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Data structures 3 | description: How to choose a type approach for your data structure 4 | --- 5 | -------------------------------------------------------------------------------- /cheatsheets/rust/cli/rustup.md: -------------------------------------------------------------------------------- 1 | # Rustup 2 | 3 | The Rust toolchain manager. 4 | 5 | Rustup allows switching between and updating stable, beta or nightly compilers. 6 | -------------------------------------------------------------------------------- /cheatsheets/typescript/tsconfig.md: -------------------------------------------------------------------------------- 1 | # TS Config 2 | 3 | See [TS Config](https://michaelcurrin.github.io/code-cookbook/recipes/typescript/tsconfig.html) in Code Cookbook. 4 | -------------------------------------------------------------------------------- /cheatsheets/javascript/typescript.md: -------------------------------------------------------------------------------- 1 | --- 2 | logo: typescript 3 | --- 4 | # TypeScript 5 | 6 | This section has moved [here]({% link cheatsheets/typescript/index.md %}). 7 | -------------------------------------------------------------------------------- /cheatsheets/python/databases.md: -------------------------------------------------------------------------------- 1 | # Databases 2 | 3 | See [Database][] in the libraries section. 4 | 5 | [Database]: {% link cheatsheets/python/libraries/database/index.md %} 6 | -------------------------------------------------------------------------------- /cheatsheets/python/files-and-paths/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # Files and paths 4 | 5 | 6 | Note the `os` library is older but the `pathlib` is newer and is more convenient. 7 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "jekyll", "~> 4.3" 4 | gem "webrick", "~> 1.7" 5 | 6 | gem "fractal", "~> 5", git: "https://github.com/MichaelCurrin/fractal" 7 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/vue/text.md: -------------------------------------------------------------------------------- 1 | # Text 2 | 3 | {% raw %} 4 | 5 | ## Space 6 | 7 | ```html 8 | {{ fruit }}{{ ' ' }} 9 | ``` 10 | 11 | {% endraw %} 12 | -------------------------------------------------------------------------------- /cheatsheets/other/vscode-extensions/workflows/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Guide to workflows so you can to export, install and publish a VSIX extension file 3 | --- 4 | # Workflows 5 | -------------------------------------------------------------------------------- /cheatsheets/sql/basic/manage-tables.md: -------------------------------------------------------------------------------- 1 | # Manage DB 2 | 3 | 4 | ## Drop 5 | 6 | ```sql 7 | DROP TABLE foo; 8 | ``` 9 | 10 | ```sql 11 | DROP TABLE IF EXISTS foo; 12 | ``` 13 | -------------------------------------------------------------------------------- /cheatsheets/tools/index.md: -------------------------------------------------------------------------------- 1 | # Tools 2 | 3 | 4 | ### Related 5 | 6 | - [AWS CLI][] in Python libraries section. 7 | 8 | [AWS CLI]: {% link cheatsheets/python/libraries/aws-cli.md %} 9 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/react/hooks/custom-hooks.md: -------------------------------------------------------------------------------- 1 | # Custom hooks 2 | 3 | Build your own custom Hooks if you have stateful logic that needs to be reused in several components. 4 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/liquid/comment.md: -------------------------------------------------------------------------------- 1 | # Comment 2 | 3 | {% raw %} 4 | 5 | ```liquid 6 | {% comment %} 7 | Comment message 8 | {% endcomment %} 9 | ``` 10 | 11 | {% endraw %} 12 | -------------------------------------------------------------------------------- /cheatsheets/version-control/git/committing/skip-hooks.md: -------------------------------------------------------------------------------- 1 | # Skip hooks 2 | 3 | If you have commit hooks like linting. 4 | 5 | ```sh 6 | $ git commit --no-verify 7 | $ git commit -n 8 | ``` 9 | -------------------------------------------------------------------------------- /hooks/pre-push: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | # On a feature branch that has no remote yet, this first part would fail. 4 | git pull --rebase || git pull --rebase origin master 5 | 6 | make all 7 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/configuration/null-values.md: -------------------------------------------------------------------------------- 1 | # Null values 2 | 3 | ```yaml 4 | foo: null 5 | bar: "" 6 | baz: 7 | ``` 8 | 9 | Note that YAML uses `null`, while Ruby uses `nil`. 10 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/python/pip/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # pip 4 | 5 | 6 | ### Releases of pip 7 | 8 | - [pip](https://pypi.org/project/pip/) project on PyPI. See Release History. 9 | -------------------------------------------------------------------------------- /cheatsheets/web/css/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | logo: css3 3 | description: Cascading Style Sheets (CSS) is a language used most often to style and improve upon the appearance of views. 4 | --- 5 | # CSS 6 | -------------------------------------------------------------------------------- /cheatsheets/python/project-administration/linting/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # Linting 4 | 5 | Some VS Code choices - there are flags for each (so multiple can be used), plus a linting enabled switch. 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | 7 | [*.{html,md}] 8 | indent_size = 4 9 | 10 | [Makefile] 11 | indent_style = tab 12 | indent_size = 4 13 | -------------------------------------------------------------------------------- /cheatsheets/ci-cd/netlify/functions/index.md: -------------------------------------------------------------------------------- 1 | # Functions 2 | 3 | 4 | ### Related 5 | 6 | - [Netlify Functions](https://michaelcurrin.github.io/code-cookbook/recipes/ci-cd/netlify/functions/) recipes. 7 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/cli/container.md: -------------------------------------------------------------------------------- 1 | # Container 2 | 3 | For running Jekyll with Docker, see the [Jekyll Containers](https://michaelcurrin.github.io/code-cookbook/recipes/containers/jekyll.html) recipe. 4 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/overview.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Overview 3 | description: Concise view of Jekyll Liquid syntax available 4 | --- 5 | 6 | - [All filters]({% link cheatsheets/jekyll/liquid/all-filters.md %}) 7 | -------------------------------------------------------------------------------- /cheatsheets/rust/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Rust 3 | logo: rust 4 | --- 5 | 6 | 7 | ### Related 8 | 9 | - [Rust](https://michaelcurrin.github.io/dev-resources/resources/rust) in Dev Resources. 10 | -------------------------------------------------------------------------------- /cheatsheets/web/http-status-codes.md: -------------------------------------------------------------------------------- 1 | # HTTP status codes 2 | 3 | - [List of HTTP status codes](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) on Wikipedia 4 | - [http.cat/](https://http.cat/) 5 | -------------------------------------------------------------------------------- /cheatsheets/javascript/browser/design-mode.md: -------------------------------------------------------------------------------- 1 | # Design mode 2 | 3 | ## Turn on 4 | 5 | ```javascript 6 | document.designMode = "on" 7 | ``` 8 | 9 | Now you can click and edit text on a website. 10 | -------------------------------------------------------------------------------- /cheatsheets/make/variables/date.md: -------------------------------------------------------------------------------- 1 | # Date 2 | 3 | Use the `date` command for the current time and format as date and time. 4 | 5 | ```makefile 6 | BUILD_DATE = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ") 7 | ``` 8 | -------------------------------------------------------------------------------- /cheatsheets/web/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | logo: html5 3 | --- 4 | # Web 5 | 6 | ### Related 7 | 8 | - [Browser][] in the JS section. 9 | 10 | [Browser]: {% link cheatsheets/javascript/browser/index.md %} 11 | -------------------------------------------------------------------------------- /cheatsheets/javascript/format-and-lint/eslint/rules/index.md: -------------------------------------------------------------------------------- 1 | # Rules 2 | 3 | See the [Rules](https://eslint.org/docs/rules/) page in the ESLint docs. It provides descriptions and link to the page of each rule. 4 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/ruby/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Ruby 3 | logo: ruby 4 | --- 5 | 6 | 7 | 8 | ### Related 9 | 10 | - [Jekyll Plugins]({% link cheatsheets/jekyll/plugins/index.md %}) section. 11 | -------------------------------------------------------------------------------- /cheatsheets/typescript/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | logo: typescript 3 | --- 4 | # TypeScript 5 | 6 | See [TypeScript](https://michaelcurrin.github.io/dev-resources/resources/javascript/typescript/) in Dev Resources site. 7 | -------------------------------------------------------------------------------- /cheatsheets/version-control/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | logo: git 3 | --- 4 | # Version control 5 | 6 | See [Version control](https://michaelcurrin.github.io/dev-resources/resources/version-control/) in my Dev Resources. 7 | -------------------------------------------------------------------------------- /cheatsheets/markdown/wiki.md: -------------------------------------------------------------------------------- 1 | # Wiki 2 | 3 | Note that if you editing markdown content in a GitHub, the rules are different for some elements. See this [gist](https://gist.github.com/subfuzion/0d3f19c4f780a7d75ba2). 4 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/ruby/bundler/clean.md: -------------------------------------------------------------------------------- 1 | # Clean 2 | 3 | ```sh 4 | $ bundle clean 5 | ``` 6 | 7 | ```sh 8 | $ bundle pristine [GEMS...] # Restores installed gems to pristine condition 9 | ``` 10 | -------------------------------------------------------------------------------- /cheatsheets/shell/commands/dig.md: -------------------------------------------------------------------------------- 1 | # dig 2 | 3 | 4 | ## Basic 5 | 6 | ```sh 7 | $ dig example.com 8 | ``` 9 | 10 | 11 | ## Trace 12 | 13 | ```sh 14 | $ dig @8.8.8.8 A example.com +noedns +trace 15 | ``` 16 | -------------------------------------------------------------------------------- /cheatsheets/python/tests/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Cheatsheets for testing in Python 3 | --- 4 | # Tests 5 | 6 | 7 | See [Getting started with testing in Python](https://realpython.com/python-testing/) on RealPython. 8 | -------------------------------------------------------------------------------- /cheatsheets/terraform/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Terraform 3 | logo: terraform 4 | --- 5 | 6 | 7 | ### Resources 8 | 9 | - [Terraform](https://michaelcurrin.github.io/dev-resources/resources/) in Dev Resources. 10 | -------------------------------------------------------------------------------- /docs/development.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Notes for developers working on this project 3 | --- 4 | # Development 5 | 6 | See [Development](https://github.com/MichaelCurrin/fractal/tree/master/docs/development/) in the theme. 7 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/configuration/load-multiple-configs.md: -------------------------------------------------------------------------------- 1 | # Load multiple configs 2 | 3 | Use a comma and no spaces. 4 | 5 | ```sh 6 | $ bundle exec jekyll build --trace \ 7 | --config _config.yml,_config_prod.yml 8 | ``` 9 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/plugins/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # Plugins 4 | 5 | 6 | Note that Jekyll plugins are just Ruby gems set up to work in a Jekyll project. 7 | 8 | Some Jekyll gems are not plugins, like a theme or Jekyll itself. 9 | -------------------------------------------------------------------------------- /cheatsheets/python/project-administration/formatting.md: -------------------------------------------------------------------------------- 1 | # Formatting 2 | 3 | Some VS Code choices - this is a free text field for provider, plug configurations for each. 4 | 5 | - autopep8 6 | - black (PY 3 only) 7 | - yapf 8 | -------------------------------------------------------------------------------- /cheatsheets/web/html/content-editable.md: -------------------------------------------------------------------------------- 1 | # content editable 2 | 3 | The attribute specifies whether the content of an element is editable or not. 4 | 5 | ```htmk 6 |
An editable paragraph.
7 | ``` 8 | -------------------------------------------------------------------------------- /cheatsheets/ci-cd/netlify/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Netlify 3 | logo: netlify 4 | --- 5 | 6 | 7 | ### Related 8 | 9 | - [Netlify](https://michaelcurrin.github.io/dev-resources/resources/ci-cd/netlify/) under Dev Resources. 10 | -------------------------------------------------------------------------------- /cheatsheets/containers/podman/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Podman 3 | description: Drop-in replacement for Docker 4 | --- 5 | 6 | Accessible with commands the same as Docker CLI. 7 | 8 | For more info see [podman.io](https://podman.io). 9 | -------------------------------------------------------------------------------- /cheatsheets/make/variables/index.md: -------------------------------------------------------------------------------- 1 | # Variables 2 | 3 | Variables are sometimes useful to define at the top of your `Makefile`. These can be fixed values to be reused across your file. Or they could be dynamic like a list of files. 4 | -------------------------------------------------------------------------------- /cheatsheets/other/regex/repeat.md: -------------------------------------------------------------------------------- 1 | # Repeat 2 | 3 | ```re 4 | \w+ 5 | \w* 6 | \w? 7 | 8 | \w{2} 9 | \w{4} 10 | \w{2,4} 11 | ``` 12 | 13 | 14 | Find lines longer than 80 characters: 15 | 16 | ``` 17 | .{81,200} 18 | ``` 19 | -------------------------------------------------------------------------------- /cheatsheets/version-control/git/committing/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # Committing 4 | 5 | See [Authors][] cheatsheet for how to change the author of a commit. 6 | 7 | [Authors]: {% link cheatsheets/version-control/git/authors.md %} 8 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Dev Cheatsheets documentation 2 | 3 | - [Installation](installation.md) 4 | - [Usage](usage.md) 5 | - [Deploy](deploy.md) 6 | - [Development](development.md) 7 | 8 | See also [Contributing](/CONTRIBUTING.md) guide. 9 | -------------------------------------------------------------------------------- /cheatsheets/powershell/files.md: -------------------------------------------------------------------------------- 1 | # Files 2 | 3 | ## Write to a file 4 | 5 | ```sh 6 | COMMAND | Set-Content -Path OUT_PATH 7 | ``` 8 | 9 | e.g. 10 | 11 | ```sh 12 | kubectl logs my-pod | Set-Content -Path my-log.txt 13 | ``` 14 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/vue/directives/v-bind.md: -------------------------------------------------------------------------------- 1 | # v-bind 2 | 3 | ## Resources 4 | 5 | - [Form input bindings](https://v3.vuejs.org/guide/forms.html) 6 | - [v-bind migration to Vue 3](https://v3.vuejs.org/guide/migration/v-bind.html) 7 | -------------------------------------------------------------------------------- /cheatsheets/markdown/emojis.md: -------------------------------------------------------------------------------- 1 | # Emojis 2 | 3 | Note, this works in GitHub-flavored Markdown, but might not work in certain markdown viewers unless you use a plugin. 4 | 5 | ```markdown 6 | :sparkles: 7 | ``` 8 | 9 | :sparkles: 10 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/javascript/yarn/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Yarn 3 | logo: yarn 4 | --- 5 | 6 | 7 | ### Resources 8 | 9 | - [Yarn](https://michaelcurrin.github.io/dev-resources/resources/package-managers/javascript/yarn/) 10 | -------------------------------------------------------------------------------- /cheatsheets/shell/commands/grep/regex-patterns/index.md: -------------------------------------------------------------------------------- 1 | # Regex patterns 2 | 3 | 4 | Grep supports three types of Regex: 5 | 6 | 1. Basic (BRE) 7 | 2. Extended (ERE) 8 | 3. Perl (PCRE) 9 | 10 | See the other pages for using each. 11 | -------------------------------------------------------------------------------- /cheatsheets/typescript/run.md: -------------------------------------------------------------------------------- 1 | # Run 2 | > How to run TypeScript files without converting to JS 3 | 4 | ```sh 5 | $ npx --yes ts-node PATH 6 | ``` 7 | 8 | Or setup an alias: 9 | 10 | ```sh 11 | alias ts='npx --yes ts-node' 12 | ``` 13 | -------------------------------------------------------------------------------- /cheatsheets/web/seo/sitemaps.md: -------------------------------------------------------------------------------- 1 | # Sitemaps 2 | 3 | ## Resources 4 | 5 | - [Learn about sitemaps](https://support.google.com/webmasters/answer/156184?hl=en&ref_topic=4581190&visit_id=637252521210246285-24299986&rd=1) on Google support docs. 6 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/javascript/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | logo: javascript 3 | --- 4 | # JavaScript 5 | 6 | 7 | ### Related sections 8 | 9 | - [Install]({% link cheatsheets/javascript/node/install.md %}) guide for Node, NPM and Yarn. 10 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/ruby/gem/show.md: -------------------------------------------------------------------------------- 1 | # Show 2 | 3 | ```sh 4 | $ gem list 5 | $ gem list D # Filter to names starting with string. 6 | ``` 7 | 8 | ```sh 9 | $ bundle list 10 | ``` 11 | 12 | ```sh 13 | $ gem environment 14 | ``` 15 | -------------------------------------------------------------------------------- /cheatsheets/shell/cross-language.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: How to run a shell command from another language 3 | --- 4 | # Cross language 5 | 6 | - [Python]({% link cheatsheets/python/shell.md %}) 7 | - [Ruby]({% link cheatsheets/ruby/shell.md %}) 8 | -------------------------------------------------------------------------------- /cheatsheets/shell/files/text-files/combine.md: -------------------------------------------------------------------------------- 1 | # Combine 2 | 3 | Mix two files together. 4 | 5 | This will read the contents of the one file and append it to the end of another file. 6 | 7 | ```sh 8 | $ < file-a.txt >> file-b.txt 9 | ``` 10 | -------------------------------------------------------------------------------- /cheatsheets/terraform/code/conditionals.md: -------------------------------------------------------------------------------- 1 | # Conditionals 2 | 3 | ## Ternary 4 | 5 | ```terraform 6 | condition ? true_val : false_val 7 | ``` 8 | 9 | e.g. 10 | 11 | ```terraform 12 | foo = var.abc === true ? "dev" : "prod" 13 | ``` 14 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/javascript/yarn/commands/add.md: -------------------------------------------------------------------------------- 1 | # add 2 | 3 | See [yarn add](https://classic.yarnpkg.com/en/docs/cli/add) docs. 4 | 5 | ```sh 6 | $ yarn add PACKAGE 7 | ``` 8 | 9 | ```sh 10 | $ yarn add PACKAGE --dev 11 | ``` 12 | -------------------------------------------------------------------------------- /cheatsheets/tools/helm.md: -------------------------------------------------------------------------------- 1 | # Helm 2 | 3 | - [helm.sh](https://helm.sh) 4 | - [docs](https://duckduckgo.com/?q=helm+cli&t=ffab&ia=web) 5 | 6 | ```sh 7 | $ helm histoy RELEASE NAME 8 | ``` 9 | 10 | ```sh 11 | $ helm delete RELEASE NAME 12 | ``` 13 | -------------------------------------------------------------------------------- /cheatsheets/javascript/format-and-lint/eslint/install.md: -------------------------------------------------------------------------------- 1 | # Install 2 | 3 | 4 | ## Install in project 5 | 6 | ```sh 7 | $ npm install eslint --save-dev 8 | ``` 9 | 10 | ## Install globally 11 | 12 | ```sh 13 | $ npm install eslint -g 14 | ``` 15 | -------------------------------------------------------------------------------- /cheatsheets/javascript/format-and-lint/prettier/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Prettier 3 | description: Format your JS scripts with Prettier 4 | --- 5 | 6 | > Prettier is an opinionated code formatter. Use Prettier for formatting and linters for catching bugs. 7 | -------------------------------------------------------------------------------- /cheatsheets/version-control/github/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | logo: github 3 | --- 4 | # GitHub 5 | 6 | 7 | ### Related 8 | 9 | - [GitHub SSH keys](https://michaelcurrin.github.io/code-cookbook/recipes/shell/ssh/github-ssh-access.html) in Code Cookbook. 10 | -------------------------------------------------------------------------------- /cheatsheets/javascript/general/request/http.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: http 3 | description: Built-in for Node 4 | --- 5 | 6 | See `http.get` or `http.request` in the Node API docs. 7 | 8 | 9 | - [http](https://nodejs.org/dist/latest/docs/api/http.htm) module 10 | -------------------------------------------------------------------------------- /cheatsheets/version-control/git/commands/gc.md: -------------------------------------------------------------------------------- 1 | # gc 2 | 3 | [git-gc](https://git-scm.com/docs/git-gc) docs 4 | 5 | 6 | If you have issues pushing your code, you can try using this to clean up the local objects. 7 | 8 | ```sh 9 | $ git gc 10 | ``` 11 | -------------------------------------------------------------------------------- /cheatsheets/version-control/git/resources.md: -------------------------------------------------------------------------------- 1 | # Resources 2 | 3 | Provided on the git website: 4 | 5 | - Downloadable [cheatsheet](https://github.github.com/training-kit/) provided by GitHub 6 | - [Visual cheatsheet](https://ndpsoftware.com/git-cheatsheet.html) 7 | -------------------------------------------------------------------------------- /cheatsheets/web/html/selection.md: -------------------------------------------------------------------------------- 1 | # Selection 2 | 3 | > Using CSS selectors 4 | 5 | Style an element based on state. 6 | 7 | - [CSS checked selector](https://www.geeksforgeeks.org/css-checked-selector/) reference. For radio buttons, checkbox and option elements 8 | -------------------------------------------------------------------------------- /cheatsheets/javascript/deno/package-list/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Package list 3 | description: Ways to put your external package dependencies in a central place 4 | --- 5 | 6 | See docs - [Linking to external code](https://deno.land/manual/linking_to_external_code) 7 | -------------------------------------------------------------------------------- /cheatsheets/shell/hardware.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Hardware 3 | description: Get info on your hardware from the shell 4 | --- 5 | 6 | 7 | ## Number of processes 8 | 9 | On Linux and macOS: 10 | 11 | ```console 12 | $ getconf _NPROCESSORS_ONLN 13 | 8 14 | ``` 15 | -------------------------------------------------------------------------------- /cheatsheets/shell/ssh/index.md: -------------------------------------------------------------------------------- 1 | # SSH 2 | 3 | ### Related 4 | 5 | - [SSH](https://michaelcurrin.github.io/code-cookbook/recipes/shell/ssh/) section of my Code Cookbook project. 6 | - [SSH command][] 7 | 8 | [SSH command]: {% link cheatsheets/shell/commands/ssh.md %} 9 | -------------------------------------------------------------------------------- /cheatsheets/data/toml/data-types.md: -------------------------------------------------------------------------------- 1 | # Data types 2 | 3 | The syntax is similar Python's. 4 | 5 | ```toml 6 | [datatypes] 7 | my_string = "abc def" 8 | my_int = 123 9 | my_list = [ 123, 456 ] 10 | my_hash = { abc = 123, def = 456 } 11 | my_bool = true 12 | ``` 13 | -------------------------------------------------------------------------------- /cheatsheets/python/libraries/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # Packages 4 | 5 | For installing 3rd-party packages in Python, see the [Package managers][] Python cheatsheets. 6 | 7 | [Package managers]: {% link cheatsheets/package-managers/python/index.md %} 8 | 9 | 10 | -------------------------------------------------------------------------------- /cheatsheets/ci-cd/circleci/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CircleCI 3 | logo: circleci 4 | --- 5 | 6 | See also [CircleCI](https://michaelcurrin.github.io/code-cookbook/recipes/ci-cd/circle-ci/) Cookbook section. 7 | 8 | [Concepts](https://circleci.com/docs/2.0/concepts/) in the docs. 9 | -------------------------------------------------------------------------------- /cheatsheets/javascript/format-and-lint/eslint/config-files/index.md: -------------------------------------------------------------------------------- 1 | # Config files 2 | 3 | See the [ESLint](https://michaelcurrin.github.io/code-cookbook/recipes/javascript/format-and-lint/eslint.html) section of my Code Cookbook for entire configs you can copy and paste. 4 | 5 | -------------------------------------------------------------------------------- /cheatsheets/python/type-checks/data-structures/tuple.md: -------------------------------------------------------------------------------- 1 | # Tuple 2 | 3 | ```python 4 | Tuple[TYPE, TYPE, ...] 5 | ``` 6 | 7 | e.g. 8 | 9 | ```python 10 | from typing import Tuple 11 | 12 | 13 | def foo() -> Tuple[bool, str]: 14 | return True, 'Yes' 15 | ``` 16 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/dependencies/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Dependencies 3 | description: Managing gems in a Jekyll site 4 | --- 5 | 6 | ## Related 7 | 8 | - [Bundler]({% link cheatsheets/package-managers/ruby/bundler/index.md %}) section - for installing gems in your Jekyll project. 9 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/liquid/hashes.md: -------------------------------------------------------------------------------- 1 | # Hashes 2 | 3 | {% raw %} 4 | 5 | 6 | Get a value on a hash. 7 | 8 | ```liquid 9 | {{ my_hash.some_key }} 10 | {{ my_hash['some_key'] }} 11 | ``` 12 | 13 | You can't use `assign` to set a value in an array. 14 | 15 | {% endraw %} 16 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/liquid/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Liquid 3 | description: Guide to Liquid templating syntax in Jekyll 4 | --- 5 | 6 | 7 | See also [Templating][] cheatsheets for using this in Jekyll. 8 | 9 | [Templating]: {% link cheatsheets/jekyll/templating/index.md %} 10 | -------------------------------------------------------------------------------- /cheatsheets/shell/commands/read-write/head.md: -------------------------------------------------------------------------------- 1 | # head 2 | 3 | 4 | ## Start of file 5 | 6 | Get the fiirst 10 lines of a file. 7 | 8 | ```sh 9 | $ head file.txt 10 | ``` 11 | 12 | Get the first 100 lines of a file. 13 | 14 | ```sh 15 | $ head -n 100 file.txt 16 | ``` 17 | -------------------------------------------------------------------------------- /cheatsheets/version-control/github/api/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: API 3 | description: About the GitHub APIs 4 | --- 5 | 6 | 7 | ### Related 8 | 9 | - [GitHub API](https://michaelcurrin.github.io/dev-resources/resources/version-control/github/api/) in Dev Resources. 10 | 11 | -------------------------------------------------------------------------------- /cheatsheets/powershell/execution-policy.md: -------------------------------------------------------------------------------- 1 | # Execution policy 2 | 3 | Based on [docs](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy). 4 | 5 | ```sh 6 | Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine 7 | ``` 8 | -------------------------------------------------------------------------------- /cheatsheets/python/virtual-environments.md: -------------------------------------------------------------------------------- 1 | # Virtual environments 2 | 3 | 4 | ## Create 5 | 6 | ```sh 7 | $ python -m venv venv 8 | ``` 9 | 10 | 11 | ## Activate 12 | 13 | ```sh 14 | $ source venv/bin/activate 15 | ``` 16 | 17 | ```sh 18 | > venv\Scripts\activate 19 | ``` 20 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | // Use "Jekyll (HTML)" so that Jekyll Liquid syntax is picked up correctly for validation and highlighting. 4 | // Remember to switch a script to HTML though, when you want formatting. 5 | "*.html": "jekyll", 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /cheatsheets/javascript/node/classes.md: -------------------------------------------------------------------------------- 1 | # Classes 2 | 3 | ```javascript 4 | export default class Foo extends Bar { 5 | constructor(props) { 6 | super(props); 7 | console.log('Setting up a Foo'); 8 | } 9 | 10 | fizz() { 11 | return 'Buzz'; 12 | } 13 | } 14 | ``` 15 | -------------------------------------------------------------------------------- /cheatsheets/terraform/atlantis.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Atlantis 3 | 4 | description: Terraform Pull Request Automation 5 | --- 6 | 7 | [https://www.runatlantis.io/](https://www.runatlantis.io/) homepage 8 | 9 | [runatlantis/atlantis](https://github.com/runatlantis/atlantis) on GitHub 10 | -------------------------------------------------------------------------------- /cheatsheets/make/copy.md: -------------------------------------------------------------------------------- 1 | # Copy 2 | 3 | This will make sure the order-only prerequisite exists (`abc.example.txt`) and then copy it to the target (`abc.txt`). 4 | ```make 5 | abc.txt: | abc.example.txt 6 | cp $| $@ 7 | ``` 8 | 9 | Usage: 10 | 11 | ```sh 12 | $ make abc.txt 13 | ``` 14 | -------------------------------------------------------------------------------- /cheatsheets/shell/architecture.md: -------------------------------------------------------------------------------- 1 | # Architecture 2 | 3 | With `dpkg`: 4 | 5 | ```console 6 | $ dpkg --print-architecture 7 | amd64 8 | ``` 9 | 10 | With [uname][] 11 | 12 | [uname]: {% link cheatsheets/shell/commands/uname.md %} 13 | 14 | ```console 15 | $ uname -m 16 | x86_64 17 | ``` 18 | -------------------------------------------------------------------------------- /cheatsheets/typescript/ignoring-rules.md: -------------------------------------------------------------------------------- 1 | # Ignoring rules 2 | 3 | Ignore on the next line. 4 | 5 | ```typescript 6 | // @ts-ignore 7 | myCode 8 | ``` 9 | 10 | Also ignore on the next line but require an error to exist. 11 | 12 | ```typescript 13 | // @ts-expect-error 14 | myCode 15 | ``` 16 | -------------------------------------------------------------------------------- /cheatsheets/ci-cd/circleci/definitions.md: -------------------------------------------------------------------------------- 1 | # Definitions 2 | 3 | - A **pipeline** is the full set of processes that run when you trigger work on your projects. 4 | - **Workflows** define a list of jobs and their run order. 5 | - **Jobs** are the building blocks of your config, which run commands and scripts. 6 | -------------------------------------------------------------------------------- /cheatsheets/javascript/format-and-lint/prettier/resources.md: -------------------------------------------------------------------------------- 1 | # Resources 2 | 3 | - [Prettier](https://prettier.io/) homepage 4 | - [Configuration file](https://prettier.io/docs/en/configuration.html) 5 | - [Options](https://prettier.io/docs/en/options.html) 6 | - [Ignore](https://prettier.io/docs/en/ignore.html) 7 | -------------------------------------------------------------------------------- /cheatsheets/javascript/general/object-shorthand.md: -------------------------------------------------------------------------------- 1 | # Object shorthand 2 | 3 | ```javascript 4 | const x = 123 5 | 6 | const y = { 7 | x 8 | } 9 | 10 | y 11 | // { x: 123 } 12 | ``` 13 | 14 | That is the equivalent of setting: 15 | 16 | ```javascript 17 | const y = { 18 | x: x 19 | } 20 | ``` 21 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/configuration/urls.md: -------------------------------------------------------------------------------- 1 | # URLs 2 | 3 | Include protocol. No trailing forwardslash. 4 | ```yaml 5 | url: "http://example.com" 6 | ``` 7 | 8 | ```yaml 9 | baseurl: "" 10 | baseurl: "/my-repo" 11 | ``` 12 | 13 | If not empty, must start with a forwardlash and not end with one, as above. 14 | -------------------------------------------------------------------------------- /cheatsheets/go/packages/time.md: -------------------------------------------------------------------------------- 1 | # time 2 | 3 | Docs: [time](https://golang.org/pkg/time/) in standard lib. 4 | 5 | ```go 6 | time.Now() 7 | time.Now().String() 8 | ``` 9 | 10 | ```sh 11 | $ godoc time Now String 12 | PACKAGE DOCUMENTATION 13 | 14 | package time 15 | import "time" 16 | ... 17 | ``` 18 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/python/pip/resources.md: -------------------------------------------------------------------------------- 1 | # Resources 2 | 3 | - [pip docs](https://pip.readthedocs.io/) 4 | - [pip on PyPI](https://pypi.org/project/pip/) 5 | - My [Installation](https://github.com/MichaelCurrin/python-package-quickstart/blob/master/docs/installation.md) guide on my Quickstart project. 6 | -------------------------------------------------------------------------------- /cheatsheets/python/configs/python.md: -------------------------------------------------------------------------------- 1 | # Python modules as configs 2 | 3 | Various ways to store config values. 4 | 5 | Such as `config.py` or `setup.py`. 6 | 7 | If the file should be for local use only and ignored by `git`, then use `config.local.py` or `config_local.py`. And perhaps supply `config.template.py`. 8 | -------------------------------------------------------------------------------- /cheatsheets/shell/files/text-files/clipboard.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Copy to and paste from clipboard. Especially useful for very large files or when you use SSH with no GUI. 3 | --- 4 | # Clipboard 5 | 6 | 7 | See [Clipboard commands]({% link cheatsheets/shell/commands/clipboard/index.md %}) cheatsheet section. 8 | -------------------------------------------------------------------------------- /cheatsheets/web/seo/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # SEO 4 | 5 | 6 | - [Guidelines](https://support.google.com/webmasters/answer/9526064?hl=en&ref_topic=9456575) on Google support. 7 | - [Crawling and indexing overview](https://support.google.com/webmasters/topic/9427949?hl=en&ref_topic=9428048) on Google support docs. 8 | -------------------------------------------------------------------------------- /cheatsheets/javascript/format-and-lint/eslint/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: ESLint 3 | description: Find and fix problems in your JS code 4 | --- 5 | 6 | ### About 7 | 8 | ESLint can statically analyze your JS code to find and fix problems. 9 | 10 | It can check syntax that is invalid. It gives errors and warnings. 11 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/dataviz/apex-charts/index.md: -------------------------------------------------------------------------------- 1 | # ApexCharts 2 | 3 | 4 | Note that mixed Y axes are only allowed for line chart (not bar) and that must also be standard orientation. 5 | 6 | See also [Dev Resources](https://michaelcurrin.github.io/dev-resources/resources/javascript/packages/dataviz/apex-charts/). 7 | -------------------------------------------------------------------------------- /cheatsheets/python/strings/wrap.md: -------------------------------------------------------------------------------- 1 | 2 | # Wrap 3 | 4 | Using the built-in `textwrap` module. 5 | 6 | 7 | ## Dedent 8 | 9 | Remove common whitespace. 10 | 11 | ```python 12 | text = textwrap.dedent("""\ 13 | a 14 | b 15 | c 16 | """) 17 | print(text) 18 | ``` 19 | ``` 20 | a 21 | b 22 | c 23 | ``` 24 | -------------------------------------------------------------------------------- /cheatsheets/shell/scripting/control-flow/and-or.md: -------------------------------------------------------------------------------- 1 | # AND OR 2 | 3 | ## AND 4 | 5 | ```sh 6 | [[ EXPRESSION ]] && [[ EXPRESSION ]] 7 | ``` 8 | 9 | That is preferred to: 10 | 11 | ```sh 12 | [[ EXPRESSION && EXPRESSION ]] 13 | ``` 14 | 15 | ## OR 16 | 17 | ```sh 18 | [[ EXPRESSION ]] || [[ EXPRESSION ]] 19 | ``` 20 | -------------------------------------------------------------------------------- /cheatsheets/shell/scripting/control-flow/if-else.md: -------------------------------------------------------------------------------- 1 | # if else 2 | 3 | Use with `if`. 4 | 5 | ```sh 6 | if true; then 7 | echo 'True!' 8 | fi 9 | # True! 10 | ``` 11 | 12 | Use with `if` and `else`. 13 | 14 | ```sh 15 | if true; then 16 | echo 'True!' 17 | else 18 | echo 'False!' 19 | fi 20 | # True! 21 | ``` 22 | -------------------------------------------------------------------------------- /cheatsheets/version-control/github/api/v3/limitations.md: -------------------------------------------------------------------------------- 1 | # Limitations 2 | 3 | > Unauthenticated clients can make 60 requests per hour. To get more requests per hour, we'll need to _authenticate_. In fact, doing anything interesting with the GitHub API requires [authentication](https://developer.github.com/v3/#authentication). 4 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/javascript/yarn/commands/install.md: -------------------------------------------------------------------------------- 1 | # install 2 | 3 | See [yarn install](https://classic.yarnpkg.com/en/docs/cli/install/) docs. 4 | 5 | 6 | ```sh 7 | $ yarn install 8 | ``` 9 | 10 | ```sh 11 | $ yarn install --frozen-lockfile 12 | ``` 13 | 14 | ```sh 15 | $ yarn install --silent 16 | ``` 17 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/python/pip/overview.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | 4 | - `pip install PACKAGE` 5 | - `pip install PACKAGE==VERSION` 6 | - `pip install PACKAGE --user` 7 | - `pip install PACKAGE -U|--upgrade` 8 | - `pip install -r REQUIREMENTS_TXT_PATH` 9 | - `pipinstall pip --upgrade` 10 | - ` pipuninstall PACKAGE` 11 | -------------------------------------------------------------------------------- /cheatsheets/python/strings/index.md: -------------------------------------------------------------------------------- 1 | # Strings 2 | 3 | 4 | ### Resources 5 | 6 | - Python docs 7 | - [Built-in types - String methods](https://docs.python.org/3/library/stdtypes.html#string-methods) 8 | - [string — Common string operations](https://docs.python.org/3/library/string.html) from Python standard library docs. 9 | -------------------------------------------------------------------------------- /cheatsheets/ruby/gems/index.md: -------------------------------------------------------------------------------- 1 | # Gems 2 | 3 | 4 | ### Related 5 | 6 | - [Jekyll][] section. 7 | - [Ruby package managers][] section for using Bundler and `gem` commands. 8 | 9 | 10 | [Jekyll]: {% link cheatsheets/jekyll/index.md %} 11 | [Ruby package managers]: {% link cheatsheets/package-managers/ruby/index.md %} 12 | -------------------------------------------------------------------------------- /cheatsheets/shell/scripting/control-flow/negate.md: -------------------------------------------------------------------------------- 1 | # Negate 2 | 3 | # Negate 4 | 5 | ```sh 6 | if ! false; then 7 | echo 'Yes!' 8 | fi 9 | ``` 10 | 11 | ```sh 12 | if [[ ! "$x" == 'abc' ]]; then 13 | echo 'Yes!' 14 | fi 15 | ``` 16 | 17 | ```sh 18 | if [[ "$x" != 'abc' ]]; then 19 | echo 'Yes!' 20 | fi 21 | ``` 22 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/ruby/bundler/subcommands/clean.md: -------------------------------------------------------------------------------- 1 | # clean subcommand 2 | 3 | Remove unused gems from the vendor directory. i.e. Remove the gems and subdependencies not covered by `Gemfile`. 4 | 5 | ```sh 6 | $ bundle clean 7 | ``` 8 | 9 | Dry run: 10 | 11 | ```sh 12 | $ bundle clean --dry-run 13 | ``` 14 | 15 | -------------------------------------------------------------------------------- /cheatsheets/shell/compression/view.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Look at the contents of a zipped file without unpacking it 3 | --- 4 | # View 5 | 6 | 7 | ```sh 8 | unzip -l ZIPPED_TARGET 9 | ``` 10 | 11 | ```sh 12 | tar ztvf TAR_ZIPPED_TARGET 13 | ``` 14 | 15 | ```sh 16 | view ZIPPED_TARGET 17 | 18 | vim ZIPPED_TARGET 19 | ``` 20 | -------------------------------------------------------------------------------- /cheatsheets/shell/files/text-files/open.md: -------------------------------------------------------------------------------- 1 | # Open 2 | 3 | See [open][] command for more info. 4 | 5 | ```sh 6 | $ open file.txt 7 | ``` 8 | 9 | [open]: {% link cheatsheets/shell/commands/open.md %} 10 | 11 | If you have this command enabled for your IDE. Use `code` for VS Code. 12 | 13 | ```sh 14 | $ code file.txt 15 | ``` 16 | -------------------------------------------------------------------------------- /cheatsheets/web/html/autofocus.md: -------------------------------------------------------------------------------- 1 | # Autofocus 2 | 3 | [Tutorial](https://www.w3schools.com/tags/att_input_autofocus.asp) 4 | 5 | The `autofocus` attribute is a boolean attribute. 6 | 7 | It specifies that an `input` element should get focus on the page load. 8 | 9 | e.g. 10 | 11 | ```html 12 | 13 | ``` 14 | -------------------------------------------------------------------------------- /cheatsheets/containers/kubernetes/cli/exec.md: -------------------------------------------------------------------------------- 1 | # exec command 2 | 3 | ## Interactive 4 | 5 | ```sh 6 | $ kubectl exec -it POD_NAME -- bash 7 | ``` 8 | 9 | ## Run command 10 | 11 | e.g. Running a Postgres dump command and writing the file. 12 | 13 | ```sh 14 | $ kubectl exec -it POD_NAME -- bash -c 'ls > my_files.txt' 15 | ``` 16 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/vue/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | logo: vuedotjs 3 | --- 4 | # Vue 5 | 6 | ### Related 7 | 8 | - [Vue in Dev Resources](https://michaelcurrin.github.io/dev-resources/resources/javascript/packages/vue/) 9 | - [Vue in Code Cookbook](https://michaelcurrin.github.io/code-cookbook/recipes/javascript/packages/vue/) 10 | -------------------------------------------------------------------------------- /cheatsheets/python/configs/toml.md: -------------------------------------------------------------------------------- 1 | # TOML 2 | 3 | ## Example 4 | 5 | 6 | `config.toml` 7 | 8 | 9 | ```toml 10 | [project] 11 | foo: "Bar" 12 | buzz: 123 13 | version: "1.0.0" 14 | updated: 1979-05-27T07:32:00Z 15 | 16 | ``` 17 | 18 | ```python 19 | import toml 20 | config = toml.load('config.toml') 21 | print(config) 22 | ``` 23 | -------------------------------------------------------------------------------- /cheatsheets/python/strings/case.md: -------------------------------------------------------------------------------- 1 | # Case 2 | 3 | 4 | ## Title case 5 | 6 | ```python 7 | >>> 'abc d'.title() 8 | 'Abc D' 9 | ``` 10 | 11 | 12 | ## Capitalize 13 | 14 | ```python 15 | >>> 'abc d'.capitalize() 16 | 'Abc d' 17 | ``` 18 | 19 | 20 | ## Uppercase 21 | 22 | ```python 23 | >>> 'abc d'.upper() 24 | 'ABC D' 25 | ``` 26 | -------------------------------------------------------------------------------- /cheatsheets/sql/replace.md: -------------------------------------------------------------------------------- 1 | # Replace 2 | 3 | ### Remove newline 4 | 5 | Replace newline with a space. 6 | 7 | `CHAR(13)` is carriage return and `CHAR(10)` is a line feed. Usually they are there together. 8 | 9 | ```sql 10 | SELECT 11 | REPLACE( REPLACE( foo, CHAR(13), ''), CHAR(10), ' ') AS foo 12 | FROM bar 13 | ; 14 | ``` 15 | -------------------------------------------------------------------------------- /cheatsheets/python/files-and-paths/read-and-write/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Read and write 3 | description: Guide to reading and writing files in Python - including text, JSON and CSVs 4 | --- 5 | 6 | ### Related 7 | 8 | - [Convert between file types](https://michaelcurrin.github.io/code-cookbook/recipes/python/convert-data.html) in Code Cookbook 9 | -------------------------------------------------------------------------------- /cheatsheets/web/html/open-graph.md: -------------------------------------------------------------------------------- 1 | # Open graph tags 2 | 3 | The Open Graph protocol - [ogp.me](https://ogp.me/) homepage. 4 | 5 | ## Sample 6 | 7 | ```html 8 | 9 | 10 | 11 | 12 | ``` 13 | -------------------------------------------------------------------------------- /cheatsheets/containers/kubernetes/cli/logs.md: -------------------------------------------------------------------------------- 1 | # Logs 2 | 3 | ```sh 4 | $ kubectl get logs POD_ID 5 | ``` 6 | 7 | For example 8 | 9 | 1. Use `kubectl get pods` to get a pod's ID (which changes on running a deploy). 10 | 1. Then run: 11 | ```sh 12 | $ kubectl get logs foobarb-backend-stg-abcd55cdc4-7qqxz 13 | ``` 14 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/npkill/index.md: -------------------------------------------------------------------------------- 1 | # npkill 2 | 3 | A command-line tool to help you find and delete unneeded `node_modules` directories. Using a GUI which is interactive. 4 | 5 | 6 | Choose a directory and run it there to find node packages at the current level and below. 7 | 8 | ```sh 9 | $ cd ~ 10 | $ npx npkill 11 | ``` 12 | -------------------------------------------------------------------------------- /cheatsheets/ruby/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | logo: ruby 3 | --- 4 | # Ruby 5 | 6 | 7 | ### Related 8 | 9 | - [Ruby]({% link cheatsheets/package-managers/ruby/index.md %}) under the Package Managers section - that covers using `gem` and `bundle` commands 10 | - [Ruby](https://michaelcurrin.github.io/d⁹ev-resources/resources/ruby/) in Dev Resources 11 | -------------------------------------------------------------------------------- /cheatsheets/web/html/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | logo: html5 3 | --- 4 | # HTML 5 | 6 | ### Related 7 | 8 | - [Markdown HTML]({% link cheatsheets/markdown/html.md %}) cheatsheet 9 | - [HTML](https://michaelcurrin.github.io/code-cookbook/recipes/web/html/) cookbook. 10 | - [Visual HTML Cheat Sheet](https://www.git-tower.com/learn/cheat-sheets/html) 11 | -------------------------------------------------------------------------------- /cheatsheets/python/libraries/database/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Databases 3 | --- 4 | 5 | If you need to handle raw SQL queries and no ORM: 6 | 7 | - Use SQLite library - already installed but only works with SQLite DBs. 8 | - Install and run SQLAlchemy or Peewee. See [pee-wee vs SQLAlchemy](https://stackshare.io/stackups/peewee-vs-sqlalchemy) comparison. 9 | -------------------------------------------------------------------------------- /cheatsheets/ruby/functions.md: -------------------------------------------------------------------------------- 1 | # Functions 2 | 3 | 4 | ## Basic 5 | 6 | ```ruby 7 | def foo(x) 8 | x*2 9 | end 10 | 11 | foo(5) 12 | # 10 13 | ``` 14 | 15 | 16 | ## Return tuple 17 | 18 | ```ruby 19 | def foo 20 | return "abc", 2, true 21 | end 22 | 23 | a, b, c = foo() 24 | a 25 | # "abc" 26 | b 27 | # 2 28 | c 29 | # true 30 | ``` 31 | -------------------------------------------------------------------------------- /cheatsheets/web/html/elements/abbr.md: -------------------------------------------------------------------------------- 1 | # abbr 2 | 3 | 4 | The `` tag defines an abbreviation or an acronym, like "HTML", "CSS" and shows the title when you hover this tag. 5 | 6 | 7 | ```html 8 |9 | I like CSS and HTML. 10 |
11 | ``` 12 | -------------------------------------------------------------------------------- /cheatsheets/containers/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Containers 3 | logo: docker 4 | description: Cheatsheets for building containerized applications with Docker, Docker-compose and Kubernetes 5 | --- 6 | 7 | 8 | ### Resources 9 | 10 | - [Containers](https://michaelcurrin.github.io/code-cookbook/recipes/containers/) section of my Code Cookbook project. 11 | -------------------------------------------------------------------------------- /cheatsheets/go/code/printing/log.md: -------------------------------------------------------------------------------- 1 | # log 2 | 3 | ```go 4 | import ( 5 | "log" 6 | ) 7 | ``` 8 | 9 | 10 | ## Print and exit 11 | 12 | The docstring says this is equivalent to calling `Print()` and `os.Exit(1)`. 13 | 14 | ```go 15 | err := foo() 16 | 17 | if err != nil { 18 | log.Fatal(err) 19 | } 20 | ``` 21 | 22 | You can also use `Fatalln`. 23 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/configuration/resources.md: -------------------------------------------------------------------------------- 1 | # Resources 2 | 3 | Jekyll docs. 4 | 5 | - [Configuration options](https://jekyllrb.com/docs/configuration/options/). That covers both CLI and config file options together. 6 | - [Frontmatter Defaults](https://jekyllrb.com/docs/configuration/front-matter-defaults/) - setting page values using the `defaults` field. 7 | -------------------------------------------------------------------------------- /cheatsheets/python/challenges.md: -------------------------------------------------------------------------------- 1 | # Challenges 2 | 3 | 4 | ## Fibonacci 5 | 6 | [Fibonacci sequence](https://www.mathsisfun.com/numbers/fibonacci-sequence.html) 7 | 8 | ### While loop 9 | 10 | ```python 11 | a, b = 0, 1 12 | while b < 10: 13 | a, b = b, a+b 14 | print(b) 15 | ``` 16 | ``` 17 | 1 18 | 2 19 | 3 20 | 5 21 | 8 22 | 13 23 | ``` 24 | -------------------------------------------------------------------------------- /cheatsheets/web/html/comments.md: -------------------------------------------------------------------------------- 1 | # Comments 2 | 3 | [W3 Schools](https://www.w3schools.com/html/html_comments.asp) tutorial. 4 | 5 | Add a note. 6 | 7 | ```html 8 | 9 | ``` 10 | 11 | Prevent code from running. 12 | 13 | ```html 14 | 17 | ``` 18 | -------------------------------------------------------------------------------- /cheatsheets/shell/files/text-files/view.md: -------------------------------------------------------------------------------- 1 | # View files 2 | 3 | - `less` 4 | - `more` 5 | - `view` 6 | - `cat` 7 | - `<` 8 | 9 | 10 | e.g. 11 | 12 | ```sh 13 | # Show entire file at once. 14 | cat file.txt 15 | 16 | # Page over large file. 17 | < file.txt 18 | view file.txt 19 | vim file.txt 20 | 21 | less file.txt 22 | 23 | more file.txt 24 | ``` 25 | -------------------------------------------------------------------------------- /cheatsheets/python/type-checks/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: How to add type safety to Python 3 | --- 4 | # Type checks 5 | 6 | In Python 3.6, type-hints were added as allowed syntax which can optionally be checked with a tool like Mypy. 7 | 8 | Getting started - see [Type hints cheat sheat](https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html) on the Mypy docs. 9 | -------------------------------------------------------------------------------- /cheatsheets/javascript/deno/managing-imports/inline.md: -------------------------------------------------------------------------------- 1 | 2 | # Inline 3 | 4 | - `index.ts` 5 | ```typescript 6 | import { assert, assertEquals, assertStrContains } from "https://deno.land/std@0.85.0/testing/asserts.ts"; 7 | 8 | assertEquals("hello", "hello"); 9 | assertEquals("world", "world"); 10 | 11 | console.log("Asserted! ✓"); 12 | ``` 13 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/ruby/bundler/list.md: -------------------------------------------------------------------------------- 1 | # List 2 | 3 | ```sh 4 | $ bundle list 5 | ``` 6 | ``` 7 | Gems included by the bundle: 8 | * addressable (2.7.0) 9 | * ... 10 | ``` 11 | 12 | Names of directories: 13 | 14 | ```sh 15 | $ ls vendor/bundle/ruby/2.6.0/gems 16 | ``` 17 | ``` 18 | addressable-2.7.0 i18n-0.9.5 ... 19 | ... 20 | ``` 21 | -------------------------------------------------------------------------------- /cheatsheets/shell/commands/ssh.md: -------------------------------------------------------------------------------- 1 | # ssh 2 | 3 | 4 | ## Basic 5 | 6 | ```sh 7 | $ ssh USERNAME@HOSTNAME 8 | ``` 9 | 10 | Or if your username is the same on both machines, or you've configured your SSH config. 11 | 12 | ```sh 13 | $ ssh HOSTNAME 14 | ``` 15 | 16 | 17 | ## Identity 18 | 19 | ```sh 20 | $ ssh USERNAME@HOSTNAME -i ~/.ssh/id_rsa_abc 21 | ``` 22 | -------------------------------------------------------------------------------- /cheatsheets/shell/scripting/control-flow/ignore.md: -------------------------------------------------------------------------------- 1 | # Ignore 2 | 3 | Have a command fail silently, or without breaking the flow. 4 | 5 | ```sh 6 | CMD || true 7 | ``` 8 | 9 | Optionally hide output. 10 | 11 | ```sh 12 | CMD > /dev/null || true 13 | ``` 14 | 15 | Or just 16 | 17 | ```sh 18 | set -e 19 | 20 | # ... 21 | 22 | set +e 23 | CMD 24 | set -e 25 | ``` 26 | -------------------------------------------------------------------------------- /cheatsheets/shell/batch.md: -------------------------------------------------------------------------------- 1 | # Batch 2 | 3 | How to perform multiple actions easily. 4 | 5 | Pipe output, use awk to get the first column, then split into separate commands. I think `xargs` is more efficient `for` loop and more inline with Functional Programming. 6 | 7 | ```sh 8 | FOO | \ 9 | awk '{print $1}' | \ 10 | xargs -I{} sh -c 'BAR "$1"' - {} 11 | ``` 12 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/dataviz/apex-charts/installation.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | ## Install with NPM 4 | 5 | ```sh 6 | $ npm install apexcharts 7 | ``` 8 | 9 | Then 10 | 11 | ```javascript 12 | import ApexCharts from 'apexcharts' 13 | ``` 14 | 15 | 16 | ## CDN 17 | 18 | ```html 19 | 20 | ``` 21 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/vue/components/conditional.md: -------------------------------------------------------------------------------- 1 | # Conditional 2 | 3 | {% raw %} 4 | 5 | ```html 6 |7 | {{ bazz }} 8 |
9 |10 | ... 11 |
12 |13 | ... 14 |
15 | ``` 16 | 17 | ```html 18 | 19 |{{ note }}
20 | 21 | ``` 22 | 23 | {% endraw %} 24 | -------------------------------------------------------------------------------- /cheatsheets/artificial-intelligence/deepseek/index.md: -------------------------------------------------------------------------------- 1 | # DeepSeek 2 | 3 | ### Models 4 | 5 | - [deepseek-coder](https://ollama.com/library/deepseek-coder) 6 | - [deepseek-coder-v2](https://ollama.com/library/deepseek-coder-v2) 7 | - [deepseek-r1](https://ollama.com/library/deepseek-r1) - range of models from 1GB to 400GB+ 8 | - [deepseek-v3](https://ollama.com/library/deepseek-v3) - 400GB+ 9 | -------------------------------------------------------------------------------- /cheatsheets/containers/colima/index.md: -------------------------------------------------------------------------------- 1 | # Colima 2 | 3 | Start in the foreground. 4 | 5 | ```sh 6 | colima start -f 7 | ``` 8 | 9 | Start SSH tunnel. 10 | 11 | ```sh 12 | colima ssh 13 | ``` 14 | 15 | Run command in the machine. 16 | 17 | ```sh 18 | colima ssh -- CMD 19 | # e.g. 20 | colima ssh -- sudo cp "/path/to/cert" /usr/local/share/ca-certificates/nscacert.crt 21 | ``` 22 | -------------------------------------------------------------------------------- /cheatsheets/go/code/printing/index.md: -------------------------------------------------------------------------------- 1 | # Printing 2 | 3 | This summarizes some of the most likely printing scenarios you'll encounter. 4 | 5 | Read more on the [fmt][] package cheatsheet or the documentation linked from there. 6 | 7 | See also [Go by Example: String Formatting](https://gobyexample.com/string-formatting) 8 | 9 | [fmt]: {% link cheatsheets/go/packages/fmt.md %} 10 | -------------------------------------------------------------------------------- /cheatsheets/python/tests/nose.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Python package. Uses unittest-style tests. More advanced than PyTest and it recommends PyTest for starting out. 3 | --- 4 | # Nose 5 | 6 | - [nose docs](https://nose.readthedocs.io/en/latest/) 7 | 8 | ## Install 9 | 10 | ```sh 11 | $ pip install nose 12 | ``` 13 | 14 | ## Run tests 15 | 16 | ```sh 17 | $ nosetests 18 | ``` 19 | -------------------------------------------------------------------------------- /cheatsheets/shell/scripting/control-flow/true-false.md: -------------------------------------------------------------------------------- 1 | # true false 2 | 3 | These are built in commands. 4 | 5 | ```sh 6 | $ true 7 | ``` 8 | 9 | ```sh 10 | $ false 11 | ``` 12 | 13 | You can use them to test your conditional statements. 14 | 15 | ```sh 16 | [[ true ]] && 'echo Yes' || echo 'No' 17 | # Yes 18 | 19 | [[ false ]] && 'echo Yes' || echo 'No' 20 | # No 21 | ``` 22 | -------------------------------------------------------------------------------- /cheatsheets/shell/ssh/directory.md: -------------------------------------------------------------------------------- 1 | # SSH directory 2 | 3 | 4 | For quick reference, here is an example what is in the `~/.ssh` directory: 5 | 6 | ## Contents 7 | 8 | ### Minimum 9 | 10 | Just two files. Commonly `dsa` or `rsa`. 11 | 12 | - `id_rsa` 13 | - `id_rsa.pub` 14 | 15 | ### Additional 16 | 17 | ```sh 18 | authorized_keys 19 | config 20 | known_hosts 21 | ``` 22 | -------------------------------------------------------------------------------- /cheatsheets/version-control/git/search-stashes.md: -------------------------------------------------------------------------------- 1 | # Search stashes 2 | 3 | Search Git stashes for a keyword and print the stash ID if one is found. 4 | 5 | ```sh 6 | QUERY='my term' 7 | 8 | git stash list | awk '{sub(/:$/, "", $1); print $1}' | while read stash; do 9 | if git stash show -p "$stash" | grep -q "$QUERY"; then 10 | echo "$stash" 11 | fi 12 | done 13 | ``` 14 | -------------------------------------------------------------------------------- /cheatsheets/artificial-intelligence/ollama/index.md: -------------------------------------------------------------------------------- 1 | # Ollama 2 | 3 | See [CLI reference](https://github.com/ollama/ollama?tab=readme-ov-file#cli-reference) in the docs on GitHub. 4 | 5 | ## Install 6 | 7 | See [Downloads](https://ollama.com/download) page. 8 | 9 | On macOS, install with `brew` using the command here - [formulae.brew.sh/cask/ollama](https://formulae.brew.sh/cask/ollama). 10 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/dashes.md: -------------------------------------------------------------------------------- 1 | # Dashes 2 | 3 | When using [Kramdown](https://github.com/gettalong/kramdown) in Jekyll and maybe others, you can write an en dash of em dash using plain hyphens. 4 | 5 | You can escape this conversion by using code formatting. 6 | 7 | Examples below 8 | 9 | - en dash 10 | - `A -- B` 11 | - A -- B 12 | - em dash 13 | - `A --- B` 14 | - A --- B 15 | -------------------------------------------------------------------------------- /cheatsheets/markdown/todo-list.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Turn your bullet list into a checklist of done and not done items 3 | --- 4 | # Todo list 5 | 6 | Use hard brackets. With either a space (not done) or lowercase `x` (done). 7 | 8 | ## Sample code 9 | 10 | ```markdown 11 | - [ ] not done. 12 | - [x] done 13 | ``` 14 | 15 | ## Sample result 16 | 17 | - [ ] not done 18 | - [x] done 19 | -------------------------------------------------------------------------------- /cheatsheets/typescript/data-types/primitives.md: -------------------------------------------------------------------------------- 1 | # Primitives 2 | 3 | 4 | ```typescript 5 | any 6 | 7 | boolean 8 | number 9 | string 10 | 11 | void 12 | null 13 | undefined 14 | 15 | unknown 16 | 17 | never // unreachable 18 | ``` 19 | 20 | ## Examples 21 | 22 | ### Unknown 23 | 24 | ```typescript 25 | let foo: unknown = 4; 26 | foo = "maybe a string instead"; 27 | foo = false; 28 | ``` 29 | -------------------------------------------------------------------------------- /cheatsheets/web/hosts.md: -------------------------------------------------------------------------------- 1 | # Hosts 2 | 3 | 4 | - `/etc/hosts` 5 | ``` 6 | ## 7 | # Host Database 8 | # 9 | # localhost is used to configure the loopback interface 10 | # when the system is booting. Do not change this entry. 11 | ## 12 | 127.0.0.1 localhost dev.localhost 13 | 255.255.255.255 broadcasthost 14 | ::1 localhost 15 | ``` 16 | -------------------------------------------------------------------------------- /cheatsheets/containers/podman/setup.md: -------------------------------------------------------------------------------- 1 | # Setup 2 | 3 | 4 | ## Install 5 | 6 | ```sh 7 | brew install podman 8 | ``` 9 | ```sh 10 | podman machine init 11 | ``` 12 | 13 | ## Use as Docker drop-in replacement 14 | 15 | Set in your shell config like this based on the CLI output. 16 | 17 | ```sh 18 | export DOCKER_HOST='unix:///var/folders/.../.../.../podman/podman-machine-default-api.sock' 19 | ``` 20 | -------------------------------------------------------------------------------- /cheatsheets/maker-projects/arduino.md: -------------------------------------------------------------------------------- 1 | # Arduinio 2 | 3 | ## Basic 4 | 5 | The default script you get when installing and running [Arduino IDE][]. 6 | 7 | [Arduino IDE]: https://www.arduino.cc/en/software 8 | 9 | ```c 10 | void setup() { 11 | // put your setup code here, to run once: 12 | 13 | } 14 | 15 | void loop() { 16 | // put your main code here, to run repeatedly: 17 | 18 | } 19 | ``` 20 | -------------------------------------------------------------------------------- /docs/deploy.md: -------------------------------------------------------------------------------- 1 | # Deploy 2 | 3 | Set up this project on GitHub Pages. 4 | 5 | 1. Add this project to your GitHub repos. 6 | 2. Go to Settings. 7 | 3. Enable GitHub Pages on the `master` branch. 8 | 4. Go to the environment tab and wait for your site to build. 9 | 5. Go to the GitHub Pages URL. e.g. 10 | - [michaelcurrin.github.io/dev-cheatsheets](https://michaelcurrin.github.io/dev-cheatsheets/) 11 | -------------------------------------------------------------------------------- /cheatsheets/javascript/format-and-lint/eslint/init.md: -------------------------------------------------------------------------------- 1 | # Init 2 | 3 | 4 | From ESLint [docs](https://github.com/eslint/eslint#installation-and-usage). 5 | 6 | ```sh 7 | $ eslint --init 8 | ``` 9 | 10 | Result: 11 | 12 | - `.eslintrc` 13 | ```json 14 | { 15 | "rules": { 16 | "semi": ["error", "always"], 17 | "quotes": ["error", "double"] 18 | } 19 | } 20 | ``` 21 | -------------------------------------------------------------------------------- /cheatsheets/javascript/general/request/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: HTTP request 3 | description: How to get and send data over HTTP using JavaScript 4 | --- 5 | 6 | 7 | A few common options: 8 | 9 | - `fetch` - built-in for the browser and for Node 17+ 10 | - `node-fetch` - polyfill for the Node server side 11 | - `axios` package 12 | - `request` package 13 | - `jquery` package - use the `ajax` function. 14 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/configuration/build-settings.md: -------------------------------------------------------------------------------- 1 | # Build settings 2 | 3 | This can be set with CLI flags, or in the config here if you prefer. 4 | 5 | ```yaml 6 | future: true 7 | profile: true 8 | livereload: true 9 | ``` 10 | 11 | Cause a build to fail if there is a YAML syntax error in a page's frontmatter. Only works in Jekyll 4 though. 12 | 13 | ```yaml 14 | strict_front_matter: true 15 | ``` 16 | -------------------------------------------------------------------------------- /cheatsheets/version-control/git/permissions-error.md: -------------------------------------------------------------------------------- 1 | # Permissions error 2 | 3 | Sometimes the root user will make changes to files in the Git repo in `.git` and change the owner to be `root`. Perhaps when using Windows Subsystem for Linux or Dev Containers (VS Code). 4 | 5 | Solution - recursively set permissions to your own user and group. 6 | 7 | ```sh 8 | $ sudo chmod -R michael:michael .git 9 | ``` 10 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/dataviz/apex-charts/formatting.md: -------------------------------------------------------------------------------- 1 | # Formatting 2 | 3 | From [Stacked](https://apexcharts.com/javascript-chart-demos/bar-charts/stacked/). 4 | 5 | ```js 6 | { 7 | xaxis: { 8 | categories: [2008, 2009, 2010, 2011, 2012, 2013, 2014], 9 | labels: { 10 | formatter: function (val) { 11 | return val + "K" 12 | } 13 | } 14 | }, 15 | } 16 | ``` 17 | -------------------------------------------------------------------------------- /cheatsheets/sql/basic/maths.md: -------------------------------------------------------------------------------- 1 | # Maths 2 | 3 | 4 | ## Float division 5 | 6 | ```sql 7 | SELECT 123 / 2.0; 8 | ``` 9 | ``` 10 | 61.5 11 | ``` 12 | 13 | Another option is to cast either value to a float. 14 | 15 | ```sql 16 | SELECT 123 / 2 :: FLOAT; 17 | ``` 18 | 19 | 20 | ## Floor division 21 | 22 | Warning, this will round down. 23 | 24 | ```sql 25 | SELECT 123 / 2; 26 | ``` 27 | ``` 28 | 61 29 | ``` 30 | -------------------------------------------------------------------------------- /cheatsheets/containers/docker/dockerfile/aliases.md: -------------------------------------------------------------------------------- 1 | # Aliases 2 | 3 | Given an image an alias and then use it later. 4 | 5 | ```Dockerfile 6 | FROM IMAGE AS ALIAS 7 | ``` 8 | 9 | Example: 10 | 11 | `Dockerfile` 12 | ```Dockerfile 13 | FROM python:alpine AS base 14 | 15 | FROM base AS dev 16 | CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"] 17 | 18 | FROM base AS build 19 | COPY . . 20 | RUN mkdocs build 21 | ``` 22 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/vue/events/emit.md: -------------------------------------------------------------------------------- 1 | # Emit 2 | 3 | 4 | When a native event (e.g. `click`) is defined in the emits option, the component event will be used instead of a native event listener. 5 | 6 | Here is the syntax for adding an emit event to an input tag, with the pushed value set to the value on the element. 7 | 8 | ``` 9 | v-on:input="$emit('input', $event.target.modelValue)" 10 | ``` 11 | 12 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/python/pip/manage-pip.md: -------------------------------------------------------------------------------- 1 | # Manage pip 2 | 3 | 4 | ## Update 5 | 6 | Keep `pip` and its related packages up to date. 7 | 8 | ```sh 9 | $ pip3 install --upgrade pip setuptools wheel 10 | ``` 11 | 12 | Inside a virtual environment you can use `pip` instead of `pip3`. 13 | 14 | You could also do: 15 | 16 | ```sh 17 | $ python3 -m pip3 install --upgrade pip setuptools wheel 18 | ``` 19 | -------------------------------------------------------------------------------- /cheatsheets/python/builtins/data-structures/deque.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: deque 3 | description: The double-ended queue in Python 4 | --- 5 | 6 | 7 | See [deque](https://docs.python.org/3/library/collections.html#collections.deque) in the docs. 8 | 9 | 10 | > list-like container with fast appends and pops on either end 11 | 12 | Not to be confused with terminology to "enqueue" (append) and "dequeue" (pop) an item. 13 | -------------------------------------------------------------------------------- /cheatsheets/shell/commands/date/convert.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Convert 3 | description: Specify an input datetime and convert to another format. 4 | --- 5 | 6 | 7 | ## Convert unix timestamp to date and time 8 | 9 | Give seconds as a number. 10 | 11 | ```console 12 | $ date -r 0 13 | Thu 1 Jan 1970 02:00:00 SAST 14 | ``` 15 | 16 | ```console 17 | $ date -r 1000000000 18 | Sun 9 Sep 2001 03:46:40 SAST 19 | ``` 20 | -------------------------------------------------------------------------------- /cheatsheets/shell/scripting/size.md: -------------------------------------------------------------------------------- 1 | # Size 2 | 3 | Directories (or at least paths without `.` to indicated extension. 4 | 5 | ```sh 6 | $ du -a | grep -v '.git' | grep -v 'pycache' | grep -v '\.\w' | sort -h -r 7 | ``` 8 | 9 | e.g. 10 | 11 | ``` 12 | 39920 . 13 | 15064 ./abc 14 | 6568 ./abc/def 15 | 23 ./xyz 16 | ... 17 | ``` 18 | 19 | Remove the `-v` of the last `grep` to show just files. 20 | 21 | -------------------------------------------------------------------------------- /cheatsheets/markdown/flavors.md: -------------------------------------------------------------------------------- 1 | # Flavors 2 | 3 | - [Flavored Markdown](https://flavoredmarkdown.com/) overview of flavors. 4 | - [CommonMark](https://commonmark.org/) 5 | - [GitHub Flavored Markdown](https://github.github.com/gfm/) 6 | - [Kramdown](https://kramdown.gettalong.org/) 7 | - > Ruby library for parsing and converting a superset of Markdown 8 | - [Quick reference](https://kramdown.gettalong.org/quickref.html) 9 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/react/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: React 3 | logo: react 4 | --- 5 | 6 | ### Related 7 | 8 | - [React recipes][] in Code Cookbook 9 | - [React resources][] in Dev Resources 10 | 11 | [React recipes]: https://michaelcurrin.github.io/code-cookbook/recipes/javascript/packages/react/ 12 | [React resources]: https://michaelcurrin.github.io/dev-resources/resources/javascript/packages/react/react.html 13 | -------------------------------------------------------------------------------- /cheatsheets/jekyll/cli/testing.md: -------------------------------------------------------------------------------- 1 | # Testing 2 | 3 | If you want to test a snippet or part of another site in your own, create a subdirectory. You can use the gems from the top-level directory. 4 | 5 | ``` 6 | _site 7 | test_site/ # Sub directory project 8 | _site 9 | index.md 10 | _config.yml 11 | Gemfile 12 | index.md 13 | _config.yml 14 | ``` 15 | 16 | ```sh 17 | cd test_site 18 | bundle exec jekyll serve 19 | ``` 20 | -------------------------------------------------------------------------------- /cheatsheets/terraform/environment.md: -------------------------------------------------------------------------------- 1 | # Environment 2 | > Setting environment variables 3 | 4 | 5 | Set up a variable. 6 | 7 | ```terraform 8 | variable "FOO" {} 9 | ``` 10 | 11 | Set up your code. 12 | 13 | ``` 14 | { 15 | foo = var.FOO 16 | } 17 | ``` 18 | 19 | Set the variable using `TF_VAR_` prefix. 20 | 21 | ```sh 22 | export TF_VAR_FOO=bar 23 | ``` 24 | 25 | Run. 26 | 27 | ```sh 28 | $ terraform plan 29 | ``` 30 | -------------------------------------------------------------------------------- /cheatsheets/go/code/cli-input.md: -------------------------------------------------------------------------------- 1 | # CLI input 2 | 3 | Read keyboard input from the user. 4 | 5 | There's no simple function, so you have to set up a buffered IO reader and read a line from it. 6 | 7 | ```go 8 | package main 9 | 10 | import ( 11 | "bufio" 12 | "fmt" 13 | "os" 14 | ) 15 | 16 | func main() { 17 | reader := bufio.NewReader(os.Stdin) 18 | s, _ := reader.ReadString('\n') 19 | fmt.Println(s) 20 | } 21 | ``` 22 | -------------------------------------------------------------------------------- /cheatsheets/javascript/packages/vue/events/key-modifiers.md: -------------------------------------------------------------------------------- 1 | # Key modifiers 2 | 3 | 4 | From [docs](https://v3.vuejs.org/guide/events.html#key-modifiers). 5 | 6 | ```html 7 | 8 | ``` 9 | 10 | 11 | ## Aliases 12 | 13 | - `.enter` 14 | - `.tab` 15 | - `.delete` (captures both "Delete" and "Backspace" keys) 16 | - `.esc` 17 | - `.space` 18 | - `.up` 19 | - `.down` 20 | - `.left` 21 | - `.right` 22 | -------------------------------------------------------------------------------- /cheatsheets/version-control/git/restore/unstage.md: -------------------------------------------------------------------------------- 1 | # Unstage 2 | 3 | If a new file has been created and staged and you want to unstage it (but not delete it), you can follow this (from the tip in the `git status` output). 4 | 5 | ```sh 6 | $ git restore --staged PATH 7 | ``` 8 | 9 | e.g. 10 | 11 | ```sh 12 | $ touch abc.txt 13 | $ git add abc.txt 14 | $ git status 15 | $ git restore --staged abc.txt 16 | $ git status 17 | ``` 18 | -------------------------------------------------------------------------------- /cheatsheets/web/html/encode-and-escape/html-entity-escaping.md: -------------------------------------------------------------------------------- 1 | # HTML entity escaping 2 | 3 | In the content of HTML pages, escape certain characters. 4 | 5 | e.g. `<` becomes `%lt;`. 6 | 7 | - [w3schools.com/html/html_entities.asp](https://www.w3schools.com/html/html_entities.asp) - Reference and conversion tool 8 | - [https://www.freeformatter.com/html-entities.html](https://www.freeformatter.com/html-entities.html) - Conversion tool. 9 | -------------------------------------------------------------------------------- /cheatsheets/containers/docker/persist.md: -------------------------------------------------------------------------------- 1 | # Persist 2 | 3 | 4 | ## Snapshot 5 | 6 | If you create a container from an image and want to keep the file changes as an image for further containers, you can write the container as a snapshot, which makes a new image. 7 | 8 | 9 | ## Volume 10 | 11 | If you want to persist file changes such as in a user directory or database storage even after deleting a container, then set up a volume. 12 | -------------------------------------------------------------------------------- /cheatsheets/other/vscode-extensions/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: VS Code extensions 3 | logo: visualstudiocode 4 | description: From how to develop an extension all the way to publishing it 5 | --- 6 | 7 | If you are new to developing an extension, see one of the _Beginner_ links in [VS Code extensions][] under Dev Resources. 8 | 9 | [VS Code extensions]: https://michaelcurrin.github.io/dev-resources/resources/other/vscode-extensions/ 10 | -------------------------------------------------------------------------------- /cheatsheets/package-managers/javascript/npm/manage.md: -------------------------------------------------------------------------------- 1 | # Manage NPM 2 | 3 | ## Install 4 | 5 | See [Install Node.js and NPM](https://gist.github.com/MichaelCurrin/aa1fc56419a355972b96bce23f3bccba) gist instructions. 6 | 7 | 8 | ## Update 9 | 10 | You should probably update Node.js as a whole but you can update just NPM if you need to. NPM will prompt you to do this sometimes. 11 | 12 | ```sh 13 | $ npm i -g --update npm 14 | ``` 15 | -------------------------------------------------------------------------------- /cheatsheets/powershell/shortcuts.md: -------------------------------------------------------------------------------- 1 | # Shortcuts 2 | 3 | ## Alias 4 | 5 | ```sh 6 | Set-Alias -Name NAME -Value VALUE 7 | ``` 8 | 9 | e.g. 10 | 11 | ```sh 12 | Set-Alias -Name kdev -Value "kubectl config set-context atlas-develop" 13 | ``` 14 | 15 | 16 | ## Functions 17 | 18 | ```sh 19 | function FUNCTIONAME { BODY } 20 | ``` 21 | 22 | e.g. 23 | 24 | ```sh 25 | function kenv { kubectl config use-context atlas-$args } 26 | ``` 27 | -------------------------------------------------------------------------------- /cheatsheets/version-control/git/changes-key.md: -------------------------------------------------------------------------------- 1 | # Changes key 2 | 3 | This is relevant for `git status`, `git diff` and `git diff-index`. 4 | 5 | - `M` modified - File has been modified 6 | - `C` copy-edit - File has been copied and modified 7 | - `R` rename-edit - File has been renamed and modified 8 | - `A` added - File has been added 9 | - `D` deleted - File has been deleted 10 | - `U` unmerged - File has conflicts after a merge 11 | -------------------------------------------------------------------------------- /cheatsheets/containers/kubernetes/install.md: -------------------------------------------------------------------------------- 1 | # Install 2 | 3 | Install Docker Desktop and you'll get Kubernetes CLI. 4 | 5 | Otherwise install directly as below. 6 | 7 | 8 | ## macOS 9 | 10 | See [Install and Set Up kubectl on macOS](https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/) for more details, autocompletion, and for installing with cURL. 11 | 12 | ### Homebrew 13 | 14 | ```sh 15 | $ brew install kubectl 16 | ``` 17 | -------------------------------------------------------------------------------- /cheatsheets/go/code/structures.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Structures 3 | description: Understanding the `struct` type 4 | --- 5 | 6 | 7 | ## Syntax 8 | 9 | ``` 10 | struct { 11 | KEY_NAME VALUE_TYPE 12 | [...] 13 | }[ optional instances ] 14 | ``` 15 | 16 | ## Examples 17 | 18 | ```go 19 | person := struct { 20 | Name string 21 | Age int 22 | }{"Kim", 22} 23 | ``` 24 | 25 | ```go 26 | point := struct { 27 | x, y int 28 | } 29 | ``` 30 | -------------------------------------------------------------------------------- /cheatsheets/shell/scheduling.md: -------------------------------------------------------------------------------- 1 | # Scheduling 2 | 3 | See [crontab](https://github.com/MichaelCurrin/learn-to-code/blob/master/Shell/Scheduling/crontab.md) guide. 4 | 5 | 6 | Send stdout and stderror to stdout and mail the result. Useful in a cronjob. Note this assumes global mail is disabled with `MAILTO=''`. 7 | 8 | ```sh 9 | RESULT="$(cd DIR && COMMAND)"; [[ $? -ne 0 ]] || echo "$RESULT" | mail -s 'Task foo failed!' $USER 10 | ``` 11 | -------------------------------------------------------------------------------- /cheatsheets/terraform/code/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Code 3 | description: How to write code for Terraform files 4 | --- 5 | 6 | The native language of Terraform is HCL - Hashicorp Configuration Language. 7 | 8 | 9 | Recommended - use this command to start interactive mode. 10 | 11 | ```sh 12 | $ terraform console 13 | ``` 14 | 15 | Then enter Terraform statements. 16 | 17 | ``` 18 | > join(", ", ["abc","def"]) 19 | "abc, def" 20 | ``` 21 | -------------------------------------------------------------------------------- /cheatsheets/web/css/pseudo-selectors/text.md: -------------------------------------------------------------------------------- 1 | ## Text 2 | 3 | 4 | ## Selectors 5 | 6 | - `::first-line` 7 | - `::last-child` 8 | - `::only-child` 9 | 10 | 11 | ## Examples 12 | 13 | Instead of adding `span` with `first` as class, you can use a selector for the first line like this: 14 | 15 | ```css 16 | /* The first line of every element. */
17 | p::first-line {
18 | color: blue;
19 | text-transform: uppercase;
20 | }
21 | ```
22 |
--------------------------------------------------------------------------------
/cheatsheets/javascript/general/modules/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Modules
3 | description: How to export and import modules
4 | ---
5 |
6 | ### Resources
7 |
8 | - [CDNs](https://michaelcurrin.github.io/dev-resources/resources/javascript/cdns/) for JS in Dev Resources.
9 | - [Modules](https://nodejs.org/api/modules.html) in the Node docs
10 | - [Different module formats](https://www.sitepoint.com/understanding-module-exports-exports-node-js/)
11 |
--------------------------------------------------------------------------------
/cheatsheets/python/libraries/built-in/http-server.md:
--------------------------------------------------------------------------------
1 | # HTTP Server
2 |
3 | A module for simple HTTP web servers for development - not recommended for production.
4 |
5 | See [http.server](https://docs.python.org/3/library/http.server.html) docs.
6 |
7 |
8 | ## Usage
9 |
10 | Start a static file server.
11 |
12 | ```sh
13 | $ python3 -m http.server
14 | ```
15 |
16 | Open in the browser:
17 |
18 | - [localhost:8000](http://localhost:8000)
19 |
--------------------------------------------------------------------------------
/cheatsheets/containers/docker/volumes.md:
--------------------------------------------------------------------------------
1 | # Volumes
2 |
3 |
4 | ## Resources
5 |
6 | - [Volumes](https://docs.docker.com/storage/volumes/)
7 |
8 |
9 | ## Related
10 |
11 | See cheatsheets here:
12 |
13 | - [Docker Compose Volumes][]
14 | - [Docker CLI Volumes][]
15 |
16 |
17 | [Docker Compose Volumes]: {% link cheatsheets/containers/docker-compose/volumes.md %}
18 | [Docker CLI Volumes]: {% link cheatsheets/containers/docker-cli/volumes.md %}
19 |
--------------------------------------------------------------------------------
/cheatsheets/containers/kubernetes/cli/replica-set.md:
--------------------------------------------------------------------------------
1 |
2 | # Replica set
3 |
4 | A new replicaset is created with each deploy and a history is saved. You’ll see 10 or so for each deployment:
5 |
6 | ```sh
7 | $ kubectl get rs
8 | ```
9 |
10 | To find which replicaset is active for the deployment, describe the deployment and look for NewReplicaSet:
11 |
12 | ```sh
13 | kubectl describe deploy my-pod-name | grep NewReplicaSet
14 | ```
15 |
--------------------------------------------------------------------------------
/cheatsheets/jekyll/templating/collections.md:
--------------------------------------------------------------------------------
1 | # Collections
2 |
3 | {% raw %}
4 |
5 |
6 | ## Iterate over collection
7 |
8 | - `_config.yml`
9 | ```yaml
10 | collections:
11 | foo:
12 | output: true
13 | ```
14 | - `_foo/bars/*.md`
15 | - `index.md`
16 | ```liquid
17 | ---
18 | ---
19 | {% for item in site.foo.bars %}
20 | {{ item.title }}
21 | {% endfor %}
22 | ```
23 |
24 | {% endraw %}
25 |
--------------------------------------------------------------------------------
/cheatsheets/python/configs/index.md:
--------------------------------------------------------------------------------
1 |
2 | # Configs
3 |
4 |
5 |
6 | See this [blog post](https://hackersandslackers.com/simplify-your-python-projects-configuration/#commento-login-box-container)
7 |
8 |
9 |
10 | See also [Python Package Quickstart repo](https://github.com/MichaelCurrin/python-package-quickstart).
11 |
--------------------------------------------------------------------------------
/cheatsheets/terraform/tfenv.md:
--------------------------------------------------------------------------------
1 | # TFEnv
2 |
3 | If you want to have multiple versions of Terraform installed, use this tool.
4 |
5 | - [tfenv](https://github.com/tfutils/tfenv)
6 |
7 |
8 | ## Install TFEnv
9 |
10 | ```sh
11 | $ brew install tfenv
12 | ```
13 |
14 | ## Install a version of Terraform
15 |
16 | ```sh
17 | $ tfenv install 1.2.3
18 | ```
19 |
20 |
21 | ## Use a version of Terraform
22 |
23 | ```sh
24 | $ terraform1.2.3
25 | ```
26 |
--------------------------------------------------------------------------------
/cheatsheets/web/css/tables.md:
--------------------------------------------------------------------------------
1 | # Tables
2 |
3 | From [CSS table](https://www.w3schools.com/Css/css_table.asp) guide.
4 |
5 |
6 | ## Add border
7 |
8 | ```css
9 | table, th, td {
10 | border: 1px solid;
11 | }
12 | ```
13 |
14 | Collapse borders to not have double borders.
15 |
16 | ```css
17 | table {
18 | border-collapse: collapse;
19 | }
20 | ```
21 |
22 | ## Full width
23 |
24 | ```css
25 | table {
26 | width: 100%;
27 | }
28 | ```
29 |
--------------------------------------------------------------------------------
/cheatsheets/jekyll/templating/static-files.md:
--------------------------------------------------------------------------------
1 | # Static files
2 |
3 | {% raw %}
4 |
5 | From [StackOverflow](https://stackoverflow.com/questions/17677094/jekyll-for-loop-over-all-images-in-a-folder).
6 |
7 | ```liquid
8 | {% for asset in site.static_files %}
9 | {% if asset.path contains ' My text
`
20 |
--------------------------------------------------------------------------------
/cheatsheets/package-managers/ruby/bundler/other.md:
--------------------------------------------------------------------------------
1 | # Other
2 |
3 | ```sh
4 | bundle version # Prints the bundler's version information
5 | ```
6 |
7 | ```sh
8 | bundle console [GROUP] # Opens an IRB session with the bundle pre-loaded
9 | ```
10 |
11 | ```sh
12 | bundle exec [OPTIONS] # Run the command in context of the bundle
13 | ```
14 |
15 | ```sh
16 | bundle gem NAME [OPTIONS] # Creates a skeleton for creating a rubygem
17 | ```
18 |
--------------------------------------------------------------------------------
/cheatsheets/javascript/format-and-lint/eslint/config-files/main.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Main
3 | description: The ESLint main config
4 | ---
5 |
6 |
7 | From [Configuration file format](https://eslint.org/docs/2.0.0/user-guide/configuring#configuration-file-formats) in the docs.
8 |
9 | 1. `.eslintrc.js`
10 | 1. `.eslintrc.yaml` or `.eslintrc.yml`
11 | 1. `.eslintrc.json`
12 | 1. `.eslintrc` - DEPRECATED, as it can be JSON or YAML
13 | 1. `package.json` - `eslintConfig` field.
14 |
15 |
--------------------------------------------------------------------------------
/cheatsheets/javascript/general/promises/callback.md:
--------------------------------------------------------------------------------
1 | # Callback function
2 |
3 | ```javascript
4 | foo('bar', function (bazz) {
5 | console.log(bazz.toUpperCase());
6 | });
7 | ```
8 |
9 | This is the infamous "callback hell" where you have to nest function calls to chain them. This what the only way for a long time.
10 |
11 | ```javascript
12 | foo('bar', function (bazz) {
13 | fizz(bazz, function(boo) {
14 | console.log(boo.toUpperCase());
15 | }
16 | });
17 | ```
18 |
--------------------------------------------------------------------------------
/cheatsheets/other/regex/groups.md:
--------------------------------------------------------------------------------
1 | # Groups
2 |
3 | A non-captured and a captured part of a pattern.
4 |
5 | ```re
6 | \w (\w)
7 | ```
8 |
9 | Named group.
10 |
11 | ```re
12 | (?
` and also use `v-html` so it sets as `innerHTML` rather than just as literal `\n` text. But it has a security concern if you use user-generated data.
18 |
19 | ```javascript
20 | text.replace(/(?:\r\n|\r|\n)/g, '
');
21 | ```
22 |
--------------------------------------------------------------------------------
/cheatsheets/package-managers/os/homebrew/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | description: A commonly-used macOS package manager
3 | ---
4 | # Homebrew
5 |
6 |
7 | ### Resources
8 |
9 | - [Homebrew Cheatsheet](https://devhints.io/homebrew) on _DevHints_.
10 | - [Homebrew docs](https://docs.brew.sh/) homepage
11 | - [Homebrew Tips N' Tricks](https://docs.brew.sh/Tips-N%27-Tricks) in the docs
12 |
13 |
14 |
15 | ### Install Devtools
16 |
17 | This is for Xcode but may be needed when installing with Brew.
18 |
19 | ```sh
20 | $ xcode-select --install
21 | ```
22 |
23 |
--------------------------------------------------------------------------------
/cheatsheets/package-managers/python/pip/show.md:
--------------------------------------------------------------------------------
1 | # Show
2 |
3 | Find where a package is installed.
4 |
5 | For a global install:
6 |
7 | ```console
8 | $ pip install requests
9 | $ pip show requests
10 | Name: requests
11 | Version: 2.26.0
12 | Summary: Python HTTP for Humans.
13 | Home-page: https://requests.readthedocs.io
14 | Author: Kenneth Reitz
15 | Author-email: me@kennethreitz.org
16 | License: Apache 2.0
17 | Location: /usr/local/lib/python3.9/site-packages
18 | Requires: certifi, charset-normalizer, urllib3, idna
19 | Required-by:
20 | ```
21 |
--------------------------------------------------------------------------------
/cheatsheets/python/formatting/black.md:
--------------------------------------------------------------------------------
1 | # Black
2 |
3 | Format with the [black](https://pypi.org/project/black/) command.
4 |
5 |
6 | ## Apply fixes
7 |
8 | This is useful for local development.
9 |
10 | This command will apply fixes in place and show any fatal errors.
11 |
12 | ```sh
13 | $ black .
14 | ```
15 |
16 | ## Check
17 |
18 | This is useful for a CI flow.
19 |
20 | This command will print the fixes needed without applying them and exit with error status if fixes need to be applied.
21 |
22 | ```sh
23 | $ black . --diff --check
24 | ```
25 |
--------------------------------------------------------------------------------
/cheatsheets/javascript/format-and-lint/prettier/install.md:
--------------------------------------------------------------------------------
1 | # Install
2 |
3 | Install it globally.
4 |
5 | ```sh
6 | $ npm i -g prettier
7 | $ prettier -h
8 | ```
9 |
10 | Or install it in a project.
11 |
12 | ```sh
13 | $ npm i --save-dev prettier
14 | ```
15 |
16 | If you've set it up in your NPM scripts, you can run like this:
17 |
18 | ```sh
19 | $ npm run format
20 | ```
21 |
22 | Otherwise, run ad hoc commands on the CLI as:
23 |
24 | ```sh
25 | $ npx prettier
26 | ```
27 |
28 | Using `npx` here works even if `prettier` is not installed anywhere.
29 |
--------------------------------------------------------------------------------
/cheatsheets/python/libraries/queue-messaging/rq.md:
--------------------------------------------------------------------------------
1 | # Redis Queue (RQ)
2 |
3 | RQ is a simple Python library for queueing jobs and processing them in the background with workers.
4 |
5 | ## Key Features
6 | - Simple to use and deploy
7 | - Uses Redis as its backend
8 | - Supports job prioritization
9 |
10 | ## Basic Usage
11 |
12 | ```python
13 | from redis import Redis
14 | from rq import Queue
15 |
16 | q = Queue(connection=Redis())
17 |
18 |
19 | def my_job(param1, param2):
20 | return param1 + param2
21 |
22 |
23 | job = q.enqueue(my_job, 1, 2)
24 | ```
--------------------------------------------------------------------------------
/cheatsheets/ruby/ruby-managers.md:
--------------------------------------------------------------------------------
1 | # Ruby managers
2 |
3 | Install Ruby with an environment manager.
4 |
5 | You might prefer to use Ruby environment managers like:
6 |
7 | - [rbenv](https://github.com/rbenv/rbenv) - see [blog post](https://richstone.io/where-is-ruby-3-0-0-on-rbenv/)
8 | - [rvm](https://rvm.io/)
9 |
10 | ```sh
11 | $ rbenv install 3.0.0
12 |
13 | $ rvm install 3.0
14 | $ rvm use 3.0
15 | ```
16 |
17 | I've never used them as I've never had to.
18 |
19 | If your Linux distro doesn't support Ruby 3 yet, you might have to use one of the above.
20 |
--------------------------------------------------------------------------------
/cheatsheets/version-control/git/committing/auto.md:
--------------------------------------------------------------------------------
1 | # Auto commit
2 |
3 | Shell flow to apply remote changes, run a script to update a versioned file then commit and push changes.
4 |
5 | A pre-configured commit message is used.
6 |
7 | ```sh
8 | FILENAME=foo.txt
9 |
10 | git pull --no-edit
11 |
12 | # ... do work
13 |
14 | if [ -z "$(git status --porcelain)" ]; then
15 | echo 'No changes to commit'
16 | else
17 | echo 'Committing and pushing changes'
18 | git commit $FILENAME -m "Cron task - Update $FILENAME"
19 | git push
20 | fi
21 | ```
22 |
--------------------------------------------------------------------------------
/cheatsheets/shell/commands/scp.md:
--------------------------------------------------------------------------------
1 | # scp
2 |
3 | See [tutorial](https://www.computerhope.com/unix/scp.htm).
4 |
5 |
6 | ## Copy to remote
7 |
8 | Copy file.
9 |
10 | ```sh
11 | $ scp ~/images/foo.jpg my-user@myhost.com:~/my_images
12 | ```
13 |
14 | Copy files.
15 |
16 | ```sh
17 | $ scp ~/images/*.jpg my-user@myhost.com:~/my_images
18 | ```
19 |
20 | Copy directory.
21 |
22 | ```sh
23 | $ scp -r ~/images my-user@myhost.com:~/my_images
24 | ```
25 |
26 |
27 | ## Copy to local
28 |
29 | ```sh
30 | $ scp my-user@myhost.com:~/my_images/*.jpg ~/images/
31 | ```
32 |
--------------------------------------------------------------------------------
/cheatsheets/other/vscode/emmet.md:
--------------------------------------------------------------------------------
1 | # Emmet shortcuts
2 |
3 | See [Emmet](https://docs.emmet.io/) homepage.
4 |
5 | Smart code generation for less typing.
6 |
7 | Description | Input
8 | --- | ---
9 | HTML boilerplate | `!` + `spacebar`
10 | Nested elements | `div` + `>` + `p` + `spacebar`
11 | Multiple elements | `li` + `*` + `3` + `spacebar`
12 | Div with class | `.class-name` + `spacebar`
13 | Any element With class | `h1` + `.class-name` + `spacebar`
14 | Lorem Ipsum in element | `p` + `>` + `lorem` + `spacebar`
15 | Sibling element | `h2` + `+` + `p` + `spacebar`
16 |
--------------------------------------------------------------------------------
/cheatsheets/shell/searching.md:
--------------------------------------------------------------------------------
1 | # Searching
2 |
3 |
4 | Based on [Find it Faster](https://marketplace.visualstudio.com/items?itemName=TomRijndorp.find-it-faster) VS Code extension, which depends on these being installed:
5 |
6 | - [fzf][] - find files by name using fuzzy search pattern
7 | - [rg][] - search contents across files, using `.gitignore`.
8 | - [bat][] - find a pattern within a file.
9 |
10 | [fzf]: {% link cheatsheets/shell/commands/fzf.md %}
11 | [bat]: {% link cheatsheets/shell/commands/bat.md %}
12 | [rg]: {% link cheatsheets/shell/commands/grep/rg.md %}
13 |
--------------------------------------------------------------------------------
/cheatsheets/containers/docker/dockerfile/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | logo: docker
3 | description: Guide to synax for a `Dockerfile` file
4 | ---
5 | # Dockerfile
6 |
7 | See [Dockerfile reference](https://docs.docker.com/engine/reference/builder/) doc.
8 |
9 |
10 | ### Overview
11 |
12 |
13 |
14 | `Dockerfile`
15 | ```Dockerfile
16 | FROM image-name
17 |
18 | ENV foo=bar
19 | ARG fizz=buzz
20 |
21 | RUN apt-get update
22 | RUN apt install -q -y foo
23 |
24 | RUN echo "Hello"
25 | ```
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/cheatsheets/python/transpose-array.md:
--------------------------------------------------------------------------------
1 | # Transpose array
2 |
3 | Given a 2D array.
4 |
5 | ```python
6 | matrix = [
7 | [1,2,3],
8 | [4,5,6],
9 | [7,8,9]
10 | ]
11 | ```
12 |
13 | And you want result:
14 |
15 | ```python
16 | [
17 | [1,4,7],
18 | [2,5,8],
19 | [3,6,9]
20 | ]
21 | ```
22 |
23 | Do this:
24 |
25 | ```python
26 | result = zip(*matrix)
27 | ```
28 |
29 | Explanation:
30 |
31 | ```
32 | x = ['a', 'b', 'c']
33 | y = 1, 2, 3]
34 | list(zip(x, y))
35 | # [
36 | # ('a', 1),
37 | # ('b', 2),
38 | # ('c', 3)
39 | # ]
40 | ```
41 |
--------------------------------------------------------------------------------
/cheatsheets/python/type-checks/data-structures/no-structure.md:
--------------------------------------------------------------------------------
1 | # No structure
2 |
3 | Using parameters only.
4 |
5 | For some cases you might be okay without a naming a structure as a type. Go for a simpler approach of just using a function expecting 2 or 3 named parameters with types.
6 |
7 | ```python
8 | def foo(name: str, age: int, height: Optional[float]): -> None
9 | print(name)
10 | print(age >= 18)
11 | print(height)
12 | ```
13 |
14 | If there are more fields and if you want to use the type outside the function, rather make a type or class, like `Person`.
15 |
--------------------------------------------------------------------------------
/cheatsheets/version-control/github/api/v4/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: V4 GraphQL
3 | logo: graphql
4 |
5 | description: About the GitHub V4 GraphQL API
6 | ---
7 |
8 |
9 | ## Resources
10 |
11 | - [GitHub GQL Resources](https://michaelcurrin.github.io/dev-resources/resources/version-control/github/graphql.html)
12 | - [Explorer](https://developer.github.com/v4/explorer/)
13 |
14 |
15 | ## Steps
16 |
17 | 1. Go to the GraphQL API explorer:
18 | 1. Sign in as your GitHub account.
19 | 1. Paste a query.
20 | 1. Include JSON data payload in Query Variables section.
21 | 1. Run query.
22 |
--------------------------------------------------------------------------------
/cheatsheets/data/yaml/data-structures.md:
--------------------------------------------------------------------------------
1 | # Data structures
2 |
3 | YAML is a superset of JSON, so you can use JSON syntax, or the ligher YAML syntax, even without quotes.
4 |
5 |
6 | ## Arrays
7 |
8 | Empty array.
9 |
10 | ```yaml
11 | my_array: []
12 | ```
13 |
14 | Two strings and an integer.
15 |
16 | ```yaml
17 | my_array: [abc, def, 123]
18 | my_array:
19 | - abc
20 | - def
21 | - 123
22 | ```
23 |
24 |
25 | ## Dictionaries
26 |
27 | ```yaml
28 | my_dict: {}
29 |
30 | my_dict: { "abc": "Hello", "def": 20 }
31 | my_dict:
32 | abc: Hello
33 | def: 20
34 | ```
35 |
--------------------------------------------------------------------------------
/cheatsheets/nosql/mongodb/advanced-features.md:
--------------------------------------------------------------------------------
1 | # Advanced Features
2 |
3 | ## Replication
4 |
5 | Replication allows you to create redundant copies of your data across multiple servers, providing high availability and fault tolerance.
6 |
7 | ## Sharding
8 |
9 | Sharding is a horizontal scaling technique that allows you to distribute data across multiple servers, enabling your database to scale out as your data grows.
10 |
11 | ## Transactions
12 |
13 | MongoDB supports multi-document transactions, allowing you to perform multiple operations as an all-or-nothing unit of work.
14 |
15 |
--------------------------------------------------------------------------------
/cheatsheets/python/libraries/queue-messaging/celery.md:
--------------------------------------------------------------------------------
1 | # Celery
2 |
3 | Celery is a distributed task queue system for Python.
4 |
5 | ## Key Features
6 |
7 | - Asynchronous task execution
8 | - Distributed architecture
9 | - Multiple broker support (RabbitMQ, Redis, etc.)
10 | - Periodic task scheduling
11 |
12 | ## Basic Usage
13 |
14 | ```python
15 | from celery import Celery
16 |
17 | app = Celery('tasks', broker='pyamqp://guest@localhost//')
18 |
19 |
20 | @app.task
21 | def add(x, y):
22 | return x + y
23 |
24 |
25 | # To call the task
26 | result = add.delay(4, 4)
27 | ```
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | default: install
2 |
3 | all: hooks install build
4 |
5 | h help:
6 | @grep '^[a-z]' Makefile
7 |
8 |
9 | .PHONY: hooks
10 | hooks:
11 | cd .git/hooks && ln -s -f ../../hooks/pre-push pre-push
12 |
13 | install:
14 | bundle config set --local path vendor/bundle
15 | bundle install
16 |
17 | upgrade:
18 | bundle clean
19 | bundle update
20 |
21 |
22 | s serve:
23 | bundle exec jekyll serve --trace --livereload
24 | i serve-i:
25 | bundle exec jekyll serve --trace --livereload --incremental
26 |
27 | build:
28 | JEKYLL_ENV=production bundle exec jekyll build --trace
29 |
--------------------------------------------------------------------------------
/cheatsheets/containers/docker-compose/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Docker Compose
3 | description: A tool that makes docker containers easier to manage
4 | ---
5 |
6 | Docker compose allows orchestration of multiple containers. It allows you to store and run parameters against those containers without typing each time.
7 |
8 | From CLI help:
9 |
10 | > Define and run multi-container applications with Docker.
11 |
12 |
13 | ### Resources
14 |
15 | - [Docker compose](https://michaelcurrin.github.io/dev-resources/resources/containers/docker-compose.html) section of my Dev Resources project.
16 |
--------------------------------------------------------------------------------
/cheatsheets/containers/docker/intro/hello-world.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Hello world
3 | description: The most basic use of Docker CLI and way to test that Docker works
4 | ---
5 |
6 | ```sh
7 | $ docker run hello-world
8 | ```
9 |
10 | Output:
11 |
12 | ```
13 | Unable to find image 'hello-world:latest' locally
14 | latest: Pulling from library/hello-world
15 | ...
16 |
17 | Hello from Docker!
18 | This message shows that your installation appears to be working correctly.
19 | ...
20 | ```
21 |
22 | If you installed using `sudo apt install ...` then you might have to run `sudo docker ...`.
23 |
--------------------------------------------------------------------------------
/cheatsheets/other/indentation.md:
--------------------------------------------------------------------------------
1 | # Indentation
2 |
3 | All my favorite languages and formats in one place.
4 |
5 |
6 | ## 2 spaces
7 |
8 | - Ruby
9 | - Bash
10 | - JavaScript
11 | - Sometimes 4 spaces
12 | - Sometimes tabs.
13 |
14 |
15 | ## 4 spaces
16 |
17 | - Python
18 | - Although some argue for tabs.
19 | - Java
20 | - Markdown
21 | - You can use 2 spaces, but in some cases around nesting bullet points you must use 4 spaces to get desired functionality.
22 | - Tabs also work, but less common.
23 |
24 |
25 | ## Tabs
26 |
27 | - GraphQL
28 | - Makefile
29 |
--------------------------------------------------------------------------------
/cheatsheets/package-managers/ruby/bundler/subcommands/add.md:
--------------------------------------------------------------------------------
1 | # add subcommand
2 |
3 | > Adds the specified gem to Gemfile (if valid) and run 'bundle install' in one step.
4 |
5 | ```sh
6 | $ bundle add GEM VERSION
7 | ```
8 |
9 | Example:
10 |
11 | ```sh
12 | $ bundle add jekyll-optional-front-matter
13 | ```
14 |
15 | Line appended to `Gemfile`:
16 |
17 | ```ruby
18 | gem "jekyll-optional-front-matter", "~> 0.3.2"
19 | ```
20 |
21 | Output:
22 |
23 | ```
24 | Fetching gem metadata from https://rubygems.org/..........
25 | ...
26 | Using jekyll-optional-front-matter 0.3.2
27 | ```
28 |
--------------------------------------------------------------------------------
/cheatsheets/shell/files/text-files/dotenv.md:
--------------------------------------------------------------------------------
1 | # Dotenv
2 |
3 | > A load a dotenv file.
4 |
5 | Export the vars in `.env` file into your shell.
6 |
7 | Simple
8 |
9 | ```sh
10 | export $(< .env) | xargs)
11 | ```
12 |
13 | Check if it exists first and ignore comments.
14 |
15 | ```sh
16 | if [ -f .env ]; then
17 | export $(egrep -v '^#' .env | xargs)
18 | fi
19 | ```
20 |
21 | [Gist source](https://gist.github.com/judy2k/7656bfe3b322d669ef75364a46327836)
22 |
23 | See also in my cookbook:
24 |
25 | - [dotenv](https://michaelcurrin.github.io/code-cookbook/recipes/shell/dotenv.html)
26 |
--------------------------------------------------------------------------------
/cheatsheets/other/regex/exclude.md:
--------------------------------------------------------------------------------
1 | # Exclude
2 |
3 | ## Exclude characters
4 |
5 | Use `^` inside `[]` to exclude. Note `a-z` will work and a `-` must be at the start of the end to match a literal `-`.
6 |
7 | ```re
8 | [^\w-]
9 | ```
10 |
11 | ## Exclude words
12 |
13 | Source: [regextester](https://www.regextester.com/15)
14 |
15 | ```re
16 | ^((?!badword).)*$
17 | ```
18 |
19 | ```
20 | badword
21 | test # match
22 | one two # match
23 | abadwords
24 | three # match
25 | ```
26 |
27 | Multiple exclusions:
28 |
29 | ```re
30 | ?!(foo|bar)
31 |
32 | ?!(http|[{#])
33 | ```
34 |
--------------------------------------------------------------------------------
/cheatsheets/shell/network-manager.md:
--------------------------------------------------------------------------------
1 | # Network manager
2 |
3 | - [Network Manager on Linux with Examples](https://devconnected.com/network-manager-on-linux-with-examples/)
4 |
5 | The Network Manager provides the following tools:
6 |
7 | - `nmcli` - CLI tool to configure, add, edit, and remove connections.
8 | - `nmtui` - GUI tool with a subset of features. You can edit a connection, activate a connection or change the hostname of your computer.
9 | - `nm-applet` - available in GNOME desktop environments. An interface overlay which can be used in order to connect or disconnect from networks.
10 |
--------------------------------------------------------------------------------
/cheatsheets/shell/scripting/copy.md:
--------------------------------------------------------------------------------
1 | # Copy
2 |
3 | See also `cp` under Commands section.
4 |
5 |
6 | ## Directory
7 |
8 | ```sh
9 | cp -R SOURCE DEST
10 | ```
11 |
12 | ## Interactive
13 |
14 | ```sh
15 | cp -i SOURCE DEST
16 | ```
17 |
18 | ## Force
19 |
20 | ```sh
21 | cp -f SOURCE DEST
22 | ```
23 |
24 | Note that will not work if you have interactive aliased. So you'll to reference the non-aliased form. Or do this.
25 |
26 | ```sh
27 | yes | cp SOURCE DEST
28 | ```
29 |
30 | [answer on SO](https://stackoverflow.com/questions/8488253/how-to-force-cp-to-overwrite-without-confirmation)
31 |
--------------------------------------------------------------------------------
/cheatsheets/terraform/cli-usage/import.md:
--------------------------------------------------------------------------------
1 | ---
2 | description: How to import resources in TF
3 | ---
4 | # Import
5 |
6 |
7 | See [import](https://www.terraform.io/docs/commands/import.html) command in the docs.
8 |
9 | ```sh
10 | $ terraform import RESOURCE_TYPE.NAME ID
11 | ```
12 |
13 | ```sh
14 | $ terraform import module.MODULE_NAME.RESOURCE_TYPE.NAME ID
15 | ```
16 |
17 | ```sh
18 | $ terraform import 'RESOURCE_TYPE.NAME[0]' ID
19 | $ # e.g.
20 | $ terraform import 'datadog_synthetics_test.this[0]' ID
21 | $ terraform import 'module.my_module[0].datadog_synthetics_test.this' ID
22 | ```
23 |
--------------------------------------------------------------------------------
/cheatsheets/web/css/pseudo-selectors/user-action.md:
--------------------------------------------------------------------------------
1 | # User action
2 |
3 | - `:focus` - using keyboard (or mouse)
4 | - `:hover` - hover with mouse)
5 | - `:checked` for certain for elements
6 | - `:visited` for links
7 |
8 |
9 | ## Examples
10 |
11 | ### Button
12 |
13 | ```css
14 | /* Any button over which the user's pointer is hovering */
15 | button:hover {
16 | color: blue;
17 | }
18 | ```
19 |
20 | ### Links
21 |
22 | ```css
23 | a:link,
24 | a:visited {
25 | color: rebeccapurple;
26 | font-weight: bold;
27 | }
28 |
29 | a:hover {
30 | color:hotpink;
31 | }
32 | ```
33 |
--------------------------------------------------------------------------------
/docs/installation.md:
--------------------------------------------------------------------------------
1 | # Installation
2 |
3 |
4 | ## Install system dependencies
5 |
6 | Install Ruby and Bundler - follow [gist](https://gist.github.com/MichaelCurrin/3af38fca4e2903cdedfb8402c18b2936).
7 |
8 |
9 | ## Clone
10 |
11 | Clone the repo or your fork.
12 |
13 | ```sh
14 | $ git clone git@github.com:MichaelCurrin/dev-cheatsheets.git
15 | $ cd dev-cheatsheets
16 | ```
17 |
18 | ## Set up hooks
19 |
20 | ```sh
21 | $ make hooks
22 | ```
23 |
24 |
25 | ## Install project dependencies
26 |
27 | Install gems - this includes Jekyll 4.
28 |
29 | ```sh
30 | $ make install
31 | ```
32 |
--------------------------------------------------------------------------------
/cheatsheets/javascript/general/es6.md:
--------------------------------------------------------------------------------
1 | # ES6
2 |
3 | Features introduced to JavaScript in ES6 aka ECMAScript 2015.
4 |
5 | - [map, reduce, filter][]
6 | - [spread or rest operator][]
7 | - [template literals][]
8 | - [closures][]
9 |
10 | [map, reduce, filter]: {% link cheatsheets/javascript/general/map-reduce-filter.md %}
11 | [spread or rest operator]: {% link cheatsheets/javascript/general/spread-operator.md %}
12 | [template literals]: {% link cheatsheets/javascript/general/strings/template-literals.md %}
13 | [closures]: {% link cheatsheets/javascript/general/variable-declaration/closures.md %}
14 |
--------------------------------------------------------------------------------
/cheatsheets/shell/scripting/overview.md:
--------------------------------------------------------------------------------
1 | # Overview
2 |
3 | A quick reference of basic syntax.
4 |
5 | Tip - if you use Bash and use a multi-line statement in the console, then when you press up to run it again it will be flattened to one line.
6 |
7 |
8 | ## If
9 |
10 | ```sh
11 | if true; then
12 | echo 'Success'
13 | fi
14 |
15 | if true; then echo 'Success'; fi
16 | ```
17 |
18 |
19 | ## For
20 |
21 | ```sh
22 | for X in A B C; do
23 | echo $X
24 | done
25 |
26 | # One line.
27 | for X in A B C; do echo $x; done
28 |
29 | for X in ${MY_ARRAY[@]; do
30 | echo $X
31 | done
32 | ```
33 |
--------------------------------------------------------------------------------
/cheatsheets/javascript/deno/cli/releasing-asset.md:
--------------------------------------------------------------------------------
1 | # Releasing assets
2 |
3 | A bundled JS and compiled executable file can both be distributed.
4 |
5 | They both uploaded and attached as an asset on a GitHub Release. Use can even use GH Actions as CI to do this for you.
6 |
7 | Those assets be downloaded and run by others.
8 |
9 | Someone might download your binary and run it directly.
10 |
11 | You might use the bundle JS file in your own site's `index.html` page. Or serve it as a JS file or others to use. Like on NPM you can include your `dist` directory as assets, for use as NPM package installs.
12 |
--------------------------------------------------------------------------------
/cheatsheets/jekyll/liquid/variables.md:
--------------------------------------------------------------------------------
1 | # Variables
2 |
3 | {% raw %}
4 |
5 |
6 | ## Page variables
7 |
8 | For a page with path `demo/python/index.md`:
9 |
10 | ```liquid
11 | {{ page | inspect }}
12 | ```
13 |
14 | ```ruby
15 | {
16 | "layout"=>"page",
17 | "title"=>"Python",
18 | "content"=>"",
19 |
20 | "dir"=>"/demo/python/",
21 | "name"=>"index.md",
22 | "path"=>"demo/python/index.md",
23 |
24 | "url"=>"/demo/python/"
25 | }
26 | ```
27 |
28 | The value of `page.dir` is equivalent to:
29 |
30 | ```liquid
31 | {{ page.path | remove: page.name }}
32 | ```
33 |
34 | {% endraw %}
35 |
--------------------------------------------------------------------------------
/cheatsheets/python/libraries/queue-messaging/apache-kafka.md:
--------------------------------------------------------------------------------
1 | # Apache Kafka
2 |
3 | Kafka is a distributed streaming platform that can be used for building real-time data pipelines and streaming apps.
4 |
5 | ## Key Features
6 | - High-throughput, fault-tolerant, publish-subscribe messaging system
7 | - Scalable and durable storage
8 | - Stream processing
9 |
10 | ## Basic Usage with kafka-python
11 |
12 | ```python
13 | from kafka import KafkaProducer
14 |
15 | producer = KafkaProducer(bootstrap_servers=['localhost:9092'])
16 |
17 | producer.send('my-topic', b'Hello, Kafka!')
18 | producer.flush()
19 | ```
--------------------------------------------------------------------------------
/cheatsheets/shell/files/text-files/head-and-tail.md:
--------------------------------------------------------------------------------
1 | # Head and tail commands
2 |
3 | ## Head
4 |
5 | Get first 10 lines.
6 |
7 | ```
8 | head PATH
9 | ```
10 |
11 | Get first N lines.
12 |
13 | ```sh
14 | head -n N PATH
15 | ```
16 |
17 | ## Tail
18 |
19 | ```sh
20 | tail PATH
21 | ```
22 |
23 | ```sh
24 | tail -n PATH
25 | ```
26 |
27 | Watch file. There is also `-f` but I think `-F` works even if the file does not exist initially.
28 |
29 | ```sh
30 | tail -F PATH
31 | ```
32 |
33 | ## Head and tail
34 |
35 | Get a portion of a file.
36 |
37 | ```sh
38 | head -n 20 PATH | tail -n 10
39 | ```
40 |
--------------------------------------------------------------------------------
/cheatsheets/shell/scripting/docstring.md:
--------------------------------------------------------------------------------
1 | # Docstring
2 |
3 |
4 | ## Format
5 |
6 |
7 | ```sh
8 | # FUNCTION_NAME ARG1 ARG2
9 | # -----------------------
10 | # MY_DESCRIPTION
11 | # ...
12 | # ...
13 | FUNCTION_NAME () {
14 | MY_LOGIC
15 | }
16 | ```
17 |
18 | ## Example
19 |
20 | See [configure](https://github.com/python/cpython/blob/main/configure) in CPython repo.
21 |
22 | ```sh
23 | # as_fn_executable_p FILE
24 | # -----------------------
25 | # Test if FILE is an executable regular file.
26 | as_fn_executable_p ()
27 | {
28 | test -f "$1" && test -x "$1"
29 | } # as_fn_executable_p
30 | ```
31 |
--------------------------------------------------------------------------------
/cheatsheets/python/type-checks/basics/union.md:
--------------------------------------------------------------------------------
1 | # Union
2 |
3 | Use Union to allow a variable to be one of given types or values.
4 |
5 | ## Python 3.10
6 |
7 | ```python
8 | TYPE | TYPE | TYPE
9 |
10 | # e.g.
11 | float | int | str
12 | ```
13 |
14 |
15 |
16 | ## Python 3.8
17 |
18 | ```python
19 | Union[TYPE, TYPE, ...]
20 |
21 | # e.g.
22 | Union[float, int, str]
23 | ```
24 |
25 |
26 | ## Example
27 |
28 | Here we allow return value as integer or string.
29 |
30 | ```python
31 | def bar(bazz: bool) -> int | str:
32 | if bazz:
33 | return 'Yes'
34 |
35 | return 12
36 | ```
37 |
38 |
--------------------------------------------------------------------------------
/cheatsheets/shell/commands/read-write/tail.md:
--------------------------------------------------------------------------------
1 | # tail
2 |
3 |
4 | ## End of file
5 |
6 | Get the last 10 lines of a file.
7 |
8 | ```sh
9 | $ tail file.txt
10 | ```
11 |
12 | Get the last 100 lines of a file.
13 |
14 | ```sh
15 | $ tail -n 100 file.txt
16 | ```
17 |
18 |
19 | ## Follow
20 |
21 | This command will watch continuously for output and not exit.
22 |
23 | ```sh
24 | $ tail -f
25 | ```
26 |
27 | Or
28 |
29 | ```sh
30 | $ tail -f > /dev/null
31 | ```
32 |
33 |
34 | ## Selection
35 |
36 | Get lines 300 to 450 of a file.
37 |
38 | ```sh
39 | $ head -n 450 file.txt | tail -n 150
40 | ```
41 |
--------------------------------------------------------------------------------
/cheatsheets/version-control/git/submodules/github-view.md:
--------------------------------------------------------------------------------
1 | # GitHub view
2 |
3 | If you view a submodule on GitHub, you get a reference to the directory name and the commit.
4 |
5 | e.g.
6 |
7 | In the [themes](https://github.com/MichaelCurrin/hugo-quickstart/tree/master/themes) directory on my Hugo Quickstart, the submodule `ananke` is displayed in the GitHub UI as:
8 |
9 | - `ananke @ 0cc2c6c`
10 |
11 | In the [themes](https://github.com/MichaelCurrin/hexo-quickstart/tree/master/themes) directory of my Hexo Quickstart, the submodule `landscape` shows as
12 |
13 | - `landscape @ f20626c`
14 |
15 |
16 |
--------------------------------------------------------------------------------
/cheatsheets/javascript/packages/react/hooks/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Hooks
3 | description: Manage state in React components
4 | ---
5 |
6 | Hooks were added in React 16.8 and let you use state and lifecycle methods in a functional component, where before you had to use a class component.
7 |
8 | Note that hooks must be used in functions and not nested within each other. You cannot add a `useState` hook within a `useEffect` hook.
9 |
10 |
11 | ## Resources
12 |
13 | - [Intro to Hooks](https://reactjs.org/docs/hooks-intro.html) in the docs.
14 | - [Hooks at a glance](https://reactjs.org/docs/hooks-overview.html)
15 |
--------------------------------------------------------------------------------
/cheatsheets/javascript/packages/vue/events/types.md:
--------------------------------------------------------------------------------
1 | # Types
2 |
3 | Use like `@click`. Or chain events and modifiers as in other cheatsheet pages.
4 |
5 |
6 | ## Common event types
7 |
8 | Event name | Description
9 | --- | ---
10 | `click` | When the element is clicked
11 | `input` | Fires when user changes an input value.
12 | `change` | Fires when user changes the value and unfocusses input (for example, clicked somewhere outside)
13 | `keyup` | listen for keyboard events.
14 |
15 | There are a lot more. Use VS Code and a Vue extension and it will suggest all values when adding `@` to an element.
16 |
17 |
--------------------------------------------------------------------------------
/cheatsheets/shell/commands/read-write/vis.md:
--------------------------------------------------------------------------------
1 | # vis
2 |
3 | ## Help
4 |
5 | ```
6 | NAME
7 | vis -- display non-printable characters in a visual format
8 |
9 | SYNOPSIS
10 | vis [-cbflnostw] [-F foldwidth] [file ...]
11 |
12 | DESCRIPTION
13 | The vis utility is a filter for converting non-printable characters into a visual representation.
14 | It differs from `cat -v' in that the form is unique and invertible. By default, all non-graphic
15 | characters except space, tab, and newline are encoded. A detailed description of the various
16 | visual formats is given in vis(3).
17 | ```
18 |
--------------------------------------------------------------------------------
/cheatsheets/sql/advanced/update-table.md:
--------------------------------------------------------------------------------
1 | # Update table
2 |
3 | Recommended - do this in a **transaction**.
4 |
5 | Here we change the type of a column such as `VARCHAR(8)` to `VARCHAR(1024)`. We have to create an new column, copy the data to it and then get rid of the old column and rename the new one.
6 |
7 | - `query.sql`
8 | ```sql
9 | LOCK table_name;
10 | ALTER TABLE table_name ADD COLUMN column_new column_type;
11 | UPDATE table_name SET column_new = column_name;
12 | ALTER TABLE table_name DROP column_name;
13 | ALTER TABLE table_name RENAME column_new TO column_name;
14 | ```
15 |
--------------------------------------------------------------------------------
/cheatsheets/web/css/transform.md:
--------------------------------------------------------------------------------
1 | # Transform
2 |
3 | ## Examples
4 |
5 | ### Rotate
6 |
7 | ```css
8 | div.a {
9 | transform: rotate(20deg);
10 | }
11 | ```
12 |
13 | ### Skew
14 |
15 | ```css
16 | div.b {
17 | transform: skewY(20deg);
18 | }
19 | ```
20 |
21 | ### Scale
22 |
23 | `scale` or `scaleX` or `scaleY`.
24 |
25 | ```css
26 | div.c {
27 | transform: scaleY(1.5);
28 | }
29 | ```
30 |
31 | ### Translate 3D
32 |
33 | ```
34 | translate3d(-20%, 12%, 0);
35 | ```
36 |
37 | ### Combined
38 |
39 | ```css
40 | el {
41 | transform: skewY(-10deg) scale(1.2) translate3d(-20%, 12%, 0);
42 | }
43 | ```
44 |
--------------------------------------------------------------------------------
/cheatsheets/javascript/deno/ignoring-rules.md:
--------------------------------------------------------------------------------
1 | # Ignoring rules
2 |
3 |
4 |
5 | ## Ignore deno rule
6 |
7 | ```typescript
8 | // deno-lint-ignore no-undef
9 | document.getElementById('root')
10 | ```
11 |
12 |
13 | ## Ignore TypeScript rule
14 |
15 | See [Ignoring rules][] in the TypeScript section of Dev Cheatsheets.
16 |
17 | [Ignoring rules]: {% link cheatsheets/typescript/ignoring-rules.md %}
18 |
19 |
20 | ## Semantic checking
21 |
22 | Must be at the top of a file.
23 |
24 | Enable:
25 |
26 | ```typescript
27 | // @ts-check
28 | ```
29 |
30 | Disable:
31 |
32 | ```typescript
33 | // @ts-no-check
34 | ```
35 |
--------------------------------------------------------------------------------
/cheatsheets/javascript/packages/react/refs.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Refs
3 | description: Used to access DOM nodes or React elements created in the render method
4 | ---
5 |
6 | See [Refs and the DOM][] doc.
7 |
8 | [Refs and the DOM]: https://reactjs.org/docs/refs-and-the-dom.html
9 |
10 | ## Use-cases
11 |
12 | - Managing focus, text selection, or media playback.
13 | - Triggering imperative animations.
14 | - Integrating with third-party DOM libraries.
15 |
16 | Avoid using refs for anything that can be done declaratively.
17 |
18 |
19 | ## Access refs
20 |
21 | ```javascript
22 | const node = this.myRef.current;
23 | ```
24 |
--------------------------------------------------------------------------------
/cheatsheets/other/share-code.md:
--------------------------------------------------------------------------------
1 | # Share code
2 |
3 |
4 |
5 | - [pastebin.com/](https://pastebin.com/)
6 | - [sourceb.in](https://sourceb.in)
7 | - See also [sourcebin](https://www.npmjs.com/package/sourcebin) NPM package.
8 | > This wrapper is designed to easily create and get bins from sourcebin. You are also able to shorten the sourcebin links.
9 | - [hastebin.com](https://hastebin.com)
10 |
11 | See this [article](https://www.makeuseof.com/tag/4-alternatives-that-may-be-better-than-pastebin/) about some of these kind of tools.
12 |
--------------------------------------------------------------------------------
/cheatsheets/shell/commands/grep/resources.md:
--------------------------------------------------------------------------------
1 | # Resources
2 |
3 | ## Homepage
4 |
5 | - [Grep](https://www.gnu.org/software/grep/) on the GNU site.
6 |
7 |
8 | ## Man page
9 |
10 | - Linux: [ss64.com/bash/grep.html](https://ss64.com/bash/grep.html)
11 |
12 |
13 | ## Tutorials
14 |
15 | - [Grep](https://www.tutorialspoint.com/unix_commands/grep.htm) on TutorialsPoint.
16 | - [Linux grep command](https://www.computerhope.com/unix/ugrep.htm) 🔗
17 | - [Linux egrep command](https://www.computerhope.com/unix/uegrep.htm) 🔗
18 | - [Grep command in Linux Unix](https://www.journaldev.com/24271/grep-command-in-linux-unix) 🔗
19 |
--------------------------------------------------------------------------------
/cheatsheets/javascript/packages/react/hooks/callback.md:
--------------------------------------------------------------------------------
1 | # Callback hook
2 |
3 | > Returns a memoized callback.
4 |
5 | > Pass an inline callback and an array of dependencies.
6 | >
7 | > `useCallback` will return a memoized version of the callback that only changes if one of the dependencies has changed.
8 | >
9 | > This is useful when passing callbacks to optimized child components that rely on reference equality to prevent unnecessary renders (e.g. shouldComponentUpdate).
10 |
11 | Compare with `useMemo` - these are equivalent:
12 |
13 | ```javascript
14 | useCallback(fn, deps)
15 |
16 | useMemo(() => fn, deps)
17 | ```
18 |
--------------------------------------------------------------------------------
/cheatsheets/web/html/clickable.md:
--------------------------------------------------------------------------------
1 | # Clickable
2 |
3 | If you want to make any element appear that it is clickable like a button or anchor tag.
4 |
5 | Set the cursor on that object to `pointer`. Note that you do **not** need the `:hover` modifier for this work.
6 |
7 | Here the hover behavior is set to change the text color on hover.
8 |
9 | - HTML:
10 | ```html
11 |