[
  {
    "path": ".commitlintrc.js",
    "content": "module.exports = {\n  extends: ['@commitlint/config-conventional'],\n  rules: {\n    'type-enum': [\n      2,\n      'always',\n      [\n        'feat', // new feature\n        'fix', // bug fix\n        'docs', // documentation update\n        'style', // code formatting, no logic changes\n        'refactor', // code refactoring\n        'perf', // performance optimization\n        'test', // add tests\n        'chore', // build process or auxiliary tool changes\n        'ci', // CI/CD related changes\n        'build', // build system or external dependency changes\n        'revert' // revert commit\n      ]\n    ],\n    'scope-enum': [\n      2,\n      'always',\n      [\n        'search', // search functionality\n        'theme', // theme related\n        'css', // style files\n        'js', // JavaScript files\n        'content', // content files\n        'build', // build related\n        'deps', // dependency updates\n        'config', // configuration files\n        'docs', // documentation\n        'layout', // layout templates\n        'widget', // components\n        'gulp', // Gulp tasks\n        'hexo', // Hexo related\n        'markdown', // Markdown processing\n        'seo', // SEO optimization\n        'a11y', // accessibility\n        'perf' // performance related\n      ]\n    ],\n    'subject-case': [2, 'never', ['start-case', 'pascal-case', 'upper-case']],\n    'subject-empty': [2, 'never'],\n    'subject-full-stop': [2, 'never', '.'],\n    'type-case': [2, 'always', 'lower-case'],\n    'type-empty': [2, 'never']\n  }\n};\n"
  },
  {
    "path": ".dockerignore",
    "content": "node_modules/\ntest\n*.log\nDockerfile*\nREADME.md\nLICENSE\nstyle.tailwindcss\n\n.idea/\n.github/\n.travis.yml\n.eslintignore\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ngithub: Fechin # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]\npatreon: # Replace with a single Patreon username\nopen_collective: # Replace with a single Open Collective username\nko_fi: # Replace with a single Ko-fi username\ntidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel\ncommunity_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry\nliberapay: # Replace with a single Liberapay username\nissuehunt: # Replace with a single IssueHunt username\notechie: # Replace with a single Otechie username\ncustom: [\"https://coff.ee/cheatsheets.zip\"]\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/cheatsheet-request.md",
    "content": "---\nname: Cheatsheet request\nabout: For request cheatsheet and reference.\ntitle: 'Cheatsheet request: '\nlabels: request\nassignees: Fechin\n---\n"
  },
  {
    "path": ".gitignore",
    "content": "# OS generated files #\n######################\n.DS_Store\n.DS_Store?\n._*\n.Spotlight-V100\n.Trashes\nehthumbs.db\nThumbs.db\nnohup.out\n*.tmp\n*.temp\n\n# Environment files #\n######################\n.env\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n.python-version\n.venv\n.ipynb_checkpoints\n\n# Logs #\n######################\n*.log\nlogs/\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n.pnpm-debug.log*\n\n# Editor files #\n######################\n.idea/\n.vscode/\n*.swp\n*.swo\n*~\n.vim/\n.emacs.d/\n.sublime-*\n\n# Node.js #\n######################\nnode_modules/\ndist/\nbuild/\ncoverage/\n.nyc_output/\n.cache/\n.parcel-cache/\n.next/\n.nuxt/\n.vuepress/dist/\n.serverless/\n.fusebox/\n.dynamodb/\n.tern-port\npackage-lock.json\n\n# Testing #\n######################\n.jest/\n.coverage/\njunit.xml\ntest-results/\n\n# Build artifacts #\n######################\nthemes/coo/source/css/style.css\npublic/\ndb.json\n*.tgz\n*.tar.gz\n\n# Security #\n######################\n.npmrc\n.yarnrc\n.pnpm-store/\n\n# Misc #\n######################\n.eslintcache\n.stylelintcache\n.prettierignore\n"
  },
  {
    "path": ".gitmessage",
    "content": "# <type>[optional scope]: <description>\n#\n# [optional body]\n#\n# [optional footer(s)]\n#\n# Commit Types:\n# feat:     New feature\n# fix:      Bug fix\n# docs:     Documentation update\n# style:    Code formatting, no logic changes\n# refactor: Code refactoring, neither new feature nor bug fix\n# perf:     Performance optimization\n# test:     Add tests\n# chore:    Build process or auxiliary tool changes\n# ci:       CI/CD related changes\n# build:    Build system or external dependency changes\n# revert:   Revert commit\n#\n# Scope Examples:\n# search, theme, css, js, content, build, deps, config, docs\n# layout, widget, gulp, hexo, markdown, seo, a11y, perf\n#\n# Examples:\n# feat(search): add fuzzy search with highlighting\n# fix(css): resolve mobile layout overflow issue\n# docs(readme): update installation instructions\n# chore(deps): upgrade tailwindcss to v3.4.0\n# perf(js): optimize search performance with debouncing\n# style(css): format tailwind classes according to prettier\n#\n# Guidelines:\n# - Use imperative mood: \"add\" not \"added\" or \"adds\"\n# - Start with lowercase\n# - No period at the end\n# - Keep description concise, under 50 characters"
  },
  {
    "path": ".husky/commit-msg",
    "content": "npx commitlint --edit $1\n"
  },
  {
    "path": ".husky/pre-commit",
    "content": "npx lint-staged\n"
  },
  {
    "path": ".lintstagedrc.js",
    "content": "module.exports = {\n  // JavaScript files\n  '*.{js,mjs}': ['eslint --fix', 'prettier --write'],\n\n  // CSS files\n  '*.css': ['stylelint --fix', 'prettier --write'],\n\n  // All other files that Prettier supports\n  '*.{md,json,yml,yaml}': ['prettier --write']\n};\n"
  },
  {
    "path": ".prettierrc.js",
    "content": "module.exports = {\n  // Basic configuration\n  semi: true,\n  trailingComma: 'none',\n  singleQuote: true,\n  printWidth: 100,\n  tabWidth: 2,\n  useTabs: false,\n  endOfLine: 'lf',\n\n  // Plugin configuration\n  plugins: ['prettier-plugin-tailwindcss'],\n\n  // File-specific configuration\n  overrides: [\n    {\n      files: '*.md',\n      options: {\n        proseWrap: 'preserve',\n        printWidth: 80\n      }\n    },\n    {\n      files: '*.yml',\n      options: {\n        singleQuote: false\n      }\n    },\n    {\n      files: '*.json',\n      options: {\n        trailingComma: 'none'\n      }\n    },\n    {\n      files: ['themes/coo/source/css/*.css'],\n      options: {\n        printWidth: 120\n      }\n    }\n  ]\n};\n"
  },
  {
    "path": ".stylelintrc.js",
    "content": "module.exports = {\n  extends: ['stylelint-config-standard'],\n  rules: {\n    // Tailwind CSS compatibility\n    'at-rule-no-unknown': [\n      true,\n      {\n        ignoreAtRules: ['tailwind', 'apply', 'variants', 'responsive', 'screen', 'layer']\n      }\n    ],\n    // Disable @apply deprecation warning, as this is a Tailwind CSS feature\n    'at-rule-no-deprecated': null,\n    // Allow duplicate selectors, as this is common in generated CSS\n    'no-descending-specificity': null,\n    'no-duplicate-selectors': null,\n    // Allow camelCase class names\n    'selector-class-pattern': null,\n    // Allow camelCase ID selectors\n    'selector-id-pattern': null,\n    // Allow unknown properties (Tailwind generated CSS variables)\n    'property-no-unknown': null,\n    // Allow unknown type selectors (custom elements)\n    'selector-type-no-unknown': null,\n    // Allow unknown declaration values\n    'declaration-property-value-no-unknown': null,\n    // Allow duplicate custom properties\n    'declaration-block-no-duplicate-custom-properties': null,\n    // Allow multiple declarations on single line\n    'declaration-block-single-line-max-declarations': null,\n    // Allow decimal precision\n    'number-max-precision': null,\n    // Allow unknown media feature values\n    'media-feature-name-value-no-unknown': null,\n    // Allow non-kebab-case keyframe names\n    'keyframes-name-pattern': null,\n    // Allow empty source files\n    'no-empty-source': null\n  },\n  ignoreFiles: [\n    'node_modules/**/*',\n    'public/**/*',\n    'themes/coo/source/css/highlightjs/**/*',\n    '**/*.min.css'\n  ]\n};\n"
  },
  {
    "path": "Dockerfile",
    "content": "# Stage 1: build the application\nFROM node:19 AS build-app\nWORKDIR /app\nCOPY . .\nRUN npm install -g pnpm\nRUN pnpm install\nRUN pnpm run build\n\n# Stage 2: Build nginx\nFROM nginx:alpine AS build-nginx\nWORKDIR /usr/share/nginx/html/\nCOPY --from=build-app /app/public /usr/share/nginx/html/\nRUN rm -rf /etc/nginx/conf.d/*\nCOPY nginx.conf /etc/nginx/\nEXPOSE 80\n\n# Stage 3: final image\nFROM alpine:latest\nRUN apk add --no-cache nginx && mkdir -p /run/nginx\nCOPY --from=build-nginx /usr/share/nginx/html/ /usr/share/nginx/html/\nCOPY --from=build-nginx /etc/nginx/nginx.conf /etc/nginx/nginx.conf\nEXPOSE 80\nHEALTHCHECK --interval=1s --timeout=3s CMD wget -q -O - http://localhost:80 || exit 1\nCMD [\"nginx\", \"-g\", \"daemon off;\"]\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "# 📖 Reference - Cheat Sheets for Developers\n\n[![love](https://badgen.net/badge/make%20with/love/pink)](#)\n[![License](https://badgen.net/badge/license/GPL-3.0/blue)](https://github.com/Fechin/reference/blob/main/LICENSE)\n[![Follow us on Twitter](https://img.shields.io/twitter/follow/FechinLi?style=social)](https://twitter.com/FechinLi)\n\nReference is a collection of cheat sheets contributed by open source angels. It shares a quick reference cheat sheet for\ndevelopers in a nice layout. \\[ [中文版](https://github.com/jaywcjlove/reference) | ... \\]\n\nWe encourage you to share your own cheat sheets with the community and make Reference even better. If you notice a cheat\nsheet that could be improved, feel free to submit a [pull request](#-contributing).\n\n## 👀 Live Demonstration\n\nNote: The original domain for this project was quickref.me, which was acquired by a US-based company. Since then,\ncheatsheets.zip is the primary and maintained domain (All within the bounds of the agreements).\n\nYou can view the most up-to-date cheat sheets live at [https://cheatsheets.zip](https://cheatsheets.zip/).\n\n[![Quick reference](https://cheatsheets.zip/assets/image/preview.png?9nd3)](https://cheatsheets.zip)\n\n## 📚 Cheat Sheets List\n\nReference provides cheat sheets for the following:\n\n<details>\n<summary>Programming</summary>\n\n- [Bash](https://cheatsheets.zip/bash.html): This is a quick reference cheat sheet to getting started with Linux bash\n  shell scripting.\n- [C](https://cheatsheets.zip/c.html): C quick reference cheat sheet that provides basic syntax and methods.\n- [C++](https://cheatsheets.zip/cpp.html): C++ quick reference cheat sheet that provides basic syntax and methods.\n- [C#](https://cheatsheets.zip/cs.html): C# quick reference cheat sheet that provides basic syntax and methods.\n- [CSS 3](https://cheatsheets.zip/css.html): This is a quick reference cheat sheet for CSS goodness, listing selector\n  syntax, properties, units and other useful bits of information.\n- [Dart](https://cheatsheets.zip/dart.html): A Dart cheat sheet with the most important concepts, functions, methods,\n  and more. A complete quick reference for beginners.\n- [Docker](https://cheatsheets.zip/docker.html): This is a quick reference cheat sheet for\n  [Docker](https://docs.docker.com/get-started/). And you can find the most common Docker commands here.\n- [ES6](https://cheatsheets.zip/es6.html): A quick reference cheat sheet of what’s new in JavaScript for ES2015, ES2016,\n  ES2017, ES2018 and beyond\n- [Go](https://cheatsheets.zip/go.html): This cheat sheet provided basic syntax and methods to help you using\n  [Go](https://go.dev/).\n- [GraphQL](https://cheatsheets.zip/graphql.html): This quick reference cheat sheet provides a brief overview of\n  GraphQL.\n- [Hook](https://cheatsheets.zip/hook.html): The [Hook](https://github.com/hook-lang/hook/) cheat sheet is a one-page\n  reference sheet for the Hook programming language.\n- [HTML](https://cheatsheets.zip/html.html): This HTML quick reference cheat sheet lists the common HTML and HTML5 tags\n  in readable layout.\n- [INI](https://cheatsheets.zip/ini.html): This is a quick reference cheat sheet for understanding and writing\n  INI-format configuration files.\n- [Java](https://cheatsheets.zip/java.html): This cheat sheet is a crash course for Java beginners and help review the\n  basic syntax of the Java language.\n- [JavaScript](https://cheatsheets.zip/javascript.html): A JavaScript cheat sheet with the most important concepts,\n  functions, methods, and more. A complete quick reference for beginners.\n- [jQuery](https://cheatsheets.zip/jquery.html): This [jQuery](https://jquery.com/) cheat sheet is a great reference for\n  both beginners and experienced developers.\n- [Kubernetes](https://cheatsheets.zip/kubernetes.html): This page contains a list of commonly used kubectl commands and\n  flags.\n- [LaTeX](https://cheatsheets.zip/latex.html): This cheat sheet summarizes a reference list of\n  [LaTeX](https://www.latex-project.org/) commonly used display math notation and some application examples of\n  [KaTeX](https://katex.org/).\n- [Laravel](https://cheatsheets.zip/laravel.html): [Laravel](https://laravel.com/docs/8.x/) is an expressive and\n  progressive web application framework for PHP. This cheat sheet provides a reference for common commands and features\n  for Laravel 8.\n- [MATLAB](https://cheatsheets.zip/matlab.html): This quick reference cheat sheet provides an example introduction to\n  using the [MATLAB](https://mathworks.cn/) scientific computing language to get started quickly\n- [Markdown](https://cheatsheets.zip/markdown.html): This is a quick reference cheat sheet to the Markdown syntax.\n- [PHP](https://cheatsheets.zip/php.html): This [PHP](https://www.php.net/manual/en/) cheat sheet provides a reference\n  for quickly looking up the correct syntax for the code you use most frequently.\n- [Python](https://cheatsheets.zip/python.html): The [Python](https://www.python.org/) cheat sheet is a one-page\n  reference sheet for the Python 3 programming language.\n- [Rust](https://cheatsheets.zip/rust.html): The Rust quick reference cheat sheet that aims at providing help on writing\n  basic syntax and methods.\n- [Sass](https://cheatsheets.zip/sass.html): This is a quick reference cheat sheet that lists the most useful features\n  of [SASS](https://sass-lang.com).\n- [TOML](https://cheatsheets.zip/toml.html): This is a quick reference cheat sheet to the TOML format configuration file\n  syntax.\n- [VHDL](https://cheatsheets.zip/vhdl.html): VHDL (VHSIC Hardware Description Language) cheat sheet - A comprehensive reference for digital hardware design and simulation.\n- [YAML](https://cheatsheets.zip/yaml.html): This is a quick reference cheat sheet for understanding and writing YAML\n  format configuration files.\n\n</details>\n\n<details>\n<summary>Toolkit</summary>\n\n- [ChatGPT](https://cheatsheets.zip/chatgpt.html): This cheat sheet lists out prompts and tips from all over the world\n  on how to use ChatGPT effectively\n- [VSCode](https://cheatsheets.zip/vscode.html): This VSCode (Visual Studio Code) quick reference cheat sheet shows its\n  keyboard shortcuts and commands.\n- [Mitmproxy](https://cheatsheets.zip/mitmproxy.html): [Mitmproxy](https://mitmproxy.org/) is a free and open source\n  interactive HTTPS proxy. This is a quick reference cheat sheet to the Mitmproxy.\n- [XPath](https://cheatsheets.zip/xpath.html): This is an [XPath](https://en.wikipedia.org/wiki/XPath) selectors cheat\n  sheet, which lists commonly used XPath positioning methods and CSS selectors\n- [Emacs](https://cheatsheets.zip/emacs.html): [Emacs](https://www.gnu.org/software/emacs) is the extensible,\n  customizable, self-documenting real time display text editor. This reference was made for Emacs 27.\n- [Emmet](https://cheatsheets.zip/emmet.html): [Emmet](https://emmet.io/) is a web-developer’s toolkit for boosting HTML\n  & CSS code writing, which allows you to write large HTML code blocks at speed of light using well-known CSS selectors.\n- [RegEX](https://cheatsheets.zip/regex.html): A quick reference for regular expressions (regex), including symbols,\n  ranges, grouping, assertions and some sample patterns to get you started.\n- [Vim](https://cheatsheets.zip/vim.html): A useful collection of [Vim](http://www.vim.org/) 8.2 quick reference cheat\n  sheets to help you learn vim editor faster.\n\n</details>\n\n<details>\n<summary>Linux Command</summary>\n\n- [Curl](https://cheatsheets.zip/curl.html): This [Curl](https://github.com/curl/curl) cheat sheet contains commands and\n  examples of some common Curl tricks.\n- [PM2](https://cheatsheets.zip/pm2.html): [PM2] is a daemon process manager that will help you manage and keep your\n  application online. Getting started with PM2 is straightforward, it is offered as a simple and intuitive CLI.\n- [Chmod](https://cheatsheets.zip/chmod.html): This quick reference cheat sheet provides a brief overview of file\n  permissions, and the operation of the chmod command\n- [Tmux](https://cheatsheets.zip/tmux.html): The tmux cheat sheet quick reference of most commonly used shortcuts and\n  commands\n- [Lsof](https://cheatsheets.zip/lsof.html): This quick reference cheat sheet provides various for using lsof command.\n- [SSH](https://cheatsheets.zip/ssh.html): This quick reference cheat sheet provides various for using SSH.\n- [Netstat](https://cheatsheets.zip/netstat.html): This quick reference cheat sheet provides various for using netstat\n  command.\n- [Screen](https://cheatsheets.zip/screen.html): This is a quick reference guide cheat sheet for the screen command.\n- [Awk](https://cheatsheets.zip/awk.html): This is a one page quick reference cheat sheet to the\n  [GNU awk](https://www.gnu.org/software/gawk/manual/gawk.html), which covers commonly used awk expressions and\n  commands.\n- [Find](https://cheatsheets.zip/find.html): This is a quick reference list of cheat sheet for Linux find command,\n  contains common options and examples.\n- [Sed](https://cheatsheets.zip/sed.html): [Sed](https://www.gnu.org/software/sed/manual/sed.html) is a stream editor,\n  this sed cheat sheet contains sed commands and some common sed tricks.\n- [Cron](https://cheatsheets.zip/cron.html): [Cron](https://en.wikipedia.org/wiki/Cron) is most suitable for scheduling\n  repetitive tasks. Scheduling one-time tasks can be accomplished using the associated at utility.\n- [Git](https://cheatsheets.zip/git.html): This cheat sheet summarizes commonly used Git command line instructions for\n  quick reference.\n- [Grep](https://cheatsheets.zip/grep.html): This cheat sheet is intended to be a quick reminder for the main concepts\n  involved in using the command line program grep and assumes you already understand its usage.\n- [Netcat](https://cheatsheets.zip/nc.html): This cheat sheet provides various for using netcat on both Linux and Unix.\n- [Taskset](https://cheatsheets.zip/taskset): This quick reference cheat sheet for tasket command.\n- [GnuPG](https://cheatsheets.zip/gnupg): A cheatsheet for GnuPG, the encryption and signing software.\n</details>\n\n<details>\n<summary>Python</summary>\n\n- [NumPy](https://cheatsheets.zip/numpy.html): [NumPy](https://numpy.org/) is the fundamental package for scientific\n  computing with Python. This cheat sheet is a quick reference for NumPy beginners.\n- [Pandas](https://cheatsheets.zip/pandas.html): [Pandas](https://pandas.pydata.org/) is a powerful data analysis and\n  manipulation library for Python. This quick reference cheat sheet provides an overview of essential Pandas functions,\n  methods, and DataFrame operations.\n\n</details>\n\n<details>\n<summary>Database</summary>\n\n- [MySQL](https://cheatsheets.zip/mysql.html): The SQL cheat sheet provides you with the most commonly used SQL\n  statements for your reference.\n- [Neo4j](https://cheatsheets.zip/neo4j.html): A Neo4j cheat sheet with getting started resources and information on how\n  to query the database with Cypher.\n- [PostgreSQL](https://cheatsheets.zip/postgres.html): The [PostgreSQL](https://www.postgresql.org/docs/current/) cheat\n  sheet provides you with the common PostgreSQL commands and statements.\n- [Redis](https://cheatsheets.zip/redis.html): This is a [Redis](https://redis.io/) quick reference cheat sheet that\n  lists examples of redis commands\n\n</details>\n\n<details>\n<summary>Keyboard Shortcuts</summary>\n\n- [Adobe Photoshop](https://cheatsheets.zip/adobe-photoshop.html): A visual cheat-sheet for the 283 keyboard shortcuts\n  found in Adobe Photoshop\n- [Apex Legends](https://cheatsheets.zip/apex-legends.html): A visual cheat-sheet for the 27 default keyboard shortcuts\n  found in Apex Legends\n- [Figma](https://cheatsheets.zip/figma.html): A visual cheat-sheet for the 119 keyboard shortcuts found in Figma\n- [Microsoft Teams](https://cheatsheets.zip/microsoft-teams.html): A visual cheat-sheet for the 38 keyboard shortcuts\n  found in Microsoft Teams\n- [TablePlus](https://cheatsheets.zip/table-plus.html): A visual cheat-sheet for the 34 keyboard shortcuts found in\n  TablePlus\n- [Bear](https://cheatsheets.zip/bear-notes.html): A visual cheat-sheet for the 66 keyboard shortcuts found in Bear.\n  This application is MacOS-only.\n- [Feedly](https://cheatsheets.zip/feedly.html): A visual cheat-sheet for the 25 keyboard shortcuts found on the Feedly\n  app\n- [FileZilla](https://cheatsheets.zip/filezilla.html): A visual cheat-sheet for the 30 keyboard shortcuts found on the\n  FileZilla program\n- [Reddit](https://cheatsheets.zip/reddit.html): A visual cheat-sheet for the 17 keyboard shortcuts found on Reddit.com\n- [Slack](https://cheatsheets.zip/slack.html): A visual cheat-sheet for the 62 keyboard shortcuts found in Slack\n- [SoundCloud](https://cheatsheets.zip/soundcloud.html): A visual cheat-sheet for the 22 keyboard shortcuts found on\n  SoundCloud\n- [Twitter](https://cheatsheets.zip/twitter.html): A visual cheat-sheet for the 26 keyboard shortcuts found on Twitter\n- [Android Studio](https://cheatsheets.zip/android-studio.html): A visual cheat-sheet for the 130 keyboard shortcuts\n  found in the Android Studio software\n- [Github](https://cheatsheets.zip/github.html): A visual cheat-sheet for the 80 keyboard shortcuts found on Github.com\n- [Shopify](https://cheatsheets.zip/shopify.html): A visual cheat-sheet for the 50 keyboard shortcuts found on the\n  Shopify website\n- [Zoom](https://cheatsheets.zip/zoom.html): A visual cheat-sheet for the 32 keyboard shortcuts found in Zoom. These\n  shortcuts are for MacOS, for Windows visit /zoom-windows.\n- [Adobe XD](https://cheatsheets.zip/adobe-xd.html): A visual cheat-sheet for the 97 keyboard shortcuts found in Adobe\n  XD\n- [Firefox](https://cheatsheets.zip/firefox.html): A visual cheat-sheet for the 116 keyboard shortcuts found in Firefox\n- [PhpStorm](https://cheatsheets.zip/phpstorm.html): A visual cheat-sheet for the 96 keyboard shortcuts found in\n  JetBrains PhpStorm\n- [Postman](https://cheatsheets.zip/postman.html): A visual cheat-sheet for the 23 keyboard shortcuts found in Postman\n- [Webflow](https://cheatsheets.zip/webflow.html): A visual cheat-sheet for the 41 keyboard shortcuts found in Webflow\n- [Adobe Lightroom CC](https://cheatsheets.zip/adobe-lightroom.html): A visual cheat-sheet for the 251 keyboard\n  shortcuts found in Adobe Lightroom CC\n- [1Password](https://cheatsheets.zip/1password.html): A cheat sheet for 1password's keyboard shortcuts in Mac, Windows,\n  iOS, Linux.\n- [Affinity Designer](https://cheatsheets.zip/affinity-designer.html): A visual cheat-sheet for the 108 keyboard\n  shortcuts found in Affinity Designer\n- [Pocket](https://cheatsheets.zip/pocket.html): A visual cheat-sheet for the 36 keyboard shortcuts found on Pocket for\n  Web\n- [Trello](https://cheatsheets.zip/trello.html): A visual cheat-sheet for the 29 keyboard shortcuts found on Trello\n- [Audacity](https://cheatsheets.zip/audacity.html): A visual cheat-sheet for the 135 default keyboard shortcuts found\n  in Audacity\n- [Framer X](https://cheatsheets.zip/framer-x.html): A visual cheat-sheet for the 45 keyboard shortcuts found in Framer\n  X. This application is MacOS-only.\n- [Google Drive](https://cheatsheets.zip/google-drive.html): A visual cheat-sheet for the 54 keyboard shortcuts found in\n  Google Drive on the web\n- [PuTTy](https://cheatsheets.zip/putty.html): A visual cheat-sheet for the 32 keyboard shortcuts found on the PuTTy app\n- [Sequel Pro](https://cheatsheets.zip/sequel-pro.html): A visual cheat-sheet for the 71 keyboard shortcuts found in\n  Sequel Pro. This application is MacOS-only.\n- [Apple Music](https://cheatsheets.zip/apple-music.html): A visual cheat-sheet for the 62 keyboard shortcuts found in\n  the Apple Music app. This application is MacOS-only.\n- [Blender](https://cheatsheets.zip/blender.html): A visual cheat-sheet for the 187 keyboard shortcuts found in Blender\n- [Obsidian](https://cheatsheets.zip/obsidian.html): A visual cheat-sheet for the 17 keyboard shortcuts found in the\n  Obsidian knowledge base app.\n- [Telegram Desktop](https://cheatsheets.zip/telegram.html): A visual cheat-sheet for the 37 keyboard shortcuts found on\n  the Telegram Desktop app\n- [YouTube](https://cheatsheets.zip/youtube.html): A visual cheat-sheet for the 18 keyboard shortcuts found on\n  YouTube.com\n- [Airtable](https://cheatsheets.zip/airtable.html): A visual cheat-sheet for the 36 keyboard shortcuts found in\n  Airtable\n- [Bitbucket](https://cheatsheets.zip/bitbucket.html): A visual cheat-sheet for the 35 keyboard shortcuts found on\n  Bitbucket\n- [Fortnite](https://cheatsheets.zip/fortnite.html): A visual cheat-sheet for the 26 default keyboard shortcuts found in\n  Fortnite\n- [Gmail](https://cheatsheets.zip/gmail.html): A visual cheat-sheet for the 90 keyboard shortcuts found on Gmail\n- [Sketch](https://cheatsheets.zip/sketch.html): A visual cheat-sheet for the 149 keyboard shortcuts found in Sketch.\n  This application is MacOS-only.\n- [Spotify](https://cheatsheets.zip/spotify.html): A visual cheat-sheet for the 23 keyboard shortcuts found in Spotify\n- [Brave Browser](https://cheatsheets.zip/brave.html): A visual cheat-sheet for the 64 keyboard shortcuts found in the\n  Brave browser\n- [KanbanMail](https://cheatsheets.zip/kanbanmail.html): A visual cheat-sheet for the 29 keyboard shortcuts found in\n  KanbanMail\n- [Microsoft Outlook](https://cheatsheets.zip/outlook.html): A visual cheat-sheet for the 210 keyboard shortcuts found\n  in Microsoft Outlook\n- [Principle](https://cheatsheets.zip/principle.html): A visual cheat-sheet for the 30 keyboard shortcuts found in\n  Principle. This application is MacOS-only.\n- [Skype](https://cheatsheets.zip/skype.html): A visual cheat-sheet for the 31 keyboard shortcuts found in Skype\n- [Arduino IDE](https://cheatsheets.zip/arduino.html): A visual cheat-sheet for the 12 keyboard shortcuts found in the\n  Arduino IDE\n- [Asana](https://cheatsheets.zip/asana.html): A visual cheat-sheet for the 40 keyboard shortcuts found in Asana\n- [Code Editor for iOS](https://cheatsheets.zip/code-editor-ios.html): A visual cheat-sheet for the 43 keyboard\n  shortcuts found in the Code Editor for iOS app. This application is MacOS-only.\n- [Jira](https://cheatsheets.zip/jira.html): A visual cheat-sheet for the 44 keyboard shortcuts found in Jira\n- [Quip.com](https://cheatsheets.zip/quip.html): A visual cheat-sheet for the 52 keyboard shortcuts found in Quip\n- [WordPress](https://cheatsheets.zip/wordpress.html): A visual cheat-sheet for the 34 keyboard shortcuts found in the\n  WordPress visual editor\n- [Chrome Developer Tools](https://cheatsheets.zip/chrome-devtools.html): A visual cheat-sheet for the 56 keyboard\n  shortcuts found in Chrome's Developer Tools\n- [GIMP](https://cheatsheets.zip/gimp.html): A visual cheat-sheet for the 97 keyboard shortcuts found in GIMP\n- [Google Chrome](https://cheatsheets.zip/google-chrome.html): A visual cheat-sheet for the 65 keyboard shortcuts found\n  in Google Chrome\n- [Todoist](https://cheatsheets.zip/todoist.html): A visual cheat-sheet for the 37 keyboard shortcuts found in Todoist\n- [TickTick](https://cheatsheets.zip/ticktick.html): A visual cheat-sheet for the 25 keyboard shortcuts found in the\n  TickTick desktop app\n- [VLC Player](https://cheatsheets.zip/vlc.html): A visual cheat-sheet for the 82 keyboard shortcuts found in VLC Player\n- [Missive](https://cheatsheets.zip/missive.html): A visual cheat-sheet for the 83 keyboard shortcuts found in Missive\n- [Origami Studio](https://cheatsheets.zip/origami.html): A visual cheat-sheet for the 71 keyboard shortcuts found in\n  Origami Studio. This application is MacOS-only.\n- [Sublime Text](https://cheatsheets.zip/sublime-text.html): A visual cheat-sheet for the 49 keyboard shortcuts found in\n  Sublime Text\n- [Transmit](https://cheatsheets.zip/transmit.html): A visual cheat-sheet for the 62 keyboard shortcuts found in\n  Transmit. This application is MacOS-only.\n- [Affinity Photo](https://cheatsheets.zip/affinity-photo.html): A visual cheat-sheet for the 177 keyboard shortcuts\n  found in Affinity Photo\n- [Monday.com](https://cheatsheets.zip/monday.html): A visual cheat-sheet for the 24 keyboard shortcuts found on\n  Monday.com\n- [Proto.io](https://cheatsheets.zip/proto-io.html): A visual cheat-sheet for the 48 keyboard shortcuts found in\n  Proto.io\n- [Superhuman](https://cheatsheets.zip/superhuman.html): A visual cheat-sheet for the 105 keyboard shortcuts found in\n  Superhuman. This application is MacOS-only.\n- [Vivaldi Browser](https://cheatsheets.zip/vivaldi.html): A visual cheat-sheet for the 69 default keyboard shortcuts\n  found in the Vivaldi browser\n- [Finder](https://cheatsheets.zip/finder.html): A visual cheat-sheet for the 55 keyboard shortcuts found in Finder.\n  This application is part of MacOS.\n- [GitLab](https://cheatsheets.zip/gitlab.html): A visual cheat-sheet for the 58 keyboard shortcuts found in GitLab\n- [Guitar Pro](https://cheatsheets.zip/guitar-pro.html): A visual cheat-sheet for the 129 keyboard shortcuts found in\n  Guitar Pro\n- [Roam Research](https://cheatsheets.zip/roam.html): A visual cheat-sheet for the 45 keyboard shortcuts found on Roam\n  Research\n- [SketchUp Pro](https://cheatsheets.zip/sketchup.html): A visual cheat-sheet for the 135 default keyboard shortcuts\n  found in SketchUp Pro\n- [Unity 3D](https://cheatsheets.zip/unity-3d.html): A visual cheat-sheet for the 50 keyboard shortcuts found in Unity\n  3D\n- [IntelliJ IDEA](https://cheatsheets.zip/idea.html): IntelliJ IDEA is a very good Java IDE, most of its commands have\n  shortcuts to keep your hands from leaving the keyboard\n- [WebStorm](https://cheatsheets.zip/webstorm.html): This quick reference cheat sheet lists the default keyboard\n  shortcuts for WebStorm running on Windows/Linux or Mac\n\n</details>\n\n<details>\n<summary>Shaders</summary>\n\n- [Unity Shader Graph](https://cheatsheets.zip/unity-shader-graph.html): This is a visual cheat-sheet for the Unity\n  Shader Graph. This tool is used to create custom shaders material in Unity, a popular game engine.\n\n</details>\n\n<details>\n<summary>Game</summary>\n\n- [Minecraft Java](https://cheatsheets.zip/minecraft-java.html): A comprehensive reference for Minecraft Java Edition (1.20.x) commands.\n- [Minecraft Bedrock](https://cheatsheets.zip/minecraft-bedrock.html): A comprehensive reference for Minecraft Bedrock Edition (1.20.x) commands.\n\n</details>\n\n<details>\n<summary>Other</summary>\n\n- [ASCII Code](https://cheatsheets.zip/ascii-code.html): This cheat sheet is a complete list of ASCII Code Table with\n  their numbers and names.\n- [Aspect Ratio](https://cheatsheets.zip/aspect-ratio.html): This cheat sheet lists some common aspect ratios and their\n  pixel resolutions. Always confirm your final delivery ratio when shooting.\n- [CheatSheets](https://cheatsheets.zip/quickref.html): This is the magic syntax variant manual that you can use on\n  CheatSheets.zip, It’s a good practice for contributors.\n- [Emoji](https://cheatsheets.zip/emoji.html): Some of the emoji codes are not super easy to remember, so here is a\n  little cheat sheet.\n- [Google Search](https://cheatsheets.zip/google-search.html): This quick reference cheat sheet lists of Google advanced\n  search operators.\n- [HTML Characters Entities](https://cheatsheets.zip/html-char.html): This cheat sheet is a complete list of HTML\n  entities with their numbers and names. Also included is a full list of ASCII characters that can be represented in\n  HTML.\n- [ISO 639-1 Language Code](https://cheatsheets.zip/iso-639-1.html): This is a list of the ISO language codes that\n  conform to the ISO 639-1 standard, it provide reference for multi-language website.\n- [HTTP Status Code](https://cheatsheets.zip/http-status-code.html): The http status codes cheat sheet. A quick\n  reference to every HTTP status code.\n- [MIME types](https://cheatsheets.zip/mime.html): This cheat sheet lists some common MIME types for the Web. You can\n  look in the [IANA/MIME Media Types registry](http://www.iana.org/assignments/media-types/index.html) which contains\n  all registered MIME types.\n- [Resolutions](https://cheatsheets.zip/resolutions.html): This cheat sheet lists screen sizes, viewport size and CSS\n  media queries for popular Phones, Tablets, Laptops and Watches\n\n</details>\n\n## 🗂️ Directory structure\n\n```\n.\n├── source\n│   ├── _posts   # Cheat sheet source files\n│   │   ├── awk.md\n│   │   ├── vim.md # => https://cheatsheets.zip/vim\n│   │   ├── php.md\n│   │   ├── css.md # => https://cheatsheets.zip/css\n│   │   ├── ...\n│   └── widget   # Widget files\n│       └── chmod.html\n├── public       # Distribution files\n├── _config.yml\n├── gulpfile.js\n├── package.json\n├── postcss.config.js\n├── tailwind.config.js\n└── themes\n    └── coo      # Theme files\n```\n\n## 🤝 Contributing\n\nWe would like to extend our gratitude to you for considering a contribution to Reference. Your support is what makes\nthis project a truly resource. Please note that the primary domain for accessing the most up-to-date content is\n[cheatsheets.zip](https://cheatsheets.zip). Feel free to\n[submit issues](https://github.com/Fechin/reference/issues/new?assignee=Fechin) and enhancement requests.\n\nFor consistency, we encourage you to refer to the [https://cheatsheets.zip/quickref](https://cheatsheets.zip/quickref)\nwhen creating or editing cheat sheets. To get started with development, follow these steps:\n\n1. Clone Github repo `git clone https://github.com/Fechin/reference.git`\n2. Install `npm` package manager (Read\n   [installation guide](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm))\n3. Run `npm install` in the root folder to install dependencies.\n4. Run `npm run dev` to start a dev server. This serves the project and live reloads when any files are changed, then\n   visit http://127.0.0.1:4000 preview.\n5. Submit a pull request and wait for it to be reviewed and merged.\n\nTo create or edit a cheat sheet, you'll need to create or edit a markdown file in `source/_posts/{filename}.md`. The\nfile should include a front matter section with the following format:\n\n```markdown\n---\ntitle: CheatSheets\ndate: 2020-11-25 18:28:43\nicon: icon-style\nbackground: bg-indigo-600\ntags:\ncategories:\n- Other\n  intro: This is a reference of styles that you can use on quickref cheat sheets!\n---\n```\n\nOnly the `title` and `intro` fields are required, and the other options can be left blank.\n\n<a href=\"https://github.com/Fechin/reference/graphs/contributors\">\n  <img src=\"https://contrib.rocks/image?repo=Fechin/reference\" />\n</a>\n\n## 🐦 Follow us on Twitter\n\n[![Follow us on Twitter](https://img.shields.io/twitter/follow/FechinLi?color=%234a99e9&style=for-the-badge)](https://twitter.com/FechinLi)\n\nStay up-to-date with our project by following us on Twitter! Get all the latest news and updates right in your feed.\nIt's the perfect way to stay in the loop.\n\n<a href=\"https://buymeacoffee.com/cheatsheets.zip\"><img src=\"https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20coffee&emoji=&slug=cheatsheets.zip&button_colour=40DCA5&font_colour=ffffff&font_family=Cookie&outline_colour=000000&coffee_colour=FFDD00\" /></a>\n\n## 📃 License\n\nThe project is licensed under the [GPL-3.0](https://github.com/Fechin/reference/blob/main/LICENSE) License and is\nmaintained by [Fechin](https://github.com/Fechin).\n"
  },
  {
    "path": "_config.yml",
    "content": "# Hexo Configuration\n## Docs: https://hexo.io/docs/configuration.html\n## Source: https://github.com/hexojs/hexo/\n\n# Site\ntitle: CheatSheets.zip\nsubtitle: \"Ultimate Cheat for Developers\"\ndescription: \"Share quick reference and cheat sheet for developers\"\nkeywords: cheat,sheet,cheatsheets,reference,programming,code table,snippets,linux,command,shortcuts,developers\nauthor: Fechin\nlanguage: en\ntimezone: \"UTC\"\n\n# URL\n## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'\nurl: https://cheatsheets.zip\nroot: /\npermalink: :name.html\npermalink_defaults:\npretty_urls:\n  trailing_index: false # Set to false to remove trailing 'index.html' from permalinks\n  trailing_html: true # Set to false to remove trailing '.html' from permalinks\n\n# Directory\nsource_dir: source\npublic_dir: public\n#tag_dir: tag\narchive_dir: archives\n#category_dir: node\n#code_dir: downloads/code\ni18n_dir: :lang\nskip_render:\n  - \"assets/**/*\"\n\n# Writing\nnew_post_name: :title.md # File name of new posts\ndefault_layout: post\ntitlecase: false # Transform title into titlecase\nexternal_link:\n  enable: true # Open external links in new tab\n  field: site # Apply to the whole site\n  exclude: \"\"\nfilename_case: 1\nrender_drafts: false\npost_asset_folder: false\nrelative_link: false\nfuture: true\nsyntax_highlighter: # empty to disable built-in syntax highlighting\nhighlight:\n  enable: false\n\n# Home page setting\n# path: Root path for your blogs index page. (default = '')\n# per_page: Posts displayed per page. (0 = disable pagination)\n# order_by: Posts order. (Order by date descending by default)\nindex_generator:\n  path: \"\"\n  per_page: 0\n  order_by: -date\n\n# Category & Tag\ndefault_category: uncategorized\ncategory_map: {}\ntag_map: {}\n\n# Metadata elements\n## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta\nmeta_generator: false\n\n# SEO configuration\nseo:\n  # Default image for social sharing\n  default_image: \"/assets/image/preview.png\"\n  # Author information\n  author_name: \"Fechin\"\n  author_url: \"https://cheatsheets.zip\"\n  # Social media configuration\n  social:\n    twitter: \"Fechin\"\n    github: \"Fechin/reference\"\n  # Site type\n  site_type: \"Educational Technology Platform\"\n  # Target audience\n  target_audience: \"Developers, Programmers, System Administrators\"\n\n# Date / Time format\n## Hexo uses Moment.js to parse and display date\n## You can customize the date format as defined in\n## http://momentjs.com/docs/#/displaying/format/\ndate_format: YYYY-MM-DD\ntime_format: HH:mm:ss\n## Use post's date for updated date unless set in front-matter\nupdated_option: \"date\"\n\n# Pagination\n## Set per_page to 0 to disable pagination\nper_page: 10\npagination_dir: page\n\n# Include / Exclude file(s)\n## include:/exclude: options only apply to the 'source/' folder\ninclude: []\nexclude:\n  - \".github\"\nignore: []\n\n# Extensions\n## Plugins: https://hexo.io/plugins/\n## Themes: https://hexo.io/themes/\ntheme: coo\n\nnofollow:\n  enable: true\n  field: site\n  exclude:\n    - \"tableconvert.com\"\n    - \"dorefer.com\"\n    - \"fionaai.com\"\n    - \"github.com\"\n    - \"gospinwheel.com\"\n    - \"colorscreen.co\"\n    - \"sshkeygenerator.com\"\n    - \"x.com\"\n\nexcerpt:\n  depth: 2\n  excerpt_excludes: []\n  more_excludes: []\n  hideWholePostExcerpts: true\n\n# Deployment\n## Docs: https://hexo.io/docs/deployment.html\ndeploy:\n  - type: cjh_bing_url_submitter\n  - type: cjh_baidu_url_submitter\n\n# hexo-server configuration\nserver:\n  # Solve the problem that occasional real-time refresh is invalid and long articles are truncated\n  compress: true\n\n# https://github.com/hexojs/hexo-generator-sitemap#options\nsitemap:\n  path: sitemap.xml\n  tags: false\n  categories: false\n\n# Markdown-it configuration\n## Docs: https://github.com/celsomiranda/hexo-renderer-markdown-it/wiki\nmarkdown:\n  render:\n    html: true\n    xhtmlOut: false\n    breaks: false\n    linkify: false\n    typographer: false\n    quotes: \"“”‘’\"\n    langPrefix: \"hljs language-\"\n  anchors:\n    level: 2\n    collisionSuffix: \"\"\n    permalink: true\n    permalinkClass: h-anchor\n    permalinkSymbol: \"#\"\n    case: 1\n    separator: \"-\"\n\n# Browsersync configuration\nbrowsersync:\n  ui: false # disable ui\n  notify: false # disable notification\n  logLevel: silent # set log level to silent\n"
  },
  {
    "path": "eslint.config.js",
    "content": "const js = require('@eslint/js');\nconst globals = require('globals');\n\nmodule.exports = [\n  js.configs.recommended,\n  {\n    languageOptions: {\n      ecmaVersion: 2022,\n      sourceType: 'module',\n      globals: {\n        ...globals.browser,\n        ...globals.node\n      }\n    },\n    rules: {\n      'no-unused-vars': 'warn',\n      'no-console': 'off'\n    }\n  },\n  {\n    files: ['**/*.js'],\n    languageOptions: {\n      sourceType: 'script',\n      globals: {\n        ...globals.node,\n        ...globals.browser\n      }\n    }\n  },\n  {\n    files: ['source/sw.js'],\n    languageOptions: {\n      globals: {\n        ...globals.serviceworker\n      }\n    }\n  },\n  {\n    files: ['themes/coo/scripts/**/*.js'],\n    languageOptions: {\n      globals: {\n        ...globals.node,\n        hexo: 'readonly'\n      }\n    }\n  },\n  {\n    files: ['themes/coo/source/js/main.js'],\n    languageOptions: {\n      globals: {\n        ...globals.browser,\n        Fuse: 'readonly'\n      }\n    }\n  },\n  {\n    ignores: [\n      'node_modules/**',\n      'public/**',\n      'db.json',\n      '.deploy_git/**',\n      'themes/coo/source/js/fuse_*.js'\n    ]\n  }\n];\n"
  },
  {
    "path": "gulpfile.js",
    "content": "const gulp = require('gulp');\nconst htmlmin = require('gulp-htmlmin');\nconst htmlclean = require('gulp-htmlclean');\nconst version = require('gulp-version-number');\nconst terser = require('gulp-terser');\n\n// Compress js files\ngulp.task('js', function () {\n  return gulp\n    .src(['./public/js/main.js'])\n    .pipe(\n      terser({\n        compress: true\n      })\n    )\n    .pipe(gulp.dest('./public/js'));\n});\n\n// Build html files\ngulp.task('html', function () {\n  return gulp\n    .src('./public/**/*.html')\n    .pipe(htmlclean())\n    .pipe(\n      htmlmin({\n        removeComments: true,\n        minifyJS: true,\n        minifyCSS: true,\n        minifyURLs: true\n      })\n    )\n    .pipe(\n      version({\n        append: {\n          key: '_v',\n          cover: 1,\n          to: ['css', 'js', 'png', 'jpg', 'woff2']\n        }\n      })\n    )\n    .pipe(gulp.dest('./public'));\n});\n\ngulp.task('default', gulp.parallel('js', 'html'));\n"
  },
  {
    "path": "nginx.conf",
    "content": "user nginx;\nworker_processes auto;\n\nerror_log /var/log/nginx/error.log notice;\npid /var/run/nginx.pid;\n\n\nevents {\n    worker_connections 1024;\n}\n\n\nhttp {\n    include /etc/nginx/mime.types;\n    default_type application/octet-stream;\n    access_log /var/log/nginx/access.log ;\n    error_log /var/log/nginx/error.log;\n\n    sendfile on;\n    #tcp_nopush     on;\n\n    keepalive_timeout 65;\n\n    server {\n        listen 80;\n        listen [::]:80;\n\n        server_name localhost;\n        root /usr/share/nginx/html;\n        index index.html;\n\n        # error_page\n        error_page 404 403 500 502 503 504 /assets/page/oops.htm;\n\n        # Rename cheatsheet\n        rewrite ^/golang$ /go permanent;\n        rewrite ^/css$ /css3 permanent;\n\n        location / {\n            try_files $uri $uri/ @html;\n        }\n\n        location @html {\n            # remove .html extension\n            rewrite ^(.*)\\.html$ $1 permanent;\n            try_files $uri.html $uri/ =404;\n        }\n    }\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"CheatSheets.zip\",\n  \"version\": \"1.0.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"dev\": \"run-p dev:*\",\n    \"dev:hexo\": \"npx hexo clean && npx hexo server\",\n    \"dev:css\": \"npx postcss themes/coo/source/css/style.tailwindcss -o themes/coo/source/css/style.css --watch\",\n    \"build\": \"run-s build:*\",\n    \"build:clean\": \"npx hexo clean\",\n    \"build:rm-db.json\": \"rm db.json || exit 0\",\n    \"build:css\": \"npx postcss themes/coo/source/css/style.tailwindcss -o themes/coo/source/css/style.css\",\n    \"build:generate\": \"npx hexo generate\",\n    \"build:gulp\": \"npx gulp --max-old-space-size=4096\",\n    \"format\": \"prettier --write .\",\n    \"format:check\": \"prettier --check .\",\n    \"lint\": \"eslint themes/coo/source/js/**/*.js --fix\",\n    \"lint:check\": \"eslint themes/coo/source/js/**/*.js\",\n    \"lint:css\": \"stylelint **/*.css --fix\",\n    \"test\": \"run-s lint:check format:check\",\n    \"audit\": \"pnpm audit --audit-level moderate\",\n    \"audit:fix\": \"pnpm audit --fix\",\n    \"security:check\": \"pnpm audit && pnpm outdated\",\n    \"deps:check\": \"npx npm-check-updates\",\n    \"deps:update\": \"npx npm-check-updates -u && pnpm install\",\n    \"prepare\": \"husky\",\n    \"commit\": \"cz\"\n  },\n  \"hexo\": {\n    \"version\": \"7.3.0\"\n  },\n  \"dependencies\": {\n    \"gulp\": \"^5.0.1\",\n    \"gulp-cli\": \"^3.1.0\",\n    \"gulp-ext-replace\": \"^0.3.0\",\n    \"gulp-htmlclean\": \"^2.7.22\",\n    \"gulp-htmlmin\": \"^5.0.1\",\n    \"gulp-minify-css\": \"^1.2.4\",\n    \"gulp-postcss\": \"^10.0.0\",\n    \"gulp-uglify-es\": \"^3.0.0\",\n    \"gulp-version-number\": \"^0.2.4\",\n    \"hexo\": \"^7.3.0\",\n    \"hexo-browsersync\": \"^0.3.0\",\n    \"hexo-excerpt\": \"^1.3.1\",\n    \"hexo-filter-nofollow\": \"^2.0.2\",\n    \"hexo-fs\": \"^5.0.0\",\n    \"hexo-generator-index\": \"^4.0.0\",\n    \"hexo-generator-sitemap\": \"^3.0.1\",\n    \"hexo-log\": \"^4.1.0\",\n    \"hexo-pagination\": \"^4.0.0\",\n    \"hexo-related-popular-posts\": \"^5.0.1\",\n    \"hexo-renderer-ejs\": \"^2.0.0\",\n    \"hexo-renderer-markdown-it\": \"^5.0.0\",\n    \"hexo-renderer-stylus\": \"^3.0.1\",\n    \"hexo-server\": \"^3.0.0\",\n    \"hexo-util\": \"^3.3.0\",\n    \"highlight.js\": \"^11.11.1\",\n    \"markdown-it-abbr\": \"^2.0.0\",\n    \"markdown-it-anchor\": \"^9.2.0\",\n    \"markdown-it-attrs\": \"^4.3.1\",\n    \"markdown-it-checkbox\": \"^1.1.0\",\n    \"markdown-it-emoji\": \"^3.0.0\",\n    \"markdown-it-footnote\": \"^4.0.0\",\n    \"markdown-it-highlight-lines\": \"^1.0.2\",\n    \"markdown-it-highlightjs\": \"^4.2.0\",\n    \"markdown-it-ins\": \"^4.0.0\",\n    \"markdown-it-shortcode-tag\": \"^1.1.0\",\n    \"markdown-it-sub\": \"^2.0.0\",\n    \"markdown-it-sup\": \"^2.0.0\",\n    \"markdown-it-task-lists\": \"^2.1.1\"\n  },\n  \"devDependencies\": {\n    \"@commitlint/cli\": \"^19.8.1\",\n    \"@commitlint/config-conventional\": \"^19.8.1\",\n    \"autoprefixer\": \"^10.4.21\",\n    \"commitizen\": \"^4.3.1\",\n    \"cssnano\": \"^7.0.7\",\n    \"cz-conventional-changelog\": \"^3.3.0\",\n    \"eslint\": \"^9.29.0\",\n    \"eslint-config-prettier\": \"^10.1.5\",\n    \"gulp-clean-css\": \"^4.3.0\",\n    \"gulp-filesize\": \"^0.0.6\",\n    \"gulp-javascript-obfuscator\": \"^1.1.6\",\n    \"gulp-replace\": \"^1.1.4\",\n    \"gulp-rev\": \"^11.0.0\",\n    \"gulp-terser\": \"^2.1.0\",\n    \"husky\": \"^9.1.7\",\n    \"lint-staged\": \"^16.1.2\",\n    \"npm-run-all2\": \"^8.0.4\",\n    \"postcss\": \"^8.5.6\",\n    \"postcss-cli\": \"^11.0.1\",\n    \"postcss-import\": \"^16.1.1\",\n    \"prettier\": \"^3.5.3\",\n    \"prettier-plugin-tailwindcss\": \"^0.6.12\",\n    \"stylelint\": \"^16.20.0\",\n    \"stylelint-config-standard\": \"^38.0.0\",\n    \"tailwindcss\": \"^3.4.14\",\n    \"tailwindcss-animate\": \"^1.0.7\"\n  },\n  \"config\": {\n    \"commitizen\": {\n      \"path\": \"./node_modules/cz-conventional-changelog\"\n    }\n  }\n}\n"
  },
  {
    "path": "postcss.config.js",
    "content": "module.exports = {\n  plugins: {\n    'postcss-import': { path: 'themes/coo/source/css' },\n    tailwindcss: { config: './tailwind.config.js' },\n    autoprefixer: {},\n    ...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {})\n  }\n};\n"
  },
  {
    "path": "source/_posts/1password.md",
    "content": "---\ntitle: 1Password\ndate: 2022-11-23 16:23:31.702312\nbackground: bg-[#397fe4]\nlabel:\ntags:\n  - tools\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A cheat sheet for 1password's keyboard shortcuts in Mac, Windows, iOS, Linux.\n---\n\n## 1Password Keyboard Shortcuts for Mac\n\n### Global keyboard shortcuts\n\n| `Shortcut`               | Action             |\n| ------------------------ | ------------------ |\n| Enter your own shortcut. | Show 1Password.    |\n| `Shift` `cmd` `Space`    | Show Quick Access. |\n| `Shift` `cmd` `L`        | Lock 1Password.    |\n| `cmd` `\\`                | Autofill.          |\n\n{.shortcuts}\n\n### 1Password app {.row-span-2}\n\n| `Shortcut`         | Action                                                                                       |\n| ------------------ | -------------------------------------------------------------------------------------------- |\n| `cmd` `/`          | View keyboard shortcuts.                                                                     |\n| `cmd` `,`          | Open preferences.                                                                            |\n| `cmd` `F`          | Search for items.                                                                            |\n| `Option` `cmd` `F` | Find items in the current list.                                                              |\n| `Esc`              | Clear the search field.                                                                      |\n| `cmd` `1`          | Switch to All Accounts.                                                                      |\n| `cmd` `2...9`      | Switch accounts and collections.                                                             |\n| `cmd` `[`          | Go back.                                                                                     |\n| `cmd` `]`          | Go forward.                                                                                  |\n| `Down Arrow`       | Focus next row.                                                                              |\n| `Up Arrow`         | Focus previous row.                                                                          |\n| `Right Arrow`      | Focus right section.                                                                         |\n| `Left Arrow`       | Focus left section.                                                                          |\n| `Return or Space`  | Activate focused element.                                                                    |\n| `cmd` `C`          | Copy the username or primary field of the selected.                                          |\n| `Shift` `cmd` `C`  | Copy the password of the selected.                                                           |\n| `Option` `cmd` `C` | Copy the one-time password of the selected.                                                  |\n| `Shift` `cmd` `F`  | Open the website for the selected login in your browser and fill your username and password. |\n| `cmd` `O`          | Open the selected in a new window.                                                           |\n| `cmd` `N`          | Create a new item.                                                                           |\n| `cmd` `E`          | Edit the selected.                                                                           |\n| `cmd` `S`          | Save changes to an item.                                                                     |\n| `Esc`              | Cancel an edit.                                                                              |\n| `cmd` `R`          | Reveal or conceal secure fields in the selected.                                             |\n| `Option`           | Temporarily reveal all secure fields in the selected.\\*                                      |\n| `Delete`           | Move the selected(s) to the Archive.                                                         |\n| `cmd` `Delete`     | Delete the selected(s).                                                                      |\n| `Shift` `cmd` `D`  | Collapse or expand the sidebar.                                                              |\n| `cmd` `+`          | Zoom in.                                                                                     |\n| `cmd` `-`          | Zoom out.                                                                                    |\n| `cmd` `0`          | Revert to actual size.                                                                       |\n| `cmd` `M`          | Minimize the app to the Dock.                                                                |\n| `cmd` `W`          | Close the current window.                                                                    |\n\n{.shortcuts}\n\n### 1Password in the browser {.row-span-2}\n\n| `Shortcut`                  | Action                                                                                    |\n| --------------------------- | ----------------------------------------------------------------------------------------- |\n| `Shift` `cmd` `X`           | Open or close the 1Password pop-up in Chrome, Edge, Brave, or Safari.                     |\n| `cmd` `.`                   | Open or close the 1Password pop-up in Firefox.                                            |\n| `cmd` `F`                   | Search for items.                                                                         |\n| `Esc`                       | Clear the search field.                                                                   |\n| `cmd` `D`                   | Show the list of vaults.                                                                  |\n| `cmd` `Down Arrow`          | Open or close the category menu.                                                          |\n| `Down Arrow`                | Select the next category, item, or field.                                                 |\n| `Up Arrow`                  | Select the previous category, item, or field.                                             |\n| `Right Arrow`               | Select the item details.                                                                  |\n| `Left Arrow`                | Select the item list.                                                                     |\n| `Space`                     | Expand item overview banners.                                                             |\n| `Return`                    | Copy the selected detail.Perform the default action for the selected.                     |\n| `cmd` `C`                   | Copy the username of the selected.                                                        |\n| `Shift` `cmd` `C`           | Copy the password of the selected.                                                        |\n| `Control` `Shift` `cmd` `C` | Copy the one-time password of the selected.                                               |\n| `cmd` `Return`              | Open the website for the selected login in a new tab and fill your username and password. |\n| `cmd` `O`                   | Open the selected in a separate window.                                                   |\n| `cmd` `I`                   | Create a new item.                                                                        |\n| `cmd` `E`                   | Edit the selected.                                                                        |\n| `Control` `Option`          | Temporarily reveal all secure fields in the selected.                                     |\n| `cmd` `G`                   | Show the password generator.                                                              |\n| `cmd` `C`                   | Copy a password from the password generator.                                              |\n| `Shift` `cmd` `L`           | Lock 1Password.                                                                           |\n| `Esc`                       | Close the 1Password pop-up.                                                               |\n\n{.shortcuts}\n\n### Quick Access\n\n| `Shortcut`            | Action                                                                              |\n| --------------------- | ----------------------------------------------------------------------------------- |\n| `Shift` `cmd` `Space` | Open or close Quick Access.                                                         |\n| `Esc`                 | Clear the search field.                                                             |\n| `cmd` `1...9`         | Switch accounts or collections.                                                     |\n| `Right Arrow`         | View all available actions.                                                         |\n| `cmd` `C`             | Copy username or primary field.                                                     |\n| `Shift` `cmd` `C`     | Copy password.                                                                      |\n| `Option` `cmd` `C`    | Copy one-time password.                                                             |\n| `cmd` `O`             | Open item details in new window.                                                    |\n| `Option` `Return`     | Open the website for the login in your browser and fill your username and password. |\n| `Shift` `Return`      | Fill the item in the currently focused app.                                         |\n| `Shift` `cmd` `O`     | Open the item in the app.                                                           |\n\n{.shortcuts}\n\n## 1Password Keyboard Shortcuts for iOS\n\n### 1Password app (I)\n\n| `Shortcut`    | Action                           |\n| ------------- | -------------------------------- |\n| `cmd` `,`     | Open settings.                   |\n| `cmd` `F`     | Search for items.                |\n| `cmd` `.`     | Clear the search field.          |\n| `cmd` `1`     | Switch to All Accounts.          |\n| `cmd` `2...9` | Switch accounts and collections. |\n| `cmd` `[`     | Go back.                         |\n| `cmd` `]`     | Go forward.                      |\n| `Down Arrow`  | Focus next item.                 |\n\n{.shortcuts}\n\n### 1Password app (II)\n\n| `Shortcut`         | Action                                              |\n| ------------------ | --------------------------------------------------- |\n| `Up Arrow`         | Focus previous item.                                |\n| `Space`            | Activate focused item.                              |\n| `cmd` `C`          | Copy the username or primary field of the selected. |\n| `Shift` `cmd` `C`  | Copy the password of the selected.                  |\n| `Option` `cmd` `C` | Copy the one-time password of the selected.         |\n| `cmd` `O`          | Open the selected in a separate window.             |\n| `cmd` `E`          | Edit the selected.                                  |\n\n{.shortcuts}\n\n### 1Password app (III)\n\n| `Shortcut`        | Action                               |\n| ----------------- | ------------------------------------ |\n| `cmd` `S`         | Save changes to an item.             |\n| `cmd` `.`         | Cancel an edit.                      |\n| `cmd` `D`         | Add the selected to your favorites.  |\n| `Delete`          | Move the selected(s) to the Archive. |\n| `cmd` `Delete`    | Delete the selected(s).              |\n| `Shift` `cmd` `D` | Collapse or expand the sidebar.      |\n| `Shift` `cmd` `L` | Lock 1Password.                      |\n\n{.shortcuts}\n\n## 1Password Keyboard Shortcuts for Windows\n\n### Global keyboard shortcuts\n\n| `Shortcut`                 | Action             |\n| -------------------------- | ------------------ |\n| `Enter your own shortcut.` | Show 1Password.    |\n| `Ctrl` `Shift` `Space`     | Show Quick Access. |\n| `Ctrl` `Shift` `L`         | Lock 1Password.    |\n| `Ctrl` `\\`                 | Fill in Browser.   |\n\n{.shortcuts}\n\n### 1Password app {.row-span-2}\n\n| `Shortcut`          | Action                                                                                       |\n| ------------------- | -------------------------------------------------------------------------------------------- |\n| `Ctrl` `Shift` `/`  | View keyboard shortcuts.                                                                     |\n| `Ctrl` `,`          | Open settings.                                                                               |\n| `Ctrl` `F`          | Search for items.                                                                            |\n| `Ctrl` `Alt` `F`    | Find items in the current list.                                                              |\n| `Esc`               | Clear the search field.                                                                      |\n| `Ctrl` `1`          | Switch to All Accounts.                                                                      |\n| `Ctrl` `2...9`      | Switch accounts and collections.                                                             |\n| `Alt` `Left Arrow`  | Go back.                                                                                     |\n| `Alt` `Right Arrow` | Go forward.                                                                                  |\n| `Down Arrow`        | Focus next row.                                                                              |\n| `Up Arrow`          | Focus previous row.                                                                          |\n| `Right Arrow`       | Focus right section.                                                                         |\n| `Left Arrow`        | Focus left section.                                                                          |\n| `Space`             | Activate focused element.                                                                    |\n| `Ctrl` `C`          | Copy the username or primary field of the selected.                                          |\n| `Ctrl` `Shift` `C`  | Copy the password of the selected.                                                           |\n| `Ctrl` `Alt` `C`    | Copy the one-time password of the selected.                                                  |\n| `Ctrl` `Shift` `F`  | Open the website for the selected login in your browser and fill your username and password. |\n| `Ctrl` `O`          | Open the selected in a new window.                                                           |\n| `Ctrl` `N`          | Create a new item.                                                                           |\n| `Ctrl` `E`          | Edit the selected.                                                                           |\n| `Ctrl` `S`          | Save changes to an item.                                                                     |\n| `Esc`               | Cancel an edit.                                                                              |\n| `Ctrl` `R`          | Reveal or conceal secure fields in the selected.                                             |\n| `Ctrl` `Alt`        | Temporarily reveal all secure fields in the selected.\\*                                      |\n| `Delete`            | Move the selected(s) to the Archive.                                                         |\n| `Ctrl` `Delete`     | Delete the selected(s).                                                                      |\n| `Ctrl` `Shift` `D`  | Collapse or expand the sidebar.                                                              |\n| `Ctrl` `+`          | Zoom in.                                                                                     |\n| `Ctrl` `-`          | Zoom out.                                                                                    |\n| `Ctrl` `0`          | Revert to actual size.                                                                       |\n\n{.shortcuts}\n\n### 1Password in the browser {.row-span-2}\n\n| `Shortcut`               | Action                                                                                    |\n| ------------------------ | ----------------------------------------------------------------------------------------- |\n| `Ctrl` `Shift` `X`       | Open or close the 1Password pop-up in Chrome, Edge, or Brave.                             |\n| `Ctrl` `.`               | Open or close the 1Password pop-up in Firefox.                                            |\n| `Ctrl` `F`               | Search for items.                                                                         |\n| `Esc`                    | Clear the search field.                                                                   |\n| `Ctrl` `D`               | Show the list of vaults.                                                                  |\n| `Ctrl` `Down Arrow`      | Open or close the category menu.                                                          |\n| `Down Arrow`             | Select the next category, item, or field.                                                 |\n| `Up Arrow`               | Select the previous category, item, or field.                                             |\n| `Right Arrow`            | Select the item details.                                                                  |\n| `Left Arrow`             | Select the item list.                                                                     |\n| `Space`                  | Expand item overview banners.                                                             |\n| `Enter`                  | Copy the selected detail.Perform the default action for the selected.                     |\n| `Ctrl` `C`               | Copy the username of the selected.                                                        |\n| `Ctrl` `Shift` `C`       | Copy the password of the selected.                                                        |\n| `Ctrl` `Shift` `Win` `C` | Copy the one-time password of the selected.                                               |\n| `Ctrl` `Enter`           | Open the website for the selected login in a new tab and fill your username and password. |\n| `Ctrl` `O`               | Open the selected in a separate window.                                                   |\n| `Ctrl` `I`               | Create new item.                                                                          |\n| `Ctrl` `E`               | Edit the selected.                                                                        |\n| `Ctrl` `Alt`             | Temporarily reveal all secure fields in the selected.                                     |\n| `Ctrl` `G`               | Show the password generator.                                                              |\n| `Ctrl` `C`               | Copy a password from the password generator.                                              |\n| `Ctrl` `Shift` `L`       | Lock 1Password.                                                                           |\n| `Esc`                    | Close the 1Password pop-up.                                                               |\n\n{.shortcuts}\n\n### Quick Access\n\n| `Shortcut`             | Action                                                                              |\n| ---------------------- | ----------------------------------------------------------------------------------- |\n| `Ctrl` `Shift` `Space` | Open or close Quick Access.                                                         |\n| `Esc`                  | Clear the search field.                                                             |\n| `Ctrl` `1...9`         | Switch accounts or collections.                                                     |\n| `Right Arrow`          | View all available actions.                                                         |\n| `Ctrl` `C`             | Copy username or primary field.                                                     |\n| `Ctrl` `Shift` `C`     | Copy password.                                                                      |\n| `Ctrl` `Alt` `C`       | Copy one-time password.                                                             |\n| `Ctrl` `O`             | Open item details in new window.                                                    |\n| `Alt` `Enter`          | Open the website for the login in your browser and fill your username and password. |\n| `Ctrl` `Shift` `O`     | Open the item in the app.                                                           |\n\n{.shortcuts}\n\n## 1Password Keyboard Shortcuts for Linux\n\n### X11\n\n| `Shortcut`              | Action             |\n| ----------------------- | ------------------ |\n| Enter your own shortcut | Show 1Password.    |\n| `Ctrl` `Shift` `Space`  | Show Quick Access. |\n| `Ctrl` `Shift` `L`      | Lock 1Password.    |\n| `Ctrl` `\\`              | Fill in Browser.   |\n\n{.shortcuts}\n\n### 1Password app {.row-span-4}\n\n| `Shortcut`          | Action                                                                                       |\n| ------------------- | -------------------------------------------------------------------------------------------- |\n| `Ctrl` `Shift` `/`  | View keyboard shortcuts.                                                                     |\n| `Alt`               | Show or hide the app menu in the title bar.                                                  |\n| `Ctrl` `,`          | Open settings.                                                                               |\n| `Ctrl` `F`          | Search for items.                                                                            |\n| `Ctrl` `Alt` `F`    | Find items in the current list.                                                              |\n| `Esc`               | Clear the search field.                                                                      |\n| `Ctrl` `1`          | Switch to All Accounts.                                                                      |\n| `Ctrl` `2...9`      | Switch accounts and collections.                                                             |\n| `Alt` `Left Arrow`  | Go back.                                                                                     |\n| `Alt` `Right Arrow` | Go forward.                                                                                  |\n| `Down Arrow`        | Focus next row.                                                                              |\n| `Up Arrow`          | Focus previous row.                                                                          |\n| `Right Arrow`       | Focus right section.                                                                         |\n| `Left Arrow`        | Focus left section.                                                                          |\n| `Space`             | Activate focused element.                                                                    |\n| `Ctrl` `C`          | Copy the username or primary field of the selected.                                          |\n| `Ctrl` `Shift` `C`  | Copy the password of the selected.                                                           |\n| `Ctrl` `Alt` `C`    | Copy the one-time password of the selected.                                                  |\n| `Ctrl` `Shift` `F`  | Open the website for the selected login in your browser and fill your username and password. |\n| `Ctrl` `O`          | Open the selected in a new window.                                                           |\n| `Ctrl` `N`          | Create a new item.                                                                           |\n| `Ctrl` `E`          | Edit the selected.                                                                           |\n| `Ctrl` `S`          | Save changes to an item.                                                                     |\n| `Esc`               | Cancel an edit.                                                                              |\n| `Ctrl` `R`          | Reveal or conceal secure fields in the selected.                                             |\n| `Ctrl` `Alt`        | Temporarily reveal all secure fields in the selected.                                        |\n| `Delete`            | Move the selected(s) to the Archive.                                                         |\n| `Ctrl` `Delete`     | Delete the selected(s).                                                                      |\n| `Ctrl` `Shift` `D`  | Collapse or expand the sidebar.                                                              |\n| `Ctrl` `+`          | Zoom in.                                                                                     |\n| `Ctrl` `-`          | Zoom out.                                                                                    |\n| `Ctrl` `0`          | Revert to actual size.                                                                       |\n\n{.shortcuts}\n\n### 1Password in the browser {.row-span-4}\n\n| `Shortcut`                     | Action                                                                                    |\n| ------------------------------ | ----------------------------------------------------------------------------------------- |\n| `Ctrl` `Shift` `X`             | Open or close the 1Password pop-up in Chrome, Edge, or Brave.                             |\n| `Ctrl` `.`                     | Open or close the 1Password pop-up in Firefox.                                            |\n| `Ctrl` `F`                     | Search for items.                                                                         |\n| `Esc`                          | Clear the search field.                                                                   |\n| `Ctrl` `D`                     | Show the list of vaults.                                                                  |\n| `Ctrl` `Down Arrow`            | Open or close the category menu.                                                          |\n| `Down Arrow`                   | Select the next category, item, or field.                                                 |\n| `Up Arrow`                     | Select the previous category, item, or field.                                             |\n| `Right Arrow`                  | Select the item details.                                                                  |\n| `Left Arrow`                   | Select the item list.                                                                     |\n| `Space`                        | Expand item overview banners.                                                             |\n| `Enter`                        | Copy the selected detail.Perform the default action for the selected.                     |\n| `Ctrl` `C`                     | Copy the username of the selected.                                                        |\n| `Ctrl` `Shift` `C`             | Copy the password of the selected.                                                        |\n| `Ctrl` `Shift` `Super key` `C` | Copy the one-time password of the selected.                                               |\n| `Ctrl` `Enter`                 | Open the website for the selected login in a new tab and fill your username and password. |\n| `Ctrl` `O`                     | Open the selected in a separate window.                                                   |\n| `Ctrl` `I`                     | Create new item.                                                                          |\n| `Ctrl` `E`                     | Edit the selected.                                                                        |\n| `Ctrl` `Alt`                   | Temporarily reveal all secure fields in the selected.                                     |\n| `Ctrl` `G`                     | Show the password generator.                                                              |\n| `Ctrl` `C`                     | Copy a password from the password generator.                                              |\n| `Ctrl` `Shift` `L`             | Lock 1Password.                                                                           |\n| `Esc`                          | Close the 1Password pop-up.                                                               |\n\n{.shortcuts}\n\n### GNOME\n\n| Shortcut               | Action                   |\n| ---------------------- | ------------------------ |\n| `Ctrl` `P`             | 1password --show         |\n| `Ctrl` `Shift` `Space` | 1password --quick-access |\n| `Ctrl` `Shift` `L`     | 1password --lock         |\n| `Ctrl` `\\`             | 1password --fill         |\n\n{.shortcuts}\n\n### KDE Plasma\n\n| `Trigger`              | Action                   |\n| ---------------------- | ------------------------ |\n| `Ctrl` `P`             | 1password --show         |\n| `Ctrl` `Shift` `Space` | 1password --quick-access |\n| `Ctrl` `Shift` `L`     | 1password --lock         |\n| `Ctrl` `\\`             | 1password --fill         |\n\n{.shortcuts}\n\n### Quick Access\n\n| `Shortcut`             | Action                                                                              |\n| ---------------------- | ----------------------------------------------------------------------------------- |\n| `Ctrl` `Shift` `Space` | Open or close Quick Access.                                                         |\n| `Esc`                  | Clear the search field.                                                             |\n| `Ctrl` `1...9`         | Switch accounts or collections.                                                     |\n| `Right Arrow`          | View all available actions.                                                         |\n| `Ctrl` `C`             | Copy username or primary field.                                                     |\n| `Ctrl` `Shift` `C`     | Copy password.                                                                      |\n| `Ctrl` `Alt` `C`       | Copy one-time password.                                                             |\n| `Ctrl` `O`             | Open item details in new window.                                                    |\n| `Alt` `Enter`          | Open the website for the login in your browser and fill your username and password. |\n| `Ctrl` `Shift` `O`     | Open the item in the app.                                                           |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for 1Password](https://support.1password.com/keyboard-shortcuts/) _(support.1password.com)_\n"
  },
  {
    "path": "source/_posts/adobe-lightroom.md",
    "content": "---\ntitle: Adobe Lightroom CC\ndate: 2022-11-23 16:23:31.702312\nbackground: bg-[#081c32]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 251 keyboard shortcuts found in Adobe Lightroom CC\n---\n\n## Keyboard Shortcuts\n\n### Working with panels {.row-span-2}\n\n| Shortcut                  | Action                                                                    |\n| ------------------------- | ------------------------------------------------------------------------- |\n| `Tab`                     | Show/hide side panels                                                     |\n| `Shift` `Tab`             | Show/hide all panels                                                      |\n| `T`                       | Show/hide toolbar                                                         |\n| `F5`                      | Show/hide Module Picker                                                   |\n| `F6`                      | Show/hide Filmstrip                                                       |\n| `F7`                      | Show/hide left panels                                                     |\n| `F8`                      | Show/hide right panels                                                    |\n| `Alt` `(click a panel)`   | Toggle solo mode                                                          |\n| `Shift` `(click a panel)` | Open a new panel without closing soloed panel                             |\n| `Ctrl` `(click a panel)`  | Open/close all panels                                                     |\n| `Ctrl` `Shift` `0-5`      | Open/close left panels, top to bottom                                     |\n| `Ctrl` `0-9`              | Open/close right panels, Library and Develop modules, top to bottom       |\n| `Ctrl` `1-7`              | Open/close right panels, Slideshow, Print, and Web modules, top to bottom |\n\n{.shortcuts}\n\n### Navigating modules\n\n| Shortcut                  | Action                     |\n| ------------------------- | -------------------------- |\n| `Ctrl` `Alt` `1`          | Go to Library module       |\n| `Ctrl` `Alt` `2`          | Go to Develop module       |\n| `Ctrl` `Alt` `3`          | Go to Slideshow module     |\n| `Ctrl` `Alt` `4`          | Go to Print module         |\n| `Ctrl` `Alt` `5`          | Go to Web module           |\n| `Ctrl` `Alt` `Left/Right` | Go back/go forward         |\n| `Ctrl` `Alt` `Up`         | Go back to previous module |\n\n{.shortcuts}\n\n### Using a secondary window\n\n| Shortcut                     | Action                                           |\n| ---------------------------- | ------------------------------------------------ |\n| `F11`                        | Open secondary window                            |\n| `Shift` `G`                  | Enter Grid view                                  |\n| `Shift` `E`                  | Enter normal Loupe view                          |\n| `Ctrl` `Shift` `Enter`       | Enter locked Loupe view                          |\n| `Shift` `C`                  | Enter Compare view                               |\n| `Shift` `N`                  | Enter Survey view                                |\n| `Ctrl` `Alt` `Shift` `Enter` | Enter Slideshow view                             |\n| `Shift` `F11`                | Enter full-screen mode (requires second monitor) |\n| `Shift` `\\`                  | Show/hide Filter bar                             |\n| `Ctrl` `Shift` `+/-`         | Zoom in/out                                      |\n\n{.shortcuts}\n\n### Working in the Develop module {.row-span-3}\n\n| Shortcut                     | Action                                                                                |\n| ---------------------------- | ------------------------------------------------------------------------------------- |\n| `V`                          | Convert to grayscale                                                                  |\n| `Ctrl` `U`                   | Auto tone                                                                             |\n| `Ctrl` `Shift` `U`           | Auto white balance                                                                    |\n| `Ctrl` `E`                   | Edit in Photoshop                                                                     |\n| `Ctrl` `Shift` `C/V`         | Copy/paste Develop settings                                                           |\n| `Ctrl` `Alt` `V`             | Paste settings from previous photo                                                    |\n| `Ctrl` `Alt` `Shift` `Left`  | Copy After settings to Before                                                         |\n| `Ctrl` `Alt` `Shift` `Right` | Copy Before settings to After                                                         |\n| `Ctrl` `Alt` `Shift` `Up`    | Swap Before and After settings                                                        |\n| `Up/Down`                    | Increase/decrease selected slider in small increments                                 |\n| `Shift` `Up/Down`            | Increase/decrease selected slider in larger increments                                |\n| `./,`                        | Cycle through Basic panel settings (forward/backward)                                 |\n| `(double-click slider name)` | Reset a slider                                                                        |\n| `Alt` `(click group name)`   | Reset a group of sliders                                                              |\n| `Ctrl` `Shift` `R`           | Reset all settings                                                                    |\n| `Ctrl` `Shift` `S`           | Sync settings                                                                         |\n| `Ctrl` `Alt` `S`             | Sync settings bypassing Synchronize Settings dialog box                               |\n| `Ctrl` `(click Sync button)` | Toggle Auto Sync                                                                      |\n| `Ctrl` `Alt` `Shift` `A`     | Enable Auto Sync                                                                      |\n| `Ctrl` `Alt` `Shift` `M`     | Match total exposures                                                                 |\n| `W`                          | Select White Balance tool (from any module)                                           |\n| `R`                          | Select the Crop tool (from any module)                                                |\n| `A`                          | Constrain aspect ratio when Crop tool is selected                                     |\n| `Shift` `A`                  | Crop to same aspect ratio as previous crop                                            |\n| `Alt` `(drag)`               | Crop from center of photo                                                             |\n| `O`                          | Cycle Crop grid overlay                                                               |\n| `Shift` `O`                  | Cycle Crop grid overlay orientation                                                   |\n| `X`                          | Switch crop between portrait and landscape orientation                                |\n| `Ctrl` `Alt` `R`             | Reset crop                                                                            |\n| `Shift` `T`                  | Select the Guided Upright tool                                                        |\n| `Q`                          | Select the Spot Removal tool                                                          |\n| `Shift` `T`                  | Toggle Brush between Clone and Heal modes when Spot Removal tool is selected          |\n| `K`                          | Select the Adjustment Brush tool (from any module)                                    |\n| `M`                          | Select the Graduated Filter tool                                                      |\n| `Shift` `T`                  | Toggle Mask between Edit and Brush modes when the Graduated/Radial Filter is selected |\n| `]/[`                        | Increase/decrease brush size                                                          |\n| `Shift` `]/[`                | Increase/decrease brush feathering                                                    |\n| `/`                          | Switch between local adjustment brush A and B                                         |\n| `Alt` `(drag)`               | Temporarily switch from brush A or B to Eraser                                        |\n| `Shift` `(drag)`             | Paint a horizontal or vertical line                                                   |\n| `H`                          | Show/hide local adjustment pin                                                        |\n| `O`                          | Show/hide local adjustment mask overlay                                               |\n| `Shift` `O`                  | Cycle local adjustment mask overlay colors                                            |\n| `Ctrl` `Alt` `Shift` `T`     | Select Targeted Adjustment tool to apply a Tone Curve adjustment                      |\n| `Ctrl` `Alt` `Shift` `H`     | Select Targeted Adjustment tool to apply a Hue adjustment                             |\n| `Ctrl` `Alt` `Shift` `S`     | Select Targeted Adjustment tool to apply a Saturation adjustment                      |\n| `Ctrl` `Alt` `Shift` `L`     | Select Targeted Adjustment tool to apply a Luminance adjustment                       |\n| `Ctrl` `Alt` `Shift` `G`     | Select Targeted Adjustment tool to apply a Grayscale Mix adjustment                   |\n| `Ctrl` `Alt` `Shift` `N`     | Deselect Targeted Adjustment tool                                                     |\n| `J`                          | Show clipping                                                                         |\n| `Ctrl` `]`                   | Rotate photo right (clockwise)                                                        |\n| `Ctrl` `[`                   | Rotate photo left (counterclockwise)                                                  |\n| `Space/Z`                    | Toggle between Loupe and 1:1 Zoom preview                                             |\n| `Ctrl` `+/-`                 | Zoom in/out                                                                           |\n| `Ctrl` `Enter`               | Play impromptu slide show                                                             |\n| `Y`                          | View Before and After left/right                                                      |\n| `Alt` `Y`                    | View Before and After top/bottom                                                      |\n| `Shift` `Y`                  | View Before and After in a split screen                                               |\n| `\\`                          | View Before only                                                                      |\n| `Ctrl` `N`                   | Create a new snapshot                                                                 |\n| `Ctrl` `Shift` `N`           | Create a new preset                                                                   |\n| `Ctrl` `Alt` `N`             | Create a new preset folder                                                            |\n| `Ctrl` `J`                   | Open Develop view options                                                             |\n\n{.shortcuts}\n\n### Changing view and screen modes\n\n| Shortcut           | Action                                             |\n| ------------------ | -------------------------------------------------- |\n| `E`                | Enter Library Loupe view                           |\n| `G`                | Enter Library Grid view                            |\n| `C`                | Enter Library Compare view                         |\n| `N`                | Enter Library Survey view                          |\n| `D`                | Open selected photo in the Develop module          |\n| `L`                | Cycle forward through Lights Out modes             |\n| `Shift` `L`        | Cycle backward through Lights Out modes            |\n| `Ctrl` `Shift` `L` | Toggle Lights Dim mode                             |\n| `F`                | Cycle screen modes                                 |\n| `Ctrl` `Shift` `F` | Switch between Normal and full-screen, hide panels |\n| `Ctrl` `Alt` `F`   | Go to Normal screen mode                           |\n| `I`                | Cycle info overlay                                 |\n| `Ctrl` `I`         | Show/hide info overlay                             |\n\n{.shortcuts}\n\n### Managing photos and catalogs\n\n| Shortcut                         | Action                                                                                 |\n| -------------------------------- | -------------------------------------------------------------------------------------- |\n| `Ctrl` `Shift` `I`               | Import photos from disk                                                                |\n| `Ctrl` `O`                       | Open catalog                                                                           |\n| `Ctrl` `,`                       | Open Preferences                                                                       |\n| `Ctrl` `Alt` `,`                 | Open Catalog Settings                                                                  |\n| `Ctrl` `Shift` `T`               | Create new subfolder (segmented tethered capture)                                      |\n| `Ctrl` `T`                       | Hide/show tether capture bar                                                           |\n| `Ctrl` `Shift` `N`               | Create a new folder in the Library module                                              |\n| `Ctrl` `'`                       | Create virtual copy (Library and Develop module only)                                  |\n| `Ctrl` `R`                       | Show in Explorer/Finder (Library and Develop module only)                              |\n| `Right/Left`                     | Go to next/previous photo in the Filmstrip                                             |\n| `Shift/Ctrl` `Click`             | Select multiple folders or collections (in Library, Slideshow, Print, and Web modules) |\n| `F2`                             | Rename photo (in Library module)                                                       |\n| `Delete`                         | Delete selected photo(s)                                                               |\n| `Alt` `Backspace`                | Remove selected photo(s) from catalog                                                  |\n| `Ctrl` `Alt` `Shift` `Backspace` | Delete selected photo(s) and move to Trash                                             |\n| `Ctrl` `Backspace`               | Delete rejected photo(s)                                                               |\n| `Ctrl` `E`                       | Edit in Photoshop                                                                      |\n| `Ctrl` `Alt` `E`                 | Open in other editor                                                                   |\n| `Ctrl` `Shift` `E`               | Export selected photo(s)                                                               |\n| `Ctrl` `Alt` `Shift` `E`         | Export with previous settings                                                          |\n| `Ctrl` `Alt` `Shift` `,`         | Open plug-in manager                                                                   |\n| `Ctrl` `P`                       | Print selected photo                                                                   |\n| `Ctrl` `Shift` `P`               | Open Page Setup dialog box                                                             |\n\n{.shortcuts}\n\n### Comparing photos in the Library module\n\n| Shortcut                 | Action                                                |\n| ------------------------ | ----------------------------------------------------- |\n| `E/Enter`                | Switch to Loupe view                                  |\n| `G/Esc`                  | Switch to Grid view                                   |\n| `C`                      | Switch to Compare view                                |\n| `N`                      | Switch to Survey view                                 |\n| `Space/E`                | Switch from Grid to Loupe view                        |\n| `Down`                   | Swap select and candidate photos in Compare view      |\n| `Up`                     | Make next photos select and candidate in Compare view |\n| `Z`                      | Toggle Zoom view                                      |\n| `Ctrl` `+/-`             | Zoom in/out in Loupe view                             |\n| `PgUp/PgDown`            | Scroll up/down zoomed photo in Loupe view             |\n| `Home/End`               | Go to beginning/end of Grid view                      |\n| `Ctrl` `Enter`           | Play impromptu slide show                             |\n| `Ctrl` `]`               | Rotate photo right (clockwise)                        |\n| `Ctrl` `[`               | Rotate photo left (counterclockwise)                  |\n| `=/-`                    | Increase/decrease Grid thumbnail size                 |\n| `PgUp/PgDown`            | Scroll up/down Grid thumbnails                        |\n| `Ctrl` `Shift` `H`       | Toggle cell extras                                    |\n| `Ctrl` `Alt` `Shift` `H` | Show/hide badges                                      |\n| `J`                      | Cycle Grid views                                      |\n| `Ctrl` `J`               | Open Library view options                             |\n| `Ctrl` `(click)`         | Select multiple discrete photos                       |\n| `Shift` `(click)`        | Select multiple contiguous photos                     |\n| `Ctrl` `A`               | Select all photos                                     |\n| `Ctrl` `D`               | Deselect all photos                                   |\n| `Ctrl` `Shift` `D`       | Select only active photo                              |\n| `/`                      | Deselect active photo                                 |\n| `Shift` `Left/Right`     | Add previous/next photo to selection                  |\n| `Ctrl` `Alt` `A`         | Select flagged photos                                 |\n| `Ctrl` `Alt` `Shift` `D` | Deselect unflagged photos                             |\n| `Ctrl` `G`               | Group into stack                                      |\n| `Ctrl` `Shift` `G`       | Unstack                                               |\n| `S`                      | Toggle stack                                          |\n| `Shift` `S`              | Move to top of stack                                  |\n| `Shift` `[`              | Move up in stack                                      |\n| `Shift` `]`              | Move down in stack                                    |\n\n{.shortcuts}\n\n### Rating and filtering photos\n\n| Shortcut                        | Action                                      |\n| ------------------------------- | ------------------------------------------- |\n| `1-5`                           | Set star rating                             |\n| `Shift` `1-5`                   | Set star rating and go to next photo        |\n| `0`                             | Remove star rating                          |\n| `Shift` `0`                     | Remove star rating and go to next photo     |\n| `]/[`                           | Increase/decrease rating by one star        |\n| `6`                             | Assign a red label                          |\n| `7`                             | Assign a yellow label                       |\n| `8`                             | Assign a green label                        |\n| `9`                             | Assign a blue label                         |\n| `Shift` `6-9`                   | Assign a color label and go to next photo   |\n| `P`                             | Flag photo as a pick                        |\n| `Shift` `P`                     | Flag photo as a pick and go to next photo   |\n| `X`                             | Flag photo as a reject                      |\n| `Shift` `X`                     | Flag photo as a reject and go to next photo |\n| `U`                             | Unflag photo                                |\n| `Shift` `U`                     | Unflag photo and go to next photo           |\n| `Ctrl` `Up/Down`                | Increase/decrease flag status               |\n| <code>\\`</code>                 | Cycle flag settings                         |\n| `Ctrl` `Alt` `R`                | Refine photos                               |\n| `\\`                             | Show/hide Library Filter bar                |\n| `Shift` `(click filter labels)` | Open multiple filters in the Filter bar     |\n| `Shift` `L`                     | Toggle filters on/off                       |\n| `Ctrl` `F`                      | Find photo in the Library module            |\n\n{.shortcuts}\n\n### Working with collections\n\n| Shortcut                 | Action                                        |\n| ------------------------ | --------------------------------------------- |\n| `Ctrl` `N`               | Create a new collection in the Library module |\n| `B`                      | Add to Quick Collection                       |\n| `Shift` `B`              | Add to Quick Collection and go to next photo  |\n| `Ctrl` `B`               | Show Quick Collection                         |\n| `Ctrl` `Alt` `B`         | Save Quick Collection                         |\n| `Ctrl` `Shift` `B`       | Clear Quick Collection                        |\n| `Ctrl` `Alt` `Shift` `B` | Set as target collection                      |\n\n{.shortcuts}\n\n### Working with metadata and keywords in the Library module\n\n| Shortcut                   | Action                                             |\n| -------------------------- | -------------------------------------------------- |\n| `Ctrl` `K`                 | Add keywords                                       |\n| `Ctrl` `Shift` `K`         | Edit keywords                                      |\n| `Ctrl` `Alt` `Shift` `K`   | Set a keyword shortcut                             |\n| `Shift` `K`                | Add/remove keyword shortcut from selected photo    |\n| `Ctrl` `Alt` `K`           | Enable painting                                    |\n| `Alt` `1-9`                | Add a keyword from a keyword set to selected photo |\n| `Alt` `0`                  | Cycle forward through keyword sets                 |\n| `Alt` `Shift` `0`          | Cycle backward through keyword sets                |\n| `Ctrl` `Alt` `Shift` `C/V` | Copy/paste metadata                                |\n| `Ctrl` `S`                 | Save metadata to file                              |\n\n{.shortcuts}\n\n### Working in the Slideshow module\n\n| Shortcut           | Action                                  |\n| ------------------ | --------------------------------------- |\n| `Enter`            | Play slide show                         |\n| `Ctrl` `Enter`     | Play impromptu slide show               |\n| `Space`            | Pause slide show                        |\n| `Alt` `Enter`      | Preview slide show                      |\n| `Esc`              | End slide show                          |\n| `Right`            | Go to next slide                        |\n| `Left`             | Go to previous slide                    |\n| `Ctrl` `]`         | Rotate photo right (clockwise)          |\n| `Ctrl` `[`         | Rotate photo left (counterclockwise)    |\n| `Ctrl` `Shift` `H` | Show/hide guides                        |\n| `Ctrl` `J`         | Export PDF slide show                   |\n| `Ctrl` `Shift` `J` | Export JPEG slide show                  |\n| `Ctrl` `Alt` `J`   | Export video slide show                 |\n| `Ctrl` `N`         | Create a new slide show template        |\n| `Ctrl` `Shift` `N` | Create a new slide show template folder |\n| `Ctrl` `S`         | Save slide show settings                |\n\n{.shortcuts}\n\n### Working in the Print module\n\n| Shortcut                 | Action                               |\n| ------------------------ | ------------------------------------ |\n| `Ctrl` `P`               | Print                                |\n| `Ctrl` `Alt` `P`         | Print one copy                       |\n| `Ctrl` `Shift` `P`       | Open Page Setup dialog box           |\n| `Ctrl` `Alt` `Shift` `P` | Open Print Settings dialog box       |\n| `Ctrl` `Shift` `Left`    | Go to first page                     |\n| `Ctrl` `Shift` `Right`   | Go to last page                      |\n| `Ctrl` `Left`            | Go to previous page                  |\n| `Ctrl` `Right`           | Go to next page                      |\n| `Ctrl` `Shift` `H`       | Show/hide guides                     |\n| `Ctrl` `R`               | Show/hide rulers                     |\n| `Ctrl` `Shift` `J`       | Show/hide page bleed                 |\n| `Ctrl` `Shift` `M`       | Show/hide margins and gutters        |\n| `Ctrl` `Shift` `K`       | Show/hide image cells                |\n| `Ctrl` `Shift` `U`       | Show/hide dimensions                 |\n| `Ctrl` `Enter`           | Play impromptu slide show            |\n| `Ctrl` `]`               | Rotate photo right (clockwise)       |\n| `Ctrl` `[`               | Rotate photo left (counterclockwise) |\n| `Ctrl` `N`               | Create a new print template          |\n| `Ctrl` `Shift` `N`       | Create a new print template folder   |\n| `Ctrl` `S`               | Save print settings                  |\n\n{.shortcuts}\n\n### Working in the Web module\n\n| Shortcut           | Action                                   |\n| ------------------ | ---------------------------------------- |\n| `Ctrl` `R`         | Reload web gallery                       |\n| `Ctrl` `Alt` `P`   | Preview in browser                       |\n| `Ctrl` `Enter`     | Play impromptu slide show                |\n| `Ctrl` `J`         | Export web gallery                       |\n| `Ctrl` `N`         | Create a new web gallery template        |\n| `Ctrl` `Shift` `N` | Create a new web gallery template folder |\n| `Ctrl` `S`         | Save web gallery settings                |\n\n{.shortcuts}\n\n### Using help\n\n| Shortcut         | Action                           |\n| ---------------- | -------------------------------- |\n| `Ctrl` `/`       | Display current module shortcuts |\n| `(click)`        | Hide current module shortcuts    |\n| `Ctrl` `Alt` `/` | Go to current module Help        |\n| `F1`             | Open Community Help              |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Adobe Lightroom CC](https://helpx.adobe.com/lightroom/help/keyboard-shortcuts.html)\n  _(helpx.adobe.com)_\n"
  },
  {
    "path": "source/_posts/adobe-photoshop.md",
    "content": "---\ntitle: Adobe Photoshop\ndate: 2022-11-23 16:23:31.706034\nbackground: bg-[#071c25]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 283 keyboard shortcuts found in Adobe Photoshop\n---\n\n## Keyboard Shortcuts\n\n### Popular shortcuts\n\n| Shortcut           | Action                                                         |\n| ------------------ | -------------------------------------------------------------- |\n| `Ctrl` `T`         | Free transform                                                 |\n| `[`                | Decrease brush size                                            |\n| `]`                | Increase brush size                                            |\n| `Shift` `[`        | Decrease brush hardness                                        |\n| `Shift` `]`        | Increase brush hardness                                        |\n| `D`                | Default foreground/background colors                           |\n| `X`                | Switch foreground/background colors                            |\n| `Ctrl` `J`         | New layer via copy                                             |\n| `Ctrl` `Shift` `J` | New layer via cut                                              |\n| `Esc`              | Cancel any modal dialog window (including the Start Workspace) |\n| `Enter`            | Select the first edit field of the tool bar                    |\n| `Tab`              | Navigate between fields                                        |\n| `Shift` `Tab`      | Navigate between fields in the opposite direction              |\n| `Alt`              | Change cancel to reset                                         |\n| `Ctrl` `F`         | Invoke the search experience                                   |\n\n{.shortcuts}\n\n### Use function keys\n\n| Shortcut     | Action                  |\n| ------------ | ----------------------- |\n| `F1`         | Start help              |\n| `F2`         | Cut                     |\n| `F3`         | Copy                    |\n| `F4`         | Paste                   |\n| `F5`         | Show/hide brush panel   |\n| `F6`         | Show/hide color panel   |\n| `F7`         | Show/hide layers panel  |\n| `F8`         | Show/hide info panel    |\n| `F9`         | Show/hide actions panel |\n| `F12`        | Revert                  |\n| `Shift` `F5` | Fill                    |\n| `Shift` `F6` | Feather selection       |\n| `Shift` `F7` | Inverse selection       |\n\n{.shortcuts}\n\n### Select tools {.row-span-2}\n\n| Shortcut    | Action                                                                                          |\n| ----------- | ----------------------------------------------------------------------------------------------- |\n| `V`         | Move tool                                                                                       |\n| `M`         | Rectangular marquee tool                                                                        |\n| `L`         | Lasso tool                                                                                      |\n| `W`         | Magic wand tool > quick selection tool                                                          |\n| `C`         | Crop tool > slice tool > slice select tool                                                      |\n| `I`         | Eyedropper tool > ruler tool > note tool                                                        |\n| `J`         | Spot healing brush tool > healing brush tool > patch tool > red eye tool                        |\n| `B`         | Brush tool > pencil tool > color replacement tool > mixer brush tool                            |\n| `S`         | Clone stamp tool > pattern stamp tool                                                           |\n| `Y`         | History brush tool > Art history brush tool                                                     |\n| `E`         | Eraser tool > background eraser tool > magic eraser tool                                        |\n| `G`         | Gradient tool > paint bucket tool                                                               |\n| `O`         | Dodge tool > burn tool > sponge tool                                                            |\n| `P`         | Pen tool > freeform pen tool                                                                    |\n| `T`         | Horizontal type tool > vertical type tool > horizontal type mask tool > vertical type mask tool |\n| `A`         | Path selection tool > direct selection tool                                                     |\n| `U`         | Rectangle tool > rounded rectangle tool > ellipse tool > polygon tool > line tool               |\n| `H`         | Hand tool                                                                                       |\n| `R`         | Rotate view tool                                                                                |\n| `Z`         | Zoom tool                                                                                       |\n| `D`         | Default foreground/background colors                                                            |\n| `X`         | Switch foreground/background colors                                                             |\n| `Q`         | Toggle standard/quick mask modes                                                                |\n| `J`         | Content-aware move tool                                                                         |\n| `C`         | Perspective crop tool                                                                           |\n| `V`         | Artboard tool                                                                                   |\n| `R`         | Rotate view tool                                                                                |\n| `/`         | Toggle preserve transparency                                                                    |\n| `,`         | Previous brush                                                                                  |\n| `.`         | Next brush                                                                                      |\n| `Shift` `,` | First brush                                                                                     |\n| `Shift` `.` | Last brush                                                                                      |\n\n{.shortcuts}\n\n### View images {.row-span-2}\n\n| Shortcut             | Action                                                                                   |\n| -------------------- | ---------------------------------------------------------------------------------------- |\n| `Ctrl` `Tab`         | Cycle through open documents                                                             |\n| `Ctrl` `Shift` `Tab` | Switch to previous document                                                              |\n| `Ctrl` `Shift` `W`   | Close a file in Photoshop and open Bridge                                                |\n| `F`                  | Toggle forward between Standard screen > Full screen with menu bar > Full screen modes   |\n| `Shift` `F`          | Toggle backwards between Standard screen > Full screen with menu bar > Full screen modes |\n| `Space` `F`          | Toggle forward canvas color                                                              |\n| `Shift` `Space` `F`  | Toggle backwards canvas color                                                            |\n| `Space`              | Switch to hand tool (when not in text-edit mode)                                         |\n| `Ctrl` `Space`       | Switch to zoom in tool                                                                   |\n| `Alt` `Space`        | Switch to zoom out tool                                                                  |\n| `Shift` `Enter`      | Apply zoom percentage, and keep zoom percentage box active                               |\n| `PgUp/PgDn`          | Scroll up or down 1 screen                                                               |\n| `Shift` `PgUp/PgDn`  | Scroll up or down 10 units                                                               |\n| `Home`               | Move view to upper-left corner                                                           |\n| `End`                | Move view to lower-right corner                                                          |\n| `\\`                  | Toggle layer mask on/off as rubylith (layer mask must be selected)                       |\n\n{.shortcuts}\n\n### Use Puppet Warp\n\n| Shortcut   | Action                   |\n| ---------- | ------------------------ |\n| `Esc`      | Cancel completely        |\n| `Ctrl` `Z` | Undo last pin adjustment |\n| `Ctrl` `A` | Select all pins          |\n| `Ctrl` `D` | Deselect all pins        |\n| `H`        | Temporarily hide pins    |\n\n{.shortcuts}\n\n### Use Refine Edge\n\n| Shortcut         | Action                                                  |\n| ---------------- | ------------------------------------------------------- |\n| `Ctrl` `Alt` `R` | Open the Refine Edge dialog box                         |\n| `F`              | Cycle forward through preview modes                     |\n| `Shift` `F`      | Cycle backwards through preview modes                   |\n| `X`              | Toggle between original image and selection preview     |\n| `P`              | Toggle between original selection and refined version   |\n| `J`              | Toggle radius preview on and off                        |\n| `Shift` `E`      | Toggle between Refine Radius and Erase Refinement tools |\n\n{.shortcuts}\n\n### Use the Filter Gallery\n\n| Shortcut           | Action                          |\n| ------------------ | ------------------------------- |\n| `Ctrl` `Alt` `F`   | Reapply last-used filter        |\n| `Ctrl`             | Change Cancel button to Default |\n| `Alt`              | Change Cancel button to Reset   |\n| `Ctrl` `Z`         | Undo/Redo                       |\n| `Ctrl` `Shift` `Z` | Step forward                    |\n| `Ctrl` `Alt` `Z`   | Step backward                   |\n\n{.shortcuts}\n\n### Use the Liquify filter\n\n| Shortcut       | Action                                                           |\n| -------------- | ---------------------------------------------------------------- |\n| `W`            | Forward warp tool                                                |\n| `R`            | Reconstruct tool                                                 |\n| `C`            | Twirl clockwise tool                                             |\n| `S`            | Pucker tool                                                      |\n| `B`            | Bloat tool                                                       |\n| `O`            | Push left tool                                                   |\n| `M`            | Mirror tool                                                      |\n| `T`            | Turbulence tool                                                  |\n| `F`            | Freeze mask tool                                                 |\n| `D`            | Thaw mask tool                                                   |\n| `Alt` `(tool)` | Reverse direction for Bloat, Pucker, Push Left, and Mirror tools |\n| `Tab`          | Cycle through controls on right from top                         |\n| `Shift` `Tab`  | Cycle through controls on right from bottom                      |\n| `Alt`          | Change cancel to reset                                           |\n\n{.shortcuts}\n\n### Use Vanishing Point\n\n| Shortcut           | Action                                               |\n| ------------------ | ---------------------------------------------------- |\n| `X`                | Zoom 2x (temporary)                                  |\n| `Ctrl` `+`         | Zoom in                                              |\n| `Ctrl` `-`         | Zoom out                                             |\n| `Ctrl` `0`         | Fit in view                                          |\n| `Ctrl` `Z`         | Undo last action                                     |\n| `Ctrl` `Shift` `Z` | Redo last action                                     |\n| `Ctrl` `D`         | Deselect all                                         |\n| `Ctrl` `H`         | Hide selection and panes                             |\n| `Arrows`           | Move selection 1 pixel                               |\n| `Shift` `Arrows`   | Move selection 10 pixels                             |\n| `Ctrl` `C`         | Copy                                                 |\n| `Ctrl` `V`         | Paste                                                |\n| `Ctrl` `Shift` `T` | Repeat last duplicate and move                       |\n| `Ctrl` `Alt` `T`   | Create floating selection from the current selection |\n| `Alt` `Shift`      | Constrain selection to a 15 degree rotation          |\n| `Backspace`        | Delete last node while creating plane                |\n\n{.shortcuts}\n\n### Use the Camera Raw dialog box {.row-span-4}\n\n| Shortcut                 | Action                                                                                             |\n| ------------------------ | -------------------------------------------------------------------------------------------------- |\n| `Z`                      | Zoom tool                                                                                          |\n| `H`                      | Hand tool                                                                                          |\n| `I`                      | White balance tool                                                                                 |\n| `S`                      | Color sampler tool                                                                                 |\n| `C`                      | Crop tool                                                                                          |\n| `A`                      | Straighten tool                                                                                    |\n| `B`                      | Spot removal tool                                                                                  |\n| `E`                      | Red eye removal tool                                                                               |\n| `Ctrl` `Alt` `1`         | Basic panel                                                                                        |\n| `Ctrl` `Alt` `2`         | Tone curve panel                                                                                   |\n| `Ctrl` `Alt` `3`         | Detail panel                                                                                       |\n| `Ctrl` `Alt` `4`         | HSL/Greyscale panel                                                                                |\n| `Ctrl` `Alt` `5`         | Split toning panel                                                                                 |\n| `Ctrl` `Alt` `6`         | Lens corrections panel                                                                             |\n| `Ctrl` `Alt` `7`         | Camera calibration panel                                                                           |\n| `Ctrl` `Alt` `8`         | Presets panel                                                                                      |\n| `Ctrl` `Alt` `9`         | Open snapshots panel                                                                               |\n| `Ctrl` `Alt` `Shift` `T` | Parametric curve targeted adjustment tool                                                          |\n| `Ctrl` `Alt` `Shift` `H` | Hue targeted adjustment tool                                                                       |\n| `Ctrl` `Alt` `Shift` `S` | Saturation targeted adjustment tool                                                                |\n| `Ctrl` `Alt` `Shift` `L` | Luminance targeted adjustment tool                                                                 |\n| `Ctrl` `Alt` `Shift` `G` | Grayscale mix targeted adjustment tool                                                             |\n| `T`                      | Last-used targeted adjustment tool                                                                 |\n| `K`                      | Adjustment brush tool                                                                              |\n| `G`                      | Graduated filter tool                                                                              |\n| `Alt`                    | Temporarily switch from Add to Erase mode for the Adjustment brush tool, or from Erase to Add mode |\n| `Alt` `]/[`              | Increase/decrease temporary adjustment brush tool size                                             |\n| `Alt` `Shift` `]/[`      | Increase/decrease temporary adjustment brush tool feather                                          |\n| `Alt` `=/-`              | Increase/decrease temporary adjustment brush tool size flow in increments of 10                    |\n| `N`                      | Switch to New mode from Add or Erase mode of the Adjustment Brush tool or Graduated filter         |\n| `M`                      | Toggle Auto Mask for Adjustment Brush tool                                                         |\n| `Y`                      | Toggle Show Mask for Adjustment Brush tool                                                         |\n| `V`                      | Toggle pins for Adjustment Brush tool                                                              |\n| `L`                      | Rotate image left                                                                                  |\n| `R`                      | Rotate image right                                                                                 |\n| `Ctrl`                   | Temporarily switch to zoom in tool                                                                 |\n| `Alt`                    | Temporarily switch to zoom out tool and change the image open button to open copy                  |\n| `P`                      | Toggle preview                                                                                     |\n| `F`                      | Full screen mode                                                                                   |\n| `Shift`                  | Temporarily activate the White Balance tool and change the open image button to open object        |\n| `Arrows`                 | Move selected point in curves panel 1 pixel                                                        |\n| `Shift` `Arrows`         | Move selected point in curves panel 10 pixels                                                      |\n| `Ctrl` `R`               | Open selected images in Camera Raw dialog box from Bridge                                          |\n| `O`                      | Highlight clipping warning                                                                         |\n| `U`                      | Shadows clipping warning                                                                           |\n| `Ctrl` `1-5`             | Add 1-5 star rating (filmstrip mode)                                                               |\n| `Ctrl` `./,`             | Increase/decrease rating (filmstrip mode)                                                          |\n| `Ctrl` `6`               | Add red label (filmstrip mode)                                                                     |\n| `Ctrl` `7`               | Add yellow label (filmstrip mode)                                                                  |\n| `Ctrl` `8`               | Add green label (filmstrip mode)                                                                   |\n| `Ctrl` `9`               | Add blue label (filmstrip mode)                                                                    |\n| `Ctrl` `Shift` `0`       | Add purple label (filmstrip mode)                                                                  |\n| `Ctrl` `K`               | Camera Raw preferences                                                                             |\n| `Ctrl` `Alt`             | Delete Adobe Camera Raw preferences (on open)                                                      |\n\n{.shortcuts}\n\n### Use the Black-and-White dialog box\n\n| Shortcut                 | Action                                  |\n| ------------------------ | --------------------------------------- |\n| `Ctrl` `Shift` `Alt` `B` | Open the Black-and-White dialog box     |\n| `Up/Down`                | Increase/decrease selected value by 1%  |\n| `Shift` `Up/Down`        | Increase/decrease selected value by 10% |\n\n{.shortcuts}\n\n### Use Curves\n\n| Shortcut         | Action                                 |\n| ---------------- | -------------------------------------- |\n| `Ctrl` `M`       | Open the Curves dialog box             |\n| `+`              | Select next point on the curve         |\n| `-`              | Select the previous point on the curve |\n| `Ctrl` `D`       | Deselect a point                       |\n| `Del`            | Delete a point on the curve            |\n| `Arrows`         | Move the selected point 1 pixel        |\n| `Shift` `Arrows` | Move the selected point 10 pixels      |\n\n{.shortcuts}\n\n### Transform selections, selection borders, and paths\n\n| Shortcut                 | Action                              |\n| ------------------------ | ----------------------------------- |\n| `Alt`                    | Transform from center or reflect    |\n| `Shift`                  | Constrain                           |\n| `Ctrl`                   | Distort                             |\n| `Enter`                  | Apply                               |\n| `Ctrl` `.`               | Cancel                              |\n| `Ctrl` `Alt` `T`         | Free transform with duplicate data  |\n| `Ctrl` `Shift` `Alt` `T` | Transform again with duplicate data |\n\n{.shortcuts}\n\n### Edit paths\n\n| Shortcut | Action                                                                                                                  |\n| -------- | ----------------------------------------------------------------------------------------------------------------------- |\n| `Ctrl`   | Switch from path selection, pen, add anchor point, delete anchor point, or convert point tools to direct selection tool |\n| `Alt`    | Switch from pen tool to freeform pen tool to convert point tool when pointer is over anchor or direction point          |\n\n{.shortcuts}\n\n### Use for painting\n\n| Shortcut                 | Action                                               |\n| ------------------------ | ---------------------------------------------------- |\n| `Alt` `Shift` `0-9`      | Mixer brush changes mix setting                      |\n| `0-9`                    | Mixer brush changes wet setting                      |\n| `00`                     | Mixer brush changes wet and mix to zero              |\n| `Shift` `+/-`            | Cycle through blending modes                         |\n| `Backspace`              | Open fill dialog box on background or standard layer |\n| `Alt` `Backspace`        | Fill with foreground color                           |\n| `Ctrl` `Backspace`       | Fill with background color                           |\n| `Ctrl` `Alt` `Backspace` | Fill from history                                    |\n| `Shift` `Backspace`      | Displays fill dialog box                             |\n| `/`                      | Lock transparent pixels on/off                       |\n\n{.shortcuts}\n\n### Use for blending modes {.row-span-2}\n\n| Shortcut          | Action                                                                        |\n| ----------------- | ----------------------------------------------------------------------------- |\n| `Ctrl` `-/+`      | Cycle through blending modes                                                  |\n| `Shift` `Alt` `N` | Normal                                                                        |\n| `Shift` `Alt` `I` | Dissolve                                                                      |\n| `Shift` `Alt` `Q` | Behind (brush tool only)                                                      |\n| `Shift` `Alt` `R` | Clear (brush tool only)                                                       |\n| `Shift` `Alt` `K` | Darken                                                                        |\n| `Shift` `Alt` `M` | Multiply                                                                      |\n| `Shift` `Alt` `B` | Color burn                                                                    |\n| `Shift` `Alt` `A` | Linear burn                                                                   |\n| `Shift` `Alt` `G` | Lighten                                                                       |\n| `Shift` `Alt` `S` | Screen                                                                        |\n| `Shift` `Alt` `D` | Color dodge                                                                   |\n| `Shift` `Alt` `W` | Linear dodge                                                                  |\n| `Shift` `Alt` `O` | Overlay                                                                       |\n| `Shift` `Alt` `F` | Soft light                                                                    |\n| `Shift` `Alt` `H` | Hard light                                                                    |\n| `Shift` `Alt` `V` | Vivid light                                                                   |\n| `Shift` `Alt` `J` | Linear light                                                                  |\n| `Shift` `Alt` `Z` | Pin light                                                                     |\n| `Shift` `Alt` `L` | Hard mix                                                                      |\n| `Shift` `Alt` `E` | Difference                                                                    |\n| `Shift` `Alt` `X` | Exclusion                                                                     |\n| `Shift` `Alt` `U` | Hue                                                                           |\n| `Shift` `Alt` `T` | Saturation                                                                    |\n| `Shift` `Alt` `C` | Color                                                                         |\n| `Shift` `Alt` `Y` | Luminosity                                                                    |\n| `Shift` `Alt` `N` | Set blending mode to Threshold for bitmap images, Normal for all other images |\n\n{.shortcuts}\n\n### Format type\n\n| Shortcut                 | Action                                                             |\n| ------------------------ | ------------------------------------------------------------------ |\n| `Ctrl` `Shift` `L/C/R`   | Align left, center, or right                                       |\n| `Ctrl` `Shift` `X`       | Choose 100% horizontal scale                                       |\n| `Ctrl` `Shift` `Alt` `X` | Choose 100% vertical scale                                         |\n| `Ctrl` `Shift` `Alt` `A` | Choose auto leading                                                |\n| `Ctrl` `Shift` `Q`       | Choose 0 for tracking                                              |\n| `Ctrl` `Shift` `J`       | Justify paragraph, left aligns last line                           |\n| `Ctrl` `Shift` `F`       | Justify paragraph, justifies all                                   |\n| `Ctrl` `Shift` `Alt` `H` | Toggle paragraph hyphenation on/off                                |\n| `Ctrl` `Shift` `Alt` `T` | Toggle single/every-line composer on/off                           |\n| `Ctrl` `Shift` `</>`     | Decrease or increase type size of selected text 2 points or pixels |\n| `Alt` `Up/Down`          | Decrease or increase leading 2 points or pixels                    |\n| `Shift` `Alt` `Up/Down`  | Decrease or increase baseline shift 2 points or pixels             |\n| `Alt` `Left/Right`       | Decrease or increase kerning/tracking 20/1000 ems                  |\n\n{.shortcuts}\n\n### Use panels\n\n| Shortcut          | Action                                                  |\n| ----------------- | ------------------------------------------------------- |\n| `Shift` `Enter`   | Apply value and keep text box active                    |\n| `Tab`             | Show/Hide all panels                                    |\n| `Shift` `Tab`     | Show/Hide all panels except the toolbox and options bar |\n| `Enter`           | Highlight options bar (select tool first)               |\n| `Shift` `Up/Down` | Increase/decrease selected values by 10                 |\n\n{.shortcuts}\n\n### Use adjustment layers\n\n| Shortcut    | Action                                  |\n| ----------- | --------------------------------------- |\n| `Alt` `3`   | Choose red channel for adjustment       |\n| `Alt` `4`   | Choose green channel for adjustment     |\n| `Alt` `5`   | Choose blue channel for adjustment      |\n| `Alt` `2`   | Choose composite channel for adjustment |\n| `Backspace` | Delete adjustment layer                 |\n\n{.shortcuts}\n\n### Use the Brush panel\n\n| Shortcut          | Action                                 |\n| ----------------- | -------------------------------------- |\n| `,/.`             | Select previous/next brush size        |\n| `Shift` `,/.`     | Select first/last brush                |\n| `Caps Lock`       | Display precise cross hair for brushes |\n| `Shift` `Alt` `P` | Toggle airbrush option                 |\n\n{.shortcuts}\n\n### Use the Clone Source panel\n\n| Shortcut                 | Action                                       |\n| ------------------------ | -------------------------------------------- |\n| `Alt` `Shift`            | Show Clone Source (overlays iamge)           |\n| `Alt` `Shift` `(arrows)` | Nudge Clone Source                           |\n| `Alt` `Shift` `</>`      | Rotate Clone Source                          |\n| `Alt` `Shift` `[/]`      | Scale (increase or reduce size) Clone Source |\n\n{.shortcuts}\n\n### Use the Layers panel\n\n| Shortcut                 | Action                                                          |\n| ------------------------ | --------------------------------------------------------------- |\n| `Ctrl` `Shift` `N`       | New layer                                                       |\n| `Ctrl` `J`               | New layer via copy                                              |\n| `Ctrl` `Shift` `J`       | New layer via cut                                               |\n| `Ctrl` `G`               | Group layers                                                    |\n| `Ctrl` `Shift` `G`       | Ungroup layers                                                  |\n| `Ctrl` `Alt` `G`         | Create/release clipping mask                                    |\n| `Ctrl` `Alt` `A`         | Select all layers                                               |\n| `Ctrl` `Shift` `E`       | Merge visible layers                                            |\n| `Alt` `.`                | Select top layer                                                |\n| `Alt` `.`                | Select bottom layer                                             |\n| `Shift` `Alt` `[/]`      | Add to layer selection in Layers panel                          |\n| `Alt` `[/]`              | Select next layer down/up                                       |\n| `Ctrl` `[/]`             | Move target layer down/up                                       |\n| `Ctrl` `Shift` `Alt` `E` | Merge a copy of all visible layers into target layer            |\n| `Ctrl` `E`               | Merge layers (while layers are highlighted)                     |\n| `Ctrl` `Shift` `[/]`     | Move layer to bottom or top                                     |\n| `/`                      | Toggle lock transparency for target layer, or last applied lock |\n| `\\`                      | Toggle rubylith mode for layer mask on/off                      |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Adobe Photoshop](https://helpx.adobe.com/photoshop/using/default-keyboard-shortcuts.html)\n  _(helpx.adobe.com)_\n"
  },
  {
    "path": "source/_posts/adobe-xd.md",
    "content": "---\ntitle: Adobe XD\ndate: 2022-11-23 16:23:31.703379\nbackground: bg-[#400835]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 97 keyboard shortcuts found in Adobe XD\n---\n\n## Keyboard Shortcuts\n\n### Keys for Edit menu\n\n| Shortcut           | Action                                                               |\n| ------------------ | -------------------------------------------------------------------- |\n| `Ctrl` `Z`         | Undo                                                                 |\n| `Ctrl` `Shift` `Z` | Redo                                                                 |\n| `Ctrl` `X`         | Cut                                                                  |\n| `Ctrl` `C`         | Copy                                                                 |\n| `Ctrl` `V`         | Paste                                                                |\n| `Ctrl` `Alt` `V`   | Paste Appearance (Design mode) or Paste Interaction (Prototype mode) |\n| `Ctrl` `D`         | Duplicate                                                            |\n| `Del`              | Delete                                                               |\n| `Ctrl` `A`         | Select All                                                           |\n| `Ctrl` `Shift` `A` | Deselect All                                                         |\n\n{.shortcuts}\n\n### Keys for File menu\n\n| Shortcut           | Action          |\n| ------------------ | --------------- |\n| `Ctrl` `N`         | New             |\n| `Ctrl` `Shift` `O` | Open...         |\n| `Alt` `F4`         | Close           |\n| `Ctrl` `S`         | Save...         |\n| `Ctrl` `Shift` `S` | Save As...      |\n| `Ctrl` `Shift` `E` | Export Batch    |\n| `Ctrl` `E`         | Export Selected |\n| `Ctrl` `Shift` `I` | Import          |\n\n{.shortcuts}\n\n### Keys for Pen/Path\n\n| Shortcut         | Action                   |\n| ---------------- | ------------------------ |\n| `P`              | Switch to Pen tool       |\n| `Alt`            | Asymmetric control point |\n| `Shift`          | Snap control point angle |\n| `Shift`          | Snap anchor point angle  |\n| `Ctrl` `Alt` `U` | Add                      |\n| `Ctrl` `Alt` `S` | Subtract                 |\n| `Ctrl` `Alt` `I` | Intersect                |\n| `Ctrl` `Alt` `X` | Exclude overlap          |\n| `Ctrl` `8`       | Convert to path          |\n\n{.shortcuts}\n\n### Keys for Layers (Objects), Groups, and Artboards {.row-span-2}\n\n| Shortcut           | Action                    |\n| ------------------ | ------------------------- |\n| `Ctrl` `G`         | Group layers              |\n| `Ctrl` `Shift` `G` | Ungroup layers            |\n| `Ctrl` `K`         | Make component            |\n| `Ctrl` `L`         | Lock/Unlock layer         |\n| `Ctrl` `,`         | Hide/Show layer           |\n| `Ctrl` `Shift` `M` | Mask with shape           |\n| `Ctrl` `R`         | Make repeat grid          |\n| `1-9`              | Change layer opacity      |\n| `Ctrl` `;`         | Show/Hide artboard guides |\n| `Ctrl` `Shift` `;` | Lock artboard guides      |\n\n{.shortcuts}\n\n### Keys for Align\n\n| Shortcut               | Action                |\n| ---------------------- | --------------------- |\n| `Ctrl` `Shift` `Left`  | Left                  |\n| `Shift` `C`            | Center (horizontally) |\n| `Ctrl` `Shift` `Right` | Right                 |\n| `Ctrl` `Shift` `Up`    | Top                   |\n| `Shift` `M`            | Middle (vertically)   |\n| `Ctrl` `Shift` `Down`  | Bottom                |\n\n{.shortcuts}\n\n### Keys for Arrange\n\n| Shortcut           | Action         |\n| ------------------ | -------------- |\n| `Ctrl` `Shift` `]` | Bring to front |\n| `Ctrl` `]`         | Bring forward  |\n| `Ctrl` `[`         | Send backward  |\n| `Ctrl` `Shift` `[` | Send to back   |\n\n{.shortcuts}\n\n### Keys for Distribute\n\n| Shortcut           | Action     |\n| ------------------ | ---------- |\n| `Ctrl` `Shift` `H` | Horizontal |\n| `Ctrl` `Shift` `V` | Vertical   |\n\n{.shortcuts}\n\n### Keys for Text\n\n| Shortcut           | Action             |\n| ------------------ | ------------------ |\n| `Ctrl` `B`         | Bold               |\n| `Ctrl` `I`         | Italic             |\n| `Ctrl` `Shift` `.` | Increase font size |\n| `Ctrl` `Shift` `,` | Decrease font size |\n\n{.shortcuts}\n\n### Keys for Operations menu\n\n| Shortcut      | Action                                   |\n| ------------- | ---------------------------------------- |\n| `Alt`         | From center                              |\n| `Shift`       | Constrain                                |\n| `Enter`       | Edit text                                |\n| `Shift`       | Constrain rotate (15 deg)                |\n| `Shift`       | Line constrain rotate (45 deg)           |\n| `Shift` `Alt` | Constrain from center                    |\n| `Ctrl`        | Direct select                            |\n| `Ctrl` `Tab`  | Switch between Design and Prototype mode |\n\n{.shortcuts}\n\n### Keys for Tools menu\n\n| Shortcut   | Action            |\n| ---------- | ----------------- |\n| `V`        | Select            |\n| `R`        | Rectangle         |\n| `E`        | Ellipse           |\n| `Y`        | Polygon           |\n| `L`        | Line              |\n| `P`        | Pen               |\n| `T`        | Text              |\n| `A`        | Artboard          |\n| `Z`        | Zoom              |\n| `Ctrl` `3` | Zoom to selection |\n| `I`        | Eyedropper        |\n\n{.shortcuts}\n\n### Keys for Interface and Viewing Options\n\n| Shortcut           | Action                                        |\n| ------------------ | --------------------------------------------- |\n| `Ctrl` `+`         | Zoom in                                       |\n| `Ctrl` `-`         | Zoom out                                      |\n| `Ctrl` `0`         | Zoom to fit                                   |\n| `Ctrl` `1`         | Zoom to 100%                                  |\n| `Ctrl` `2`         | Zoom to 200%                                  |\n| `Space`            | Pan                                           |\n| `Ctrl` `Shift` `Y` | Assets                                        |\n| `Ctrl` `Y`         | Layers                                        |\n| `Ctrl` `Shift` `'` | Show layout grid                              |\n| `Ctrl` `'`         | Show square grid                              |\n| `Ctrl` `Tab`       | Switch between Design and Prototype mode      |\n| `Up/Down`          | Increase or decrease a value in a field by 1  |\n| `Shift` `Up/Down`  | Increase or decrease a value in a field by 10 |\n\n{.shortcuts}\n\n### Keys for Design Specs\n\n| Shortcut           | Action                                     |\n| ------------------ | ------------------------------------------ |\n| `Ctrl` `+/-`       | Zoom                                       |\n| `Ctrl` `0`         | Reset zoom                                 |\n| `(arrows)`         | Pan                                        |\n| `Shift` `(arrows)` | Faster pan                                 |\n| `Esc`              | Go from Spec view to UX flow view          |\n| `Esc`              | Remove focus from artboard in UX flow view |\n\n{.shortcuts}\n\n### Keys for Vector Editing\n\n| Shortcut | Action                               |\n| -------- | ------------------------------------ |\n| `Enter`  | Start editing selected vector object |\n| `Esc`    | Stop editing selected vector object  |\n\n{.shortcuts}\n\n### Keys for Prototyping\n\n| Shortcut           | Action                                            |\n| ------------------ | ------------------------------------------------- |\n| `Ctrl` `A`         | See all connections in prototype mode             |\n| `Ctrl` `Enter`     | Preview                                           |\n| `Ctrl` `Shift` `E` | Share prototype online                            |\n| `Left/Right`       | Navigate artboards in preview or shared prototype |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Adobe XD](https://helpx.adobe.com/xd/help/keyboard-shortcuts.html) _(helpx.adobe.com)_\n"
  },
  {
    "path": "source/_posts/affinity-designer.md",
    "content": "---\ntitle: Affinity Designer\ndate: 2022-11-23 16:23:31.702748\nbackground: bg-[#79cdf1]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 108 keyboard shortcuts found in Affinity Designer\n---\n\n## Keyboard Shortcuts\n\n### Designer Persona {.row-span-2}\n\n| Shortcut       | Action                     |\n| -------------- | -------------------------- |\n| `Esc`          | Cancel operation           |\n| `F1`           | Help                       |\n| `0-9`          | Change opacity             |\n| `Tab`          | Toggle UI                  |\n| `T`            | Cycle text tools           |\n| `Y`            | Transparency tool          |\n| `I`            | Color picker tool          |\n| `P`            | Pen tool                   |\n| `[`            | Decrease brush size        |\n| `]`            | Increase brush size        |\n| `A`            | Node tool                  |\n| `F`            | Point transform tool       |\n| `G`            | Fill tool                  |\n| `H`            | View tool                  |\n| `;`            | Toggle snapping            |\n| `\\`            | Clip to canvas             |\n| `Z`            | Zoom tool                  |\n| `X`            | Toggle active selector     |\n| `C`            | Corner tool                |\n| `V`            | Move tool                  |\n| `B`            | Vector brush tool          |\n| `N`            | Pencil tool                |\n| `M`            | Cycle shape tool           |\n| `,`            | Cycle split view           |\n| `.`            | Reset selection box        |\n| `/`            | Set fill or stroke to none |\n| `Ctrl` `1`     | Zoom to 100%               |\n| `Ctrl` `2`     | Zoom to 200%               |\n| `Ctrl` `3`     | Zoom to 400%               |\n| `Ctrl` `4`     | Zoom to 800%               |\n| `Ctrl` `8`     | Zoom to actual size        |\n| `Ctrl` `9`     | Zoom to pixel size         |\n| `Ctrl` `0`     | Zoom to fit                |\n| `Ctrl` `-`     | Zoom out                   |\n| `Ctrl` `=`     | Zoom in                    |\n| `Ctrl` `Tab`   | Switch view                |\n| `Ctrl` `W`     | Close                      |\n| `Ctrl` `R`     | Rulers                     |\n| `Ctrl` `T`     | Character                  |\n| `Ctrl` `Y`     | Redo                       |\n| `Ctrl` `O`     | Open                       |\n| `Ctrl` `P`     | Print                      |\n| `Ctrl` `[`     | Back one                   |\n| `Ctrl` `]`     | Forward one                |\n| `Ctrl` `Enter` | Convert to curves          |\n| `Ctrl` `A`     | Select all                 |\n| `Ctrl` `S`     | Save                       |\n| `Ctrl` `G`     | Group                      |\n| `Ctrl` `J`     | Duplicate                  |\n| `Ctrl` `L`     | Lock                       |\n| `Ctrl` `;`     | Show guides                |\n| `Ctrl` `'`     | Show grid                  |\n| `Ctrl` `Z`     | Undo                       |\n| `Ctrl` `X`     | Cut                        |\n| `Ctrl` `C`     | Copy                       |\n| `Ctrl` `V`     | Paste                      |\n| `Ctrl` `N`     | New                        |\n| `Ctrl` `M`     | Curves                     |\n| `Ctrl` `,`     | Preferences                |\n| `Space`        | Hold for view tool         |\n\n{.shortcuts}\n\n### Pixel Persona\n\n| Shortcut | Action                      |\n| -------- | --------------------------- |\n| `W`      | Selection brush             |\n| `E`      | Erase brush                 |\n| `I`      | Color picker tool           |\n| `O`      | Cycle dodge or burn brushes |\n| `[`      | Decrease brush size         |\n| `]`      | Increase brush size         |\n| `G`      | Flood fill tool             |\n| `L`      | Freehand selection tool     |\n| `X`      | Toggle active selector      |\n| `V`      | Move tool                   |\n| `B`      | Cycle brush or pixel tools  |\n| `M`      | Cycle marquees              |\n| `,`      | Cycle split view            |\n| `.`      | Reset selection box         |\n\n{.shortcuts}\n\n### Modifiers and Layer Control {.row-span-2}\n\n| Shortcut | Action                                                                 |\n| -------- | ---------------------------------------------------------------------- |\n| `Alt`    | Drawing and painting - temporarily switches to the color picker tool   |\n| `Shift`  | Freehand selection tools - connects clicked points with straight lines |\n| `Shift`  | Reverses aspect ratio constraint on scaling                            |\n| `Ctrl`   | Scales from the center of selection                                    |\n| `Alt`    | Ignores snapping during an operation                                   |\n| `Ctrl`   | Geometric shapes - moves red handles symmetrically                     |\n| `Shift`  | Path text - maintains distance between red handles                     |\n| `Ctrl`   | Path text - moves red handles symmetrically                            |\n| `Shift`  | Pixel brush painting - draws straight line connecting two strokes      |\n| `Shift`  | Pixel selections - constrains marquee to square or circle              |\n| `Ctrl`   | Pixel selection - moves underlying layer rather than selection         |\n| `Alt`    | Pixel selection - removes from selection                               |\n| `Ctrl`   | Pixel tool - erases from current layer or projects                     |\n| `Shift`  | Rotating - constrains rotations to 15 degree intervals                 |\n| `Shift`  | Selecting - scales multiple objects and layers                         |\n| `Alt`    | Selecting - selects object or layer behind current selection           |\n| `Ctrl`   | Shearing - mirrors shear around center of object                       |\n| `Shift`  | Vector drawing tools - constrains handle angles to 15 degrees          |\n| `Alt`    | Vector drawing tools - sets node to sharp for creating cusps           |\n| `Ctrl`   | Vector drawing tools - temporarily switches to node editing from pen   |\n\n{.shortcuts}\n\n### Advanced Text\n\n| Shortcut                    | Action                   |\n| --------------------------- | ------------------------ |\n| `Ctrl` `T`                  | Character panel          |\n| `Ctrl` `Shift` `T`          | Typography dialog        |\n| `Ctrl` `B`                  | Bold                     |\n| `Ctrl` `I`                  | Italic                   |\n| `Ctrl` `U`                  | Underline                |\n| `Ctrl` `Alt` `L`            | Align left               |\n| `Ctrl` `Alt` `C`            | Align center             |\n| `Ctrl` `Alt` `R`            | Align right              |\n| `Alt` `Shift` `Left`        | Tighten spacing more     |\n| `Alt` `Shift` `Right`       | Loosen spacing more      |\n| `Ctrl` `Alt` `Shift` `Up`   | Precise raise baseline   |\n| `Ctrl` `Alt` `Shift` `Down` | Precise lower baseline   |\n| `Ctrl` `Alt` `Down`         | Precise increase leading |\n| `Ctrl` `Alt` `Up`           | Precise decrease leading |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Affinity Designer](https://affinityspotlight.com/article/downloadable-affinity-keyboard-shortcut-cheat-sheets/)\n  _(affinityspotlight.com)_\n"
  },
  {
    "path": "source/_posts/affinity-photo.md",
    "content": "---\ntitle: Affinity Photo\ndate: 2022-11-23 16:23:31.694998\nbackground: bg-[#d578f0]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 177 keyboard shortcuts found in Affinity Photo\n---\n\n## Keyboard Shortcuts\n\n### Editing {.row-span-2}\n\n| Shortcut           | Action                                         |\n| ------------------ | ---------------------------------------------- |\n| `Ctrl` `Alt` `I`   | Resize document                                |\n| `Ctrl` `Alt` `C`   | Resize canvas                                  |\n| `.`                | Reset selection box                            |\n| `;`                | Toggle snapping                                |\n| `Ctrl`             | Erase with pixel tool on current layer         |\n| `X`                | Switch between Stroke/Fill color selectors     |\n| `Shift` `X`        | Swap Stroke/Fill colour selectors              |\n| `/`                | Set no fill on Stroke/Fill color selectors     |\n| `O`                | Toggle between crop tool overlays              |\n| `Shift` `O`        | Flip golden spiral overlay (crop tool enabled) |\n| `Esc`              | Cancel a sizing, moving, or creating operation |\n| `(arrows)`         | Move item                                      |\n| `Shift` `(arrows)` | Move item in 10x measurement units             |\n\n{.shortcuts}\n\n### Tools (Tone Mapping Persona)\n\n| Shortcut | Action                |\n| -------- | --------------------- |\n| `H`      | View tool             |\n| `Z`      | Zoom tool             |\n| `B`      | Overlay paint tool    |\n| `E`      | Overlay erase tool    |\n| `G`      | Overlay gradient tool |\n\n{.shortcuts}\n\n### Files\n\n| Shortcut                 | Action                                                  |\n| ------------------------ | ------------------------------------------------------- |\n| `Ctrl` `N`               | New document                                            |\n| `Ctrl` `Shift` `Alt` `N` | New from clipboard                                      |\n| `Ctrl` `O`               | Open document                                           |\n| `Ctrl` `W`               | Close document, or close app when no documents are open |\n| `Ctrl` `Tab`             | Switch document/view                                    |\n| `Ctrl` `S`               | Save                                                    |\n| `Ctrl` `Shift` `S`       | Save as                                                 |\n| `Ctrl` `Shift` `Alt` `S` | Export                                                  |\n| `Ctrl` `P`               | Print                                                   |\n\n{.shortcuts}\n\n### Vector Graphics\n\n| Shortcut       | Action                                                |\n| -------------- | ----------------------------------------------------- |\n| `Ctrl`         | Edit curves as you draw using node editing (from pen) |\n| `Ctrl` `Enter` | Convert to curves                                     |\n\n{.shortcuts}\n\n### Tools (Export Persona)\n\n| Shortcut | Action            |\n| -------- | ----------------- |\n| `S`      | Slice tool        |\n| `L`      | Layer select tool |\n\n{.shortcuts}\n\n### Tools (Develop Persona)\n\n| Shortcut | Action                |\n| -------- | --------------------- |\n| `S`      | Sampler tool          |\n| `W`      | White balance tool    |\n| `R`      | Red eye removal tool  |\n| `L`      | Blemish removal tool  |\n| `B`      | Overlay paint tool    |\n| `E`      | Overlay erase tool    |\n| `G`      | Overlay gradient tool |\n| `C`      | Crop tool             |\n| `Z`      | Zoom tool             |\n| `H`      | View tool             |\n\n{.shortcuts}\n\n### Tools\n\n| Shortcut | Action                                   |\n| -------- | ---------------------------------------- |\n| `G`      | Flood fill tool/gradient cycle           |\n| `H`      | View tool                                |\n| `V`      | Move tool                                |\n| `C`      | Crop tool                                |\n| `W`      | Selection tools cycle                    |\n| `P`      | Pen and node tool cycle                  |\n| `Z`      | Zoom tool                                |\n| `S`      | Clone tool                               |\n| `U`      | Shape tools cycle                        |\n| `T`      | Text tools cycle                         |\n| `O`      | Dodge, burn, and sponge brush tool cycle |\n| `J`      | Retouch tools cycle                      |\n| `B`      | Painting tools cycle                     |\n| `E`      | Erase tools cycle                        |\n| `M`      | Marquee selection tools cycle            |\n| `L`      | Free hand selection tool                 |\n\n{.shortcuts}\n\n### Tools (Liquify Persona)\n\n| Shortcut | Action                    |\n| -------- | ------------------------- |\n| `P`      | Liquify push forward tool |\n| `L`      | Liquify push left tool    |\n| `T`      | Liquify twirl tool        |\n| `U`      | Liquify pinch tool        |\n| `B`      | Liquify turbulence tool   |\n| `C`      | Liquify mesh clone tool   |\n| `R`      | Liquify reconstruct tool  |\n| `F`      | Liquify freeze tool       |\n| `W`      | Liquify thaw tool         |\n| `Z`      | Liquify zoom tool         |\n| `H`      | Liquify view tool         |\n\n{.shortcuts}\n\n### Text {.row-span-3}\n\n| Shortcut                    | Action                             |\n| --------------------------- | ---------------------------------- |\n| `Ctrl` `>`                  | Bigger text                        |\n| `Ctrl` `<`                  | Smaller text                       |\n| `Ctrl` `Alt` `>`            | Precise bigger text                |\n| `Ctrl` `Alt` `<`            | Precise smaller text               |\n| `Alt` `Left`                | Tighten                            |\n| `Alt` `Right`               | Loosen                             |\n| `Alt` `Shift` `Left`        | Tighten more                       |\n| `Alt` `Shift` `Right`       | Loosen more                        |\n| `Ctrl` `B`                  | Bold                               |\n| `Ctrl` `I`                  | Italic                             |\n| `Ctrl` `U`                  | Underline                          |\n| `Ctrl` `T`                  | Show character                     |\n| `Ctrl` `Shift` `T`          | Show typography                    |\n| `Ctrl` `Alt` `+`            | Superscript                        |\n| `Ctrl` `Alt` `-`            | Subscript                          |\n| `Ctrl` `Alt` `L`            | Align left                         |\n| `Ctrl` `Alt` `R`            | Align right                        |\n| `Ctrl` `Alt` `C`            | Align center                       |\n| `Ctrl` `Alt` `Shift` `\\`    | Justify left                       |\n| `Alt` `Down`                | Increase paragraph leading         |\n| `Alt` `Up`                  | Decrease paragraph leading         |\n| `Ctrl` `Shift` `Up`         | Precise paragraph increase leading |\n| `Ctrl` `Shift` `Down`       | Precise paragraph decrease leading |\n| `Alt` `Shift` `Up`          | Raise baseline                     |\n| `Alt` `Shift` `Down`        | Lower baseline                     |\n| `Ctrl` `Alt` `Shift` `Up`   | Precise raise baseline             |\n| `Ctrl` `Alt` `Shift` `Down` | Precise lower baseline             |\n| `Ctrl` `Alt` `Space`        | Special characters                 |\n| `Ctrl` `Enter`              | Line break                         |\n| `Alt` `Space`               | Non-breaking space                 |\n| `Alt` `-`                   | En dash                            |\n| `Alt` `Shift` `-`           | Em dash                            |\n| `Ctrl` `Shift` `;`          | Spelling options                   |\n\n{.shortcuts}\n\n### Tools (Panorama Persona)\n\n| Shortcut | Action                            |\n| -------- | --------------------------------- |\n| `A`      | Transform source image tool       |\n| `L`      | Add to source image mask tool     |\n| `U`      | Erase from source image mask tool |\n\n{.shortcuts}\n\n### Edit\n\n| Shortcut                 | Action               |\n| ------------------------ | -------------------- |\n| `Ctrl` `Z`               | Undo                 |\n| `Ctrl` `Shift` `Z`       | Redo                 |\n| `Ctrl` `Shift` `C`       | Copy merged          |\n| `Ctrl` `Shift` `V`       | Paste style          |\n| `Ctrl` `Alt` `V`         | Paste FX             |\n| `Ctrl` `Shift` `Alt` `V` | Paste without format |\n| `Ctrl` `Alt` `V`         | Paste inside         |\n| `Shift` `F5`             | Fill                 |\n| `Alt` `Tab`              | Inpaint              |\n\n{.shortcuts}\n\n### Layer Operations\n\n| Shortcut                 | Action                                     |\n| ------------------------ | ------------------------------------------ |\n| `Ctrl` `Alt` `A`         | Select all layers                          |\n| `Ctrl` `G`               | Group                                      |\n| `Ctrl` `Shift` `G`       | Ungroup                                    |\n| `Ctrl` `J`               | Duplicate                                  |\n| `Ctrl` `I`               | Invert                                     |\n| `Ctrl` `Shift` `]`       | Move to front                              |\n| `Ctrl` `]`               | Move forward one                           |\n| `Ctrl` `Shift` `[`       | Move to back                               |\n| `Ctrl` `[`               | Move back one                              |\n| `Ctrl` `Shift` `N`       | New layer                                  |\n| `Ctrl` `E`               | Merge down                                 |\n| `Ctrl` `Shift` `E`       | Merge selected                             |\n| `Ctrl` `Shift` `Alt` `E` | Merge visible                              |\n| `F`                      | Toggle between frequency separation layers |\n| `Ctrl` `Alt` `P`         | Edit live projection                       |\n\n{.shortcuts}\n\n### Brush\n\n| Shortcut | Action                                             |\n| -------- | -------------------------------------------------- |\n| `0-9`    | Change selected layer content/brush tool's opacity |\n| `[/]`    | Increase/decrease brush width                      |\n\n{.shortcuts}\n\n### View\n\n| Shortcut       | Action               |\n| -------------- | -------------------- |\n| `Ctrl` `+`     | Zoom in              |\n| `Ctrl` `-`     | Zoom out             |\n| `Ctrl` `0`     | Zoom to fit          |\n| `Ctrl` `1`     | Zoom to 100%         |\n| `Ctrl` `2`     | Zoom to 200%         |\n| `Ctrl` `3`     | Zoom to 400%         |\n| `Ctrl` `4`     | Zoom to 800%         |\n| `Ctrl` `8`     | Zoom to actual size  |\n| `Ctrl` `9`     | Zoom to pixel size   |\n| `Space`        | Hot key panning      |\n| `Ctrl` `Space` | Hot key zoom in      |\n| `H`            | View tool            |\n| `Ctrl` `Tab`   | Switch between views |\n| `Ctrl` `R`     | Show rulers          |\n| `Ctrl` `;`     | Show guides          |\n| `Ctrl` `'`     | Show grid            |\n\n{.shortcuts}\n\n### Pixel Selection / Mask\n\n| Shortcut           | Action                                                       |\n| ------------------ | ------------------------------------------------------------ |\n| `Ctrl` `A`         | Select all                                                   |\n| `Ctrl` `D`         | Deselect                                                     |\n| `Ctrl` `Shift` `I` | Invert pixel selection                                       |\n| `Ctrl`             | Add to selection (marquee or free hand selection tools only) |\n| `Alt`              | Remove from selection                                        |\n| `Ctrl` `B`         | Grow or shrink                                               |\n| `Shift` `F6`       | Feather                                                      |\n| `Ctrl` `Alt` `R`   | Refine edges                                                 |\n| `(arrows)`         | Move selection in 1 pixel increments                         |\n| `Shift` `(arrows)` | Move selection in 10 pixel increments                        |\n| `Q`                | Quick mask                                                   |\n| `Ctrl` `I`         | Invert mask                                                  |\n\n{.shortcuts}\n\n### Workspace\n\n| Shortcut           | Action                     |\n| ------------------ | -------------------------- |\n| `Ctrl` `Shift` `H` | Show or hide studio panels |\n| `Ctrl` `Alt` `T`   | Show or hide toolbar       |\n| `Tab`              | Toggle UI                  |\n| `Ctrl` `H`         | Hide workspace             |\n\n{.shortcuts}\n\n### Adjustment and Filter\n\n| Shortcut                 | Action                     |\n| ------------------------ | -------------------------- |\n| `Ctrl` `L`               | Levels adjustment          |\n| `Ctrl` `U`               | HSL adjustment             |\n| `Ctrl` `I`               | Invert adjustment          |\n| `Ctrl` `M`               | Curves adjustment          |\n| `Ctrl` `Shift` `Alt` `B` | Black and white adjustment |\n| `Ctrl` `F`               | Repeat filter              |\n\n{.shortcuts}\n\n### Liquify Persona\n\n| Shortcut   | Action      |\n| ---------- | ----------- |\n| `Ctrl` `D` | Mask all    |\n| `Ctrl` `I` | Invert mask |\n| `Ctrl` `A` | Clear mask  |\n\n{.shortcuts}\n\n### Misc\n\n| Shortcut         | Action                     |\n| ---------------- | -------------------------- |\n| `Ctrl` `,`       | Preferences                |\n| `Ctrl` `Alt` `L` | Liquify persona            |\n| `Ctrl` `Alt` `E` | Export persona             |\n| `Ctrl` `Alt` `R` | Develop persona            |\n| `Ctrl` `Alt` `H` | Hide others (applications) |\n| `Ctrl` `Alt` `M` | Media browser              |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Affinity Photo](https://affinityspotlight.com/article/downloadable-affinity-keyboard-shortcut-cheat-sheets/)\n  _(affinityspotlight.com)_\n"
  },
  {
    "path": "source/_posts/ai.md",
    "content": "---\ntitle: AI Directory\ndate: 2023-03-02 11:28:43\nbackground: bg-purple-600\ntags:\n  - AI\n  - List\n  - Tools\n  - Resources\ncategories:\n  - Other\nintro:\n  This is a quick reference list of cheat sheets for the AI Navigation Directory, designed to help you discover exciting\n  AI tools.\n---\n\n## Getting Started\n\n### Health & fitness\n\n- [![Favicon](https://icon.horse/icon/buoyhealth.com) Buoy health](https://buoyhealth.com)\n- [![Favicon](https://icon.horse/icon/mdacne.com) Mdacne](https://mdacne.com)\n- [![Favicon](https://icon.horse/icon/youper.ai) Youper](https://youper.ai)\n- [![Favicon](https://icon.horse/icon/endel.io/sleep) Endel × james blake: wind down](https://endel.io/sleep)\n- [![Favicon](https://icon.horse/icon/nowdialogue.com) Dialogue](https://nowdialogue.com)\n- [![Favicon](https://icon.horse/icon/maslo.ai) Maslo ai](https://maslo.ai)\n\n{.icon-list .marker-none}\n\n### Text\n\n- [![Favicon](https://icon.horse/icon/quillbot.com) Quillbot paraphraser](https://quillbot.com)\n- [![Favicon](https://icon.horse/icon/notion.so/product/ai) Notion ai](https://notion.so/product/ai)\n- [![Favicon](https://icon.horse/icon/naturalreaders.com) Naturalreader](https://naturalreaders.com)\n- [![Favicon](https://icon.horse/icon/wordtune.com/read) Wordtune read](https://wordtune.com/read)\n- [![Favicon](https://icon.horse/icon/uberduck.ai) Underduck](https://uberduck.ai)\n- [![Favicon](https://icon.horse/icon/aiseo.ai/templates/slogan-generator.html) Slogan generator](https://aiseo.ai/templates/slogan-generator.html)\n\n{.icon-list .marker-none}\n\n### Writing\n\n- [![Favicon](https://icon.horse/icon/prowritingaid.com) Prowritingaid](https://prowritingaid.com)\n- [![Favicon](https://icon.horse/icon/sapling.ai) Sapling](https://sapling.ai)\n- [![Favicon](https://icon.horse/icon/coschedule.com/headline-studio) Headline studio](https://coschedule.com/headline-studio)\n- [![Favicon](https://icon.horse/icon/trinka.ai) Trinka](https://trinka.ai)\n- [![Favicon](https://icon.horse/icon/benchmarkemail.com/features/smart-content) Benchmark email](https://benchmarkemail.com/features/smart-content)\n- [![Favicon](https://icon.horse/icon/sassbook.com/ai-writer) Sassbook ai writer](https://sassbook.com/ai-writer)\n\n{.icon-list .marker-none}\n\n### Image editing\n\n- [![Favicon](https://icon.horse/icon/remove.bg) Remove.bg](https://remove.bg)\n- [![Favicon](https://icon.horse/icon/tools.picsart.com/image) Quicktools by picsart](https://tools.picsart.com/image)\n- [![Favicon](https://icon.horse/icon/befunky.com) Befunky](https://befunky.com)\n- [![Favicon](https://icon.horse/icon/topazlabs.com/topaz-photo-ai) Topaz photo ai](https://topazlabs.com/topaz-photo-ai)\n- [![Favicon](https://icon.horse/icon/photoroom.com) Photoroom](https://photoroom.com)\n- [![Favicon](https://icon.horse/icon/erase.bg) Erase.bg](https://erase.bg)\n\n{.icon-list .marker-none}\n\n### Productivity\n\n- [![Favicon](https://icon.horse/icon/openai.com/blog/dall-e) Dall-e](https://openai.com/blog/dall-e)\n- [![Favicon](https://icon.horse/icon/flowrite.com) Flowrite](https://flowrite.com)\n- [![Favicon](https://icon.horse/icon/golden.com) Golden](https://golden.com)\n- [![Favicon](https://icon.horse/icon/picturethisai.com) Picturethis](https://picturethisai.com)\n- [![Favicon](https://icon.horse/icon/wandb.ai/site) Weights & biases](https://wandb.ai/site)\n- [![Favicon](https://icon.horse/icon/vwo.com/ab-testing-openai-gpt-3) Vwo humans vs ai](https://vwo.com/ab-testing-openai-gpt-3)\n\n{.icon-list .marker-none}\n\n### Music\n\n- [![Favicon](https://icon.horse/icon/openai.com/blog/musenet) Musenet (openai)](https://openai.com/blog/musenet)\n- [![Favicon](https://icon.horse/icon/sites.research.google/trc) Tensorflow research cloud](https://sites.research.google/trc)\n- [![Favicon](https://icon.horse/icon/moises.ai) Moises app](https://moises.ai)\n- [![Favicon](https://icon.horse/icon/soundraw.io) Soundraw](https://soundraw.io)\n- [![Favicon](https://icon.horse/icon/theselyricsdonotexist.com) Ai lyrics generator](https://theselyricsdonotexist.com)\n- [![Favicon](https://icon.horse/icon/phonicmind.com) Phonicmind](https://phonicmind.com)\n\n{.icon-list .marker-none}\n\n### Design assistant\n\n- [![Favicon](https://icon.horse/icon/kapwing.com/cartoonify) Cartoonify](https://kapwing.com/cartoonify)\n- [![Favicon](https://icon.horse/icon/icons8.com/upscaler) Smart upscaler](https://icons8.com/upscaler)\n- [![Favicon](https://icon.horse/icon/icons8.com/bgremover) Background remover](https://icons8.com/bgremover)\n- [![Favicon](https://icon.horse/icon/icons8.com/lunacy) Lunacy](https://icons8.com/lunacy)\n- [![Favicon](https://icon.horse/icon/pixlr.com) Pixlr](https://pixlr.com)\n- [![Favicon](https://icon.horse/icon/namecheap.com/logo-maker) Launchaco free logo builder](https://namecheap.com/logo-maker)\n\n{.icon-list .marker-none}\n\n### Image\n\n- [![Favicon](https://icon.horse/icon/icons8.com/swapper) Swapper](https://icons8.com/swapper)\n- [![Favicon](https://icon.horse/icon/movavi.com/photo-editor) Movavi picverse](https://movavi.com/photo-editor)\n- [![Favicon](https://icon.horse/icon/clipstudio.net/en) Clipstudio](https://clipstudio.net/en)\n- [![Favicon](https://icon.horse/icon/looka.com) Looka](https://looka.com)\n- [![Favicon](https://icon.horse/icon/midjourney.com) Midjourney](https://midjourney.com)\n- [![Favicon](https://icon.horse/icon/deepai.org/machine-learning-model/text2img) Text to image api](https://deepai.org/machine-learning-model/text2img)\n\n{.icon-list .marker-none}\n\n### Business\n\n- [![Favicon](https://icon.horse/icon/tools.picsart.com/text/ai-writer) Ai writer by picsart](https://tools.picsart.com/text/ai-writer)\n- [![Favicon](https://icon.horse/icon/aiseo.ai/tools/paraphrasing-tool.html) Intelligent paraphraser](https://aiseo.ai/tools/paraphrasing-tool.html)\n- [![Favicon](https://icon.horse/icon/bardeen.ai) Bardeen ai](https://bardeen.ai)\n- [![Favicon](https://icon.horse/icon/wonsulting.com/resumai) Resumai](https://wonsulting.com/resumai)\n- [![Favicon](https://icon.horse/icon/durable.co/ai-website-builder) Durable ai site builder](https://durable.co/ai-website-builder)\n- [![Favicon](https://icon.horse/icon/tally.so/r/npeJgq) Startup pitch generator](https://tally.so/r/npeJgq)\n\n{.icon-list .marker-none}\n\n### Virtual reality\n\n- [![Favicon](https://icon.horse/icon/myheritage.com/deep-nostalgia) Deep nostalgia™](https://myheritage.com/deep-nostalgia)\n- [![Favicon](https://icon.horse/icon/resemble.ai/gpt-3) Gpt-3 custom ai voices](https://resemble.ai/gpt-3)\n- [![Favicon](https://icon.horse/icon/sketchar.io) Ai portraits by sketchar](https://sketchar.io)\n- [![Favicon](https://icon.horse/icon/anything.world) Anything world](https://anything.world)\n- [![Favicon](https://icon.horse/icon/aipoly.com) Aipoly](https://aipoly.com)\n- [![Favicon](https://icon.horse/icon/aws.amazon.com/comprehend) Amazon comprehend](https://aws.amazon.com/comprehend)\n\n{.icon-list .marker-none}\n\n### Developer tools\n\n- [![Favicon](https://icon.horse/icon/coda.io/@coda/openai-for-coda) Openai for coda](https://coda.io/@coda/openai-for-coda)\n- [![Favicon](https://icon.horse/icon/case-study-page-nanonets.webflow.io/ocr-api) Nanonets ocr](https://case-study-page-nanonets.webflow.io/ocr-api)\n- [![Favicon](https://icon.horse/icon/ai.google) Google.ai](https://ai.google)\n- [![Favicon](https://icon.horse/icon/assemblyai.com) Assemblyai](https://assemblyai.com)\n- [![Favicon](https://icon.horse/icon/httpie.io) Httpie ai](https://httpie.io)\n- [![Favicon](https://icon.horse/icon/runpod.io) Runpod](https://runpod.io)\n\n{.icon-list .marker-none}\n\n### Avatar\n\n- [![Favicon](https://icon.horse/icon/myheritage.com/ai-time-machine) Ai time machine](https://myheritage.com/ai-time-machine)\n- [![Favicon](https://icon.horse/icon/readyplayer.me) Ready player me](https://readyplayer.me)\n- [![Favicon](https://icon.horse/icon/openart.ai/photobooth) Openart photo booth](https://openart.ai/photobooth)\n- [![Favicon](https://icon.horse/icon/hey.reface.ai) Reface ai](https://hey.reface.ai)\n- [![Favicon](https://icon.horse/icon/socialbook.io/ai-avatar) Pandora avatars](https://socialbook.io/ai-avatar)\n- [![Favicon](https://icon.horse/icon/livereacting.com/ai-host-for-live-stream) Livereacting ai](https://livereacting.com/ai-host-for-live-stream)\n\n{.icon-list .marker-none}\n\n### Fun tools\n\n- [![Favicon](https://icon.horse/icon/transformer.huggingface.co) Write with artificial intelligence](https://transformer.huggingface.co)\n- [![Favicon](https://icon.horse/icon/chai.ml) Chai](https://chai.ml)\n- [![Favicon](https://icon.horse/icon/pudding.cool/2020/12/judge-my-spotify) How bad is your spotify?](https://pudding.cool/2020/12/judge-my-spotify)\n- [![Favicon](https://icon.horse/icon/playphrase.me/) Playphrase.me](https://playphrase.me/)\n- [![Favicon](https://icon.horse/icon/dreamily.ai/editor) Dreamily](https://dreamily.ai/editor)\n- [![Favicon](https://icon.horse/icon/supermeme.ai) Supermeme.ai](https://supermeme.ai)\n\n{.icon-list .marker-none}\n\n### Seo\n\n- [![Favicon](https://icon.horse/icon/writer.com) Writer](https://writer.com)\n- [![Favicon](https://icon.horse/icon/jenni.ai) Jenni](https://jenni.ai)\n- [![Favicon](https://icon.horse/icon/articleforge.com) Articleforge](https://articleforge.com)\n- [![Favicon](https://icon.horse/icon/wordhero.co) Wordhero](https://wordhero.co)\n- [![Favicon](https://icon.horse/icon/ai-writer.com) Ai-writer](https://ai-writer.com)\n- [![Favicon](https://icon.horse/icon/growthbarseo.com) Growthbar](https://growthbarseo.com)\n\n{.icon-list .marker-none}\n\n### Video editing\n\n- [![Favicon](https://icon.horse/icon/wave.video) Wave.video](https://wave.video)\n- [![Favicon](https://icon.horse/icon/topazlabs.com/topaz-video-ai) Topaz video ai](https://topazlabs.com/topaz-video-ai)\n- [![Favicon](https://icon.horse/icon/unscreen.com) Unscreen.com](https://unscreen.com)\n- [![Favicon](https://icon.horse/icon/pictory.ai) Pictory](https://pictory.ai)\n- [![Favicon](https://icon.horse/icon/typestudio.co/tool/video-to-text) Type studio](https://typestudio.co/tool/video-to-text)\n- [![Favicon](https://icon.horse/icon/papercup.com) Papercup](https://papercup.com)\n\n{.icon-list .marker-none}\n\n### Code assistant\n\n- [![Favicon](https://icon.horse/icon/replit.com/site/ghostwriter) Ghostwriter](https://replit.com/site/ghostwriter)\n- [![Favicon](https://icon.horse/icon/fig.io/user-manual/ai) Fig ai](https://fig.io/user-manual/ai)\n- [![Favicon](https://icon.horse/icon/continual.ai) Continual](https://continual.ai)\n- [![Favicon](https://icon.horse/icon/cheatlayer.com) Cheat layer](https://cheatlayer.com)\n- [![Favicon](https://icon.horse/icon/kodezi.com) Kodezi ai](https://kodezi.com)\n- [![Favicon](https://icon.horse/icon/whatthediff.ai) Whatthediff](https://whatthediff.ai)\n\n{.icon-list .marker-none}\n\n### Mac\n\n- [![Favicon](https://icon.horse/icon/myfonts.com) Whatthefont](https://myfonts.com)\n- [![Favicon](https://icon.horse/icon/references.design) References.design](https://references.design)\n- [![Favicon](https://icon.horse/icon/github.com/Swift-AI/Swift-AI) Swift ai](https://github.com/Swift-AI/Swift-AI)\n\n{.icon-list .marker-none}\n\n### Audio editing\n\n- [![Favicon](https://icon.horse/icon/voicemod.net) Voicemod](https://voicemod.net)\n- [![Favicon](https://icon.horse/icon/podcastle.ai) Podcastle](https://podcastle.ai)\n- [![Favicon](https://icon.horse/icon/beatoven.ai) Beatoven.ai](https://beatoven.ai)\n- [![Favicon](https://icon.horse/icon/altered.ai) Altered](https://altered.ai)\n- [![Favicon](https://icon.horse/icon/cleanvoice.ai) Cleanvoice ai](https://cleanvoice.ai)\n- [![Favicon](https://icon.horse/icon/krisp.ai) Krisp](https://krisp.ai)\n\n{.icon-list .marker-none}\n\n### Copywriting\n\n- [![Favicon](https://icon.horse/icon/inkforall.com) Ink](https://inkforall.com)\n- [![Favicon](https://icon.horse/icon/boomeranggmail.com/respondable) Respondable](https://boomeranggmail.com/respondable)\n- [![Favicon](https://icon.horse/icon/frase.io) Frase](https://frase.io)\n- [![Favicon](https://icon.horse/icon/anyword.com) Anyword](https://anyword.com)\n- [![Favicon](https://icon.horse/icon/copysmith.ai) Copysmith](https://copysmith.ai)\n- [![Favicon](https://icon.horse/icon/hypotenuse.ai) Hypotenuse ai](https://hypotenuse.ai)\n\n{.icon-list .marker-none}\n\n### General writing\n\n- [![Favicon](https://icon.horse/icon/languagetool.org) Languagetool](https://languagetool.org)\n- [![Favicon](https://icon.horse/icon/wordtune.com) Wordtune](https://wordtune.com)\n- [![Favicon](https://icon.horse/icon/kickresume.com) Kickresume](https://kickresume.com)\n- [![Favicon](https://icon.horse/icon/nichesss.com) Nichess](https://nichesss.com)\n- [![Favicon](https://icon.horse/icon/wordai.com) Wordai](https://wordai.com)\n- [![Favicon](https://icon.horse/icon/corrector.app) Corrector app](https://corrector.app)\n\n{.icon-list .marker-none}\n\n### Summarizer\n\n- [![Favicon](https://icon.horse/icon/otter.ai) Otter ai](https://otter.ai)\n- [![Favicon](https://icon.horse/icon/tldrthis.com) Tldr this](https://tldrthis.com)\n- [![Favicon](https://icon.horse/icon/summari.com) Summari](https://summari.com)\n- [![Favicon](https://icon.horse/icon/tactiq.io) Tactiq](https://tactiq.io)\n- [![Favicon](https://icon.horse/icon/genei.io) Genei](https://genei.io)\n- [![Favicon](https://icon.horse/icon/upword.ai) Upword](https://upword.ai)\n\n{.icon-list .marker-none}\n\n### Video generator\n\n- [![Favicon](https://icon.horse/icon/invideo.io) Invideo](https://invideo.io)\n- [![Favicon](https://icon.horse/icon/replicate.com/google-research/frame-interpolation) Film](https://replicate.com/google-research/frame-interpolation)\n- [![Favicon](https://icon.horse/icon/synthesia.io) Synthesia](https://synthesia.io)\n- [![Favicon](https://icon.horse/icon/movio.la) Movio](https://movio.la)\n- [![Favicon](https://icon.horse/icon/hourone.ai) Hourone](https://hourone.ai)\n- [![Favicon](https://icon.horse/icon/colossyan.com) Colossyan](https://colossyan.com)\n\n{.icon-list .marker-none}\n\n### Legal assistant\n\n- [![Favicon](https://icon.horse/icon/donotpay.com) Donotpay](https://donotpay.com)\n- [![Favicon](https://icon.horse/icon/darrow.ai) Darrow ai](https://darrow.ai)\n- [![Favicon](https://icon.horse/icon/spellbook.legal) Spellbook](https://spellbook.legal)\n- [![Favicon](https://icon.horse/icon/patentpal.com) Patentpal](https://patentpal.com)\n- [![Favicon](https://icon.horse/icon/legalrobot.com) Legal robot](https://legalrobot.com)\n- [![Favicon](https://icon.horse/icon/detangle.ai) Detangle.ai](https://detangle.ai)\n\n{.icon-list .marker-none}\n\n### Generative art\n\n- [![Favicon](https://icon.horse/icon/hotpot.ai/art-generator) Hotpot art generator](https://hotpot.ai/art-generator)\n- [![Favicon](https://icon.horse/icon/bannerbear.com) Bannerbear](https://bannerbear.com)\n- [![Favicon](https://icon.horse/icon/6pen.art) 6pen art](https://6pen.art)\n- [![Favicon](https://icon.horse/icon/admaker.memorable.io) Memorable ad maker](https://admaker.memorable.io)\n- [![Favicon](https://icon.horse/icon/withflair.ai) Flair](https://withflair.ai)\n- [![Favicon](https://icon.horse/icon/designedwithai.com) Designed with ai](https://designedwithai.com)\n\n{.icon-list .marker-none}\n\n### Text to speech\n\n- [![Favicon](https://icon.horse/icon/speechify.com) Speechify](https://speechify.com)\n- [![Favicon](https://icon.horse/icon/fakeyou.com) Fakeyou](https://fakeyou.com)\n- [![Favicon](https://icon.horse/icon/play.ht) Play.ht](https://play.ht)\n- [![Favicon](https://icon.horse/icon/wellsaidlabs.com) Wellsaidlabs](https://wellsaidlabs.com)\n- [![Favicon](https://icon.horse/icon/resemble.ai) Resemble](https://resemble.ai)\n- [![Favicon](https://icon.horse/icon/aiva.ai) Aiva](https://aiva.ai)\n\n{.icon-list .marker-none}\n\n### Life assistant\n\n- [![Favicon](https://icon.horse/icon/resumeworded.com/index.php) Resume worded](https://resumeworded.com/index.php)\n- [![Favicon](https://icon.horse/icon/replika.com) Replika](https://replika.com)\n- [![Favicon](https://icon.horse/icon/justlearn.com) Justlearn](https://justlearn.com)\n- [![Favicon](https://icon.horse/icon/thekeys.ai) Thekeys](https://thekeys.ai)\n- [![Favicon](https://icon.horse/icon/looria.com) Looria](https://looria.com)\n- [![Favicon](https://icon.horse/icon/woebothealth.com) Woebot health](https://woebothealth.com)\n\n{.icon-list .marker-none}\n\n### Image generator\n\n- [![Favicon](https://icon.horse/icon/hotpot.ai) Hotpot.ai](https://hotpot.ai)\n- [![Favicon](https://icon.horse/icon/generated.photos) Generated photos](https://generated.photos)\n- [![Favicon](https://icon.horse/icon/imgcreator.zmo.ai) Imgcreator](https://imgcreator.zmo.ai)\n- [![Favicon](https://icon.horse/icon/getimg.ai) Getimg.ai](https://getimg.ai)\n- [![Favicon](https://icon.horse/icon/stockai.com) Stock ai](https://stockai.com)\n- [![Favicon](https://icon.horse/icon/gocharlie.ai) Go charlie](https://gocharlie.ai)\n\n{.icon-list .marker-none}\n\n### Book\n\n- [![Favicon](https://icon.horse/icon/readthistwice.com/sona) Sona](https://readthistwice.com/sona)\n\n{.icon-list .marker-none}\n\n### Gaming\n\n- [![Favicon](https://icon.horse/icon/play.aidungeon.io) Aidungeon](https://play.aidungeon.io)\n- [![Favicon](https://icon.horse/icon/beam.eyeware.tech) Eyeware beam](https://beam.eyeware.tech)\n- [![Favicon](https://icon.horse/icon/litrpgadventures.com) Litrpg adventures](https://litrpgadventures.com)\n- [![Favicon](https://icon.horse/icon/charisma.ai) Charisma](https://charisma.ai)\n- [![Favicon](https://icon.horse/icon/hiddendoor.co) Hidden door](https://hiddendoor.co)\n- [![Favicon](https://icon.horse/icon/ggpredict.io) Ggpredict](https://ggpredict.io)\n\n{.icon-list .marker-none}\n\n### Image scanning\n\n- [![Favicon](https://icon.horse/icon/experiments.withgoogle.com/thing-translator) Thing translator](https://experiments.withgoogle.com/thing-translator)\n- [![Favicon](https://icon.horse/icon/poly.cam) Polycam](https://poly.cam)\n\n{.icon-list .marker-none}\n\n### Sales\n\n- [![Favicon](https://icon.horse/icon/klaviyo.com/product/whats-new/sms-assistant) Klaviyo sms assistant](https://klaviyo.com/product/whats-new/sms-assistant)\n- [![Favicon](https://icon.horse/icon/instantly.ai) Instantly](https://instantly.ai)\n- [![Favicon](https://icon.horse/icon/affinity.co) Affinity](https://affinity.co)\n- [![Favicon](https://icon.horse/icon/trywingman.com) Wingman](https://trywingman.com)\n- [![Favicon](https://icon.horse/icon/lavender.ai) Lavender](https://lavender.ai)\n- [![Favicon](https://icon.horse/icon/cresta.com) Cresta](https://cresta.com)\n\n{.icon-list .marker-none}\n\n### Audio\n\n- [![Favicon](https://icon.horse/icon/descript.com) Descript](https://descript.com)\n- [![Favicon](https://icon.horse/icon/lalal.ai) Lalal.ai voice cleaner](https://lalal.ai)\n- [![Favicon](https://icon.horse/icon/poly.ai) Poly ai](https://poly.ai)\n- [![Favicon](https://icon.horse/icon/wzrd.ai) Wzrd.ai](https://wzrd.ai)\n- [![Favicon](https://icon.horse/icon/rythmex.com) Rythmex](https://rythmex.com)\n- [![Favicon](https://icon.horse/icon/blogaudio.co) Blogaudio](https://blogaudio.co)\n\n{.icon-list .marker-none}\n\n### Analytics\n\n- [![Favicon](https://icon.horse/icon/paperswithcode.com) Papers with code](https://paperswithcode.com)\n- [![Favicon](https://icon.horse/icon/explainpaper.com) Explainpaper](https://explainpaper.com)\n- [![Favicon](https://icon.horse/icon/anania.ai) Anania](https://anania.ai)\n- [![Favicon](https://icon.horse/icon/voiceops.com) Voiceops](https://voiceops.com)\n- [![Favicon](https://icon.horse/icon/stormly.com) Stormly 2.0](https://stormly.com)\n- [![Favicon](https://icon.horse/icon/sahha.ai) Sahha](https://sahha.ai)\n\n{.icon-list .marker-none}\n\n### Fintech\n\n- [![Favicon](https://icon.horse/icon/novamoney.app.link/PH) Nova money](https://novamoney.app.link/PH)\n\n{.icon-list .marker-none}\n\n### Marketing\n\n- [![Favicon](https://icon.horse/icon/monkeylearn.com) Monkeylearn](https://monkeylearn.com)\n- [![Favicon](https://icon.horse/icon/wonsulting.com/networkai) Networkai](https://wonsulting.com/networkai)\n- [![Favicon](https://icon.horse/icon/reply.io) Reply.io](https://reply.io)\n- [![Favicon](https://icon.horse/icon/outranking.io) Outranking](https://outranking.io)\n- [![Favicon](https://icon.horse/icon/linkgraph.io/seo-content-assistant) Seo content assistant by searchatlas](https://linkgraph.io/seo-content-assistant)\n- [![Favicon](https://icon.horse/icon/adcreative.ai) Adcreative.ai](https://adcreative.ai)\n\n{.icon-list .marker-none}\n\n### Story teller\n\n- [![Favicon](https://icon.horse/icon/novelai.net) Novelai](https://novelai.net)\n- [![Favicon](https://icon.horse/icon/artflow.ai) Artflow ai](https://artflow.ai)\n- [![Favicon](https://icon.horse/icon/subtxt.app) Subtxt](https://subtxt.app)\n- [![Favicon](https://icon.horse/icon/sceneone.app) Scene one](https://sceneone.app)\n- [![Favicon](https://icon.horse/icon/storypath.app) Story path](https://storypath.app)\n- [![Favicon](https://icon.horse/icon/whatonearth.xyz) What on earth?](https://whatonearth.xyz)\n\n{.icon-list .marker-none}\n\n### Low-code/no-code\n\n- [![Favicon](https://icon.horse/icon/vwo.com/testing) Vwo](https://vwo.com/testing)\n- [![Favicon](https://icon.horse/icon/mutinyhq.com) Mutiny](https://mutinyhq.com)\n- [![Favicon](https://icon.horse/icon/nanonets.com) Nanonets](https://nanonets.com)\n- [![Favicon](https://icon.horse/icon/axiom.ai) Axiom](https://axiom.ai)\n- [![Favicon](https://icon.horse/icon/askviable.com) Viable](https://askviable.com)\n- [![Favicon](https://icon.horse/icon/durable.co) Durable](https://durable.co)\n\n{.icon-list .marker-none}\n\n### Art\n\n- [![Favicon](https://icon.horse/icon/wombo.art) Wombo](https://wombo.art)\n- [![Favicon](https://icon.horse/icon/neural.love) Neural.love art generator](https://neural.love)\n- [![Favicon](https://icon.horse/icon/promptomania.com) Promptomania](https://promptomania.com)\n- [![Favicon](https://icon.horse/icon/lexica.art) Lexica](https://lexica.art)\n- [![Favicon](https://icon.horse/icon/alethea.ai/avatars) Ai avatars](https://alethea.ai/avatars)\n- [![Favicon](https://icon.horse/icon/diffusionbee.com) Diffusionbee](https://diffusionbee.com)\n\n{.icon-list .marker-none}\n\n### Customer communication\n\n- [![Favicon](https://icon.horse/icon/algolia.com/products/recommendations) Algolia recommend](https://algolia.com/products/recommendations)\n\n{.icon-list .marker-none}\n\n### Chrome extensions\n\n- [![Favicon](https://icon.horse/icon/sendpulse.com) Sendpulse for slack](https://sendpulse.com)\n- [![Favicon](https://icon.horse/icon/bizzabo.com) X.ai](https://bizzabo.com)\n- [![Favicon](https://icon.horse/icon/pipecandy.com) Pipecandy](https://pipecandy.com)\n- [![Favicon](https://icon.horse/icon/surferseo.com/free-article-outline-generator) Free article outline generator](https://surferseo.com/free-article-outline-generator)\n- [![Favicon](https://icon.horse/icon/fylehq.com) Fyle](https://fylehq.com)\n- [![Favicon](https://icon.horse/icon/socialbook.io/cartoonize) Socialbook cartoonizer](https://socialbook.io/cartoonize)\n\n{.icon-list .marker-none}\n\n### Search engine\n\n- [![Favicon](https://icon.horse/icon/algolia.com) Algolia](https://algolia.com)\n- [![Favicon](https://icon.horse/icon/everypixel.com) Everypixel](https://everypixel.com)\n- [![Favicon](https://icon.horse/icon/andisearch.com) Andi](https://andisearch.com)\n- [![Favicon](https://icon.horse/icon/onemoreai.com) One more ai](https://onemoreai.com)\n- [![Favicon](https://icon.horse/icon/imaiger.com) Imaiger](https://imaiger.com)\n- [![Favicon](https://icon.horse/icon/dreamsands.ai) Dreamsands](https://dreamsands.ai)\n\n{.icon-list .marker-none}\n\n### Research\n\n- [![Favicon](https://icon.horse/icon/elicit.org) Elicit](https://elicit.org)\n- [![Favicon](https://icon.horse/icon/typeset.io) Scispace](https://typeset.io)\n- [![Favicon](https://icon.horse/icon/adept.ai) Adept](https://adept.ai)\n- [![Favicon](https://icon.horse/icon/scholarcy.com) Scholarcy](https://scholarcy.com)\n- [![Favicon](https://icon.horse/icon/consensus.app) Consensus](https://consensus.app)\n- [![Favicon](https://icon.horse/icon/akkio.com) Akkio](https://akkio.com)\n\n{.icon-list .marker-none}\n\n### Browser extensions\n\n- [![Favicon](https://icon.horse/icon/usemotion.com) Motion task manager](https://usemotion.com)\n\n{.icon-list .marker-none}\n\n### Pc\n\n- [![Favicon](https://icon.horse/icon/paperspace.com/gradient) Gradient°](https://paperspace.com/gradient)\n\n{.icon-list .marker-none}\n\n### Prompt\n\n- [![Favicon](https://icon.horse/icon/replicate.com/methexis-inc/img2prompt) Img2prompt](https://replicate.com/methexis-inc/img2prompt)\n- [![Favicon](https://icon.horse/icon/openart.ai) Openart](https://openart.ai)\n- [![Favicon](https://icon.horse/icon/decktopus.com/blog/chatgpt-prompts-for-your-next-launch) Decktopus](https://decktopus.com/blog/chatgpt-prompts-for-your-next-launch)\n- [![Favicon](https://icon.horse/icon/promptbase.com) Promptbase](https://promptbase.com)\n- [![Favicon](https://icon.horse/icon/krea.ai) Krea](https://krea.ai)\n- [![Favicon](https://icon.horse/icon/pyttipanna.xyz) Pyttipanna](https://pyttipanna.xyz)\n\n{.icon-list .marker-none}\n\n### Email\n\n- [![Favicon](https://icon.horse/icon/unbounce.com) The landing page analyzer by unbounce](https://unbounce.com)\n- [![Favicon](https://icon.horse/icon/unbounce.com/smart-copy-everywhere) Smart copy everywhere](https://unbounce.com/smart-copy-everywhere)\n- [![Favicon](https://icon.horse/icon/breadcrumbs.io/reveal) Breadcrumbs reveal](https://breadcrumbs.io/reveal)\n- [![Favicon](https://icon.horse/icon/emergingtechbrew.com) Emerging tech brew](https://emergingtechbrew.com)\n- [![Favicon](https://icon.horse/icon/snazzy.ai) Snazzy ai](https://snazzy.ai)\n- [![Favicon](https://icon.horse/icon/conduithq.com) Conduit](https://conduithq.com)\n\n{.icon-list .marker-none}\n\n### Image improvement\n\n- [![Favicon](https://icon.horse/icon/vanceai.com/image-enlarger) Vanceai image upscaler](https://vanceai.com/image-enlarger)\n- [![Favicon](https://icon.horse/icon/cloudinary.com) Cloudinary](https://cloudinary.com)\n- [![Favicon](https://icon.horse/icon/ai.nero.com/image-upscaler) Nero image upscaler](https://ai.nero.com/image-upscaler)\n- [![Favicon](https://icon.horse/icon/prisma-ai.com/lensa) Lensa](https://prisma-ai.com/lensa)\n- [![Favicon](https://icon.horse/icon/convert.leiapix.com) Leiapix](https://convert.leiapix.com)\n- [![Favicon](https://icon.horse/icon/github.com/Sanster/lama-cleaner) Lama cleaner](https://github.com/Sanster/lama-cleaner)\n\n{.icon-list .marker-none}\n\n### Human resources\n\n- [![Favicon](https://icon.horse/icon/chatbot.com/features) Chatbot](https://chatbot.com/features)\n- [![Favicon](https://icon.horse/icon/moveworks.com) Moveworks](https://moveworks.com)\n- [![Favicon](https://icon.horse/icon/findem.ai) Findem](https://findem.ai)\n- [![Favicon](https://icon.horse/icon/skillroads.com) Skillroads](https://skillroads.com)\n- [![Favicon](https://icon.horse/icon/qatalog.com) Qatalog](https://qatalog.com)\n- [![Favicon](https://icon.horse/icon/hellotars.com/ph) Tars](https://hellotars.com/ph)\n\n{.icon-list .marker-none}\n\n### Website\n\n- [![Favicon](https://icon.horse/icon/getresponse.com/features/website-builder) Getresponse](https://getresponse.com/features/website-builder)\n- [![Favicon](https://icon.horse/icon/bookmark.com/ai-website-builder) Aida](https://bookmark.com/ai-website-builder)\n- [![Favicon](https://icon.horse/icon/studio.design) Studio design](https://studio.design)\n\n{.icon-list .marker-none}\n\n### Branding\n\n- [![Favicon](https://icon.horse/icon/namesnack.com) Namesnack](https://namesnack.com)\n- [![Favicon](https://icon.horse/icon/namify.tech) Namify](https://namify.tech)\n- [![Favicon](https://icon.horse/icon/namefruits.com) Namefruits](https://namefruits.com)\n\n{.icon-list .marker-none}\n\n### Speech\n\n- [![Favicon](https://icon.horse/icon/speechanalyzer.elsaspeak.com) Elsa speech analyzer](https://speechanalyzer.elsaspeak.com)\n- [![Favicon](https://icon.horse/icon/resemble.ai/speech-to-speech) Speech-to-speech](https://resemble.ai/speech-to-speech)\n\n{.icon-list .marker-none}\n\n### Communication\n\n- [![Favicon](https://icon.horse/icon/poised.com) Poised 2.0](https://poised.com)\n\n{.icon-list .marker-none}\n\n### Other\n\n- [![Favicon](https://icon.horse/icon/pjreddie.com/darknet/yolo) Yolo](https://pjreddie.com/darknet/yolo)\n- [![Favicon](https://icon.horse/icon/hownormalami.eu) How normal am i?](https://hownormalami.eu)\n- [![Favicon](https://icon.horse/icon/toonify.photos) Toonify](https://toonify.photos)\n- [![Favicon](https://icon.horse/icon/gptcrush.com/resources) Gpt-3 crush](https://gptcrush.com/resources)\n- [![Favicon](https://icon.horse/icon/handl.ai) Handl](https://handl.ai)\n- [![Favicon](https://icon.horse/icon/aicheatsheet.comuzi.xyz) Ai cheatsheet](https://aicheatsheet.comuzi.xyz)\n\n{.icon-list .marker-none}\n\n### Health\n\n- [![Favicon](https://icon.horse/icon/ubiehealth.com) Ubie ai symptom checker](https://ubiehealth.com)\n\n{.icon-list .marker-none}\n\n### Aggregator\n\n- [![Favicon](https://icon.horse/icon/gpt3demo.com) Gpt-3 demo](https://gpt3demo.com)\n- [![Favicon](https://icon.horse/icon/futurepedia.io) Futurepedia](https://futurepedia.io)\n- [![Favicon](https://icon.horse/icon/library.phygital.plus) Ai library](https://library.phygital.plus)\n- [![Favicon](https://icon.horse/icon/smokingrobot.ai) Smoking robot ai](https://smokingrobot.ai)\n- [![Favicon](https://icon.horse/icon/allthingsai.com) All things ai](https://allthingsai.com)\n- [![Favicon](https://icon.horse/icon/aitogrow.com) Aitogrow](https://aitogrow.com)\n\n{.icon-list .marker-none}\n\n### Customer support\n\n- [![Favicon](https://icon.horse/icon/hiverhq.com/harvey-ai-customer-support) Harvey](https://hiverhq.com/harvey-ai-customer-support)\n- [![Favicon](https://icon.horse/icon/forethought.ai) Forethought](https://forethought.ai)\n- [![Favicon](https://icon.horse/icon/kore.ai) Kore.ai](https://kore.ai)\n- [![Favicon](https://icon.horse/icon/regie.ai) Regie](https://regie.ai)\n- [![Favicon](https://icon.horse/icon/typewise.app) Typewise](https://typewise.app)\n- [![Favicon](https://icon.horse/icon/quickchat.ai) Quickchat](https://quickchat.ai)\n\n{.icon-list .marker-none}\n\n### Movies\n\n- [![Favicon](https://icon.horse/icon/taste.io) Taste](https://taste.io)\n\n{.icon-list .marker-none}\n\n### Video\n\n- [![Favicon](https://icon.horse/icon/deepfakesweb.com) Deepfakesweb](https://deepfakesweb.com)\n- [![Favicon](https://icon.horse/icon/fineshare.com/finecam) Fineshare](https://fineshare.com/finecam)\n- [![Favicon](https://icon.horse/icon/wisecut.video) Wisecut](https://wisecut.video)\n- [![Favicon](https://icon.horse/icon/elai.io) Elai](https://elai.io)\n- [![Favicon](https://icon.horse/icon/move.ai) Move](https://move.ai)\n- [![Favicon](https://icon.horse/icon/twelvelabs.io) Twelve labs](https://twelvelabs.io)\n\n{.icon-list .marker-none}\n\n### Email assistant\n\n- [![Favicon](https://icon.horse/icon/missiveapp.com) Missive](https://missiveapp.com)\n- [![Favicon](https://icon.horse/icon/magicreach.ai) Magicreach](https://magicreach.ai)\n- [![Favicon](https://icon.horse/icon/ellieai.com) Ellie](https://ellieai.com)\n- [![Favicon](https://icon.horse/icon/superreply.co) Superreply](https://superreply.co)\n- [![Favicon](https://icon.horse/icon/chatgptwriter.ai) Chatgpt writer](https://chatgptwriter.ai)\n- [![Favicon](https://icon.horse/icon/superhuman.com) Superhuman](https://superhuman.com)\n\n{.icon-list .marker-none}\n\n### Messaging\n\n- [![Favicon](https://icon.horse/icon/madgicx.com) Madgicx for facebook ads](https://madgicx.com)\n- [![Favicon](https://icon.horse/icon/bottr.me) Bottr.me](https://bottr.me)\n- [![Favicon](https://icon.horse/icon/octaneai.com) Octane ai](https://octaneai.com)\n- [![Favicon](https://icon.horse/icon/gonerdify.com/nerdybot) Nerdify bot](https://gonerdify.com/nerdybot)\n- [![Favicon](https://icon.horse/icon/fritz.ai/launch) Fritz](https://fritz.ai/launch)\n- [![Favicon](https://icon.horse/icon/abe.ai) Abe](https://abe.ai)\n\n{.icon-list .marker-none}\n\n### Generative video\n\n- [![Favicon](https://icon.horse/icon/lumen5.com) Lumen5](https://lumen5.com)\n- [![Favicon](https://icon.horse/icon/livereacting.com) Livereacting](https://livereacting.com)\n- [![Favicon](https://icon.horse/icon/reachout.ai) Reachout.ai](https://reachout.ai)\n- [![Favicon](https://icon.horse/icon/huggingface.co/spaces/camenduru/one-shot-talking-face) One shot talking face](https://huggingface.co/spaces/camenduru/one-shot-talking-face)\n- [![Favicon](https://icon.horse/icon/boolvideoinvite.carrd.co) Boolvideo](https://boolvideoinvite.carrd.co)\n- [![Favicon](https://icon.horse/icon/quickvid.ai) Quickvid](https://quickvid.ai)\n\n{.icon-list .marker-none}\n\n### Safari extensions\n\n- [![Favicon](https://icon.horse/icon/rezi.ai/ai-resume-builder) Rezi 3.0](https://rezi.ai/ai-resume-builder)\n\n{.icon-list .marker-none}\n\n### Transcriber\n\n- [![Favicon](https://icon.horse/icon/fireflies.ai) Fireflies.ai](https://fireflies.ai)\n- [![Favicon](https://icon.horse/icon/steno.ai) Steno](https://steno.ai)\n- [![Favicon](https://icon.horse/icon/peech-ai.com) Peech](https://peech-ai.com)\n- [![Favicon](https://icon.horse/icon/anypod.ai) Anypod](https://anypod.ai)\n- [![Favicon](https://icon.horse/icon/supertranslate.ai) Supertranslate](https://supertranslate.ai)\n\n{.icon-list .marker-none}\n\n### Motion capture\n\n- [![Favicon](https://icon.horse/icon/rokoko.com) Rokoko](https://rokoko.com)\n- [![Favicon](https://icon.horse/icon/cascadeur.com) Cascadeur](https://cascadeur.com)\n\n{.icon-list .marker-none}\n\n### Voice\n\n- [![Favicon](https://icon.horse/icon/fineshare.com/finevoice) Fineshare](https://fineshare.com/finevoice)\n- [![Favicon](https://icon.horse/icon/voice.ai) Voice ai](https://voice.ai)\n- [![Favicon](https://icon.horse/icon/vocads.com) Vocads survey](https://vocads.com)\n- [![Favicon](https://icon.horse/icon/whisperapi.com) Whisperapi](https://whisperapi.com)\n- [![Favicon](https://icon.horse/icon/createaivoiceovers.com) Createaivoiceovers](https://createaivoiceovers.com)\n\n{.icon-list .marker-none}\n\n### Machine learning\n\n- [![Favicon](https://icon.horse/icon/h2o.ai) H2o ai](https://h2o.ai)\n- [![Favicon](https://icon.horse/icon/nocodebooth.com) Nocodebooth](https://nocodebooth.com)\n\n{.icon-list .marker-none}\n\n### Social media assistant\n\n- [![Favicon](https://icon.horse/icon/tweethunter.io) Tweet hunter](https://tweethunter.io)\n- [![Favicon](https://icon.horse/icon/socialbu.com) Socialbu](https://socialbu.com)\n- [![Favicon](https://icon.horse/icon/predis.ai) Predis](https://predis.ai)\n- [![Favicon](https://icon.horse/icon/feedhive.com) Feedhive](https://feedhive.com)\n- [![Favicon](https://icon.horse/icon/audiolabs.io) Audiolabs](https://audiolabs.io)\n- [![Favicon](https://icon.horse/icon/zaap.ai) Zaap.ai](https://zaap.ai)\n\n{.icon-list .marker-none}\n\n### Inspiration\n\n- [![Favicon](https://icon.horse/icon/entreresource.com/chatgpt-cheat-sheet) Gpt cheat sheet](https://entreresource.com/chatgpt-cheat-sheet)\n- [![Favicon](https://icon.horse/icon/trello.com/b/4BPkSY1w/100-ai-prompts-resources-prompt-lovers) 100+ ai prompts](https://trello.com/b/4BPkSY1w/100-ai-prompts-resources-prompt-lovers)\n- [![Favicon](https://icon.horse/icon/aealexander.com/midjourney-prompt-database) Midjourney prompt database](https://aealexander.com/midjourney-prompt-database)\n- [![Favicon](https://icon.horse/icon/prompt.noonshot.com) Midjourney prompt tool](https://prompt.noonshot.com)\n- [![Favicon](https://icon.horse/icon/saaslibrary.dev) Saas library](https://saaslibrary.dev)\n- [![Favicon](https://icon.horse/icon/ordinarypeopleprompts.com) Ordinary prompts](https://ordinarypeopleprompts.com)\n\n{.icon-list .marker-none}\n\n### Stocks\n\n- [![Favicon](https://icon.horse/icon/torto.ai/welcome) Torto.ai](https://torto.ai/welcome)\n\n{.icon-list .marker-none}\n\n### Voice modulation\n\n- [![Favicon](https://icon.horse/icon/voice.ai/voice-ai-beta/I2p6L) Voice.ai](https://voice.ai/voice-ai-beta/I2p6L)\n- [![Favicon](https://icon.horse/icon/studio.themetavoice.xyz) Metavoice studio](https://studio.themetavoice.xyz)\n\n{.icon-list .marker-none}\n\n### Paraphraser\n\n- [![Favicon](https://icon.horse/icon/paraphrasetool.com) Paraphraser](https://paraphrasetool.com)\n- [![Favicon](https://icon.horse/icon/rephrasely.com) Rephrasely](https://rephrasely.com)\n- [![Favicon](https://icon.horse/icon/bearly.ai) Bearly](https://bearly.ai)\n- [![Favicon](https://icon.horse/icon/wordfixerbot.com) Wordfixerbot](https://wordfixerbot.com)\n\n{.icon-list .marker-none}\n\n### Amazon\n\n- [![Favicon](https://icon.horse/icon/TheReviewIndex.com/us) Thereviewindex](https://TheReviewIndex.com/us)\n\n{.icon-list .marker-none}\n\n### Personalized videos\n\n- [![Favicon](https://icon.horse/icon/windsor.io) Windsor](https://windsor.io)\n- [![Favicon](https://icon.horse/icon/rephrase.ai) Rephrase](https://rephrase.ai)\n- [![Favicon](https://icon.horse/icon/trymaverick.com) Maverick](https://trymaverick.com)\n- [![Favicon](https://icon.horse/icon/bhuman.ai) Bhuman](https://bhuman.ai)\n- [![Favicon](https://icon.horse/icon/vidyo.ai) Vidyo](https://vidyo.ai)\n\n{.icon-list .marker-none}\n\n### Spreadsheets\n\n- [![Favicon](https://icon.horse/icon/excelformulabot.com) Excel formula bot](https://excelformulabot.com)\n- [![Favicon](https://icon.horse/icon/boloforms.com/sheetgod) Sheetgod](https://boloforms.com/sheetgod)\n- [![Favicon](https://icon.horse/icon/sheetai.app) Sheet ai](https://sheetai.app)\n- [![Favicon](https://icon.horse/icon/sheetplus.ai) Sheet+](https://sheetplus.ai)\n- [![Favicon](https://icon.horse/icon/workspace.google.com/marketplace/app/simple_ml_for_sheets/685936641092) Simple ml](https://workspace.google.com/marketplace/app/simple_ml_for_sheets/685936641092)\n\n{.icon-list .marker-none}\n\n### Ipad\n\n- [![Favicon](https://icon.horse/icon/brain.fm) Brain.fm](https://brain.fm)\n\n{.icon-list .marker-none}\n\n### Task management\n\n- [![Favicon](https://icon.horse/icon/levity.ai) Levity](https://levity.ai)\n- [![Favicon](https://icon.horse/icon/apac.ai) Athena](https://apac.ai)\n- [![Favicon](https://icon.horse/icon/teacherbot.io) Teacherbot](https://teacherbot.io)\n\n{.icon-list .marker-none}\n\n### Email marketing\n\n- [![Favicon](https://icon.horse/icon/phrasee.co) Phrasee](https://phrasee.co)\n\n{.icon-list .marker-none}\n\n### Fashion\n\n- [![Favicon](https://icon.horse/icon/ca.la) Cala](https://ca.la)\n- [![Favicon](https://icon.horse/icon/botika.io) Botika](https://botika.io)\n- [![Favicon](https://icon.horse/icon/fashionadvisorai.com) Fashionadvisorai](https://fashionadvisorai.com)\n- [![Favicon](https://icon.horse/icon/visualhound.com) Visualhound](https://visualhound.com)\n\n{.icon-list .marker-none}\n\n### Generator\n\n- [![Favicon](https://icon.horse/icon/blocksurvey.io/ai-surveys) Blocksurvey](https://blocksurvey.io/ai-surveys)\n\n{.icon-list .marker-none}\n\n### 3d\n\n- [![Favicon](https://icon.horse/icon/deepmotion.com) Deepmotion](https://deepmotion.com)\n- [![Favicon](https://icon.horse/icon/plask.ai) Plask](https://plask.ai)\n- [![Favicon](https://icon.horse/icon/captures.lumalabs.ai/imagine) Imagine 3d](https://captures.lumalabs.ai/imagine)\n- [![Favicon](https://icon.horse/icon/lumalabs.ai) Luma ai](https://lumalabs.ai)\n- [![Favicon](https://icon.horse/icon/kaedim3d.com) Kaedim](https://kaedim3d.com)\n- [![Favicon](https://icon.horse/icon/masterpiecestudio.com) Masterpiece studio](https://masterpiecestudio.com)\n\n{.icon-list .marker-none}\n\n### Home\n\n- [![Favicon](https://icon.horse/icon/shapescale.com) Shapescale](https://shapescale.com)\n- [![Favicon](https://icon.horse/icon/github.com/Shinao/SmartMirror) Smartmirror](https://github.com/Shinao/SmartMirror)\n\n{.icon-list .marker-none}\n\n### Api\n\n- [![Favicon](https://icon.horse/icon/deepgram.com) Deepgram](https://deepgram.com)\n- [![Favicon](https://icon.horse/icon/banana.dev) Banana](https://banana.dev)\n- [![Favicon](https://icon.horse/icon/perspectiveapi.com) Perspective](https://perspectiveapi.com)\n- [![Favicon](https://icon.horse/icon/theneo.io) Theneo](https://theneo.io)\n- [![Favicon](https://icon.horse/icon/base64.ai) Base64.ai](https://base64.ai)\n- [![Favicon](https://icon.horse/icon/trueface.ai) Trueface.ai](https://trueface.ai)\n\n{.icon-list .marker-none}\n\n### Software engineering\n\n- [![Favicon](https://icon.horse/icon/prodi.gy) Prodigy](https://prodi.gy)\n\n{.icon-list .marker-none}\n\n### Open source\n\n- [![Favicon](https://icon.horse/icon/blog.floydhub.com) Floyd](https://blog.floydhub.com)\n- [![Favicon](https://icon.horse/icon/cloud.mindsdb.com) Mindsdb](https://cloud.mindsdb.com)\n- [![Favicon](https://icon.horse/icon/evidentlyai.com) Evidently ai](https://evidentlyai.com)\n- [![Favicon](https://icon.horse/icon/warrior.js.org) Warriorjs](https://warrior.js.org)\n- [![Favicon](https://icon.horse/icon/datature.io) Datature](https://datature.io)\n- [![Favicon](https://icon.horse/icon/bot.viseo.io) Viseo bot maker](https://bot.viseo.io)\n\n{.icon-list .marker-none}\n\n### Chat\n\n- [![Favicon](https://icon.horse/icon/poppylist.com/askpoppy) Ask poppy](https://poppylist.com/askpoppy)\n- [![Favicon](https://icon.horse/icon/chatbotgpt3.bubbleapps.io/version-test) Gpt chatbot](https://chatbotgpt3.bubbleapps.io/version-test)\n- [![Favicon](https://icon.horse/icon/voiceflow.com) Voiceflow](https://voiceflow.com)\n- [![Favicon](https://icon.horse/icon/mobilespoon.net/2023/01/how-to-activate-chatgpt-with-siri-and-save-response.html) Chatgpt for siri](https://mobilespoon.net/2023/01/how-to-activate-chatgpt-with-siri-and-save-response.html)\n- [![Favicon](https://icon.horse/icon/trudo.ai) Trudo](https://trudo.ai)\n- [![Favicon](https://icon.horse/icon/unschooler.me) Unschooler](https://unschooler.me)\n\n{.icon-list .marker-none}\n\n### Playstation\n\n- [![Favicon](https://icon.horse/icon/chatfuel.com) Chatfuel](https://chatfuel.com)\n\n{.icon-list .marker-none}\n\n### Startup\n\n- [![Favicon](https://icon.horse/icon/rationale.jina.ai) Rationale](https://rationale.jina.ai)\n- [![Favicon](https://icon.horse/icon/trustfinta.com) Finta](https://trustfinta.com)\n- [![Favicon](https://icon.horse/icon/ideabuddy.com) Ideabuddy](https://ideabuddy.com)\n- [![Favicon](https://icon.horse/icon/broadn.io) Broadn](https://broadn.io)\n- [![Favicon](https://icon.horse/icon/validatorai.com) Validator ai](https://validatorai.com)\n- [![Favicon](https://icon.horse/icon/namelix.com) Namelix](https://namelix.com)\n\n{.icon-list .marker-none}\n\n### Experiments\n\n- [![Favicon](https://icon.horse/icon/alethea.ai) Alethea](https://alethea.ai)\n- [![Favicon](https://icon.horse/icon/thismodeldoesnotexist.co) This model does not exist](https://thismodeldoesnotexist.co)\n\n{.icon-list .marker-none}\n\n### Windows\n\n- [![Favicon](https://icon.horse/icon/superannotate.com) Superannotate desktop](https://superannotate.com)\n\n{.icon-list .marker-none}\n\n### Generative code\n\n- [![Favicon](https://icon.horse/icon/gradio.app) Gradio](https://gradio.app)\n- [![Favicon](https://icon.horse/icon/obviously.ai) Obviously ai](https://obviously.ai)\n- [![Favicon](https://icon.horse/icon/sourceai.dev) Sourceai](https://sourceai.dev)\n- [![Favicon](https://icon.horse/icon/no-code-ai-model-builder.com) No-code ai model builder](https://no-code-ai-model-builder.com)\n- [![Favicon](https://icon.horse/icon/codesquire.ai) Codesquire](https://codesquire.ai)\n- [![Favicon](https://icon.horse/icon/aigur.dev) Aigur](https://aigur.dev)\n\n{.icon-list .marker-none}\n\n### Photography\n\n- [![Favicon](https://icon.horse/icon/portrait.vana.com) Portrait by vana](https://portrait.vana.com)\n- [![Favicon](https://icon.horse/icon/photorestoration.ai) Photorestoration](https://photorestoration.ai)\n- [![Favicon](https://icon.horse/icon/ecosnap.vercel.app) Ecosnap](https://ecosnap.vercel.app)\n- [![Favicon](https://icon.horse/icon/github.com/yemount/pose-animator) Pose animator](https://github.com/yemount/pose-animator)\n- [![Favicon](https://icon.horse/icon/github.com/ageitgey/show-facebook-computer-vision-tags) Facebook computer vision tags](https://github.com/ageitgey/show-facebook-computer-vision-tags)\n- [![Favicon](https://icon.horse/icon/dpth.app) Dpth](https://dpth.app)\n\n{.icon-list .marker-none}\n\n### Healthcare\n\n- [![Favicon](https://icon.horse/icon/whisper.ai) Whisper ai](https://whisper.ai)\n\n{.icon-list .marker-none}\n\n### Resources\n\n- [![Favicon](https://icon.horse/icon/lablab.ai) Lablab.ai](https://lablab.ai)\n- [![Favicon](https://icon.horse/icon/aiartapps.com) Ai art apps database](https://aiartapps.com)\n- [![Favicon](https://icon.horse/icon/experiments.withgoogle.com/collection/ai) Ai experiments](https://experiments.withgoogle.com/collection/ai)\n- [![Favicon](https://icon.horse/icon/flowgpt.com) Flowgpt](https://flowgpt.com)\n\n{.icon-list .marker-none}\n\n### Growth hacking\n\n- [![Favicon](https://icon.horse/icon/depict.ai) Depict.ai](https://depict.ai)\n\n{.icon-list .marker-none}\n\n### Kids\n\n- [![Favicon](https://icon.horse/icon/brickit.app) Brickit](https://brickit.app)\n\n{.icon-list .marker-none}\n\n### Search\n\n- [![Favicon](https://icon.horse/icon/open.ai) Open](https://open.ai)\n\n{.icon-list .marker-none}\n\n### Speech-to-text\n\n- [![Favicon](https://icon.horse/icon/glasp.co/youtube-summary) Glasp youtube summarizer](https://glasp.co/youtube-summary)\n- [![Favicon](https://icon.horse/icon/relayed.ai) Relayed](https://relayed.ai)\n- [![Favicon](https://icon.horse/icon/meeple.ai) Meeple](https://meeple.ai)\n- [![Favicon](https://icon.horse/icon/app.towords.io) Towords](https://app.towords.io)\n- [![Favicon](https://icon.horse/icon/usemelville.com) Melville app](https://usemelville.com)\n\n{.icon-list .marker-none}\n\n### Articles\n\n- [![Favicon](https://icon.horse/icon/riku.ai/creators) Riku](https://riku.ai/creators)\n\n{.icon-list .marker-none}\n\n### Podcast\n\n- [![Favicon](https://icon.horse/icon/snipd.com/ai-podcast-summaries) Snipd podcast summaries](https://snipd.com/ai-podcast-summaries)\n- [![Favicon](https://icon.horse/icon/sumly.ai) Sumly](https://sumly.ai)\n- [![Favicon](https://icon.horse/icon/tapesearch.com) Tapesearch](https://tapesearch.com)\n\n{.icon-list .marker-none}\n\n### Parenting\n\n- [![Favicon](https://icon.horse/icon/smartivity.in/pages/parentivity_bot) Parentivity](https://smartivity.in/pages/parentivity_bot)\n- [![Favicon](https://icon.horse/icon/gosesh.com) Sesh](https://gosesh.com)\n\n{.icon-list .marker-none}\n\n### Education assistant\n\n- [![Favicon](https://icon.horse/icon/brain-buddy.com) Brain Buddy](https://brain-buddy.com/)\n- [![Favicon](https://icon.horse/icon/kobra.dev) Kobra](https://kobra.dev)\n- [![Favicon](https://icon.horse/icon/boldvoice.com) Boldvoice](https://boldvoice.com)\n- [![Favicon](https://icon.horse/icon/prepai.in/us) Prepai](https://prepai.in/us)\n- [![Favicon](https://icon.horse/icon/explainlikeimfive.io) Eli5](https://explainlikeimfive.io)\n- [![Favicon](https://icon.horse/icon/tutorai.me) Tutorai](https://tutorai.me)\n- [![Favicon](https://icon.horse/icon/yippity.io) Yip](https://yippity.io)\n\n{.icon-list .marker-none}\n\n### Tracking\n\n- [![Favicon](https://icon.horse/icon/hexowatch.com) Hexowatch](https://hexowatch.com)\n\n{.icon-list .marker-none}\n\n### Privacy\n\n- [![Favicon](https://icon.horse/icon/playground.ai) Anonymous camera](https://playground.ai)\n- [![Favicon](https://icon.horse/icon/useguard.com) Guard](https://useguard.com)\n\n{.icon-list .marker-none}\n\n### Vehicle\n\n- [![Favicon](https://icon.horse/icon/polymathrobotics.com) Polymath robotics](https://polymathrobotics.com)\n\n{.icon-list .marker-none}\n\n### Twitter\n\n- [![Favicon](https://icon.horse/icon/tribescaler.com) Tribescaler](https://tribescaler.com)\n- [![Favicon](https://icon.horse/icon/kanyegenerator.com) Kanye tweet generator](https://kanyegenerator.com)\n- [![Favicon](https://icon.horse/icon/tweetspear.com) Tweetspear](https://tweetspear.com)\n- [![Favicon](https://icon.horse/icon/tweept3.com) Tweept3](https://tweept3.com)\n- [![Favicon](https://icon.horse/icon/tweetai.com) Tweetai](https://tweetai.com)\n\n{.icon-list .marker-none}\n\n### Dev\n\n- [![Favicon](https://icon.horse/icon/edenai.co) Eden ai](https://edenai.co)\n- [![Favicon](https://icon.horse/icon/meetmaya.world) Maya ai](https://meetmaya.world)\n- [![Favicon](https://icon.horse/icon/testkit.app) Testkit](https://testkit.app)\n\n{.icon-list .marker-none}\n\n### Saas\n\n- [![Favicon](https://icon.horse/icon/yous.ai) Yous](https://yous.ai)\n- [![Favicon](https://icon.horse/icon/trydocent.ai) Docent](https://trydocent.ai)\n\n{.icon-list .marker-none}\n\n### Podcasting\n\n- [![Favicon](https://icon.horse/icon/audo.ai) Audo ai](https://audo.ai)\n\n{.icon-list .marker-none}\n\n### Bot\n\n- [![Favicon](https://icon.horse/icon/hirex.ai) Hirex.ai](https://hirex.ai)\n\n{.icon-list .marker-none}\n\n### Finance\n\n- [![Favicon](https://icon.horse/icon/glean.ai) Glean ai](https://glean.ai)\n- [![Favicon](https://icon.horse/icon/avanz.ai) Avanzai](https://avanz.ai)\n\n{.icon-list .marker-none}\n\n### Self-improvement\n\n- [![Favicon](https://icon.horse/icon/huberman.rile.yt) Huberman ai](https://huberman.rile.yt)\n\n{.icon-list .marker-none}\n\n### Robots\n\n- [![Favicon](https://icon.horse/icon/activechat.ai/intents-and-insights) Activechat bot trainer](https://activechat.ai/intents-and-insights)\n- [![Favicon](https://icon.horse/icon/motion.ai) Motion ai](https://motion.ai)\n- [![Favicon](https://icon.horse/icon/apitobot.io) Api to bot](https://apitobot.io)\n\n{.icon-list .marker-none}\n\n### Slack\n\n- [![Favicon](https://icon.horse/icon/thegist.ai) Thegist](https://thegist.ai)\n- [![Favicon](https://icon.horse/icon/chatbottle.co) Chatbottle](https://chatbottle.co)\n- [![Favicon](https://icon.horse/icon/cai.tools.sap) Bot builder by recast.ai](https://cai.tools.sap)\n\n{.icon-list .marker-none}\n\n### Investing\n\n- [![Favicon](https://icon.horse/icon/koble.ai/founderfit) Founderfit by koble](https://koble.ai/founderfit)\n\n{.icon-list .marker-none}\n\n### Questions\n\n- [![Favicon](https://icon.horse/icon/therocketbrew.com/jeeves) Jeeves](https://therocketbrew.com/jeeves)\n- [![Favicon](https://icon.horse/icon/godinabox.co) God in a box](https://godinabox.co)\n\n{.icon-list .marker-none}\n\n### Construction\n\n- [![Favicon](https://icon.horse/icon/aim.vision) Aim](https://aim.vision)\n\n{.icon-list .marker-none}\n\n### Data\n\n- [![Favicon](https://icon.horse/icon/geniussheets.com) Genius sheets](https://geniussheets.com)\n- [![Favicon](https://icon.horse/icon/askcommand.com) Ask command](https://askcommand.com)\n- [![Favicon](https://icon.horse/icon/noluai.com) Nolu](https://noluai.com)\n- [![Favicon](https://icon.horse/icon/uselookup.com) Lookup](https://uselookup.com)\n- [![Favicon](https://icon.horse/icon/olli.ai) Olli](https://olli.ai)\n- [![Favicon](https://icon.horse/icon/autopredict.co.uk) Autopredict](https://autopredict.co.uk)\n\n{.icon-list .marker-none}\n\n### Plugin\n\n- [![Favicon](https://icon.horse/icon/tldrdev.ai) Jetbrains ide plugin](https://tldrdev.ai)\n\n{.icon-list .marker-none}\n\n### Pet\n\n- [![Favicon](https://icon.horse/icon/digitaldogs.ai) Digital dogs](https://digitaldogs.ai)\n- [![Favicon](https://icon.horse/icon/aipetavatar.com) Aipetavatar](https://aipetavatar.com)\n\n{.icon-list .marker-none}\n\n### Sports\n\n- [![Favicon](https://icon.horse/icon/sportsprediction.ai) Ai sports prediction](https://sportsprediction.ai)\n\n{.icon-list .marker-none}\n\n### User experience\n\n- [![Favicon](https://icon.horse/icon/arcopypaste.app) Clipdrop](https://arcopypaste.app)\n- [![Favicon](https://icon.horse/icon/getairim.com) Airim 2.0](https://getairim.com)\n- [![Favicon](https://icon.horse/icon/akin.nz) Akin](https://akin.nz)\n\n{.icon-list .marker-none}\n\n### Quiz\n\n- [![Favicon](https://icon.horse/icon/quizgecko.com) Quizgecko](https://quizgecko.com)\n\n{.icon-list .marker-none}\n\n### Sql\n\n- [![Favicon](https://icon.horse/icon/decile.app) Decile](https://decile.app)\n- [![Favicon](https://icon.horse/icon/aihelperbot.com) Aihelperbot](https://aihelperbot.com)\n- [![Favicon](https://icon.horse/icon/aiquery.co) Ai query](https://aiquery.co)\n- [![Favicon](https://icon.horse/icon/ai2sql.io) Ai2sql](https://ai2sql.io)\n- [![Favicon](https://icon.horse/icon/usechannel.com) Channel](https://usechannel.com)\n\n{.icon-list .marker-none}\n\n### Linkedin\n\n- [![Favicon](https://icon.horse/icon/sid.black/tools/linkedin-post-generator) Linkedin posts generator](https://sid.black/tools/linkedin-post-generator)\n\n{.icon-list .marker-none}\n\n### Food\n\n- [![Favicon](https://icon.horse/icon/ai-recipes.softr.app) Ai recipe generator](https://ai-recipes.softr.app)\n- [![Favicon](https://icon.horse/icon/foodai.app) Foodai](https://foodai.app)\n- [![Favicon](https://icon.horse/icon/whatcaketobake.com) What cake to bake?](https://whatcaketobake.com)\n\n{.icon-list .marker-none}\n\n### Tool\n\n- [![Favicon](https://icon.horse/icon/autoname.org) Autoname](https://autoname.org)\n- [![Favicon](https://icon.horse/icon/assetsai.art) Assetsai](https://assetsai.art)\n- [![Favicon](https://icon.horse/icon/aibusinesstool.com) Aibusinesstool](https://aibusinesstool.com)\n\n{.icon-list .marker-none}\n\n### Emoji\n\n- [![Favicon](https://icon.horse/icon/phben.ch) Ph bench](https://phben.ch)\n\n{.icon-list .marker-none}\n\n### Newsletters\n\n- [![Favicon](https://icon.horse/icon/subscribe.machinelearnings.co) Machine learnings](https://subscribe.machinelearnings.co)\n\n{.icon-list .marker-none}\n\n### Streaming services\n\n- [![Favicon](https://icon.horse/icon/their.tube) Theirtube](https://their.tube)\n\n{.icon-list .marker-none}\n\n### Excel\n\n- [![Favicon](https://icon.horse/icon/formula.dog) Formula dog](https://formula.dog)\n\n{.icon-list .marker-none}\n\n### Ai detection\n\n- [![Favicon](https://icon.horse/icon/thomas.io/detect-gpt) Detect gpt](https://thomas.io/detect-gpt)\n- [![Favicon](https://icon.horse/icon/nsfw.m1guelpf.me) Is this image nsfw?](https://nsfw.m1guelpf.me)\n\n{.icon-list .marker-none}\n\n### News\n\n- [![Favicon](https://icon.horse/icon/speechkit.io) Speechkit](https://speechkit.io)\n- [![Favicon](https://icon.horse/icon/useclarity.com) Clarity](https://useclarity.com)\n\n{.icon-list .marker-none}\n\n### Vacation\n\n- [![Favicon](https://icon.horse/icon/letsroam.app) Roamr](https://letsroam.app)\n\n{.icon-list .marker-none}\n\n### Logo generator\n\n- [![Favicon](https://icon.horse/icon/makelogoai.com) Make logo ai](https://makelogoai.com)\n\n{.icon-list .marker-none}\n\n### Real estate\n\n- [![Favicon](https://icon.horse/icon/airoomplanner.com) Ai room planner](https://airoomplanner.com)\n- [![Favicon](https://icon.horse/icon/coolaiid.com) Coolaiid](https://coolaiid.com)\n\n{.icon-list .marker-none}\n\n### Assistant\n\n- [![Favicon](https://icon.horse/icon/eddyai.com) Eddyai](https://eddyai.com)\n\n{.icon-list .marker-none}\n\n### Bots\n\n- [![Favicon](https://icon.horse/icon/ai-chatbots.pulse.is) Ai chatbots in messengers](https://ai-chatbots.pulse.is)\n\n{.icon-list .marker-none}\n\n### Advertising\n\n- [![Favicon](https://icon.horse/icon/jotapp.tech) Jot](https://jotapp.tech)\n\n{.icon-list .marker-none}\n\n### Gift ideas\n\n- [![Favicon](https://icon.horse/icon/giftastic.ai) Giftastic.ai](https://giftastic.ai)\n- [![Favicon](https://icon.horse/icon/coolgiftideas.io) Cool gift ideas](https://coolgiftideas.io)\n- [![Favicon](https://icon.horse/icon/elfhelp.ai) Elf help](https://elfhelp.ai)\n\n{.icon-list .marker-none}\n\n### Text-to-speech\n\n- [![Favicon](https://icon.horse/icon/verbatik.com) Verbatik](https://verbatik.com)\n\n{.icon-list .marker-none}\n\n### Character\n\n- [![Favicon](https://icon.horse/icon/salewhale.chat) Salewhale](https://salewhale.chat)\n\n{.icon-list .marker-none}\n\n### Memory\n\n- [![Favicon](https://icon.horse/icon/heyday.xyz) Heyday](https://heyday.xyz)\n\n{.icon-list .marker-none}\n\n### Feedback\n\n- [![Favicon](https://icon.horse/icon/myess.ai) Myess](https://myess.ai)\n\n{.icon-list .marker-none}\n\n### Background\n\n- [![Favicon](https://icon.horse/icon/zoomscape.ai) Zoomscape](https://zoomscape.ai)\n\n{.icon-list .marker-none}\n\n### Support\n\n- [![Favicon](https://icon.horse/icon/resolveai.co) Resolveai](https://resolveai.co)\n\n{.icon-list .marker-none}\n\n### Rank\n\n- [![Favicon](https://icon.horse/icon/reviewz.ai) Reviewz](https://reviewz.ai)\n\n{.icon-list .marker-none}\n\n### Letter\n\n- [![Favicon](https://icon.horse/icon/recommendme.to) Recommendme](https://recommendme.to)\n\n{.icon-list .marker-none}\n\n### Gift\n\n- [![Favicon](https://icon.horse/icon/text2present.com) Text2present](https://text2present.com)\n\n{.icon-list .marker-none}\n\n### Dream\n\n- [![Favicon](https://icon.horse/icon/scarlettpanda.com) Scarlettpanda](https://scarlettpanda.com)\n\n{.icon-list .marker-none}\n\n### Excuse\n\n- [![Favicon](https://icon.horse/icon/excuses.ai) Excuses ai](https://excuses.ai)\n\n{.icon-list .marker-none}\n\n### Game\n\n- [![Favicon](https://icon.horse/icon/huggingface.co/spaces/huggingface-projects/stable-diffusion-multiplayer) Stable diffusion multiplayer](https://huggingface.co/spaces/huggingface-projects/stable-diffusion-multiplayer)\n\n{.icon-list .marker-none}\n\n### Edit\n\n- [![Favicon](https://icon.horse/icon/bigmp4.com) Bigmp4](https://bigmp4.com)\n\n{.icon-list .marker-none}\n\n### Translation\n\n- [![Favicon](https://icon.horse/icon/bot.petit.today) Languagepro](https://bot.petit.today)\n\n{.icon-list .marker-none}\n\n### Startup tools\n\n- [![Favicon](https://icon.horse/icon/releasenote.ai) Releasenote.ai](https://releasenote.ai)\n\n{.icon-list .marker-none}\n\n### E-commerce\n\n- [![Favicon](https://icon.horse/icon/recommendix.com/es-ar) Recommendix](https://recommendix.com/es-ar)\n\n{.icon-list .marker-none}\n\n### Beauty\n\n- [![Favicon](https://icon.horse/icon/hairbyai.com) Hairbyai](https://hairbyai.com)\n\n{.icon-list .marker-none}\n\n### Photo\n\n- [![Favicon](https://icon.horse/icon/camira.ai) Camira](https://camira.ai)\n\n{.icon-list .marker-none}\n"
  },
  {
    "path": "source/_posts/airtable.md",
    "content": "---\ntitle: Airtable\ndate: 2022-11-23 16:23:31.699659\nbackground: bg-[#f1b73f]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 36 keyboard shortcuts found in Airtable\n---\n\n## Keyboard Shortcuts\n\n### General {.row-span-3}\n\n| Shortcut           | Action                                                                                           |\n| ------------------ | ------------------------------------------------------------------------------------------------ |\n| `Ctrl` `Z`         | Undo action                                                                                      |\n| `Ctrl` `Shift` `Z` | Redo action                                                                                      |\n| `Ctrl` `P`         | Print the current table view or current expanded record (if inside an expanded record)           |\n| `Ctrl` `J`         | Opens the table switcher in the current base                                                     |\n| `Ctrl` `K`         | Opens the quick base switcher if on the home screen or inside a base                             |\n| `Ctrl` `Shift` `K` | Opens the view switcher in the current base                                                      |\n| `Ctrl` `Shift` `F` | Opens the filter menu in the current view, press enter to create a new filter                    |\n| `Ctrl` `Shift` `D` | Opens the grouped records menu in the current view, press enter to collapse or expand all groups |\n| `Ctrl` `Shift` `S` | Opens the sort menu in the current view, press enter to re-apply the most recent sort            |\n| `Ctrl` `Shift` `\\` | Toggles blocks                                                                                   |\n| `Ctrl` `F`         | Opens the find bar, use esc to close it                                                          |\n| `Ctrl` `;`         | Sets the selected date/datetime field to now                                                     |\n\n{.shortcuts}\n\n### Grid View {.row-span-3}\n\n| Shortcut                  | Action                                                                                                  |\n| ------------------------- | ------------------------------------------------------------------------------------------------------- |\n| `Ctrl` `C`                | Copy a cell or range of cells                                                                           |\n| `Ctrl` `X`                | Cut a cell or range of cells                                                                            |\n| `Ctrl` `V`                | Paste a cell (if you select a range of cells, you can paste the same value into multiple cells at once) |\n| `Space`                   | Expand the active record, use esc to return to the table                                                |\n| `Shift` `Space`           | Expand the active cell, you can then use arrow keys to move to different cells                          |\n| `PgUp`                    | Scrolls one screen up                                                                                   |\n| `PgDn`                    | Scrolls one screen down                                                                                 |\n| `Alt` `PgUp`              | Scrolls one screen left                                                                                 |\n| `Alt` `PgDn`              | Scrolls one screen right                                                                                |\n| `Ctrl` `(arrows)`         | Jump to the edge of the table                                                                           |\n| `Ctrl` `Shift` `(arrows)` | Jump to the edge of table and select cells                                                              |\n| `Shift` `(arrows)`        | Select range of cells, you can also click while holding shift to select cells                           |\n| `Shift` `Enter`           | Insert a record below the selected cell                                                                 |\n| `Enter`                   | Edit the selected cell                                                                                  |\n\n{.shortcuts}\n\n### Gallery View\n\n| Shortcut         | Action                    |\n| ---------------- | ------------------------- |\n| `Ctrl` `Up/Down` | Scroll to edge of gallery |\n\n{.shortcuts}\n\n### Kanban View\n\n| Shortcut       | Action                                        |\n| -------------- | --------------------------------------------- |\n| `Left`         | Scroll kanban board to the left by one stack  |\n| `Right`        | Scroll kanban board to the right by one stack |\n| `Ctrl` `Left`  | Scroll kanban board to the left edge          |\n| `Ctrl` `Right` | Scroll kanban board to the right edge         |\n| `Ctrl` `Up`    | Scroll all stacks to the top                  |\n| `Ctrl` `Down`  | Scroll all stacks to the bottom               |\n\n{.shortcuts}\n\n### Expanded Record\n\n| Shortcut           | Action                                                       |\n| ------------------ | ------------------------------------------------------------ |\n| `Ctrl` `Shift` `<` | Move to the previous record while viewing an expanded record |\n| `Ctrl` `Shift` `>` | Move to the next record while viewing an expanded record     |\n| `Esc`              | Close expanded record                                        |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Airtable](https://support.airtable.com/hc/en-us/articles/204143385-Airtable-keyboard-shortcuts)\n  _(support.airtable.com)_\n"
  },
  {
    "path": "source/_posts/alan-ai.md",
    "content": "---\ntitle: Alan AI\ndate: 2023-03-03 6:00:00\nbackground: bg-[#4aa181]\ntags:\n  - AI\n  - AlanAI\n  - Prompts\n  - Tips\ncategories:\n  - Toolkit\nintro:\n  This cheat sheet covers all major script concepts, client API methods, handlers and other tools to create a multimodal\n  conversational experience with Alan AI\n---\n\n### Legend\n\n- `pattern` — phrase to invoke a voice/text command or a response to be played\n- `value` — specified value\n- `params` — passed parameters\n- `action` — action to be performed\n- `output` — data outcome\n- `[...]` — optional data or parameters\n\n## Dialog script\n\n### Intents & patterns\n\nDefine a voice/text command to play a response\n\n```{.wrap}\nintent('pattern'[, 'patternN'], reply('pattern'))\n```\n\nDefine a voice/text command to play a response or perform an action\n\n```{.wrap}\nintent('pattern'[, 'patternN'], p => { action })\n```\n\nDefine alternatives\n\n```{.wrap}\nintent('phrase1|phrase2')\n```\n\nDefine optional words and phrases\n\n```{.wrap}\nintent('pattern (optional phrase|)')\n```\n\n### Response functions\n\nPlay a response (in case of multiple patterns, a response is picked at random)\n\n```{.wrap}\nreply('pattern'[, 'patternN'])\n```\n\nPlay a response\n\n```{.wrap}\np.play('pattern')\n```\n\nDefine voice settings for the assistant reply: `accent (en, fr, de, it, ru, es)`, `gender (male/female)`, `voice type`,\n`speaking pitch`, `speaking rate`\n\n```{.wrap}\np.play([voice(code, gender, type, pitch, rate), ]'pattern')\n```\n\nDefine play options: `force:true` (execute if the button is inactive), `activate:true` (activate the button before),\n`deactivate:true` (deactivate the button after)\n\n```{.wrap}\np.play('pattern'[, opts(options)])\n```\n\nSend a command to the app\n\n```{.wrap}\np.play({command:data})\n```\n\n### User-defined slots\n\nDefine a static list of values expected in the input\n\n```{.wrap}\n$(SLOTNAME value1|value2) => p.SLOTNAME.value\n```\n\nProvide labels to classify or identify the slot values\n\n```{.wrap}\n$(SLOTNAME value1~label1|value2~label2) => p.SLOTNAME.label\n```\n\nEnable fuzzy matching to capture similar variants\n\n```{.wrap}\n$(SLOTNAME~ value1|value2) => p.SLOTNAME.value\n```\n\nMake a slot optional\n\n```{.wrap}\n$(SLOTNAME value1|value2|)\n```\n\nCapture several slot values\n\n```{.wrap}\nintent('$(SLOTNAME value1|value2) and $(SLOTNAME value1|value2 )') => p.SLOTNAME_ (array), p.SLOTNAME_[0].value, p.SLOTNAME_[1].value\n```\n\n### Predefined slots\n\nCapture date values\n\n```{.wrap}\n$(DATE) => p.DATE.value, p.DATE.moment, p.DATE.luxon\n```\n\nCapture time values\n\n```{.wrap}\n$(TIME) => p.TIME.value, p.TIME.moment\n```\n\nCapture cardinal numbers\n\n```{.wrap}\n$(NUMBER) => p.NUMBER.value, p.NUMBER.number\n```\n\nCapture ordinal numbers\n\n```{.wrap}\n$(ORDINAL) => p.ORDINAL.value, p.ORDINAL.number\n```\n\nCapture locations\n\n```{.wrap}\n$(LOC) => p.LOC.value\n```\n\nCapture names\n\n```{.wrap}\n$(NAME) => p.NAME.value\n```\n\n### Dynamic slots\n\nDefine a dynamic slot at the project level\n\n```{.wrap}\nproject.name = {en: \"value1|value2|value3\"}\n$(SLOTNAME p:name) => p.SLOTNAME.value\n```\n\nDefine a dynamic slot at the dialog session level\n\n```{.wrap}\np.userData.name = {en: \"value1|value2|value3\"}\n$(SLOTNAME u:name) => p.SLOTNAME.value\n```\n\nGet data for a dynamic slot with the visual state\n\n```{.wrap}\nlet name = [\"value1|value2|value3\"]\np.visual.data = {en: name};\n$(SLOTNAME v:name) => p.SLOTNAME.value\n```\n\nDefine a dynamic slot in a short form\n\n```{.wrap}\nproject.name = {en: \"value1|value2|value3\"}\n$(p:name) => p.SLOTNAME.value\n```\n\nDefine labels for dynamic slots: see [User-defined slots](#user-defined-slots).\n\nEnable fuzzy matching for dynamic slots: see [User-defined slots](#user-defined-slots).\n\nMake a dynamic slot optional: see [User-defined slots](#user-defined-slots).\n\nCapture several slot values: see [User-defined slots](#user-defined-slots).\n\n### RegEx slots\n\nCapture digit and/or letter combination\n\n```{.wrap}\nconst reg = \"([A-Za-z]{1}\\\\s?){6}\"\n$(SLOTNAME* ${reg}) => p.SLOTNAME.value\n```\n\nCapture any user’s input\n\n```{.wrap}\n$(SLOTNAME* .+) => p.SLOTNAME.value\n```\n\n### Contexts\n\nDefine a context\n\n```{.wrap}\nlet contextName = context(() => { action })\n```\n\nActivate a context\n\n```{.wrap}\nintent('pattern', p => {..., p.then(contextName)}\n```\n\nPass data to the context\n\n```{.wrap}\np.then(contextName, state: {data:yourData}) => p.state.data\n```\n\nResolve a context\n\n```{.wrap}\np.resolve([data:yourData])\n```\n\nReset a context\n\n```{.wrap}\np.resetContext()\n```\n\nDefine intents to be matched at any time without switching the current context\n\n```{.wrap}\nintent(noctx, 'pattern', ...) or noContext(() => {intent(...)})\n```\n\nPlay a prompt for an expected input\n\n```{.wrap}\nfallback('pattern1'[, 'patternN'])\n```\n\nTitle a context\n\n```{.wrap}\ntitle('contextName')\n```\n\n### Predefined objects\n\nStore static device- and user-specific data passed from the client app\n\n```{.wrap}\nauthData.data => p.authData.data\n```\n\nStore state data to be available globally at the project scope\n\n```{.wrap}\nproject.info = {data:yourData} => project.info.data\n```\n\nStore the intent match score\n\n```{.wrap}\np.score\n```\n\nStore data to be passed between contexts\n\n```{.wrap}\np.state.data\n```\n\nStore visual context data to be passed from the client app with `setVisualState()`\n\n```{.wrap}\np.visual.data\n```\n\nStore user-specific state data to be accessible during the dialog session\n\n```{.wrap}\np.userData.data\n```\n\n### Predefined callbacks\n\nDefine actions to be performed when the script is saved and dialog model is built\n\n```{.wrap}\nonCreateProject(() => { action })\n```\n\nDefine actions to be performed when the dialog session starts\n\n```{.wrap}\nonCreateUser((p) => { action })\n```\n\nDefine actions to be performed when the dialog session ends\n\n```{.wrap}\nonCleanupUser((p) => { action })\n```\n\nDefine actions to be performed when the visual state is set\n\n```{.wrap}\nonVisualState((p, s) => { action })\n```\n\nDefine actions to be performed when a user event is triggered in the client app: `buttonReady`, `buttonClicked`,\n`micPermissionPrompt`, `micAllowed`, `firstActivate`, `showPopup`, `popupCloseClicked`, `recognized`\n\n```{.wrap}\nonUserEvent((p, e) => { action })\n```\n\nDefine actions to be performed when a context is activated\n\n```{.wrap}\nonEnter((p) => { action })\n```\n\n### Q&A service\n\nDefine a URL of a resource to be indexed\n\n```{.wrap}\ncorpus({url: url, depth: depthLevel})\n```\n\nDefine text corpus to be used by the assistant in the dialog\n\n```{.wrap}\ncorpus('text')\n```\n\n### Built-in JS libraries\n\nMake API calls\n\n```{.wrap}\naxios, request\n```\n\nWork with time\n\n```{.wrap}\nmoment-timezone, luxon\n```\n\nWork with arrays, numbers, objects, strings and so on\n\n```{.wrap}\nlodash\n```\n\n### Other\n\nProvide a list of hints to help recognize specific terms\n\n```{.wrap}\nrecognitionHints('hint'[, 'hintN'])\n```\n\nWrite info messages to Alan Studio logs\n\n```{.wrap}\nconsole.log(data)\n```\n\nWrite error messages to Alan Studio logs\n\n```{.wrap}\nconsole.error(data)\n```\n\n## Client SDK\n\n### Client API methods\n\nSend information about the visual state from the client app to the dialog script\n\n```{.wrap}\nsetVisualState(visualStateData:object)\n```\n\nSend data or perform actions without a voice/text command\n\n```{.wrap}\nprojectAPI.method = function(p, param, callback) {\n  p.userData.data = param.data;\n  callback();\n};\n\ncallProjectApi(method:string, data:object, callback:function)\n```\n\nPlay a text message in the client app\n\n```{.wrap}\nplayText(text:string)\n```\n\nSend a text message to Alan as the user’s input\n\n```{.wrap}\nsendText(text:string)\n```\n\nExecute a command in the client app\n\n```{.wrap}\nplayCommand(command:object)\n```\n\n### Client API methods (continued)\n\nActivate the Alan button programmatically\n\n```{.wrap}\nactivate()\n```\n\nDeactivate the Alan button programmatically\n\n```{.wrap}\ndeactivate()\n```\n\nCheck the Alan button state\n\n```{.wrap}\nisActive()\n```\n\nRemove the Alan button from the parent element, page (supported on Web, Ionic)\n\n```{.wrap}\nremove()\n```\n\nCheck the state of the wake word (supported on iOS, Android)\n\n```{.wrap}\ngetWakewordEnabled()\n```\n\nSet the state of the wake word (supported on iOS, Android)\n\n```{.wrap}\nsetWakewordEnabled(enabled:boolean)\n```\n\n### Handlers\n\n// Examples are provided for the Web platform\n\nHandle commands sent from the dialog script to the client app\n\n```{.wrap}\nonCommand: function (commandData) { action }\n```\n\nHandle Alan button state changes\n\n```{.wrap}\nonButtonState: function (e) { action }\n```\n\nHandle connection status to the virtual assistant project in the Alan Cloud\n\n```{.wrap}\nonConnectionStatus: function (e) { action }\n```\n\nHandle events received from Alan\n\n```{.wrap}\nonEvent: function (e) { action }\n```\n\n## Also see\n\n- [Alan AI website](https://alan.app)\n- [About the Alan Platform](https://alan.app/platform)\n- [Alan AI documentation](https://alan.app/docs)\n"
  },
  {
    "path": "source/_posts/alpine-linux.md",
    "content": "---\ntitle: Alpine Linux\ndate: 2024-03-20 12:00:00\nicon: icon-alpine\nbackground: bg-blue-600\ntags:\n  - linux\n  - server\n  - container\ncategories:\n  - Operating System\nintro:\n  A comprehensive cheatsheet for Alpine Linux, covering package management, system administration, networking, and more.\n  Alpine Linux is a security-oriented, lightweight Linux distribution based on musl libc and busybox.\n---\n\n# Alpine Linux Cheatsheet\n\n## Package Management (apk)\n\n### Basic Package Operations\n\n```bash\n# Update package index\napk update\n\n# Upgrade all installed packages\napk upgrade\n\n# Install a package\napk add <package-name>\n\n# Remove a package\napk del <package-name>\n\n# Search for a package\napk search <package-name>\n\n# Show package info\napk info <package-name>\n\n# List all installed packages\napk list --installed\n```\n\n### Advanced Package Operations\n\n```bash\n# Add package from testing repository\napk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing <package-name>\n\n# Add multiple packages\napk add package1 package2 package3\n\n# Clean package cache\napk cache clean\n```\n\n## System Administration\n\n### Service Management (OpenRC)\n\n```bash\n# Start a service\nrc-service <service-name> start\n\n# Stop a service\nrc-service <service-name> stop\n\n# Restart a service\nrc-service <service-name> restart\n\n# Add service to default runlevel\nrc-update add <service-name> default\n\n# Remove service from default runlevel\nrc-update del <service-name> default\n\n# List all services\nrc-status\n```\n\n### System Information\n\n```bash\n# Show system information\nuname -a\n\n# Show disk usage\ndf -h\n\n# Show memory usage\nfree -h\n\n# Show running processes\nps aux\n\n# Show system uptime\nuptime\n```\n\n### Network Configuration\n\n```bash\n# Show network interfaces\nip addr show\n\n# Configure network interface\nsetup-interfaces\n\n# Test network connectivity\nping -c 4 google.com\n\n# Show routing table\nip route show\n\n# Edit network configuration\nvi /etc/network/interfaces\n```\n\n### User Management\n\n```bash\n# Add a new user\nadduser <username>\n\n# Add user to group\naddgroup <username> <groupname>\n\n# Change password\npasswd <username>\n\n# Delete user\ndeluser <username>\n\n# List all users\ncat /etc/passwd\n```\n\n## File System Operations\n\n### Basic File Operations\n\n```bash\n# Create directory\nmkdir <directory-name>\n\n# Remove directory\nrm -r <directory-name>\n\n# Copy files\ncp <source> <destination>\n\n# Move/rename files\nmv <source> <destination>\n\n# Change permissions\nchmod <permissions> <file>\n\n# Change ownership\nchown <user>:<group> <file>\n```\n\n## Container Operations\n\n### Docker Support\n\n```bash\n# Install Docker\napk add docker\n\n# Start Docker service\nrc-service docker start\n\n# Enable Docker at boot\nrc-update add docker default\n```\n\n## System Maintenance\n\n### Disk Operations\n\n```bash\n# Check disk space\ndf -h\n\n# Check directory size\ndu -sh <directory>\n\n# Mount a device\nmount /dev/<device> /mnt/<mountpoint>\n\n# Unmount a device\numount /mnt/<mountpoint>\n```\n\n### Backup and Restore\n\n```bash\n# Create tar archive\ntar -czf backup.tar.gz /path/to/backup\n\n# Extract tar archive\ntar -xzf backup.tar.gz\n\n# Create system backup (root required)\nlbu package /media/backup.apkovl.tar.gz\n```\n\n## Tips and Tricks\n\n### Common Configuration Files\n\n- `/etc/apk/repositories` - Package repositories\n- `/etc/network/interfaces` - Network configuration\n- `/etc/hostname` - System hostname\n- `/etc/hosts` - Host mappings\n- `/etc/resolv.conf` - DNS configuration\n\n### Environment Variables\n\n```bash\n# Set environment variable\nexport VARIABLE=value\n\n# View all environment variables\nenv\n\n# Add permanent environment variable\necho \"export VARIABLE=value\" >> ~/.profile\n```\n\n### System Logs\n\n```bash\n# View system logs\nless /var/log/messages\n\n# View boot messages\ndmesg\n\n# Follow log in real-time\ntail -f /var/log/messages\n```\n\n## Security\n\n### Firewall (using iptables)\n\n```bash\n# Install iptables\napk add iptables\n\n# Allow SSH (port 22)\niptables -A INPUT -p tcp --dport 22 -j ACCEPT\n\n# Save iptables rules\n/etc/init.d/iptables save\n\n# Restore iptables rules\n/etc/init.d/iptables restart\n```\n\n### SSH Configuration\n\n```bash\n# Generate SSH key\nssh-keygen -t rsa -b 4096\n\n# Copy SSH key to remote server\nssh-copy-id user@remote-server\n\n# Edit SSH configuration\nvi /etc/ssh/sshd_config\n```\n\n## Troubleshooting\n\n### Common Commands\n\n```bash\n# Check system logs for errors\ndmesg | grep -i error\n\n# Check service status\nrc-service <service-name> status\n\n# Check system resource usage\ntop\n\n# Check network connections\nnetstat -tuln\n\n# Check disk health\nsmartctl -a /dev/sda  # Requires smartmontools package\n```\n"
  },
  {
    "path": "source/_posts/android-studio.md",
    "content": "---\ntitle: Android Studio\ndate: 2022-11-23 16:23:31.704217\nbackground: bg-[#6bd488]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 130 keyboard shortcuts found in the Andriod Studio software\n---\n\n## Keyboard Shortcuts\n\n### General\n\n| Shortcut                 | Action                                            |\n| ------------------------ | ------------------------------------------------- |\n| `Ctrl` `S`               | Save all                                          |\n| `Ctrl` `Alt` `Y`         | Synchronize                                       |\n| `Ctrl` `Shift` `F12`     | Minimize or maximize the editor                   |\n| `Alt` `Shift` `F`        | Add to favorites                                  |\n| `Alt` `Shift` `I`        | Inspect the current file with the current profile |\n| `Ctrl` <code>\\`</code>   | Quick switch the scheme                           |\n| `Ctrl` `Alt` `S`         | Open the settings dialogue                        |\n| `Ctrl` `Alt` `Shift` `S` | Open the project structure dialogue               |\n| `Ctrl` `Tab`             | Switch between the tabs and tool window           |\n\n{.shortcuts}\n\n### Navigating and Searching {.row-span-2}\n\n| Shortcut                   | Action                                      |\n| -------------------------- | ------------------------------------------- |\n| `Shift` `Shift`            | Search everything, including code and menus |\n| `Ctrl` `F`                 | Find                                        |\n| `F3`                       | Find next                                   |\n| `Shift` `F3`               | Find previous                               |\n| `Ctrl` `R`                 | Replace                                     |\n| `Ctrl` `Shift` `A`         | Find action                                 |\n| `Ctrl` `Alt` `Shift` `N`   | Search by a symbol name                     |\n| `Ctrl` `N`                 | Find class                                  |\n| `Ctrl` `Shift` `N`         | Find file, instead of class                 |\n| `Ctrl` `Shift` `F`         | Find in path                                |\n| `Ctrl` `F12`               | Open file structure pop-up                  |\n| `Alt` `Right/Left`         | Navigate between open editor tabs           |\n| `Ctrl` `Enter`             | Jump to source                              |\n| `Shift` `F4`               | Open the current editor tab in a new window |\n| `Ctrl` `E`                 | Recently opened files pop-up                |\n| `Ctrl` `Shift` `E`         | Recently edited files pop-up                |\n| `Ctrl` `Shift` `Backspace` | Go to last edit location                    |\n| `Ctrl` `F4`                | Close active editor tab                     |\n| `Esc`                      | Return to editor window from a tool window  |\n| `Shift` `Esc`              | Hide active or last active tool window      |\n| `Ctrl` `G`                 | Go to line                                  |\n| `Ctrl` `H`                 | Open type hierarchy                         |\n| `Ctrl` `Shift` `H`         | Open method hierarchy                       |\n| `Ctrl` `Alt` `H`           | Open call hierarchy                         |\n\n{.shortcuts}\n\n### Writing Code {.row-span-4}\n\n| Shortcut               | Action                                                                            |\n| ---------------------- | --------------------------------------------------------------------------------- |\n| `Alt` `Insert`         | Generate code, e.g. getters, setters, constructors, new class                     |\n| `Ctrl` `O`             | Override methods                                                                  |\n| `Ctrl` `I`             | Implement methods                                                                 |\n| `Ctrl` `Alt` `T`       | Surround with if...else, try...catch, etc                                         |\n| `Ctrl` `Y`             | Delete line at caret                                                              |\n| `Ctrl` `-`             | Collapse the current code block                                                   |\n| `Ctrl` `+`             | Expand the current code block                                                     |\n| `Ctrl` `Shift` `-`     | Collapse all code blocks                                                          |\n| `Ctrl` `Shift` `+`     | Expand all code blocks                                                            |\n| `Ctrl` `D`             | Duplicate the current line or selection                                           |\n| `Ctrl` `Space`         | Basic code completion                                                             |\n| `Ctrl` `Shift` `Space` | Smart code completion, filters the list of methods and variables by expected type |\n| `Ctrl` `Shift` `Enter` | Complete statement                                                                |\n| `Ctrl` `Q`             | Quick documentation lookup                                                        |\n| `Ctrl` `P`             | Show parameters for selected method                                               |\n| `Ctrl` `B`             | Go to declaration, directly                                                       |\n| `Ctrl` `Alt` `B`       | Go to implementations                                                             |\n| `Ctrl` `U`             | Go to super-method or super-class                                                 |\n| `Ctrl` `Shift` `I`     | Open quick definition lookup                                                      |\n| `Alt` `1`              | Toggle project tool window visibility                                             |\n| `F11`                  | Toggle bookmark                                                                   |\n| `Ctrl` `F11`           | Toggle bookmark with mnemonic                                                     |\n| `Ctrl` `/`             | Comment or uncomment with line comment                                            |\n| `Ctrl` `Shift` `/`     | Comment or uncomment with block comment                                           |\n| `Ctrl` `W`             | Select successively increasing code blocks                                        |\n| `Ctrl` `Shift` `W`     | Decrease current selection to previous state                                      |\n| `Ctrl` `[`             | Move to code block start                                                          |\n| `Ctrl` `]`             | Move to code block end                                                            |\n| `Ctrl` `Shift` `[`     | Select to the code block start                                                    |\n| `Ctrl` `Shift` `]`     | Select to the code block end                                                      |\n| `Ctrl` `Del`           | Delete to the end of a word                                                       |\n| `Ctrl` `Backspace`     | Delete to the start of a word                                                     |\n| `Ctrl` `Alt` `O`       | Optimize imports                                                                  |\n| `Alt` `Enter`          | Project quick fix, show intention actions and quick fixes                         |\n| `Ctrl` `Alt` `L`       | Reformat code                                                                     |\n| `Ctrl` `Alt` `I`       | Auto-indent lines                                                                 |\n| `Tab`                  | Indent lines                                                                      |\n| `Shift` `Tab`          | Unindent lines                                                                    |\n| `Ctrl` `Shift` `J`     | Smart line join                                                                   |\n| `Ctrl` `Enter`         | Smart line split                                                                  |\n| `Shift` `Enter`        | Start new line                                                                    |\n| `F2`                   | Next highlighted error                                                            |\n| `Shift` `F2`           | Previous highlighted error                                                        |\n\n{.shortcuts}\n\n### Viewing Layouts\n\n| Shortcut           | Action        |\n| ------------------ | ------------- |\n| `Ctrl` `+`         | Zoom in       |\n| `Ctrl` `-`         | Zoom out      |\n| `Ctrl` `0`         | Fit to screen |\n| `Ctrl` `Shift` `1` | Actual size   |\n\n{.shortcuts}\n\n### Layout Editor\n\n| Shortcut          | Action                                       |\n| ----------------- | -------------------------------------------- |\n| `B`               | Toggle between Design and Blueprint modes    |\n| `O`               | Toggle between Portrait and Landscaope modes |\n| `D`               | Toggle devices                               |\n| `R`               | Force refresh                                |\n| `E`               | Toggle render errors panel                   |\n| `Del`             | Delete constraints                           |\n| `Ctrl` `+`        | Zoom in                                      |\n| `Ctrl` `-`        | Zoom out                                     |\n| `Ctrl` `0`        | Zoom to fit                                  |\n| `Ctrl` `B`        | Go to XML                                    |\n| `Ctrl` `A`        | Select all components                        |\n| `Shift` `(click)` | Select multiple components                   |\n\n{.shortcuts}\n\n### Navigation Editor\n\n| Shortcut         | Action                       |\n| ---------------- | ---------------------------- |\n| `Ctrl` `+`       | Zoom in                      |\n| `Ctrl` `-`       | Zoom out                     |\n| `Ctrl` `0`       | Zoom to fit                  |\n| `Ctrl` `B`       | Go to XML                    |\n| `E`              | Toggle render errors panel   |\n| `Ctrl` `G`       | Group into a nested graph    |\n| `Tab`            | Cycle through destinations   |\n| `Ctrl` `A`       | Select all destinations      |\n| `Ctrl` `(click)` | Select multiple destinations |\n\n{.shortcuts}\n\n### Build and Run\n\n| Shortcut           | Action                             |\n| ------------------ | ---------------------------------- |\n| `Ctrl` `F9`        | Build                              |\n| `Shift` `F10`      | Build and run                      |\n| `Ctrl` `F10`       | Apply changes and restart activity |\n| `Ctrl` `Alt` `F10` | Apply code changes                 |\n\n{.shortcuts}\n\n### Debugging\n\n| Shortcut            | Action              |\n| ------------------- | ------------------- |\n| `Shift` `F9`        | Debug               |\n| `F8`                | Step over           |\n| `F7`                | Step into           |\n| `Shift` `F7`        | Smart step into     |\n| `Shift` `F8`        | Step out            |\n| `Alt` `F9`          | Run to cursor       |\n| `Alt` `F8`          | Evaluate expression |\n| `F9`                | Resume program      |\n| `Ctrl` `F8`         | Toggle breakpoint   |\n| `Ctrl` `Shift` `F8` | View breakpoints    |\n\n{.shortcuts}\n\n### Refactoring\n\n| Shortcut         | Action            |\n| ---------------- | ----------------- |\n| `F5`             | Copy              |\n| `F6`             | Move              |\n| `Alt` `Del`      | Safe delete       |\n| `Shift` `F6`     | Rename            |\n| `Ctrl` `F6`      | Change signature  |\n| `Ctrl` `Alt` `N` | Inline            |\n| `Ctrl` `Alt` `M` | Extract method    |\n| `Ctrl` `Alt` `V` | Extract variable  |\n| `Ctrl` `Alt` `F` | Extract field     |\n| `Ctrl` `Alt` `C` | Extract constant  |\n| `Ctrl` `Alt` `P` | Extract parameter |\n\n{.shortcuts}\n\n### Version Control\n\n| Shortcut              | Action                  |\n| --------------------- | ----------------------- |\n| `Ctrl` `K`            | Commit project to VCS   |\n| `Ctrl` `T`            | Update project from VCS |\n| `Alt` `Shift` `C`     | View recent changes     |\n| `Alt` <code>\\`</code> | Open VCS pop-up         |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Android Studio](https://developer.android.com/studio/intro/keyboard-shortcuts)\n  _(developer.android.com)_\n"
  },
  {
    "path": "source/_posts/apex-legends.md",
    "content": "---\ntitle: Apex Legends\ndate: 2022-11-23 16:23:31.706352\nbackground: bg-[#a74145]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 27 default keyboard shortcuts found in Apex Legends\n---\n\n## Keyboard Shortcuts\n\n### Movement\n\n| Shortcut     | Action         |\n| ------------ | -------------- |\n| `W`          | Move forward   |\n| `S`          | Move back      |\n| `A`          | Move left      |\n| `D`          | Move right     |\n| `Left Shift` | Sprint         |\n| `Space`      | Jump           |\n| `C`          | Toggle crouch  |\n| `Left Ctrl`  | Hold to crouch |\n\n{.shortcuts}\n\n### Weapons and Abilities\n\n| Shortcut | Action                    |\n| -------- | ------------------------- |\n| `Q`      | Tactical ability          |\n| `Z`      | Ultimate ability          |\n| `E`      | Interact or pickup        |\n| `X`      | Alternate interact        |\n| `Tab`    | Toggle inventory          |\n| `M`      | Toggle map                |\n| `B`      | Toggle fire mode          |\n| `V`      | Melee                     |\n| `R`      | Reload                    |\n| `1`      | Equip first weapon        |\n| `2`      | Equip second weapon       |\n| `3`      | Holster weapons           |\n| `G`      | Equip grenade             |\n| `4`      | Use selected health item  |\n| `H`      | Toggle Gibraltar's shield |\n| `N`      | Inspect weapon            |\n\n{.shortcuts}\n\n### Communication\n\n| Shortcut | Action                   |\n| -------- | ------------------------ |\n| `F`      | Ping enemy here          |\n| `T`      | Hold to use push to talk |\n| `Enter`  | Message team             |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Apex Legends](https://www.metabomb.net/off-meta/gameplay-guides/apex-legends-controls-pc-playstation-4xbox-one)\n  _(www.metabomb.net)_\n"
  },
  {
    "path": "source/_posts/apple-music.md",
    "content": "---\ntitle: Apple Music\ndate: 2022-11-23 16:23:31.700157\nbackground: bg-[#e05564]\nlabel: Mac\ntags:\n  -\n  - mac\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 62 keyboard shortcuts found in the Apple Music app. This application is MacOS-only.\n---\n\n## Keyboard Shortcuts\n\n### Playing Music {.row-span-2}\n\n| Shortcut              | Action                                                   |\n| --------------------- | -------------------------------------------------------- |\n| `Space`               | Start playing or pause the selected song                 |\n| `Enter`               | Play the currently selected song from the beginning      |\n| `Cmd` `Opt` `Right`   | Move forward within a song                               |\n| `Cmd` `Opt` `Left`    | Move backward within a song                              |\n| `Cmd` `.`             | Stop playing the selected song                           |\n| `Right`               | When a song is playing, play the next song in a list     |\n| `Left`                | When a song is playing, play the previous song in a list |\n| `Cmd` `L`             | Show the currently playing song in the list              |\n| `Cmd` `Opt` `U`       | Show the Playing Next queue                              |\n| `Opt` `Right`         | Listen to the next album in a list                       |\n| `Opt` `Left`          | Listen to the previous album in a list                   |\n| `Cmd` `Up`            | Increase the volume                                      |\n| `Cmd` `Down`          | Decrease the volume                                      |\n| `Cmd` `Opt` `E`       | Open the equalizer                                       |\n| `Cmd` `Shift` `Right` | Go to the next chapter, if available                     |\n| `Cmd` `Shift` `Left`  | Go to the previous chapter, if available                 |\n| `Cmd` `U`             | Stream audio file at a specific URL to Music             |\n\n{.shortcuts}\n\n### Playlists\n\n| Shortcut          | Action                                                                   |\n| ----------------- | ------------------------------------------------------------------------ |\n| `Cmd` `N`         | Create a new playlist                                                    |\n| `Cmd` `Shift` `N` | Create a playlist from a selection of songs                              |\n| `Cmd` `Opt` `N`   | Create a new Smart Playlist                                              |\n| `Opt` `Space`     | Start the Genius Shuffle                                                 |\n| `Cmd` `R`         | Refresh a Genius Playlist, when the playlist is selected                 |\n| `Cmd` `Del`       | Delete the selected playlist without confirmation                        |\n| `Opt` `Del`       | Delete the selected playlist and all songs it contains from your library |\n| `Opt` `Del`       | Delete the selected song from your library and all playlists             |\n\n{.shortcuts}\n\n### Window Options {.row-span-2}\n\n| Shortcut          | Action                                                    |\n| ----------------- | --------------------------------------------------------- |\n| `Cmd` `Shift` `M` | Open the MiniPlayer                                       |\n| `Cmd` `Shift` `F` | Open the Full Screen Player                               |\n| `Cmd` `Ctrl` `F`  | Toggle full-screen view                                   |\n| `Cmd` `/`         | Show or hide the status bar                               |\n| `Cmd` `I`         | Open the info window for the selected song                |\n| `Cmd` `N`         | In the info window, see information for the next song     |\n| `Cmd` `P`         | In the info window, see information for the previous song |\n| `Cmd` `Shift` `[` | Go to the previous pane in the info window                |\n| `Cmd` `Shift` `]` | Go to the next pane in the info window                    |\n| `Cmd` `J`         | Open the View Options window for the selected source      |\n| `Cmd` `T`         | Turn the visualizer on or off                             |\n| `?`               | See more options when a visual effect is showing          |\n| `Cmd` `R`         | Refresh Apple Music or the iTunes Store                   |\n| `Cmd` `0`         | Open the Music window                                     |\n| `Cmd` `W`         | Close the Music window                                    |\n| `Cmd` `M`         | Put the Music window in the Dock                          |\n| `Cmd` `H`         | Hide the Music window                                     |\n| `Cmd` `Opt` `H`   | Hide all other applications                               |\n\n{.shortcuts}\n\n### Library\n\n| Shortcut          | Action                                             |\n| ----------------- | -------------------------------------------------- |\n| `Cmd` `O`         | Add a file to your library                         |\n| `Cmd` `Shift` `R` | Show where a song file is located                  |\n| `Cmd` `F`         | Select the search field                            |\n| `Cmd` `Z`         | Undo your last typing change while editing an item |\n| `Cmd` `X`         | Cut the selected song's information or artwork     |\n| `Cmd` `C`         | Copy the selected song's information or artwork    |\n| `Cmd` `V`         | Paste the selected song's information or artwork   |\n| `Cmd` `A`         | Select all the songs in the list                   |\n| `Cmd` `B`         | Show or hide the column browser                    |\n| `Cmd` `Shift` `A` | De-select all the songs in the list                |\n\n{.shortcuts}\n\n### iTunes Store\n\n| Shortcut      | Action                                      |\n| ------------- | ------------------------------------------- |\n| `Opt` `Enter` | Initiate a search in the iTunes Store       |\n| `Cmd` `]`     | Go to the next page in the iTunes Store     |\n| `Cmd` `[`     | Go to the previous page in the iTunes Store |\n| `Cmd` `R`     | Reload the current page                     |\n\n{.shortcuts}\n\n### Other\n\n| Shortcut    | Action                                              |\n| ----------- | --------------------------------------------------- |\n| `Cmd` `,`   | Open Music Preferences                              |\n| `Cmd` `Q`   | Quit the Music app                                  |\n| `Cmd` `E`   | Eject a CD                                          |\n| `Cmd` `?`   | Open the Music Help menu                            |\n| `Cmd` `Opt` | Open a different music library, while opening Music |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Music on Mac](https://support.apple.com/guide/music/keyboard-shortcuts-mus1019/mac)\n  _(support.apple.com)_\n"
  },
  {
    "path": "source/_posts/arduino-programming.md",
    "content": "---\ntitle: Arduino Programming\ndate: 2024-05-29 8:58:31\nbackground: bg-[#387f83]\nlabel:\ntags: -cpp -I/O\ncategories:\n  - Programming\nintro: |\n  Ardunio programming cheat-sheet for I/O programming and  ardunio board programming.\n\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Gather Necessary Materials\n\n- Arduino Board: Any model, such as Arduino Uno, Mega, Nano, etc.\n- USB Cable: Compatible with your Arduino board (commonly USB Type-A to Type-B for Uno).\n- Computer: Windows, macOS, or Linux.\n\n### Install the Arduino IDE\n\n- windows/mac/linux\n- Go to the Arduino Software page.\n- Download the os installer.\n- Run the installer and follow the instructions.\n\n### Connect Your Arduino Board\n\n- Connect the Arduino board to your computer using the USB cable.\n- The power LED on the Arduino should light up, indicating it’s receiving power.\n\n### Configure the Arduino IDE\n\n- Open the Arduino IDE.\n- Select Your Board:\n- Go to Tools > Board and select the model of your Arduino board (e.g., Arduino Uno).\n\n- Select the Port:\n\n- Go to Tools > Port and select the port that the Arduino is connected to (it usually shows as COMx on Windows,\n  /dev/cu.usbmodemxxxx on macOS, and /dev/ttyUSBx on Linux).\n\n## Basic Structure\n\n### Setup and Loop\n\n```cpp\nvoid setup() {\n  // Code here runs once\n}\n\nvoid loop() {\n  // Code here runs repeatedly\n}\n```\n\n### Comment\n\n```cpp\n// Single-line comment\n\n/*\nMulti-line\ncomment\n*/\n```\n\n### Variable\n\n```cpp\nint ledPin = 13; // Integer\nfloat voltage = 5.0; // Floating-point number\nchar letter = 'A'; // Character\nString text = \"Hello\"; // String\n```\n\n### Pin Modes\n\n```cpp\npinMode(pin, mode);\n```\n\n### Digital I/O\n\n```cpp\ndigitalWrite(pin, value);\nint value = digitalRead(pin);\n\n```\n\n### Analog I/O\n\n```cpp\nanalogWrite(pin, value);\nint value = analogRead(pin);\n\n```\n\n## Serial Communication\n\n### Begin Serial Communication\n\n```cpp\nSerial.begin(baudRate);\n```\n\n### Print to Serial Monitor\n\n```cpp\nSerial.print(data);\nSerial.println(data);\n```\n\n### Read from Serial Monitor\n\n```cpp\nif (Serial.available()) {\n  char data = Serial.read();\n}\n```\n\n## Control Structures\n\n### If Statement\n\n```cpp\nif (condition) {\n  // Code to execute if condition is true\n} else {\n  // Code to execute if condition is false\n}\n```\n\n### For Loop\n\n```cpp\nfor (initialization; condition; increment) {\n  // Code to execute\n}\n```\n\n### While Loop\n\n```cpp\nwhile (condition) {\n  // Code to execute\n}\n```\n\n### Functions\n\n```cpp\nreturnType functionName(parameters) {\n  // Code to execute\n  return value;\n}\n```\n\n## Libraries\n\n### Include a Library\n\n```cpp\n#include <LibraryName.h>\n```\n\n### Using a Library\n\n```cpp\n#include <Servo.h>\n\nServo myServo;\n\nvoid setup() {\n  myServo.attach(9); // Attach servo to pin 9\n}\n\nvoid loop() {\n  myServo.write(90); // Set servo to 90 degrees\n  delay(1000);\n  myServo.write(0); // Set servo to 0 degrees\n  delay(1000);\n}\n```\n\n## Common Functions\n\n### Delay\n\n```cpp\ndelay(milliseconds);\n\n```\n\n### Millis\n\n```cpp\nunsigned long currentTime = millis();\n\n```\n\n### Map\n\n```cpp\nlong outputValue = map(inputValue, fromLow, fromHigh, toLow, toHigh);\n\n```\n\n### Random\n\n```cpp\nlong randomValue = random(max);\nlong randomValue = random(min, max);\n\n```\n\n### Random Seed\n\n```cpp\nrandomSeed(analogRead(0)); // Seed from analog pin 0\n\n```\n\n## Sensors and Modules\n\n### Reading Temperature with DHT Sensor\n\n```cpp\n#include <DHT.h>\n\n#define DHTPIN 2     // Pin which is connected to the DHT sensor\n#define DHTTYPE DHT11   // DHT 11\n\nDHT dht(DHTPIN, DHTTYPE);\n\nvoid setup() {\n  Serial.begin(9600);\n  dht.begin();\n}\n\nvoid loop() {\n  float humidity = dht.readHumidity();\n  float temperature = dht.readTemperature();\n\n  Serial.print(\"Humidity: \");\n  Serial.print(humidity);\n  Serial.print(\" %\\t\");\n  Serial.print(\"Temperature: \");\n  Serial.print(temperature);\n  Serial.println(\" *C\");\n\n  delay(2000);\n}\n```\n\n### Blinking LED\n\n```cpp\nconst int ledPin = 13;\n\nvoid setup() {\n  pinMode(ledPin, OUTPUT);\n}\n\nvoid loop() {\n  digitalWrite(ledPin, HIGH);  // Turn the LED on\n  delay(1000);                 // Wait for 1 second\n  digitalWrite(ledPin, LOW);   // Turn the LED off\n  delay(1000);                 // Wait for 1 second\n}\n\n```\n\n### Read Button Input\n\n```cpp\nconst int buttonPin = 2;  // Pin where the push button is connected\nconst int ledPin = 13;    // Pin where the LED is connected\n\nvoid setup() {\n  pinMode(buttonPin, INPUT);  // Set the button pin as an input\n  pinMode(ledPin, OUTPUT);    // Set the LED pin as an output\n}\n\nvoid loop() {\n  int buttonState = digitalRead(buttonPin);  // Read the state of the button\n\n  if (buttonState == HIGH) {\n    digitalWrite(ledPin, HIGH);  // Turn the LED on\n  } else {\n    digitalWrite(ledPin, LOW);   // Turn the LED off\n  }\n}\n\n\n```\n\n### Analog Input\n\n```cpp\nconst int potPin = A0;    // Pin where the potentiometer is connected\nconst int ledPin = 9;     // Pin where the LED is connected\n\nvoid setup() {\n  pinMode(ledPin, OUTPUT);  // Set the LED pin as an output\n}\n\nvoid loop() {\n  int potValue = analogRead(potPin);  // Read the potentiometer value\n  int ledBrightness = map(potValue, 0, 1023, 0, 255);  // Map the value to a range from 0 to 255\n\n  analogWrite(ledPin, ledBrightness);  // Set the brightness of the LED\n  delay(10);  // Small delay to make the LED change smoothly\n}\n\n\n```\n\n### Serial Communication\n\n```cpp\nvoid setup() {\n  Serial.begin(9600);  // Start the serial communication at 9600 baud rate\n}\n\nvoid loop() {\n  Serial.println(\"Hello, world!\");  // Send a message to the serial monitor\n  delay(1000);  // Wait for 1 second\n}\n\n\n```\n\n### Temperature Sensor\n\n```cpp\nconst int tempPin = A0;  // Pin where the TMP36 sensor is connected\n\nvoid setup() {\n  Serial.begin(9600);  // Start the serial communication at 9600 baud rate\n}\n\nvoid loop() {\n  int tempValue = analogRead(tempPin);  // Read the sensor value\n  float voltage = tempValue * (5.0 / 1023.0);  // Convert the value to voltage\n  float temperatureC = (voltage - 0.5) * 100;  // Convert the voltage to temperature in Celsius\n\n  Serial.print(\"Temperature: \");\n  Serial.print(temperatureC);\n  Serial.println(\" C\");\n  delay(1000);  // Wait for 1 second\n}\n\n\n```\n\n### RGB LED Control\n\n```cpp\nconst int redPin = 9;\nconst int greenPin = 10;\nconst int bluePin = 11;\n\nconst int potRedPin = A0;\nconst int potGreenPin = A1;\nconst int potBluePin = A2;\n\nvoid setup() {\n  pinMode(redPin, OUTPUT);\n  pinMode(greenPin, OUTPUT);\n  pinMode(bluePin, OUTPUT);\n}\n\nvoid loop() {\n  int redValue = analogRead(potRedPin);\n  int greenValue = analogRead(potGreenPin);\n  int blueValue = analogRead(potBluePin);\n\n  analogWrite(redPin, map(redValue, 0, 1023, 0, 255));\n  analogWrite(greenPin, map(greenValue, 0, 1023, 0, 255));\n  analogWrite(bluePin, map(blueValue, 0, 1023, 0, 255));\n\n  delay(10);\n}\n\n```\n\n### Ultrasonic Sensor\n\n```cpp\nconst int trigPin = 9;\nconst int echoPin = 10;\n\nvoid setup() {\n  Serial.begin(9600);\n  pinMode(trigPin, OUTPUT);\n  pinMode(echoPin, INPUT);\n}\n\nvoid loop() {\n  long duration;\n  int distance;\n\n  digitalWrite(trigPin, LOW);\n  delayMicroseconds(2);\n  digitalWrite(trigPin, HIGH);\n  delayMicroseconds(10);\n  digitalWrite(trigPin, LOW);\n\n  duration = pulseIn(echoPin, HIGH);\n  distance = duration * 0.034 / 2;\n\n  Serial.print(\"Distance: \");\n  Serial.print(distance);\n  Serial.println(\" cm\");\n  delay(1000);\n}\n```\n\n### Controlling a Servo Motor\n\n```cpp\n#include <Servo.h>\n\nServo myServo;\nconst int potPin = A0;\n\nvoid setup() {\n  myServo.attach(9);  // Attach the servo to pin 9\n}\n\nvoid loop() {\n  int potValue = analogRead(potPin);  // Read the potentiometer value\n  int angle = map(potValue, 0, 1023, 0, 180);  // Map the value to an angle between 0 and 180\n\n  myServo.write(angle);  // Set the servo position\n  delay(15);  // Small delay for the servo to reach the position\n}\n\n```\n\n### Displaying Text on an LCD\n\n```cpp\n#include <LiquidCrystal.h>\n\n// Initialize the library with the numbers of the interface pins\nLiquidCrystal lcd(12, 11, 5, 4, 3, 2);\n\nvoid setup() {\n  // Set up the LCD's number of columns and rows\n  lcd.begin(16, 2);\n  // Print a message to the LCD\n  lcd.print(\"Hello, World!\");\n}\n\nvoid loop() {\n  // Set the cursor to column 0, line 1 (second row)\n  lcd.setCursor(0, 1);\n  // Print the number of seconds since reset\n  lcd.print(millis() / 1000);\n}\n```\n\n## Wireless Communication with NRF24L01\n\n### Transmitter Code\n\n```cpp\n#include <SPI.h>\n#include <nRF24L01.h>\n#include <RF24.h>\n\nRF24 radio(9, 10);  // CE, CSN pins\n\nconst byte address[6] = \"00001\";  // Address\n\nvoid setup() {\n  radio.begin();\n  radio.openWritingPipe(address);\n  radio.setPALevel(RF24_PA_MIN);\n  radio.stopListening();\n}\n\nvoid loop() {\n  const char text[] = \"Hello\";\n  radio.write(&text, sizeof(text));\n  delay(1000);\n}\n```\n\n### Receiver Code\n\n```cpp\n#include <SPI.h>\n#include <nRF24L01.h>\n#include <RF24.h>\n\nRF24 radio(9, 10);  // CE, CSN pins\n\nconst byte address[6] = \"00001\";  // Address\n\nvoid setup() {\n  Serial.begin(9600);\n  radio.begin();\n  radio.openReadingPipe(0, address);\n  radio.setPALevel(RF24_PA_MIN);\n  radio.startListening();\n}\n\nvoid loop() {\n  if (radio.available()) {\n    char text[32] = \"\";\n    radio.read(&text, sizeof(text));\n    Serial.println(text);\n  }\n}\n\n```\n\n## Also Read\n\n- [Ardunio](https://www.arduino.cc/en/software)\n"
  },
  {
    "path": "source/_posts/arduino.md",
    "content": "---\ntitle: Arduino IDE\ndate: 2022-11-23 16:23:31.697581\nbackground: bg-[#409096]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 12 keyboard shortcuts found in the Arduino IDE\n---\n\n## Keyboard Shortcuts\n\n### General\n\n| Shortcut           | Action                           |\n| ------------------ | -------------------------------- |\n| `Ctrl` `S`         | Save                             |\n| `Ctrl` `Shift` `S` | Save as                          |\n| `Ctrl` `N`         | Open a new sketch                |\n| `Ctrl` `O`         | Open an existing sketch          |\n| `Ctrl` `Q`         | Close the Arduino IDE            |\n| `Ctrl` `R`         | Verify                           |\n| `Ctrl` `U`         | Upload                           |\n| `Ctrl` `F`         | Find                             |\n| `Ctrl` `T`         | Adjust the alignment and spacing |\n| `Ctrl` `/`         | Comment                          |\n| `Ctrl` `Shift` `M` | Open the serial monitor          |\n| `Ctrl` `K`         | Open the sketch folder           |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for the Arduino IDE](https://progtpoint.blogspot.com/2017/02/arduino-keyboard-shortcuts.html)\n  _(progtpoint.blogspot.com)_\n"
  },
  {
    "path": "source/_posts/asana.md",
    "content": "---\ntitle: Asana\ndate: 2022-11-23 16:23:31.697445\nbackground: bg-[#e0726e]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 40 keyboard shortcuts found in Asana\n---\n\n## Keyboard Shortcuts\n\n### My Tasks\n\n| Shortcut  | Action                            |\n| --------- | --------------------------------- |\n| `Tab` `Y` | Mark as Today in your My Tasks    |\n| `Tab` `U` | Mark as Upcoming in your My Tasks |\n| `Tab` `L` | Mark as Later in your My Tasks    |\n\n{.shortcuts}\n\n### Inbox\n\n| Shortcut | Action              |\n| -------- | ------------------- |\n| `K/J`    | Move Up/Down        |\n| `H`      | Jump to Inbox tab   |\n| `S`      | Jump to Archive tab |\n| `F`      | Follow or Unfollow  |\n| `I`      | Archive             |\n| `U`      | Move to Inbox       |\n\n{.shortcuts}\n\n### Task Actions {.row-span-2}\n\n| Shortcut                 | Action                                        |\n| ------------------------ | --------------------------------------------- |\n| `Enter`                  | New Task                                      |\n| `Tab` `Backspace`        | Delete Selected Task(s)                       |\n| `Backspace`              | Delete current task (when task name is empty) |\n| `Ctrl` `Enter`           | Complete Selected Task(s)                     |\n| `Ctrl` `Up/Down`         | Move Up/Down                                  |\n| `Ctrl` `Shift` `Up/Down` | Jump Up/Down to the next Section              |\n| `Ctrl` `C`               | Copy Selected Tasks                           |\n| `Ctrl` `V`               | Paste Tasks (one per line)                    |\n| `Tab` `M`                | Assign to Me                                  |\n| `Tab` `H`                | Like a Selected Task                          |\n| `:`                      | Create a Section (at the end of a task name)  |\n\n{.shortcuts}\n\n### Navigation\n\n| Shortcut  | Action                                     |\n| --------- | ------------------------------------------ |\n| `Tab` `Z` | Navigate to My Tasks                       |\n| `Tab` `I` | Navigate to Inbox                          |\n| `Tab` `C` | Comment on Selected Task                   |\n| `Tab` `A` | Assign Selected Task                       |\n| `Tab` `D` | Set Due Date                               |\n| `Tab` `F` | Add Follower                               |\n| `Tab` `T` | Add a tag to the task                      |\n| `Tab` `S` | Focus Subtasks                             |\n| `Tab` `/` | Search for a project, tag, person, or task |\n\n{.shortcuts}\n\n### Selection\n\n| Shortcut          | Action                       |\n| ----------------- | ---------------------------- |\n| `Up/Down`         | Change Selection             |\n| `Shift` `(click)` | Select Range                 |\n| `Shift` `Up/Down` | Select Range                 |\n| `Ctrl` `(click)`  | Multi-select Individual Task |\n\n{.shortcuts}\n\n### Application\n\n| Shortcut      | Action                            |\n| ------------- | --------------------------------- |\n| `Ctrl` `/`    | Show Keyboard Shortcuts           |\n| `Tab`         | Expand the right pane             |\n| `Esc`         | Collapse the right pane           |\n| `Tab` `X`     | Enter Focus Mode                  |\n| `Tab` `Q`     | Quick Add                         |\n| `Tab` `Enter` | Post Comment (from comment field) |\n| `Tab` `B`     | What it sounds like               |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Asana](https://asana.com/guide/help/faq/shortcuts) _(asana.com)_\n"
  },
  {
    "path": "source/_posts/ascii-code.md",
    "content": "---\ntitle: ASCII Code\ndate: 2023-01-05 12:44:21\ntags:\n  - ASCII\n  - code\n  - Table\ncategories:\n  - Other\nintro: |\n  This cheatsheet is a complete list of ASCII Code Table with their numbers and names.\n---\n\n## ASCII Code Table {.cols-1}\n\n### ASCII Code Table\n\n| Symbol                             | Dec | Oct | Hex | Bin      |\n| ---------------------------------- | --- | --- | --- | -------- |\n| NUL (Null)                         | 0   | 0   | 0   | 0        |\n| SOH (Start of Heading)             | 1   | 1   | 1   | 1        |\n| STX (Start of Text)                | 2   | 2   | 2   | 10       |\n| ETX (End of Text)                  | 3   | 3   | 3   | 11       |\n| EOT (End of Transmission)          | 4   | 4   | 4   | 100      |\n| ENQ (Enquiry)                      | 5   | 5   | 5   | 101      |\n| ACK (Acknowledgment)               | 6   | 6   | 6   | 110      |\n| BEL (Bell)                         | 7   | 7   | 7   | 111      |\n| BS (Back Space)                    | 8   | 10  | 8   | 1000     |\n| HT (Horizontal Tab)                | 9   | 11  | 9   | 1001     |\n| LF (Line Feed)                     | 10  | 12  | 0A  | 1010     |\n| VT (Vertical Tab)                  | 11  | 13  | 0B  | 1011     |\n| FF (Form Feed)                     | 12  | 14  | 0C  | 1100     |\n| CR (Carriage Return)               | 13  | 15  | 0D  | 1101     |\n| SO (Shift Out / X-On)              | 14  | 16  | 0E  | 1110     |\n| SI (Shift In / X-Off)              | 15  | 17  | 0F  | 1111     |\n| DLE (Data Line Escape)             | 16  | 20  | 10  | 10000    |\n| DC1 (Device Control 1 / oft. XON)  | 17  | 21  | 11  | 10001    |\n| DC2 (Device Control 2)             | 18  | 22  | 12  | 10010    |\n| DC3 (Device Control 3 / oft. XOFF) | 19  | 23  | 13  | 10011    |\n| DC4 (Device Control 4)             | 20  | 24  | 14  | 10100    |\n| NAK (Negative Acknowledgement)     | 21  | 25  | 15  | 10101    |\n| SYN (Synchronous Idle)             | 22  | 26  | 16  | 10110    |\n| ETB (End of Transmit Block)        | 23  | 27  | 17  | 10111    |\n| CAN (Cancel)                       | 24  | 30  | 18  | 11000    |\n| EM (End of Medium)                 | 25  | 31  | 19  | 11001    |\n| SUB (Substitute)                   | 26  | 32  | 1A  | 11010    |\n| ESC (Escape)                       | 27  | 33  | 1B  | 11011    |\n| FS (File Separator)                | 28  | 34  | 1C  | 11100    |\n| GS (Group Separator)               | 29  | 35  | 1D  | 11101    |\n| RS (Record Separator)              | 30  | 36  | 1E  | 11110    |\n| US (Unit Separator)                | 31  | 37  | 1F  | 11111    |\n| (Space)                            | 32  | 40  | 20  | 100000   |\n| !                                  | 33  | 41  | 21  | 100001   |\n| \"                                  | 34  | 42  | 22  | 100010   |\n| #                                  | 35  | 43  | 23  | 100011   |\n| $                                  | 36  | 44  | 24  | 100100   |\n| %                                  | 37  | 45  | 25  | 100101   |\n| &amp;                              | 38  | 46  | 26  | 100110   |\n| '                                  | 39  | 47  | 27  | 100111   |\n| (                                  | 40  | 50  | 28  | 101000   |\n| )                                  | 41  | 51  | 29  | 101001   |\n| \\*                                 | 42  | 52  | 2A  | 101010   |\n| +                                  | 43  | 53  | 2B  | 101011   |\n| ,                                  | 44  | 54  | 2C  | 101100   |\n| -                                  | 45  | 55  | 2D  | 101101   |\n| .                                  | 46  | 56  | 2E  | 101110   |\n| /                                  | 47  | 57  | 2F  | 101111   |\n| 0                                  | 48  | 60  | 30  | 110000   |\n| 1                                  | 49  | 61  | 31  | 110001   |\n| 2                                  | 50  | 62  | 32  | 110010   |\n| 3                                  | 51  | 63  | 33  | 110011   |\n| 4                                  | 52  | 64  | 34  | 110100   |\n| 5                                  | 53  | 65  | 35  | 110101   |\n| 6                                  | 54  | 66  | 36  | 110110   |\n| 7                                  | 55  | 67  | 37  | 110111   |\n| 8                                  | 56  | 70  | 38  | 111000   |\n| 9                                  | 57  | 71  | 39  | 111001   |\n| :                                  | 58  | 72  | 3A  | 111010   |\n| ;                                  | 59  | 73  | 3B  | 111011   |\n| &lt;                               | 60  | 74  | 3C  | 111100   |\n| =                                  | 61  | 75  | 3D  | 111101   |\n| &gt;                               | 62  | 76  | 3E  | 111110   |\n| ?                                  | 63  | 77  | 3F  | 111111   |\n| @                                  | 64  | 100 | 40  | 1000000  |\n| A                                  | 65  | 101 | 41  | 1000001  |\n| B                                  | 66  | 102 | 42  | 1000010  |\n| C                                  | 67  | 103 | 43  | 1000011  |\n| D                                  | 68  | 104 | 44  | 1000100  |\n| E                                  | 69  | 105 | 45  | 1000101  |\n| F                                  | 70  | 106 | 46  | 1000110  |\n| G                                  | 71  | 107 | 47  | 1000111  |\n| H                                  | 72  | 110 | 48  | 1001000  |\n| I                                  | 73  | 111 | 49  | 1001001  |\n| J                                  | 74  | 112 | 4A  | 1001010  |\n| K                                  | 75  | 113 | 4B  | 1001011  |\n| L                                  | 76  | 114 | 4C  | 1001100  |\n| M                                  | 77  | 115 | 4D  | 1001101  |\n| N                                  | 78  | 116 | 4E  | 1001110  |\n| O                                  | 79  | 117 | 4F  | 1001111  |\n| P                                  | 80  | 120 | 50  | 1010000  |\n| Q                                  | 81  | 121 | 51  | 1010001  |\n| R                                  | 82  | 122 | 52  | 1010010  |\n| S                                  | 83  | 123 | 53  | 1010011  |\n| T                                  | 84  | 124 | 54  | 1010100  |\n| U                                  | 85  | 125 | 55  | 1010101  |\n| V                                  | 86  | 126 | 56  | 1010110  |\n| W                                  | 87  | 127 | 57  | 1010111  |\n| X                                  | 88  | 130 | 58  | 1011000  |\n| Y                                  | 89  | 131 | 59  | 1011001  |\n| Z                                  | 90  | 132 | 5A  | 1011010  |\n| [                                  | 91  | 133 | 5B  | 1011011  |\n| \\                                  | 92  | 134 | 5C  | 1011100  |\n| ]                                  | 93  | 135 | 5D  | 1011101  |\n| ^                                  | 94  | 136 | 5E  | 1011110  |\n| \\_                                 | 95  | 137 | 5F  | 1011111  |\n| <code>\\`</code>                    | 96  | 140 | 60  | 1100000  |\n| a                                  | 97  | 141 | 61  | 1100001  |\n| b                                  | 98  | 142 | 62  | 1100010  |\n| c                                  | 99  | 143 | 63  | 1100011  |\n| d                                  | 100 | 144 | 64  | 1100100  |\n| e                                  | 101 | 145 | 65  | 1100101  |\n| f                                  | 102 | 146 | 66  | 1100110  |\n| g                                  | 103 | 147 | 67  | 1100111  |\n| h                                  | 104 | 150 | 68  | 1101000  |\n| i                                  | 105 | 151 | 69  | 1101001  |\n| j                                  | 106 | 152 | 6A  | 1101010  |\n| k                                  | 107 | 153 | 6B  | 1101011  |\n| l                                  | 108 | 154 | 6C  | 1101100  |\n| m                                  | 109 | 155 | 6D  | 1101101  |\n| n                                  | 110 | 156 | 6E  | 1101110  |\n| o                                  | 111 | 157 | 6F  | 1101111  |\n| p                                  | 112 | 160 | 70  | 1110000  |\n| q                                  | 113 | 161 | 71  | 1110001  |\n| r                                  | 114 | 162 | 72  | 1110010  |\n| s                                  | 115 | 163 | 73  | 1110011  |\n| t                                  | 116 | 164 | 74  | 1110100  |\n| u                                  | 117 | 165 | 75  | 1110101  |\n| v                                  | 118 | 166 | 76  | 1110110  |\n| w                                  | 119 | 167 | 77  | 1110111  |\n| x                                  | 120 | 170 | 78  | 1111000  |\n| y                                  | 121 | 171 | 79  | 1111001  |\n| z                                  | 122 | 172 | 7A  | 1111010  |\n| {                                  | 123 | 173 | 7B  | 1111011  |\n|                                    | 124 | 174 | 7C  | 1111100  |\n| }                                  | 125 | 175 | 7D  | 1111101  |\n| ~                                  | 126 | 176 | 7E  | 1111110  |\n| (Delete)                           | 127 | 177 | 7F  | 1111111  |\n| €                                  | 128 | 200 | 80  | 10000000 |\n|                                    | 129 | 201 | 81  | 10000001 |\n| ‚                                  | 130 | 202 | 82  | 10000010 |\n| ƒ                                  | 131 | 203 | 83  | 10000011 |\n| „                                  | 132 | 204 | 84  | 10000100 |\n| …                                  | 133 | 205 | 85  | 10000101 |\n| †                                  | 134 | 206 | 86  | 10000110 |\n| ‡                                  | 135 | 207 | 87  | 10000111 |\n| ˆ                                  | 136 | 210 | 88  | 10001000 |\n| ‰                                  | 137 | 211 | 89  | 10001001 |\n| Š                                  | 138 | 212 | 8A  | 10001010 |\n| ‹                                  | 139 | 213 | 8B  | 10001011 |\n| Œ                                  | 140 | 214 | 8C  | 10001100 |\n|                                    | 141 | 215 | 8D  | 10001101 |\n| Ž                                  | 142 | 216 | 8E  | 10001110 |\n|                                    | 143 | 217 | 8F  | 10001111 |\n|                                    | 144 | 220 | 90  | 10010000 |\n| ‘                                  | 145 | 221 | 91  | 10010001 |\n| ’                                  | 146 | 222 | 92  | 10010010 |\n| “                                  | 147 | 223 | 93  | 10010011 |\n| ”                                  | 148 | 224 | 94  | 10010100 |\n| •                                  | 149 | 225 | 95  | 10010101 |\n| –                                  | 150 | 226 | 96  | 10010110 |\n| —                                  | 151 | 227 | 97  | 10010111 |\n| ˜                                  | 152 | 230 | 98  | 10011000 |\n| ™                                 | 153 | 231 | 99  | 10011001 |\n| š                                  | 154 | 232 | 9A  | 10011010 |\n| ›                                  | 155 | 233 | 9B  | 10011011 |\n| œ                                  | 156 | 234 | 9C  | 10011100 |\n|                                    | 157 | 235 | 9D  | 10011101 |\n| ž                                  | 158 | 236 | 9E  | 10011110 |\n| Ÿ                                  | 159 | 237 | 9F  | 10011111 |\n| (Non-breaking space)               | 160 | 240 | A0  | 10100000 |\n| ¡                                  | 161 | 241 | A1  | 10100001 |\n| ¢                                  | 162 | 242 | A2  | 10100010 |\n| £                                  | 163 | 243 | A3  | 10100011 |\n| ¤                                  | 164 | 244 | A4  | 10100100 |\n| ¥                                  | 165 | 245 | A5  | 10100101 |\n| ¦                                  | 166 | 246 | A6  | 10100110 |\n| §                                  | 167 | 247 | A7  | 10100111 |\n| ¨                                  | 168 | 250 | A8  | 10101000 |\n| ©                                 | 169 | 251 | A9  | 10101001 |\n| ª                                  | 170 | 252 | AA  | 10101010 |\n| «                                  | 171 | 253 | AB  | 10101011 |\n| ¬                                  | 172 | 254 | AC  | 10101100 |\n| (Soft hyphen)                      | 173 | 255 | AD  | 10101101 |\n| ®                                 | 174 | 256 | AE  | 10101110 |\n| ¯                                  | 175 | 257 | AF  | 10101111 |\n| °                                  | 176 | 260 | B0  | 10110000 |\n| ±                                  | 177 | 261 | B1  | 10110001 |\n| ²                                  | 178 | 262 | B2  | 10110010 |\n| ³                                  | 179 | 263 | B3  | 10110011 |\n| ´                                  | 180 | 264 | B4  | 10110100 |\n| µ                                  | 181 | 265 | B5  | 10110101 |\n| ¶                                  | 182 | 266 | B6  | 10110110 |\n| ·                                  | 183 | 267 | B7  | 10110111 |\n| ¸                                  | 184 | 270 | B8  | 10111000 |\n| ¹                                  | 185 | 271 | B9  | 10111001 |\n| º                                  | 186 | 272 | BA  | 10111010 |\n| »                                  | 187 | 273 | BB  | 10111011 |\n| ¼                                  | 188 | 274 | BC  | 10111100 |\n| ½                                  | 189 | 275 | BD  | 10111101 |\n| ¾                                  | 190 | 276 | BE  | 10111110 |\n| ¿                                  | 191 | 277 | BF  | 10111111 |\n| À                                  | 192 | 300 | C0  | 11000000 |\n| Á                                  | 193 | 301 | C1  | 11000001 |\n| Â                                  | 194 | 302 | C2  | 11000010 |\n| Ã                                  | 195 | 303 | C3  | 11000011 |\n| Ä                                  | 196 | 304 | C4  | 11000100 |\n| Å                                  | 197 | 305 | C5  | 11000101 |\n| Æ                                  | 198 | 306 | C6  | 11000110 |\n| Ç                                  | 199 | 307 | C7  | 11000111 |\n| È                                  | 200 | 310 | C8  | 11001000 |\n| É                                  | 201 | 311 | C9  | 11001001 |\n| Ê                                  | 202 | 312 | CA  | 11001010 |\n| Ë                                  | 203 | 313 | CB  | 11001011 |\n| Ì                                  | 204 | 314 | CC  | 11001100 |\n| Í                                  | 205 | 315 | CD  | 11001101 |\n| Î                                  | 206 | 316 | CE  | 11001110 |\n| Ï                                  | 207 | 317 | CF  | 11001111 |\n| Ð                                  | 208 | 320 | D0  | 11010000 |\n| Ñ                                  | 209 | 321 | D1  | 11010001 |\n| Ò                                  | 210 | 322 | D2  | 11010010 |\n| Ó                                  | 211 | 323 | D3  | 11010011 |\n| Ô                                  | 212 | 324 | D4  | 11010100 |\n| Õ                                  | 213 | 325 | D5  | 11010101 |\n| Ö                                  | 214 | 326 | D6  | 11010110 |\n| ×                                  | 215 | 327 | D7  | 11010111 |\n| Ø                                  | 216 | 330 | D8  | 11011000 |\n| Ù                                  | 217 | 331 | D9  | 11011001 |\n| Ú                                  | 218 | 332 | DA  | 11011010 |\n| Û                                  | 219 | 333 | DB  | 11011011 |\n| Ü                                  | 220 | 334 | DC  | 11011100 |\n| Ý                                  | 221 | 335 | DD  | 11011101 |\n| Þ                                  | 222 | 336 | DE  | 11011110 |\n| ß                                  | 223 | 337 | DF  | 11011111 |\n| à                                  | 224 | 340 | E0  | 11100000 |\n| á                                  | 225 | 341 | E1  | 11100001 |\n| â                                  | 226 | 342 | E2  | 11100010 |\n| ã                                  | 227 | 343 | E3  | 11100011 |\n| ä                                  | 228 | 344 | E4  | 11100100 |\n| å                                  | 229 | 345 | E5  | 11100101 |\n| æ                                  | 230 | 346 | E6  | 11100110 |\n| ç                                  | 231 | 347 | E7  | 11100111 |\n| è                                  | 232 | 350 | E8  | 11101000 |\n| é                                  | 233 | 351 | E9  | 11101001 |\n| ê                                  | 234 | 352 | EA  | 11101010 |\n| ë                                  | 235 | 353 | EB  | 11101011 |\n| ì                                  | 236 | 354 | EC  | 11101100 |\n| í                                  | 237 | 355 | ED  | 11101101 |\n| î                                  | 238 | 356 | EE  | 11101110 |\n| ï                                  | 239 | 357 | EF  | 11101111 |\n| ð                                  | 240 | 360 | F0  | 11110000 |\n| ñ                                  | 241 | 361 | F1  | 11110001 |\n| ò                                  | 242 | 362 | F2  | 11110010 |\n| ó                                  | 243 | 363 | F3  | 11110011 |\n| ô                                  | 244 | 364 | F4  | 11110100 |\n| õ                                  | 245 | 365 | F5  | 11110101 |\n| ö                                  | 246 | 366 | F6  | 11110110 |\n| ÷                                  | 247 | 367 | F7  | 11110111 |\n| ø                                  | 248 | 370 | F8  | 11111000 |\n| ù                                  | 249 | 371 | F9  | 11111001 |\n| ú                                  | 250 | 372 | FA  | 11111010 |\n| û                                  | 251 | 373 | FB  | 11111011 |\n| ü                                  | 252 | 374 | FC  | 11111100 |\n| ý                                  | 253 | 375 | FD  | 11111101 |\n| þ                                  | 254 | 376 | FE  | 11111110 |\n| ÿ                                  | 255 | 377 | FF  | 11111111 |\n\n{.show-header}\n"
  },
  {
    "path": "source/_posts/aspect-ratio.md",
    "content": "---\ntitle: Aspect Ratio\ndate: 2022-09-21 10:28:43\nbackground: bg-indigo-600\ntags:\n  - photo\n  - image\n  - aspect\n  - ratio\n  - resolutions\ncategories:\n  - Other\nintro: |\n  This cheat sheet lists some common aspect ratios and their pixel resolutions. Always confirm your final delivery ratio when shooting.\n---\n\n## Getting Started {.cols-2}\n\n### Introduction\n\n- The aspect ratio is the ratio between the width and height of the screen or image\n- It's usually written as two numbers separated by a colon or \"x\", ex: 16:9 or 16x9\n- Which is interpreted as W pixels in width for every H pixel in height.\n- Resolution is the number of pixels (individual points of color)\n\n{.marker-round}\n\n### Multi-format of Aspect Ratio\n\n- [Markdown Table](https://tableconvert.com/html-to-markdown?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [Template](https://tableconvert.com/html-to-template?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [LaTeX Table](https://tableconvert.com/html-to-latex?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [CSV](https://tableconvert.com/html-to-csv?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [Excel](https://tableconvert.com/html-to-excel?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [JSON Array](https://tableconvert.com/html-to-json?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [HTML Table](https://tableconvert.com/html-to-html?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [Insert SQL](https://tableconvert.com/html-to-sql?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [YAML Sequence](https://tableconvert.com/html-to-yaml?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [XML](https://tableconvert.com/html-to-xml?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [ASCII](https://tableconvert.com/html-to-ascii?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [MediaWiki Table](https://tableconvert.com/html-to-mediawiki?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [AsciiDoc Table](https://tableconvert.com/html-to-asciidoc?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [Jira Table](https://tableconvert.com/html-to-jira?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [Textile Table](https://tableconvert.com/html-to-textile?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [reStructuredText](https://tableconvert.com/html-to-restructuredtext?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [PHP Array](https://tableconvert.com/html-to-php?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [Ruby Array](https://tableconvert.com/html-to-ruby?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [ASP Array](https://tableconvert.com/html-to-asp?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [ActionScript](https://tableconvert.com/html-to-actionscript?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [BBCode](https://tableconvert.com/html-to-bbcode?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [PDF](https://tableconvert.com/html-to-pdf?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n- [JPEG](https://tableconvert.com/html-to-jpeg?data=https://cheatsheets.zip/aspect-ratio#TableGenerator)\n\n{.cols-4 .marker-none}\n\n## Lists of Aspect Ratios\n\n### 1080p {.row-span-2}\n\n| Aspect Ratio | Resolution  |\n| ------------ | ----------- |\n| 0.80 (4:5)   | 864 x 1080  |\n| 1.25 (5:4)   | 1350 x 1080 |\n| 1.33 (4:3)   | 1440 x 1080 |\n| 1.66 (5:3)   | 1800 x 1080 |\n| 1.78 (16:9)  | 1920 x 1080 |\n| 1.85         | 1920 x 1038 |\n| 1.90         | 1920 x 1011 |\n| 2.00         | 1920 x 960  |\n| 2.35         | 1920 x 817  |\n| 2.37         | 1920 x 810  |\n| 2.39         | 1920 x 803  |\n| 2.40         | 1920 x 800  |\n| 2.44         | 1920 x 787  |\n\n{.show-header}\n\n### 720p {.row-span-2}\n\n| Aspect Ratio | Resolution |\n| ------------ | ---------- |\n| 0.80 (4:5)   | 576 x 720  |\n| 1.25 (5:4)   | 900 x 720  |\n| 1.33 (4:3)   | 960 x 720  |\n| 1.66 (5:3)   | 1200 x 720 |\n| 1.78 (16:9)  | 1280 x 720 |\n| 1.85         | 1280 x 692 |\n| 1.90         | 1280 x 674 |\n| 2.00         | 1280 x 640 |\n| 2.35         | 1280 x 545 |\n| 2.37         | 1280 x 540 |\n| 2.39         | 1280 x 536 |\n| 2.40         | 1280 x 533 |\n| 2.44         | 1280 x 525 |\n\n{.show-header}\n\n### Cinema DCP 4K\n\n| Aspect Ratio          | Resolution  |\n| --------------------- | ----------- |\n| Flat (1.85)           | 3996 x 2160 |\n| Scope (2.39)          | 4096 x 1716 |\n| Full Container (1.90) | 4096 x 2160 |\n\n{.show-header}\n\n### Cinema DCP 2K\n\n| Aspect Ratio          | Resolution  |\n| --------------------- | ----------- |\n| Flat (1.85)           | 1998 x 1080 |\n| Scope (2.39)          | 2048 x 858  |\n| Full Container (1.90) | 2048 x 1080 |\n\n{.show-header}\n\n### 8K\n\n| Aspect Ratio | Resolution  |\n| ------------ | ----------- |\n| 0.80 (4:5)   | 3686 x 4608 |\n| 1.25 (5:4)   | 5760 x 4608 |\n| 1.33 (4:3)   | 6144 x 4608 |\n| 1.66 (5:3)   | 7680 x 4608 |\n| 1.78 (16:9)  | 8192 x 4608 |\n| 1.85         | 8192 x 4428 |\n| 1.90         | 8192 x 4320 |\n| 2.00         | 8192 x 4096 |\n| 2.35         | 8192 x 3486 |\n| 2.37         | 8192 x 3456 |\n| 2.39         | 8192 x 3428 |\n| 2.40         | 8192 x 3413 |\n| 2.44         | 8192 x 3357 |\n\n{.show-header}\n\n### 6K\n\n| Aspect Ratio | Resolution  |\n| ------------ | ----------- |\n| 0.80 (4:5)   | 2765 x 3456 |\n| 1.25 (5:4)   | 4320 x 3456 |\n| 1.33 (4:3)   | 4608 x 3456 |\n| 1.66 (5:3)   | 5760 x 3456 |\n| 1.78 (16:9)  | 6144 x 3456 |\n| 1.85         | 6144 x 3321 |\n| 1.90         | 6144 x 3234 |\n| 2.00         | 6144 x 3072 |\n| 2.35         | 6144 x 2614 |\n| 2.37         | 6144 x 2592 |\n| 2.39         | 6144 x 2571 |\n| 2.40         | 6144 x 2560 |\n| 2.44         | 6144 x 2518 |\n\n{.show-header}\n\n### 4K\n\n| Aspect Ratio | Resolution  |\n| ------------ | ----------- |\n| 0.80 (4:5)   | 2765 x 3456 |\n| 1.25 (5:4)   | 4320 x 3456 |\n| 1.33 (4:3)   | 4608 x 3456 |\n| 1.66 (5:3)   | 5760 x 3456 |\n| 1.78 (16:9)  | 6144 x 3456 |\n| 1.85         | 6144 x 3321 |\n| 1.90         | 6144 x 3234 |\n| 2.00         | 6144 x 3072 |\n| 2.35         | 6144 x 2614 |\n| 2.37         | 6144 x 2592 |\n| 2.39         | 6144 x 2571 |\n| 2.40         | 6144 x 2560 |\n| 2.44         | 6144 x 2518 |\n\n{.show-header}\n\n### 3K\n\n| Aspect Ratio | Resolution  |\n| ------------ | ----------- |\n| 0.80 (4:5)   | 1382 x 1728 |\n| 1.25 (5:4)   | 2160 x 1728 |\n| 1.33 (4:3)   | 2304 x 1728 |\n| 1.66 (5:3)   | 2880 x 1728 |\n| 1.78 (16:9)  | 3072 x 1728 |\n| 1.85         | 3072 x 1661 |\n| 1.90         | 3072 x 1620 |\n| 2.00         | 3072 x 1536 |\n| 2.35         | 3072 x 1307 |\n| 2.37         | 3072 x 1296 |\n| 2.39         | 3072 x 1285 |\n| 2.40         | 3072 x 1280 |\n| 2.44         | 3072 x 1259 |\n\n{.show-header}\n\n### 2K\n\n| Aspect Ratio | Resolution  |\n| ------------ | ----------- |\n| 0.80 (4:5)   | 922 x 1152  |\n| 1.25 (5:4)   | 1440 x 1152 |\n| 1.33 (4:3)   | 1536 x 1152 |\n| 1.66 (5:3)   | 1920 x 1152 |\n| 1.78 (16:9)  | 2048 x 1152 |\n| 1.85         | 2048 x 1107 |\n| 1.90         | 2048 x 1078 |\n| 2.00         | 2048 x 1024 |\n| 2.35         | 2048 x 871  |\n| 2.37         | 2048 x 864  |\n| 2.39         | 2048 x 858  |\n| 2.40         | 2048 x 853  |\n| 2.44         | 2048 x 838  |\n\n{.show-header}\n\n### 8K UHD\n\n| Aspect Ratio | Resolution  |\n| ------------ | ----------- |\n| 0.80 (4:5)   | 2765 x 3456 |\n| 1.25 (5:4)   | 5400 x 3456 |\n| 1.33 (4:3)   | 5760 x 3456 |\n| 1.66 (5:3)   | 7200 x 3456 |\n| 1.78 (16:9)  | 7680 x 4320 |\n| 1.85         | 7680 x 4151 |\n| 1.90         | 7680 x 4042 |\n| 2.00         | 7680 x 3840 |\n| 2.35         | 7680 x 3268 |\n| 2.37         | 7680 x 3240 |\n| 2.39         | 7680 x 3213 |\n| 2.40         | 7680 x 3200 |\n| 2.44         | 7680 x 3148 |\n\n{.show-header}\n\n### 5K\n\n| Aspect Ratio | Resolution  |\n| ------------ | ----------- |\n| 0.80 (4:5)   | 2304 x 2880 |\n| 1.25 (5:4)   | 3600 x 2880 |\n| 1.33 (4:3)   | 3840 x 2880 |\n| 1.66 (5:3)   | 4800 x 2880 |\n| 1.78 (16:9)  | 5120 x 2880 |\n| 1.85         | 5120 x 2768 |\n| 1.90         | 5120 x 2700 |\n| 2.00         | 5120 x 2560 |\n| 2.35         | 5120 x 2179 |\n| 2.37         | 5120 x 2160 |\n| 2.39         | 5120 x 2142 |\n| 2.40         | 5120 x 2133 |\n| 2.44         | 5120 x 2098 |\n\n{.show-header}\n\n### 4K UHD\n\n| Aspect Ratio | Resolution  |\n| ------------ | ----------- |\n| 0.80 (4:5)   | 1728 x 2160 |\n| 1.25 (5:4)   | 2700 x 2160 |\n| 1.33 (4:3)   | 2880 x 2160 |\n| 1.66 (5:3)   | 3600 x 2160 |\n| 1.78 (16:9)  | 3840 x 2160 |\n| 1.85         | 3840 x 2076 |\n| 1.90         | 3840 x 2021 |\n| 2.00         | 3840 x 1920 |\n| 2.35         | 3840 x 1634 |\n| 2.37         | 3840 x 1620 |\n| 2.39         | 3840 x 1607 |\n| 2.40         | 3840 x 1600 |\n| 2.44         | 3840 x 1574 |\n\n{.show-header}\n\n### 3K UHD\n\n| Aspect Ratio | Resolution  |\n| ------------ | ----------- |\n| 0.80 (4:5)   | 1296 x 1620 |\n| 1.25 (5:4)   | 2025 x 1620 |\n| 1.33 (4:3)   | 2160 x 1620 |\n| 1.66 (5:3)   | 2700 x 1620 |\n| 1.78 (16:9)  | 2880 x 1620 |\n| 1.85         | 2880 x 1557 |\n| 1.90         | 2880 x 1516 |\n| 2.00         | 2880 x 1440 |\n| 2.35         | 2880 x 1226 |\n| 2.37         | 2880 x 1215 |\n| 2.39         | 2880 x 1205 |\n| 2.40         | 2880 x 1200 |\n| 2.44         | 2880 x 1180 |\n\n{.show-header}\n"
  },
  {
    "path": "source/_posts/audacity.md",
    "content": "---\ntitle: Audacity\ndate: 2022-11-23 16:23:31.701833\nbackground: bg-[#0000e1]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 135 default keyboard shortcuts found in Audacity\n---\n\n## Keyboard Shortcuts\n\n### File Menu\n\n| Shortcut           | Action          |\n| ------------------ | --------------- |\n| `Ctrl` `N`         | New             |\n| `Ctrl` `O`         | Open            |\n| `Ctrl` `W`         | Close           |\n| `Ctrl` `Q`         | Exit            |\n| `Ctrl` `S`         | Save project    |\n| `Ctrl` `Shift` `E` | Export audio    |\n| `Ctrl` `Shift` `L` | Export multiple |\n| `Ctrl` `Shift` `I` | Import audio    |\n\n{.shortcuts}\n\n### Edit Menu\n\n| Shortcut           | Action                           |\n| ------------------ | -------------------------------- |\n| `Ctrl` `Z`         | Undo                             |\n| `Ctrl` `Y`         | Redo                             |\n| `Ctrl` `X`         | Cut                              |\n| `Ctrl` `K`         | Delete                           |\n| `Ctrl` `C`         | Copy                             |\n| `Ctrl` `V`         | Paste                            |\n| `Ctrl` `D`         | Duplicate                        |\n| `Ctrl` `P`         | Preferences                      |\n| `Ctrl` `Alt` `X`   | Split cut                        |\n| `Ctrl` `Alt` `K`   | Split delete                     |\n| `Ctrl` `L`         | Silence audio                    |\n| `Ctrl` `T`         | Trim audio                       |\n| `Ctrl` `Alt` `I`   | Split new                        |\n| `Ctrl` `J`         | Join                             |\n| `Ctrl` `Shift` `J` | Detach at silences               |\n| `Ctrl` `B`         | Add label at selection           |\n| `Ctrl` `M`         | Add label at playback position   |\n| `Ctrl` `Alt` `V`   | Paste text to new label          |\n| `Alt` `X`          | Cut labeled audio                |\n| `Alt` `K`          | Delete labeled audio             |\n| `Alt` `Shift` `X`  | Split cut labeled audio          |\n| `Alt` `Shift` `K`  | Split delete labeled audio       |\n| `Alt` `L`          | Silence labeled audio            |\n| `Alt` `Shift` `C`  | Copy labeled audio               |\n| `Alt` `I`          | Split labeled audio              |\n| `Alt` `J`          | Join labeled audio               |\n| `Alt` `Shift` `J`  | Detach labeled audio at silences |\n\n{.shortcuts}\n\n### Extra Menu {.row-span-4}\n\n| Shortcut               | Action                                 |\n| ---------------------- | -------------------------------------- |\n| `F11`                  | Toggle full screen                     |\n| `1`                    | Play one second                        |\n| `B`                    | Play to selection                      |\n| `Shift` `F5`           | Play before selection start            |\n| `Shift` `F6`           | Play after selection start             |\n| `Shift` `F7`           | Play before selection end              |\n| `Shift` `F8`           | Play after selection end               |\n| `Ctrl` `Shift` `F5`    | Play before and after selection start  |\n| `Ctrl` `Shift` `F7`    | Play before and after selection end    |\n| `C`                    | Play cut preview                       |\n| `F1`                   | Selection tool                         |\n| `F2`                   | Envelope tool                          |\n| `F3`                   | Draw tool                              |\n| `F4`                   | Zoom tool                              |\n| `F5`                   | Time shift tool                        |\n| `F6`                   | Multi tool                             |\n| `A`                    | Previous tool                          |\n| `D`                    | Next tool                              |\n| `Backspace`            | Delete                                 |\n| `Alt` `Left`           | Move to previous label                 |\n| `Alt` `Right`          | Move to next label                     |\n| `Left`                 | Short seek left during playback        |\n| `Right`                | Short seek right during playback       |\n| `Shift` `Left`         | Long seek left during playback         |\n| `Shift` `Right`        | Long seek right during playback        |\n| `Shift` `I`            | Change recording device                |\n| `Shift` `O`            | Change playback device                 |\n| `Shift` `H`            | Change audio host                      |\n| `Shift` `N`            | Change recording channels              |\n| `Shift` `Home`         | Selection to start                     |\n| `Shift` `End`          | Selection to end                       |\n| `Shift` `Left`         | Selection extend left                  |\n| `Shift` `Right`        | Selection extend right                 |\n| `Ctrl` `Shift` `Right` | Selection contract left                |\n| `Ctrl` `Shift` `Left`  | Selection contract right               |\n| `Ctrl` `Shift` `F6`    | Move backwards from toolbars to tracks |\n| `Ctrl` `F6`            | Move forward from toolbars to tracks   |\n| `Up`                   | Move focus to previous track           |\n| `Down`                 | Move focus to next track               |\n| `Ctrl` `Home`          | Move focus to first track              |\n| `Ctrl` `End`           | Move focus to last track               |\n| `Shift` `Up`           | Move focus to previous and select      |\n| `Shift` `Down`         | Move focus to next and select          |\n| `Enter`                | Toggle focused track                   |\n| `Left`                 | Cursor left                            |\n| `Right`                | Cursor right                           |\n| `,`                    | Cursor short jump left                 |\n| `.`                    | Cursor short jump right                |\n| `Shift` `,`            | Cursor long jump left                  |\n| `Shift` `.`            | Cursor long jump right                 |\n| `Shift` `P`            | Change pan on focused track            |\n| `Alt` `Shift` `Left`   | Pan left on focused track              |\n| `Alt` `Shift` `Right`  | Pan right on focused track             |\n| `Shift` `G`            | Change gain on focused track           |\n| `Alt` `Shift` `Up`     | Increase gain on focused track         |\n| `Alt` `Shift` `Down`   | Decrease gain on focused track         |\n| `Shift` `U`            | Mute or unmute focused track           |\n| `Shift` `S`            | Solo or unsolo focused track           |\n| `Shift` `C`            | Close focused track                    |\n\n{.shortcuts}\n\n### Select Menu\n\n| Shortcut           | Action                           |\n| ------------------ | -------------------------------- |\n| `Ctrl` `A`         | Select all                       |\n| `Ctrl` `Shift` `A` | Select none                      |\n| `Z`                | Select at zero crossings         |\n| `Ctrl` `Shift` `K` | Select in all tracks             |\n| `Ctrl` `Shift` `Y` | Select in all sync-locked tracks |\n| `[`                | Left at playback position        |\n| `]`                | Right at playback position       |\n| `Shift` `J`        | Track start to cursor            |\n| `Shift` `K`        | Cursor to track end              |\n| `Q`                | Toggle spectral selection        |\n| `Ctrl` `Alt` `P`   | Previous clip                    |\n| `Ctrl` `Alt` `N`   | Next clip                        |\n\n{.shortcuts}\n\n### View Menu\n\n| Shortcut           | Action                  |\n| ------------------ | ----------------------- |\n| `Ctrl` `1`         | Zoom in                 |\n| `Ctrl` `2`         | Zoom normal             |\n| `Ctrl` `3`         | Zoom out                |\n| `Ctrl` `E`         | Zoom to selection       |\n| `Shift` `Z`        | Zoom toggle             |\n| `Ctrl` `F`         | Fit to width            |\n| `Ctrl` `Shift` `F` | Fit to height           |\n| `Ctrl` `Shift` `C` | Collapse all tracks     |\n| `Ctrl` `Shift` `X` | Expand collapsed tracks |\n| `Ctrl` `[`         | Skip to selection start |\n| `Ctrl` `]`         | Skip to selection end   |\n\n{.shortcuts}\n\n### Transport Menu\n\n| Shortcut        | Action                      |\n| --------------- | --------------------------- |\n| `Space`         | Play or stop                |\n| `X`             | Play or stop and set cursor |\n| `Shift` `Space` | Loop play                   |\n| `P`             | Pause                       |\n| `R`             | Record                      |\n| `Shift` `R`     | Record new track            |\n| `Shift` `T`     | Timer record...             |\n| `Shift` `D`     | Punch and roll record       |\n| `P`             | Pause                       |\n| `J`             | Cursor to track start       |\n| `K`             | Cursor to track end         |\n| `Home`          | Cursor to project start     |\n| `End`           | Cursor to project end       |\n\n{.shortcuts}\n\n### Tracks Menu\n\n| Shortcut           | Action                      |\n| ------------------ | --------------------------- |\n| `Ctrl` `Shift` `N` | Add new mono track          |\n| `Ctrl` `Shift` `M` | Mix and render to new track |\n| `Ctrl` `U`         | Mute all tracks             |\n| `Ctrl` `Shift` `U` | Unmute all tracks           |\n\n{.shortcuts}\n\n### Effect Menu\n\n| Shortcut   | Action             |\n| ---------- | ------------------ |\n| `Ctrl` `R` | Repeat last effect |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Audacity](https://manual.audacityteam.org/man/keyboard_shortcut_reference.html)\n  _(manual.audacityteam.org)_\n"
  },
  {
    "path": "source/_posts/awk.md",
    "content": "---\ntitle: Awk\ndate: 2020-12-31 15:18:34\nbackground: bg-slate-600\ntags:\n  - bash\n  - text\n  - script\ncategories:\n  - Linux Command\nintro: |\n  This is a one page quick reference cheat sheet to the [GNU awk](https://www.gnu.org/software/gawk/manual/gawk.html), which covers commonly used awk expressions and commands.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Have a try\n\n```shell script {.wrap}\n$ awk -F: '{print $1, $NF}' /etc/passwd\n```\n\n---\n\n| -             | -                         |\n| ------------- | ------------------------- |\n| `-F:`         | Colon as a separator      |\n| `{...}`       | Awk program               |\n| `print`       | Prints the current record |\n| `$1`          | First field               |\n| `$NF`         | Last field                |\n| `/etc/passwd` | Input data file           |\n\n{.left-text}\n\n### Awk program\n\n```\nBEGIN          {<initializations>}\n   <pattern 1> {<program actions>}\n   <pattern 2> {<program actions>}\n   ...\nEND            {< final actions >}\n```\n\n#### Example\n\n```\nawk '\n    BEGIN { print \"\\n>>>Start\" }\n    !/(login|shutdown)/ { print NR, $0 }\n    END { print \"<<<END\\n\" }\n' /etc/passwd\n```\n\n### Variables {.row-span-2}\n\n```bash\n          $1      $2/$(NF-1)    $3/$NF\n           ▼          ▼           ▼\n        ┌──────┬──────────────────┬───────┐\n$0/NR ▶ │  ID  │  WEBSITE         │  URI  │\n        ├──────┼──────────────────┼───────┤\n$0/NR ▶ │  1   │  cheatsheets.zip │  awk  │\n        ├──────┼──────────────────┼───────┤\n$0/NR ▶ │  2   │  google.com      │  25   │\n        └──────┴──────────────────┴───────┘\n```\n\n---\n\n```\n# First and last field\nawk -F: '{print $1,$NF}' /etc/passwd\n\n# With line number\nawk -F: '{print NR, $0}' /etc/passwd\n\n# Second last field\nawk -F: '{print $(NF-1)}' /etc/passwd\n\n# Custom string\nawk -F: '{print $1 \"=\" $6}' /etc/passwd\n```\n\nSee: [Variables](#awk-variables)\n\n### Awk program examples {.col-span-2 .row-span-2}\n\n```\nawk 'BEGIN {print \"hello world\"}'        # Prints \"hello world\"\nawk -F: '{print $1}' /etc/passwd         # -F: Specify field separator\n\n# /pattern/ Execute actions only for matched pattern\nawk -F: '/root/ {print $1}' /etc/passwd\n\n# BEGIN block is executed once at the start\nawk -F: 'BEGIN { print \"uid\"} { print $1 }' /etc/passwd\n\n# END block is executed once at the end\nawk -F: '{print $1} END { print \"-done-\"}' /etc/passwd\n```\n\n### Conditions\n\n```\nawk -F: '$3>30 {print $1}' /etc/passwd\n```\n\nSee: [Conditions](#awk-conditions)\n\n### Generate 1000 spaces\n\n```\nawk 'BEGIN{\n    while (a++ < 1000)\n        s=s \" \";\n    print s\n}'\n```\n\nSee: [Loops](#awk-loops)\n\n### Arrays\n\n```\nawk 'BEGIN {\n   fruits[\"mango\"] = \"yellow\";\n   fruits[\"orange\"] = \"orange\"\n   for(fruit in fruits) {\n     print \"The color of \" fruit \" is \" fruits[fruit]\n   }\n}'\n```\n\nSee: [Arrays](#awk-arrays)\n\n### Functions\n\n```\n# => 5\nawk 'BEGIN{print length(\"hello\")}'\n# => HELLO\nawk 'BEGIN{print toupper(\"hello\")}'\n# => hel\nawk 'BEGIN{print substr(\"hello\", 1, 3)}'\n```\n\nSee: [Functions](#awk-functions)\n\n## Awk Variables\n\n### Build-in variables\n\n| -              | -                                                   |\n| -------------- | --------------------------------------------------- |\n| `$0`           | Whole line                                          |\n| `$1, $2...$NF` | First, second… last field                           |\n| `NR`           | `N`umber of `R`ecords                               |\n| `NF`           | `N`umber of `F`ields                                |\n| `OFS`          | `O`utput `F`ield `S`eparator <br> _(default \" \")_   |\n| `FS`           | input `F`ield `S`eparator <br> _(default \" \")_      |\n| `ORS`          | `O`utput `R`ecord `S`eparator <br> _(default \"\\n\")_ |\n| `RS`           | input `R`ecord `S`eparator <br> _(default \"\\n\")_    |\n| `FILENAME`     | Name of the file                                    |\n\n### Expressions\n\n| -                   | -                                  |\n| ------------------- | ---------------------------------- |\n| `$1 == \"root\"`      | First field equals root            |\n| `{print $(NF-1)}`   | Second last field                  |\n| `NR!=1{print $0}`   | From 2nd record                    |\n| `NR > 3`            | From 4th record                    |\n| `NR == 1`           | First record                       |\n| `END{print NR}`     | Total records                      |\n| `BEGIN{print OFMT}` | Output format                      |\n| `{print NR, $0}`    | Line number                        |\n| `{print NR \"\t\" $0}`  | Line number (tab)                  |\n| `{$1 = NR; print}`  | Replace 1st field with line number |\n| `$NF > 4`           | Last field > 4                     |\n| `NR % 2 == 0`       | Even records                       |\n| `NR==10, NR==20`    | Records 10 to 20                   |\n| `BEGIN{print ARGC}` | Total arguments                    |\n| `ORS=NR%5?\",\":\"\\n\"` | Concatenate records                |\n\n### Examples\n\nPrint sum and average\n\n```\nawk -F: '{sum += $3}\n     END { print sum, sum/NR }\n' /etc/passwd\n```\n\nPrinting parameters\n\n```\nawk 'BEGIN {\n    for (i = 1; i < ARGC; i++)\n        print ARGV[i] }' a b c\n```\n\nOutput field separator as a comma\n\n```\nawk 'BEGIN { FS=\":\";OFS=\",\"}\n    {print $1,$2,$3,$4}' /etc/passwd\n```\n\nPosition of match\n\n```\nawk 'BEGIN {\n    if (match(\"One Two Three\", \"Tw\"))\n        print RSTART }'\n```\n\nLength of match\n\n```\nawk 'BEGIN {\n    if (match(\"One Two Three\", \"re\"))\n        print RLENGTH }'\n```\n\n### Environment Variables\n\n| -         | -                                                         |\n| --------- | --------------------------------------------------------- |\n| `ARGC`    | Number or arguments                                       |\n| `ARGV`    | Array of arguments                                        |\n| `FNR`     | `F`ile `N`umber of `R`ecords                              |\n| `OFMT`    | Format for numbers <br> _(default \"%.6g\")_                |\n| `RSTART`  | Location in the string                                    |\n| `RLENGTH` | Length of match                                           |\n| `SUBSEP`  | Multi-dimensional array separator <br> _(default \"\\034\")_ |\n| `ARGIND`  | Argument Index                                            |\n\n### GNU awk only\n\n| -             | -                     |\n| ------------- | --------------------- |\n| `ENVIRON`     | Environment variables |\n| `IGNORECASE`  | Ignore case           |\n| `CONVFMT`     | Conversion format     |\n| `ERRNO`       | System errors         |\n| `FIELDWIDTHS` | Fixed width fields    |\n\n### Defining variable\n\n```\nawk -v var1=\"Hello\" -v var2=\"Wold\" '\n    END {print var1, var2}\n' </dev/null\n```\n\n#### Use shell variables\n\n```\nawk -v varName=\"$PWD\" '\n    END {print varName}' </dev/null\n```\n\n## Awk Operators\n\n### Operators\n\n| -                | -           |\n| ---------------- | ----------- |\n| `{print $1}`     | First field |\n| `$2 == \"foo\"`    | Equals      |\n| `$2 != \"foo\"`    | Not equals  |\n| `\"foo\" in array` | In array    |\n\n#### Regular expression\n\n| -               | -                 |\n| --------------- | ----------------- |\n| `/regex/`       | Line matches      |\n| `!/regex/`      | Line not matches  |\n| `$1 ~ /regex/`  | Field matches     |\n| `$1 !~ /regex/` | Field not matches |\n\n#### More conditions\n\n| -                        | -   |\n| ------------------------ | --- |\n| `($2 <= 4 \\|\\| $3 < 20)` | Or  |\n| `($1 == 4 && $3 < 20)`   | And |\n\n### Operations\n\n#### Arithmetic operations\n\n- `+`\n- `-`\n- `*`\n- `/`\n- `%`\n- `++`\n- `--`\n\n{.cols-3 .marker-none}\n\n#### Shorthand assignments\n\n- `+=`\n- `-=`\n- `*=`\n- `/=`\n- `%=`\n\n{.cols-3 .marker-none}\n\n#### Comparison operators\n\n- `==`\n- `!=`\n- `<`\n- `>`\n- `<=`\n- `>=`\n\n{.cols-3 .marker-none}\n\n### Examples\n\n```\nawk 'BEGIN {\n    if (\"foo\" ~ \"^fo+$\")\n        print \"Fooey!\";\n}'\n```\n\n#### Not match\n\n```\nawk 'BEGIN {\n    if (\"boo\" !~ \"^fo+$\")\n        print \"Boo!\";\n}'\n```\n\n#### if in array\n\n```\nawk 'BEGIN {\n    assoc[\"foo\"] = \"bar\";\n    assoc[\"bar\"] = \"baz\";\n    if (\"foo\" in assoc)\n        print \"Fooey!\";\n}'\n```\n\n## Awk Functions\n\n### Common functions {.col-span-2}\n\n| Function              | Description                                                                     |\n| --------------------- | ------------------------------------------------------------------------------- |\n| `index(s,t)`          | Position in string s where string t occurs, 0 if not found                      |\n| `length(s)`           | Length of string s (or $0 if no arg)                                            |\n| `rand`                | Random number between 0 and 1                                                   |\n| `substr(s,index,len)` | Return len-char substring of s that begins at index (counted from 1)            |\n| `srand`               | Set seed for rand and return previous seed                                      |\n| `int(x)`              | Truncate x to integer value                                                     |\n| `split(s,a,fs)`       | Split string s into array a split by fs, returning length of a                  |\n| `match(s,r)`          | Position in string s where regex r occurs, or 0 if not found                    |\n| `sub(r,t,s)`          | Substitute t for first occurrence of regex r in string s (or $0 if s not given) |\n| `gsub(r,t,s)`         | Substitute t for all occurrences of regex r in string s                         |\n| `system(cmd)`         | Execute cmd and return exit status                                              |\n| `tolower(s)`          | String s to lowercase                                                           |\n| `toupper(s)`          | String s to uppercase                                                           |\n| `getline`             | Set $0 to next input record from current input file.                            |\n\n### User defined function\n\n```\nawk '\n    # Returns minimum number\n    function find_min(num1, num2){\n       if (num1 < num2)\n       return num1\n       return num2\n    }\n    # Returns maximum number\n    function find_max(num1, num2){\n       if (num1 > num2)\n       return num1\n       return num2\n    }\n    # Main function\n    function main(num1, num2){\n       result = find_min(num1, num2)\n       print \"Minimum =\", result\n\n       result = find_max(num1, num2)\n       print \"Maximum =\", result\n    }\n    # Script execution starts here\n    BEGIN {\n       main(10, 60)\n    }\n'\n```\n\n## Awk Arrays\n\n### Array with index\n\n```\nawk 'BEGIN {\n    arr[0] = \"foo\";\n    arr[1] = \"bar\";\n    print(arr[0]); # => foo\n    delete arr[0];\n    print(arr[0]); # => \"\"\n}'\n```\n\n### Array with key\n\n```\nawk 'BEGIN {\n    assoc[\"foo\"] = \"bar\";\n    assoc[\"bar\"] = \"baz\";\n    print(\"baz\" in assoc); # => 0\n    print(\"foo\" in assoc); # => 1\n}'\n```\n\n### Array with split\n\n```\nawk 'BEGIN {\n    split(\"foo:bar:baz\", arr, \":\");\n    for (key in arr)\n        print arr[key];\n}'\n```\n\n### Array with asort\n\n```\nawk 'BEGIN {\n    arr[0] = 3\n    arr[1] = 2\n    arr[2] = 4\n    n = asort(arr)\n    for (i = 1; i <= n ; i++)\n        print(arr[i])\n}'\n```\n\n### Multi-dimensional\n\n```\nawk 'BEGIN {\n    multidim[0,0] = \"foo\";\n    multidim[0,1] = \"bar\";\n    multidim[1,0] = \"baz\";\n    multidim[1,1] = \"boo\";\n}'\n```\n\n### Multi-dimensional iteration\n\n```\nawk 'BEGIN {\n    array[1,2]=3;\n    array[2,3]=5;\n    for (comb in array) {\n        split(comb,sep,SUBSEP);\n        print sep[1], sep[2],\n        array[sep[1],sep[2]]\n    }\n}'\n```\n\n## Awk Conditions\n\n### if-else statement\n\n```\nawk -v count=2 'BEGIN {\n    if (count == 1)\n        print \"Yes\";\n    else\n        print \"Huh?\";\n}'\n```\n\n#### Ternary operator\n\n```\nawk -v count=2 'BEGIN {\n    print (count==1) ? \"Yes\" : \"Huh?\";\n}'\n```\n\n### Exists\n\n```\nawk 'BEGIN {\n    assoc[\"foo\"] = \"bar\";\n    assoc[\"bar\"] = \"baz\";\n    if (\"foo\" in assoc)\n        print \"Fooey!\";\n}'\n```\n\n#### Not exists\n\n```\nawk 'BEGIN {\n    assoc[\"foo\"] = \"bar\";\n    assoc[\"bar\"] = \"baz\";\n    if (\"Huh\" in assoc == 0 )\n        print \"Huh!\";\n}'\n```\n\n### switch\n\n```\nawk -F: '{\n    switch (NR * 2 + 1) {\n        case 3:\n        case \"11\":\n            print NR - 1\n            break\n\n        case /2[[:digit:]]+/:\n            print NR\n\n        default:\n            print NR + 1\n\n        case -1:\n            print NR * -1\n    }\n}' /etc/passwd\n```\n\n## Awk Loops\n\n### for...i\n\n```\nawk 'BEGIN {\n    for (i = 0; i < 10; i++)\n        print \"i=\" i;\n}'\n```\n\n#### Powers of two between 1 and 100\n\n```\nawk 'BEGIN {\n    for (i = 1; i <= 100; i *= 2)\n        print i\n}'\n```\n\n### for...in\n\n```\nawk 'BEGIN {\n    assoc[\"key1\"] = \"val1\"\n    assoc[\"key2\"] = \"val2\"\n    for (key in assoc)\n        print assoc[key];\n}'\n```\n\n#### Arguments\n\n```\nawk 'BEGIN {\n    for (argnum in ARGV)\n        print ARGV[argnum];\n}' a b c\n```\n\n### Examples {.row-span-3}\n\n#### Reverse records\n\n```\nawk -F: '{ x[NR] = $0 }\n    END {\n        for (i = NR; i > 0; i--)\n        print x[i]\n    }\n' /etc/passwd\n```\n\n#### Reverse fields\n\n```\nawk -F: '{\n    for (i = NF; i > 0; i--)\n        printf(\"%s \",$i);\n    print \"\"\n}' /etc/passwd\n```\n\n#### Sum by record\n\n```\nawk -F: '{\n    s=0;\n    for (i = 1; i <= NF; i++)\n        s += $i;\n    print s\n}' /etc/passwd\n```\n\n#### Sum whole file\n\n```\nawk -F: '\n    {for (i = 1; i <= NF; i++)\n        s += $i;\n    };\n    END{print s}\n' /etc/passwd\n```\n\n### while {.row-span-2}\n\n```\nawk 'BEGIN {\n    while (a < 10) {\n        print \"- \" \" concatenation: \" a\n        a++;\n    }\n}'\n```\n\n#### do...while\n\n```\nawk '{\n    i = 1\n    do {\n        print $0\n        i++\n    } while (i <= 5)\n}' /etc/passwd\n```\n\n### Break\n\n```\nawk 'BEGIN {\n    break_num = 5\n    for (i = 0; i < 10; i++) {\n        print i\n        if (i == break_num)\n            break\n    }\n}'\n```\n\n### Continue\n\n```\nawk 'BEGIN {\n    for (x = 0; x <= 10; x++) {\n        if (x == 5 || x == 6)\n            continue\n        printf \"%d \", x\n    }\n    print \"\"\n}'\n```\n\n## Awk Formatted Printing\n\n### Usage\n\n#### Right align\n\n```\nawk 'BEGIN{printf \"|%10s|\\n\", \"hello\"}'\n\n|     hello|\n```\n\n#### Left align\n\n```\nawk 'BEGIN{printf \"|%-10s|\\n\", \"hello\"}'\n\n|hello     |\n```\n\n### Common specifiers\n\n| Character     | Description           |\n| ------------- | --------------------- |\n| `c`           | ASCII character       |\n| `d`           | Decimal integer       |\n| `e`, `E`, `f` | Floating-point format |\n| `o`           | Unsigned octal value  |\n| `s`           | String                |\n| `%`           | Literal %             |\n\n### Space\n\n```\nawk -F: '{\n    printf \"%-10s %s\\n\", $1, $(NF-1)\n}' /etc/passwd | head -n 3\n```\n\nOutputs\n\n```shell script\nroot       /root\nbin        /bin\ndaemon     /sbin\n```\n\n### Header\n\n```\nawk -F: 'BEGIN {\n    printf \"%-10s %s\\n\", \"User\", \"Home\"\n    printf \"%-10s %s\\n\", \"----\",\"----\"}\n    { printf \"%-10s %s\\n\", $1, $(NF-1) }\n' /etc/passwd | head -n 5\n```\n\nOutputs\n\n```\nUser       Home\n----       ----\nroot       /root\nbin        /bin\ndaemon     /sbin\n```\n\n## Miscellaneous\n\n### Regex Metacharacters\n\n- `\\`\n- `^`\n- `$`\n- `.`\n- `[`\n- `]`\n- `|`\n- `(`\n- `)`\n- `*`\n- `+`\n- `?`\n\n{.cols-3 .marker-none}\n\n### Escape Sequences\n\n| -    | -                   |\n| ---- | ------------------- |\n| `\\b` | Backspace           |\n| `\\f` | Form feed           |\n| `\\n` | Newline (line feed) |\n| `\\r` | Carriage return     |\n| `\\t` | Horizontal tab      |\n| `\\v` | Vertical tab        |\n\n### Run script\n\n```shell script\n$ cat demo.awk\n#!/usr/bin/awk -f\nBEGIN { x = 23 }\n      { x += 2 }\nEND   { print x }\n$ awk -f demo.awk /etc/passwd\n69\n```\n\n## Also see\n\n- [The GNU Awk User's Guide](https://www-zeuthen.desy.de/dv/documentation/unixguide/infohtml/gawk/gawk.html)\n  _(www-zeuthen.desy.de)_\n- [AWK cheatsheet](https://gist.github.com/Rafe/3102414) _(gist.github.com)_\n"
  },
  {
    "path": "source/_posts/bash.md",
    "content": "---\ntitle: Bash\ndate: 2020-11-25 18:28:43\nbackground: bg-[#3e4548]\ntags:\n  - shell\n  - sh\n  - echo\n  - script\n  - linux\ncategories:\n  - Programming\n  - Operating System\nintro: This is a quick reference cheat sheet to getting started with linux bash shell scripting.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### hello.sh\n\n```bash\n#!/bin/bash\n\nVAR=\"world\"\necho \"Hello $VAR!\" # => Hello world!\n```\n\nExecute the script\n\n```shell script\n$ bash hello.sh\n```\n\n### Variables\n\n```bash\nNAME=\"John\"\n\necho ${NAME}    # => John (Variables)\necho $NAME      # => John (Variables)\necho \"$NAME\"    # => John (Variables)\necho '$NAME'    # => $NAME (Exact string)\necho \"${NAME}!\" # => John! (Variables)\n\nNAME = \"John\"   # => Error (about space)\n```\n\n### Comments\n\n```bash\n# This is an inline Bash comment.\n```\n\n```bash\n: '\nThis is a\nvery neat comment\nin bash\n'\n```\n\nMulti-line comments use `:'` to open and `'` to close\n\n### Arguments {.row-span-2}\n\n| Expression  | Description                           |\n| ----------- | ------------------------------------- |\n| `$1` … `$9` | Parameter 1 ... 9                     |\n| `$0`        | Name of the script itself             |\n| `$1`        | First argument                        |\n| `${10}`     | Positional parameter 10               |\n| `$#`        | Number of arguments                   |\n| `$$`        | Process id of the shell               |\n| `$*`        | All arguments                         |\n| `$@`        | All arguments, starting from first    |\n| `$-`        | Current options                       |\n| `$_`        | Last argument of the previous command |\n\nSee: [Special parameters](http://wiki.bash-hackers.org/syntax/shellvars#special_parameters_and_shell_variables)\n\n### Functions\n\n```bash\nget_name() {\n    echo \"John\"\n}\n\necho \"You are $(get_name)\"\n```\n\nSee: [Functions](#bash-functions)\n\n### Conditionals {#conditionals-example}\n\n```bash\nif [[ -z \"$string\" ]]; then\n    echo \"String is empty\"\nelif [[ -n \"$string\" ]]; then\n    echo \"String is not empty\"\nfi\n```\n\nSee: [Conditionals](#bash-conditionals)\n\n### Brace expansion\n\n```bash\necho {A,B}.js\n```\n\n---\n\n| Expression | Description         |\n| ---------- | ------------------- |\n| `{A,B}`    | Same as `A B`       |\n| `{A,B}.js` | Same as `A.js B.js` |\n| `{1..5}`   | Same as `1 2 3 4 5` |\n\nSee: [Brace expansion](http://wiki.bash-hackers.org/syntax/expansion/brace)\n\n### Shell execution\n\n```bash\n# => I'm in /path/of/current\necho \"I'm in $(PWD)\"\n\n# Same as:\necho \"I'm in `pwd`\"\n```\n\nSee: [Command substitution](http://wiki.bash-hackers.org/syntax/expansion/cmdsubst)\n\n## Bash Parameter expansions\n\n### Syntax {.row-span-2}\n\n| Code              | Description         |\n| ----------------- | ------------------- |\n| `${FOO%suffix}`   | Remove suffix       |\n| `${FOO#prefix}`   | Remove prefix       |\n| `${FOO%%suffix}`  | Remove long suffix  |\n| `${FOO##prefix}`  | Remove long prefix  |\n| `${FOO/from/to}`  | Replace first match |\n| `${FOO//from/to}` | Replace all         |\n| `${FOO/%from/to}` | Replace suffix      |\n| `${FOO/#from/to}` | Replace prefix      |\n\n#### Substrings\n\n| Expression      | Description                    |\n| --------------- | ------------------------------ |\n| `${FOO:0:3}`    | Substring _(position, length)_ |\n| `${FOO:(-3):3}` | Substring from the right       |\n\n#### Length\n\n| Expression | Description      |\n| ---------- | ---------------- |\n| `${#FOO}`  | Length of `$FOO` |\n\n#### Default values\n\n| Expression        | Description                              |\n| ----------------- | ---------------------------------------- |\n| `${FOO:-val}`     | `$FOO`, or `val` if unset                |\n| `${FOO:=val}`     | Set `$FOO` to `val` if unset             |\n| `${FOO:+val}`     | `val` if `$FOO` is set                   |\n| `${FOO:?message}` | Show message and exit if `$FOO` is unset |\n\n### Substitution\n\n```bash\necho ${food:-Cake}  #=> $food or \"Cake\"\n```\n\n```bash\nSTR=\"/path/to/foo.cpp\"\necho ${STR%.cpp}    # /path/to/foo\necho ${STR%.cpp}.o  # /path/to/foo.o\necho ${STR%/*}      # /path/to\n\necho ${STR##*.}     # cpp (extension)\necho ${STR##*/}     # foo.cpp (basepath)\n\necho ${STR#*/}      # path/to/foo.cpp\necho ${STR##*/}     # foo.cpp\n\necho ${STR/foo/bar} # /path/to/bar.cpp\n```\n\n### Slicing\n\n```bash\nname=\"John\"\necho ${name}           # => John\necho ${name:0:2}       # => Jo\necho ${name::2}        # => Jo\necho ${name::-1}       # => Joh\necho ${name:(-1)}      # => n\necho ${name:(-2)}      # => hn\necho ${name:(-2):2}    # => hn\n\nlength=2\necho ${name:0:length}  # => Jo\n```\n\nSee: [Parameter expansion](http://wiki.bash-hackers.org/syntax/pe)\n\n### basepath & dirpath\n\n```bash\nSRC=\"/path/to/foo.cpp\"\n```\n\n```bash\nBASEPATH=${SRC##*/}\necho $BASEPATH  # => \"foo.cpp\"\n\n\nDIRPATH=${SRC%$BASEPATH}\necho $DIRPATH   # => \"/path/to/\"\n```\n\n### Transform\n\n```bash\nSTR=\"HELLO WORLD!\"\necho ${STR,}   # => hELLO WORLD!\necho ${STR,,}  # => hello world!\n\nSTR=\"hello world!\"\necho ${STR^}   # => Hello world!\necho ${STR^^}  # => HELLO WORLD!\n\nARR=(hello World)\necho \"${ARR[@],}\" # => hello world\necho \"${ARR[@]^}\" # => Hello World\n```\n\n## Bash Arrays\n\n### Defining arrays\n\n```bash\nFruits=('Apple' 'Banana' 'Orange')\n\nFruits[0]=\"Apple\"\nFruits[1]=\"Banana\"\nFruits[2]=\"Orange\"\n\nARRAY1=(foo{1..2}) # => foo1 foo2\nARRAY2=({A..D})    # => A B C D\n\n# Merge => foo1 foo2 A B C D\nARRAY3=(${ARRAY1[@]} ${ARRAY2[@]})\n\n# declare construct\ndeclare -a Numbers=(1 2 3)\nNumbers+=(4 5) # Append => 1 2 3 4 5\n```\n\n### Indexing\n\n| -                  | -             |\n| ------------------ | ------------- |\n| `${Fruits[0]}`     | First element |\n| `${Fruits[-1]}`    | Last element  |\n| `${Fruits[*]}`     | All elements  |\n| `${Fruits[@]}`     | All elements  |\n| `${#Fruits[@]}`    | Number of all |\n| `${#Fruits}`       | Length of 1st |\n| `${#Fruits[3]}`    | Length of nth |\n| `${Fruits[@]:3:2}` | Range         |\n| `${!Fruits[@]}`    | Keys of all   |\n\n### Iteration\n\n```bash\nFruits=('Apple' 'Banana' 'Orange')\n\nfor e in \"${Fruits[@]}\"; do\n    echo $e\ndone\n```\n\n#### With index\n\n```bash\nfor i in \"${!Fruits[@]}\"; do\n  printf \"%s\\t%s\\n\" \"$i\" \"${Fruits[$i]}\"\ndone\n\n```\n\n### Operations {.col-span-2}\n\n```bash\nFruits=(\"${Fruits[@]}\" \"Watermelon\")     # Push\nFruits+=('Watermelon')                   # Also Push\nFruits=( ${Fruits[@]/Ap*/} )             # Remove by regex match\nunset Fruits[2]                          # Remove one item\nFruits=(\"${Fruits[@]}\")                  # Duplicate\nFruits=(\"${Fruits[@]}\" \"${Veggies[@]}\")  # Concatenate\nlines=(`cat \"logfile\"`)                  # Read from file\n```\n\n### Arrays as arguments\n\n```bash\nfunction extract()\n{\n    local -n myarray=$1\n    local idx=$2\n    echo \"${myarray[$idx]}\"\n}\nFruits=('Apple' 'Banana' 'Orange')\nextract Fruits 2     # => Orangle\n```\n\n## Bash Dictionaries\n\n### Defining\n\n```bash\ndeclare -A sounds\n```\n\n```bash\nsounds[dog]=\"bark\"\nsounds[cow]=\"moo\"\nsounds[bird]=\"tweet\"\nsounds[wolf]=\"howl\"\n```\n\n### Working with dictionaries\n\n```bash\necho ${sounds[dog]} # Dog's sound\necho ${sounds[@]}   # All values\necho ${!sounds[@]}  # All keys\necho ${#sounds[@]}  # Number of elements\nunset sounds[dog]   # Delete dog\n```\n\n### Iteration\n\n```bash\nfor val in \"${sounds[@]}\"; do\n    echo $val\ndone\n```\n\n---\n\n```bash\nfor key in \"${!sounds[@]}\"; do\n    echo $key\ndone\n```\n\n## Bash Conditionals\n\n### Integer conditions\n\n| Condition           | Description                                 |\n| ------------------- | ------------------------------------------- |\n| `[[ NUM -eq NUM ]]` | <yel>Eq</yel>ual                            |\n| `[[ NUM -ne NUM ]]` | <yel>N</yel>ot <yel>e</yel>qual             |\n| `[[ NUM -lt NUM ]]` | <yel>L</yel>ess <yel>t</yel>han             |\n| `[[ NUM -le NUM ]]` | <yel>L</yel>ess than or <yel>e</yel>qual    |\n| `[[ NUM -gt NUM ]]` | <yel>G</yel>reater <yel>t</yel>han          |\n| `[[ NUM -ge NUM ]]` | <yel>G</yel>reater than or <yel>e</yel>qual |\n| `(( NUM < NUM ))`   | Less than                                   |\n| `(( NUM <= NUM ))`  | Less than or equal                          |\n| `(( NUM > NUM ))`   | Greater than                                |\n| `(( NUM >= NUM ))`  | Greater than or equal                       |\n\n### String conditions\n\n| Condition          | Description                 |\n| ------------------ | --------------------------- |\n| `[[ -z STR ]]`     | Empty string                |\n| `[[ -n STR ]]`     | <yel>N</yel>ot empty string |\n| `[[ STR == STR ]]` | Equal                       |\n| `[[ STR = STR ]]`  | Equal (Same above)          |\n| `[[ STR < STR ]]`  | Less than _(ASCII)_         |\n| `[[ STR > STR ]]`  | Greater than _(ASCII)_      |\n| `[[ STR != STR ]]` | Not Equal                   |\n| `[[ STR =~ STR ]]` | Regexp                      |\n\n### Example {.row-span-3}\n\n#### String\n\n```bash\nif [[ -z \"$string\" ]]; then\n    echo \"String is empty\"\nelif [[ -n \"$string\" ]]; then\n    echo \"String is not empty\"\nelse\n    echo \"This never happens\"\nfi\n```\n\n#### Combinations\n\n```bash\nif [[ X && Y ]]; then\n    ...\nfi\n```\n\n#### Equal\n\n```bash\nif [[ \"$A\" == \"$B\" ]]; then\n    ...\nfi\n```\n\n#### Regex\n\n```bash\nif [[ '1. abc' =~ ([a-z]+) ]]; then\n    echo ${BASH_REMATCH[1]}\nfi\n```\n\n#### Smaller\n\n```bash\nif (( $a < $b )); then\n   echo \"$a is smaller than $b\"\nfi\n```\n\n#### Exists\n\n```bash\nif [[ -e \"file.txt\" ]]; then\n    echo \"file exists\"\nfi\n```\n\n### File conditions {.row-span-2}\n\n| Condition         | Description                            |\n| ----------------- | -------------------------------------- |\n| `[[ -e FILE ]]`   | <yel>E</yel>xists                      |\n| `[[ -d FILE ]]`   | <yel>D</yel>irectory                   |\n| `[[ -f FILE ]]`   | <yel>F</yel>ile                        |\n| `[[ -h FILE ]]`   | Symlink                                |\n| `[[ -s FILE ]]`   | Size is > 0 bytes                      |\n| `[[ -r FILE ]]`   | <yel>R</yel>eadable                    |\n| `[[ -w FILE ]]`   | <yel>W</yel>ritable                    |\n| `[[ -x FILE ]]`   | Executable                             |\n| `[[ f1 -nt f2 ]]` | f1 <yel>n</yel>ewer <yel>t</yel>han f2 |\n| `[[ f1 -ot f2 ]]` | f2 <yel>o</yel>lder <yel>t</yel>han f1 |\n| `[[ f1 -ef f2 ]]` | Same files                             |\n\n### More conditions\n\n| Condition            | Description          |\n| -------------------- | -------------------- | ----- | --- |\n| `[[ -o noclobber ]]` | If OPTION is enabled |\n| `[[ ! EXPR ]]`       | Not                  |\n| `[[ X && Y ]]`       | And                  |\n| `[[ X                |                      | Y ]]` | Or  |\n\n### logical and, or\n\n```bash\nif [ \"$1\" = 'y' -a $2 -gt 0 ]; then\n    echo \"yes\"\nfi\n\nif [ \"$1\" = 'n' -o $2 -lt 0 ]; then\n    echo \"no\"\nfi\n```\n\n## Bash Loops\n\n### Basic for loop\n\n```bash\nfor i in /etc/rc.*; do\n    echo $i\ndone\n```\n\n### C-like for loop\n\n```bash\nfor ((i = 0 ; i < 100 ; i++)); do\n    echo $i\ndone\n```\n\n### Ranges {.row-span-2}\n\n```bash\nfor i in {1..5}; do\n    echo \"Welcome $i\"\ndone\n```\n\n#### With step size\n\n```bash\nfor i in {5..50..5}; do\n    echo \"Welcome $i\"\ndone\n```\n\n### Continue\n\n```bash {data=3,5}\nfor number in $(seq 1 3); do\n    if [[ $number == 2 ]]; then\n        continue;\n    fi\n    echo \"$number\"\ndone\n```\n\n### Break\n\n```bash\nfor number in $(seq 1 3); do\n    if [[ $number == 2 ]]; then\n        # Skip entire rest of loop.\n        break;\n    fi\n    # This will only print 1\n    echo \"$number\"\ndone\n```\n\n### Until\n\n```bash\ncount=0\nuntil [ $count -gt 10 ]; do\n    echo \"$count\"\n    ((count++))\ndone\n```\n\n### While with increment\n\n```bash\ni=1\nwhile [[ $i -lt 4 ]]; do\n    echo \"Number: $i\"\n    ((i++))\ndone\n```\n\n### While with decrement\n\n```bash\ni=3\nwhile [[ $i -gt 0 ]]; do\n    echo \"Number: $i\"\n    ((i--))\ndone\n```\n\n#### Combined with test\n\n```bash\ni=3\nwhile ((i--)); do\n    echo \"Number: $i\"\ndone\n```\n\n### Forever\n\n```bash\nwhile true; do\n    # here is some code.\ndone\n```\n\n### Forever (shorthand)\n\n```bash\nwhile :; do\n    # here is some code.\ndone\n```\n\n### Reading lines\n\n```bash\nwhile read line; do\n    echo $line\ndone < file.txt\n```\n\n## Bash Functions\n\n### Defining functions\n\n```bash\nmyfunc() {\n    echo \"hello $1\"\n}\n```\n\n```bash\n# Same as above (alternate syntax)\nfunction myfunc() {\n    echo \"hello $1\"\n}\n```\n\n```bash\nmyfunc \"John\"\n```\n\n### Returning values\n\n```bash\nmyfunc() {\n    local myresult='some value'\n    echo $myresult\n}\n```\n\n```bash\nresult=\"$(myfunc)\"\n```\n\n### Raising errors\n\n```bash\nmyfunc() {\n    return 1\n}\n```\n\n```bash\nif myfunc; then\n    echo \"success\"\nelse\n    echo \"failure\"\nfi\n```\n\n## Bash Options {.cols-2}\n\n### Options\n\n```bash\n# Avoid overlay files\n# (echo \"hi\" > foo)\nset -o noclobber\n\n# Used to exit upon error\n# avoiding cascading errors\nset -o errexit\n\n# Unveils hidden failures\nset -o pipefail\n\n# Exposes unset variables\nset -o nounset\n```\n\n### Glob options\n\n```bash\n# Non-matching globs are removed\n# ('*.foo' => '')\nshopt -s nullglob\n\n# Non-matching globs throw errors\nshopt -s failglob\n\n# Case insensitive globs\nshopt -s nocaseglob\n\n# Wildcards match dotfiles\n# (\"*.sh\" => \".foo.sh\")\nshopt -s dotglob\n\n# Allow ** for recursive matches\n# ('lib/**/*.rb' => 'lib/a/b/c.rb')\nshopt -s globstar\n```\n\n## Bash History {.cols-2}\n\n### Commands\n\n| Command               | Description                               |\n| --------------------- | ----------------------------------------- |\n| `history`             | Show history                              |\n| `sudo !!`             | Run the previous command with sudo        |\n| `shopt -s histverify` | Don't execute expanded result immediately |\n\n### Expansions\n\n| Expression   | Description                                          |\n| ------------ | ---------------------------------------------------- |\n| `!$`         | Expand last parameter of most recent command         |\n| `!*`         | Expand all parameters of most recent command         |\n| `!-n`        | Expand `n`th most recent command                     |\n| `!n`         | Expand `n`th command in history                      |\n| `!<command>` | Expand most recent invocation of command `<command>` |\n\n### Operations\n\n| Code                 | Description                                                           |\n| -------------------- | --------------------------------------------------------------------- |\n| `!!`                 | Execute last command again                                            |\n| `!!:s/<FROM>/<TO>/`  | Replace first occurrence of `<FROM>` to `<TO>` in most recent command |\n| `!!:gs/<FROM>/<TO>/` | Replace all occurrences of `<FROM>` to `<TO>` in most recent command  |\n| `!$:t`               | Expand only basename from last parameter of most recent command       |\n| `!$:h`               | Expand only directory from last parameter of most recent command      |\n\n`!!` and `!$` can be replaced with any valid expansion.\n\n### Slices\n\n| Code     | Description                                                                              |\n| -------- | ---------------------------------------------------------------------------------------- |\n| `!!:n`   | Expand only `n`th token from most recent command (command is `0`; first argument is `1`) |\n| `!^`     | Expand first argument from most recent command                                           |\n| `!$`     | Expand last token from most recent command                                               |\n| `!!:n-m` | Expand range of tokens from most recent command                                          |\n| `!!:n-$` | Expand `n`th token to last from most recent command                                      |\n\n`!!` can be replaced with any valid expansion i.e. `!cat`, `!-2`, `!42`, etc.\n\n## Miscellaneous\n\n### Numeric calculations\n\n```bash\n$((a + 200))      # Add 200 to $a\n```\n\n```bash\n$(($RANDOM%200))  # Random number 0..199\n```\n\n### Subshells\n\n```bash\n(cd somedir; echo \"I'm now in $PWD\")\npwd # still in first directory\n```\n\n### Inspecting commands\n\n```bash\ncommand -V cd\n#=> \"cd is a function/alias/whatever\"\n```\n\n### Redirection {.row-span-2 .col-span-2}\n\n```bash\npython hello.py > output.txt   # stdout to (file)\npython hello.py >> output.txt  # stdout to (file), append\npython hello.py 2> error.log   # stderr to (file)\npython hello.py 2>&1           # stderr to stdout\npython hello.py 2>/dev/null    # stderr to (null)\npython hello.py &>/dev/null    # stdout and stderr to (null)\n```\n\n```bash\npython hello.py < foo.txt      # feed foo.txt to stdin for python\n```\n\n### Source relative\n\n```bash\nsource \"${0%/*}/../share/foo.sh\"\n```\n\n### Directory of script\n\n```bash\nDIR=\"${0%/*}\"\n```\n\n### Case/switch\n\n```bash\ncase \"$1\" in\n    start | up)\n    vagrant up\n    ;;\n\n    *)\n    echo \"Usage: $0 {start|stop|ssh}\"\n    ;;\nesac\n```\n\n### Trap errors {.col-span-2}\n\n```bash\ntrap 'echo Error at about $LINENO' ERR\n```\n\nor\n\n```bash\ntraperr() {\n    echo \"ERROR: ${BASH_SOURCE[1]} at about ${BASH_LINENO[0]}\"\n}\n\nset -o errtrace\ntrap traperr ERR\n```\n\n### printf\n\n```bash\nprintf \"Hello %s, I'm %s\" Sven Olga\n#=> \"Hello Sven, I'm Olga\n\nprintf \"1 + 1 = %d\" 2\n#=> \"1 + 1 = 2\"\n\nprintf \"Print a float: %f\" 2\n#=> \"Print a float: 2.000000\"\n```\n\n### Getting options {.col-span-2}\n\n```bash\nwhile [[ \"$1\" =~ ^- && ! \"$1\" == \"--\" ]]; do case $1 in\n    -V | --version )\n    echo $version\n    exit\n    ;;\n    -s | --string )\n    shift; string=$1\n    ;;\n    -f | --flag )\n    flag=1\n    ;;\nesac; shift; done\nif [[ \"$1\" == '--' ]]; then shift; fi\n```\n\n### Check for command's result {.col-span-2}\n\n```bash\nif ping -c 1 google.com; then\n    echo \"It appears you have a working internet connection\"\nfi\n```\n\n### Special variables {.row-span-2}\n\n| Expression | Description                  |\n| ---------- | ---------------------------- |\n| `$?`       | Exit status of last task     |\n| `$!`       | PID of last background task  |\n| `$$`       | PID of shell                 |\n| `$0`       | Filename of the shell script |\n\nSee [Special parameters](http://wiki.bash-hackers.org/syntax/shellvars#special_parameters_and_shell_variables).\n\n### Grep check {.col-span-2}\n\n```bash\nif grep -q 'foo' ~/.bash_history; then\n    echo \"You appear to have typed 'foo' in the past\"\nfi\n```\n\n### Backslash escapes {.row-span-2}\n\n- &nbsp;\n- \\!\n- \\\"\n- \\#\n- \\&\n- \\'\n- \\(\n- \\)\n- \\,\n- \\;\n- \\<\n- \\>\n- \\[\n- \\|\n- \\\\\n- \\]\n- \\^\n- \\{\n- \\}\n- \\`\n- \\$\n- \\*\n- \\?\n\n{.cols-4 .marker-none}\n\nEscape these special characters with `\\`\n\n### Heredoc\n\n```sh\ncat <<END\nhello world\nEND\n```\n\n### Go to previous directory\n\n```bash\npwd # /home/user/foo\ncd bar/\npwd # /home/user/foo/bar\ncd -\npwd # /home/user/foo\n```\n\n### Reading input\n\n```bash\necho -n \"Proceed? [y/n]: \"\nread ans\necho $ans\n```\n\n```bash\nread -n 1 ans    # Just one character\n```\n\n### Conditional execution\n\n```bash\ngit commit && git push\ngit commit || echo \"Commit failed\"\n```\n\n### Strict mode\n\n```bash\nset -euo pipefail\nIFS=$'\\n\\t'\n```\n\nSee: [Unofficial bash strict mode](http://redsymbol.net/articles/unofficial-bash-strict-mode/)\n\n### Optional arguments\n\n```bash\nargs=(\"$@\")\nargs+=(foo)\nargs+=(bar)\necho \"${args[@]}\"\n```\n\nPut the arguments into an array and then append\n\n## Also see {.cols-1}\n\n- [Devhints](https://devhints.io/bash) _(devhints.io)_\n- [Bash-hackers wiki](http://wiki.bash-hackers.org/) _(bash-hackers.org)_\n- [Shell vars](http://wiki.bash-hackers.org/syntax/shellvars) _(bash-hackers.org)_\n- [Learn bash in y minutes](https://learnxinyminutes.com/docs/bash/) _(learnxinyminutes.com)_\n- [Bash Guide](http://mywiki.wooledge.org/BashGuide) _(mywiki.wooledge.org)_\n- [ShellCheck](https://www.shellcheck.net/) _(shellcheck.net)_\n- [shell - Standard Shell](https://devmanual.gentoo.org/tools-reference/bash/index.html) _(devmanual.gentoo.org)_\n"
  },
  {
    "path": "source/_posts/bear-notes.md",
    "content": "---\ntitle: Bear\ndate: 2022-11-23 16:23:31.705436\nbackground: bg-[#cd5654]\nlabel: Mac\ntags:\n  -\n  - mac\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 66 keyboard shortcuts found in Bear. This application is MacOS-only.\n---\n\n## Keyboard Shortcuts\n\n### Text Styles {.row-span-3}\n\n| Shortcut             | Action             |\n| -------------------- | ------------------ |\n| `Option` `Cmd` `1-6` | Headings           |\n| `Option` `Cmd` `S`   | Line separator     |\n| `Cmd` `B`            | Bold               |\n| `Cmd` `I`            | Italic             |\n| `Cmd` `U`            | Underline          |\n| `Shift` `Cmd` `E`    | Strikethrough      |\n| `Cmd` `K`            | Link               |\n| `Cmd` `L`            | Unordered list     |\n| `Shift` `Cmd` `L`    | Ordered list       |\n| `Shift` `Cmd` `U`    | Quote              |\n| `Cmd` `T`            | Todo               |\n| `Option` `Cmd` `C`   | Inline code        |\n| `Ctrl` `Option` `C`  | Code block         |\n| `Shift` `Cmd` `M`    | Marker/Highlighter |\n| `Shift` `Cmd` `V`    | Insert file        |\n\n{.shortcuts}\n\n### Todos\n\n| Shortcut           | Action                  |\n| ------------------ | ----------------------- |\n| `Shift` `Cmd` `T`  | Toggle Todo             |\n| `Option` `Cmd` `T` | Mark Todo as completed  |\n| `Ctrl` `Cmd` `T`   | Mark Todo as incomplete |\n\n{.shortcuts}\n\n### Structure\n\n| Shortcut              | Action           |\n| --------------------- | ---------------- |\n| `Cmd` `]`             | Shift line right |\n| `Cmd` `[`             | Shift line left  |\n| `Cmd` `Option` `Up`   | Move line up     |\n| `Cmd` `Option` `Down` | Move line down   |\n\n{.shortcuts}\n\n### Lists\n\n| Shortcut        | Action                       |\n| --------------- | ---------------------------- |\n| `Tab`           | Shift the list element right |\n| `Shift` `Tab`   | Shift the list element left  |\n| `Shift` `Enter` | End the list                 |\n\n{.shortcuts}\n\n### Dates\n\n| Shortcut          | Action                                        |\n| ----------------- | --------------------------------------------- |\n| `Shift` `Cmd` `7` | Long Form Date with time (11 Jul 2017, 10:43) |\n| `Shift` `Cmd` `8` | Long Form Date (11 Jul 2017)                  |\n| `Shift` `Cmd` `9` | Short Form Date (11/07/2017)                  |\n| `Shift` `Cmd` `0` | Hours (11:43)                                 |\n\n{.shortcuts}\n\n### Control\n\n| Shortcut      | Action      |\n| ------------- | ----------- |\n| `Cmd` `A`     | Select all  |\n| `Cmd` `Enter` | End editing |\n| `Cmd` `P`     | Print note  |\n\n{.shortcuts}\n\n### Zoom\n\n| Shortcut  | Action      |\n| --------- | ----------- |\n| `Cmd` `+` | Zoom in     |\n| `Cmd` `-` | Zoom out    |\n| `Cmd` `0` | Actual size |\n\n{.shortcuts}\n\n### Navigation {.row-span-2}\n\n| Shortcut                  | Action                                                                |\n| ------------------------- | --------------------------------------------------------------------- |\n| `Cmd` `N`                 | Create a new note                                                     |\n| `Option` `Cmd` `N`        | Create a new note in a new window                                     |\n| `Up/Down`                 | Move the selection in the note and tags list                          |\n| `Left/Right`              | Move the selection between the sidebar, the nost list, and the editor |\n| `Enter`                   | Edit the selected note                                                |\n| `Option` `Cmd` `F`        | Search in the current note list                                       |\n| `Cmd` `Backspace`         | Delete selected note                                                  |\n| `Shift` `Cmd` `R`         | Restore selected note                                                 |\n| `Shift` `Cmd` `P`         | Pin/unpin selected note                                               |\n| `Cmd` `A`                 | Select all the notes in the list                                      |\n| `Shift` `Cmd` `Backspace` | Empty Trash                                                           |\n| `Cmd` `1`                 | Select Notes in the sidebar                                           |\n| `Cmd` `2`                 | Select Untagged in the sidebar                                        |\n| `Cmd` `3`                 | Select ToDo in the sidebar                                            |\n| `Cmd` `4`                 | Select Today in the sidebar                                           |\n| `Cmd` `5`                 | Select Archive in the sidebar                                         |\n| `Cmd` `6`                 | Select Trash in the sidebar                                           |\n| `Option` `Cmd` `Left`     | Navigate back in visualized notes history                             |\n| `Option` `Cmd` `Right`    | Navigate forward in visualized notes history                          |\n\n{.shortcuts}\n\n### Panels and search\n\n| Shortcut           | Action                                     |\n| ------------------ | ------------------------------------------ |\n| `Shift` `Cmd` `I`  | Toggle information panel                   |\n| `Cmd` `F`          | Search inside the current note             |\n| `Option` `Cmd` `F` | Search and replace inside the current note |\n| `Shift` `Cmd` `F`  | Search inside the note list                |\n\n{.shortcuts}\n\n### Saving and importing\n\n| Shortcut          | Action                |\n| ----------------- | --------------------- |\n| `Shift` `Cmd` `S` | Export selected notes |\n| `Shift` `Cmd` `O` | Import notes          |\n\n{.shortcuts}\n\n### Window\n\n| Shortcut         | Action                             |\n| ---------------- | ---------------------------------- |\n| `Ctrl` `1`       | Show sidebar, note list and editor |\n| `Ctrl` `2`       | Show note list and editor          |\n| `Ctrl` `3`       | Show editor only                   |\n| `Cmd` `,`        | Show preferences                   |\n| `Ctrl` `Cmd` `F` | Enter fullscreen                   |\n| `Cmd` `\\`        | Open main window                   |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Bear notes app](https://bear.app/faq/Shortcuts%20and%20more/Mac%20shortcuts/) _(bear.app)_\n"
  },
  {
    "path": "source/_posts/bitbucket.md",
    "content": "---\ntitle: Bitbucket\ndate: 2022-11-23 16:23:31.699805\nbackground: bg-[#4382f7]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 35 keyboard shortcuts found on Bitbucket\n---\n\n## Keyboard Shortcuts\n\n### All pages\n\n| Shortcut | Action                              |\n| -------- | ----------------------------------- |\n| `?`      | Display keyboard shortcuts          |\n| `[`      | Expand and collapse left navigation |\n| `/`      | Focus the site search               |\n\n{.shortcuts}\n\n### Most pages (except Your Work and Source)\n\n| Shortcut | Action                         |\n| -------- | ------------------------------ |\n| `.`      | Open the Omnibar               |\n| `J`      | Select next item               |\n| `K`      | Select previous item           |\n| `Enter`  | View selected item             |\n| `G` `D`  | Go to Your Work dashboard      |\n| `G` `A`  | Go to your Personal Settings   |\n| `Esc`    | Dismiss dialog or remove focus |\n| `U`      | Go back                        |\n\n{.shortcuts}\n\n### Repository pages (except for Source)\n\n| Shortcut | Action                        |\n| -------- | ----------------------------- |\n| `C` `R`  | Create a repository           |\n| `I` `R`  | Import a repository           |\n| `R` `S`  | Open repository source        |\n| `R` `C`  | Open repository commits       |\n| `R` `B`  | Open repository branches      |\n| `R` `P`  | Open repository pull requests |\n| `R` `I`  | Open repository issues        |\n| `R` `W`  | Open repository wiki          |\n| `R` `D`  | Open repository downloads     |\n| `R` `A`  | Open repository settings      |\n| `F`      | Search for file               |\n\n{.shortcuts}\n\n### Repository pages (except for Source and Settings) {.row-span-2}\n\n| Shortcut | Action                   |\n| -------- | ------------------------ |\n| `X` `F`  | Fork repository          |\n| `X` `B`  | Create branch            |\n| `X` `C`  | Compare branches or tags |\n| `X` `P`  | Create pull request      |\n| `X` `I`  | Create issue             |\n\n{.shortcuts}\n\n### Pull requests {.row-span-2}\n\n| Shortcut       | Action                                  |\n| -------------- | --------------------------------------- |\n| `Ctrl` `Enter` | Submit a comment                        |\n| `T` `C`        | Toggle display of inline comments       |\n| `P` `D`        | Switch to the pull request diff tab     |\n| `P` `C`        | Switch to the pull request commits tab  |\n| `P` `A`        | Switch to the pull request activity tab |\n| `Shift` `T`    | Show the list of tasks                  |\n\n{.shortcuts}\n\n### Repository pages with sidebar\n\n| Shortcut | Action                            |\n| -------- | --------------------------------- |\n| `]`      | Expand and collapse right sidebar |\n\n{.shortcuts}\n\n### Repository source\n\n| Shortcut | Action                |\n| -------- | --------------------- |\n| `F`      | Focus the file filter |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Bitbucket](https://confluence.atlassian.com/bitbucket/keyboard-shortcuts-269980511.html)\n  _(confluence.atlassian.com)_\n"
  },
  {
    "path": "source/_posts/blender.md",
    "content": "---\ntitle: Blender\ndate: 2022-11-23 16:23:31.700590\nbackground: bg-[#e48040]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 187 keyboard shortcuts found in Blender\n---\n\n## Keyboard Shortcuts {.cols-2}\n\n### Universal\n\n| Shortcut            | Action                                                                                                                        |\n| ------------------- | ----------------------------------------------------------------------------------------------------------------------------- |\n| `Esc`               | Cancels Blender functions without changes                                                                                     |\n| `Space`             | Open the toolbox                                                                                                              |\n| `Tab`               | Start or quit edit mode                                                                                                       |\n| `F1`                | Loads a Blender file, changes the window to a file window                                                                     |\n| `Shift` `F1`        | Appends parts from other files, or loads as library data                                                                      |\n| `F2`                | Writes a Blender file, changes the window to a file window                                                                    |\n| `Shift` `F2`        | Exports the scene as a DXF file                                                                                               |\n| `Ctrl` `F2`         | Exports the scene as a VRML1 file                                                                                             |\n| `F3`                | Writes a picture, if a picture has been rendered, and the file format is as indicated in the display buttons                  |\n| `Ctrl` `F3`         | Saves a screen dump of the active window                                                                                      |\n| `Ctrl` `Shift` `F3` | Saves a screen dump of the whole Blender screen                                                                               |\n| `F4`                | Displays the logic context                                                                                                    |\n| `F5`                | Displays the shading context, light, material, or world sub-contexts                                                          |\n| `F6`                | Displays the shading context and texture sub-context                                                                          |\n| `F7`                | Displays the object context                                                                                                   |\n| `F8`                | Displays the shading context and world sub-context                                                                            |\n| `F9`                | Displays the editing context                                                                                                  |\n| `F10`               | Displays the scene context                                                                                                    |\n| `F11`               | Hides or shows the render window                                                                                              |\n| `F12`               | Starts the rendering from the active camera                                                                                   |\n| `Left`              | Go to the previous frame                                                                                                      |\n| `Shift` `Left`      | Go to the first frame                                                                                                         |\n| `Right`             | Go to the next frame                                                                                                          |\n| `Shift` `Right`     | Go to the last frame                                                                                                          |\n| `Up`                | Go forward 10 frames                                                                                                          |\n| `Down`              | Go back 10 frames                                                                                                             |\n| `Alt` `A`           | Change the current Blender window to animation playback mode, the cursor changes to a counter                                 |\n| `Alt` `Shift` `A`   | Change the current window and all 3D windows to animation playback mode                                                       |\n| `I`                 | Insert key menu, this menu differs from window to window                                                                      |\n| `J`                 | Toggle the render buffers                                                                                                     |\n| `Ctrl` `O`          | Opens the last saved file                                                                                                     |\n| `Q`                 | Quit Blender                                                                                                                  |\n| `Ctrl` `Alt` `T`    | Timer menu, this menu offers access to information about drawing speed                                                        |\n| `Ctrl` `U`          | Save user defaults, current project settings are written to the default file that will be loaded every time you start Blender |\n| `Ctrl` `W`          | Write file without opening a file window                                                                                      |\n| `Alt` `W`           | Write videoscape file                                                                                                         |\n| `Ctrl` `X`          | Erase everything except the render buffer, the default scene is reloaded                                                      |\n| `Ctrl` `Y`          | Redo                                                                                                                          |\n| `Ctrl` `Z`          | Undo                                                                                                                          |\n| `Ctrl` `Shift` `Z`  | Redo                                                                                                                          |\n\n{.shortcuts}\n\n### Object Mode\n\n| Shortcut                | Action                                                                                                                                                |\n| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `Home`                  | All objects in the visible layer are displayed completely, centered in the window                                                                     |\n| `PgUp`                  | Select the next object key, if more than one is selected the selection is shifted up cyclically                                                       |\n| `Shift` `PgUp`          | Add to selection the next object key                                                                                                                  |\n| `PgDn`                  | Select the previous object key, if more than one is selected the selection is shifted up cyclically                                                   |\n| `Shift` `PgDn`          | Adds to selection the previous object key                                                                                                             |\n| <code>\\`</code>         | Select all layers                                                                                                                                     |\n| `Shift` <code>\\`</code> | Revert to the previous layer setting                                                                                                                  |\n| `Tab`                   | Start or stop edit mode                                                                                                                               |\n| `A`                     | Selects or deselects all                                                                                                                              |\n| `Ctrl` `A`              | Apply size and rotation                                                                                                                               |\n| `Ctrl` `Shift` `A`      | If the active object is automatically duplicated, brings up a menu for actually creating the objects                                                  |\n| `Shift` `A`             | Brings up the add menu, the toolbox items that start with ADD                                                                                         |\n| `B`                     | Border select, draws a rectangle with the left mouse to select objects                                                                                |\n| `Shift` `B`             | Render border, this only works in camera view mode                                                                                                    |\n| `C`                     | Center view, the position of the 3D cursor becomes the new center of the 3D window                                                                    |\n| `Alt` `C`               | Convert menu, depending on the active object a popup menu is displayed enabling you to convert certain types of ObData                                |\n| `Ctrl` `C`              | Copy menu, this menu copies information from the active object to selected objects                                                                    |\n| `Shift` `C`             | Center zero view, the 3D cursor is set to zero and the view is changed so all objects can be displayed                                                |\n| `D`                     | Display draw mode menu                                                                                                                                |\n| `Shift` `D`             | Add duplicate, the selected objects are duplicated                                                                                                    |\n| `Alt` `D`               | Add linked duplicate, linked duplicates of the selected objects are created                                                                           |\n| `Ctrl` `D`              | Draw the texture image as wire                                                                                                                        |\n| `Alt` `E`               | Start or stop edit mode                                                                                                                               |\n| `F`                     | If selected object is a mash, toggles face select mode on or off                                                                                      |\n| `Ctrl` `F`              | Sort faces, the faces of the active mesh object are sorted based on the current view in the 3D window                                                 |\n| `G`                     | Grab mode, or translation mode                                                                                                                        |\n| `Alt` `G`               | Clears translations, given in grab mode                                                                                                               |\n| `Shift` `G`             | Group selection                                                                                                                                       |\n| `I`                     | Insert object key, a keyposition is inserted in the current frame of all selected objects                                                             |\n| `Ctrl` `J`              | Join objects, all selected objects of the same type are added to the active object                                                                    |\n| `K`                     | Show keys, the draw key option is turned on for all selected objects                                                                                  |\n| `Shift` `K`             | Display popup menu for showing and selecting all keys                                                                                                 |\n| `L`                     | Makes selected object local, makes library linked objects local for the current scene                                                                 |\n| `Ctrl` `L`              | Link selected, links some of the active object data to all selected objects                                                                           |\n| `Shift` `L`             | Select linked, selected all objects somehow linked to the active object                                                                               |\n| `M`                     | Move selected objects to another layer                                                                                                                |\n| `Ctrl` `M`              | Mirror menu, it is possible to mirror an object along the X, Y, or Z axis                                                                             |\n| `N`                     | Number panel, the location, rotation, and scaling of the active object are displayed and can be modified                                              |\n| `Alt` `O`               | Clear origin, the origin is erased for all child objects, which causes them to move ot the exact location of the parent objects                       |\n| `Shift` `O`             | If the selected object is a mesh, toggles the subsurf on or off                                                                                       |\n| `Ctrl` `P`              | Make selected objects the children of the active object                                                                                               |\n| `Alt` `P`               | Clears parent relation, user is asked if they wish to keep or clear parent-induced transforms                                                         |\n| `R`                     | Rotate mode, works on selected objects                                                                                                                |\n| `Alt` `R`               | Clears rotation, the X, Y, and Z rotations of selected objects are set to zero                                                                        |\n| `S`                     | Size mode or scaling mode, works on selected objects                                                                                                  |\n| `Alt` `S`               | Clears size, the X, Y, and Z dimensions of selected objects are set to 1                                                                              |\n| `Shift` `S`             | Opens the snap menu                                                                                                                                   |\n| `T`                     | Texture space mode, the position of dimensions of the texture space for the selected objects can be changed in the same manner for grab and size mode |\n| `Ctrl` `T`              | Makes selected objects track the active object                                                                                                        |\n| `Alt` `T`               | Clears old style track, constraint track is removed as all constrains are                                                                             |\n| `U`                     | Makes object single user, the inverse operation of link                                                                                               |\n| `V`                     | Switches in and out of vertex paint mode                                                                                                              |\n| `Alt` `V`               | Object image aspect, this hotkey sets the X and Y dimensions of the selected objects in relation to the dimensions of the image texture they have     |\n| `W`                     | Opens the object booleans menu                                                                                                                        |\n| `X`                     | Deletes selected objects                                                                                                                              |\n| `Z`                     | Toggles solid mode on or off                                                                                                                          |\n| `Shift` `Z`             | Toggles shaded mode on or off                                                                                                                         |\n| `Alt` `Z`               | Toggles textured mode on or off                                                                                                                       |\n\n{.shortcuts}\n\n### Edit Mode - General\n\n| Shortcut     | Action                                                                                             |\n| ------------ | -------------------------------------------------------------------------------------------------- |\n| `Tab`        | Start or stop edit mode                                                                            |\n| `Alt` `E`    | Start or stop edit mode (alternative)                                                              |\n| `Ctrl` `Tab` | Switches between vertex select, edge select, and face select modes                                 |\n| `A`          | Select or unselect all                                                                             |\n| `B` `B`      | Circle select                                                                                      |\n| `Ctrl` `H`   | With vertices selected, this creates a hook object                                                 |\n| `N`          | Number panel, simpler than the object mode one                                                     |\n| `O`          | Switch in and out of proportional editing                                                          |\n| `Shift` `O`  | Toggles between smooth and sharp proportional editing                                              |\n| `P`          | Separate, you can choose to make a new object with all selected vertices, edges, faces, and curves |\n| `Ctrl` `P`   | Make vertex parent                                                                                 |\n| `Ctrl` `S`   | Shear, in edit mode this operation enables you to make selected forms slant                        |\n| `U`          | Undo                                                                                               |\n| `W`          | Displays specials popup menu                                                                       |\n| `Shift` `W`  | Warp, selected vertices can be bent into curves with this option                                   |\n\n{.shortcuts}\n\n### Edit Mode - Mesh\n\n| Shortcut           | Action                                                                                                                  |\n| ------------------ | ----------------------------------------------------------------------------------------------------------------------- |\n| `Ctrl` `+`         | Adds to selection all vertices connected by an edge to an already selected vertex                                       |\n| `Ctrl` `-`         | Removes from selection all vertices of the outer ring of selected vertices                                              |\n| `C`                | If using curve deformation, toggles the curve cyclic mode on or off                                                     |\n| `E`                | Extrude selected                                                                                                        |\n| `Shift` `E`        | Crease subsurf edge                                                                                                     |\n| `Ctrl` `E`         | Mark LSCM seam                                                                                                          |\n| `F`                | Make edge or face                                                                                                       |\n| `Shift` `F`        | Fill selected, all selected vertices that are bound by edges and form a closed polygon are filled with triangular faces |\n| `Alt` `F`          | Beauty fill, edges of all selected triangular faces are switched so equally sized faces are formed                      |\n| `Ctrl` `F`         | Flip faces, selected triangular faces are paired and common edge of each pair swapped                                   |\n| `H`                | Hide selected, all selected vertices and faces are hidden                                                               |\n| `Shift` `H`        | Hide not selected, all non-selected vertices and faces are hidden                                                       |\n| `Alt` `H`          | Reveal, all hidden vertices and faces are drawn again                                                                   |\n| `Alt` `J`          | Join faces, selected triangular faces are joined in pairs and transformed to quads                                      |\n| `K`                | Knife tool menu                                                                                                         |\n| `L`                | Select linked                                                                                                           |\n| `Shift` `L`        | Deselect linked                                                                                                         |\n| `Ctrl` `L`         | Select linked selected                                                                                                  |\n| `M`                | Mirror, opens a popup asking for the axis to mirror                                                                     |\n| `Alt` `M`          | Merges selected vertices as barycentrum or at cursor depending on selection made on popup                               |\n| `Ctrl` `N`         | Calculate normals outside                                                                                               |\n| `Ctrl` `Shift` `N` | Calculate normals inside                                                                                                |\n| `Alt` `S`          | Scales each vertex in the direction of its local normal                                                                 |\n| `Ctrl` `T`         | Make triangles, all selected faces are converted to triangles                                                           |\n| `U`                | Undo                                                                                                                    |\n| `Shift` `U`        | Redo                                                                                                                    |\n| `Alt` `U`          | Undo menu                                                                                                               |\n| `W`                | Special menu                                                                                                            |\n| `X`                | Erase selected                                                                                                          |\n| `Y`                | Split, this command splits the selected part of a mesh without deleting faces                                           |\n\n{.shortcuts}\n\n### Edit Mode - Curve\n\n| Shortcut    | Action                                                                                 |\n| ----------- | -------------------------------------------------------------------------------------- |\n| `C`         | Set the selected curves to cyclic or turn cyclic off                                   |\n| `E`         | Extrude curve                                                                          |\n| `F`         | Add segment, a segment is added between two selected vertices at the end of two curves |\n| `H`         | Toggle handle align or free                                                            |\n| `Shift` `H` | Set handle to auto                                                                     |\n| `Ctrl` `H`  | Calculate handles                                                                      |\n| `L`         | Select linked                                                                          |\n| `Shift` `L` | Deselect linked                                                                        |\n| `M`         | Mirror selected control points exactly as for vertices in a mesh                       |\n| `T`         | Tilt mode, specify an extra axis rotation for each vertex in a 3D curve                |\n| `Alt` `T`   | Clear tilt                                                                             |\n| `V`         | Vector handle                                                                          |\n| `W`         | The special menu for curves appears                                                    |\n| `X`         | Erase selected                                                                         |\n\n{.shortcuts}\n\n### Edit Mode - Surface\n\n| Shortcut    | Action                                                                                 |\n| ----------- | -------------------------------------------------------------------------------------- |\n| `C`         | Toggle cyclic menu                                                                     |\n| `E`         | Extrude selected                                                                       |\n| `F`         | Add segment, a segment is added between two selected vertices at the end of two curves |\n| `L`         | Select linked                                                                          |\n| `Shift` `L` | Deselect linked                                                                        |\n| `M`         | Mirror selected control points exactly as for vertices in a mesh                       |\n| `Shift` `R` | Select row, starting with the last selected vertex                                     |\n| `W`         | The special menu for surfaces appears                                                  |\n| `X`         | Erase selected                                                                         |\n\n{.shortcuts}\n\n### Edit Mode - Font\n\n| Shortcut        | Action                                        |\n| --------------- | --------------------------------------------- |\n| `Right`         | Move text cursor one position forward         |\n| `Shift` `Right` | Move text cursor to the end of the line       |\n| `Left`          | Move text cursor one position backwards       |\n| `Shift` `Left`  | Move text cursor to the start of the line     |\n| `Down`          | Move text cursor one line forward             |\n| `Shift` `Down`  | Move text cursor to the end of the text       |\n| `Up`            | Move text cursor one line back                |\n| `Shift` `Up`    | Move text cursor to the beginning of the text |\n| `Alt` `U`       | Reload original data                          |\n| `Alt` `V`       | Paste text                                    |\n\n{.shortcuts}\n\n### VertexPaint\n\n| Shortcut    | Action                                                                      |\n| ----------- | --------------------------------------------------------------------------- |\n| `Shift` `K` | All vertex colors are erased, they are changed to the current drawing color |\n| `U`         | Undo, press twice redos the undone                                          |\n| `W`         | Shared vertexcol, the colors of all faces that share vertices are blended   |\n\n{.shortcuts}\n\n### UV Editor\n\n| Shortcut  | Action                                                                                        |\n| --------- | --------------------------------------------------------------------------------------------- |\n| `E`       | LSCM unwrapping, launches on the faces visible in the UV editor                               |\n| `P`       | Pin selected vertices, they will stay in place on the UV editor when executing an LSCM unwrap |\n| `Alt` `P` | Un-pin selected vertices                                                                      |\n\n{.shortcuts}\n\n### FaceSelect\n\n| Shortcut | Action                                                                                                       |\n| -------- | ------------------------------------------------------------------------------------------------------------ |\n| `Tab`    | Switches to edit mode                                                                                        |\n| `F`      | With multiple, co-planar faces selected, this will merge them into one FGon so long as they remain co-planar |\n| `L`      | Select linked UVs                                                                                            |\n| `R`      | Calls a menu allowing to rotate the UV coordinates or the vertex col                                         |\n| `U`      | Calls the UV Calculation menu                                                                                |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Blender](https://download.blender.org/documentation/BlenderHotkeyReference.pdf)\n  _(download.blender.org)_\n"
  },
  {
    "path": "source/_posts/brave.md",
    "content": "---\ntitle: Brave Browser\ndate: 2022-11-23 16:23:31.698868\nbackground: bg-[#da6b37]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 64 keyboard shortcuts found in the Brave browser\n---\n\n## Keyboard Shortcuts {.cols-2}\n\n### Tabs and Windows\n\n| Shortcut             | Action                                                               |\n| -------------------- | -------------------------------------------------------------------- |\n| `Ctrl` `N`           | Open a new window                                                    |\n| `Ctrl` `Shift` `N`   | Open a new window in Private mode                                    |\n| `Ctrl` `T`           | Open a new tab, and jump to it                                       |\n| `Ctrl` `Shift` `T`   | Reopen the last closed tab, and jump to it                           |\n| `Ctrl` `Tab`         | Jump to the next open tab                                            |\n| `Ctrl` `Shift` `Tab` | Jump to the previous open tab                                        |\n| `Ctrl` `1-8`         | Jump to a specific tab                                               |\n| `Ctrl` `9`           | Jump to the last tab                                                 |\n| `Alt` `Home`         | Open your home page in the current tab                               |\n| `Ctrl` `Left`        | Open the previous page from your browsing history in the current tab |\n| `Alt` `Right`        | Open the next page from your browsing history in the current tab     |\n| `Ctrl` `W`           | Close the current tab                                                |\n| `Ctrl` `Shift` `W`   | Close the current window                                             |\n| `Alt` `Space` `N`    | Minimize the current window                                          |\n| `Alt` `Space` `X`    | Maximize the current window                                          |\n| `Alt` `F4`           | Close the current window                                             |\n| `Ctrl` `Shift` `Q`   | Quit Brave                                                           |\n\n{.shortcuts}\n\n### Browser\n\n| Shortcut                | Action                                             |\n| ----------------------- | -------------------------------------------------- |\n| `Alt` `F`               | Open the main menu                                 |\n| `Ctrl` `Shift` `B`      | Show or hide the bookmarks bar                     |\n| `Ctrl` `H`              | Open the history page in a new tab                 |\n| `Ctrl` `J`              | Open the downloads page in a new tab               |\n| `Shift` `Esc`           | Open the Brave task manager                        |\n| `Shift` `Alt` `T`       | Set focus on the first item in the toolbar         |\n| `F10`                   | Set focus on the last item in the toolbar          |\n| `F6`                    | Switch focus to unfocused dialog, if showing       |\n| `Ctrl` `F`              | Open the find bar to search the current page       |\n| `Ctrl` `G`              | Jump to the next match in your find bar search     |\n| `Ctrl` `Shift` `G`      | Jump to the previous match in your find bar search |\n| `Ctrl` `Shift` `J`      | Open developer tools                               |\n| `Ctrl` `Shift` `Delete` | Open the clear browser data options                |\n| `F1`                    | Open the Brave help center in a new tab            |\n| `Ctrl` `Shift` `M`      | Open profile menu                                  |\n| ``                      |\n\n{.shortcuts}\n\n### Address Bar\n\n| Shortcut         | Action                                                                          |\n| ---------------- | ------------------------------------------------------------------------------- |\n| `Enter`          | Search with your default search engine (after typing)                           |\n| `Tab`            | Search using a different search engine (after typing)                           |\n| `Ctrl` `Enter`   | Add www. and .com to a site name, and open it in the current tab (after typing) |\n| `Alt` `Enter`    | Open a new tab and perform a search (after typing)                              |\n| `Ctrl` `L`       | Jump to the address bar                                                         |\n| `Ctrl` `K`       | Search from anywhere on the page                                                |\n| `Shift` `Delete` | Remove predictions from your address bar (after highlighting them)              |\n\n{.shortcuts}\n\n### Webpage\n\n| Shortcut           | Action                                                             |\n| ------------------ | ------------------------------------------------------------------ |\n| `Ctrl` `P`         | Open options to print the current page                             |\n| `Ctrl` `S`         | Open options to save the current page                              |\n| `Ctrl` `R`         | Reload the current page                                            |\n| `Ctrl` `Shift` `R` | Reload the current page, ignoring cached content                   |\n| `Esc`              | Stop the page loading                                              |\n| `Tab`              | Browse clickable items moving forward                              |\n| `Shift` `Tab`      | Browse clickable items moving backwards                            |\n| `Ctrl` `O`         | Open a file from your computer in Brave                            |\n| `Ctrl` `U`         | Display non-editable HTML source code for the current page         |\n| `Ctrl` `D`         | Save your current webpage as a bookmark                            |\n| `Ctrl` `Shift` `D` | Save all open tabs as bookmarks in a new folder                    |\n| `F11`              | Turn full-screen mode on or off                                    |\n| `Ctrl` `+`         | Make everything on the page bigger                                 |\n| `Ctrl` `-`         | Make everything on the page smaller                                |\n| `Ctrl` `0`         | Return everything on the page to default size                      |\n| `Space`            | Scroll down a webpage, a screen at a time                          |\n| `Shift` `Space`    | Scroll up a webpage, a screen at a time                            |\n| `Home`             | Go to the top of the page                                          |\n| `End`              | Go to the bottom of the page                                       |\n| `Shift` `(scroll)` | Scroll horizontally on the page                                    |\n| `Alt` `Left`       | Move your cursor to the front of the previous word in a text field |\n| `Ctrl` `Right`     | Move your cursor to the back of the next word in a text field      |\n| `Ctrl` `Back`      | Delete the previous word in a text field                           |\n| `Alt` `Home`       | Open the home page in the current tab                              |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Brave](https://support.brave.com/hc/en-us/articles/360032272171-What-keyboard-shortcuts-can-I-use-in-Brave-)\n  _(support.brave.com)_\n"
  },
  {
    "path": "source/_posts/c.md",
    "content": "---\ntitle: C\ndate: 2022-12-30 09:51:44\nbackground: bg-[#2a338a]\ntags:\ncategories:\n  - Programming\nintro: |\n  C quick reference cheat sheet that provides basic syntax and methods.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### hello.c {.row-span-2}\n\n```c\n#include <stdio.h>\n\nint main(void) {\n  printf(\"Hello World!\\n\");\n\n  return 0;\n}\n```\n\nCompile `hello.c` file with `gcc`\n\n```bash\n$ gcc -Wall -g hello.c -o hello\n```\n\nRun the compiled binary `hello`\n\n```bash\n$ ./hello\n```\n\nOutput => Hello World!\n\n### Variables {.row-span-2}\n\n```c\nint myNum = 15;\n\nint myNum2; // do not assign, then assign\nmyNum2 = 15;\n\nint myNum3 = 15; // myNum3 is 15\nmyNum3 = 10;     // myNum3 is now 10\n\nfloat myFloat = 5.99; // floating point number\nchar myLetter = 'D';  // character\n\nint x = 5;\nint y = 6;\nint sum = x + y; // add variables to sum\n\n// declare multiple variables\nint a = 5, b = 6, c = 50;\n```\n\n### Constants\n\n```c\nconst int minutesPerHour = 60;\nconst float PI = 3.14;\n```\n\nBest Practices\n\n```c\nconst int BIRTHYEAR = 1980;\n```\n\n### Comment\n\n```c\n// this is a comment\nprintf(\"Hello World!\\n\"); // Can comment anywhere in file\n\n/*Multi-line comment, print Hello World!\nto the screen, it's awesome */\n```\n\n### Print text\n\n```c\nprintf(\"I am learning C.\\n\");\nint testInteger = 5;\nprintf(\"Number = %d\\n\", testInteger);\n\nfloat f = 5.99; // floating point number\nprintf(\"Value = %f\\n\", f);\n\nshort a = 0b1010110; // binary number\nint b = 02713; // octal number\nlong c = 0X1DAB83; // hexadecimal number\n\n// output in octal form\nprintf(\"a=%ho, b=%o, c=%lo\\n\", a, b, c);\n// output => a=126, b=2713, c=7325603\n\n// Output in decimal form\nprintf(\"a=%hd, b=%d, c=%ld\\n\", a, b, c);\n// output => a=86, b=1483, c=1944451\n\n// output in hexadecimal form (letter lowercase)\nprintf(\"a=%hx, b=%x, c=%lx\\n\", a, b, c);\n// output => a=56, b=5cb, c=1dab83\n\n// Output in hexadecimal (capital letters)\nprintf(\"a=%hX, b=%X, c=%lX\\n\", a, b, c);\n// output => a=56, b=5CB, c=1DAB83\n```\n\n### Control the number of spaces\n\n```c\nint a1 = 20, a2 = 345, a3 = 700;\nint b1 = 56720, b2 = 9999, b3 = 20098;\nint c1 = 233, c2 = 205, c3 = 1;\nint d1 = 34, d2 = 0, d3 = 23;\n\nprintf(\"%-9d %-9d %-9d\\n\", a1, a2, a3);\nprintf(\"%-9d %-9d %-9d\\n\", b1, b2, b3);\nprintf(\"%-9d %-9d %-9d\\n\", c1, c2, c3);\nprintf(\"%-9d %-9d %-9d\\n\", d1, d2, d3);\n```\n\noutput result\n\n```bash\n20        345       700\n56720     9999      20098\n233       205       1\n34        0         23\n```\n\nIn `%-9d`, `d` means to output in `10` base, `9` means to occupy at least `9` characters width, and the width is not\nenough to fill with spaces, `-` means left alignment\n\n### Strings\n\n```c\nchar greetings[] = \"Hello World!\";\nprintf(\"%s\", greetings);\n```\n\nAccess string\n\n```c\nchar greetings[] = \"Hello World!\";\nprintf(\"%c\", greetings[0]);\n```\n\nModify string\n\n```c\nchar greetings[] = \"Hello World!\";\ngreetings[0] = 'J';\n\nprintf(\"%s\", greetings);\n// prints \"Jello World!\"\n```\n\nAnother way to create a string\n\n```c\nchar greetings[] = {'H','e','l','l','\\0'};\n\nprintf(\"%s\", greetings);\n// print \"Hell!\"\n```\n\nCreating String using character pointer (String Literals)\n\n```c\nchar *greetings = \"Hello\";\nprintf(\"%s\", greetings);\n// print \"Hello!\"\n```\n\n**NOTE**: String literals might be stored in read-only section of memory. Modifying a string literal invokes undefined\nbehavior. You can't modify it!\n\n`C` **does not** have a String type, use `char` type and create an `array` of characters\n\n### Condition {.row-span-2}\n\n```c\nint time = 20;\nif (time < 18) {\n  printf(\"Goodbye!\\n\");\n} else {\n  printf(\"Good evening!\\n\");\n}\n// Output -> \"Good evening!\"\nint time = 22;\nif (time < 10) {\n  printf(\"Good morning!\\n\");\n} else if (time < 20) {\n  printf(\"Goodbye!\\n\");\n} else {\n  printf(\"Good evening!\\n\");\n}\n// Output -> \"Good evening!\"\n```\n\n### Ternary operator {.col-span-2}\n\n```c\nint age = 20;\n(age > 19) ? printf(\"Adult\\n\") : printf(\"Teenager\\n\");\n```\n\n### Switch\n\n```c\nint day = 4;\n\nswitch (day) {\n  case 3: printf(\"Wednesday\\n\"); break;\n  case 4: printf(\"Thursday\\n\"); break;\n  default:\n    printf(\"Weekend!\\n\");\n}\n// output -> \"Thursday\" (day 4)\n```\n\n### While Loop\n\n```c\nint i = 0;\n\nwhile (i < 5) {\n  printf(\"%d\\n\", i);\n  i++;\n}\n```\n\n**NOTE**: Don't forget to increment the variable used in the condition, otherwise the loop will never end and become an\n\"infinite loop\"!\n\n### Do/While Loop\n\n```c\nint i = 0;\n\ndo {\n  printf(\"%d\\n\", i);\n  i++;\n} while (i < 5);\n```\n\n### For Loop\n\n```c\nfor (int i = 0; i < 5; i++) {\n  printf(\"%d\\n\", i);\n}\n```\n\n### Break out of the loop Break/Continue {.row-span-2}\n\n```c\nfor (int i = 0; i < 10; i++) {\n  if (i == 4) {\n    break;\n  }\n  printf(\"%d\\n\", i);\n}\n```\n\nBreak out of the loop when `i` is equal to `4`\n\n```c\nfor (int i = 0; i < 10; i++) {\n  if (i == 4) {\n    continue;\n  }\n  printf(\"%d\\n\", i);\n}\n```\n\nExample to skip the value of `4`\n\n### While Break Example\n\n```c\nint i = 0;\n\nwhile (i < 10) {\n  if (i == 4) {\n    break;\n  }\n  printf(\"%d\\n\", i);\n\n  i++;\n}\n```\n\n### While continue example\n\n```c\nint i = 0;\n\nwhile (i < 10) {\n  i++;\n\n  if (i == 4) {\n    continue;\n  }\n  printf(\"%d\\n\", i);\n}\n```\n\n### Arrays {.row-span-2}\n\n```c\nint myNumbers[] = {25, 50, 75, 100};\n\nprintf(\"%d\", myNumbers[0]);\n// output 25\n```\n\nChange array elements\n\n```c\nint myNumbers[] = {25, 50, 75, 100};\nmyNumbers[0] = 33;\n\nprintf(\"%d\", myNumbers[0]);\n```\n\nLoop through the array\n\n```c\nint myNumbers[] = {25, 50, 75, 100};\nint i;\n\nfor (i = 0; i < 4; i++) {\n  printf(\"%d\\n\", myNumbers[i]);\n}\n```\n\nSet array size\n\n```c\n// Declare an array of four integers:\nint myNumbers[4];\n\n// add element\nmyNumbers[0] = 25;\nmyNumbers[1] = 50;\nmyNumbers[2] = 75;\nmyNumbers[3] = 100;\n```\n\n### Enumeration Enum {.col-span-2}\n\n```c\nenum week { Mon = 1, Tues, Wed, Thurs, Fri, Sat, Sun };\n```\n\nDefine enum variable\n\n```c\nenum week a, b, c;\nenum week { Mon = 1, Tues, Wed, Thurs, Fri, Sat, Sun } a, b, c;\n```\n\nWith an enumeration variable, you can assign the value in the list to it\n\n```c\nenum week { Mon = 1, Tues, Wed, Thurs, Fri, Sat, Sun };\nenum week a = Mon, b = Wed, c = Sat;\n// or\nenum week{ Mon = 1, Tues, Wed, Thurs, Fri, Sat, Sun } a = Mon, b = Wed, c = Sat;\n```\n\n### Enumerate sample applications\n\n```c\nenum week {Mon = 1, Tues, Wed, Thurs} day;\n\nscanf(\"%d\", &day);\n\nswitch(day) {\n  case Mon: puts(\"Monday\"); break;\n  case Tues: puts(\"Tuesday\"); break;\n  case Wed: puts(\"Wednesday\"); break;\n  case Thurs: puts(\"Thursday\"); break;\n  default: puts(\"Error!\");\n}\n```\n\n### User input\n\n```c\n// Create an integer variable to store the number we got from the user\nint myNum;\n\n// Ask the user to enter a number\nprintf(\"Enter a number: \");\n\n// Get and save the number entered by the user\nscanf(\"%d\", &myNum);\n\n// Output the number entered by the user\nprintf(\"The number you entered: %d\\n\", myNum);\n```\n\n### User input string\n\n```c\n// create a string\nchar firstName[30];\n// Ask the user to enter some text\nprintf(\"Enter your name: \");\n// get and save the text\nscanf(\"%s\", &firstName);\n// output text\nprintf(\"Hello %s.\\n\", firstName);\n```\n\n### memory address\n\nWhen a variable is created, it is assigned a memory address\n\n```c\nint myAge = 43;\n\nprintf(\"%p\", &myAge);\n// Output: 0x7ffe5367e044\n```\n\nTo access it, use the reference operator (`&`)\n\n### create pointer\n\n```c\nint myAge = 43; // an int variable\nprintf(\"%d\\n\", myAge); // output the value of myAge(43)\n\n// Output the memory address of myAge (0x7ffe5367e044)\nprintf(\"%p\\n\", &myAge);\n```\n\n### pointer variable {.col-span-2}\n\n```c\nint myAge = 43; // an int variable\nint*ptr = &myAge; // pointer variable named ptr, used to store the address of myAge\n\nprintf(\"%d\\n\", myAge); // print the value of myAge (43)\n\nprintf(\"%p\\n\", &myAge); // output the memory address of myAge (0x7ffe5367e044)\nprintf(\"%p\\n\", ptr); // use the pointer (0x7ffe5367e044) to output the memory address of myAge\n```\n\n### Dereference\n\n```c\nint myAge = 43; // variable declaration\nint*ptr = &myAge; // pointer declaration\n\n// Reference: output myAge with a pointer\n// memory address (0x7ffe5367e044)\nprintf(\"%p\\n\", ptr);\n// dereference: output the value of myAge with a pointer (43)\nprintf(\"%d\\n\", *ptr);\n```\n\n## Operators\n\n### Arithmetic Operators\n\n```c\nint myNum = 100 + 50;\nint sum1 = 100 + 50; // 150 (100 + 50)\nint sum2 = sum1 + 250; // 400 (150 + 250)\nint sum3 = sum2 + sum2; // 800 (400 + 400)\n```\n\n---\n\n| Operator | Name      | Example |\n| -------- | --------- | ------- |\n| `+`      | Add       | `x + y` |\n| `-`      | Subtract  | `x - y` |\n| `*`      | Multiply  | `x * y` |\n| `/`      | Divide    | `x / y` |\n| `%`      | Modulo    | `x % y` |\n| `++`     | Increment | `++x`   |\n| `--`     | Decrement | `--x`   |\n\n### Assignment operator\n\n| Example              | As                        |\n| -------------------- | ------------------------- |\n| x `=` 5              | x `=` 5                   |\n| x `+=` 3             | x `=` x `+` 3             |\n| x `-=` 3             | x `=` x `-` 3             |\n| x `*=` 3             | x `=` x `*` 3             |\n| x `/=` 3             | x `=` x `/` 3             |\n| x `%=` 3             | x `=` x `%` 3             |\n| x `&=` 3             | x `=` x `&` 3             |\n| x <code>\\|=</code> 3 | x `=` x <code>\\|</code> 3 |\n| x `^=` 3             | x `=` x `^` 3             |\n| x `>>=` 3            | x `=` x `>>` 3            |\n| x `<<=` 3            | x `=` x `<<` 3            |\n\n### Comparison Operators\n\n```c\nint x = 5;\nint y = 3;\n\nprintf(\"%d\", x > y);\n// returns 1 (true) because 5 is greater than 3\n```\n\n---\n\n| Symbol | Name                     | Example  |\n| ------ | ------------------------ | -------- |\n| `==`   | equals                   | x `==` y |\n| `!=`   | not equal to             | x `!=` y |\n| `>`    | greater than             | x `>` y  |\n| `<`    | less than                | x `<` y  |\n| `>=`   | greater than or equal to | x `>=` y |\n| `<=`   | less than or equal to    | x `<=` y |\n\nComparison operators are used to compare two values\n\n### Logical Operators {.col-span-2}\n\n| Symbol            | Name          | Description                                   | Example                       |\n| ----------------- | ------------- | --------------------------------------------- | ----------------------------- |\n| `&&`              | `and` logical | returns true if both statements are true      | `x < 5 && x < 10`             |\n| <code>\\|\\|</code> | `or` logical  | returns true if one of the statements is true | <code>x < 5 \\|\\| x < 4</code> |\n| `!`               | `not` logical | Invert result, return false if true           | `!(x < 5 && x < 10)`          |\n\n{.show-header}\n\n### Operator Examples {.row-span-2}\n\n```c\nunsigned int a = 60; /*60 = 0011 1100 */\nunsigned int b = 13; /*13 = 0000 1101 */\nint c = 0;\n\nc = a & b; /*12 = 0000 1100 */\nprintf(\"Line 1 -the value of c is %d\\n\", c);\n\nc = a | b; /*61 = 0011 1101 */\nprintf(\"Line 2 -the value of c is %d\\n\", c);\nc = a ^ b; /*49 = 0011 0001 */\nprintf(\"Line 3 -the value of c is %d\\n\", c);\nc = ~a; /*-61 = 1100 0011 */\nprintf(\"Line 4 -The value of c is %d\\n\", c);\nc = a << 2; /*240 = 1111 0000 */\nprintf(\"Line 5 -the value of c is %d\\n\", c);\nc = a >> 2; /*15 = 0000 1111 */\nprintf(\"Line 6 -The value of c is %d\\n\", c);\n```\n\n### Bitwise operators {.col-span-2}\n\n| Operator        | Description                                                     | Instance                                              |\n| :-------------- | :-------------------------------------------------------------- | :---------------------------------------------------- |\n| `&`             | Bitwise AND operation, \"AND\" operation by binary digits         | `(A & B)` will get `12` which is 0000 1100            |\n| <code>\\|</code> | Bitwise OR operator, \"or\" operation by binary digit             | <code>(A \\| B)</code> will get`61` which is 0011 1101 |\n| `^`             | XOR operator, perform \"XOR\" operation by binary digits          | `(A ^ B)` will get `49` which is 0011 0001            |\n| `~`             | Inversion operator, perform \"inversion\" operation by binary bit | `(~A)` will get `-61` which is 1100 0011              |\n| `<<`            | binary left shift operator                                      | `A << 2` will get `240` which is 1111 0000            |\n| `>>`            | binary right shift operator                                     | `A >> 2` will get `15` which is 0000 1111             |\n\n{.show-header}\n\n## Data Types\n\n### Basic data types {.col-span-2}\n\n| Data Type            | Size             | Range                              | Description                         |\n| -------------------- | ---------------- | ---------------------------------- | :---------------------------------- |\n| `char`               | 1 byte           | `−128` ~ `127`                     | single character/alphanumeric/ASCII |\n| `signed char`        | 1 byte           | `−128` ~ `127`                     |                                     |\n| `unsigned char`      | 1 byte           | `0` ~ `255`                        |                                     |\n| `int`                | `2` to `4` bytes | `−32,768` ~ `32,767`               | store integers                      |\n| `signed int`         | 2 bytes          | `−32,768` ~ `32,767`               |                                     |\n| `unsigned int`       | 2 bytes          | `0` ~ `65,535`                     |                                     |\n| `short int`          | 2 bytes          | `−32,768` ~ `32,767`               |                                     |\n| `signed short int`   | 2 bytes          | `−32,768` ~ `32,767`               |                                     |\n| `unsigned short int` | 2 bytes          | `0` ~ `65,535`                     |                                     |\n| `long int`           | 4 bytes          | `-2,147,483,648` ~ `2,147,483,647` |                                     |\n| `signed long int`    | 4 bytes          | `-2,147,483,648` ~ `2,147,483,647` |                                     |\n| `unsigned long int`  | 4 bytes          | `0` ~ `4,294,967,295`              |                                     |\n| `float`              | 4 bytes          | `3.4E-38` ~ `3.4E+38`              |                                     |\n| `double`             | 8 bytes          | `1.7E-308` ~ `1.7E+308`            |                                     |\n| `long double`        | 10 bytes         | `3.4E-4932` ~ `1.1E+4932`          |                                     |\n\n{.show-header}\n\n### Data types\n\n```c\n// create variables\nint myNum = 5; // integer\nfloat myFloatNum = 5.99; // floating point number\nchar myLetter = 'D'; // string\n// High precision floating point data or numbers\ndouble myDouble = 3.2325467;\n// print output variables\nprintf(\"%d\\n\", myNum);\nprintf(\"%f\\n\", myFloatNum);\nprintf(\"%c\\n\", myLetter);\nprintf(\"%lf\\n\", myDouble);\n```\n\n---\n\n| Data Type | Description                          |\n| :-------- | :----------------------------------- |\n| `char`    | character type                       |\n| `short`   | short integer                        |\n| `int`     | integer type                         |\n| `long`    | long integer                         |\n| `float`   | single-precision floating-point type |\n| `double`  | double-precision floating-point type |\n| `void`    | no type                              |\n\n### Basic format specifiers\n\n| Format Specifier | Data Type                                             |\n| ---------------- | :---------------------------------------------------- |\n| `%d` or `%i`     | `int` integer                                         |\n| `%f`             | `float` single-precision decimal type                 |\n| `%lf`            | `double` high precision floating point data or number |\n| `%c`             | `char` character                                      |\n| `%s`             | for `strings` strings                                 |\n\n{.show-header}\n\n### Separate base format specifiers\n\n| Format      | Short         | Int         | Long          |\n| ----------- | ------------- | ----------- | :------------ |\n| Octal       | `%ho`         | `%o`        | `%lo`         |\n| Decimal     | `%hd`         | `%d`        | `%ld`         |\n| Hexadecimal | `%hx` / `%hX` | `%x` / `%X` | `%lx` / `%lX` |\n\n{.show-header}\n\n### Data format example\n\n```c\nint myNum = 5;\nfloat myFloatNum = 5.99; // floating point number\nchar myLetter = 'D';     // string\n// print output variables\nprintf(\"%d\\n\", myNum);\nprintf(\"%f\\n\", myFloatNum);\nprintf(\"%c\\n\", myLetter);\n```\n\n## C Preprocessor\n\n### Preprocessor Directives {.row-span-2}\n\n| Directive  | Description                                                          |\n| ---------- | :------------------------------------------------------------------- |\n| `#define`  | define a macro                                                       |\n| `#include` | include a source code file                                           |\n| `#undef`   | undefined macro                                                      |\n| `#ifdef`   | Returns true if the macro is defined                                 |\n| `#ifndef`  | Returns true if the macro is not defined                             |\n| `#if`      | Compile the following code if the given condition is true            |\n| `#else`    | Alternative to `#if`                                                 |\n| `#elif`    | If the `#if` condition is false, the current condition is `true`     |\n| `#endif`   | End a `#if...#else` conditional compilation block                    |\n| `#error`   | Print an error message when standard error is encountered            |\n| `#pragma`  | Issue special commands to the compiler using the standardized method |\n\n{.show-header}\n\n```c\n// replace all MAX_ARRAY_LENGTH with 20\n#define MAX_ARRAY_LENGTH 20\n// Get stdio.h from the system library\n#include <stdio.h>\n// Get myheader.h in the local directory\n#include \"myheader.h\"\n#undef FILE_SIZE\n#define FILE_SIZE 42 // undefine and define to 42\n```\n\n### Predefined macros {.row-span-2}\n\n| Macro      | Description                                                           |\n| ---------- | :-------------------------------------------------------------------- |\n| `__DATE__` | The current date, a character constant in the format \"MMM DD YYYY\"    |\n| `__TIME__` | The current time, a character constant in the format \"HH:MM:SS\"       |\n| `__FILE__` | This will contain the current filename, a string constant             |\n| `__LINE__` | This will contain the current line number, a decimal constant         |\n| `__STDC__` | Defined as `1` when the compiler compiles against the `ANSI` standard |\n\n{.show-header}\n\n`ANSI C` defines a number of macros that you can use, but you cannot directly modify these predefined macros\n\n#### Predefined macro example\n\n```c\n#include <stdio.h>\n\nint main(void) {\n  printf(\"File: %s\\n\", __FILE__);\n  printf(\"Date: %s\\n\", __DATE__);\n  printf(\"Time: %s\\n\", __TIME__);\n  printf(\"Line: %d\\n\", __LINE__);\n  printf(\"ANSI: %d\\n\", __STDC__);\n}\n```\n\n### Macro continuation operator (\\\\)\n\nA macro is usually written on a single line.\n\n```c\n#define message_for(a, b) \\\n    printf(#a \" and \" #b \": We love you!\\n\")\n```\n\nIf the macro is too long to fit on a single line, use the macro continuation operator `\\`\n\n### String Constantization Operator (#)\n\n```c\n#include <stdio.h>\n\n#define message_for(a, b) \\\n  printf(#a \" and \" #b \": We love you!\\n\")\n\nint main(void) {\n  message_for(Carole, Debra);\n\n  return 0;\n}\n```\n\nWhen the above code is compiled and executed, it produces the following result:\n\n```\nCarole and Debra: We love you!\n```\n\nWhen you need to convert a macro parameter to a string constant, use the string constant operator `#`\n\n### tag paste operator (##)\n\n```c\n#include <stdio.h>\n\n#define tokenpaster(n) printf (\"Token \" #n \" = %d\\n\", token##n)\n\nint main(void) {\n  int token34 = 40;\n  tokenpaster(34);\n\n  return 0;\n}\n```\n\n### defined() operator\n\n```c\n#include <stdio.h>\n\n#if !defined (MESSAGE)\n   #define MESSAGE \"You wish!\"\n#endif\n\nint main(void) {\n  printf(\"Here is the message: %s\\n\", MESSAGE);\n\n  return 0;\n}\n```\n\n### Parameterized macros\n\n```c\nint square(int x) {\n  return x * x;\n}\n```\n\nThe macro rewrites the above code as follows:\n\n```c\n#define square(x) ( (x) * (x) )\n```\n\nNo spaces are allowed between the macro name and the opening parenthesis\n\n```c\n#include <stdio.h>\n#define MAX(x,y) ( (x) > (y) ? (x) : (y) )\n\nint main(void) {\n  printf(\"Max between 20 and 10 is %d\\n\", MAX(10, 20));\n\n  return 0;\n}\n```\n\n## C Function\n\n### Function declaration and definition {.row-span-2}\n\n```c\nint main(void) {\n  printf(\"Hello World!\\n\");\n\n  return 0;\n}\n```\n\nThe function consists of two parts\n\n```c\nvoid myFunction() { // declaration declaration\n  // function body (code to be executed) (definition)\n}\n```\n\n---\n\n- `Declaration` declares the function name, return type and parameters _(if any)_\n- `Definition` function body _(code to execute)_\n\n---\n\n```c\n// function declaration\nvoid myFunction();\n// main method\nint main() {\n  myFunction(); // --> call the function\n\n  return 0;\n}\n\nvoid myFunction() {// Function definition\n  printf(\"Good evening!\\n\");\n}\n```\n\n### Call function\n\n```c\n// create function\nvoid myFunction() {\n  printf(\"Good evening!\\n\");\n}\n\nint main() {\n  myFunction(); // call the function\n  myFunction(); // can be called multiple times\n\n  return 0;\n}\n// Output -> \"Good evening!\"\n// Output -> \"Good evening!\"\n```\n\n### Function parameters\n\n```c\nvoid myFunction(char name[]) {\n  printf(\"Hello %s\\n\", name);\n}\n\nint main() {\n  myFunction(\"Liam\");\n  myFunction(\"Jenny\");\n\n  return 0;\n}\n// Hello Liam\n// Hello Jenny\n```\n\n### Multiple parameters\n\n```c\nvoid myFunction(char name[], int age) {\n  printf(\"Hi %s, you are %d years old.\\n\",name,age);\n}\nint main() {\n  myFunction(\"Liam\", 3);\n  myFunction(\"Jenny\", 14);\n\n  return 0;\n}\n// Hi Liam you are 3 years old.\n// Hi Jenny you are 14 years old.\n```\n\n### Return value {.row-span-2}\n\n```c\nint myFunction(int x) {\n  return 5 + x;\n}\n\nint main() {\n  printf(\"Result: %d\\n\", myFunction(3));\n  return 0;\n}\n// output 8 (5 + 3)\n```\n\nTwo parameters\n\n```c\nint myFunction(int x, int y) {\n  return x + y;\n}\n\nint main() {\n  printf(\"Result: %d\\n\", myFunction(5, 3));\n  // store the result in a variable\n  int result = myFunction(5, 3);\n  printf(\"Result = %d\\n\", result);\n\n  return 0;\n}\n// result: 8 (5 + 3)\n// result = 8 (5 + 3)\n```\n\n### Recursive example\n\n```c\nint sum(int k);\n\nint main() {\n  int result = sum(10);\n  printf(\"%d\\n\", result);\n\n  return 0;\n}\n\nint sum(int k) {\n  if (k > 0) {\n    return k + sum(k -1);\n  } else {\n    return 0;\n  }\n}\n```\n\n### Mathematical functions\n\n```c\n#include <math.h>\n\nvoid main(void) {\n  printf(\"%f\\n\", sqrt(16)); // square root\n  printf(\"%f\\n\", ceil(1.4)); // round up (round)\n  printf(\"%f\\n\", floor(1.4)); // round down (round)\n  printf(\"%f\\n\", pow(4, 3)); // x(4) to the power of y(3)\n}\n```\n\n---\n\n- `abs(x)` absolute value\n- `acos(x)` arc cosine value\n- `asin(x)` arc sine\n- `atan(x)` arc tangent\n- `cbrt(x)` cube root\n- `cos(x)` cosine\n- the value of `exp(x)` Ex\n- `sin(x)` the sine of x\n- tangent of `tan(x)` angle\n\n## C Structures\n\n### Create structure\n\n```c\nstruct MyStructure { // structure declaration\n  int myNum; // member (int variable)\n  char myLetter; // member (char variable)\n}; // end the structure with a semicolon\n```\n\nCreate a struct variable called `s1`\n\n```c{7}\nstruct myStructure {\n  int myNum;\n  char myLetter;\n};\n\nint main() {\n  struct myStructure s1;\n\n  return 0;\n}\n```\n\n### Strings in the structure\n\n```c{9}\nstruct myStructure {\n  int myNum;\n  char myLetter;\n  char myString[30]; // String\n};\n\nint main() {\n  struct myStructure s1;\n  strcpy(s1. myString, \"Some text\");\n  // print value\n  printf(\"My string: %s\\n\", s1.myString);\n\n  return 0;\n}\n```\n\nAssigning values to strings using the `strcpy` function\n\n### Accessing structure members {.row-span-2}\n\n```c{11,12,16}\n// create a structure called myStructure\nstruct myStructure {\n  int myNum;\n  char myLetter;\n};\n\nint main() {\n  // Create a structure variable called myStructure called s1\n  struct myStructure s1;\n  // Assign values ​​to the members of s1\n  s1.myNum = 13;\n  s1.myLetter = 'B';\n\n  // Create a structure variable of myStructure called s2\n  // and assign it a value\n  struct myStructure s2 = {13, 'B'};\n  // print value\n  printf(\"My number: %d\\n\", s1.myNum);\n  printf(\"My letter: %c\\n\", s1.myLetter);\n\n  return 0;\n}\n```\n\nCreate different structure variables\n\n```c\nstruct myStructure s1;\nstruct myStructure s2;\n// Assign values ​​to different structure variables\ns1.myNum = 13;\ns1.myLetter = 'B';\n\ns2.myNum = 20;\ns2.myLetter = 'C';\n```\n\n### Copy structure\n\n```c{6}\nstruct myStructure s1 = {\n  13, 'B', \"Some text\"\n};\n\nstruct myStructure s2;\ns2 = s1;\n```\n\nIn the example, the value of `s1` is copied to `s2`\n\n### Modify value\n\n```c{6,7}\n// Create a struct variable and assign it a value\nstruct myStructure s1 = {\n  13, 'B'\n};\n// modify the value\ns1.myNum = 30;\ns1.myLetter = 'C';\n// print value\nprintf(\"%d %c\",\n    s1.myNum,\n    s1.myLetter);\n```\n\n## File Processing\n\n### File processing function\n\n| Function    | Description                                       |\n| ----------- | :------------------------------------------------ |\n| `fopen()`   | `open` a new or existing file                     |\n| `fprintf()` | write data to `file`                              |\n| `fscanf()`  | `read` data from a file                           |\n| `fputc()`   | write a character to `file`                       |\n| `fgetc()`   | `read` a character from a file                    |\n| `fclose()`  | `close` the file                                  |\n| `fseek()`   | set the file pointer to `the given position`      |\n| `fputw()`   | Write an integer `to` a file                      |\n| `fgetw()`   | `read` an integer from a file                     |\n| `ftell()`   | returns the current `position`                    |\n| `rewind()`  | set the file pointer to the beginning of the file |\n\n{.show-header}\n\nThere are many functions in the C library to `open`/`read`/`write`/`search` and `close` files\n\n### Open mode parameter\n\n| Mode  | Description                                                                                                 |\n| ----- | :---------------------------------------------------------------------------------------------------------- |\n| `r`   | Open a text file in `read` mode, allowing the file to be read                                               |\n| `w`   | Open a text file in `write` mode, allowing writing to the file                                              |\n| `a`   | Open a text file in `append` mode<br /><small>If the file does not exist, a new one will be created</small> |\n| `r+`  | Open a text file in `read-write` mode, allowing reading and writing of the file                             |\n| `w+`  | Open a text file in `read-write` mode, allowing reading and writing of the file                             |\n| `a+`  | Open a text file in `read-write` mode, allowing reading and writing of the file                             |\n| `rb`  | Open a binary file in `read` mode                                                                           |\n| `wb`  | Open binary file in `write` mode                                                                            |\n| `ab`  | Open a binary file in `append` mode                                                                         |\n| `rb+` | open binary file in `read-write` mode                                                                       |\n| `wb+` | Open binary file in `read-write` mode                                                                       |\n| `ab+` | open binary file in `read-write` mode                                                                       |\n\n{.show-header}\n\n### Open the file: fopen()\n\n```c{6}\n#include <stdio.h>\n\nvoid main() {\n  FILE *fp;\n  char ch;\n\n  fp = fopen(\"file_handle.c\", \"r\");\n\n  while (1) {\n    ch = fgetc(fp);\n    if (ch == EOF)\n      break;\n    printf(\"%c\", ch);\n  }\n  fclose(fp);\n}\n```\n\nAfter performing all operations on the file, the file must be closed with `fclose()`\n\n### Write to file: fprintf()\n\n```c{7}\n#include <stdio.h>\n\nvoid main() {\n  FILE *fp;\n  fp = fopen(\"file.txt\", \"w\"); // open the file\n\n  // write data to file\n  fprintf(fp, \"Hello file for fprintf..\\n\");\n  fclose(fp); // close the file\n}\n```\n\n### Read the file: fscanf()\n\n```c{6}\n#include <stdio.h>\n\nvoid main() {\n  FILE *fp;\n\n  char buff[255]; // Create a char array to store file data\n  fp = fopen(\"file.txt\", \"r\");\n\n  while(fscanf(fp, \"%s\", buff) != EOF) {\n    printf(\"%s \", buff);\n  }\n  fclose(fp);\n}\n```\n\n### Write to file: fputc()\n\n```c{6}\n#include <stdio.h>\n\nvoid main() {\n  FILE *fp;\n  fp = fopen(\"file1.txt\", \"w\"); // open the file\n  fputc('a',fp); // write a single character to the file\n  fclose(fp); // close the file\n}\n```\n\n### Read the file: fgetc()\n\n```c{8}\n#include <stdio.h>\n#include <conio.h>\n\nvoid main() {\n  FILE *fp;\n  char c;\n\n  clrscr();\n\n  fp = fopen(\"myfile.txt\", \"r\");\n\n  while( (c = fgetc(fp) ) != EOF) {\n    printf(\"%c\", c);\n  }\n  fclose(fp);\n\n  getch();\n}\n```\n\n### Write to file: fputs()\n\n```c {8}\n#include<stdio.h>\n#include<conio.h>\n\nvoid main() {\n  FILE *fp;\n\n  clrscr();\n\n  fp = fopen(\"myfile2.txt\",\"w\");\n  fputs(\"hello c programming\",fp);\n  fclose(fp);\n\n  getch();\n}\n```\n\n### Read files: fgets()\n\n```c {10}\n#include<stdio.h>\n#include<conio.h>\n\nvoid main() {\n  FILE *fp;\n  char text[300];\n\n  clrscr();\n\n  fp = fopen(\"myfile2.txt\", \"r\");\n  printf(\"%s\", fgets(text, 200, fp));\n  fclose(fp);\n\n  getch();\n}\n```\n\n### fseek()\n\n```c{8}\n#include <stdio.h>\n\nvoid main(void) {\n  FILE *fp;\n\n  fp = fopen(\"myfile.txt\",\"w+\");\n  fputs(\"This is Book\", fp);\n\n  // Set file pointer to the given position\n  fseek(fp, 7, SEEK_SET);\n\n  fputs(\"Kenny Wong\", fp);\n  fclose(fp);\n}\n```\n\nSet the file pointer to the given position\n\n### rewind()\n\n```c{11}\n#include <stdio.h>\n#include <conio.h>\n\nvoid main() {\n  FILE *fp;\n  char c;\n\n  clrscr();\n\n  fp = fopen(\"file.txt\", \"r\");\n\n  while( (c = fgetc(fp) ) != EOF) {\n    printf(\"%c\", c);\n  }\n\n  rewind(fp); // move the file pointer to the beginning of the file\n\n  while( (c = fgetc(fp) ) != EOF) {\n    printf(\"%c\", c);\n  }\n  fclose(fp);\n\n  getch();\n}\n// output\n// Hello World! Hello World!\n```\n\n### ftell()\n\n```c{11}\n#include <stdio.h>\n#include <conio.h>\n\nvoid main () {\n   FILE *fp;\n   int length;\n\n   clrscr();\n\n   fp = fopen(\"file.txt\", \"r\");\n\n   fseek(fp, 0, SEEK_END);\n   length = ftell(fp); // return current position\n   fclose(fp);\n\n   printf(\"File size: %d bytes\", length);\n\n   getch();\n}\n// output\n// file size: 18 bytes\n```\n"
  },
  {
    "path": "source/_posts/canvas.md",
    "content": "---\ntitle: HTML Canvas\ndate: 2024-05-28 22:16:42\nbackground: bg-[#cc5534]\ntags:\n  - web\ncategories:\n  - Programming\nintro: |\n  This HTML  Canvas quick reference cheat sheet lists the common HTML5  Canvas design tags in readable layout.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### Basic Setup\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <title>Canvas Example</title>\n  </head>\n  <body>\n    <canvas\n      id=\"myCanvas\"\n      width=\"500\"\n      height=\"400\"\n      style=\"border:1px solid #000000;\"\n    ></canvas>\n    <script src=\"script.js\"></script>\n  </body>\n</html>\n```\n\n### Getting the Context\n\n```js\nconst canvas = document.getElementById('myCanvas');\nconst ctx = canvas.getContext('2d');\n```\n\n## Drawing Shapes\n\n### Rectangles\n\n```js\nctx.fillStyle = 'red';\nctx.fillRect(10, 10, 150, 100); // x, y, width, height\n\nctx.strokeStyle = 'blue';\nctx.lineWidth = 5;\nctx.strokeRect(200, 10, 150, 100); // x, y, width, height\n\nctx.clearRect(15, 15, 30, 30); // x, y, width, height\n```\n\n## Paths\n\n### Lines\n\n```js\nctx.beginPath();\nctx.moveTo(50, 50); // Starting point\nctx.lineTo(200, 50); // Ending point\nctx.lineTo(200, 200); // Next line ending point\nctx.closePath(); // Connects the end point to the start point\nctx.stroke();\n```\n\n### Circles\n\n```js\nctx.beginPath();\nctx.arc(150, 150, 75, 0, 2 * Math.PI); // x, y, radius, startAngle, endAngle\nctx.fillStyle = 'green';\nctx.fill();\nctx.stroke();\n```\n\n### Arcs\n\n```js\nctx.beginPath();\nctx.arc(150, 150, 75, 0, Math.PI); // x, y, radius, startAngle, endAngle\nctx.stroke();\n```\n\n## Bezier and Quadratic Curves\n\n### Quadratic Curve\n\n```js\nctx.beginPath();\nctx.moveTo(50, 250);\nctx.quadraticCurveTo(200, 100, 400, 250); // cpX, cpY, endX, endY\nctx.stroke();\n```\n\n### Bezier Curve\n\n```js\nctx.beginPath();\nctx.moveTo(50, 300);\nctx.bezierCurveTo(150, 100, 350, 500, 450, 300); // cp1X, cp1Y, cp2X, cp2Y, endX, endY\nctx.stroke();\n```\n\n### Text\n\n```js\nctx.font = '30px Arial';\nctx.fillStyle = 'black';\nctx.fillText('Hello Canvas', 10, 50); // text, x, y\n\nctx.strokeText('Hello Canvas', 10, 100); // text, x, y\n```\n\n### Images\n\n```js\nconst img = new Image();\nimg.src = 'path/to/image.jpg';\nimg.onload = () => {\n  ctx.drawImage(img, 10, 10); // img, x, y\n  ctx.drawImage(img, 50, 50, 100, 100); // img, x, y, width, height\n  ctx.drawImage(img, 100, 100, 100, 100, 150, 150, 200, 200); // img, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight\n};\n```\n\n## Transformations\n\n### Translation\n\n```js\nctx.translate(100, 100); // x, y\nctx.fillRect(0, 0, 50, 50);\n```\n\n### Rotation\n\n```js\nctx.rotate((Math.PI / 180) * 45); // Angle in radians\nctx.fillRect(100, 100, 50, 50);\n```\n\n### Scaling\n\n```js\nctx.scale(2, 2); // x, y\nctx.fillRect(50, 50, 50, 50);\n```\n\n## Gradients\n\n### Linear Gradient\n\n```js\nconst linearGradient = ctx.createLinearGradient(0, 0, 200, 0); // x0, y0, x1, y1\nlinearGradient.addColorStop(0, 'red');\nlinearGradient.addColorStop(1, 'blue');\nctx.fillStyle = linearGradient;\nctx.fillRect(10, 10, 200, 100);\n```\n\n### Radial Gradient\n\n```js\nconst radialGradient = ctx.createRadialGradient(75, 50, 5, 90, 60, 100); // x0, y0, r0, x1, y1, r1\nradialGradient.addColorStop(0, 'red');\nradialGradient.addColorStop(1, 'blue');\nctx.fillStyle = radialGradient;\nctx.fillRect(10, 10, 200, 100);\n```\n\n### Patterns\n\n```js\nconst img = new Image();\nimg.src = 'path/to/image.jpg';\nimg.onload = () => {\n  const pattern = ctx.createPattern(img, 'repeat'); // 'repeat', 'repeat-x', 'repeat-y', 'no-repeat'\n  ctx.fillStyle = pattern;\n  ctx.fillRect(0, 0, 300, 300);\n};\n```\n\n### Shadows\n\n```js\nctx.shadowColor = 'rgba(0, 0, 0, 0.5)';\nctx.shadowBlur = 10;\nctx.shadowOffsetX = 5;\nctx.shadowOffsetY = 5;\n\nctx.fillStyle = 'red';\nctx.fillRect(100, 100, 100, 100);\n```\n\n## Compositing\n\n### Global Alpha\n\n```js\nctx.globalAlpha = 0.5;\nctx.fillStyle = 'red';\nctx.fillRect(100, 100, 100, 100);\n\nctx.fillStyle = 'blue';\nctx.fillRect(150, 150, 100, 100);\n```\n\n### Global Composite Operation\n\n```js\nctx.globalCompositeOperation = 'source-over'; // Default\nctx.fillStyle = 'red';\nctx.fillRect(100, 100, 100, 100);\n\nctx.globalCompositeOperation = 'destination-over';\nctx.fillStyle = 'blue';\nctx.fillRect(150, 150, 100, 100);\n```\n\n### Animations\n\n```js\nlet x = 0;\nfunction draw() {\n  ctx.clearRect(0, 0, canvas.width, canvas.height);\n  ctx.fillStyle = 'blue';\n  ctx.fillRect(x, 100, 50, 50);\n  x += 2;\n  requestAnimationFrame(draw);\n}\ndraw();\n```\n\n## Also read\n\n- [MDN doc ](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API)\n"
  },
  {
    "path": "source/_posts/chatgpt.md",
    "content": "---\ntitle: ChatGPT\ndate: 2023-02-09 10:28:43\nbackground: bg-[#4aa181]\ntags:\n  - AI\n  - OpenAI\n  - Prompts\n  - Tips\ncategories:\n  - Toolkit\nintro: This cheat sheet lists out prompts and tips from all over the world on how to use ChatGPT effectively\nplugins:\n  - copyCode\n---\n\n## Glossary\n\n### AI\n\n- Prompt: input or query that guides an AI model in generating a\n  response.[[s]](https://time.com/collections/the-ai-dictionary-from-allbusiness-com/7273982/definition-of-prompt-ai-prompt)\n- Tokens: the smallest units of text processed by an AI model (e.g., words, subwords, characters, and punctuation marks)\n  that varies depending on the model and the tokenization\n  method.[[s]](https://time.com/collections/the-ai-dictionary-from-allbusiness-com/7273998/definition-of-token/)\n- Token Limit: the maximum number of tokens an AI model can process in one\n  interaction.[[s]](https://time.com/collections/the-ai-dictionary-from-allbusiness-com/7273998/definition-of-token/)\n- Artificial intelligence (AI): technology that enables machines to simulate human cognition (e.g., human learning,\n  comprehension, problem solving, decision making, creativity, and\n  autonomy).[[s]](https://www.ibm.com/think/topics/artificial-intelligence)\n- AI Model: program trained on a set of data to recognize patterns or make decisions without further human\n  intervention.[[s]](https://www.ibm.com/think/topics/ai-model)\n- Large language model (LLM): transformer-based AI model trained on large text datasets to understand and generate\n  natural language.[[s]](https://www.ibm.com/think/topics/large-language-models)\n- Hallucination: AI response that detects nonexistent patterns and creates outputs that are nonsensical and\n  inaccurate.[[s]](https://www.ibm.com/think/topics/ai-hallucinations)\n- Jailbreak: exploiting vulnerabilities in AI systems to bypass their ethical guidelines and perform restricted\n  actions.[[s]](https://www.ibm.com/think/insights/ai-jailbreak)\n\n### Prompt Engineering Techniques\n\n- Zero-shot: prompt with no examples.[[s]](https://www.ibm.com/think/topics/zero-shot-prompting)\n- One-shot: prompt with one example.[[s]](https://www.ibm.com/think/topics/one-shot-prompting)\n- Few-shot: prompt with multiple examples.[[s]](https://www.ibm.com/think/topics/few-shot-prompting)\n- Chain of thought: prompt guiding the model to break down complex reasoning into intermediate\n  steps.[[s]](https://cloud.google.com/discover/what-is-prompt-engineering?hl=en)\n\n### Modes\n\n- Study and learn: interactive learning that encourages step by step problem solving instead of giving direct\n  answers.[[s]](https://openai.com/index/chatgpt-study-mode/)\n- Create image: generate images from text\n  prompts.[[s]](https://help.openai.com/en/articles/9260256-chatgpt-capabilities-overview)\n- Think longer: performs deeper reasoning and generates more accurate, thoughtful, and detailed\n  responses.[[s]](https://openai.com/index/introducing-gpt-5)\n- Deep research: reads and synthesizes content across multiple online sources and produces cited structured\n  outputs.[[s]](https://help.openai.com/en/articles/9260256-chatgpt-capabilities-overview)\n- Web search: finds recent and real-time information\n  online.[[s]](https://help.openai.com/en/articles/9260256-chatgpt-capabilities-overview)\n- Canvas: separate interface for collaborative writing and coding that provides inline editing, suggestions, and\n  feedback.[[s]](https://openai.com/index/introducing-canvas/)\n\n## Prompt Tips\n\n### Efficiency\n\n- Use the latest model as it's generally more capable and easier to\n  prompt.[[s]](https://help.openai.com/en/articles/6654000-best-practices-for-prompt-engineering-with-the-openai-api)\n- Provide general instructions at the start of conversations or when changing direction to avoid repeating them.\n- Don't say polite phrases to the AI (e.g., please, thank you) as it adds unecessary computational\n  costs.[[s]](https://www.techradar.com/computing/artificial-intelligence/chatgpt-spends-tens-of-millions-of-dollars-on-people-playing-please-and-thank-you-but-sam-altman-says-its-worth-it?utm_source=chatgpt.com)\n- Don't explicitly ask the AI for help (e.g., can you help me do x?).\n- Don't explicitly reference yourself unless clarifying multiple entities (e.g., I want to, do x for me).\n\n### Clarity\n\n- Be clear, specific, and provide enough context for the model to understand what you are\n  asking.[[s]](https://help.openai.com/en/articles/10032626-prompt-engineering-best-practices-for-chatgpt)\n- Prompt engineering often requires iterative refinement by adjusting wording, adding context, and simplifying\n  requests.[[s]](https://help.openai.com/en/articles/10032626-prompt-engineering-best-practices-for-chatgpt)\n- Break complex tasks into smaller focused\n  prompts.[[s]](https://help.openai.com/en/articles/4936848-how-do-i-create-a-good-prompt-for-an-ai-model)\n- Specify focus areas, highlight important aspects, and ask for multiple\n  options.[[s]](https://help.openai.com/en/articles/4936848-how-do-i-create-a-good-prompt-for-an-ai-model)\n- Provide examples of the desired output format to improve\n  accuracy.[[s]](https://help.openai.com/en/articles/6654000-best-practices-for-prompt-engineering-with-the-openai-api)\n- Focus on specifying what to do and not just what to\n  avoid.[[s]](https://help.openai.com/en/articles/6654000-best-practices-for-prompt-engineering-with-the-openai-api)\n- Before writing a prompt, identify the goal and expected\n  output.[[s]](https://www.techtarget.com/searchenterpriseai/definition/AI-prompt)\n- Provide important keywords or phrases where possible to faciliate SEO and communicate term preferences to the AI\n  model.[[s]](https://www.techtarget.com/searchenterpriseai/definition/AI-prompt)\n- Keep prompts precise and clean by omitting unnecessary or redundant\n  information.[[s]](https://www.techtarget.com/searchenterpriseai/definition/AI-prompt)\n- Avoid conflicting terms that might confuse the\n  AI.[[s]](https://www.techtarget.com/searchenterpriseai/definition/AI-prompt)\n- Open-ended questions usually provide more detailed responses than [closed-ended questions] and yes/no\n  questions.[[s]](https://www.techtarget.com/searchenterpriseai/definition/AI-prompt)\n- When in doubt, ask AI to generate prompts for\n  you.[[s]](https://www.techtarget.com/searchenterpriseai/definition/AI-prompt)\n\n### Security\n\n- Don't share sensitive information with AI as you can't be certain how it's stored, if it will be shared, of if it's\n  vulnerable to data\n  breaches.[[s]](https://www.grantthornton.com/insights/articles/advisory/2023/anticipate-cybersecurity-and-privacy-risks-in-ai)\n\n## Prompt Structure\n\n### Prompt Frameworks\n\nGeneral Purpose\n\n```\n[role] [task] [style] [output format] [constraint]\n```\n\n### Role\n\nStandard\n\n- Act as [occupation] with [specifications]\n- [List of roles](https://github.com/f/awesome-chatgpt-prompts)\n\nRoleplay\n\n- Act as [name] with [visual description] [personality] [behaviour examples] [lore] in [scenario]\n\n### Tasks (Language And Text) {.secondary}\n\n[verb] [task] [specifics]\n\nGenerate\n\n- Generate [content type] to [entity] about [topic] and cover [aspects]\n- Generate random [names|numbers|words|ideas|X] matching [criteria]\n- [Continue|extend|lengthen]\n\nSummarise\n\n- [Summarise|shorten|write concise|write key points|write main lesson]\n- Create outline\n\nRefine\n\n- [Write better|improve]\n- Paraphrase\n- Correct spelling, grammar, and punctuation errors\n- Change [narrative voice A] to [narrative voice B]\n- Replace X with Y\n\nExplain\n\n- [Explain|elaborate]\n- Explain [how to do|each step of] X\n- Explain what X does\n- Explain X [in simple terms|like I’m 5|simplify]; Simplify X\n- Teach me about [topic|subject]\n- Provide [example|analogy]\n\nOrganize\n\n- Sort X by [key] in [order]\n- Categorize\n\nAdvise\n\n- Create [strategy|goals|milestones|roadmap|schedule|timeline] for X\n- Recommend [media type] [on|similar to] [topic]\n- Recommend [gifts|X] for [entity|occasion]\n- Recommend improvements\n- Provide [advice|feedback] for X\n\nAnalyze\n\n- Extract [themes|keywords|info] about X\n- Identify [similarities|differences] between X and Y\n- Analyse the [sentiment|tone] of X\n- Identify gaps in X\n- Evaluate [strengths and weaknesses|pros and cons] of X\n- Is X [comparison] Y?\n\nTranslate\n\n- Translate [language A] into [language B]\n- Convert [unit A] to [unit B]\n- Reformat as [output format]\n\nFilter\n\n- Filter items where [condition]\n- Choose best from [options]\n- Choose [top|lowest|first|last|random] [quantity] from [options]\n\nEngage\n\n- Provide questions about X\n\nResearch\n\n- Get up-to-date [facts|news|data] on X\n- Find [sources|references|citations] for X\n- Is this true?\n\n### Tasks (Meta) {.secondary}\n\nChat Memory\n\n- Based on [previous context] do X\n\n### Tasks (Code) {.secondary}\n\nGenerate\n\n- Generate code in [programming language] to do X\n\nTranslate\n\n- Translate [programming language A] into [programming language B]\n\nOptimize\n\n- Optimize X for [benefit]\n\nDebug\n\n- Debug X and explain why it's doing Y\n\n### Tasks (Image) {.secondary}\n\nGenerate\n\n- Generate image of X in [style]\n\nEdit\n\n- Edit image to have X\n\n### Tasks (File And Image Upload) {.secondary}\n\nExplain\n\n- Question what is shown\n- Interpet visuals\n\nAnalysis\n\n- Extract data\n\n### Task (5W1H Questions) {.secondary}\n\nWho\n\n- Who is X?\n- Who is [involved|affected by|responsible] for X?\n- Who should I contact for help with X?\n\nWhat\n\n- [What is|define|explain|describe] X?\n- What are the key topics of X?\n- What does [quote] mean?\n- [What is done well?|what can be improved?]\n- What is the best way to do X?\n\nWhen\n\n- When [did|will] X happen?\n- When is the best time to do X?\n\nWhere\n\n- Where did X take place?\n- Where to find X?\n\nWhy\n\n- Why did X happen?\n- Why is this approach used?\n- Why is X important?\n- Why might X succeed or fail?\n- Why is X preferable to Y?\n\nHow\n\n- How to do X?\n- How does X work?\n- How did this happen?\n\n### Style\n\nUsing [style]\n\nImitate\n\n- Using style of [person|brand|genre|character]\n\nFormality\n\n- Formal\n- Informal\n\nDirectness\n\n- Direct\n- Indirect\n\nTones\n\nPositive\n\n- Optimistic\n- Appreciative\n- Assertive\n- Calm\n- Confident\n- Encouraging\n- Friendly\n- Humorous\n- Inspirational\n\nNegative\n\n- Pessimistic\n- Accusatory\n- Concerned\n- Critical\n- Regretful\n- Sarcastic\n- Urgent\n\n### Output Format (Text) {.secondary}\n\nIn [output format]\n\nParagraphs\n\n- Paragraphs **_(default)_**\n\nList\n\n- Bulleted list\n- Numbered list\n- Check list\n\nCode\n\n- Code\n\nInstructions\n\n- Step-by-step instructions\n\nKnowledge Base\n\n- Q&A\n- FAQ\n\nCreative Writing\n\n- [Joke|humour]\n- [Lyrics|song]\n- [Metaphorical|stylized language]\n- Poetry\n- [Script|screenplay|dialogue]\n- [Story|narrative]\n\nGames\n\n- [Quiz|test|flashcards|drills]\n- [Riddle|puzzle]\n- [rpg|choose-your-own-adventure]\n\n### Output Format (Visual) {.secondary}\n\nData Visualization\n\n- Table\n- [Chart type] chart\n\nCreative Visual\n\n- ASCII Art\n- Emojis\n- Word cloud\n\n### Output Format (File Type) {.secondary}\n\nDocument\n\n- PDF\n\nStructured Data And Markup\n\n- Plain text\n- Markdown\n- HTML\n- XML\n- CSV\n- JSON\n- LaTeX\n\nProgramming Code And Scripting\n\n- [Programming language]\n- Pseudocode\n- Regular expression\n\n### Constraint\n\nBut [constraint]\n\nLength\n\n- Be [extremely detailed|concise]\n- In [quantity] [words|sentences]\n\nLanguage\n\n- No jargon or technical terms\n\nStructure\n\n- Show [quantity] [examples|options]\n- No headers\n- No pretext titles\n\nVoice And Style\n\n- Use [first-person|second-person|third-person] narrative voice\n- Don't change the wording\n- Use pop culture references\n\nEdits\n\n- Do [minor|major] edits\n- Only show [changed|unchanged] content\n\n## Examples\n\n### Job\n\nName Business\n\n```{.wrap}\nSuggest creative name for tech startup\n```\n\n```{.wrap}\nSuggest catchy names for bakery business\n```\n\nInterview Questions\n\n```{.wrap}\nSuggest common software engineer interview questions\n```\n\nCreate Course Outline\n\n```{.wrap}\nCreate course outline on web development for beginners\n```\n\n```{.wrap}\nCreate training program outline for customer service workshop\n```\n\n### Relationship\n\nGift Ideas\n\n```{.wrap}\nSuggest gift ideas for clients\n```\n\n```{.wrap}\nSuggest gift ideas for clients who work as flourists\n```\n\n```{.wrap}\nSuggest gift ideas for my wife who loves steampunk art and crafts, mystery sci-fi, journalling\n```\n\n```{.wrap}\nSuggest creative ideas for 10 year old’s birthday\n```\n\n### Competition\n\nSelect Contest Winners\n\n```{.wrap}\nRandomly select 1 name from this list\n```\n\n```{.wrap}\nRandomly select 5 email addresses from this list\n```\n\n```{.wrap}\nSelect top 3 records with the shortest lap times from this list\n```\n\n### Programming\n\nCreate Code\n\n```{.wrap}\nCreate program to calculate the factorial of given number in python\n```\n\nCreate Regular Expressions\n\n```{.wrap}\nCreate regex to match all email addresses in list\n```\n\n```{.wrap}\nCreate regex to match all words that start with \"ban\"\n```\n\n```{.wrap}\nCreate regex to match 8-digit password\n```\n\nExplain Code\n\n```{.wrap}\nExplain why code not working\n```\n\n```{.wrap}\nExplain what code does\n```\n\n```{.wrap}\nExplain how to make a HTTP request in javascript\n```\n\nUpdate Code\n\n```{.wrap}\nAdd code comments\n```\n\n```{.wrap}\nAdd class \"header\" to header tag\n```\n\n```{.wrap}\nUpdate CSS to change font color to blue\n```\n\nTranslate\n\n- Specifically called transpile when addressing programming languages.\n\n```{.wrap}\nTranslate code to Python\n```\n\n### Email\n\nCreate Emails\n\n```{.wrap}\nWrite email inviting Jack to dinner on the weekend\n```\n\n```{.wrap}\nWrite email sequence for our new customer onboarding process\n```\n\n```{.wrap}\nWrite email to inform staff of elevator maintenance on 23 June 2025, elevators unavailable for 24 hours, apologise for inconvenience\n```\n\n```{.wrap}\nSuggest response to message asking about project status\n```\n\nFormat Email\n\n```{.wrap}\nProofread and format email\n```\n\nEmail Marketing\n\n```{.wrap}\nSuggest tips to increase open and click-through rates for my email campaigns\n```\n\n```{.wrap}\nSuggest ways to make my email content more engaging and relevant to my subscribers\n```\n\nExtract Data\n\n```{.wrap}\nExtract all email addresses in text\n```\n\n### Spreadsheet\n\nCreate Something\n\n```{.wrap}\nCreate excel formula to calculate sum of cells A1 to A10\n```\n\n```{.wrap}\nGenerate spreadsheet dummy data as a placeholder\n```\n\n```{.wrap}\nCreate macro to calculate average of cells B1 to B10 and insert result in cell C1\n```\n\nExplain Something\n\n```{.wrap}\nExplain formula =SUM(A1:A10) in simple terms\n```\n\n```{.wrap}\nSuggest tips to improve spreadsheet efficiency\n```\n\n### Social Media\n\nCreate Content\n\n```{.wrap}\nSuggest meme ideas for dogs\n```\n\n```{.wrap}\nSuggest climate change post ideas to engage my followers\n```\n\n```{.wrap}\nGenerate hashtags and caption for a picture of scenic sunset\n```\n\n### Reading\n\nText Analysis\n\n```{.wrap}\nSummarize article\n```\n\n```{.wrap}\nWrite concise main points\n```\n\nTranslate\n\n```{.wrap}\nTranslate to spanish\n```\n\nRecommendations\n\n```{.wrap}\nRecommend books similar to Hunger Games\n```\n\n### Design\n\nDesign Prompts\n\n```{.wrap}\nCreate design prompt of logo for new sports brand\n```\n\n```{.wrap}\nSuggest eye-catching thumbnail designs for youtube video on healthy eating\n```\n\nAesthetic Pairings\n\n```{.wrap}\nSuggest font pairing for travel blog header design\n```\n\n```{.wrap}\nSuggest color palette for wedding photography website\n```\n\n### Data Analysis\n\nData Extraction\n\n```{.wrap}\nExtract all numbers from text\n```\n\nData Filtering\n\n```{.wrap}\nFilter list based on [condition]\n```\n\nData Presentation\n\n```{.wrap}\nCreate table from data\n```\n\n### Paid Ads\n\nCreate Ad\n\n```{.wrap}\nSuggest creative ideas for new product launch\n```\n\n```{.wrap}\nSuggest ad copy for travel company\n```\n\n```{.wrap}\nCreate headlines, body text, and calls to action for new fitness program ad\n```\n\nAd Targeting\n\n```{.wrap}\nRecommend target Facebook audience for clothing line ad campaign\n```\n\nAd Technical Support\n\n```{.wrap}\nReview tag manager code for errors\n```\n\n### Amazon FBA\n\nProduct Content\n\n```{.wrap}\nWrite compelling product description for latest item\n```\n\nCommunication\n\n```{.wrap}\nRewrite appeal letter to make it more persuasive\n```\n\n```{.wrap}\nWrite effective email to reach out to potential suppliers\n```\n\nProduct Strategy\n\n```{.wrap}\nSuggest items that would make a good bundle for our customers\n```\n\n```{.wrap}\nOrganize product and pricing information into a neat and manageable spreadsheet\n```\n\n### Writing\n\nName Something\n\n```{.wrap}\nSuggest titles for short story\n```\n\n```{.wrap}\nSuggest titles for article 10 options\n```\n\n```{.wrap}\nSuggest domain name for gardening blog\n```\n\nContent Creation\n\n```{.wrap}\nCreate outline for essay on exercise\n```\n\n```{.wrap}\nSuggest ideas for blog on sustainable fashion\n```\n\n```{.wrap}\nCreate blog post on financial planning\n```\n\n```{.wrap}\nExpand jazz music sentence\n```\n\nEditing And Formatting\n\n```{.wrap}\nChange report tone to conversational\n```\n\n```{.wrap}\nProofread article\n```\n\n```{.wrap}\nFormat headings for blog post\n```\n\nEvaluation\n\n```{.wrap}\nCheck for bias\n```\n\n```{.wrap}\nCheck for plagiarism\n```\n\n### Teacher\n\nTeaching Support\n\n```{.wrap}\nConvert work history fact list into multiple-choice quiz\n```\n\n```{.wrap}\nSuggest ideas for history assignment on American Revolution\n```\n\n```{.wrap}\nDivide list of 30 students into groups of 6\n```\n\n```{.wrap}\nCreate grading curve for class based on their test scores\n```\n\n```{.wrap}\nGrade history essay and provide feedback on any areas for improvement\n```\n\n### YouTube\n\nContent Creation\n\n```{.wrap}\nCreate timestamps for podcast episode transcript\n```\n\n```{.wrap}\nConvert youtube cooking video into blog post with headings and bullet points\n```\n\n```{.wrap}\nCreate outline for a video about the benefits of meditation\n```\n\n```{.wrap}\nSuggest thumbnail ideas for video on \"DIY home decor\"\n```\n\n```{.wrap}\nSuggest fashion video ideas for individual episodes\n```\n\nAnalyse\n\n```{.wrap}\nWhat is the script tone for environmental issues video\n```\n\nCommunication\n\n```{.wrap}\nCreate thoughtful and polite response to negative comment on youtube video\n```\n\n### Research\n\nHistory Research\n\n```{.wrap}\nExplain events leading up to American Civil War\n```\n\n```{.wrap}\nProvide key details about printing press invention\n```\n\n```{.wrap}\nResearch olympic games history\n```\n\n```{.wrap}\nProvide key details about French Revolution\n```\n\n```{.wrap}\nExplain history of Byzantine Empire\n```\n\nScience Reseearch\n\n```{.wrap}\nExplain quantum computing in simple terms\n```\n\n```{.wrap}\nExplain rocket science like i'm five\n```\n\n### SEO\n\nKeywords\n\n```{.wrap}\nFind best keywords for [topic] with low competition\n```\n\n```{.wrap}\nGenerate list of keywords targeting multiple geographic locations\n```\n\n```{.wrap}\nGenerate list of keyword synonyms for [topic]\n```\n\nContent Optimization\n\n```{.wrap}\nFind opportunities for internal linking related to [topic]\n```\n\n```{.wrap}\nResearch industry-specific terminology for use in [topic] content\n```\n\n```{.wrap}\nFind best time to publish content related to [topic]\n```\n\nLink Building\n\n```{.wrap}\nFind authoritative websites to acquire backlinks for [topic] content\n```\n\n```{.wrap}\nResearch best external linking strategies for [topic]\n```\n\nTools\n\n```{.wrap}\nFind most popular tools used for [topic] seo\n```\n\nTactics\n\n```{.wrap}\nResearch best tactics for [topic] mobile optimization\n```\n\n```{.wrap}\nWhat are the best tactics for [topic] international seo?\n```\n\nCompetitors\n\n```{.wrap}\nResearch competitor strategies related to [topic]\n```\n\n```{.wrap}\nWhat are the best affiliate marketing websites for [topic]?\n```\n\n### Roleplay\n\n```{.wrap}\nName: William Shakespeare\n\nVisual description:\n- Wearing Elizabethan attire.\n- Holding quill.\n\nPersonality:\n- Keen observer and a masterful weaver of tales.\n- Knack for finding humor in the most unlikely places.\n\nBehaviour examples:\n- \"To be, or not to be: that is the question: Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take arms against a sea of troubles, And by opposing end them?\"\n- \"Canst thou not minister to a mind diseased?\"\n\nLore:\n- Grew up in Stratford-upon-Avon and later moved to London.\n- Famous for his tragedies, comedies, and historical plays.\n\nScenario:\n-\tNight of a grand performance at the Globe Theatre.\n-\tLead actor is missing and staff are concerned about how to achieve the performance.\n```\n\n<style>\nem { font-size: 0.785em; }\nstrong {font-weight: 400;}\nul.collapsible > li > pre { padding-left: 0; padding-right: 0; font-size: 0.925em;}\n</style>"
  },
  {
    "path": "source/_posts/chmod.md",
    "content": "---\ntitle: Chmod\ndate: 2021-07-01 10:51:44\nbackground: bg-indigo-600\ntags:\n  - permission\ncategories:\n  - Linux Command\nintro: |\n  This quick reference cheat sheet provides a brief overview of file permissions, and the operation of the chmod command\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Syntax\n\n```shell script\n$ chmod [options] <permissions> <file>\n```\n\n#### Example\n\n```shell\n$ chmod 755 foo.txt\n$ chmod +x cheatsheets.py\n$ chmod u-x cheatsheets.py\n$ chmod u=rwx,g=rx,o= cheatsheets.sh\n```\n\n#### Change files and directories recursively\n\n```shell\n$ chmod -R 755 my_directory\n```\n\nThe `chmod` command stands for \"change mode\"\n\n### Chmod Generator\n\n<widget name=\"chmod\"/>\n\nChmod Generator allows you to quickly and visually generate permissions in numerical and symbolic.\n\n### Common Permissions\n\n| Command | s         | Meaning                      |\n| ------- | --------- | ---------------------------- |\n| `400`   | r-------- | Readable by owner only       |\n| `500`   | r-x------ | Avoid Changing               |\n| `600`   | rw------- | Changeable by user           |\n| `644`   | rw-r--r-- | Read and change by user      |\n| `660`   | rw-rw---- | Changeable by user and group |\n| `700`   | rwx------ | Only user has full access    |\n| `755`   | rwxr-xr-x | Only changeable by user      |\n| `775`   | rwxrwxr-x | Sharing mode for a group     |\n| `777`   | rwxrwxrwx | Everybody can do everything  |\n\n### Explains\n\n```shell\n$ ls -l\n-rw-r--r--  1 root root 3 Jun 29 15:35 a.log\ndrwxr-xr-x  2 root root 2 Jun 30 18:06 dir\n```\n\n#### Permission analysis of \"dir\"\n\n```text\nd  rwx  r-x  r-x\n┬  ─┬─  ─┬─  ─┬─\n│   │    │    │\n│   │    │    └─ 4. Other｜5 (4+0+1)\n│   │    └────── 3. Group｜5 (4+0+1)\n│   └─────────── 2. User ｜7 (4+2+1)\n└─────────────── 1. File Type | directory\n```\n\n### Permission Modes {.col-span-2}\n\n| Permission | Description             | Octal | Decimal   |\n| ---------- | ----------------------- | ----- | --------- |\n| `---`      | No Permission           | 000   | 0 (0+0+0) |\n| `--x`      | Execute                 | 001   | 1 (0+0+1) |\n| `-w-`      | Write                   | 010   | 2 (0+2+0) |\n| `-wx`      | Execute and Write       | 011   | 3 (0+2+1) |\n| `r--`      | Read                    | 100   | 4 (4+0+0) |\n| `r-x`      | Read and Execute        | 101   | 5 (4+0+1) |\n| `rw-`      | Read and Write          | 110   | 6 (4+2+0) |\n| `rwx`      | Read, Write and Execute | 111   | 7 (4+2+1) |\n\n{.show-header}\n\n### Objects\n\n| Who (abbr.) | Meaning            |\n| ----------- | ------------------ |\n| `u`         | `U`ser             |\n| `g`         | `G`roup            |\n| `o`         | `O`thers           |\n| `a`         | `A`ll, same as ugo |\n\n{.show-header}\n\n### Permissions\n\n| Abbreviation | Permission    | Value |\n| ------------ | ------------- | ----- |\n| `r`          | `R`ead        | 4     |\n| `w`          | `W`rite       | 2     |\n| `x`          | E`x`ecute     | 1     |\n| `-`          | No permission | 0     |\n\n{.show-header}\n\n### File Types\n\n| Abbreviation | File Type       |\n| ------------ | --------------- |\n| `d`          | `D`irectory     |\n| `-`          | Regular file    |\n| `l`          | Symbolic `L`ink |\n\n{.show-header}\n\n## Chmod Examples\n\n### Operators\n\n| Symbol | Description |\n| ------ | ----------- |\n| `+`    | Add         |\n| `-`    | Remove      |\n| `=`    | Set         |\n\n### chmod 600\n\n```shell\n$ chmod 600 example.txt\n$ chmod u=rw,g=,o= example.txt\n$ chmod a+rwx,u-x,g-rwx,o-rwx example.txt\n```\n\n### chmod 664\n\n```shell\n$ chmod 664 example.txt\n$ chmod u=rw,g=rw,o=r example.txt\n$ chmod a+rwx,u-x,g-x,o-wx example.txt\n```\n\n### chmod 777\n\n```shell\n$ chmod 777 example.txt\n$ chmod u=rwx,g=rwx,o=rwx example.txt\n$ chmod a=rwx example.txt\n```\n\n### Symbolic mode {.row-span-3}\n\nDeny execute permission to everyone.\n\n```shell\n$ chmod a-x chmodExampleFile.txt\n```\n\nAllow read permission to everyone.\n\n```shell\n$ chmod a+r chmodExampleFile.txt\n```\n\nMake a file readable and writable by the group and others.\n\n```shell\n$ chmod go+rw chmodExampleFile.txt\n```\n\nMake a shell script executable by the user/owner.\n\n```shell\n$ chmod u+x chmodExampleScript.sh\n```\n\nAllow everyone to read, write, and execute the file and turn on the set group-ID.\n\n```shell\n$ chmod =rwx,g+s chmodExampleScript.sh\n```\n\n### Removing Permissions {.row-span-3}\n\nIn order to remove read write permissions given to a file, use the following syntax:\n\n```shell\n$ chmod o-rw example.txt\n```\n\nFor our file example.txt, we can remove read write permissions using chmod for group by running the following command:\n\n```shell\n$ chmod  g-rx example.txt\n```\n\nTo remove chmod read write permissions from the group while adding read write permission to public/others, we can use\nthe following command:\n\n```shell\n$ chmod g-rx, o+rx example.txt\n```\n\nBut, if you wish to remove all permissions for group and others, you can do so using the go= instead:\n\n```shell\n$ chmod go= example.txt\n```\n\n### Executable\n\n```shell\n$ chmod +x ~/example.py\n$ chmod u+x ~/example.py\n$ chmod a+x ~/example.py\n```\n\n### chmod 754\n\n```shell\n$ chmod 754 foo.sh\n$ chmod u=rwx,g=rx,o=r foo.sh\n```\n\n## Chmod Practices\n\n### SSH Permissions\n\n```shell script\n$ chmod 700 ~/.ssh\n$ chmod 600 ~/.ssh/authorized_keys\n$ chmod 600 ~/.ssh/id_rsa\n$ chmod 600 ~/.ssh/id_rsa.pub\n$ chmod 400 /path/to/access_key.pem\n```\n\n### Web Permissions\n\n```shell script\n$ chmod -R 644 /var/www/html/\n$ chmod 644 .htaccess\n$ chmod 644 robots.txt\n$ chmod 755 /var/www/uploads/\n$ find /var/www/html -type d -exec chmod 755 {} \\;\n```\n\n### Batch Change\n\n```shell script\n$ chmod -R 644 /your_path\n$ find /path -type d -exec chmod 755 {} \\;\n$ find /path -type f -exec chmod 644 {} \\;\n```\n\nSee: [Command Substitution](https://tldp.org/LDP/abs/html/commandsub.html)\n\n## Also see\n\n- [Modify File Permissions with chmod](https://www.linode.com/docs/guides/modify-file-permissions-with-chmod/)\n  _(linode.com)_\n"
  },
  {
    "path": "source/_posts/chrome-devtools.md",
    "content": "---\ntitle: Chrome Developer Tools\ndate: 2022-11-23 16:23:31.696017\nbackground: bg-[#c64d3e]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 56 keyboard shortcuts found in Chrome's Developer Tools\n---\n\n## Keyboard Shortcuts\n\n### Opening DevTools\n\n| Shortcut           | Action                            |\n| ------------------ | --------------------------------- |\n| `Ctrl` `Shift` `I` | Open whatever panel you used last |\n| `Ctrl` `Shift` `J` | Open the Console panel            |\n| `Ctrl` `Shift` `C` | Open the Elements panel           |\n\n{.shortcuts}\n\n### Global Shortcuts {.row-span-2}\n\n| Shortcut           | Action                                                 |\n| ------------------ | ------------------------------------------------------ |\n| `F1`               | Show Settings                                          |\n| `Ctrl` `]`         | Focus the next panel                                   |\n| `Ctrl` `[`         | Focus the previous panel                               |\n| `Ctrl` `Shift` `D` | Switch back to whatever docking position you last used |\n| `Ctrl` `Shift` `M` | Toggle Device Mode                                     |\n| `Ctrl` `Shift` `C` | Toggle Inspect Element Mode                            |\n| `Ctrl` `Shift` `P` | Open the Command Menu                                  |\n| `Esc`              | Toggle the Drawer                                      |\n| `Ctrl` `R`         | Normal reload                                          |\n| `Ctrl` `Shift` `R` | Hard reload                                            |\n| `Ctrl` `F`         | Search for text within the current panel               |\n| `Ctrl` `Shift` `F` | Opens the Search tab in the Drawer                     |\n| `Ctrl` `P`         | Open a file in the Sources panel                       |\n| `Ctrl` `Shift` `+` | Zoom in                                                |\n| `Ctrl` `-`         | Zoom out                                               |\n| `Ctrl` `0`         | Restore default zoom level                             |\n| `Ctrl` `O` `!`     | Run snippet                                            |\n\n{.shortcuts}\n\n### Elements Panel\n\n| Shortcut      | Action                                                            |\n| ------------- | ----------------------------------------------------------------- |\n| `Ctrl` `Z`    | Undo change                                                       |\n| `Ctrl` `Y`    | Redo change                                                       |\n| `Up/Down`     | Select the element above or below the currently-selected element  |\n| `Right`       | Expand the currently-selected node                                |\n| `Left`        | Collapse the currently-selected node                              |\n| `Enter`       | Toggle Edit Attributes mode on the currently-selected element     |\n| `Tab`         | Select the next attribute after entering Edit Attributes mode     |\n| `Shift` `Tab` | Select the previous attribute after entering Edit Attributes mode |\n| `H`           | Hide the currently-selected element                               |\n| `F2`          | Toggle Edit as HTML mode on the currently-selected element        |\n\n{.shortcuts}\n\n### Sources Panel\n\n| Shortcut           | Action                                                            |\n| ------------------ | ----------------------------------------------------------------- |\n| `Ctrl` `\\`         | Pause script execution (if running), or resume (if paused)        |\n| `Ctrl` `'`         | Step over next function call                                      |\n| `Ctrl` `;`         | Step into next function call                                      |\n| `Ctrl` `Shift` `;` | Step out of current function                                      |\n| `Ctrl` `./,`       | Select the call frame below or above the currently-selected frame |\n| `Ctrl` `S`         | Save changes to local modifications                               |\n| `Ctrl` `Alt` `S`   | Save all changes                                                  |\n| `Ctrl` `G`         | Go to line                                                        |\n| `Alt` `W`          | Close the active tab                                              |\n\n{.shortcuts}\n\n### Code Editor\n\n| Shortcut     | Action                                                         |\n| ------------ | -------------------------------------------------------------- |\n| `Ctrl` `Del` | Delete all characters in the last word, up to the cursor       |\n| `Ctrl` `M`   | Go to matching bracket                                         |\n| `Ctrl` `/`   | Toggle single-line comment                                     |\n| `Ctrl` `D`   | Select the next occurrence of whatever word the cursor is on   |\n| `Ctrl` `U`   | Deselect the next occurrence of whatever word the cursor is on |\n\n{.shortcuts}\n\n### Performance Panel\n\n| Shortcut   | Action                  |\n| ---------- | ----------------------- |\n| `Ctrl` `E` | Start or stop recording |\n| `Ctrl` `S` | Save recording          |\n| `Ctrl` `O` | Load recording          |\n\n{.shortcuts}\n\n### Memory Panel\n\n| Shortcut   | Action                  |\n| ---------- | ----------------------- |\n| `Ctrl` `E` | Start or stop recording |\n\n{.shortcuts}\n\n### Console Panel\n\n| Shortcut               | Action                         |\n| ---------------------- | ------------------------------ |\n| `Tab`                  | Accept autocomplete suggestion |\n| `Esc`                  | Reject autocomplete suggestion |\n| `Up`                   | Get previous statement         |\n| `Down`                 | Get next statement             |\n| `Ctrl` <code>\\`</code> | Focus the Console              |\n| `Ctrl` `L`             | Clear the console              |\n| `Shift` `Enter`        | Force a multi-line entry       |\n| `Enter`                | Execute                        |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Chrome DevTools](https://developers.google.com/web/tools/chrome-devtools/shortcuts)\n  _(developers.google.com)_\n"
  },
  {
    "path": "source/_posts/code-editor-ios.md",
    "content": "---\ntitle: Code Editor for iOS\ndate: 2022-11-23 16:23:31.697110\nbackground: bg-[#4880c2]\nlabel: Mac\ntags:\n  -\n  - mac\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 43 keyboard shortcuts found in the Code Editor for iOS app. This application is MacOS-only.\n---\n\n## Keyboard Shortcuts {.cols-2}\n\n### General Shortcuts I\n\n| Shortcut          | Action                                                        |\n| ----------------- | ------------------------------------------------------------- |\n| `Esc`             | Show completions                                              |\n| `Tab`             | Insert indent, depending on the preferences of tabs or spaces |\n| `Cmd` `N`         | New document tab                                              |\n| `Cmd` `W`         | Close tab                                                     |\n| `Cmd` `S`         | Save                                                          |\n| `Cmd` `Z`         | Undo                                                          |\n| `Cmd` `Shift` `Z` | Redo                                                          |\n| `Cmd` `A`         | Select all                                                    |\n| `Cmd` `X`         | Cut                                                           |\n| `Cmd` `C`         | Copy                                                          |\n| `Cmd` `V`         | Paste                                                         |\n| `Cmd` `F`         | Find                                                          |\n| `Cmd` `G`         | Find next                                                     |\n| `Cmd` `Shift` `G` | Find previous                                                 |\n| `Cmd` `/`         | Toggle comment                                                |\n| `Cmd` `[`         | Indent selection                                              |\n| `Cmd` `]`         | Dedent selection                                              |\n| `Cmd` `Shift` `[` | Move to previous tab                                          |\n| `Cmd` `Shift` `]` | Move to next tab                                              |\n| `Cmd` `4`         | Toggle preview, in editor only                                |\n| `Cmd` `K`         | Clear scrollback, in terminal and playgrounds only            |\n\n{.shortcuts}\n\n### General Shortcuts II\n\n| Shortcut                    | Action                                      |\n| --------------------------- | ------------------------------------------- |\n| `Cmd` `R`                   | Reload, in preview only                     |\n| `Cmd` `Left`                | Back, in preview only                       |\n| `Cmd` `Right`               | Forward, in preview only                    |\n| `Shift` `Left`              | Select the previous character               |\n| `Shift` `Right`             | Select the next character                   |\n| `Cmd` `Left`                | Move to the beginning of the current line   |\n| `Cmd` `Right`               | Move to the end of the current line         |\n| `Cmd` `Shift` `Left`        | Select to the beginning of the current line |\n| `Cmd` `Shift` `Right`       | Select to the end of the current line       |\n| `Opt` `Left`                | Move to the beginning of the current word   |\n| `Opt` `Right`               | Move to the end of the current word         |\n| `Opt` `Shift` `Left`        | Select to the beginning of the current word |\n| `Opt` `Shift` `Right`       | Select to the end of the current word       |\n| `Cmd` `Del`                 | Delete to the beginning of the current line |\n| `Cmd` `Opt` `Del`           | Delete to the beginning of the current word |\n| `Cmd` `Del (forward)`       | Delete to the end of the current line       |\n| `Cmd` `Opt` `Del (forward)` | Delete to the end of the current word       |\n| `Ctrl` `A`                  | Move to the beginning of the current line   |\n| `Ctrl` `Shift` `A`          | Select to the beginning of the current line |\n| `Ctrl` `E`                  | Move to the end of the current line         |\n| `Ctrl` `Shift` `E`          | Select to the end of the current line       |\n| `Ctrl` `K`                  | Delete to the end of the current line       |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for the Code Editor iOS app](https://library.panic.com/code-editor/shortcut-keys/)\n  _(library.panic.com)_\n"
  },
  {
    "path": "source/_posts/color-picker.md",
    "content": "---\r\ntitle: Color Picker\r\ndate: 2025-07-01 18:28:43\r\nbackground: bg-[#2a6387]\r\ntags:\r\n  - html\r\n  - color\r\ncategories:\r\n  - Toolkit\r\nintro: The Color Picker  cheat sheet provides you basic color info and  choices \r\nplugins:\r\n  - copyCode\r\n---\r\n\r\n## Getting Started \r\n\r\n\r\n### Color Basics {.col-span-3}\r\n\r\n\r\n| **Category**                     | **Description**                                                                                                                                                                                                                                                                                |\r\n|:---------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\r\n| **Color Models**                 | **RGB**: Red, Green, Blue – additive model used in screens. <br> **HEX**: Hexadecimal color codes, e.g., #FFFFFF. <br> **HSL**: Hue, Saturation, Lightness – intuitive for color adjustments. <br> **HSV**: Hue, Saturation, Value – similar to HSL but with different brightness handling.    |\r\n| **Color Terminology**            | **Saturation**: Intensity or purity of a color. <br> **Hue**: The color type (e.g., red, blue). <br> **Lightness**: Brightness or darkness of a color. <br> **Opacity**: Transparency level of a color, often defined as alpha in RGBA.                                                        |\r\n| **Color Representation Formats** | **HEX**: `#RRGGBB` or `#RRGGBBAA` (with alpha). <br> **RGB**: `rgb(255, 255, 255)` <br> **RGBA**: `rgba(255, 255, 255, 0.5)` <br> **HSL**: `hsl(120, 100%, 50%)` <br> **HSLA**: `hsla(120, 100%, 50%, 0.5)`                                                                                    |\r\n\r\n\r\n\r\n### Main Frameworks {.col-span-3}\r\n\r\n| **Framework**    | **Color Notation / Syntax**                                                                                                                                                     | **Description**                                             | **Documentation Link**                                                                     |\r\n|:-----------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------|:-------------------------------------------------------------------------------------------|\r\n| **CSS**          | `color: red;` <br> `color: #ff0000;` <br> `color: rgb(255, 0, 0);` <br> `color: rgba(255, 0, 0, 0.5);` <br> `color: hsl(0, 100%, 50%);` <br> `color: hsla(0, 100%, 50%, 0.5);`  | Standard CSS color properties and formats.                  | [CSS Color Documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/color)          |\r\n| **SASS/SCSS**    | `$color: #ff0000;` <br> `color: $color;`                                                                                                                                        | Variables for colors, can use same formats as CSS.          | [SASS Color Documentation](https://sass-lang.com/documentation/values/colors)              |\r\n| **Tailwind CSS** | `class=\"bg-red-500\"` <br> `class=\"text-green-300\"`                                                                                                                              | Utility classes with predefined color shades.               | [Tailwind CSS Colors](https://tailwindcss.com/docs/customizing-colors)                     |\r\n| **Bootstrap**    | `class=\"text-primary\"` <br> `class=\"bg-success\"`                                                                                                                                | Named color classes for quick styling.                      | [Bootstrap Colors](https://getbootstrap.com/docs/5.0/getting-started/introduction/#colors) |\r\n| **Material UI**  | `style={{ color: 'primary' }}` or theme palette                                                                                                                                 | Uses theme palette, can override with specific color codes. | [Material UI Color](https://mui.com/customization/color/)                                  |\r\n\r\n\r\n## Color Palette\r\n\r\n### Tailwind Palette {.col-span-3}\r\n\r\n<widget name=\"color-palette-tailwind\"/>\r\n\r\n\r\n## Gradient CSS \r\n\r\n### Gradient Maker {.col-span-3}\r\n\r\n<widget name=\"gradient-maker\"/>\r\n\r\n\r\n| Parameter     | Description                       | Example                                        |\r\n|:--------------|:----------------------------------|:-----------------------------------------------|\r\n| **to right**  | Gradient goes from left to right  | `linear-gradient(to right, #ff7e5f, #feb47b)`  |\r\n| **to left**   | Gradient goes from right to left  | `linear-gradient(to left, #ff7e5f, #feb47b)`   |\r\n| **to bottom** | Gradient goes from top to bottom  | `linear-gradient(to bottom, #ff7e5f, #feb47b)` |\r\n| **to top**    | Gradient goes from bottom to top  | `linear-gradient(to top, #ff7e5f, #feb47b)`    |\r\n| **deg**       | Specify an angle in degrees       | `linear-gradient(45deg, ...)`                  |\r\n\r\n"
  },
  {
    "path": "source/_posts/colorscreen.md",
    "content": "---\ntitle: ColorScreen\ndate: 2026-01-04 12:00:00\nbackground: bg-gradient-to-br from-slate-800 via-slate-900 to-black\ntags:\n  - Tool\n  - Display\n  - Productivity\ncategories:\n  - Other\nintro: A quick reference collection of full-screen color pages, monitor tests, prank screens, screensavers, and timers.\nplugins:\n  - copyCode\n---\n\n## Overview {.cols-2}\n\n### What is ColorScreen? {.col-span-2}\n\n**[ColorScreen](https://colorscreen.co/)** is a collection of browser-based screen utilities designed for simplicity and privacy. It provides full-screen tools without ads or login requirements.\n\n- **Utilities**: Pure color pages, monitor diagnostics, prank screens, screensavers, and timers.\n- **Features**: System-level fullscreen support, local storage for settings, static web app.\n- **Use Cases**: Bias lighting, display testing (dead pixels/bleed), streaming backdrops, and productivity timing.\n\n[Visit ColorScreen.co](https://colorscreen.co/) {.link-arrow}\n\n## Tools Directory {.cols-3}\n\n### Pure Colors {.col-span-2}\n\n- [White Screen for Light](https://colorscreen.co/white-screen) — full-screen white page for lighting & testing\n- [Black Screen for OLED](https://colorscreen.co/black-screen) — pure black screen for OLED power saving & bleed tests\n- [Red Screen for Night Vision](https://colorscreen.co/red-screen) — red light for dark adaptation\n- [Green Screen for Chroma Key](https://colorscreen.co/green-screen) — green background for keying / streaming\n- [Blue Screen for Chroma Key](https://colorscreen.co/blue-screen) — blue background for keying / video\n- [Yellow Screen for Warm Light](https://colorscreen.co/yellow-screen) — warm yellow light\n- [Purple Screen for Ambient Light](https://colorscreen.co/purple-screen) — ambient purple vibe\n- [Orange Screen for Creativity](https://colorscreen.co/orange-screen) — energetic orange glow\n- [Pink Screen for Beauty Light](https://colorscreen.co/pink-screen) — soft pink beauty light\n\n{.cols-2 .marker-none}\n\n### Lighting\n\n- [Meeting Zoom Lighting](https://colorscreen.co/meeting-zoom-lighting) — monitor-as-softbox lighting\n- [Live Streaming Lighting](https://colorscreen.co/live-streaming-lighting) — adjustable softbox screen\n\n{.marker-none}\n\n### Screen Tests\n\n- [Online Dead Pixel Monitor Test](https://colorscreen.co/dead-pixel-test) — detect dead / stuck pixels\n- [Burn-in Fixer & Stuck Pixel Tool](https://colorscreen.co/burn-in-fixer) — reduce image retention\n- [Gradient / Color Banding Test](https://colorscreen.co/gradient-test) — check banding & transitions\n- [Grid Alignment & Projector Calibration](https://colorscreen.co/grid-alignment-test) — alignment / overscan test\n\n{.marker-none}\n\n### Fake Update Screens (Prank) {.col-span-2}\n\n- [Windows 11 fake update](https://colorscreen.co/fake-update-screen-windows-11)\n- [Windows 10 fake update](https://colorscreen.co/fake-update-screen-windows-10)\n- [Windows 8 fake update](https://colorscreen.co/fake-update-screen-windows-8)\n- [Windows 7 fake update](https://colorscreen.co/fake-update-screen-windows-7)\n- [Windows XP fake update](https://colorscreen.co/fake-update-screen-windows-xp)\n- [Mac fake update](https://colorscreen.co/fake-update-screen-mac)\n- [Android fake update](https://colorscreen.co/fake-update-screen-android)\n- [iPad fake update](https://colorscreen.co/fake-update-screen-apple-ipad)\n- [iOS fake update](https://colorscreen.co/fake-update-screen-apple-iphone-ios)\n- [Ubuntu fake update](https://colorscreen.co/fake-update-screen-ubuntu)\n- [Steam fake update](https://colorscreen.co/fake-update-screen-steam)\n- [Sarcastic fake update](https://colorscreen.co/fake-update-screen-sarcastic)\n\n{.cols-2 .marker-none}\n\n### Prank Screens\n\n- [Blue Screen of Death (BSOD)](https://colorscreen.co/bsod-prank)\n- [Broken Screen Simulator](https://colorscreen.co/broken-screen-prank)\n- [Hacker Typer](https://colorscreen.co/hacker-typer-prank)\n- [Matrix Rain Code](https://colorscreen.co/matrix-rain-prank)\n\n{.marker-none}\n\n### Screensavers\n\n- [No Signal / SMPTE Bars](https://colorscreen.co/no-signal-screensaver)\n- [DVD Bounce](https://colorscreen.co/dvd-screensaver)\n- [Radar Scan](https://colorscreen.co/radar-screensaver)\n- [White Noise / TV Static](https://colorscreen.co/white-noise-screensaver)\n\n{.marker-none}\n\n### Clocks & Timers\n\n- [Stopwatch (Lap Timer)](https://colorscreen.co/stopwatch)\n- [Countdown Timer](https://colorscreen.co/countdown-timer)\n- [Pomodoro Timer](https://colorscreen.co/pomodoro-timer)\n- [Flip Clock](https://colorscreen.co/flip-clock-screensaver)\n\n{.marker-none}\n"
  },
  {
    "path": "source/_posts/conventional-commits.md",
    "content": "---\ntitle: Conventional Commits\ndate: 2024-03-11 09:51:44\nbackground: bg-[#e86d7a]\ntags:\n  - permission\ncategories:\n  - Other\nintro: |\n  A cheat sheet of the Conventional Commits and Conventional Comments standards\nplugins:\n---\n\n## Getting Started {.cols-3}\n\n### Quick Guide\n\n#### Why Conventional Commits\n\n- Easy-to-follow structure for commit messages.\n- Clearly states the nature of changes.\n- Ensures uniformity in commit messages across teams.\n- Enables automated versioning and changelog generation.\n- Makes commit history easy to browse.\n- Allows the specification of 'scope' for more clarity.\n- Has a special notation for breaking changes.\n- Facilitates better understanding among team members.\n- Makes the review process efficient.\n- Helps in future troubleshooting with descriptive commit messages.\n\n#### Structure\n\n```javascript\n<type>[optional scope]: <description>\n\n[optional body]\n\n[optional footer(s)]\n```\n\n[Official Website](https://www.conventionalcommits.org/en) {.link-arrow}\n\n### Examples\n\n- feat: add jwt support\n- feat!: breaking change in API\n- feat(ui)!: redesign user profile page\n- fix: fix SQL injection vulnerability\n- fix(database): resolve data race condition\n- docs: update setup section of README\n- style(login): correct indentation in login component\n- refactor: refactor user database schema\n- perf: optimize user retrieval code for faster response\n- test: add tests for jwt authentication\n- test(payment): add tests for the payment gateway\n- chore: update build script\n- chore(deps): update dependencies\n- build(docker): update Dockerfile to use node 14\n- ci: add job for integration tests\n- revert: revert commit a1b2c3d4e5f\n\n### Types\n\n| Type     | Description                                                                                                      |\n| -------- | ---------------------------------------------------------------------------------------------------------------- |\n| `feat`   | Introduces a new feature                                                                                         |\n| `fix`    | Fixes a bug                                                                                                      |\n| `docs`   | Changes in documentation only                                                                                    |\n| `style`  | Code changes that do not impact the functionality (e.g., formatting, white-space, etc)                           |\n| refactor | Code changes that neither fix a bug nor introduce a feature, typically improving code readability or structure   |\n| perf     | Code changes that improve performance                                                                            |\n| test     | Addition of missing tests or corrections to existing tests                                                       |\n| `chore`  | Changes that do not modify the source code or test files, like tweaking the build process or adding dependencies |\n| build    | Changes affecting the build system or external dependencies (e.g., changes in webpack, npm packages)             |\n| ci       | Changes to Continuous Integration configuration files and scripts (e.g., Travis, CircleCI, Jenkins)              |\n| revert   | Reverts a previously made commit                                                                                 |\n\n{.bold-first}\n\n## Specification {.cols-1}\n\n### Specification\n\n- Commits MUST be prefixed with a type, which consists of a noun, feat, fix, etc., followed by the OPTIONAL scope,\n  OPTIONAL !, and REQUIRED terminal colon and space.\n- The type feat MUST be used when a commit adds a new feature to your application or library.\n- The type fix MUST be used when a commit represents a bug fix for your application.\n- A scope MAY be provided after a type. A scope MUST consist of a noun describing a section of the codebase surrounded\n  by parenthesis, e.g., fix(parser):\n- A description MUST immediately follow the colon and space after the type/scope prefix. The description is a short\n  summary of the code changes, e.g., fix: array parsing issue when multiple spaces were contained in string.\n- A longer commit body MAY be provided after the short description, providing additional contextual information about\n  the code changes. The body MUST begin one blank line after the description.\n- A commit body is free-form and MAY consist of any number of newline separated paragraphs.\n- One or more footers MAY be provided one blank line after the body. Each footer MUST consist of a word token, followed\n  by either a :<space> or <space># separator, followed by a string value (this is inspired by the\n  [git trailer convention](https://git-scm.com/docs/git-interpret-trailers)).\n- A footer’s token MUST use - in place of whitespace characters, e.g., Acked-by (this helps differentiate the footer\n  section from a multi-paragraph body). An exception is made for BREAKING CHANGE, which MAY also be used as a token.\n- A footer’s value MAY contain spaces and newlines, and parsing MUST terminate when the next valid footer\n  token/separator pair is observed.\n- Breaking changes MUST be indicated in the type/scope prefix of a commit, or as an entry in the footer.\n- If included as a footer, a breaking change MUST consist of the uppercase text BREAKING CHANGE, followed by a colon,\n  space, and description, e.g., BREAKING CHANGE: environment variables now take precedence over config files.\n- If included in the type/scope prefix, breaking changes MUST be indicated by a ! immediately before the :. If ! is\n  used, BREAKING CHANGE: MAY be omitted from the footer section, and the commit description SHALL be used to describe\n  the breaking change.\n- Types other than feat and fix MAY be used in your commit messages, e.g., docs: update ref docs.\n- The units of information that make up Conventional Commits MUST NOT be treated as case sensitive by implementors, with\n  the exception of BREAKING CHANGE which MUST be uppercase.\n- BREAKING-CHANGE MUST be synonymous with BREAKING CHANGE, when used as a token in a footer.\n\n## Also see\n\n- [Conventional Commits](https://conventionalcommits.org/) _(conventionalcommits.org)_\n"
  },
  {
    "path": "source/_posts/cpp.md",
    "content": "---\ntitle: C++\ndate: 2021-06-01 11:51:44\nbackground: bg-[#6d94c7]\ntags:\ncategories:\n  - Programming\nintro: |\n  C++ quick reference cheat sheet that provides basic syntax and methods.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### hello.cpp\n\n```cpp\n#include <iostream>\n\nint main() {\n    std::cout << \"Hello CheatSheets\\n\";\n    return 0;\n}\n```\n\nCompiling and running\n\n```shell script\n$ g++ hello.cpp -o hello\n$ ./hello\nHello CheatSheets\n```\n\n### Variables\n\n```cpp\nint number = 5;       // Integer\nfloat f = 0.95;       // Floating number\ndouble PI = 3.14159;  // Floating number\nchar yes = 'Y';       // Character\nstd::string s = \"ME\"; // String (text)\nbool isRight = true;  // Boolean\n\n// Constants\nconst float RATE = 0.8;\n```\n\n---\n\n```cpp\nint age {25};         // Since C++11\nstd::cout << age;     // Print 25\n```\n\n### Primitive Data Types\n\n| Data Type | Size           | Range               |\n| --------- | -------------- | ------------------- |\n| `int`     | 4 bytes        | -2^31^ ^to^ 2^31^-1 |\n| `float`   | 4 bytes        | _N/A_               |\n| `double`  | 8 bytes        | _N/A_               |\n| `char`    | 1 byte         | -128 ^to^ 127       |\n| `bool`    | 1 byte         | true / false        |\n| `void`    | _N/A_          | _N/A_               |\n| `wchar_t` | 2 ^or^ 4 bytes | 1 wide character    |\n\n{.show-header}\n\n### User Input\n\n```cpp\nint num;\n\nstd::cout << \"Type a number: \";\nstd::cin >> num;\n\nstd::cout << \"You entered \" << num;\n```\n\n### Swap\n\n```cpp\nint a = 5, b = 10;\nstd::swap(a, b);\n\n// Outputs: a=10, b=5\nstd::cout << \"a=\" << a << \", b=\" << b;\n```\n\n### Comments\n\n```cpp\n// A single one line comment in C++\n\n/* This is a multiple line comment\n   in C++ */\n```\n\n### If statement\n\n```cpp\nif (a == 10) {\n    // do something\n}\n```\n\nSee: [Conditionals](#c-conditionals)\n\n### Loops\n\n```cpp\nfor (int i = 0; i < 10; i++) {\n    std::cout << i << \"\\n\";\n}\n```\n\nSee: [Loops](#c-loops)\n\n### Functions\n\n```cpp\n#include <iostream>\n\nvoid hello(); // Declaring\n\nint main() {  // main function\n    hello();    // Calling\n}\n\nvoid hello() { // Defining\n    std::cout << \"Hello CheatSheets!\\n\";\n}\n```\n\nSee: [Functions](#c-functions)\n\n### References\n\n```cpp\nint i = 1;\nint& ri = i; // ri is a reference to i\n\nri = 2; // i is now changed to 2\nstd::cout << \"i=\" << i;\n\ni = 3;   // i is now changed to 3\nstd::cout << \"ri=\" << ri;\n```\n\n`ri` and `i` refer to the same memory location.\n\n### Namespaces\n\n```cpp\n#include <iostream>\nnamespace ns1 {int val(){return 5;}}\nint main()\n{\n    std::cout << ns1::val();\n}\n```\n\n---\n\n```cpp\n#include <iostream>\nnamespace ns1 {int val(){return 5;}}\nusing namespace ns1;\nusing namespace std;\nint main()\n{\n    cout << val();\n}\n```\n\nNamespaces allow global identifiers under a name\n\n## C++ Arrays\n\n### Declaration\n\n```cpp\nstd::array<int, 3> marks; // Definition\nmarks[0] = 92;\nmarks[1] = 97;\nmarks[2] = 98;\n\n// Define and initialize\nstd::array<int, 3> = {92, 97, 98};\n\n// With empty members\nstd::array<int, 3> marks = {92, 97};\nstd::cout << marks[2]; // Outputs: 0\n```\n\n### Manipulation\n\n```cpp\n┌─────┬─────┬─────┬─────┬─────┬─────┐\n| 92  | 97  | 98  | 99  | 98  | 94  |\n└─────┴─────┴─────┴─────┴─────┴─────┘\n   0     1     2     3     4     5\n```\n\n---\n\n```cpp\nstd::array<int, 6> marks = {92, 97, 98, 99, 98, 94};\n\n// Print first element\nstd::cout << marks[0];\n\n// Change 2nd element to 99\nmarks[1] = 99;\n\n// Take input from the user\nstd::cin >> marks[2];\n```\n\n### Displaying\n\n```cpp\nchar ref[5] = {'R', 'e', 'f'};\n\n// Range based for loop\nfor (const int &n : ref) {\n    std::cout << std::string(1, n);\n}\n\n// Traditional for loop\nfor (int i = 0; i < sizeof(ref); ++i) {\n    std::cout << ref[i];\n}\n```\n\n### Multidimensional\n\n```cpp\n     j0   j1   j2   j3   j4   j5\n   ┌────┬────┬────┬────┬────┬────┐\ni0 | 1  | 2  | 3  | 4  | 5  | 6  |\n   ├────┼────┼────┼────┼────┼────┤\ni1 | 6  | 5  | 4  | 3  | 2  | 1  |\n   └────┴────┴────┴────┴────┴────┘\n```\n\n---\n\n```cpp\nint x[2][6] = {\n    {1,2,3,4,5,6}, {6,5,4,3,2,1}\n};\nfor (int i = 0; i < 2; ++i) {\n    for (int j = 0; j < 6; ++j) {\n        std::cout << x[i][j] << \" \";\n    }\n}\n// Outputs: 1 2 3 4 5 6 6 5 4 3 2 1\n```\n\n## C++ Conditionals\n\n### If Clause\n\n```cpp\nif (a == 10) {\n    // do something\n}\n```\n\n---\n\n```cpp\nint number = 16;\n\nif (number % 2 == 0)\n{\n    std::cout << \"even\";\n}\nelse\n{\n    std::cout << \"odd\";\n}\n\n// Outputs: even\n```\n\n### Else if Statement\n\n```cpp\nint score = 99;\nif (score == 100) {\n    std::cout << \"Superb\";\n}\nelse if (score >= 90) {\n    std::cout << \"Excellent\";\n}\nelse if (score >= 80) {\n    std::cout << \"Very Good\";\n}\nelse if (score >= 70) {\n    std::cout << \"Good\";\n}\nelse if (score >= 60)\n    std::cout << \"OK\";\nelse\n    std::cout << \"What?\";\n```\n\n### Operators {.row-span-2}\n\n#### Relational Operators\n\n|          |                              |\n| -------- | ---------------------------- |\n| `a == b` | a is equal to b              |\n| `a != b` | a is NOT equal to b          |\n| `a < b`  | a is less than b             |\n| `a > b`  | a is greater b               |\n| `a <= b` | a is less than or equal to b |\n| `a >= b` | a is greater or equal to b   |\n\n#### Assignment Operators\n\n| Example  | Equivalent to    |\n| -------- | ---------------- |\n| `a += b` | _Aka_ a = a + b  |\n| `a -= b` | _Aka_ a = a - b  |\n| `a *= b` | _Aka_ a = a \\* b |\n| `a /= b` | _Aka_ a = a / b  |\n| `a %= b` | _Aka_ a = a % b  |\n\n#### Logical Operators\n\n| Example                     | Meaning                |\n| --------------------------- | ---------------------- |\n| `exp1 && exp2`              | Both are true _(AND)_  |\n| <code>exp1 \\|\\| exp2</code> | Either is true _(OR)_  |\n| `!exp`                      | `exp` is false _(NOT)_ |\n\n#### Bitwise Operators\n\n| Operator            | Description             |\n| ------------------- | ----------------------- |\n| `a & b`             | Binary AND              |\n| <code>a \\| b</code> | Binary OR               |\n| `a ^ b`             | Binary XOR              |\n| `~ a`               | Binary One's Complement |\n| `a << b`            | Binary Shift Left       |\n| `a >> b`            | Binary Shift Right      |\n\n### Ternary Operator\n\n```\n           ┌── True ──┐\nResult = Condition ? Exp1 : Exp2;\n           └───── False ─────┘\n```\n\n---\n\n```cpp\nint x = 3, y = 5, max;\nmax = (x > y) ? x : y;\n\n// Outputs: 5\nstd::cout << max << std::endl;\n```\n\n---\n\n```cpp\nint x = 3, y = 5, max;\nif (x > y) {\n    max = x;\n} else {\n    max = y;\n}\n// Outputs: 5\nstd::cout << max << std::endl;\n```\n\n### Switch Statement\n\n```cpp\nint num = 2;\nswitch (num) {\n    case 0:\n        std::cout << \"Zero\";\n        break;\n    case 1:\n        std::cout << \"One\";\n        break;\n    case 2:\n        std::cout << \"Two\";\n        break;\n    case 3:\n        std::cout << \"Three\";\n        break;\n    default:\n        std::cout << \"What?\";\n        break;\n}\n```\n\n## C++ Loops\n\n### While\n\n```cpp\nint i = 0;\nwhile (i < 6) {\n    std::cout << i++;\n}\n\n// Outputs: 012345\n```\n\n### Do-while\n\n```cpp\nint i = 1;\ndo {\n    std::cout << i++;\n} while (i <= 5);\n\n// Outputs: 12345\n```\n\n### Continue statements\n\n```cpp\nfor (int i = 0; i < 10; i++) {\n    if (i % 2 == 0) {\n        continue;\n    }\n    std::cout << i;\n} // Outputs: 13579\n```\n\n### Infinite loop\n\n```cpp\nwhile (true) { // true or 1\n    std::cout << \"infinite loop\";\n}\n```\n\n---\n\n```cpp\nfor (;;) {\n    std::cout << \"infinite loop\";\n}\n```\n\n---\n\n```cpp\nfor(int i = 1; i > 0; i++) {\n    std::cout << \"infinite loop\";\n}\n```\n\n### for_each (Since C++11)\n\n```cpp\n#include <iostream>\n#include <array>\n\nint main()\n{\n    auto print = [](int num) { std::cout << num << std::endl; };\n\n    std::array<int, 4> arr = {1, 2, 3, 4};\n    std::for_each(arr.begin(), arr.end(), print);\n    return 0;\n}\n```\n\n### Range-based (Since C++11)\n\n```cpp\nfor (int n : {1, 2, 3, 4, 5}) {\n    std::cout << n << \" \";\n}\n// Outputs: 1 2 3 4 5\n```\n\n---\n\n```cpp\nstd::string hello = \"CheatSheets.zip\";\nfor (char c: hello)\n{\n    std::cout << c << \" \";\n}\n// Outputs: Q u i c k R e f . M E\n```\n\n### Break statements\n\n```cpp\nint password, times = 0;\nwhile (password != 1234) {\n    if (times++ >= 3) {\n        std::cout << \"Locked!\\n\";\n        break;\n    }\n    std::cout << \"Password: \";\n    std::cin >> password; // input\n}\n```\n\n### Several variations\n\n```cpp\nfor (int i = 0, j = 2; i < 3; i++, j--){\n    std::cout << \"i=\" << i << \",\";\n    std::cout << \"j=\" << j << \";\";\n}\n// Outputs: i=0,j=2;i=1,j=1;i=2,j=0;\n```\n\n## C++ Functions\n\n### Arguments & Returns\n\n```cpp\n#include <iostream>\n\nint add(int a, int b) {\n    return a + b;\n}\n\nint main() {\n    std::cout << add(10, 20);\n}\n```\n\n`add` is a function taking 2 ints and returning int\n\n### Overloading\n\n```cpp\nvoid fun(string a, string b) {\n    std::cout << a + \" \" + b;\n}\nvoid fun(string a) {\n    std::cout << a;\n}\nvoid fun(int a) {\n    std::cout << a;\n}\n```\n\n### Built-in Functions\n\n```cpp\n#include <iostream>\n#include <cmath> // import library\n\nint main() {\n    // sqrt() is from cmath\n    std::cout << sqrt(9);\n}\n```\n\n## C++ Classes & Objects {.cols-2}\n\n### Defining a Class\n\n```cpp\nclass MyClass {\n  public:             // Access specifier\n    int myNum;        // Attribute (int variable)\n    string myString;  // Attribute (string variable)\n};\n\n```\n\n### Creating an Object\n\n```cpp\nMyClass myObj;  // Create an object of MyClass\n\nmyObj.myNum = 15;          // Set the value of myNum to 15\nmyObj.myString = \"Hello\";  // Set the value of myString to \"Hello\"\n\ncout << myObj.myNum << endl;         // Output 15\ncout << myObj.myString << endl;      // Output \"Hello\"\n\n```\n\n### Constructors\n\n```cpp\nclass MyClass {\n  public:\n    int myNum;\n    string myString;\n    MyClass() {  // Constructor\n      myNum = 0;\n      myString = \"\";\n    }\n};\n\nMyClass myObj;  // Create an object of MyClass\n\ncout << myObj.myNum << endl;         // Output 0\ncout << myObj.myString << endl;      // Output \"\"\n\n```\n\n### Destructors\n\n```cpp\nclass MyClass {\n  public:\n    int myNum;\n    string myString;\n    MyClass() {  // Constructor\n      myNum = 0;\n      myString = \"\";\n    }\n    ~MyClass() {  // Destructor\n      cout << \"Object destroyed.\" << endl;\n    }\n};\n\nMyClass myObj;  // Create an object of MyClass\n\n// Code here...\n\n// Object is destroyed automatically when the program exits the scope\n\n\n```\n\n### Class Methods\n\n```cpp\nclass MyClass {\n  public:\n    int myNum;\n    string myString;\n    void myMethod() {  // Method/function defined inside the class\n      cout << \"Hello World!\" << endl;\n    }\n};\n\nMyClass myObj;  // Create an object of MyClass\nmyObj.myMethod();  // Call the method\n```\n\n### Access Modifiers\n\n```cpp\nclass MyClass {\n  public:     // Public access specifier\n    int x;    // Public attribute\n  private:    // Private access specifier\n    int y;    // Private attribute\n  protected:  // Protected access specifier\n    int z;    // Protected attribute\n};\n\nMyClass myObj;\nmyObj.x = 25;  // Allowed (public)\nmyObj.y = 50;  // Not allowed (private)\nmyObj.z = 75;  // Not allowed (protected)\n\n```\n\n### Getters and Setters\n\n```cpp\nclass MyClass {\n  private:\n    int myNum;\n  public:\n    void setMyNum(int num) {  // Setter\n      myNum = num;\n    }\n    int getMyNum() {  // Getter\n      return myNum;\n    }\n};\n\nMyClass myObj;\nmyObj.setMyNum(15);  // Set the value of myNum to 15\ncout << myObj.getMyNum() << endl;  // Output 15\n\n```\n\n### Inheritance\n\n```cpp\nclass Vehicle {\n  public:\n    string brand = \"Ford\";\n    void honk() {\n      cout << \"Tuut, tuut!\" << endl;\n    }\n};\n\nclass Car : public Vehicle {\n  public:\n    string model = \"Mustang\";\n};\n\nCar myCar;\nmyCar.honk();  // Output \"Tuut, tuut!\"\ncout << myCar.brand + \" \" + myCar.model << endl;  // Output \"Ford Mustang\"\n```\n\n## C++ Preprocessor\n\n### Preprocessor {.row-span-3}\n\n- [if](https://en.cppreference.com/w/cpp/preprocessor/conditional)\n- [elif](https://en.cppreference.com/w/cpp/preprocessor/conditional)\n- [else](https://en.cppreference.com/w/cpp/preprocessor/conditional)\n- [endif](https://en.cppreference.com/w/cpp/preprocessor/conditional)\n- [ifdef](https://en.cppreference.com/w/cpp/preprocessor/conditional)\n- [ifndef](https://en.cppreference.com/w/cpp/preprocessor/conditional)\n- [define](https://en.cppreference.com/w/cpp/preprocessor/replace)\n- [undef](https://en.cppreference.com/w/cpp/preprocessor/replace)\n- [include](https://en.cppreference.com/w/cpp/preprocessor/include)\n- [line](https://en.cppreference.com/w/cpp/preprocessor/line)\n- [error](https://en.cppreference.com/w/cpp/preprocessor/error)\n- [pragma](https://en.cppreference.com/w/cpp/preprocessor/impl)\n- [defined](https://en.cppreference.com/w/cpp/preprocessor/conditional)\n- [\\_\\_has_include](https://en.cppreference.com/w/cpp/feature_test)\n- [\\_\\_has_cpp_attribute](https://en.cppreference.com/w/cpp/feature_test)\n- [export](https://en.cppreference.com/w/cpp/keyword/export)\n- [import](https://en.cppreference.com/mwiki/index.php?title=cpp/keyword/import&action=edit&redlink=1)\n- [module](https://en.cppreference.com/mwiki/index.php?title=cpp/keyword/module&action=edit&redlink=1)\n\n{.marker-none .cols-2}\n\n### Includes\n\n```cpp\n#include \"iostream\"\n#include <iostream>\n```\n\n### Defines\n\n```cpp\n#define FOO\n#define FOO \"hello\"\n\n#undef FOO\n```\n\n### If {.row-span-2}\n\n```cpp\n#ifdef DEBUG\n  console.log('hi');\n#elif defined VERBOSE\n  ...\n#else\n  ...\n#endif\n```\n\n### Error\n\n```cpp\n#if VERSION == 2.0\n  #error Unsupported\n  #warning Not really supported\n#endif\n```\n\n### Macro\n\n```cpp\n#define DEG(x) ((x) * 57.29)\n```\n\n### Token concat\n\n```cpp\n#define DST(name) name##_s name##_t\nDST(object);   #=> object_s object_t;\n```\n\n### Stringification\n\n```cpp\n#define STR(name) #name\nchar * a = STR(object);   #=> char * a = \"object\";\n```\n\n### file and line\n\n```cpp\n#define LOG(msg) console.log(__FILE__, __LINE__, msg)\n#=> console.log(\"file.txt\", 3, \"hey\")\n```\n\n## Miscellaneous\n\n### Escape Sequences\n\n| Escape Sequences | Characters            |\n| ---------------- | --------------------- |\n| `\\b`             | Backspace             |\n| `\\f`             | Form feed             |\n| `\\n`             | Newline               |\n| `\\r`             | Return                |\n| `\\t`             | Horizontal tab        |\n| `\\v`             | Vertical tab          |\n| `\\\\`             | Backslash             |\n| `\\'`             | Single quotation mark |\n| `\\\"`             | Double quotation mark |\n| `\\?`             | Question mark         |\n| `\\0`             | Null Character        |\n\n### Keywords {.col-span-2 .row-span-2}\n\n- [alignas](https://en.cppreference.com/w/cpp/keyword/alignas)\n- [alignof](https://en.cppreference.com/w/cpp/keyword/alignof)\n- [and](https://en.cppreference.com/w/cpp/keyword/and)\n- [and_eq](https://en.cppreference.com/w/cpp/keyword/and_eq)\n- [asm](https://en.cppreference.com/w/cpp/keyword/asm)\n- [atomic_cancel](https://en.cppreference.com/w/cpp/keyword/atomic_cancel)\n- [atomic_commit](https://en.cppreference.com/w/cpp/keyword/atomic_commit)\n- [atomic_noexcept](https://en.cppreference.com/w/cpp/keyword/atomic_noexcept)\n- [auto](https://en.cppreference.com/w/cpp/keyword/auto)\n- [bitand](https://en.cppreference.com/w/cpp/keyword/bitand)\n- [bitor](https://en.cppreference.com/w/cpp/keyword/bitor)\n- [bool](https://en.cppreference.com/w/cpp/keyword/bool)\n- [break](https://en.cppreference.com/w/cpp/keyword/break)\n- [case](https://en.cppreference.com/w/cpp/keyword/case)\n- [catch](https://en.cppreference.com/w/cpp/keyword/catch)\n- [char](https://en.cppreference.com/w/cpp/keyword/char)\n- [char8_t](https://en.cppreference.com/w/cpp/keyword/char8_t)\n- [char16_t](https://en.cppreference.com/w/cpp/keyword/char16_t)\n- [char32_t](https://en.cppreference.com/w/cpp/keyword/char32_t)\n- [class](https://en.cppreference.com/w/cpp/keyword/class)\n- [compl](https://en.cppreference.com/w/cpp/keyword/compl)\n- [concept](https://en.cppreference.com/w/cpp/keyword/concept)\n- [const](https://en.cppreference.com/w/cpp/keyword/const)\n- [consteval](https://en.cppreference.com/w/cpp/keyword/consteval)\n- [constexpr](https://en.cppreference.com/w/cpp/keyword/constexpr)\n- [constinit](https://en.cppreference.com/w/cpp/keyword/constinit)\n- [const_cast](https://en.cppreference.com/w/cpp/keyword/const_cast)\n- [continue](https://en.cppreference.com/w/cpp/keyword/continue)\n- [co_await](https://en.cppreference.com/w/cpp/keyword/co_await)\n- [co_return](https://en.cppreference.com/w/cpp/keyword/co_return)\n- [co_yield](https://en.cppreference.com/w/cpp/keyword/co_yield)\n- [decltype](https://en.cppreference.com/w/cpp/keyword/decltype)\n- [default](https://en.cppreference.com/w/cpp/keyword/default)\n- [delete](https://en.cppreference.com/w/cpp/keyword/delete)\n- [do](https://en.cppreference.com/w/cpp/keyword/do)\n- [double](https://en.cppreference.com/w/cpp/keyword/double)\n- [dynamic_cast](https://en.cppreference.com/w/cpp/keyword/dynamic_cast)\n- [else](https://en.cppreference.com/w/cpp/keyword/else)\n- [enum](https://en.cppreference.com/w/cpp/keyword/enum)\n- [explicit](https://en.cppreference.com/w/cpp/keyword/explicit)\n- [export](https://en.cppreference.com/w/cpp/keyword/export)\n- [extern](https://en.cppreference.com/w/cpp/keyword/extern)\n- [false](https://en.cppreference.com/w/cpp/keyword/false)\n- [float](https://en.cppreference.com/w/cpp/keyword/float)\n- [for](https://en.cppreference.com/w/cpp/keyword/for)\n- [friend](https://en.cppreference.com/w/cpp/keyword/friend)\n- [goto](https://en.cppreference.com/w/cpp/keyword/goto)\n- [if](https://en.cppreference.com/w/cpp/keyword/if)\n- [inline](https://en.cppreference.com/w/cpp/keyword/inline)\n- [int](https://en.cppreference.com/w/cpp/keyword/int)\n- [long](https://en.cppreference.com/w/cpp/keyword/long)\n- [mutable](https://en.cppreference.com/w/cpp/keyword/mutable)\n- [namespace](https://en.cppreference.com/w/cpp/keyword/namespace)\n- [new](https://en.cppreference.com/w/cpp/keyword/new)\n- [noexcept](https://en.cppreference.com/w/cpp/keyword/noexcept)\n- [not](https://en.cppreference.com/w/cpp/keyword/not)\n- [not_eq](https://en.cppreference.com/w/cpp/keyword/not_eq)\n- [nullptr](https://en.cppreference.com/w/cpp/keyword/nullptr)\n- [operator](https://en.cppreference.com/w/cpp/keyword/operator)\n- [or](https://en.cppreference.com/w/cpp/keyword/or)\n- [or_eq](https://en.cppreference.com/w/cpp/keyword/or_eq)\n- [private](https://en.cppreference.com/w/cpp/keyword/private)\n- [protected](https://en.cppreference.com/w/cpp/keyword/protected)\n- [public](https://en.cppreference.com/w/cpp/keyword/public)\n- [reflexpr](https://en.cppreference.com/w/cpp/keyword/reflexpr)\n- [register](https://en.cppreference.com/w/cpp/keyword/register)\n- [reinterpret_cast](https://en.cppreference.com/w/cpp/keyword/reinterpret_cast)\n- [requires](https://en.cppreference.com/w/cpp/keyword/requires)\n- [return](https://en.cppreference.com/w/cpp/language/return)\n- [short](https://en.cppreference.com/w/cpp/keyword/short)\n- [signed](https://en.cppreference.com/w/cpp/keyword/signed)\n- [sizeof](https://en.cppreference.com/w/cpp/keyword/sizeof)\n- [static](https://en.cppreference.com/w/cpp/keyword/static)\n- [static_assert](https://en.cppreference.com/w/cpp/keyword/static_assert)\n- [static_cast](https://en.cppreference.com/w/cpp/keyword/static_cast)\n- [struct](https://en.cppreference.com/w/cpp/keyword/struct)\n- [switch](https://en.cppreference.com/w/cpp/keyword/switch)\n- [synchronized](https://en.cppreference.com/w/cpp/keyword/synchronized)\n- [template](https://en.cppreference.com/w/cpp/keyword/template)\n- [this](https://en.cppreference.com/w/cpp/keyword/this)\n- [thread_local](https://en.cppreference.com/w/cpp/keyword/thread_local)\n- [throw](https://en.cppreference.com/w/cpp/keyword/throw)\n- [true](https://en.cppreference.com/w/cpp/keyword/true)\n- [try](https://en.cppreference.com/w/cpp/keyword/try)\n- [typedef](https://en.cppreference.com/w/cpp/keyword/typedef)\n- [typeid](https://en.cppreference.com/w/cpp/keyword/typeid)\n- [typename](https://en.cppreference.com/w/cpp/keyword/typename)\n- [union](https://en.cppreference.com/w/cpp/keyword/union)\n- [unsigned](https://en.cppreference.com/w/cpp/keyword/unsigned)\n- [using](https://en.cppreference.com/w/cpp/keyword/using)\n- [virtual](https://en.cppreference.com/w/cpp/keyword/virtual)\n- [void](https://en.cppreference.com/w/cpp/keyword/void)\n- [volatile](https://en.cppreference.com/w/cpp/keyword/volatile)\n- [wchar_t](https://en.cppreference.com/w/cpp/keyword/wchar_t)\n- [while](https://en.cppreference.com/w/cpp/keyword/while)\n- [xor](https://en.cppreference.com/w/cpp/keyword/xor)\n- [xor_eq](https://en.cppreference.com/w/cpp/keyword/xor_eq)\n- [final](https://en.cppreference.com/w/cpp/language/final)\n- [override](https://en.cppreference.com/w/cpp/language/override)\n- [transaction_safe](https://en.cppreference.com/w/cpp/language/transactional_memory)\n- [transaction_safe_dynamic](https://en.cppreference.com/w/cpp/language/transactional_memory) {.marker-none .cols-5}\n\n### Preprocessor\n\n- [if](https://en.cppreference.com/w/cpp/preprocessor/conditional)\n- [elif](https://en.cppreference.com/w/cpp/preprocessor/conditional)\n- [else](https://en.cppreference.com/w/cpp/preprocessor/conditional)\n- [endif](https://en.cppreference.com/w/cpp/preprocessor/conditional)\n- [ifdef](https://en.cppreference.com/w/cpp/preprocessor/conditional)\n- [ifndef](https://en.cppreference.com/w/cpp/preprocessor/conditional)\n- [define](https://en.cppreference.com/w/cpp/preprocessor/replace)\n- [undef](https://en.cppreference.com/w/cpp/preprocessor/replace)\n- [include](https://en.cppreference.com/w/cpp/preprocessor/include)\n- [line](https://en.cppreference.com/w/cpp/preprocessor/line)\n- [error](https://en.cppreference.com/w/cpp/preprocessor/error)\n- [pragma](https://en.cppreference.com/w/cpp/preprocessor/impl)\n- [defined](https://en.cppreference.com/w/cpp/preprocessor/conditional)\n- [\\_\\_has_include](https://en.cppreference.com/w/cpp/feature_test)\n- [\\_\\_has_cpp_attribute](https://en.cppreference.com/w/cpp/feature_test)\n- [export](https://en.cppreference.com/w/cpp/keyword/export)\n- [import](https://en.cppreference.com/mwiki/index.php?title=cpp/keyword/import&action=edit&redlink=1)\n- [module](https://en.cppreference.com/mwiki/index.php?title=cpp/keyword/module&action=edit&redlink=1) {.marker-none\n  .cols-2}\n\n## Also see\n\n- [C++ Infographics & Cheat Sheets](https://hackingcpp.com/cpp/cheat_sheets.html) _(hackingcpp.com)_\n\n- [C++ reference](https://en.cppreference.com/w/) _(cppreference.com)_\n- [C++ Language Tutorials](http://www.cplusplus.com/doc/tutorial/) _(cplusplus.com)_\n"
  },
  {
    "path": "source/_posts/cron.md",
    "content": "---\ntitle: Cron\ndate: 2020-12-16 18:28:43\nbackground: bg-red-500\ntags:\n  - schedule\n  - crontab\n  - time\ncategories:\n  - Linux Command\nintro: |\n  [Cron](https://en.wikipedia.org/wiki/Cron) is most suitable for scheduling repetitive tasks. Scheduling one-time tasks can be accomplished using the associated at utility.\nplugins:\n  - copyCode\n---\n\n## Crontab Format {.cols-2}\n\n### Format\n\n```\nMin  Hour Day  Mon  Weekday\n```\n\n---\n\n```\n*    *    *    *    *  command to be executed\n```\n\n```\n┬    ┬    ┬    ┬    ┬\n│    │    │    │    └─  Day of Week   (0=Sun .. 6=Sat)\n│    │    │    └──────  Month         (1..12)\n│    │    └───────────  Day of Month  (1..31)\n│    └────────────────  Hour          (0..23)\n└─────────────────────  Minute        (0..59)\n```\n\n---\n\n| Field        | Range  | Special characters |\n| ------------ | ------ | ------------------ |\n| Minute       | 0 - 59 | , - \\* /           |\n| Hour         | 0 - 23 | , - \\* /           |\n| Day of Month | 1 - 31 | , - \\* ? / L W     |\n| Month        | 1 - 12 | , - \\* /           |\n| Day of Week  | 0 - 6  | , - \\* ? / L #     |\n\n{.show-header}\n\n### Examples\n\n| Example        | Description                                                        |\n| -------------- |--------------------------------------------------------------------|\n| `*/15 * * * *` | Every 15 mins                                                      |\n| `0 * * * *`    | Every hour                                                         |\n| `0 */2 * * *`  | Every 2 hours                                                      |\n| `15 2 * * *`   | At 2:15AM (of every day)                                           |\n| `15 2 * * ?`   | At 2:15AM (of every day)                                           |\n| `10 9 * * 5`   | At 9:10AM (of every Friday)                                        |\n| `0 0 * * 0`    | At 12:00 AM, only on Sunday                                        |\n| `15 2 * * 1L`  | At 2:15am on the last monday of every month                        |\n| `15 0 * * 4#2` | At 00:15am on the second thursday of every month                   |\n| `0 0 1 * *`    | At 12:00 AM, on day 1 of the month (1st of month / monthly)        |\n| `0 0 1 1 *`    | At 12:00 AM, on day 1 of the month, only in January (1st of month) |\n| `@reboot`      | Every reboot <br>_(non-standard)_                                  |\n\n\n### Cron Generator {.col-span-3}\n\n<widget name=\"cron\"/>\n\n\n### Special strings\n\n| Special String | Meaning                                              |\n| -------------- | ---------------------------------------------------- |\n| @reboot        | Run once, at system startup _(non-standard)_         |\n| @yearly        | Run once every year, \"0 0 1 1 \\*\" _(non-standard)_   |\n| @annually      | (same as @yearly) _(non-standard)_                   |\n| @monthly       | Run once every month, \"0 0 1 \\* \\*\" _(non-standard)_ |\n| @weekly        | Run once every week, \"0 0 \\* \\* 0\" _(non-standard)_  |\n| @daily         | Run once each day, \"0 0 \\* \\* \\*\" _(non-standard)_   |\n| @midnight      | (same as @daily) _(non-standard)_                    |\n| @hourly        | Run once an hour, \"0 \\* \\* \\* \\*\" _(non-standard)_   |\n\n### Crontab command\n\n| -            | -                                                                       |\n| ------------ | ----------------------------------------------------------------------- |\n| `crontab -e` | Edit or create a crontab file if doesn’t already exist.                 |\n| `crontab -l` | Display the crontab file.                                               |\n| `crontab -r` | Remove the crontab file.                                                |\n| `crontab -v` | Display the last time you edited your crontab file.<br>_(non-standard)_ |\n\n{.shortcuts}\n\n### Special characters {.col-span-2}\n\n| Special Character   | Description                                                                                                                                          |\n| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `Asterik(*)`        | Matches all values in the field or any possible value.                                                                                               |\n| `Hyphen(-)`         | Used to define a range.Ex: 1-5 in 5th field(Day Of Week) Every Weekday i.e., Monday to Friday                                                        |\n| `Slash (/)`         | 1st field(Minute) /15 meaning every fifteen minute or increment of range.                                                                            |\n| `Comma (,)`         | Used to separate items.Ex: 2,6,8 in 2nd fields(Hour) executes at 2am,6am and 8am                                                                     |\n| `L`                 | It is allowed only for Day of Month or Day Of Week field, 2L in Day of week indicates Last tuesday of every month                                    |\n| `Hash (#)`          | It is allowed only for Day Of Week field, which must be followed within range of 1 to 5. For example, 4#1 means \"The first Thursday\" of given month. |\n| `Question mark (?)` | Can be instead of '\\*' and allowed for Day of Month and Day Of Week. Usage is restricted to either Day of Month or Day Of Week in a cron expression. |\n\n## Also see {.cols-1}\n\n- [Devhints](https://devhints.io/cron) _(devhints.io)_\n- [Crontab Generator](https://crontab-generator.org/) _(crontab-generator.org)_\n- [Crontab guru](https://crontab.guru/) _(crontab.guru)_\n"
  },
  {
    "path": "source/_posts/cs.md",
    "content": "---\ntitle: C#\ndate: 2021-12-14 12:22:00\nbackground: bg-[#8c4c8a]\ntags:\n  - object-oriented\n  - class\ncategories:\n  - Programming\nintro: |\n  C# quick reference cheat sheet that provides basic syntax and methods.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Hello.cs\n\n```cs\nclass Hello {\n  // main method\n  static void Main(string[] args)\n  {\n    // Output: Hello, world!\n    Console.WriteLine(\"Hello, world!\");\n  }\n}\n```\n\nCreates a project directory for new console application\n\n```cs\n$ dotnet new console\n```\n\nLists all the applications templates\n\n```cs\n$ dotnet new list\n```\n\nCompiling and running (make sure you are in the project directory)\n\n```shell script\n$ dotnet run\nHello, world!\n```\n\n### Variables\n\n```cs\nint intNum = 9;\nlong longNum = 9999999;\nfloat floatNum = 9.99F;\ndouble doubleNum = 99.999;\ndecimal decimalNum = 99.9999M;\nchar letter = 'D';\nbool @bool = true;\nstring site = \"cheatsheets.zip\";\n\nvar num = 999;\nvar str = \"999\";\nvar bo = false;\n```\n\n### Primitive Data Types\n\n| Data Type | Size             | Range                     |\n| --------- | ---------------- | ------------------------- |\n| `int`     | 4 bytes          | -2^31^ ^to^ 2^31^-1       |\n| `long`    | 8 bytes          | -2^63^ ^to^ 2^63^-1       |\n| `float`   | 4 bytes          | 6 ^to^ 7 decimal digits   |\n| `double`  | 8 bytes          | 15 decimal digits         |\n| `decimal` | 16 bytes         | 28 ^to^ 29 decimal digits |\n| `char`    | 2 bytes          | 0 ^to^ 65535              |\n| `bool`    | 1 bit            | true / false              |\n| `string`  | 2 bytes per char | _N/A_                     |\n\n{.show-header}\n\n### Comments\n\n```cs\n// Single-line comment\n\n/* Multi-line\n   comment */\n\n// TODO: Adds comment to a task list in Visual Studio\n\n/// Single-line comment used for documentation\n\n/** Multi-line comment\n    used for documentation **/\n\n```\n\n### Strings\n\n```cs\nstring first = \"John\";\nstring last = \"Doe\";\n\n// string concatenation\nstring name = first + \" \" + last;\nConsole.WriteLine(name); // => John Doe\n```\n\nSee: [Strings](#c-strings)\n\n### User Input\n\n```cs\nConsole.WriteLine(\"Enter number:\");\nif(int.TryParse(Console.ReadLine(),out int input))\n{\n  // Input validated\n  Console.WriteLine($\"You entered {input}\");\n}\n```\n\n### Conditionals\n\n```cs\nint j = 10;\n\nif (j == 10) {\n  Console.WriteLine(\"I get printed\");\n} else if (j > 10) {\n  Console.WriteLine(\"I don't\");\n} else {\n  Console.WriteLine(\"I also don't\");\n}\n```\n\n### Arrays\n\n```cs\nchar[] chars = new char[10];\nchars[0] = 'a';\nchars[1] = 'b';\n\nstring[] letters = {\"A\", \"B\", \"C\"};\nint[] mylist = {100, 200};\nbool[] answers = {true, false};\n```\n\n### Loops\n\n```cs\nint[] numbers = {1, 2, 3, 4, 5};\n\nfor(int i = 0; i < numbers.Length; i++) {\n  Console.WriteLine(numbers[i]);\n}\n```\n\n---\n\n```cs\nforeach(int num in numbers) {\n  Console.WriteLine(num);\n}\n```\n\n## C# Strings\n\n### String concatenation\n\n```cs\nstring first = \"John\";\nstring last = \"Doe\";\n\nstring name = first + \" \" + last;\nConsole.WriteLine(name); // => John Doe\n```\n\n### String interpolation\n\n```cs\nstring first = \"John\";\nstring last = \"Doe\";\n\nstring name = $\"{first} {last}\";\nConsole.WriteLine(name); // => John Doe\n```\n\n### String Members {.row-span-2}\n\n| Member     | Description                                                                                                                          |\n| ---------- | ------------------------------------------------------------------------------------------------------------------------------------ |\n| Length     | A property that returns the length of the string.                                                                                    |\n| Compare()  | A static method that compares two strings.                                                                                           |\n| Contains() | Determines if the string contains a specific substring.                                                                              |\n| Equals()   | Determines if the two strings have the same character data.                                                                          |\n| Format()   | Formats a string via the {0} notation and by using other primitives.                                                                 |\n| Trim()     | Removes all instances of specific characters from trailing and leading characters. Defaults to removing leading and trailing spaces. |\n| Split()    | Removes the provided character and creates an array out of the remaining characters on either side.                                  |\n\n{.show-header}\n\n### Verbatim strings\n\n```cs {.wrap}\nstring longString = @\"I can type any characters in here !#@$%^&*()__+ '' \\n \\t except double quotes and I will be taken literally. I even work with multiple lines.\";\n```\n\n### Member Example\n\n```cs\n// Using property of System.String\nstring lengthOfString = \"How long?\";\nlengthOfString.Length           // => 9\n\n// Using methods of System.String\nlengthOfString.Contains(\"How\"); // => true\n```\n\n## Misc\n\n### General .NET Terms {.col-span-2}\n\n| Term                          | Definition                                                                                                                                                                                         |\n| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Runtime                       | A collection of services that are required to execute a given compiled unit of code.                                                                                                               |\n| Common Language Runtime (CLR) | Primarily locates, loads, and managed .NET objects. The CLR also handles memory management, application hosting, coordination of threads, performing security checks, and other low-level details. |\n| Managed code                  | Code that compiles and runs on .NET runtime. C#/F#/VB are examples.                                                                                                                                |\n| Unmanaged code                | Code that compiles straight to machine code and cannot be directly hosted by the .NET runtime. Contains no free memory management, garbage collection, etc. DLLs created from C/C++ are examples.  |\n\n{.show-header}\n"
  },
  {
    "path": "source/_posts/css3.md",
    "content": "---\ntitle: CSS 3\ndate: 2020-12-25 20:22:47\nbackground: bg-[#3473b5]\ntags:\n  - web\n  - css\n  - style\ncategories:\n  - Programming\nintro: |\n  This is a quick reference cheat sheet for CSS goodness, listing selector syntax, properties, units and other useful bits of information.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### Introduction {.row-span-3}\n\nCSS is rich in capabilities and is more than simply laying out pages.\n\n#### External stylesheet\n\n```html {.wrap}\n<link href=\"./path/to/stylesheet/style.css\" rel=\"stylesheet\" type=\"text/css\" />\n```\n\n#### Internal stylesheet\n\n```html\n<style>\n  body {\n    background-color: linen;\n  }\n</style>\n```\n\n#### Inline styles\n\n```html {.wrap}\n<h2 style=\"text-align: center;\">Centered text</h2>\n\n<p style=\"color: blue; font-size: 18px;\">Blue, 18-point text</p>\n```\n\n### Add class\n\n```html\n<div class=\"classname\"></div>\n<div class=\"class1 classn ...\"></div>\n```\n\nSupport multiple classes on one element.\n\n### !important\n\n```css\n.post-title {\n  color: blue !important;\n}\n```\n\nOverrides all previous styling rules.\n\n### Selector\n\n```css\nh1 {\n}\n#job-title {\n}\ndiv.hero {\n}\ndiv > p {\n}\n```\n\nSee: [Selectors](#css-selectors)\n\n### Text color\n\n```css\ncolor: #2a2aff;\ncolor: green;\ncolor: rgb(34, 12, 64, 0.6);\ncolor: hsla(30 100% 50% / 0.6);\n```\n\nSee: [Colors](#css-colors)\n\n### Background\n\n```css\nbackground-color: blue;\nbackground-image: url('nyan-cat.gif');\nbackground-image: url('../image.png');\n```\n\nSee: [Backgrounds](#css-backgrounds)\n\n### Font\n\n```css\n.page-title {\n  font-weight: bold;\n  font-size: 30px;\n  font-family: 'Courier New';\n}\n```\n\nSee: [Fonts](#css-fonts)\n\n### Position\n\n```css\n.box {\n  position: relative;\n  top: 20px;\n  left: 20px;\n}\n```\n\nSee also: [Position](https://learn-the-web.algonquindesign.ca/topics/css-layout-cheat-sheet/)\n\n### Animation\n\n```css\nanimation: 300ms linear 0s infinite;\n\nanimation: bounce 300ms linear infinite;\n```\n\nSee: [Animation](#css-animation)\n\n### Comment\n\n```css\n/* This is a single line comment */\n\n/* This is a \n   multi-line comment */\n```\n\n### Flex layout\n\n```css\ndiv {\n  display: flex;\n  justify-content: center;\n}\ndiv {\n  display: flex;\n  justify-content: flex-start;\n}\n```\n\nSee: [Flexbox](#css-flexbox) | [Flex Tricks](#css-flexbox-tricks)\n\n### Grid layout\n\n```css\n#container {\n  display: grid;\n  grid: repeat(2, 60px) / auto-flow 80px;\n}\n\n#container > div {\n  background-color: #8ca0ff;\n  width: 50px;\n  height: 50px;\n}\n```\n\nSee: [Grid Layout](#css-grid-layout)\n\n### Variable & Counter\n\n```css\ncounter-set: subsection;\ncounter-increment: subsection;\ncounter-reset: subsection 0;\n\n:root {\n  --bg-color: brown;\n}\nelement {\n  background-color: var(--bg-color);\n}\n```\n\nSee: [Dynamic content](#css-dynamic-content)\n\n## CSS Selectors\n\n### Examples {.row-span-2}\n\n#### Groups Selector\n\n```css\nh1,\nh2 {\n  color: red;\n}\n```\n\n#### Chaining Selector\n\n```css\nh3.section-heading {\n  color: blue;\n}\n```\n\n#### Attribute Selector\n\n```css\ndiv[attribute='SomeValue'] {\n  background-color: red;\n}\n```\n\n#### First Child Selector\n\n```css\np:first-child {\n  font-weight: bold;\n}\n```\n\n#### No Children Selector\n\n```css\n.box:empty {\n  background: lime;\n  height: 80px;\n  width: 80px;\n}\n```\n\n### Basic\n\n|              |                             |\n| ------------ | --------------------------- |\n| `*`          | All elements                |\n| `div`        | All div tags                |\n| `.classname` | All elements with class     |\n| `#idname`    | Element with ID             |\n| `div,p`      | All divs and paragraphs     |\n| `#idname *`  | All elements inside #idname |\n\nSee also: [Type](https://developer.mozilla.org/en-US/docs/Web/CSS/Type_selectors) /\n[Class](https://developer.mozilla.org/en-US/docs/Web/CSS/Class_selectors) /\n[ID](https://developer.mozilla.org/en-US/docs/Web/CSS/ID_selectors) /\n[Universal](https://developer.mozilla.org/en-US/docs/Web/CSS/Universal_selectors) selectors\n\n### Combinators\n\n| Selector        | Description                           |\n| --------------- | ------------------------------------- |\n| `div.classname` | Div with certain classname            |\n| `div#idname`    | Div with certain ID                   |\n| `div p`         | Paragraphs inside divs                |\n| `div > p`       | All p tags<br>_one level deep in div_ |\n| `div + p`       | P tags immediately after div          |\n| `div ~ p`       | P tags preceded by div                |\n\nSee also: [Adjacent](https://developer.mozilla.org/en-US/docs/Web/CSS/Adjacent_sibling_combinator) /\n[Sibling](https://developer.mozilla.org/en-US/docs/Web/CSS/General_sibling_combinator) /\n[Child](https://developer.mozilla.org/en-US/docs/Web/CSS/Child_combinator) selectors\n\n### Attribute selectors\n\n|                      |                                    |\n| -------------------- | ---------------------------------- | ---------------------------- |\n| `a[target]`          | With a <yel>target</yel> attribute |\n| `a[target=\"_blank\"]` | Open in new tab                    |\n| `a[href^=\"/index\"]`  | Starts with <yel>/index</yel>      |\n| `[class              | =\"chair\"]`                         | Starts with <yel>chair</yel> |\n| `[class*=\"chair\"]`   | containing <yel>chair</yel>        |\n| `[title~=\"chair\"]`   | Contains the word <yel>chair</yel> |\n| `a[href$=\".doc\"]`    | Ends with <yel>.doc</yel>          |\n| `[type=\"button\"]`    | Specified type                     |\n\nSee also: [Attribute selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors)\n\n### User action pseudo classes\n\n|              |                         |\n| ------------ | ----------------------- |\n| `a:link    ` | Link in normal state    |\n| `a:active  ` | Link in clicked state   |\n| `a:hover   ` | Link with mouse over it |\n| `a:visited ` | Visited link            |\n\n### Pseudo classes\n\n|                   |                                                                                         |\n| ----------------- | --------------------------------------------------------------------------------------- |\n| `p::after`        | Add content after p                                                                     |\n| `p::before`       | Add content before p                                                                    |\n| `p::first-letter` | First letter in p                                                                       |\n| `p::first-line`   | First line in p                                                                         |\n| `::selection`     | Selected by user                                                                        |\n| `::placeholder`   | [Placeholder](https://developer.mozilla.org/en-US/docs/Web/CSS/::placeholder) attribute |\n| `:root`           | Documents root element                                                                  |\n| `:target`         | Highlight active anchor                                                                 |\n| `div:empty`       | Element with no children                                                                |\n| `p:lang(en)`      | P with en language attribute                                                            |\n| `:not(span)`      | Element that's not a span                                                               |\n\n### Input pseudo classes\n\n|                       |                                                                                             |\n| --------------------- | ------------------------------------------------------------------------------------------- |\n| `input:checked`       | Checked inputs                                                                              |\n| `input:disabled`      | Disabled inputs                                                                             |\n| `input:enabled`       | Enabled inputs                                                                              |\n| `input:focus`         | Input has focus                                                                             |\n| `input:in-range`      | Value in range                                                                              |\n| `input:out-of-range`  | Input value out of range                                                                    |\n| `input:valid`         | Input with valid value                                                                      |\n| `input:invalid`       | Input with invalid value                                                                    |\n| `input:optional`      | No required attribute                                                                       |\n| `input:required`      | Input with required attribute                                                               |\n| `input:read-only`     | With readonly attribute                                                                     |\n| `input:read-write`    | No readonly attribute                                                                       |\n| `input:indeterminate` | With [indeterminate](https://developer.mozilla.org/en-US/docs/Web/CSS/:indeterminate) state |\n\n### Structural pseudo classes\n\n|                         |                            |\n| ----------------------- | -------------------------- |\n| `p:first-child`         | First child                |\n| `p:last-child`          | Last child                 |\n| `p:first-of-type`       | First of some type         |\n| `p:last-of-type`        | Last of some type          |\n| `p:nth-child(2)`        | Second child of its parent |\n| `p:nth-child(3n42)`     | Nth-child (an + b) formula |\n| `p:nth-last-child(2)`   | Second child from behind   |\n| `p:nth-of-type(2)`      | Second p of its parent     |\n| `p:nth-last-of-type(2)` | ...from behind             |\n| `p:only-of-type`        | Unique of its parent       |\n| `p:only-child`          | Only child of its parent   |\n\n## CSS Fonts\n\n### Properties {.row-span-3}\n\n| Property          | Description     |\n| ----------------- | --------------- |\n| `font-family:`    | \\<font> <fontN> |\n| `font-size:`      | \\<size>         |\n| `letter-spacing:` | \\<size>         |\n| `line-height:`    | \\<number>       |\n\n| `font-weight:` | \\<number> / bold / normal | | `font-style:` | italic / normal | | `text-decoration:` | underline /\nnone |\n\n| `text-align:` | left / right<br>center / justify | | `text-transform:` | capitalize / uppercase / lowercase |\n{.left-text}\n\nSee also: [Font](https://developer.mozilla.org/en-US/docs/Web/CSS/font)\n\n### Shorthand {.secondary .col-span-2}\n\n|         | style    | weight | size (required) |     | line-height | family            |\n| ------- | -------- | ------ | --------------- | --- | ----------- | ----------------- |\n| `font:` | `italic` | `400`  | `14px`          | `/` | `1.5`       | `sans-serif`      |\n|         | style    | weight | size (required) |     | line-height | family (required) |\n\n### Example\n\n```css\nfont-family: Arial, sans-serif;\nfont-size: 12pt;\nletter-spacing: 0.02em;\n```\n\n### Case {.row-span-2}\n\n```css\n/* Hello */\ntext-transform: capitalize;\n\n/* HELLO */\ntext-transform: uppercase;\n\n/* hello */\ntext-transform: lowercase;\n```\n\n### @font-face\n\n```css\n@font-face {\n  font-family: 'Glegoo';\n  src: url('../Glegoo.woff');\n}\n```\n\n## CSS Colors\n\n### Named color\n\n```css\ncolor: red;\ncolor: orange;\ncolor: tan;\ncolor: rebeccapurple;\n```\n\n### Hexadecimal color\n\n```css\ncolor: #090;\ncolor: #009900;\ncolor: #090a;\ncolor: #009900aa;\n```\n\n### rgb() Colors\n\n```css\ncolor: rgb(34, 12, 64, 0.6);\ncolor: rgba(34, 12, 64, 0.6);\ncolor: rgb(34 12 64 / 0.6);\ncolor: rgba(34 12 64 / 0.3);\ncolor: rgb(34 12 64 / 60%);\ncolor: rgba(34.6 12 64 / 30%);\n```\n\n### HSL Colors\n\n```css\ncolor: hsl(30, 100%, 50%, 0.6);\ncolor: hsla(30, 100%, 50%, 0.6);\ncolor: hsl(30 100% 50% / 0.6);\ncolor: hsla(30 100% 50% / 0.6);\ncolor: hsl(30 100% 50% / 60%);\ncolor: hsla(30.2 100% 50% / 60%);\n```\n\n### Other\n\n```css\ncolor: inherit;\ncolor: initial;\ncolor: unset;\ncolor: transparent;\n\ncolor: currentcolor; /* keyword */\n```\n\n## CSS Backgrounds\n\n### Properties {.row-span-2}\n\n| Property      | Description   |\n| ------------- | ------------- |\n| `background:` | _(Shorthand)_ |\n\n| `background-color:` | See: [Colors](#css-colors) | | `background-image:` | url(...) | | `background-position:` |\nleft/center/right<br/>top/center/bottom | | `background-size:` | cover X Y | | `background-clip:` |\nborder-box<br/>padding-box<br/>content-box | | `background-repeat:` | no-repeat<br/>repeat-x<br/>repeat-y | |\n`background-attachment:` | scroll/fixed/local | {.left-text}\n\n### Shorthand {.secondary .col-span-2}\n\n|               | color  | image        | positionX | positionY |     | size           | repeat      | attachment |\n| ------------- | ------ | ------------ | --------- | --------- | --- | -------------- | ----------- | ---------- |\n| `background:` | `#ff0` | `url(a.jpg)` | `left`    | `top`     | `/` | `100px` `auto` | `no-repeat` | `fixed;`   |\n| `background:` | `#abc` | `url(b.png)` | `center`  | `center`  | `/` | `cover`        | `repeat-x`  | `local;`   |\n|               | color  | image        | posX      | posY      |     | size           | repeat      | attach..   |\n\n### Examples {.col-span-2}\n\n```css {.wrap}\nbackground: url(img_man.jpg) no-repeat center;\n\nbackground:\n  url(img_flwr.gif) right bottom no-repeat,\n  url(paper.gif) left top repeat;\n\nbackground: rgb(2, 0, 36);\nbackground: linear-gradient(\n  90deg,\n  rgba(2, 0, 36, 1) 0%,\n  rgba(13, 232, 230, 1) 35%,\n  rgba(0, 212, 255, 1) 100%\n);\n```\n\n## CSS The Box Model\n\n### Maximums/Minimums\n\n```css\n.column {\n  max-width: 200px;\n  width: 500px;\n}\n```\n\nSee also: [max-width](https://developer.mozilla.org/en-US/docs/Web/CSS/max-width) /\n[min-width](https://developer.mozilla.org/en-US/docs/Web/CSS/min-width) /\n[max-height](https://developer.mozilla.org/en-US/docs/Web/CSS/max-height) /\n[min-height](https://developer.mozilla.org/en-US/docs/Web/CSS/min-height)\n\n### Margin / Padding\n\n```css\n.block-one {\n  margin: 20px;\n  padding: 10px;\n}\n```\n\nSee also: [Margin](https://developer.mozilla.org/en-US/docs/Web/CSS/margin) /\n[Padding](https://developer.mozilla.org/en-US/docs/Web/CSS/padding)\n\n### Box-sizing\n\n```css\n.container {\n  box-sizing: border-box;\n}\n```\n\nSee also: [Box-sizing](https://developer.mozilla.org/en-US/docs/Web/CSS/Box-sizing)\n\n### Visibility\n\n```css\n.invisible-elements {\n  visibility: hidden;\n}\n```\n\nSee also: [Visibility](https://developer.mozilla.org/en-US/docs/Web/CSS/visibility)\n\n### Auto keyword\n\n```css\ndiv {\n  margin: auto;\n}\n```\n\nSee also: [Margin](https://developer.mozilla.org/en-US/docs/Web/CSS/margin)\n\n### Overflow\n\n```css\n.small-block {\n  overflow: scroll;\n}\n```\n\nSee also: [Overflow](https://developer.mozilla.org/en-US/docs/Web/CSS/overflow)\n\n## CSS Animation {.cols-5}\n\n### Shorthand {.col-span-5 .secondary}\n\n|              | name     | duration | timing-function | delay   | count      | direction           | fill-mode | play-state |\n| ------------ | -------- | -------- | --------------- | ------- | ---------- | ------------------- | --------- | ---------- |\n| `animation:` | `bounce` | `300ms`  | `linear`        | `100ms` | `infinite` | `alternate-reverse` | `both`    | `reverse`  |\n|              | name     | duration | timing-function | delay   | count      | direction           | fill-mode | play-state |\n\n### Properties {.row-span-2 .col-span-2}\n\n| Property                     | Value                                                  |\n| ---------------------------- | ------------------------------------------------------ |\n| `animation:`                 | _(shorthand)_                                          |\n| `animation-name:`            | \\<name>                                                |\n| `animation-duration:`        | \\<time>ms                                              |\n| `animation-timing-function:` | ease / linear / ease-in / ease-out / ease-in-out       |\n| `animation-delay:`           | \\<time>ms                                              |\n| `animation-iteration-count:` | infinite / \\<number>                                   |\n| `animation-direction:`       | normal / reverse / alternate / alternate-reverse       |\n| `animation-fill-mode:`       | none / forwards / backwards / both / initial / inherit |\n| `animation-play-state:`      | normal / reverse / alternate / alternate-reverse       |\n\n{.left-text}\n\nSee also: [Animation](https://developer.mozilla.org/en-US/docs/Web/CSS/animation)\n\n### Example {.col-span-3}\n\n```css\n/* @keyframes duration | timing-function | delay |\n   iteration-count | direction | fill-mode | play-state | name */\nanimation: 3s ease-in 1s 2 reverse both paused slidein;\n\n/* @keyframes duration | timing-function | delay | name */\nanimation: 3s linear 1s slidein;\n\n/* @keyframes duration | name */\nanimation: 3s slidein;\n\nanimation: 4s linear 0s infinite alternate move_eye;\nanimation: bounce 300ms linear 0s infinite normal;\nanimation: bounce 300ms linear infinite;\nanimation: bounce 300ms linear infinite alternate-reverse;\nanimation: bounce 300ms linear 2s infinite alternate-reverse forwards normal;\n```\n\n### Javascript Event {.col-span-3}\n\n```js\n.one('webkitAnimationEnd oanimationend msAnimationEnd animationend')\n```\n\n## CSS Flexbox {.cols-2}\n\n### Simple example\n\n```css\n.container {\n  display: flex;\n}\n```\n\n```css\n.container > div {\n  flex: 1 1 auto;\n}\n```\n\n### Container {.row-span-2}\n\n.container {\n\n```css\ndisplay: flex;\ndisplay: inline-flex;\n```\n\n```css\nflex-direction: row; /* ltr - default */\nflex-direction: row-reverse; /* rtl */\nflex-direction: column; /* top-bottom */\nflex-direction: column-reverse; /* bottom-top */\n```\n\n```css\nflex-wrap: nowrap; /* one-line */\nflex-wrap: wrap; /* multi-line */\n```\n\n```css\nalign-items: flex-start; /* vertical-align to top */\nalign-items: flex-end; /* vertical-align to bottom */\nalign-items: center; /* vertical-align to center */\nalign-items: stretch; /* same height on all (default) */\n```\n\n```css\njustify-content: flex-start; /* [xxx        ] */\njustify-content: center; /* [    xxx    ] */\njustify-content: flex-end; /* [        xxx] */\njustify-content: space-between; /* [x    x    x] */\njustify-content: space-around; /* [ x   x   x ] */\njustify-content: space-evenly; /* [  x  x  x  ] */\n```\n\n}\n\n### Child\n\n.container > div {\n\n```css\n/* This: */\nflex: 1 0 auto;\n\n/* Is equivalent to this: */\nflex-grow: 1;\nflex-shrink: 0;\nflex-basis: auto;\n```\n\n```css\norder: 1;\n```\n\n```css\nalign-self: flex-start; /* left */\nmargin-left: auto; /* right */\n```\n\n}\n\n## CSS Flexbox Tricks\n\n### Vertical center\n\n```css\n.container {\n  display: flex;\n}\n\n.container > div {\n  width: 100px;\n  height: 100px;\n  margin: auto;\n}\n```\n\n### Vertical center (2)\n\n```css\n.container {\n  display: flex;\n\n  /* vertical */\n  align-items: center;\n\n  /* horizontal */\n  justify-content: center;\n}\n```\n\n### Reordering\n\n```css\n.container > .top {\n  order: 1;\n}\n\n.container > .bottom {\n  order: 2;\n}\n```\n\n### Mobile layout\n\n```css\n.container {\n  display: flex;\n  flex-direction: column;\n}\n\n.container > .top {\n  flex: 0 0 100px;\n}\n\n.container > .content {\n  flex: 1 0 auto;\n}\n```\n\nA fixed-height top bar and a dynamic-height content area.\n\n### Table-like {.col-span-2}\n\n```css\n.container {\n  display: flex;\n}\n\n/* the 'px' values here are just suggested percentages */\n.container > .checkbox {\n  flex: 1 0 20px;\n}\n.container > .subject {\n  flex: 1 0 400px;\n}\n.container > .date {\n  flex: 1 0 120px;\n}\n```\n\nThis creates columns that have different widths, but size accordingly according to the circumstances.\n\n### Vertical\n\n```css\n.container {\n  align-items: center;\n}\n```\n\nVertically-center all items.\n\n### Left and right {.col-span-2}\n\n```css\n.menu > .left {\n  align-self: flex-start;\n}\n.menu > .right {\n  align-self: flex-end;\n}\n```\n\n## CSS Grid Layout\n\n### Grid Template Columns\n\n```css\n#grid-container {\n  display: grid;\n  width: 100px;\n  grid-template-columns: 20px 20% 60%;\n}\n```\n\n### fr Relative Unit\n\n```css\n.grid {\n  display: grid;\n  width: 100px;\n  grid-template-columns: 1fr 60px 1fr;\n}\n```\n\n### Grid Gap\n\n```css\n/*The distance between rows is 20px*/\n/*The distance between columns is 10px*/\n#grid-container {\n  display: grid;\n  grid-gap: 20px 10px;\n}\n```\n\n### CSS Block Level Grid\n\n```css\n#grid-container {\n  display: block;\n}\n```\n\n### CSS grid-row\n\nCSS syntax:\n\n- grid-row: grid-row-start / grid-row-end;\n\n#### Example\n\n```css\n.item {\n  grid-row: 1 / span 2;\n}\n```\n\n### CSS Inline Level Grid\n\n```css\n#grid-container {\n  display: inline-grid;\n}\n```\n\n### minmax() Function\n\n```css {.wrap}\n.grid {\n  display: grid;\n  grid-template-columns: 100px minmax(100px, 500px) 100px;\n}\n```\n\n### grid-row-start & grid-row-end\n\nCSS syntax:\n\n- grid-row-start: auto|row-line;<br>\n- grid-row-end: auto|row-line|span n;\n\n#### Example\n\n```css\ngrid-row-start: 2;\ngrid-row-end: span 2;\n```\n\n### CSS grid-row-gap\n\n```css\ngrid-row-gap: length;\n```\n\nAny legal length value, like px or %. 0 is the default value\n\n### CSS grid-area\n\n```css\n.item1 {\n  grid-area: 2 / 1 / span 2 / span 3;\n}\n```\n\n### Justify Items\n\n```css\n#container {\n  display: grid;\n  justify-items: center;\n  grid-template-columns: 1fr;\n  grid-template-rows: 1fr 1fr 1fr;\n  grid-gap: 10px;\n}\n```\n\n### CSS grid-template-areas\n\n```css\n.item {\n  grid-area: nav;\n}\n.grid-container {\n  display: grid;\n  grid-template-areas:\n    'nav nav . .'\n    'nav nav . .';\n}\n```\n\n### Justify Self\n\n```css\n#grid-container {\n  display: grid;\n  justify-items: start;\n}\n\n.grid-items {\n  justify-self: end;\n}\n```\n\nThe grid items are positioned to the right (end) of the row.\n\n### Align Items\n\n```css\n#container {\n  display: grid;\n  align-items: start;\n  grid-template-columns: 1fr;\n  grid-template-rows: 1fr 1fr 1fr;\n  grid-gap: 10px;\n}\n```\n\n## CSS Dynamic Content\n\n### Variable\n\nDefine CSS Variable\n\n```css\n:root {\n  --first-color: #16f;\n  --second-color: #ff7;\n}\n```\n\nVariable Usage\n\n```css\n#firstParagraph {\n  background-color: var(--first-color);\n  color: var(--second-color);\n}\n```\n\nSee also: [CSS Variable](https://developer.mozilla.org/en-US/docs/Web/CSS/--*)\n\n### Counter\n\n```css\n/* Set \"my-counter\" to 0 */\ncounter-set: my-counter;\n```\n\n```css\n/* Increment \"my-counter\" by 1 */\ncounter-increment: my-counter;\n```\n\n```css\n/* Decrement \"my-counter\" by 1 */\ncounter-increment: my-counter -1;\n```\n\n```css\n/* Reset \"my-counter\" to 0 */\ncounter-reset: my-counter;\n```\n\nSee also: [Counter set](https://developer.mozilla.org/en-US/docs/Web/CSS/counter-set)\n\n### Using counters\n\n```css\nbody {\n  counter-reset: section;\n}\n\nh3::before {\n  counter-increment: section;\n  content: 'Section.' counter(section);\n}\n```\n\n```css\nol {\n  counter-reset: section;\n  list-marker-type: none;\n}\n\nli::before {\n  counter-increment: section;\n  content: counters(section, '.') ' ';\n}\n```\n\n## Css 3 tricks\n\n### Scrollbar smooth\n\n```css\nhtml {\n  scroll-behavior: smooth;\n}\n```\n\n[Click me](#css-getting-started), the page will scroll smoothly to Getting started\n\n## Modern CSS\n\n### container queries(size)\n\n```css\n.element-wrap {\n  container: element / inline-size;\n}\n@container element (min-inline-size: 300px) {\n  .element {\n    display: flex;\n    gap: 1rem;\n  }\n}\n```\n\n### container qeries(style)\n\n```css\n.container {\n  --variant: 1;\n\n  &.variant2 {\n    --variant: 2;\n  }\n}\n\n@container style(--variant: 1) {\n  button {\n  } /* You can't style .container, but can select inside it */\n  .other-things {\n  }\n}\n\n@container style(--variant: 2) {\n  button {\n  }\n  .whatever {\n  }\n}\n```\n\n### container units\n\n- The units are cqw (“container query width”),\n- cqh (“container query height”),\n- cqi (“container query inline”),\n- cqb (“container query block”),\n- cqmin (smaller of cqi and cqb),\n- and cqmax (larger of cqi and cqb)\n\n```css\n.card {\n  padding: 5cqi;\n  font-size: 4cqi;\n  border: 1cqi solid brown;\n  height: 100%;\n}\n\nh2 {\n  font-size: 10cqi;\n  margin-block: 0 3cqi;\n}\n```\n\n### the :has() pseudo selector\n\n```css\nfigure:has(figcaption) {\n  border: 1px solid black;\n  padding: 0.5rem;\n}\n```\n\n### nesting\n\n```css\n.cards {\n  .card {\n    & .card-description {\n      color: blue;\n    }\n    & .card-title {\n      color: red;\n    }\n  }\n}\n```\n\n###\n\n### scoping\n\n```css\n@scope {\n  :scope {\n    display: grid;\n    grid-template-columns: 1fr 1fr;\n    gap: 1rem;\n    padding: 1rem;\n    border: 1px solid black;\n  }\n  .card {\n    padding: 1rem;\n    border: 1px solid black;\n    background: lightgray;\n    h2 {\n      margin: 0 0 1rem 0;\n    }\n  }\n}\n```\n\n### cascade layers\n\n```css\n/* Specify the order to apply styles in cascade */\n@layer legacyCard, newCard;\n\n/* Imagine you have a lot of styles */\n@layer newCard {\n  .card {\n    background-color: red;\n  }\n}\n@layer legacyCard {\n  .card {\n    background-color: green;\n  }\n}\n```\n\n### logical properties\n\n```css\nbutton {\n  background-color: #4caf50;\n  border: none;\n  color: white;\n  padding: 0.5rem 1.5rem;\n  text-decoration: none;\n  font: inherit;\n  border-radius: 4px;\n  .icon {\n    position: relative;\n    top: 0.125em;\n    fill: white;\n    width: 1em;\n    aspect-ratio: 1;\n    margin-inline-end: 0.25rem;\n  }\n}\n```\n\n### p3 colors\n\n```html\n<div class=\"container\">\n  <div class=\"swatch\">\n    <style contenteditable>\n      @scope {\n        :scope {\n          background-color: color(display-p3 1 0.5 0);\n        }\n      }\n    </style>\n  </div>\n  <div class=\"swatch\">\n    <style contenteditable>\n      @scope {\n        :scope {\n          background-color: oklch(61.88% 0.286 342.4);\n        }\n      }\n    </style>\n  </div>\n  <div class=\"swatch\">\n    <style contenteditable>\n      @scope {\n        :scope {\n          background-color: oklab(0.73 0.15 0.16);\n        }\n      }\n    </style>\n  </div>\n\n  <div class=\"swatch\">\n    <style contenteditable>\n      @scope {\n        :scope {\n          background-image: linear-gradient(to right in oklch, red, blue);\n        }\n      }\n    </style>\n  </div>\n\n  <div class=\"swatch\">\n    <style contenteditable>\n      @scope {\n        :scope {\n          background-image: linear-gradient(to right in oklab, red, blue);\n        }\n      }\n    </style>\n  </div>\n\n  <div class=\"swatch\">\n    <style contenteditable>\n      @scope {\n        :scope {\n          background-image: linear-gradient(to right in srgb, red, blue);\n        }\n      }\n    </style>\n  </div>\n</div>\n```\n\n### color mixing\n\n```css\n.swatch {\n  color: white;\n  width: 100px;\n  aspect-ratio: 1;\n  display: grid;\n  place-items: center;\n  text-align: center;\n\n  &:nth-child(1) {\n    background-color: var(--bg);\n  }\n  &:nth-child(2) {\n    background-color: color-mix(in oklch, var(--bg), black 30%);\n  }\n  &:nth-child(3) {\n    background-color: color-mix(in oklch, var(--bg), white 30%);\n  }\n}\n```\n\n### margin trim\n\n```css\n.container {\n  /* prevent \"extra\" margin at the end of the element */\n  margin-trim: block-end;\n\n  /* an element like this might be the culprit, but it could be anything */\n  > p {\n    margin-block-end: 1rem;\n  }\n}\n```\n\n### text wrapping\n\n```css\n.balance {\n  text-wrap: balance;\n}\n.pretty {\n  text-wrap: pretty;\n}\n\nhtml {\n  font-family: system-ui, sans-serif;\n}\n\nmain {\n  max-inline-size: 60ch;\n  margin-inline: auto;\n}\n```\n\n### subgrid\n\n```css\n.grid {\n  display: grid;\n  grid-template-columns: repeat(9, 1fr);\n  grid-template-rows: repeat(4, minmax(100px, auto));\n}\n\n.item {\n  display: grid;\n  grid-column: 2 / 7;\n  grid-row: 2 / 4;\n  grid-template-columns: subgrid;\n  grid-template-rows: repeat(3, 80px);\n}\n\n.subitem {\n  grid-column: 3 / 6;\n  grid-row: 1 / 3;\n}\n```\n\n## Also see {.cols-1}\n\n- [frontendmasters.com ](https://frontendmasters.com/blog/what-you-need-to-know-about-modern-css-spring-2024-edition/)\n- [CSS selectors cheatsheet](https://frontend30.com/css-selectors-cheatsheet/) _(frontend30.com)_\n- [MDN: Using CSS flexbox](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Flexible_boxes)\n- [Ultimate flexbox cheatsheet](http://www.sketchingwithcss.com/samplechapter/cheatsheet.html)\n- [GRID: A simple visual cheatsheet](http://grid.malven.co/)\n- [CSS Tricks: A Complete Guide to Grid](https://css-tricks.com/snippets/css/complete-guide-grid/)\n- [Browser support](https://caniuse.com/#feat=css-grid)\n"
  },
  {
    "path": "source/_posts/curl.md",
    "content": "---\ntitle: Curl\ndate: 2023-01-03 15:18:34\nbackground: bg-slate-600\ntags:\n  - url\n  - request\ncategories:\n  - Linux Command\nintro: |\n  This [Curl](https://github.com/curl/curl) cheat sheet contains commands and examples of some common Curl tricks.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Introduction\n\n`Curl` is a tool for transferring data between servers, supporting protocols, including:\n\n- HTTP\n- HTTPS\n- FTP\n- IMAP\n- LDAP\n- POP3\n- SCP\n- SFTP\n- SMB\n- SMTP\n- etc...\n\n{.cols-3 .marker-none}\n\n---\n\n- [Curl GitHub source repository](https://github.com/curl/curl) _(github.com)_\n- [Curl Official Website](https://curl.se/) _(curl.se)_\n\n### Options {.col-span-2 row-span-2}\n\n```bash\n-o <file>    # --output: write to file\n-u user:pass # --user: authentication\n```\n\n---\n\n```bash\n-v   # --verbose: Make curl verbose during operation\n-vv  # more verbose\n-s   # --silent: don't show progress meter or errors\n-S   # --show-error: When used with --silent (-sS), show errors but no progress meter\n```\n\n---\n\n```bash\n-i  # --include: include HTTP headers in the output\n-I  # --head: header only\n```\n\n### Request\n\n```bash\n-X POST # --request\n-L # If the page redirects, follow the link\n-F # --form: HTTP POST data for multipart/form-data\n```\n\n### data\n\n```bash\n# --data: HTTP post data\n# URL encoding (eg, status=\"Hello\")\n-d 'data'\n\n# --data pass file\n-d @file\n\n# --get: send -d data via get\n-G\n```\n\n### Header information Headers\n\n```bash\n-A <str>      # --user-agent\n\n-b name=val   # --cookie\n\n-b, --cookie FILE           # Load cookies from the specified file for the URL\n-c, --cookie-jar FILE       # Save cookies to the specified file from the URL\n\n-H \"X-Foo: y\" # --header\n\n--compressed  # use deflate/gzip\n```\n\n### SSL\n\n```bash\n    --cacert <file>\n    --capath <dir>\n```\n\n```bash\n-E, --cert <cert> # --cert: client certificate file\n    --cert-type # der/pem/eng\n-k, --insecure # For self-signed certificates\n```\n\n#### Install\n\n```bash\napk add --update curl # install in alpine linux\n```\n\n## Example {.cols-6}\n\n### CURL GET/HEAD {.col-span-4 .row-span-2}\n\n| command                                                               | description                         |\n| :-------------------------------------------------------------------- | :---------------------------------- |\n| `curl -I https://cheatsheets.zip`                                     | `curl` sends a request              |\n| `curl -v -I https://cheatsheets.zip`                                  | `curl` request with details         |\n| `curl -X GET https://cheatsheets.zip`                                 | use explicit http method for `curl` |\n| `curl --noproxy 127.0.0.1 http://www.stackoverflow.com`               | `curl` without http proxy           |\n| `curl --connect-timeout 10 -I -k https://cheatsheets.zip`             | `curl` has no timeout by default    |\n| `curl --verbose --header \"Host: www.mytest.com:8182\" cheatsheets.zip` | `curl` get extra header             |\n| `curl -k -v https://www.google.com`                                   | `curl` get response with headers    |\n\n### Multiple file upload {.col-span-2}\n\n```bash\n$ curl -v --include \\\n--form key1=value1 \\\n    --form upload=@localfilename URL\n```\n\n### Prettify json output for curl response {.col-span-2}\n\n```bash\n$ curl -XGET http://${elasticsearch_ip}:9200/_cluster/nodes | python -m json.tool\n```\n\n### CURL POST {.col-span-4}\n\n| command                                                                     | description         |\n| :-------------------------------------------------------------------------- | :------------------ |\n| `curl -d \"name=username&password=123456\" <URL>`                             | `curl` send request |\n| `curl <URL> -H \"content-type: application/json\" -d \"{ \\\"woof\\\": \\\"bark\\\"}\"` | `curl` sends json   |\n\n### CURL script install rvm {.col-span-2}\n\n```shell\ncurl -sSL https://get.rvm.io | bash\n```\n\n### CURL Advanced {.col-span-6}\n\n| command                                                                                     | description                    |\n| :------------------------------------------------------------------------------------------ | :----------------------------- |\n| `curl -L -s http://ipecho.net/plain, curl -L -s http://whatismijnip.nl`                     | get my public `IP`             |\n| `curl -u $username:$password http://repo.dennyzhang.com/README.txt`                         | `curl` with credentials        |\n| `curl -v -F key1=value1 -F upload=@localfilename <URL>`                                     | `curl` upload                  |\n| `curl -k -v --http2 https://www.google.com/`                                                | use http2 curl                 |\n| `curl -T cryptopp552.zip -u test:test ftp://10.32.99.187/`                                  | curl `ftp` upload              |\n| `curl -u test:test ftp://10.32.99.187/cryptopp552.zip -o cryptopp552.zip`                   | curl `ftp` download            |\n| `curl -v -u admin:admin123 --upload-file package1.zip http://mysever:8081/dir/package1.zip` | upload with credentials `curl` |\n\n### Check website response time {.col-span-4}\n\n```shell\ncurl -s -w \\\n'\\nLookup time:\\t%{time_namelookup}\\nConnect time:\\t%{time_connect}\\nAppCon time:\\t%{time_appconnect}\\nRedirect time:\\t%{time_redirect}\\nPreXfer time:\\t%{time_pretransfer }\\nStartXfer time:\\t%{time_starttransfer}\\n\\nTotal time:\\t%{time_total}\\n' \\\n     -o /dev/null https://www.google.com\n```\n\n### Use Curl to check if a remote resource is available {.col-span-2}\n\n```bash\ncurl -o /dev/null --silent -Iw \"%{http_code}\" https://example.com/my.remote.tarball.gz\n```\n\n### Downloading file {.col-span-3}\n\n```bash\ncurl https://example.com | \\\ngrep --only-matching 'src=\"[^\"]*.[png]\"' | \\\ncut -d \\\" -f2 | \\\nwhile read i; do curl https://example.com/\"${i}\" \\\n-o \"${i##*/}\"; done\n```\n\nDownload all PNG files from the site (using GNU grep)\n\n### Download the file, save the file without changing its name {.col-span-3}\n\n```bash\ncurl --remote-name \"https://example.com/linux-distro.iso\"\n```\n\nRename file\n\n```bash\ncurl --remote-name \"http://example.com/index.html\" --output foo.html\n```\n\n### continue partial download {.col-span-3}\n\n```bash\ncurl --remote-name --continue-at -\"https://example.com/linux-distro.iso\"\n```\n\n### Download files from multiple domains {.col-span-3}\n\n```bash\ncurl \"https://www.{example,w3,iana}.org/index.html\" --output \"file_#1.html\"\n```\n\n### Download a series of files {.col-span-3}\n\n```bash\ncurl \"https://{foo,bar}.com/file_[1-4].webp\" --output \"#1_#2.webp\"\n```\n\nDownload a series of files (output `foo_file1.webp`, `foo_file2.webp...bar_file1_webp`, etc.)\n\n### Redirect output to file {.col-span-3}\n\n```bash\n$ curl http://url/file > file\n```\n\n### Basic Authentication {.col-span-3}\n\n```bash\n$ curl --user username:password http://example.com/\n$ curl -u username:password http://example.com/\n```\n\n### Write to file instead of stdout {.col-span-2}\n\n```bash\n$ curl -o file http://url/file\n$ curl --output file http://url/file\n```\n\n### Download header information\n\n```bash\n$ curl -I url\n# display header information\n```\n\n### Write output to a file named remote_file {.col-span-2}\n\n```bash\n$ curl -o file http://url/file\n$ curl --output file http://url/file\n```\n\n### Execute remote script {.col-span-2}\n\n```bash\n$ curl -s http://url/myscript.sh\n```\n\n### Configuration file {.col-span-2}\n\n```bash\ncurl -K file\n# read configuration from file\ncurl --config file\n$HOME/.curlrc # default configuration file on UNIX-like systems\n```\n"
  },
  {
    "path": "source/_posts/dart.md",
    "content": "---\ntitle: Dart\ndate: 2021-11-04 10:12:25\nbackground: bg-[#58aee9]\ntags:\n  - dart\n  - flutter\ncategories:\n  - Programming\nintro: |\n  A Dart cheat sheet with the most important concepts, functions, methods, and more. A complete quick reference for beginners.\nplugins:\n  - copyCode\n---\n\n## Getting Started {.cols-2}\n\n### hello.dart\n\n```dart\n// top-level function where app execution starts\nvoid main(){\n    print(\"Hello World!\"); // Print to console\n}\n```\n\nEvery app has a main() function\n\n### Variables\n\n```dart\nint x = 2; // explicitly typed\nvar p = 5; // type inferred - Generic var with type inference\n\ndynamic z = 8; // variable can take on any type\nz = \"cool\"; // cool\n\n// if you never intend to change a variable use final or const. Something like this:\n\nfinal email = \"temid@gmail.com\"; // Same as var but cannot be reassigned\nfinal String email = \"temid@gmail.com\"; // you can't change the value\n\nconst qty = 5; // Compile-time constant\n```\n\n### Datatypes\n\n```dart\n\nint age = 20; // integers, range -2^63 to 2^63 - 1\ndouble height = 1.85; // floating-point numbers\n\n// You can also declare a variable as a num\nnum x = 1;  // x can have both int and double values\nx += 2.5;\nprint(x); //Print: 3.5\n\nString name = \"Nicola\";\n\nbool isFavourite = true;\nbool isLoaded = false;\n```\n\n### String interpolation\n\n```dart\n// can use single or double qoutes for String type\nvar firstName = 'Nicola';\nvar lastName = \"Tesla\";\n\n//can embed variables in string with $\nString fullName = \"$firstName $lastName\";\n\n// concatenate with +\nvar name = \"Albert \" + \"Einstein\";\n\nString upperCase = '${firstName.toUpperCase()}';\nprint(upperCase); //Print: NICOLA\n```\n\n### Comments\n\n```dart\n// This is a normal, one-line comment.\n\n/// This is a documentation comment, used to document libraries,\n/// classes, and their members. Tools like IDEs and dartdoc treat\n/// doc comments specially.\n\n/* Comments like these are also supported. */\n```\n\n### multiline String\n\n```dart\nFor multiline String we have to use ''' your text'''\nfor example\nprint('''My long string''');\n//this will show long string\n//this will help for only long strings\n```\n\n### Imports\n\n```dart\n// Importing core libraries\nimport 'dart:math';\n\n// Importing libraries from external packages\nimport 'package:test/test.dart';\n\n// Importing files\nimport 'path/to/my_other_file.dart';\n```\n\n## Operators {.cols-2}\n\n### Arithmatic Operators\n\n```dart\nprint(2 + 3); //Print: 5\nprint(2 - 3); //Print: -1\nprint(2 * 3); //Print: 6\nprint(5 / 2);  //Print: 2.5 - Result is a double\nprint(5 ~/ 2); //Print: 2 - Result is an int\nprint(5 % 2); //Print: 1 - Remainder\n\nint a = 1, b;\n// Increment\nb = ++a; // preIncrement - Increment a before b gets its value.\nb = a++; // postIncrement - Increment a AFTER b gets its value.\n\n//Decrement\nb = --a; // predecrement - Decrement a before b gets its value.\nb = a--; // postdecrement - Decrement a AFTER b gets its value.\n```\n\n### Equality and relational operators\n\n```dart\nprint(2 == 2);  //Print: true - Equal\nprint(2 != 3); //Print: true - Not  Equal\nprint(3 > 2); //Print: true - Grater than\nprint(2 < 3); //Print: true - Less than\nprint(3 >= 3); //Print: true - Greater than or equal to\nprint(2 <= 3); //Print: true - Less than or equal to\n```\n\n### Logical operators\n\n```dart\n// !expr inverts the expression (changes false to true, and vice versa)\n// ||\tlogical OR\n// &&\tlogical AND\nbool isOutOfStock = false;\nint quantity = 3;\nif (!isOutOfStock && (quantity == 2 || quantity == 3)) {\n  // ...Order the product...\n}\n```\n\n## Control Flows : Conditionals {.cols-2}\n\n### if and else if\n\n```dart\nif(age < 18){\n    print(\"Teen\");\n} else if( age > 18 && age <60){\n    print(\"Adult\");\n} else {\n    print(\"Old\");\n}\n```\n\n### switch case\n\n```dart\nenum Pet {dog, cat}\nPet myPet = Pet.dog;\nswitch(myPet){\n    case Pet.dog:\n        print('My Pet is Dog.');\n        break;\n    case Pet.cat:\n        print('My Pet is Cat.');\n        break;\n    default:\n        print('I don\\'t have a Pet');\n}\n// Prints: My Pet is Dog.\n```\n\n## Control Flows : Loops\n\n### while loop\n\n```dart\nwhile (!dreamsAchieved) {\n  workHard();\n}\n```\n\nwhile loop check condition before iteration of the loop\n\n### do-while loop\n\n```dart\ndo {\n  workHard();\n} while (!dreamsAchieved);\n```\n\ndo-while loop verifies the condition after the execution of the statements inside the loop\n\n### for loop\n\n```dart\nfor(int i=0; i< 10; i++){\n    print(i);\n}\n\nvar numbers = [1,2,3];\n// for-in loop for lists\nfor(var number in numbers){\n    print(number);\n}\n```\n\n### for in loop\n\n```dart\n  // Define a list of numbers\n  var numbers = [1, 2, 3, 4, 5];\n\n  // Use a for-in loop to iterate over the list\n  for (var number in numbers) {\n    print(number);\n  }\n\n  // Define a list of strings\n  var fruits = ['Apple', 'Banana', 'Cherry'];\n\n  // Use a for-in loop to iterate over the list\n  for (var fruit in fruits) {\n    print(fruit);\n  }\n```\n\n## Collections {.cols-2}\n\n### Lists\n\n```dart\n// ordered group of objects\nvar list = [1, 2, 3];\n\nprint(list.length); //Print: 3\nprint(list[1]); //Print: 2\n\n// other ways of list declaration and initializations\n\nList<String> cities = <String>[\"New York\", \"Mumbai\", \"Tokyo\"];\n\n// To create a list that’s a compile-time constant\nconst constantCities = const [\"New York\", \"Mumbai\", \"Tokyo\"];\n```\n\n### Sets\n\n```dart\n// A set in Dart is an unordered collection of unique items.\nvar halogens = {'fluorine', 'chlorine', 'bromine', 'iodine', 'astatine'};\n\n// to create an empty set\nvar names = <String>{};\nSet<String> names = {}; // This works, too.\n//var names = {}; // Creates a map, not a set.\n```\n\n### Maps\n\n```dart\n// a map is an object that associates keys and values\nvar person = Map<String, String>();\n// To initialize the map, do this:\n\nperson['lastName'] = 'Tesla';\n\nprint(person); //Print: {firstName: Nicola, lastName: Tesla}\nprint(person['lastName']); //Print: Tesla\n\n\nvar nobleGases = {\n  // Key: Value\n  2: 'helium',\n  10: 'neon',\n  18: 'argon',\n};\n```\n\n## Functions {.cols-2}\n\n### Functions\n\n```dart\n// functions in dart are objects and have a type\nint add(int a, int b){\n    return a+b;\n}\n\n// functions can be assigned to variables\nint sum = add(2,3); // returns: 5\n\n// can be passed as arguments to other functions\nint totalSum = add(2, add(2,3)); // returns : 7\n```\n\n### Arrow Syntax (=>)\n\n```dart\n// functions that contain just one expression, you can use a shorthand syntax\nbool isFav(Product product) => favProductsList.contains(product);\n```\n\n### Anonymous (lambda) functions\n\n```dart\n// small one line functions that dont have name\nint add(a,b) => a+b;\n\n// lambda functions mostly passed as parameter to other functions\nconst list = ['apples', 'bananas', 'oranges'];\nlist.forEach(\n(item) => print('${list.indexOf(item)}: $item'));\n//Prints: 0: apples 1: bananas 2: oranges\n```\n\n## Classes and Objects\n\n### Class\n\n```dart\nclass Cat {\n    String name;\n\n    // method\n    void voice(){\n        print(\"Meow\");\n    }\n}\n```\n\n### Object\n\n```dart\n// instance of a class\n// below myCat is Object of class Cat\n\nvoid main(){\n    Cat myCat = Cat();\n    myCat.name = \"Kitty\";\n    myCat.voice(); // Prints: Meow\n}\n```\n\n### Constructors\n\n```dart\nclass Cat {\n    String name;\n    Cat(this.name);\n}\nvoid main(){\n    Cat myCat = Cat(\"Kitty\");\n    print(myCat.name); // Prints: Kitty\n}\n```\n\n### Abstract Classes\n\n```dart\n// abstract class—a class that can’t be instantiated\n// This class is declared abstract and thus can't be instantiated.\nabstract class AbstractContainer {\n  // Define constructors, fields, methods...\n\n  void updateChildren(); // Abstract method.\n}\n```\n\n### Getters Setters\n\n```dart\n// provide read and write access to an object’s properties\nclass Cat {\n    String name;\n\n    // getter\n    String get catName {\n        return name;\n    }\n\n    // setter\n    void set catName(String name){\n        this.name = name;\n    }\n}\n```\n\n## Implicit interfaces {.cols-2}\n\n### A basic interface\n\n```dart\n// A person. The implicit interface contains greet().\nclass Person {\n  // In the interface, but visible only in this library.\n  final String _name;\n\n  // Not in the interface, since this is a constructor.\n  Person(this._name);\n\n  // In the interface.\n  String greet(String who) => 'Hello, $who. I am $_name.';\n}\n\n// An implementation of the Person interface.\nclass Impostor implements Person {\n  String get _name => '';\n\n  String greet(String who) => 'Hi $who. Do you know who I am?';\n}\n\nString greetBob(Person person) => person.greet('Bob');\n\nvoid main() {\n  print(greetBob(Person('Kathy'))); // Hello, Bob. I am Kathy.\n  print(greetBob(Impostor())); // Hi Bob. Do you know who I am?\n}\n```\n\n### Extending a class\n\n```dart\nclass Phone {\n\n    void use(){\n        _call();\n        _sendMessage();\n    }\n}\n// Use extends to create a subclass\nclass SmartPhone extends Phone {\n    void use(){\n        // use super to refer to the superclass\n        super.use();\n        _takePhotos();\n        _playGames();\n    }\n}\n```\n\n## Exceptions\n\n### Throw\n\n```dart\n// throws or raises and exception\nthrow IntegerDivisionByZeroException();\n\n// You can also throw arbitrary objects\nthrow \"Product out of stock!\";\n```\n\n### Catch\n\n```dart\n\ntry {\n    int c = 3/0;\n    print(c);\n} on IntegerDivisionByZeroException {\n    // A specific exception\n    print('Can not divide integer by 0.')\n} on Exception catch (e) {\n    // Anything else that is an exception\n    print('Unknown exception: $e');\n} catch (e) {\n    // No specified type, handles all\n    print('Something really unknown: $e');\n}\n\n```\n\n### Finally\n\n```dart\n// To ensure that some code runs whether or not an exception is thrown\ntry {\n  cookFood();\n} catch (e) {\n  print('Error: $e'); // Handle the exception first.\n} finally {\n  cleanKitchen(); // Then clean up.\n}\n```\n\n## Futures\n\n### Async Await\n\n```dart\n// functions which are asynchronous: they return after setting up a possibly time-consuming operation\n// The async and await keywords support asynchronous programming\n\nFuture<String> login() {\n String userName=\"Temidjoy\";\n return\n  Future.delayed(\n    Duration(seconds: 4), () => userName);\n}\n\n// Asynchronous\nmain() async {\n print('Authenticating please wait...');\n print(await login());\n}\n```\n\n## Extensions {.cols-2}\n\n### Why use extensions? {.row-span-2}\n\n```dart\n// Extensions allow you to add methods to existing\n// classes without modifying them.\n\n// Instead of defining a util class.\nclass StringUtil {\n  static bool isValidEmail(String str) {\n    final emailRegExp = RegExp(r\"^[a-zA-Z0-9.]+@[a-zA-Z0-9]+\\.[a-zA-Z]+\");\n    return emailRegExp.hasMatch(str);\n  }\n}\n\nprint(StringUtil.isValidEmail('someString')); //Print: false\n\n// We can define an extension which will be applied\n// on a certain type.\n\nextension StringExtensions on String {\n  bool get isValidEmail {\n    final emailRegExp = RegExp(r\"^[a-zA-Z0-9.]+@[a-zA-Z0-9]+\\.[a-zA-Z]+\");\n    return emailRegExp.hasMatch(this);\n  }\n}\n\nprint('test@example.com'.isValidEmail); //Print: true\nprint('SomeString'.isValidEmail); //Print: false\n\n```\n\n### Generic Extensions\n\n```dart\n// allows you to apply the same logic to a range of types.\nextension NumGenericExtensions<T extends num> on T {\n  T addTwo() => this + 2 as T;\n}\n\nprint(7.addTwo()); // Print: 9\n```\n\n### Dart Extensions in Flutter\n\n```dart\nextension ContextExtension on BuildContext {\n  double get screenHeight => MediaQuery.of(this).size.height;\n  double get screenWidth => MediaQuery.of(this).size.width;\n}\n\n// usage\n@override\nWidget build(BuildContext context) => MaterialApp(\n    home: Scaffold(\n      body: Container(\n        width: context.screenWidth * 0.5,\n        height: context.screenHeight * 0.3,\n        color: Colors.blue,\n        child: Text('Hello World!'),\n      ),\n    ),\n  );\n```\n\n## Miscellaneous {.cols-2}\n\n### Null and Null aware\n\n```dart\nint x; // The initial value of any object is null\n\n// ?? null aware operator\n\nx ??=6; // ??= assignment operator, which assigns a value of a variable only if that variable is currently null\nprint(x); //Print: 6\n\nx ??=3;\nprint(x); // Print: 6 - result is still 6\n\nprint(null ?? 10); // Prints: 10. Display the value on the left if it's not null else return the value on the right\n```\n\n### Ternary Operator\n\n```dart\n// condition ? exprIfTrue : exprIfFalse\nbool isAvailable;\n\nisAvailable ? orderproduct() : addToFavourite();\n```\n\n### Spread Operator (...)\n\n```dart\n// to insert multiple values into a collection.\nvar list = [1, 2, 3];\nvar list2 = [0, ...list];\n\nprint(list2.length); //Print: 4\n```\n\n### Cascade notation (..)\n\n```dart\n// allows you to make a sequence of operations on the same object\n\n// rather than doing this\nvar user = User();\nuser.name = \"Nicola\";\nuser.email = \"nicola@g.c\";\nuser.age = 24;\n\n// you can do this\nvar user = User()\n  ..name = \"Nicola\"\n  ..email = \"nicola@g.c\"\n  ..age = 24;\n```\n\n### Conditional Property Access\n\n```dart\nuserObject?.userName\n\n//The code snippet above is equivalent to following:\n(userObject != null) ? userObject.userName : null\n\n//You can chain multiple uses of ?. together in a single expression\nuserObject?.userName?.toString()\n\n// The preceeding code returns null and never calls toString() if either userObject or userObject.userName is null\n```\n\n### enum in dart\n\n```dart\ndefination: An enum (short for \"enumeration\") is a special data type that enables a variable to be a set of predefined constants. Enums are used to define variables that can only take one out of a small set of possible values. They help make code more readable and less error-prone by providing meaningful names to these sets of values.\n\n// Define the enum\nenum TrafficLight {\n  red,\n  yellow,\n  green\n}\n\n// A function that prints a message based on the traffic light state\nvoid printTrafficLightMessage(TrafficLight light) {\n  switch (light) {\n    case TrafficLight.red:\n      print('Stop!');\n      break;\n    case TrafficLight.yellow:\n      print('Get ready...');\n      break;\n    case TrafficLight.green:\n      print('Go!');\n      break;\n  }\n}\n\nvoid main() {\n  // Example usage of the enum\n  TrafficLight currentLight = TrafficLight.green;\n\n  // Print the message for the current traffic light state\n  printTrafficLightMessage(currentLight);\n}\n\n\n```\n"
  },
  {
    "path": "source/_posts/django.md",
    "content": "---\ntitle: Django\ndate: 2024-05-15 10:12:25\nbackground: bg-[#214a35]\nlabel: Python\ntags:\n  - python\n  - web\ncategories:\n  - Programming\nintro: |\n  A Django cheat sheet.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Start a new Django Project\n\n{.row-span-2}\n\n```python\n# Create et access project folder\n~$  mkdir project_name\n~$  cd project_name\n\n# Create Python virtual env\n~$  python3 -m venv venv\n\n# Activate virtual env\n~$  source venv/bin/activate\n\n# If you want to deactivate virtual env\n~$  deactivate\n\n# Install django (~= same as 4.2.*)\n~$  pip install django~=4.2.0\n\n# New django project (from project_name folder)\n~$  django-admin startproject config\n\n# Create app (from project_name folder)\n~$  python manage.py startapp app_name\n```\n\n### Migration:\n\n<small>Django create a database table for each models present in your app using those commands:</small>\n\nMakemigrations: Create a file under app_name/migrations with the database structure to create\n\n```python\n~$  python manage.py makemigrations\n```\n\nMigrate: Will read the migrations files and create the actual database and tables\n\n```python\n~$  python manage.py migrate\n```\n\n### Create superuser for authenficiation/admin panel\n\n```python\n~$  python manage.py createsuperuser\n```\n\n### Start server\n\n```python\n~$  python manage.py runserver  => ex.  http://127.0.0.1:8000\n```\n\n### Requirements\n\n```python\n# Create a requirements file that contain all your project dependencies\n~$  pip freeze > requirements.txt\n\n# Install your project requirements (if a requirements file exist)\n~$  pip install -r requirements.txt\n```\n\n### Other commands\n\n```python\n# Django shell (Run project code directly)\n~$ python manage.py shell\n\n# example of code to run in the shell:\n >>> from app_name.models import User\n >>> user1 = User.objects.first()\n\n# Prepare static folders for production\n~$ python manage.py collectstatic\n\n# Take all data from app blog and export in json\n~$ python manage.py dumpdata blog > myapp.json\n\n# Take all data in json file and import in app data table\n~$ python manage.py loaddata myapp.json\n\n# To Create or Update a message file for Translation, run this command\n~$ django-admin makemessages -l de\n# Updating message files\n~$ django-admin compilemessages\n```\n\n## Project config {.cols-1}\n\n### Configuration settings\n\n##### Project base templates directory and Apps templates directory:\n\n- create folder project/templates\n- create folder appfolder/templates/appname\n\n##### Create Static folder in base root and separate for apps:\n\n- project_name\\static\\root\n- app_name\\static\\app_name\n\n```python\n# Add app to settings.py\nINSTALLED_APPS = [\n         … ,\n         'app_name.apps.App_nameConfig',\n ]\n\n# template directory config\nProject templates settings.py:\n    TEMPLATES = [\n        { …\n           'DIRS': [BASE_DIR / 'templates'],\n        … }\n\n# Static folder:\nSTATIC_URL = '/static/'\nSTATICFILES_DIRS = [ BASE_DIR / 'static' ]\nSTATIC_ROOT = 'static_root'\n# Media folder:\nMEDIA_URL = '/media/'\nSTATICFILES_DIRS = (\n    (BASE_DIR / 'static'),\n)\nMEDIA_ROOT = BASE_DIR / 'media'\n\n# To use PostgresSQL\n# pip install psycopg2\n# settings.py\nDATABASE = {\n    'default': {\n        'ENGINE': 'django.db.backends.postgresql',\n        'NAME': 'blog',\n        'USER': 'admin',\n        'PASSWORD': '123456',\n        'HOST': 'localhost',\n        'PORT': '5432'\n        }\n    }\n\nTIME_INPUT_FORMATS = [\n    '%H:%M:%S',     # '14:30:59'\n    '%H:%M',        # '14:30'\n]\n\nDATE_FORMAT = \"Y/M/d\"\n\n# locale for Translations\nLANGUAGES = [\n    ('en', 'English'),\n    ('de', 'German'),\n]\n\nLOCALE_PATHS = (\n    BASE_DIR / 'locale',\n)\n\n# CK Editor Configuration\nCKEDITOR_UPLOAD_PATH = 'uploads/'\nCKEDITOR_RESTRICT_BY_USER = True\nCKEDITOR_BROWSE_SHOW_DIRS = True\nCKEDITOR_ALLOW_NONIMGE_FILES = True\nCKEDITOR_IMAGE_BACKEND = \"pillow\"\nCKEDITOR_CONFIGS = {\n    'default': {\n        'toolbar': 'full',\n    }}\n\n# SSL\n# If you have an SSL certificate\nSECURE_SSL_REDIRECT = True\n# cookies will only be sent via HTTPS connections\nSESSION_COOKIE_SECURE = True\nCSRF_COOKIE_SECURE = True\n```\n\n## Data Models\n\n### Create Data Model {.col-span-2}\n\n<small>Theses models can be created as database tables with the migrations commands</small>\n\n```python\n# models.py\n# The id fields is automaticly created by Django\n# for each model that why it's not show below\nfrom django.db import models\n\nclass Customer(models.Model)\n    name = models.Charfield('Customer', max_length=120)\n    age = models.IntegerField()\n    note = models.TextField(blank=True, null = True)\n    email = models.EmailField(max_length=255, blank=True, null=True)\n    credit = models.FloatField(blank=True)\n    is_active = models.BooleanField(default=True)\n    created_at = models.DateTimeField(auto_now_add=True)\n    updated_at = models.DateTimeField(auto_now=True)\n    img = models.ImageField(upload_to ='uploads/')\n    # Select Field (return value, display value)\n    TYPE_CHOICES = (\n        ('Customer', _('Customer')),\n        ('Supplier', _('Supplier')),\n        ('Student', _('Student')),\n    )\n    type = models.CharField(choices=TYPE_CHOICES)\n\n    class Meta:\n        verbose_name = \"Customer\"\n        verbose_name_plural = \"Customers\"\n\n    # Model string representation\n    def __str__(self):\n        return self.name\n\n    # the URL that points to a resource or page on your website\n    def get_absolute_url(self):\n        return reverse(\"customer_detail\", kwargs={\"pk\": self.pk})\n```\n\n#### We can also use this method to define the ChoiceField value.\n\n```python\n  class Customer(models.Model)\n    class TypeList(models.IntegerChoices):\n        customer = (1, _('Customer'))\n        supplier = (2, _('Supplier'))\n        student = (3, _('Student'))\n    .\n    .\n    .\n    type = models.CharField(choices=TypeList.choices, default=1)\n```\n\n#### To access the ChoiceField value in the template, we need to do the following in the template:\n\n- In Django templates you can use the \"`get_FOO_display()`\" method, that will return the readable alias for the field,\n  where `'FOO'` is the name of the field.\n- If the choices are stored in the variable `CHOICES` and the model field storing the selected choice is `'type'` then\n  you can directly use\n\n```html\n<!-- Here, X is the model instance -->\n{{ X.get_type_display }}\n\n<!-- You can even use this method to display its translation. -->\n{% trans X.get_type_display %}\n```\n\n#### Relationship between models\n\n```python\n# One-to-Many: (use double quotes if the entity is not yet declare) ex. \"Supplier\"\nsupplier = models.ForeignKey(Supplier, blank=True, null=True, on_delete=models.CASCADE,related_name=\"supplierother\")\n\n# on_delete can be set to models.CASCADE, models.ST_DEFAULT or models.SET_NULL\n# The related_name attribute specifies the name of the reverse relation from the supplier model back to your model\n\n# Many-to-Many:\ntags = models.ManyToManyField(Tag, blank=True)\n\n# One to One\nUser = models.OneToOneField(User, on_delete=models.CASCADE)\n\n# Overwrite save method\ndef save(self, (*args, **kwargs):\n    if not self.slug:\n        self.slug = slugify(self.title)\n    super().save(*args, **kwargs)\n```\n\n## Lookup\n\n### Field Lookups {.col-span-2}\n\nIn Django, the `field__lookuptype` syntax is used to perform lookups on fields in queries. The `field` represents the\nname of the field you want to perform the lookup on, and `lookuptype` represents the type of lookup you want to perform.\n\nFor example, let's say you have a model called `Book` with a field called `title` . You can use the `field__lookuptype`\nsyntax to perform different types of lookups on the `title` field.\n\nHere are a few examples:\n\n```python\n\n# 1. Exact Match Lookup:\nBook.objects.filter(title__exact='Python Tricks')\n# 2. Case-insensitive Lookup:\nBook.objects.filter(title__iexact='python tricks')\n# 3. Contains Lookup:\nBook.objects.filter(title__contains='Python')\n# 4. Startswith Lookup:\nBook.objects.filter(title__startswith='Python')\n# 5. Endswith Lookup:\nBook.objects.filter(title__endswith='Tricks')\n```\n\n### Field Lookups Reference\n\n| Keyword        | Description                                      |\n| -------------- | :----------------------------------------------- |\n| `contains`     | Contains the phrase                              |\n| `icontains`    | Same as contains, but case-insensitive           |\n| `date`         | Matches a date                                   |\n| `day`          | Matches a date (day of month, 1-31) (for dates)  |\n| `endswith`     | Ends with                                        |\n| `iendswith`    | Same as endswidth, but case-insensitive          |\n| `exact`        | An exact match                                   |\n| `iexact`       | Same as exact, but case-insensitive              |\n| `in`           | Matches one of the values                        |\n| `isnull`       | Matches NULL values                              |\n| `gt`           | Greater than                                     |\n| `gte`          | Greater than, or equal to                        |\n| `hour`         | Matches an hour (for datetimes)                  |\n| `lt`           | Less than                                        |\n| `lte`          | Less than, or equal to                           |\n| `minute`       | Matches a minute (for datetimes)                 |\n| `month`        | Matches a month (for dates)                      |\n| `quarter`      | Matches a quarter of the year (1-4) (for dates)  |\n| `range`        | Match between                                    |\n| `regex`        | Matches a regular expression                     |\n| `iregex`       | Same as regex, but case-insensitive              |\n| `second`       | Matches a second (for datetimes)                 |\n| `startswith`   | Starts with                                      |\n| `istartswith`  | Same as startswith, but case-insensitive         |\n| `time`         | Matches a time (for datetimes)                   |\n| `week`         | Matches a week number (1-53) (for dates)         |\n| `week_day`     | Matches a day of week (1-7) 1 is Sunday          |\n| `iso_week_day` | Matches a ISO 8601 day of week (1-7) 1 is Monday |\n| `year`         | Matches a year (for dates)                       |\n| `iso_year`     | Matches an ISO 8601 year (for dates)             |\n\n### Admin Panel {.col-span-2}\n\nEvery Django projects come with an Admin Panel that can be open at /admin url (ex: localhost:8000/admin)<br> To display\nthe model in the Admin panel register the model in the app_name/admin.py file<br> For each models you can specify the\nfields you want to use</small>\n\n```python\nfrom django.contrib import admin\nfrom app_name.models import Blog\n\n# Custom model Admin (admin.py):\n@admin.register(Blog)   # Register app\nclass BlogAdmin(admin.ModelAdmin)\n    fields = (\"title\", \"description\") # Fields to use for add/edit/show page\n    list_display = (\"title\", \"description\") # fields to display in search page\n    list_display_links = (\"title\",) # fields that will be a link in search page\n    ordering = (\"date_created\",) # Ordering allowed in the search page\n    search_fields = (\"title\", \"description\") # Search fields allowed in the search page\n    list_filter =(\"title\",) # define list filters that appear in the right sidebar\n```\n\n### Routing\n\nDjango routing info is store in project_folder/urls.py file\n\n```python\nfrom django.contrib import admin\nfrom django.urls import path, include\n\nurlpatterns = [\n    path('admin/', admin.site.urls), # pre-created admin urls routes\n    path('', include('app_name.urls')) # include your app urls\n]\n```\n\nThe 'include()' method allow to link another urls.py file created in your app folder (app_name/urls.py)\n\n```python\nfrom django.urls import path\nfrom app_name import views\n\nurlpatterns = [\n    path('posts', views.index, name='posts.index'),\n    path('posts/create/', views.create, name='posts.create',\n    path('posts/<int:id>/', views.show, name='posts.show'),\n    path('posts/<int:id>/edit/', views.edit, name='posts.edit'),\n    path('posts/<int:id>/delete/', views.delete, name='posts.delete'),\n    path('posts/<int:id>/<int:state>/', views.status, name='posts.status'), # two arguments\n]\n```\n\n## Static Route and Customize Admin Panel {.cols-1}\n\n### Customizing Admin Panel\n\nHeader and Title admin panel & Custom `404`, `500`, and `503` Template\n\n```python\n# add in project/urls.py\nfrom django.contrib import admin\nfrom django.conf import settings\nfrom django.conf.urls.static import static\n\nurlpatterns = [  ...  ]\n\nif settings.DEBUG == True:\n    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)\n    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n\n# Customize Admin Panel Header & Title\nadmin.site.site_header = _('Administrator Control Panel')\nadmin.site.site_title = _('Administrator Control Panel')\nadmin.site.index_title = _('Wellcome to Control Panel')\n\n# Costomize 404 Template page\nhandler404 = 'app_name.views.handler404'\nhandler500 = 'app_name.views.handler500'\nhandler503 = 'app_name.views.handler503'\n```\n\n## Views {.cols-1}\n\n### Function Based Views\n\n```python\n# views.py\nfrom django.shortcuts import render, redirect\nfrom app_name.models import Post\nfrom app_name.forms import PostForm\n\ndef index(request):\n    # Get all Posts\n    posts = Post.objects.all()\n\n    # Render app template with context\n    return render(request, 'appfolder/index.html', {'posts': posts})\n\ndef show(request, id):\n    post = Post.objects.get(id=id)\n    return render(request, 'appfolder/show.html', {'post': post})\n\ndef create(request):\n    form = PostForm(request.POST or None, request.FILES or None)\n    # When the form contains an image or file field, we should use request.FILES\n    if form.is_valid():\n        # optionally we can access form data with form.cleaned_data['first_name']\n        post = form.save(commit=False)\n        post.user = request.user\n        post.save()\n        return redirect('/posts')\n\n    return render(request, 'appfolder/create.html', {'form': form)\n\ndef edit(request, id):\n    post = Post.objects.get(id=id)\n    form = PostForm(request.POST or None, request.FILES or None, instance=post)\n    if form.is_valid():\n        form.save()\n        return redirect('/posts')\n\n    return render(request, 'appfolder/edit.html', {'form': form)\n\ndef delete(request, id):\n    post = Post.objects.get(id=id)\n    post.delete()\n    return redirect('/posts')\n\ndef status(request, id, state):\n    post = Post.objects.get(id=id, state=state)\n    return redirect('appfolder/status.html', {'post': post})\n```\n\n### Class Based Views\n\n```python\nfrom django.views.generic import TemplateView, ListView, DetailView,\n           CreateView, UpdateView, DeleteView\n\nclass LandingPageView(TemplateView):\n    template_name = 'landing.html'\n\n    # Optional: Change context data dict\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['title'] = 'Landing Page'\n        return context\n\n\nclass PostsListView(ListView):\n    queryset = Post.objects.all()\n    # Optional\n    # context_object_name = \"posts\" (default: post_list)\n    # template_name = 'posts.html' (default: posts/post_list.html)\n\n\nclass PostsDetailView(DetailView):\n    model = Post # object var in template\n    # Optional\n    # template_name = 'post.html' (default: posts/post_detail.html)\n\n\nclass PostsCreateView(CreateView):\n    form_class = PostForm\n    template_name = 'posts/post_create.html' # no default value\n\n    def get_success_url(self):\n        return reverse('posts-list')\n\n    # Optional: Overwrite form data (before save)\n    def form_valid(self, form):\n        if self.request.user.is_authenticated:\n            from.instance.author = self.request.user\n        return super().form_valid(form)\n\n\nclass PostsUpdateView(UpdateView):\n    model = Post\n    form_class = PostForm\n    template_name = 'posts/post_update.html'\n\n    def get_success_url(self):\n        return reverse('post-list')\n\n    # Optional: Change context data dict\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['submit_text'] = 'Update'\n        return context\n\n\nclass PostsDeleteView(DeleteView):\n    model = Post\n    template_name = 'posts/post_delete.html'\n    success_url = reverse_lazy('posts-list')\n\n# Urls.py route declaration\npath('<int:pk>/update/', PostsUpdateView.as_view(), name='post-update')\n```\n\n## Templates\n\n### Basic Template\n\nTemplates are store in `project_folder/templates` or in your <code>app_folder/templates/app_name/\\*.html</code>\n\n```html\n<!-- Extend from another template -->\n<!-- can use the same parts of your HTML for different template -->\n{% extends 'base.html' %}\n\n<!-- A part of the parent template that is defined and is replaced by a part in the child template -->\n{% block contents %} {% endblock contents %}\n\n<!-- include template-->\n{% include 'partials/header.html' %}\n<!-- include template with One or More Parameters -->\n{% include 'body.html' with key1=value1 key2=value2 %}\n\n<!-- If statement in template -->\n{% if user.username = 'Mike' %}\n<p>Hello Admin</p>\n{% elif user.username = 'john' %}\n<p>Hello John Doe</p>\n{% else %}\n<p>Hello User</p>\n{% endif %}\n\n<!-- for loop in template -->\n{% for product in products %}\n<p>row: {{ forloop.counter }} # starting index 1 {{ forloop.counter0 }} # starting index 0</p>\n<p>The product name is {{ product.name }}</p>\n<p></p>\n<p>The product name is {{ product.price }}</p>\n<p>\n  {% endfor %}\n\n  <!-- Access to the variable in the template -->\n  {{ var_name }}\n\n  <!-- Template variables formating  -->\n  {{ title | lower }} {{ blog.post | truncatwords:50 }} {{ order.date | date:\"D M Y\" }} {{ list_items | slice:\":3\" }} {{\n  total | default:\"nil\" }}\n\n  <!-- Current path (ex. posts/1/show) -->\n  {{ request.path }}\n\n  <!-- URL by name with param -->\n  {% url 'posts.delete' id=post.id %}\n\n  <!-- Use static in template: -->\n  {% load static %} {% static 'css/main.css' %}\n\n  <!-- Define the variable in the template -->\n  {% with name=\"World\" %}\n  <html>\n    <div>Hello {{ name }}!</div>\n  </html>\n  {% endwith %}\n\n  <!-- Template translate text -->\n  {% load i18n %}\n  <title>{% trans \"This is the title.\" %}</title>\n  <!-- Use variable translate in the template -->\n  <title>{% trans object.title %}</title>\n\n  <!-- Define the list in the template -->\n  <input type=\"number\" {% if product.unit in 'kg,milligram,milliliter' %} step=\"0.01\" {% else %} step=\"1\" {% endif %}>\n\n  <!-- Safely Pass Data to JavaScript in a Django Template: -->\n  <!--+ Use data attributes for simple values -->\n  <script data-username=\"{{ username }}\">\n    const data = document.currentScript.dataset;\n    const username = data.username;\n  </script>\n\n  <!-- + Separate script files: can use document.currentScript for separate script files -->\n  <script src=\"{% static 'index.js' %}\" data-username=\"{{ username }}\"></script>\n\n  <!-- + Case conversion -->\n  <script src=\"{% static 'index.js' %}\" data-full-name=\"{{ full_name }}\"></script>\n  <!--  Read it in JavaScript as fullName: -->\n  <script>\n    const data = document.currentScript.dataset;\n    const fullName = data.fullName;\n  </script>\n\n  <!-- + Non-string types -->\n  <script src=\"{% static 'index.js' %}\" data-follower-count=\"{{ follower_count }}\"></script>\n\n  <!--  parseInt() to convert this value from a string: -->\n  <script>\n    const data = document.currentScript.dataset;\n    const followerCount = parseInt(data.followerCount, 10);\n  </script>\n\n  <!-- + There’s no limit: A <script> can have as many data attributes as you like: -->\n  <script\n    src=\"{% static 'index.js' %}\"\n    defer\n    data-settings-url=\"{% url 'settings' %}\"\n    data-configuration-url=\"{% url 'configuration' %}\"\n    data-options-url=\"{% url 'options' %}\"\n    data-preferences-url=\"{% url 'preferences' %}\"\n    data-setup-url=\"{% url 'setup' %}\"\n  ></script>\n</p>\n```\n\n### Custom Template Tags and Filters\n\nFor example, if your custom tags/filters are in a file called `basetags.py`, your app layout might look like this:\n\n```\napp_name/\n└─── templatetags/\n     └─── basetags.py\n     __init__.py\n     models.py\n     views.py\n```\n\n- And in your template you would use the following:\n\n```html\n{% load basetags %}\n```\n\n- the module must contain a module-level variable named register that is a template.Library instance, in which all the\n  tags and filters are registered. So, near the top of your module, put the following:\n\n### Writing custom template filters\n\nCustom filters are Python functions that take one or two arguments: The value of the variable (input) – not necessarily\na string. The value of the argument – this can have a default value, or be left out altogether. For example, in the\nfilter `{{ var|foo:\"bar\" }}`, the filter foo would be passed the variable var and the argument \"bar\".\n\nThe Library.filter() method takes two arguments: The name of the filter – a string. The compilation function – a Python\nfunction (not the name of the function as a string). You can use register.filter() as a decorator instead:\n\n```python\n# basetags.py\nfrom django import template\n\nregister = template.Library()\n\n@register.filter(name=\"cut\")\ndef cut(value, arg):\n    \"\"\"Removes all values of arg from the given string\"\"\"\n    return value.replace(arg, \"\")\n\n# Most filters don’t take arguments. In this case, leave the argument out of your function\n@register.filter()\ndef lower(value): # Only one argument.\n    \"\"\"Converts a string into all lowercase\"\"\"\n    return value.lower()\n\n\n@register.simple_tag\ndef to_class_name(object):\n    return str(object.__class__.__name__)\n\n# Template\n# And here’s an example of how that filter would be used in Template:\n{{ somevariable | cut:\"0\" }}\n\n# Put the result of simple tag into a variable\n{% to_class_name object as objectmodel %}\n<p>Model Class Name: {{ objectmodel }}</p>\n```\n\n## Context Processor {.cols-1}\n\n### Creating custom Context Processor\n\nAnywhere, create a `context_processors.py` file\n\n```\nproject_name\n└───app_name\n    ├───...\n    └───context_processors.pyy\n```\n\nCreate a function in context_processors.py that accepts a HttpRequest object as an argument and returns a dictionary\n\nA context processor is just a function that accepts an HttpRequest object as an argument and returns a dictionary. Like\nthis:\n\n```python\n# app_name/context_processors.py\ndef site_email(request):\n    return { 'site_email' : 'example@gmail.com' }\n```\n\n3. Add this to your context_processors setting in settings.py (at the bottom for security reasons)\n\n```python\n TEMPLATES = [\n    { …\n        'OPTIONS': {\n          'context_processors': [\n            …\n              'app_name.context_processors.site_email',\n              # New context processor here\n            …\n          ],\n    … },\n\n# Now be able to access the 'site_email' template variable on every single django template across your whole site.\n```\n\n## Model Managers and Querysets\n\n### Model Manager\n\nModel manager allow model database reads and writes\n\n```python\n# One line create and save\nArticle.objects.create(name='Item 1', price=19.95)\n\n# Read all\nArticle.objects.all()\n\n# Create\nuser = User.objects.first()\narticle = Article(user=user, name='Item 1', price=19.95)\n\n# Save\narticle.save()\n\n# Read one\nArticle.objects.get(id=1)\n\n# Select Related (to avoid n+1 query)\nposts = Post.objects.select_related('user', 'category').all()\n\n# Read or render a 404 not found page\nfrom django.shortcuts import get_object_or_404\narticle = get_object_or_404(Article, id=512)\n\n# Filter\nArticle.objects.filter(model='dyson', name__icontains='dyson') # __icontains\nArticle.objects.filter(year__gt=2016) # __gt = greater than\nArticle.objects.filter(year__lt=2001) # __lt = less than\n\n# Filter on relationship sub model field\nArticle.objects.get(user__username='mike')\n\n# Ordering\nArticle.objects.order_by('name')     # ascending\nArticle.objects.order_by('-name')   # descending\n\n# Slicing return first\nArticle.objects.all().order_by('name')[0]\n\n# Slicing return last\nArticle.objects.all().order_by('-name')[0]\n\n# Slicing limit/offset\nArticle.objects.all().order_by('name')[1..10]\n\n# Updating\narticle = Article.objects.first()\narticle.name = 'new name'\narticle.save()\n\n# One line update\nArticle.objects.filter(id=4).update(name='new name')\n\n# Deleting\narticle = Article.objects.first()\narticle.delete()\n\n# One line delete\narticle.objects.get(id=1).delete()\n\n# Delete all\nArticle.objects.all().delete()\n\n# Set ForeignKey field value\nmodel1 = Model(name='dyson')\narticle.model = model1\n\n# Get ForeignKey value\narticle1.model.name\nmodel1.article_set.all()\n\n# Add Many-to-Many\narticle1.tags.add(tag1)\narticle1.tags.all()\ntag1.articles_set.all()\n```\n\n## Form\n\n### Form creation {.col-span-2}\n\nIn HTML, a form is a collection of elements inside `<form>...</form>` that allow a visitor to do things like enter text,\nselect options, manipulate objects or controls, and so on, and then send that information back to the server.\n\n```python\n# app_name/forms.py\nfrom django import forms\nclass ArticleForm(forms.Form):\n    name = forms.Charfield(max_length=100)\n    description = forms.Charfield(blank=True, null = True)\n\n\n# Model Form\nfrom django.forms import ModelForm\nfrom app_name.models import Article\nclass ArticleForm(ModelForm):\n    class Meta:\n        model = Article\n        fields = ['name', 'description', 'price'] # Use '__all__' for all fields\n        widgets = {\n            'name': forms.TextInput(attrs={'class': 'form-control'}),\n        }\n        labels = {\n            'name': 'First Name',\n        }\n        error_messages = {\n            'name': {'required': 'This field is required',},\n            }\n        help_texts = {\n        'name': 'Enter Your First Name',\n        }\n```\n\n```html\n<!-- Render form in template -->\n<form method=\"“post”\" action=\"“”\" novalidate>\n  {% csrf_token %} {{ form }}\n  <button type=\"submit\">Submit</button>\n</form>\n```\n\n- NOTE: If the form contains a file field, your form MUST contain `enctype=\"multipart/form-data\"`, eg:\n\n```html\n<form action=\"\" method=\"post\" enctype=\"multipart/form-data\">\n  {% csrf_token %} {{ form.as_p }}\n  <button type=\"submit\">{% trans 'Submit' %}</button>\n</form>\n```\n\n##### A Tailwind CSS template pack for the wonderful django-crispy-forms.\n\n```bash\npip install crispy-tailwind\n```\n\n```python\n# settings.py\nINSTALLED_APPS = (\n    ...\n    \"crispy_forms\",\n    \"crispy_tailwind\",\n    ...\n)\nCRISPY_ALLOWED_TEMPLATE_PACKS = 'tailwind'\nCRISPY_TEMPLATE_PACK = 'tailwind'\n```\n\n```html\n<!-- template usage -->\n{% load tailwind_filters %} {{ form|crispy }}\n```\n\n### Form Validation\n\n```python\n# forms.py\nfrom django.core.exceptions import ValidationError\n\n# field validation\ndef clean_first_name(self):\n    data = self.cleaned_data['first_name']\n    if data = 'Mike':\n        raise ValidationError('Your name must not be Mike')\n    return data\n\n# form validation\ndef clean(self):\n    first_name = self.cleaned_data['first_name']\n    last_name = self.cleaned_data['last_name']\n    if first_name + last_name = 'MikeTaylor':\n        raise ValidationError('Your name must not be Mike Taylor')\n```\n\n## Flash messages {.cols-1}\n\n### Displaying messages\n\n```python\n# Message tags\n# debug, info, success, warning and error\n\nmessages.success(request, 'Login successful')\nmessages.error(request, 'Login error')\n```\n\n```html\n<!-- Display flash messages in template -->\n{% if messages %} {% for message in messages %} {% message %} {% message.tags %}\n{% endfor %} {% endif %}\n```\n\n## User Model\n\n### Pre-created\n\nUser Model (pre-created)\n\n```python\n# Get a reference to Django pre-created User model\nfrom django.contrib.auth import get_user_model\n\nUser = get_user_model()\n\n# Or if you want to custom user model\nfrom django.contrib.auth.models import AbstractUser\n\nclass User(AbstractUser):\n    # add custom fields and methods\n\n# To make Django use that model go to settings.py and add: AUTH_USER_MODEL = 'app_name.User'\n```\n\n## Authentication\n\n### Authentication : LoginView\n\n```python\n# LoginView is already pre-created by Django\nfrom django.contrib.auth.views import LoginView\n\n# Add a url to reach that view\npath('login/', LoginView.as_view(), name='login')\n\n# By default the LoginView will try to open a template name 'registration/login.html' and send a login form with it.\n```\n\n```html\n<!-- Create a template under registration/login.html -->\n{% extends \"base.html\" %} {% block content %}\n<form method=\"post\">\n  {% csrf_token %} {{ form }}\n  <button type=\"submit\">Login</button>\n</form>\n{% endblock content %}\n\n<!-- When user click the Login button, the LoginView will try to authenticate the user with the form username ans password -->\n\n<!-- If successful il will then login the user and redirect to LOGIN_REDIRECT_URL specified in your settings.py -->\n```\n\n#### Authentication : LogoutView\n\n```python\n# LogoutView is already pre-created by Django\nfrom django.contrib.auth.views import LogoutView\n\n# Add a url to reach that view\npath('logout/', LoginView.as_view(), name='logout')\n\n# Include a link in a template\n<a> href=\"{% url 'logout' %}\">Logout</a>\n\n# After link is execute, the user will be logout and redirect to LOGOUT_REDIRECT_URL specified in your settings.py\n```\n\n#### Authentication : SignupView\n\n```python\n# Create a SignupView (that view is not created by default)\n# import sinupview form pre-created by Django\nfrom django.contrib.auth.forms import UserCreationForm\nfrom django.views.generic import CreateView\n\nclass SignupView(CreateView):\n    template_name = 'registration/signup.html'\n    form_class = UserCreationForm\n\n    def get_success_url(self):\n        return reverse(\"login\")\n```\n\n```html\n<!-- Create template: registration/signup.html -->\n{% extends \"base.html\" %} {% block content %}\n<form method=\"post\">\n  {% csrf_token %} {{ form }}\n  <button type=\"submit\">Signup</button>\n</form>\n{% endblock content %}\n```\n\n```python\n# Add a url to reach that view\nfrom posts.views import SignupView\n\npath('signup/', SignupView.as_view(), name='signup')\n```\n\n```python\n# Optional: Customize the UserCreationForm\n# (forms.py)\nfrom django.contrib.auth import get_user_model\nfrom django.contrib.auth.forms import UserCreationForm\n\nUser = get_user_model()\nclass CustomUserCreationForm(UserCreattionForm):\n    class Meta:\n        model = User\n        fields = ['username']\n        fields_classes = {'username': UsernameField}\n```\n\n#### Optional pre-created Authentication routes\n\n```python\n# urls.py\nurlpatterns += path('', include('django.contrib.auth.urls'))\n# /login, /lougout, /signup, etc.\n```\n\n#### Template Authentication helpers\n\n```html\n<!-- Authentication links -->\n<a href=\"{% url 'login' %}\">Login</a>\n<a href=\"{% url 'signup' %}\">Signup</a>\n<a href=\"{% url 'logout' %}\">Logout</a>\n\n<!-- Check if user login -->\n{% if request.user.is_authenticated %} Logged in as: {{ request.user.username }}\n{% endif %}\n```\n\n#### Authorization: LoginRequiredMixin and login_required\n\n```python\nfrom django.contrib.auth.mixins import LoginRequiredMixin\n\n# Restrict views to auth user only (views.py)\nclass PostsCreateView(LoginRequiredMixin, generic.CreateView):\n    ...\n    ...\n\n\nfrom django.contrib.auth.decorators import login_required\n\n@login_required(login_url='/login')\ndef search_page(request):\n    ...\n    ...\n```\n\n#### Manual Authentication , Login and Logout\n\n```python\nfrom django.contrib.auth import authenticate, login\n\ndef login_page(request):\n    if request.method == \"POST\":\n        username = request.POST.get(\"username\")\n        password = request.POST.get(\"password\")\n        user = authenticate(request, username=username, password=password)\n        if user is not None:\n            login(request, user)\n            return redirect(\"index\")\n\nreturn render(request, \"registration/login.html\", {})\n\n\ndef logout_page(request):\n    logout(request)\n    return redirect(\"index\")\n```\n\n#### User Change password\n\n```python\n# set_password will hash the password\nuser.set_password('raw password')\n```\n\n## Create Custom Accounts Model\n\n```python\n~$ python manage.py startapp accounts\n```\n\n```python\n# Add accounts app to settings.py\nINSTALLED_APPS = [ … ,\n         'accounts.apps.AccountsConfig',\n          ]\n.\n.\n.\nAUTH_USER_MODEL = 'accounts.User'\n```\n\n```python\n# accounts/models.py\nfrom django.db import models\nfrom django.contrib.auth.models import BaseUserManager, AbstractBaseUser, PermissionsMixin\n\nclass UserManager(BaseUserManager):\n    def create_user(self, username, email, password=None, **extra_fields):\n        if not username:\n            raise ValueError('Users must have an username')\n        if not email:\n            raise ValueError('Users must have an email')\n\n        user = self.model(email=email, **extra_fields)\n        user.set_password(password)\n        user.save(using=self._db)\n        return user\n\n    def create_superuser(self, username,  email, password=None, **extra_fields):\n        extra_fields.setdefault('is_staff', True)\n        extra_fields.setdefault('is_superuser', True)\n        extra_fields.setdefault('is_active', True)\n\n        user = self.create_user(username, email, password=password, **extra_fields)\n        user.save(using=self._db)\n        return user\n\n\nclass User(AbstractBaseUser, PermissionsMixin):\n    username = models.CharField(verbose_name='Username', max_length=255, unique=True)\n    email = models.EmailField(verbose_name='email', max_length=255, unique=True)\n    phone = models.BigIntegerField(verbose_name='Phone Number', unique=True, blank=True, null=True)\n    is_active = models.BooleanField(default=True, verbose_name=\"is_active\")\n    is_staff = models.BooleanField(default=False, verbose_name=\"is_staff\")\n    is_superuser = models.BooleanField(default=False, verbose_name=\"is_superuser\")\n\n    objects = UserManager()\n\n    # We can use any field for username\n    USERNAME_FIELD = 'username'  # or 'email' or 'phone'\n    REQUIRED_FIELDS = ['username', 'email']\n\n    def __str__(self):\n        return self.username\n\n    class Meta:\n        verbose_name = \"User\"\n        verbose_name_plural = \"Users\"\n```\n\n```python\n# accounts/forms.py\nfrom django import forms\nfrom django.contrib.auth.forms import ReadOnlyPasswordHashField\nfrom django.core.exceptions import ValidationError\nfrom accounts.models import User\nfrom django.utils.translation import gettext_lazy as _\n\n\nclass UserCreationForm(forms.ModelForm):\n    password1 = forms.CharField(label='Password', widget=forms.PasswordInput)\n    password2 = forms.CharField(label='Password confirmation', widget=forms.PasswordInput)\n\n    class Meta:\n        model = User\n        fields = ('username', 'email', 'phone', 'is_active', 'is_staff')\n\n    def clean_password2(self):\n        password1 = self.cleaned_data.get(\"password1\")\n        password2 = self.cleaned_data.get(\"password2\")\n        if password1 and password2 and password1 != password2:\n            raise ValidationError(\"Passwords don't match\")\n        return password2\n\n    def save(self, commit=True):\n        user = super().save(commit=False)\n        user.set_password(self.cleaned_data[\"password1\"])\n        if commit:\n            user.save()\n        return user\n\n\nclass UserChangeForm(forms.ModelForm):\n    password = ReadOnlyPasswordHashField()\n\n    class Meta:\n        model = User\n        fields = ('username', 'email', 'phone', 'is_active', 'is_staff')\n\n    def clean_password(self):\n        return self.initial[\"password\"]\n\n\nclass LoginForm(forms.Form):\n    email = forms.CharField(\n        widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Email'}), label='Email')\n    password = forms.CharField(\n        widget=forms.PasswordInput(attrs={'class': 'form-control', 'placeholder': 'Password'}),label='Password')\n\n\nclass RegisterForm(forms.ModelForm):\n    password1 = forms.CharField(label='Password', widget=forms.PasswordInput(\n        attrs={'class': 'form-control'}))\n    password2 = forms.CharField(label='Password confirmation',\n                                widget=forms.PasswordInput(attrs={'class': 'form-control'}))\n\n    class Meta:\n        model = User\n        fields = ('username', 'email', 'phone')\n\n        widgets = {  # Optional\n            'username': forms.TextInput(attrs={'class': 'form-control'}),\n            'email': forms.EmailInput(attrs={'class': 'form-control'}),\n            'phone': forms.NumberInput(\n                attrs={'class': 'form-control', 'type': 'tel', 'maxlength': '11',\n                       'minlength': '11',  'onkeypress': 'return isNumber(event)', 'required': 'false'})}\n\n    def clean_password2(self):\n        password1 = self.cleaned_data.get(\"password1\")\n        password2 = self.cleaned_data.get(\"password2\")\n        if password1 and password2 and password1 != password2:\n            raise ValidationError(\"Passwords don't match\")\n        else:\n            return password2\n\n    def save(self, commit=True):\n        user = super().save(commit=False)\n        user.set_password(self.cleaned_data[\"password1\"])\n        if commit:\n            user.save()\n        return user\n\nclass EditProfileForm(forms.ModelForm):\n    class Meta:\n        model = User\n        fields = ('username', 'email', 'phone')\n\n\nclass ChangePassword(forms.Form):\n    password1 = forms.CharField(label=_('Password'), widget=forms.PasswordInput(\n        attrs={'class': 'form-control', 'placeholder': 'Password'}))\n    password2 = forms.CharField(label=_('Password confirmation'),\n                                widget=forms.PasswordInput(\n                                    attrs={'class': 'form-control', 'placeholder': 'Re-Enter Password'}))\n\n    def clean_password2(self):\n        password1 = self.cleaned_data.get(\"password1\")\n        password2 = self.cleaned_data.get(\"password2\")\n        if password1 and password2 and password1 != password2:\n            raise ValidationError(\"Passwords don't match\")\n        else:\n            return password2\n```\n\n```python\n# accounts/admin.py\nfrom django import forms\nfrom django.contrib import admin\nfrom django.contrib.auth.admin import UserAdmin as BaseUserAdmin\nfrom django.contrib.auth.forms import ReadOnlyPasswordHashField\nfrom django.core.exceptions import ValidationError\nfrom django.contrib.auth.models import Group\nfrom accounts.models import User\n\n\nclass UserCreationForm(forms.ModelForm):\n    password1 = forms.CharField(label='Password', widget=forms.PasswordInput)\n    password2 = forms.CharField(label='Password confirmation', widget=forms.PasswordInput)\n\n    class Meta:\n        model = User\n        fields = ('username', 'email', 'phone')\n\n    def clean_password2(self):\n        # Check that the two password entries match\n        password1 = self.cleaned_data.get(\"password1\")\n        password2 = self.cleaned_data.get(\"password2\")\n        if password1 and password2 and password1 != password2:\n            raise ValidationError(\"Passwords don't match\")\n        return password2\n\n    def save(self, commit=True):\n        user = super().save(commit=False)\n        user.set_password(self.cleaned_data[\"password1\"])\n        if commit:\n            user.save()\n        return user\n\n\nclass UserChangeForm(forms.ModelForm):\n    password = ReadOnlyPasswordHashField()\n\n    class Meta:\n        model = User\n        fields = ('username', 'email', 'phone', 'password', 'is_active', 'is_staff')\n\n\nclass UserAdmin(BaseUserAdmin):\n    form = UserChangeForm\n    add_form = UserCreationForm\n    list_display = ('username', 'email', 'is_active', 'is_staff', 'is_superuser')\n    list_editable = ('is_staff', 'is_active')\n    list_filter = ('is_staff', 'groups')\n    fieldsets = (\n        (None, {'fields': ( 'username', 'email', 'phone', 'password')}),\n        ('Permissions', {'fields': ('is_staff',)}),\n        ('Group Permissions', {\n            'fields': ('is_active', 'is_superuser', 'groups', 'user_permissions'),\n        })\n    )\n    add_fieldsets = (\n        (None, {\n            'classes': ('wide',),\n            'fields': ('username', 'email', 'phone', 'password1', 'password2'),\n        }),\n        ('Group Permissions', {\n            'fields': ('is_active', 'is_superuser', 'groups', 'user_permissions'),\n        })\n    )\n    search_fields = ('username', 'email', 'phone')\n    ordering = ('username', 'email', 'phone')\n    filter_horizontal = ('groups', 'user_permissions',)\n\n\nadmin.site.register(User, UserAdmin)\n# unregister the Group model from admin.\n# admin.site.unregister(Group)\n```\n\n```python\n# accounts/urls.py\nfrom django.urls import path\nfrom accounts import views\n\napp_name = 'accounts'\nurlpatterns = [\n    path('login/', views.userLogin, name='login'),\n    path('register/', views.userRegister, name='register'),\n    path('logout/', views.LogoutPage, name='logout')\n]\n```\n\n```python\n# accounts/views.py\nfrom django.shortcuts import render, redirect\nfrom django.contrib.auth import login, logout, authenticate\nfrom django.contrib.auth.decorators import login_required\nfrom django.utils.translation import gettext_lazy as _\nfrom accounts.forms import LoginForm, RegisterForm\nfrom django.contrib import messages\nfrom accounts.models import User\n\n\ndef userRegister(request):\n    form = RegisterForm()\n    if request.method == 'POST':\n        form = RegisterForm(request.POST)\n        if form.is_valid():\n            cd = form.cleaned_data\n            if not User.objects.filter(email=cd['username']).exists():\n                if not User.objects.filter(email=cd['email']).exists():\n                    user = User.objects.create_user(\n                        username=cd['username'], phone=cd['phone'], email=cd['email'], password=cd['password1'])\n                    user.save()\n                    login(request, user)\n                    messages.success(request, _(\"You successfully registered a user\"), extra_tags=\"success\")\n                    return redirect('app_name:home')\n                else:\n                    messages.error(request, _(\"This Email is exists\"), extra_tags=\"warning\")\n            else:\n                messages.error(request, _(\"This Username is exists\"), extra_tags=\"warning\")\n        else:\n            import json\n            er = json.loads(form.errors.as_json())\n            for e in er:\n                messages.error(request, er[e][0]['message'], 'warning')\n    return render(request, 'accounts/register.html', {'form': form})\n\n\ndef userLogin(request):\n    if not request.user.is_active:\n        if request.method == 'POST':\n            form = LoginForm(request.POST)\n            if form.is_valid():\n                cd = form.cleaned_data\n                if User.objects.filter(username=cd['username']).exists():\n                    user = authenticate(request, username=cd['username'], password=cd['password'])\n                    if user is not None:\n                        login(request, user)\n                        messages.success(request, _(\"logged in successfully\"), extra_tags=\"success\")\n                        return redirect('app_name:home')\n                    else:\n                        messages.error(request, _(\"your username Or Password is wrong\"), extra_tags=\"warning\")\n                else:\n                    messages.error(request, _(\"No account created with this username\"), extra_tags=\"warning\")\n                    return redirect('accounts:login')\n            else:\n                messages.error(request, _(\"Please enter your information correctly\"), extra_tags=\"warning\")\n        else:\n            form = LoginForm()\n        return render(request, 'accounts/login.html', {'form': form})\n    else:\n        return redirect('app_name:home')\n\n\n@login_required()\ndef LogoutPage(request):\n    logout(request)\n    messages.success(request, _(\"You Logged Out successfully\"), extra_tags=\"success\")\n    return redirect('app_name:home')\n```\n\n## Send Email\n\n```python\n# settings.py\nEMAIL_BACKEND = \"django.core.mail.backends.console.EmailBackend\"\n\n# Send email function\nfrom django.core.email import send_mail\n\nsend_mail(\n    subject = \"A new post has been created\",\n    message = \"Go to the web site to see the detail\",\n    from_email = \"test@test.com\",\n    recipient_list = [\"test2@text.com\"]\n)\n```\n\n## Signals\n\n```python\n# models.py\nfrom django.db.models.signals import post_save, pre_save\n\ndef post_user_created_signal(sender, instance, created, **kwargs):\n    if created:\n        UserProfile.objects.create(user=instance)\n\n# Launch the post_user_created_signal method if User model is save\npost_save.connect(post_user_created_signal, sender=User)\n```\n\n## Seed\n\n```python\nfrom app_name.models import Product, Category\nfrom django.shortcuts import HttpResponse\nfrom faker import Faker\n\n\ndef seed(request):\n    Product.objects.all().delete()\n    Category.objects.all().delete()\n\n    category = Category()\n    category.name = \"Sports\"\n    category.save()\n\n    category = Category()\n    category.name = \"Home\"\n    category.save()\n\n    fake = Faker()\n    for _ in range(100):\n        product = Product()\n        product.name = fake.unique.word()\n        product.short_description = fake.sentence()\n        product.main_picture = fake.image_url()\n        product.price = fake.random_digit() * 10\n        product.category =  Category.objects.order_by('?').first()\n        product.save()\n\n    return HttpResponse('Seeded')\n```\n\n## Environment Variables\n\n### .env key/value file\n\n```python\n$ pip install python-decouple\n```\n\nCreate a file name '.env' in the root folder of your project\n\n```python\nSECRET_KEY = 'your secret key'\nALLOWED_HOST = 127.0.0.1\n```\n\nIn settings.py change security related settings to point to the .env file\n\n```python\nfrom decouple import config\n\nSECRET_KEY = config('SECRET_KEY')\nALLOWED_HOST = config('ALLOWED_HOST')\n```\n\n## Asynchronous Tasks\n\n### Django Celery Redis\n\nCelery is a distributed task queue that can collect, record, schedule, and perform tasks outside of your main program.\n\n#### Step 1: Install Celery Using pip\n\n```python\n~$ pip install celery       # pip install celery[redis]\n```\n\n#### Step 2. Add celery.py File in Your Project Module\n\n```python\n# your_project/celery.py\nimport os\nfrom celery import Celery\n\nos.environ.setdefault('DJANGO_SETTINGS_MODULE','your_project_name.settings')\napp = Celery('your_project_name')\napp.config_from_object('django.conf:settings', namespace='CELERY')\napp.autodiscover_tasks()\n\n@app.task(bind=True)\ndef debug_task(self):\n    print(f'Request: {self.request!r}')\n```\n\n#### Step 3: Import the Celery App to Django\n\n<small>To ensure that the Celery app is loaded when Django starts, add the following code into the `__init__.py` file\nthat sits on the project module beside on settings.py file.</small>\n\n```python\n# your_project/__init__.py\nfrom .celery import app as celery_app\n\n__all__ = ('celery_app',)\n```\n\n#### Step 4: Download and Run Redis as a Celery ‘broker’\n\n```python\n~$ redis-server\n```\n\n<small>You can test that Redis is working properly by typing this into your terminal:</small>\n\n```python\n~$ redis-cli ping\n```\n\nRedis should reply with PONG - try it!\n\n#### Step 5: Add Redis as a Dependency in the Django Project:\n\n```python\n~$ pip install redis\n```\n\n#### Step 6: Celery Stuff Configure to the Django Settings File\n\nOnce Redis is up, add the following code to your settings.py file and use celery-result\n\n```python\n~$ pip install django-celery-results\n```\n\nThis extension enables you to store Celery task results using the Django ORM.<br> It defines a single model\n(`django_celery_results.models.TaskResult`) used to store task results, and you can query this database table like any\nother Django model.\n\n```python\nINSTALLED_APPS = [\n                … ,\n                'django_celery_results',\n                ]\n\nBROKER_URL = 'redis://localhost:6379'\nCELERY_RESULT_BACKEND = 'redis://localhost:6379'\nCELERY_ACCEPT_CONTENT = ['application/json']\nCELERY_TASK_SERIALIZER = 'json'\nCELERY_RESULT_SERIALIZER = 'json'\nCELERY_TIMEZONE = TIME_ZONE\nCELERY_RESULT_BACKEND = 'django-db'\nCELERY_CACHE_BACKEND = 'django-cache'\n\nCACHES = {\n    'default': {\n        'BACKEND': 'django.core.cache.backends.db.DatabaseCache',\n        'LOCATION': 'redis://localhost:6379/1',\n        \"OPTIONS\": {\n                    \"CLIENT_CLASS\": \"django_redis.client.DefaultClient\",\n        }\n    }\n}\n```\n\n#### That’s it! You should now be able to use Celery with Django\n\nTest that the Celery worker is ready to receive tasks:\n\n```python\n~$ celery -A your_project_name worker -l info\n```\n\nThe most important task is: Always run a worker is needed to execute the celery task if any error throws from Redis like\nthis:\n\n```python\nAttributeError: 'str' object has no attribute 'items'\n```\n\n- the solution is: you have to use Redis old version\n\n### Add a New Task\n\n#### Step 1: Add tasks.py File to Your Django App.\n\n```python\n# app_name/tasks.py\nfrom celery import shared_task\nfrom celery.decorators import task\nfrom time import sleep\n\n\n@task(name='my_first_task')\ndef my_first_task(duration):\n    sleep(duration)\n    return('first_task_done')\n\n@shared_task\ndef test_func():\n    for i in range(10):\n        print(i)\n    return 'End_OK'\n\n@shared_task\ndef adding(x, y):\n    time.sleep(10)\n    result = x + y\n    return result\n```\n\n#### Step 2: Assign Task to the Celery.\n\nYou need to assign a task to the celery. To assign this task you need to call this function with something different.\ncelery gives us two methods `delay()` and `apply_async()` to call task.\n\n```bash\n# Normal function call in python\n~$ my_first_task()\n\n# add task to the celery with function call\n~$ my_first_task.delay()\n```\n\nYou can send argument to the function using the delay method. <small>To check celery on the action open a separate tab\nof the terminal then go to the project directory (activate environment if you are using one) and run this command\nagain</small>\n\n```bash\n~$ celery -A your_project_name worker -l info\n```\n\n### Create a View in your App\n\n```python\n# app_name/views.py\nfrom django.http import HttpResponse\nfrom app_name.tasks import my_first_task, test_func, adding\n\ndef index(request):\n    my_first_task.delay(10)\n    result = adding.delay(x=4, y=5)\n    return HttpResponse(f'response done. {result}')\n\ndef test(request):\n    test_func.delay()\n    return HttpResponse(\"Done\")\n```\n\n#### Then call the view from your app URL\n\n```python\n# app_name/urls.py\nfrom django.urls import path\nfrom app_name.views import index, test\nurlpatterns = [\n    path('celery-index/', index, name='celery_index_url'),\n    path('celery-test/', test, name='celery_test_url'),\n]\n```\n\n### Celery In Production Using Supervisor\n\n#### Step 1: Install Supervisor on Ubuntu Server\n\n```bash\n~$ sudo apt-get install supervisor\n```\n\n#### Step 2: Add .conf File in Supervisor\n\n```bash\n~$ sudo nano /etc/supervisor/conf.d/app_name.conf\n```\n\n`app_name` can be anything you like, it should be similar to your project name.\n\n#### Step 3: Add some Configure in app_name.conf\n\n```bash\n[program:your_app_name]\ncommand=/path/to/env/bin/celery worker -A your_project_name --loglevel=INFO\ndirectory=/path/to/workflow/your_project_name/\nuser=www-data\nautostart=true\nautorestart=true\nstdout_logfile=/path/to/workflow/your_project_name/logs/celeryd.log\nredirect_stderr=true\n```\n\nDescribe the configure file:\n\n```bash\n[program:your_app_name]\n#The name of your supervisord program\n\ncommand=/path/to/env/bin/celery worker -A your_project_name --loglevel=INFO\n#Set full path to celery program if using virtualenv\n\ndirectory=/path/to/workflow/your_project_name/\n#The directory to your Django project\n\nuser=www-data\n#The web server has to be run under a specific user. That user must exist.\n\nautostart=true\n#If true, this program will start automatically when supervisord is started\n\nautorestart=true\n#May be one of false, unexpected, or true. If false, the process will never be autorestarted. If unexpected, the process will be restart when the program exits with an exit code that is not one of the exit codes associated with this process’ configuration (see exitcodes). If true, the process will be unconditionally restarted when it exits, without regard to its exit code.\n\nstdout_logfile=/path/to/workflow/your_project_name/logs/celeryd.log\n#Put process stdout output in this file\n\nredirect_stderr=true\n#If true, cause the process’ stderr output to be sent back to supervisord on its stdout file descriptor (in UNIX shell terms, this is the equivalent of executing /the/program 2>&1).\n```\n\n#### Step 4: Inform Configuration to the Server\n\nAfter adding a new program, we should run the following two commands, to inform the server to reread the configuration\nfiles and to apply any changes.\n\n```python\n~$ sudo supervisorctl reread\n~$ sudo supervisorctl update\n```\n\n#### Managing Supervisor App\n\n```bash\n~$ sudo supervisorctl\n```\n\nYou will be greeted with a list of the registered processes. You will see a process called `your_app_name` with a\n`RUNNING` status.\n\n```bash\nyour_app_name                 RUNNING   pid 6853, uptime 0:22:30\nsupervisor>\n```\n\nType `help` for a list of available commands.\n\n```bash\nsupervisor> help\ndefault commands (type help <topic>):\n=====================================\nadd    exit      open  reload  restart   start   tail\navail  fg        pid   remove  shutdown  status  update\nclear  maintail  quit  reread  signal    stop    version\n```\n\nIn a nutshell, we can `start`, `stop` and `restart` programs bypassing the program name as an argument to the respective\ncommand. We can also take a look at the program output with the `tail` command. Once you are finished, you can `quit`.\n\n```bash\n~$ supervisor> quit\n```\n\n## Deployment Django in Server\n\n### Set Up Django with Postgres, Nginx, and Gunicorn on Ubuntu server\n\n#### Step 1 — Installing the Packages from the Ubuntu Repositories\n\n```bash\nsudo apt update\nsudo apt install python3-venv python3-dev libpq-dev postgresql postgresql-contrib nginx curl\n```\n\n#### Step 2 — Creating the PostgreSQL Database and User\n\n```bash\nsudo -u postgres psql\n```\n\n- First, create a database for your project:\n\n```bash\npostgres=# CREATE DATABASE myproject;\n```\n\n- Next, create a database user for our project. Make sure to select a secure password:\n\n```bash\npostgres=# CREATE USER myprojectuser WITH PASSWORD 'password';\n```\n\n- Afterwards, you’ll modify a few of the connection parameters for the user that you just created\n\n```bash\npostgres=# ALTER ROLE myprojectuser SET client_encoding TO 'utf8';\npostgres=# ALTER ROLE myprojectuser SET default_transaction_isolation TO 'read committed';\npostgres=# ALTER ROLE myprojectuser SET timezone TO 'UTC';\n```\n\n- Now, you can give the new user access to administer the new database:\n\n```bash\npostgres=# GRANT ALL PRIVILEGES ON DATABASE myproject TO myprojectuser;\n```\n\n- When you are finished, exit out of the PostgreSQL prompt by typing:\n\n```bash\npostgres=# \\q\n```\n\n#### Step 3 — Creating a Python Virtual Environment for your Project\n\n- thin the project directory, create a Python virtual environment by typing:\n\n```bash\nmkdir ~/myprojectdir\ncd ~/myprojectdir\n```\n\n- Within the project directory, create a Python virtual environment by typing:\n\n```bash\npython3 -m venv myprojectenv\n```\n\n- Before installing your project’s Python requirements, you will need to activate the virtual environment. You can do\n  that by typing:\n\n```bash\nsource myprojectenv/bin/activate\n```\n\n- With your virtual environment active, install Django, Gunicorn, and the psycopg2 PostgreSQL adaptor with the local\n  instance of pip\n\n```bash\n(myprojectenv)$ pip install django gunicorn psycopg2-binary\n```\n\n#### Step 4 — Creating and Configuring a New Django Project\n\n- With your Python components installed, you can now create the actual Django project files.\n\n```bash\n(myprojectenv)$ django-admin startproject myproject ~/myprojectdir\n```\n\n- The first thing you should do with your newly created project files is adjust the settings. Open the settings file in\n  your text editor:\n\n```bash\n(myprojectenv)$ nano ~/myprojectdir/myproject/settings.py\n```\n\n- Start by locating the ALLOWED_HOSTS directive.\n\n```python\n# ~/myprojectdir/myproject/settings.py\nALLOWED_HOSTS = ['your_server_domain_or_IP', 'second_domain_or_IP', . . ., 'localhost']\n```\n\n- Next, find the section that configures database access. It will start with DATABASES. The configuration in the file is\n  for a SQLite database.\n\n```python\n. . .\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.postgresql_psycopg2',\n        'NAME': 'myproject',\n        'USER': 'myprojectuser',\n        'PASSWORD': 'password',\n        'HOST': 'localhost',\n        'PORT': '',\n    }\n}\n. . .\n```\n\n- Next, move down to the bottom of the file and add a setting indicating where the static files should be placed.\n\n```python\n. . .\nSTATIC_URL = 'static/'\n\n# Default primary key field type\n# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field\n\nDEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'\n\nimport os\nSTATIC_ROOT = os.path.join(BASE_DIR, 'static/')\n```\n\n#### Step 5 — Completing Initial Project Setup\n\n- Now, you can migrate the initial database schema to our PostgreSQL database using the management script:\n\n```bash\n(myprojectenv)$ ~/myprojectdir/manage.py makemigrations\n(myprojectenv)$ ~/myprojectdir/manage.py migrate\n```\n\n- Create an administrative user for the project by typing:\n\n```bash\n(myprojectenv)$ ~/myprojectdir/manage.py createsuperuser\n```\n\n- You can collect all of the static content into the directory location that you configured by typing:\n\n```bash\n(myprojectenv)$ ~/myprojectdir/manage.py collectstatic\n```\n\n#### Step 6 — Testing Gunicorn’s Ability to Serve the Project\n\n```bash\n(myprojectenv)$ cd ~/myprojectdir\n(myprojectenv)$ gunicorn --bind 0.0.0.0:8000 myproject.wsgi\n```\n\n- You’re now finished configuring your Django application. You can back out of our virtual environment by typing:\n\n```bash\n(myprojectenv)$ deactivate\n```\n\n#### Step 7 — Creating systemd Socket and Service Files for Gunicorn You have tested tha\n\n```bash\nsudo nano /etc/systemd/system/gunicorn.socket\n```\n\n- Inside, you will create a `[Unit]` section to describe the socket, a `[Socket]` section to define the socket location,\n  and an `[Install]` section to make sure the socket is created at the right time:\n\n```bash /etc/systemd/system/gunicorn.socket\n[Unit]\nDescription=gunicorn socket\n\n[Socket]\nListenStream=/run/gunicorn.sock\n\n[Install]\nWantedBy=sockets.target\n```\n\n- Save and close the file when you are finished.\n- Next, create and open a systemd service file for Gunicorn with sudo privileges in your text editor. The service\n  filename should match the socket filename with the exception of the extension:\n\n```bash\nsudo nano /etc/systemd/system/gunicorn.service\n```\n\n```bash\n[Unit]\nDescription=gunicorn daemon\nRequires=gunicorn.socket\nAfter=network.target\n\n[Service]\nUser=sammy\nGroup=www-data\nWorkingDirectory=/home/sammy/myprojectdir\nExecStart=/home/sammy/myprojectdir/myprojectenv/bin/gunicorn \\\n          --access-logfile - \\\n          --workers 3 \\\n          --bind unix:/run/gunicorn.sock \\\n          myproject.wsgi:application\n\n[Install]\nWantedBy=multi-user.target\n```\n\n- You can now start and enable the Gunicorn socket. This will create the socket file at /run/gunicorn.sock now and at\n  boot. When a connection is made to that socket, systemd will automatically start the gunicorn.service to handle it\n\n```bash\nsudo systemctl start gunicorn.socket\nsudo systemctl enable gunicorn.socket\n```\n\n#### Step 8 — Checking for the Gunicorn Socket File\n\n- Check the status of the process to find out whether it was able to start:\n\n```bash\nsudo systemctl status gunicorn.socket\n```\n\n- Next, check for the existence of the gunicorn.sock file within the /run directory:\n\n```bash\nfile /run/gunicorn.sock\n```\n\n#### Step 9 — Testing Socket Activation\n\n```bash\nsudo systemctl status gunicorn\n```\n\n- To test the socket activation mechanism, you can send a connection to the socket through curl by typing:\n\n```bash\ncurl --unix-socket /run/gunicorn.sock localhost\n```\n\n- You should receive the HTML output from your application in the terminal. This indicates that Gunicorn was started and\n  was able to serve your Django application. You can verify that the Gunicorn service is running by typing:\n\n```bash\nsudo systemctl status gunicorn\n```\n\n- Check your /etc/systemd/system/gunicorn.service file for problems. If you make changes to the\n  /etc/systemd/system/gunicorn.service file, reload the daemon to reread the service definition and restart the Gunicorn\n  process by typing\n\n```bash\nsudo systemctl daemon-reload\nsudo systemctl restart gunicorn\n```\n\n#### Step 10 — Configure Nginx to Proxy Pass to Gunicorn\n\n- Start by creating and opening a new server block in Nginx’s sites-available directory:\n\n```bash\nsudo nano /etc/nginx/sites-available/myproject\n```\n\n```bash\nserver {\n    listen 80;\n    server_name server_domain_or_IP;\n\n    location = /favicon.ico { access_log off; log_not_found off; }\n    location /static/ {\n        alias /home/sammy/myprojectdir/staticfiles/;\n    }\n\n    location /media {\n        autoindex on;\n        alias /home/sammy/myprojectdir/media/;\n    }\n\n    location / {\n        include proxy_params;\n        proxy_pass http://unix:/run/gunicorn.sock;\n    }\n}\n```\n\n- Save and close the file when you are finished. Now, you can enable the file by linking it to the sites-enabled\n  directory:\n\n```bash\nsudo ln -s /etc/nginx/sites-available/myproject /etc/nginx/sites-enabled\n```\n\n- Test your Nginx configuration for syntax errors by typing:\n\n```bash\nsudo nginx -t\n```\n\n- If no errors are reported, go ahead and restart Nginx by typing:\n\n```bash\nsudo systemctl restart nginx\n```\n\n- you need to open up your firewall to normal traffic on port 80\n\n```bash\nsudo ufw allow 'Nginx Full'\n```\n\nYou should now be able to go to your server’s domain or IP address to view your application.\n\n#### Step 11 — Troubleshooting Nginx and Gunicorn\n\n- Nginx Is Showing the Default Page Instead of the Django Application\n\n```bash\nsudo tail -F /var/log/nginx/error.log\n```\n\n- Django Is Displaying: “could not connect to server: Connection refused”\n\n```bash\nsudo systemctl status postgresql\n```\n\n- If it is not, you can start it and enable it to start automatically at boot (if it is not already configured to do so)\n  by typing:\n\n```bash\nsudo systemctl start postgresql\nsudo systemctl enable postgresql\n```\n\nIf you change Gunicorn socket or service files, reload the daemon and restart the process by typing:\n\n```bash\nsudo systemctl daemon-reload\nsudo systemctl restart gunicorn.socket gunicorn.service\n```\n\nIf you change the Nginx server block configuration, test the configuration and then Nginx by typing:\n\n```bash\nsudo nginx -t && sudo systemctl restart nginx\n```\n"
  },
  {
    "path": "source/_posts/docker.md",
    "content": "---\ntitle: Docker\ndate: 2020-12-30 10:55:24\nbackground: bg-[#488fdf]\ntags:\n  - container\n  - virtual\ncategories:\n  - Programming\nintro: |\n  This is a quick reference cheat sheet for [Docker](https://docs.docker.com/get-started/). And you can find the most common Docker commands here.\nplugins:\n  - copyCode\n---\n\n## Getting Started {.cols-2}\n\n### Getting started\n\nCreate and run a container in background\n\n```shell script\n$ docker run -d -p 80:80 docker/getting-started\n```\n\n---\n\n- `-d` - Run the container in detached mode\n- `-p 80:80` - Map port 80 to port 80 in the container\n- `docker/getting-started` - The image to use\n\n{.marker-none}\n\nCreate and run a container in foreground\n\n```shell script\n$ docker run -it -p 8001:8080 --name my-nginx nginx\n```\n\n---\n\n- `-it` - Interactive bash mode\n- `-p 8001:8080` - Map port 8001 to port 8080 in the container\n- `--name my-nginx` - Specify a name\n- `nginx` - The image to use\n\n{.marker-none}\n\n### General commands\n\n| Example                             | Description                                      |\n| ----------------------------------- | ------------------------------------------------ |\n| `docker ps`                         | List running containers                          |\n| `docker ps -a`                      | List all containers                              |\n| `docker ps -s`                      | List running containers<br>_(with CPU / memory)_ |\n| `docker images`                     | List all images                                  |\n| `docker exec -it <container>  bash` | Connecting to container                          |\n| `docker logs <container>`           | Shows container's console log                    |\n| `docker stop <container>`           | Stop a container                                 |\n| `docker restart <container>`        | Restart a container                              |\n| `docker rm <container>`             | Remove a container                               |\n| `docker port <container>`           | Shows container's port mapping                   |\n| `docker top <container>`            | List processes                                   |\n| `docker kill <container>`           | Kill a container                                 |\n\nParameter `<container>` can be container id or name\n\n## Docker Containers {.cols-2}\n\n### Starting & Stopping\n\n| Description               | Example                             |\n| ------------------------- | ----------------------------------- |\n| `docker start my-nginx`   | Starting                            |\n| `docker stop my-nginx`    | Stopping                            |\n| `docker restart my-nginx` | Restarting                          |\n| `docker pause my-nginx`   | Pausing                             |\n| `docker unpause my-nginx` | Unpausing                           |\n| `docker wait my-nginx`    | Blocking a Container                |\n| `docker kill my-nginx`    | Sending a SIGKILL                   |\n| `docker attach my-nginx`  | Connecting to an Existing Container |\n\n### Information\n\n| Example                   | Description                            |\n| ------------------------- | -------------------------------------- |\n| `docker ps`               | List running containers                |\n| `docker ps -a`            | List all containers                    |\n| `docker logs my-nginx`    | Container Logs                         |\n| `docker inspect my-nginx` | Inspecting Containers                  |\n| `docker events my-nginx`  | Containers Events                      |\n| `docker port my-nginx`    | Public Ports                           |\n| `docker top my-nginx`     | Running Processes                      |\n| `docker stats my-nginx`   | Container Resource Usage               |\n| `docker diff my-nginx`    | Lists the changes made to a container. |\n\n### Creating\n\n```yaml\ndocker create [options] IMAGE\n  -a, --attach               # attach stdout/err\n  -i, --interactive          # attach stdin (interactive)\n  -t, --tty                  # pseudo-tty\n      --name NAME            # name your image\n  -p, --publish 5000:5000    # port map (host:container)\n      --expose 5432          # expose a port to containers\n  -P, --publish-all          # publish all ports\n      --link container:alias # linking\n  -v, --volume `pwd`:/app    # mount (absolute paths needed)\n  -e, --env NAME=hello       # env vars\n```\n\n#### Example\n\n```shell script\n$ docker create --name my_redis --expose 6379 redis:3.0.2\n```\n\n### Manipulating\n\nRenaming a Container\n\n```shell script\ndocker rename my-nginx my-nginx\n```\n\nRemoving a Container\n\n```shell script\ndocker rm my-nginx\n```\n\nUpdating a Container\n\n```shell script\ndocker update --cpu-shares 512 -m 300M my-nginx\n```\n\n## Docker Images {.cols-2}\n\n### Manipulating\n\n| `Example`                          | Description                     |\n| ---------------------------------- | ------------------------------- |\n| `docker images`                    | Listing images                  |\n| `docker rmi nginx`                 | Removing an image               |\n| `docker load < ubuntu.tar.gz`      | Loading a tarred repository     |\n| `docker load --input ubuntu.tar`   | Loading a tarred repository     |\n| `docker save busybox > ubuntu.tar` | Save an image to a tar archive  |\n| `docker history`                   | Showing the history of an image |\n| `docker commit nginx`              | Save a container as an image.   |\n| `docker tag nginx eon01/nginx`     | Tagging an image                |\n| `docker push eon01/nginx`          | Pushing an image                |\n\n### Building Images\n\n```shell script\n$ docker build .\n$ docker build github.com/creack/docker-firefox\n$ docker build - < Dockerfile\n$ docker build - < context.tar.gz\n$ docker build -t eon/my-nginx .\n$ docker build -f myOtherDockerfile .\n$ curl example.com/remote/Dockerfile | docker build -f - .\n```\n\n## Docker Networking {.cols-2}\n\n### Manipulating\n\nRemoving a network\n\n```shell script\ndocker network rm MyOverlayNetwork\n```\n\nListing networks\n\n```shell script\ndocker network ls\n```\n\nGetting information about a network\n\n```shell script\ndocker network inspect MyOverlayNetwork\n```\n\nConnecting a running container to a network\n\n```shell script\ndocker network connect MyOverlayNetwork nginx\n```\n\nConnecting a container to a network when it starts\n\n```shell script\ndocker run -it -d --network=MyOverlayNetwork nginx\n```\n\nDisconnecting a container from a network\n\n```shell script\ndocker network disconnect MyOverlayNetwork nginx\n```\n\n### Creating Networks\n\n```shell script\ndocker network create -d overlay MyOverlayNetwork\n\ndocker network create -d bridge MyBridgeNetwork\n\ndocker network create -d overlay \\\n  --subnet=192.168.0.0/16 \\\n  --subnet=192.170.0.0/16 \\\n  --gateway=192.168.0.100 \\\n  --gateway=192.170.0.100 \\\n  --ip-range=192.168.1.0/24 \\\n  --aux-address=\"my-router=192.168.1.5\" \\\n  --aux-address=\"my-switch=192.168.1.6\" \\\n  --aux-address=\"my-printer=192.170.1.5\" \\\n  --aux-address=\"my-nas=192.170.1.6\" \\\n  MyOverlayNetwork\n```\n\n## Clean Up {.cols-2}\n\n### Clean All\n\nCleans up dangling images, containers, volumes, and networks (ie, not associated with a container)\n\n```shell\ndocker system prune\n```\n\n---\n\nAdditionally, remove any stopped containers and all unused images (not just dangling images)\n\n```shell\ndocker system prune -a\n```\n\n### Containers\n\nStop all running containers\n\n```shell\ndocker stop $(docker ps -a -q)\n```\n\nDelete stopped containers\n\n```shell\ndocker container prune\n```\n\n### Images\n\nRemove all dangling (not tagged and is not associated with a container) images:\n\n```shell\ndocker image prune\n```\n\nRemove all images which are not used by existing containers\n\n```shell\ndocker image prune -a\n```\n\n### Volumes\n\n```shell\ndocker volume prune\n```\n\nRemove all volumes not used by at least one container\n\n## Miscellaneous {.cols-2}\n\n### Docker Hub\n\n| Docker Syntax               | Description                         |\n| --------------------------- | ----------------------------------- |\n| `docker search search_word` | Search docker hub for images.       |\n| `docker pull user/image   ` | Downloads an image from docker hub. |\n| `docker login             ` | Authenticate to docker hub          |\n| `docker push user/image   ` | Uploads an image to docker hub.     |\n\n### Registry commands {.row-span-3}\n\nLogin to a Registry\n\n```shell script\n$ docker login\n$ docker login localhost:8080\n```\n\nLogout from a Registry\n\n```shell script\n$ docker logout\n$ docker logout localhost:8080\n```\n\nSearching an Image\n\n```shell script\n$ docker search nginx\n$ docker search nginx --stars=3 --no-trunc busybox\n```\n\nPulling an Image\n\n```shell script\n$ docker pull nginx\n$ docker pull eon01/nginx localhost:5000/myadmin/nginx\n```\n\nPushing an Image\n\n```shell script\n$ docker push eon01/nginx\n$ docker push eon01/nginx localhost:5000/myadmin/nginx\n```\n\n### Batch clean\n\n| Example                             | Description             |\n| ----------------------------------- | ----------------------- |\n| `docker stop -f $(docker ps -a -q)` | Stopping all containers |\n| `docker rm -f $(docker ps -a -q)`   | Removing all containers |\n| `docker rmi -f $(docker images -q)` | Removing all images     |\n\n### Volumes\n\nCheck volumes\n\n```shell script\n$ docker volume ls\n```\n\nCleanup unused volumes\n\n```shell script\n$ docker volume prune\n```\n"
  },
  {
    "path": "source/_posts/ejs.md",
    "content": "---\ntitle: EJS\ndate: 2023-04-07\nbackground: bg-[#b4ca65]\ntags:\n  - EJS\n  - Frontend\n  - Framework\ncategories:\n  - Programming\nintro: EJS(Embedded JavaScript) is a simple templating language that lets you generate HTML markup with plain JavaScript.\nplugins:\n  - copyCode\n  - runCode\n---\n\n<!-- NOTE: EJS does not have Prettier support, so manually format and add a prettier-ignore above broken code blocks -->\n\n## Get Started { .cols-3 }\n\n### Hello world\n\n#### install\n\n```shell\n$ npm install ejs\n```\n\n#### hello.ejs\n\n<!-- prettier-ignore -->\n```html\n<% if (user.email) { %>\n  <h1><%= user.email %></h1>\n<% } %>\n```\n\n#### CLI\n\n```shell\n$ ejs hello.ejs -o hello.html\n```\n\n### Render with Data\n\n```js\nlet ejs = require('ejs');\n\nlet people = ['geddy', 'neil', 'alex'];\nlet tpl = '<%= people.join(\", \"); %>';\n\nlet html = ejs.render(tpl, { people: people });\nconsole.log(html);\n```\n\nPass EJS a template string and some data.\n\n### Browser Support\n\n```html\n<script src=\"https://unpkg.com/ejs\"></script>\n<script>\n  let people = ['geddy', 'neil', 'alex'];\n  let html = ejs.render('<%= people.join(\", \"); %>', { people: people });\n  console.log(html);\n</script>\n```\n\nUse ejs in a script tag.\n\n### Variables\n\n|              |                                  |\n| ------------ | -------------------------------- |\n| `<%= var %>` | Prints the value of the variable |\n| `<%- var %>` | Prints without HTML escaping     |\n\n### CLI\n\nRender and specify an output file.\n\n```shell\n$ ejs hello.ejs -o hello.html\n```\n\nFeed it a template file and a data file\n\n```shell\n$ ejs hello.ejs -f data.json -o hello.html\n```\n\n### Comments\n\n```html\n<%# This line will denote a comment %>\n```\n\n---\n\n<!-- prettier-ignore -->\n```html\n<%# This is a multi-line EJS comment.\n    It can span multiple lines,\n    but will not be displayed\n    in the final HTML output.\n%>\n```\n\n### Method {.col-span-2}\n\n```js\nlet ejs = require('ejs');\nlet template = ejs.compile(str, options);\n\ntemplate(data);\n// => Rendered HTML string\n\nejs.render(str, data, options);\n// => Rendered HTML string\n\nejs.renderFile(filename, data, options, function (err, str) {\n  // str => Rendered HTML string\n});\n```\n\n### Including Files\n\n```html\n<%- include('partials/navbar.ejs') %>\n```\n\nInclude a template with data:\n\n```html\n<% include('header', { title: 'My Page' }) %>\n```\n\n---\n\n<!-- prettier-ignore -->\n```html\n<ul>\n  <% users.forEach(function(user){ %>\n    <%- include('item', {user: user}); %>\n  <% }); %>\n</ul>\n```\n\nTo include a template, needs a file name option, paths are relative\n\n## Docs {.cols-3}\n\n### Conditionals\n\n<!-- prettier-ignore -->\n```html\n<% if (userLoggedIn) { %>\n  <p>Welcome, <%= username %>!</p>\n<% } else { %>\n  <p>Please log in.</p>\n<% } %>\n```\n\n### Using loops\n\n<!-- prettier-ignore -->\n```html\n<ul>\n  <% for(i=0; i < users.length; i++) { %>\n    <li><%= users[i].username %></li>\n  <% } %>\n</ul>\n```\n\n### Custom delimiters\n\n```js\nlet ejs = require('ejs'),\n  users = ['geddy', 'neil', 'alex'];\n\n// Just one template\nejs.render('<?= users.join(\" | \"); ?>', { users: users }, { delimiter: '?' });\n// => 'geddy | neil | alex'\n\n// Or globally\nejs.delimiter = '$';\nejs.render('<$= users.join(\" | \"); $>', { users: users });\n// => 'geddy | neil | alex'\n```\n\n### Caching\n\n```js\nlet ejs = require('ejs'),\n  LRU = require('lru-cache');\n\n// LRU cache with 100-item limit\nejs.cache = LRU(100);\n```\n\n### Custom file loader\n\n```js\nlet ejs = require('ejs');\nlet myFileLoader = function (filePath) {\n  return 'myFileLoader: ' + fs.readFileSync(filePath);\n};\n\nejs.fileLoader = myFileLoader;\n```\n\n### Layouts\n\n<!-- prettier-ignore -->\n```html\n<%- include('header'); -%>\n<h1>\n  Title\n</h1>\n<p>\n  My page\n</p>\n<%- include('footer'); -%>\n```\n\n## Client-side support {.cols-2}\n\n### Example\n\n```html\n<div id=\"output\"></div>\n<script src=\"ejs.min.js\"></script>\n<script>\n  let people = ['geddy', 'neil', 'alex'],\n    html = ejs.render('<%= people.join(\", \"); %>', { people: people });\n  // With jQuery:\n  $('#output').html(html);\n  // Vanilla JS:\n  document.getElementById('output').innerHTML = html;\n</script>\n```\n\n### Caveats\n\n```js\nlet str = \"Hello <%= include('file', {person: 'John'}); %>\",\n  fn = ejs.compile(str, { client: true });\n\n// include callback\nfn(data, null, function (path, d) {\n  // path -> 'file'\n  // d -> {person: 'John'}\n  // Put your code here\n  // Return the contents of file as a string\n}); // returns rendered string\n```\n\n## Options {.cols-1}\n\n### Options list\n\n| Option             | Description                                                                                                                                                                                                                   |\n| ------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| cache              | Compiled functions are cached, requires filename                                                                                                                                                                              |\n| filename           | Used by cache to key caches, and for includes                                                                                                                                                                                 |\n| root               | Set project root for includes with an absolute path (e.g. `/file.ejs`). Can be an array to try to resolve include from multiple directories.                                                                                  |\n| views              | An array of paths to use when resolving includes with relative paths.                                                                                                                                                         |\n| context            | Function execution context                                                                                                                                                                                                    |\n| compileDebug       | When false, no debug instrumentation is compiled                                                                                                                                                                              |\n| client             | Returns standalone compiled function                                                                                                                                                                                          |\n| delimiter          | Character to use for inner delimiter, by default `%`                                                                                                                                                                          |\n| openDelimiter      | Character to use for opening delimiter, by default `<`                                                                                                                                                                        |\n| closeDelimiter     | Character to use for closing delimiter, by default `>`                                                                                                                                                                        |\n| debug              | Outputs generated function body                                                                                                                                                                                               |\n| strict             | When set to `true`, generated function is in strict mode                                                                                                                                                                      |\n| \\_with             | Whether or not to use with() {} constructs. If `false`, then the locals will be stored in the locals object. (Implies `--strict`)                                                                                             |\n| localsName         | Name to use for the object storing local variables when not using with defaults to `locals`                                                                                                                                   |\n| rmWhitespace       | Remove all safe-to-remove whitespace, including leading and trailing whitespace. It also enables a safer version of `-%> `line slurping for all scriptlet tags (it does not strip new lines of tags in the middle of a line). |\n| escape             | The escaping function used with `<%=` construct. It is used in rendering and is `.toString()`ed in the generation of client functions. (By default escapes XML).                                                              |\n| outputFunctionName | Set to a string (e.g., 'echo' or 'print') for a function to print output inside scriptlet tags.                                                                                                                               |\n| async              | When true, EJS will use an async function for rendering. (Depends on async/await support in the JS runtime.                                                                                                                   |\n\n## Tags {.cols-1}\n\n### Tags list\n\n| Tag               | Description                                                          |\n| ----------------- | :------------------------------------------------------------------- |\n| `<%`              | 'Scriptlet' tag, for control-flow, no output                         |\n| <code><%\\_</code> | 'Whitespace Slurping' Scriptlet tag, strips all whitespace before it |\n| `<%=`             | Outputs the value into the template (HTML escaped)                   |\n| `<%-`             | Outputs the unescaped value into the template                        |\n| `<%#`             | Comment tag, no execution, no output                                 |\n| `<%%`             | Outputs a literal `<%`                                               |\n| `%>`              | Plain ending tag                                                     |\n| `-%>`             | Trim-mode ('newline slurp') tag, trims following newline             |\n| <code>\\_%></code> | 'Whitespace Slurping' ending tag, removes all whitespace after it    |\n\n## CLI {.cols-1}\n\n### CLI list\n\n| Option                               | Description                                                                                 |\n| ------------------------------------ | :------------------------------------------------------------------------------------------ |\n| `cache`                              | Compiled functions are cached, requires filename                                            |\n| `-o` / `--output-file FILE`          | Write the rendered output to FILE rather than stdout.                                       |\n| `-f` / `--data-file FILE`            | Must be JSON-formatted. Use parsed input from FILE as data for rendering.                   |\n| `-i` / `--data-input STRING`         | Must be JSON-formatted and URI-encoded. Use parsed input from STRING as data for rendering. |\n| `-m` / `--delimiter CHARACTER`       | Use CHARACTER with angle brackets for open/close (defaults to %).                           |\n| `-p` / `--open-delimiter CHARACTER`  | Use CHARACTER instead of left angle bracket to open.                                        |\n| `-c` / `--close-delimiter CHARACTER` | Use CHARACTER instead of right angle bracket to close.                                      |\n| `-s` / `--strict`                    | When set to `true`, generated function is in strict mode                                    |\n| `-n` / `--no-with`                   | Use `locals` object for vars rather than using `with` (implies --strict).                   |\n| `-l` / `--locals-name`               | Name to use for the object storing local variables when not using `with`.                   |\n| `-w` / `--rm-whitespace`             | Remove all safe-to-remove whitespace, including leading and trailing whitespace.            |\n| `-d` / `--debug`                     | Outputs generated function body                                                             |\n| `-h` / `--help`                      | Display this help message.                                                                  |\n| `-V` / `-v` / `--version`            | Display the EJS version.                                                                    |\n\nExamples of use :\n\n```shell\n$ ejs -p [ -c ] ./template_file.ejs -o ./output.html\n$ ejs ./test/fixtures/user.ejs name=Lerxst\n$ ejs -n -l _ ./some_template.ejs -f ./data_file.json\n```\n"
  },
  {
    "path": "source/_posts/emacs.md",
    "content": "---\ntitle: Emacs\ndate: 2020-12-17 16:21:49\nbackground: bg-[#7752a9]\ntags:\n  - editor\n  - text\n  - shortcut\ncategories:\n  - Toolkit\nintro: |\n  [Emacs](https://www.gnu.org/software/emacs) is the extensible, customizable, self-documenting real time display text editor.\n  This reference was made for Emacs 27.\nplugins:\n  - copyCode\n---\n\n## Getting started\n\n### Starting Emacs\n\nTo enter Emacs, just type its name:\n\n```shell\n$ emacs\n```\n\n---\n\n| -           | -                      |\n| ----------- | :--------------------- |\n| `C-z`       | Suspend Emacs          |\n| `C-x` `C-c` | Exit Emacs permanently |\n\n{.shortcuts}\n\n### Global Description {.secondary}\n\n| -         | -                                           |\n| --------- | :------------------------------------------ |\n| `C-<key>` | Means hold the control, and press `<key>`   |\n| `M-<key>` | Means press the Esc once, and press `<key>` |\n\n{.shortcuts}\n\nNOTICE: This cheatsheet follows the above rules.\n\n### Motion {.row-span-2}\n\n| Backward  | Forward   | Entity to move over            |\n| --------- | --------- | :----------------------------- |\n| `C-b`     | `C-f`     | Haracter                       |\n| `M-b`     | `M-f`     | Word                           |\n| `C-p`     | `C-n`     | Line                           |\n| `C-a`     | `C-e`     | Line beginning<br/>_(or end)_  |\n| `M-a`     | `M-e`     | Sentence                       |\n| `M-{`     | `M-}`     | Paragraph                      |\n| `C-x` `[` | `C-x` `]` | Page                           |\n| `C-M-b`   | `C-M-f`   | Sexp                           |\n| `C-M-a`   | `C-M-e`   | Function                       |\n| `M-<`     | `M->`     | Buffer beginning<br>_(or end)_ |\n\n{.shortcuts .show-header}\n\n### Case Change\n\n| -           | -                |\n| ----------- | :--------------- |\n| `M-u`       | Uppercase word   |\n| `M-l`       | Lowercase word   |\n| `M-c`       | Capitalize word  |\n| `C-x` `C-u` | Uppercase region |\n| `C-x` `C-l` | Lowercase region |\n\n{.shortcuts}\n\n### Files\n\n| -           | -                                                |\n| ----------- | :----------------------------------------------- |\n| `C-x` `C-f` | Read a file into Emacs                           |\n| `C-x` `C-s` | Save a file back to disk                         |\n| `C-x` `s`   | Save all files                                   |\n| `C-x` `i`   | Insert contents of another file into this buffer |\n| `C-x` `C-v` | Replace this file with your file                 |\n| `C-x` `C-w` | Write buffer to a specified file                 |\n| `C-x` `C-q` | Toggle read-only status of buffer                |\n\n{.shortcuts}\n\n### Error Recovery\n\n| -                           | -                                          |\n| --------------------------- | :----------------------------------------- |\n| `C-g`                       | Abort partially typed or executing command |\n| `M-x` recover-session       | Recover files lost by a system crash       |\n| `C-x` `u`<br>`C-_`<br>`C-/` | Undo an unwanted change                    |\n| `M-x` revert-buffer         | Restore a buffer to its original contents  |\n| `C-l`                       | Redraw garbaged screen                     |\n\n{.shortcuts}\n\n### Transposing {.row-span-2}\n\n| -           | -                    |\n| ----------- | :------------------- |\n| `C-t`       | Transpose characters |\n| `M-t`       | Transpose words      |\n| `C-x` `C-t` | Transpose lines      |\n| `C-M-t`     | Transpose sexps      |\n\n{.shortcuts .table-fixed}\n\n#### Scroll\n\n| -         | -                                              |\n| --------- | :--------------------------------------------- |\n| `C-v`     | Scroll to next screen                          |\n| `M-v`     | Scroll to previous screen                      |\n| `C-x` `<` | Scroll left                                    |\n| `C-x` `>` | Scroll right                                   |\n| `C-l`     | Scroll current line to <br>center, top, bottom |\n\n{.shortcuts .table-fixed}\n\n#### Goto\n\n| -         | -                   |\n| --------- | :------------------ |\n| `M-g` `g` | Goto line           |\n| `M-g` `c` | Goto char           |\n| `M-m`     | Back to indentation |\n\n{.shortcuts .table-fixed}\n\n### Marking\n\n| -                 | -                       |\n| ----------------- | :---------------------- |\n| `C-@`<br/>`C-SPC` | Uet mark here           |\n| `C-x` `C-x`       | Exchange point and mark |\n| `M-@`             | Set mark arg words away |\n| `M-h`             | Mark paragraph          |\n| `C-x` `C-p`       | Mark page               |\n| `C-M-@`           | Mark sexp               |\n| `C-M-h`           | Mark function           |\n| `C-x` `h`         | Mark entire buffer      |\n\n{.shortcuts}\n\n### Killing and Deleting {.row-span-2}\n\n| Backward      | Forward | Entity to kill           |\n| ------------- | ------- | :----------------------- |\n| `DEL`         | `C-d`   | Character <br>_(delete)_ |\n| `M-DEL`       | `M-d`   | Word                     |\n| `M-0` `C-k`   | `C-k`   | Line <br/> _(to end of)_ |\n| `C-x` `DEL`   | `M-k`   | Sentence                 |\n| `M--` `C-M-k` | `C-M-k` | Sexp                     |\n\n{.shortcuts .show-header}\n\n#### Killing\n\n| -          | -                                    |\n| ---------- | :----------------------------------- |\n| `C-W`      | Kill region C-w                      |\n| `M-w`      | Copy region to kill ring             |\n| `M-z` char | Kill through next occurrence of char |\n| `C-y`      | Yank back last thing killed          |\n| `M-y`      | Replace last yank with previous kill |\n\n{.shortcuts}\n\n### Getting Help\n\n| -         | -                                        |\n| --------- | :--------------------------------------- |\n| `C-x` `1` | Remove help window                       |\n| `C-M-v`   | Scroll help window                       |\n| `C-h` `a` | Apropos: show commands matching a string |\n| `C-h` `k` | Describe the function a key runs         |\n| `C-h` `f` | Describe a function                      |\n| `C-h` `m` | Get mode-specific information            |\n\n{.shortcuts}\n\nThe help system is simple. Type `C-h` (or `F1`) and follow the directions. If you are a first-time user, type `C-h` `t`\nfor a tutorial.\n\n### Multiple Windows {.col-span-2}\n\nWhen two commands are shown, the second is a similar command for a frame instead of a window.\n\n| -               | -               | -                                   |\n| --------------- | --------------- | :---------------------------------- |\n| `C-x` `5` `1`   | `C-x` `1`       | Delete all other windows            |\n| `C-x` `5` `2`   | `C-x` `2`       | Split window, above and below       |\n| `C-x` `5` `0`   | `C-x` `0`       | Delete this window                  |\n| `C-x` `3`       |                 | Split window, side by side          |\n| `C-M-v`         |                 | Scroll other window                 |\n| `C-x` `5` `o`   | `C-x` `o`       | Switch cursor to another window     |\n| `C-x` `5` `b`   | `C-x` `4` `b`   | Select buffer in other window       |\n| `C-x` `5` `C-o` | `C-x` `4` `C-o` | Display buffer in other window      |\n| `C-x` `5` `f`   | `C-x` `4` `f`   | Find file in other window           |\n| `C-x` `5` `r`   | `C-x` `4` `r`   | Find file read-only in other window |\n| `C-x` `5` `d`   | `C-x` `4` `d`   | Run Dired in other window           |\n| `C-x` `5` `.`   | `C-x` `4` `.`   | Find tag in other window            |\n| `C-x` `^`       |                 | Grow window taller                  |\n| `C-x` `{`       |                 | Shrink window narrower              |\n| `C-x` `}`       |                 | Grow window wider                   |\n\n{.shortcuts}\n\n### Formatting\n\n| -           | -                                        |\n| ----------- | :--------------------------------------- |\n| `TAB`       | Indent current line (mode-dependent)     |\n| `C-M-\\`     | Indent region (mode-dependent)           |\n| `C-M-q`     | Indent sexp (mode-dependent)             |\n| `C-x` `TAB` | Indent region rigidly arg columns        |\n| `M-;`       | Indent for comment                       |\n| `C-o`       | Insert newline after point               |\n| `C-M-o`     | Move rest of line vertically down        |\n| `C-x` `C-o` | Delete blank lines around point          |\n| `M-^`       | Join line with previous (with arg, next) |\n| `M-\\`       | Delete all white space around point      |\n| `M-SPC`     | Put exactly one space at point           |\n| `M-q`       | Fill paragraph                           |\n| `C-x` `f`   | Set fill column to arg                   |\n| `C-x` `.`   | Set prefix each line starts with         |\n| `M-o`       | Set face                                 |\n\n{.shortcuts}\n\n### Info {.row-span-2}\n\n| -         | -                                           |\n| --------- | :------------------------------------------ |\n| `C-h` `i` | Enter the Info documentation reader         |\n| `C-h` `S` | Find specified function or variable in Info |\n\n{.shortcuts .table-fixed}\n\n#### Moving within a node\n\n| -     | -                 |\n| ----- | :---------------- |\n| `SPC` | Scroll forward    |\n| `DEL` | Scroll reverse    |\n| `b`   | Beginning of node |\n\n{.shortcuts .table-fixed}\n\n#### Moving between nodes\n\n| -   | -                                      |\n| --- | :------------------------------------- |\n| `n` | Next node                              |\n| `p` | Previous node                          |\n| `u` | Move up                                |\n| `m` | Select menu item by name               |\n| `n` | Select nth menu item by number (1–9)   |\n| `f` | Follow cross reference (return with l) |\n| `l` | Return to last node you saw            |\n| `d` | Return to directory node               |\n| `t` | Go to top node of Info file            |\n| `g` | Go to any node by name                 |\n\n{.shortcuts .table-fixed}\n\n#### Other\n\n| -   | -                                |\n| --- | :------------------------------- |\n| `h` | Run Info tutorial                |\n| `i` | Look up a subject in the indices |\n| `s` | Search nodes for regexp          |\n| `q` | Quit Info                        |\n\n{.shortcuts .table-fixed}\n\n### Minibuffer\n\nThe following keys are defined in the minibuffer.\n\n| -     | -                                       |\n| ----- | :-------------------------------------- |\n| `TAB` | Complete as much as possible            |\n| `SPC` | Complete up to one word                 |\n| `RET` | Complete and execute                    |\n| `?`   | Show possible completions               |\n| `M-p` | Fetch previous minibuffer input         |\n| `M-n` | Fetch later minibuffer input or default |\n| `M-r` | Regexp search backward through history  |\n| `M-s` | Regexp search forward through history   |\n| `C-g` | Abort command                           |\n\n{.shortcuts}\n\nType `C-x` `ESC` `ESC` to edit and repeat the last command that used the minibuffer. Type `F10` to activate menu bar\nitems on text terminals.\n\n### Tags\n\n| -                        | -                                          |\n| ------------------------ | :----------------------------------------- |\n| `M-.`                    | Find a tag (a definition)                  |\n| `C-u` `M-.`              | Find next occurrence of tag                |\n| `M-x` visit-tags-table   | Specify a new tags file                    |\n| `M-x` tags-search        | Regexp search on all files in tags table   |\n| `M-x` tags-query-replace | Run query-replace on all the files         |\n| `M-,`                    | Continue last tags search or query-replace |\n\n{.shortcuts}\n\n### Rectangles\n\n| -             | -                                   |\n| ------------- | :---------------------------------- |\n| `C-x` `r` `r` | Copy rectangle to register          |\n| `C-x` `r` `k` | Kill rectangle                      |\n| `C-x` `r` `y` | Yank rectangle                      |\n| `C-x` `r` `o` | Open rectangle, shifting text right |\n| `C-x` `r` `c` | Blank out rectangle                 |\n| `C-x` `r` `t` | Prefix each line with a string      |\n\n{.shortcuts}\n\n### Keyboard Macros\n\n| -                         | -                                   |\n| ------------------------- | :---------------------------------- |\n| `C-x` `(`                 | Start defining a keyboard macro     |\n| `C-x` `)`                 | End keyboard macro definition       |\n| `C-x` `e`                 | Execute last-defined keyboard macro |\n| `C-u` `C-x` `(`           | Append to last keyboard macro       |\n| `M-x` name-last-kbd-macro | Name last keyboard macro            |\n| `M-x` insert-kbd-macro    | Insert Lisp definition in buffer    |\n\n{.shortcuts}\n\n### Buffers\n\n| -           | -                     |\n| ----------- | :-------------------- |\n| `C-x` `b`   | Select another buffer |\n| `C-x` `C-b` | List all buffers      |\n| `C-x` `k`   | Kill a buffer         |\n\n{.shortcuts}\n\n## Emacs Search\n\n### Regex (common) {.row-span-2}\n\n| -             | -                                            |\n| ------------- | :------------------------------------------- |\n| `.` `(dot)`   | Any single character except a newline        |\n| `*`           | Zero or more repeats                         |\n| `+`           | One or more repeats                          |\n| `?`           | Zero or one repeat                           |\n| `\\`           | Quote special characters                     |\n| `\\c`          | Quote regular expression special character c |\n| `\\|`          | Alternative (“or”)                           |\n| `\\(...\\)`     | Grouping                                     |\n| `\\(:?...\\)`   | Shy grouping                                 |\n| `\\(:NUM...\\)` | Explicit numbered grouping                   |\n| `\\n`          | Same text as nth group                       |\n| `\\b`          | At word break                                |\n| `\\B`          | Not at word break                            |\n\n### Regex (entry)\n\n| Start | End   | Entity |\n| ----- | ----- | :----- |\n| `^`   | `$`   | Line   |\n| `\\<`  | `\\>`  | Word   |\n| `\\_<` | `\\_>` | Symbol |\n| `\\‘`  | `\\’`  | Buffer |\n\n{.show-header}\n\n### Regex (conflict)\n\n| These   | Others   | class                     |\n| ------- | -------- | :------------------------ |\n| `[...]` | `[^...]` | Explicit set              |\n| `\\w`    | `\\W`     | Word-syntax character     |\n| `\\sc`   | `\\Sc`    | Character with syntax c   |\n| `\\cc`   | `\\Cc`    | Character with category c |\n\n{.show-header}\n\n### Incremental Search\n\n| -       | -                                 |\n| ------- | :-------------------------------- |\n| `C-s`   | Search forward                    |\n| `C-r`   | Search backward                   |\n| `C-M-s` | Regular expression search         |\n| `C-M-r` | Reverse regular expression search |\n| `M-p`   | Select previous search string     |\n| `M-n`   | Select next later search string   |\n| `RET`   | Exit incremental search           |\n| `DEL`   | Undo effect of last character     |\n| `C-g`   | Abort current search              |\n\n{.shortcuts}\n\nUse `C-s` or `C-r` again to repeat the search in either direction. If Emacs is still searching, `C-g` cancels only the\npart not matched.\n\n### Query Replace\n\n| -            | -                                    |\n| ------------ | :----------------------------------- |\n| `M-%`        | Interactively replace a text string  |\n| `M-x` regexp | Using regular expressions            |\n| `SPC` / `y`  | Replace this one, go on to next      |\n| `,`          | Replace this one, don’t move         |\n| `DEL` / `n`  | Skip to next without replacing       |\n| `!`          | Replace all remaining matches        |\n| `^`          | Back up to the previous match        |\n| `RET`        | Exit query-replace                   |\n| `C-r`        | Enter recursive edit (C-M-c to exit) |\n\n{.shortcuts}\n\n## Misc\n\n### Shells\n\n| -           | -                                      |\n| ----------- | :------------------------------------- |\n| `M-!`       | Execute a shell command                |\n| `M-&`       | Execute a shell command asynchronously |\n| `M-`        | Run a shell command on the region      |\n| `C-u` `M-`  | Filter region through a shell command  |\n| `M-x` shell | Start a shell in window shell          |\n\n{.shortcuts}\n\n### International Character Sets {.col-span-2}\n\n| -                          | -                                  |\n| -------------------------- | :--------------------------------- |\n| `C-x` `RET` `l`            | specify principal language         |\n| `M-x` list-input-methods   | show all input methods             |\n| `C-\\`                      | enable or disable input method     |\n| `C-x` `RET` `c`            | set coding system for next command |\n| `M-x` list-coding-systems  | show all coding systems            |\n| `M-x` prefer-coding-system | choose preferred coding system     |\n\n{.shortcuts}\n\n### Registers\n\n| -               | -                                    |\n| --------------- | :----------------------------------- |\n| `C-x` `r` `s`   | Save region in register              |\n| `C-x` `r` `i`   | Insert register contents into buffer |\n| `C-x` `r` `SPC` | Save value of point in register      |\n| `C-x` `r` `j`   | Jump to point saved in register      |\n\n{.shortcuts}\n\n### Miscellaneous\n\n| -          | -                 |\n| ---------- | :---------------- |\n| `C-u` num  | Numeric argument  |\n| `M--`      | Negative argument |\n| `C-q` char | Quoted insert     |\n\n{.shortcuts}\n\n### Commands Dealing with Emacs Lisp\n\n| -                  | -                                  |\n| ------------------ | :--------------------------------- |\n| `C-x` `C-e`        | Eval sexp before point             |\n| `C-M-x`            | Eval current defun                 |\n| `M-x` eval-region  | Eval region                        |\n| `M-:`              | Read and eval minibuffer           |\n| `M-x` load-library | Load a Lisp library from load-path |\n\n{.shortcuts}\n\n### Simple Customization\n\n| -                 | -                             |\n| ----------------- | :---------------------------- |\n| `M-x` `customize` | customize variables and faces |\n\nMaking global key bindings in Emacs Lisp:\n\n```{.wrap}\n(global-set-key (kbd \"C-c g\") ’search-forward)\n(global-set-key (kbd \"M-#\") ’query-replace-regexp)\n```\n\n### Abbrevs\n\n| -                 | -                                        |\n| ----------------- | :--------------------------------------- |\n| `C-x` `a` `g`     | Add global abbrev                        |\n| `C-x` `a` `l`     | Add mode-local abbrev                    |\n| `C-x` `a` `i` `g` | Add global expansion for this abbrev     |\n| `C-x` `a` `i` `l` | Add mode-local expansion for this abbrev |\n| `C-x` `a` `e`     | Explicitly expand abbrev                 |\n| `M-/`             | Expand previous word dynamically         |\n\n{.shortcuts}\n\n### Spelling Check\n\n| -                   | -                                     |\n| ------------------- | :------------------------------------ |\n| `M-$`               | Check spelling of current word        |\n| `M-x` ispell-region | Check spelling of all words in region |\n| `M-x` ispell-buffer | Check spelling of entire buffer       |\n| `M-x` flyspell-mode | Toggle on-the-fly spell checking      |\n\n{.shortcuts}\n\n### Writing Commands {.col-span-2}\n\n#### Syntax\n\n```lisp\n(defun command-name (args)\n\"documentation\" (interactive \"template\")\nbody)\n```\n\n#### Example\n\n```lisp\n(defun this-line-to-top-of-window (line)\n    \"Reposition current line to top of window.\nWith prefix argument LINE, put point on LINE.\"\n    (interactive \"P\")\n    (recenter (if (null line)\n                  0\n              (prefix-numeric-value line))))\n```\n\nThe interactive spec says how to read arguments interactively. Type `C-h` `f` interactive `RET` for more details.\n"
  },
  {
    "path": "source/_posts/emmet.md",
    "content": "---\ntitle: Emmet\ndate: 2020-12-14 18:28:43\nbackground: bg-[#95c844]\ntags:\n  - snippets\n  - coding\n  - html\n  - css\n  - abbr\ncategories:\n  - Toolkit\nintro: |\n  [Emmet](https://emmet.io/) is a web-developer’s toolkit for boosting HTML & CSS code writing, which allows you to write large HTML code blocks at speed of light using well-known CSS selectors.\nplugins:\n  - copyCode\n---\n\n## Emmet Syntax\n\n### Getting started\n\nLet us start to improve your development to the speed of light.\n\n- [Emmet in Visual Studio Code](https://code.visualstudio.com/docs/editor/emmet) _(code.visualstudio.com)_\n- [Emmet 2 for Sublime Text](https://github.com/emmetio/sublime-text-plugin) _(github.com)_\n- [Emmet for Coda](https://emmet.io/download/coda/) _(emmet.io)_\n- [Emmet for Atom](https://github.com/emmetio/emmet-atom#readme) _(github.com)_\n\n### Multiplication: \\*\n\n<code>ul>li\\*5</code>\n\n```html\n<ul>\n  <li></li>\n  <li></li>\n  <li></li>\n  <li></li>\n  <li></li>\n</ul>\n```\n\n### Child: >\n\n`nav>ul>li`\n\n```html\n<nav>\n  <ul>\n    <li></li>\n  </ul>\n</nav>\n```\n\n### Custom attributes {.col-span-2}\n\n`p[title=\"Hello world\"]`\n\n```html\n<p title=\"Hello world\"></p>\n```\n\n`td[rowspan=2 colspan=3 title]`\n\n```html\n<td rowspan=\"2\" colspan=\"3\" title=\"\"></td>\n```\n\n`[a='value1' b=\"value2\"]`\n\n```html\n<div a=\"value1\" b=\"value2\"></div>\n```\n\n### Text: {}\n\n`a{Click me}`\n\n```html\n<a href=\"\">Click me</a>\n```\n\n`p>{Click }+a{here}+{ to continue}`\n\n```html {.wrap}\n<p>Click <a href=\"\">here</a> to continue</p>\n```\n\n### ID and CLASS attributes {.row-span-2}\n\n`#header`\n\n```html\n<div id=\"header\"></div>\n```\n\n`.title`\n\n```html\n<div class=\"title\"></div>\n```\n\n`form#search.wide`\n\n```html\n<form id=\"search\" class=\"wide\"></form>\n```\n\n`p.class1.class2.class3`\n\n```html\n<p class=\"class1 class2 class3\"></p>\n```\n\n### Implicit tag names {.row-span-2}\n\n`.class`\n\n```html\n<div class=\"class\"></div>\n```\n\n`em>.class`\n\n```html\n<em><span class=\"class\"></span></em>\n```\n\n`ul>.class`\n\n```html\n<ul>\n  <li class=\"class\"></li>\n</ul>\n```\n\n`table>.row>.col`\n\n```html\n<table>\n  <tr class=\"row\">\n    <td class=\"col\"></td>\n  </tr>\n</table>\n```\n\n### Sibling: +\n\n`div+p+bq`\n\n```html\n<div></div>\n<p></p>\n<blockquote></blockquote>\n```\n\n### Climb-up: ^\n\n`div+div>p>span+em^bq`\n\n```html\n<div></div>\n<div>\n  <p><span></span><em></em></p>\n  <blockquote></blockquote>\n</div>\n```\n\n`div+div>p>span+em^^bq`\n\n```html\n<div></div>\n<div>\n  <p><span></span><em></em></p>\n</div>\n<blockquote></blockquote>\n```\n\n### Grouping: ()\n\n<code>div>(header>ul>li\\*2>a)+footer>p</code>\n\n```html\n<div>\n  <header>\n    <ul>\n      <li><a href=\"\"></a></li>\n      <li><a href=\"\"></a></li>\n    </ul>\n  </header>\n  <footer>\n    <p></p>\n  </footer>\n</div>\n```\n\n<code>(div>dl>(dt+dd)\\*4)+footer>p</code>\n\n```html\n<div>\n  <dl>\n    <dt></dt>\n    <dd></dd>\n    <dt></dt>\n    <dd></dd>\n    <dt></dt>\n    <dd></dd>\n    <dt></dt>\n    <dd></dd>\n  </dl>\n</div>\n<footer>\n  <p></p>\n</footer>\n```\n\n### Indexing: $ {.col-span-2}\n\n<code>ul>li.item$\\*3</code>\n\n```html\n<ul>\n  <li class=\"item1\"></li>\n  <li class=\"item2\"></li>\n  <li class=\"item3\"></li>\n</ul>\n```\n\n<code>h$[title=item$]{Header $}\\*3</code>\n\n```html\n<h1 title=\"item1\">Header 1</h1>\n<h2 title=\"item2\">Header 2</h2>\n<h3 title=\"item3\">Header 3</h3>\n```\n\n<code>ul>li.item$$$\\*3</code>\n\n```html\n<ul>\n  <li class=\"item001\"></li>\n  <li class=\"item002\"></li>\n  <li class=\"item003\"></li>\n</ul>\n```\n\n<code>ul>li.item$@-\\*3</code>\n\n```html\n<ul>\n  <li class=\"item3\"></li>\n  <li class=\"item2\"></li>\n  <li class=\"item1\"></li>\n</ul>\n```\n\n<code>ul>li.item$@2\\*3</code>\n\n```html\n<ul>\n  <li class=\"item2\"></li>\n  <li class=\"item3\"></li>\n  <li class=\"item4\"></li>\n</ul>\n```\n\n## Also see {.cols-1}\n\n- [Emmet Cheat sheet](https://docs.emmet.io/cheat-sheet/) _(docs.emmet.io)_\n"
  },
  {
    "path": "source/_posts/emoji.md",
    "content": "---\ntitle: Emoji\ndate: 2020-12-15 18:28:43\nbackground: bg-[#ebbe46]\ntags:\ncategories:\n  - Other\nintro: Some of the emoji codes are not super easy to remember, so here is a little cheat sheet.\n---\n\n## Getting Started\n\n### People\n\n| -                              | -                                |\n| ------------------------------ | -------------------------------- |\n| :smile:                        | `:smile:`                        |\n| :laughing:                     | `:laughing:`                     |\n| :blush:                        | `:blush:`                        |\n| :smiley:                       | `:smiley:`                       |\n| :relaxed:                      | `:relaxed:`                      |\n| :smirk:                        | `:smirk:`                        |\n| :heart_eyes:                   | `:heart_eyes:`                   |\n| :kissing_heart:                | `:kissing_heart:`                |\n| :kissing_closed_eyes:          | `:kissing_closed_eyes:`          |\n| :flushed:                      | `:flushed:`                      |\n| :relieved:                     | `:relieved:`                     |\n| :satisfied:                    | `:satisfied:`                    |\n| :grin:                         | `:grin:`                         |\n| :wink:                         | `:wink:`                         |\n| :stuck_out_tongue_winking_eye: | `:stuck_out_tongue_winking_eye:` |\n| :stuck_out_tongue_closed_eyes: | `:stuck_out_tongue_closed_eyes:` |\n| :grinning:                     | `:grinning:`                     |\n| :kissing:                      | `:kissing:`                      |\n| :kissing_smiling_eyes:         | `:kissing_smiling_eyes:`         |\n| :stuck_out_tongue:             | `:stuck_out_tongue:`             |\n| :sleeping:                     | `:sleeping:`                     |\n| :worried:                      | `:worried:`                      |\n| :frowning:                     | `:frowning:`                     |\n| :anguished:                    | `:anguished:`                    |\n| :open_mouth:                   | `:open_mouth:`                   |\n| :grimacing:                    | `:grimacing:`                    |\n| :confused:                     | `:confused:`                     |\n| :hushed:                       | `:hushed:`                       |\n| :expressionless:               | `:expressionless:`               |\n| :unamused:                     | `:unamused:`                     |\n| :sweat_smile:                  | `:sweat_smile:`                  |\n| :sweat:                        | `:sweat:`                        |\n| :disappointed_relieved:        | `:disappointed_relieved:`        |\n| :weary:                        | `:weary:`                        |\n| :pensive:                      | `:pensive:`                      |\n| :disappointed:                 | `:disappointed:`                 |\n| :confounded:                   | `:confounded:`                   |\n| :fearful:                      | `:fearful:`                      |\n| :cold_sweat:                   | `:cold_sweat:`                   |\n| :persevere:                    | `:persevere:`                    |\n| :cry:                          | `:cry:`                          |\n| :sob:                          | `:sob:`                          |\n| :joy:                          | `:joy:`                          |\n| :astonished:                   | `:astonished:`                   |\n| :scream:                       | `:scream:`                       |\n| :tired_face:                   | `:tired_face:`                   |\n| :angry:                        | `:angry:`                        |\n| :rage:                         | `:rage:`                         |\n| :triumph:                      | `:triumph:`                      |\n| :sleepy:                       | `:sleepy:`                       |\n| :yum:                          | `:yum:`                          |\n| :mask:                         | `:mask:`                         |\n| :sunglasses:                   | `:sunglasses:`                   |\n| :dizzy_face:                   | `:dizzy_face:`                   |\n| :imp:                          | `:imp:`                          |\n| :smiling_imp:                  | `:smiling_imp:`                  |\n| :neutral_face:                 | `:neutral_face:`                 |\n| :no_mouth:                     | `:no_mouth:`                     |\n| :innocent:                     | `:innocent:`                     |\n| :alien:                        | `:alien:`                        |\n| :yellow_heart:                 | `:yellow_heart:`                 |\n| :blue_heart:                   | `:blue_heart:`                   |\n| :purple_heart:                 | `:purple_heart:`                 |\n| :heart:                        | `:heart:`                        |\n| :green_heart:                  | `:green_heart:`                  |\n| :broken_heart:                 | `:broken_heart:`                 |\n| :heartbeat:                    | `:heartbeat:`                    |\n| :heartpulse:                   | `:heartpulse:`                   |\n| :two_hearts:                   | `:two_hearts:`                   |\n| :revolving_hearts:             | `:revolving_hearts:`             |\n| :cupid:                        | `:cupid:`                        |\n| :sparkling_heart:              | `:sparkling_heart:`              |\n| :sparkles:                     | `:sparkles:`                     |\n| :star:                         | `:star:`                         |\n| :star2:                        | `:star2:`                        |\n| :dizzy:                        | `:dizzy:`                        |\n| :boom:                         | `:boom:`                         |\n| :collision:                    | `:collision:`                    |\n| :anger:                        | `:anger:`                        |\n| :exclamation:                  | `:exclamation:`                  |\n| :question:                     | `:question:`                     |\n| :grey_exclamation:             | `:grey_exclamation:`             |\n| :grey_question:                | `:grey_question:`                |\n| :zzz:                          | `:zzz:`                          |\n| :dash:                         | `:dash:`                         |\n| :sweat_drops:                  | `:sweat_drops:`                  |\n| :notes:                        | `:notes:`                        |\n| :musical_note:                 | `:musical_note:`                 |\n| :fire:                         | `:fire:`                         |\n| :hankey:                       | `:hankey:`                       |\n| :poop:                         | `:poop:`                         |\n| :shit:                         | `:shit:`                         |\n| :+1:                           | `:+1:`                           |\n| :thumbsup:                     | `:thumbsup:`                     |\n| :-1:                           | `:-1:`                           |\n| :thumbsdown:                   | `:thumbsdown:`                   |\n| :ok_hand:                      | `:ok_hand:`                      |\n| :punch:                        | `:punch:`                        |\n| :facepunch:                    | `:facepunch:`                    |\n| :fist:                         | `:fist:`                         |\n| :v:                            | `:v:`                            |\n| :wave:                         | `:wave:`                         |\n| :hand:                         | `:hand:`                         |\n| :raised_hand:                  | `:raised_hand:`                  |\n| :open_hands:                   | `:open_hands:`                   |\n| :point_up:                     | `:point_up:`                     |\n| :point_down:                   | `:point_down:`                   |\n| :point_left:                   | `:point_left:`                   |\n| :point_right:                  | `:point_right:`                  |\n| :raised_hands:                 | `:raised_hands:`                 |\n| :pray:                         | `:pray:`                         |\n| :point_up_2:                   | `:point_up_2:`                   |\n| :clap:                         | `:clap:`                         |\n| :muscle:                       | `:muscle:`                       |\n| :metal:                        | `:metal:`                        |\n| :fu:                           | `:fu:`                           |\n| :runner:                       | `:runner:`                       |\n| :running:                      | `:running:`                      |\n| :couple:                       | `:couple:`                       |\n| :family:                       | `:family:`                       |\n| :two_men_holding_hands:        | `:two_men_holding_hands:`        |\n| :two_women_holding_hands:      | `:two_women_holding_hands:`      |\n| :dancer:                       | `:dancer:`                       |\n| :dancers:                      | `:dancers:`                      |\n| :ok_woman:                     | `:ok_woman:`                     |\n| :no_good:                      | `:no_good:`                      |\n| :information_desk_person:      | `:information_desk_person:`      |\n| :raising_hand:                 | `:raising_hand:`                 |\n| :bride_with_veil:              | `:bride_with_veil:`              |\n| :bow:                          | `:bow:`                          |\n| :couplekiss:                   | `:couplekiss:`                   |\n| :couple_with_heart:            | `:couple_with_heart:`            |\n| :massage:                      | `:massage:`                      |\n| :haircut:                      | `:haircut:`                      |\n| :nail_care:                    | `:nail_care:`                    |\n| :boy:                          | `:boy:`                          |\n| :girl:                         | `:girl:`                         |\n| :woman:                        | `:woman:`                        |\n| :man:                          | `:man:`                          |\n| :baby:                         | `:baby:`                         |\n| :older_woman:                  | `:older_woman:`                  |\n| :older_man:                    | `:older_man:`                    |\n| :man_with_gua_pi_mao:          | `:man_with_gua_pi_mao:`          |\n| :man_with_turban:              | `:man_with_turban:`              |\n| :construction_worker:          | `:construction_worker:`          |\n| :cop:                          | `:cop:`                          |\n| :angel:                        | `:angel:`                        |\n| :princess:                     | `:princess:`                     |\n| :smiley_cat:                   | `:smiley_cat:`                   |\n| :smile_cat:                    | `:smile_cat:`                    |\n| :heart_eyes_cat:               | `:heart_eyes_cat:`               |\n| :kissing_cat:                  | `:kissing_cat:`                  |\n| :smirk_cat:                    | `:smirk_cat:`                    |\n| :scream_cat:                   | `:scream_cat:`                   |\n| :crying_cat_face:              | `:crying_cat_face:`              |\n| :joy_cat:                      | `:joy_cat:`                      |\n| :pouting_cat:                  | `:pouting_cat:`                  |\n| :japanese_ogre:                | `:japanese_ogre:`                |\n| :japanese_goblin:              | `:japanese_goblin:`              |\n| :see_no_evil:                  | `:see_no_evil:`                  |\n| :hear_no_evil:                 | `:hear_no_evil:`                 |\n| :speak_no_evil:                | `:speak_no_evil:`                |\n| :guardsman:                    | `:guardsman:`                    |\n| :skull:                        | `:skull:`                        |\n| :feet:                         | `:feet:`                         |\n| :lips:                         | `:lips:`                         |\n| :kiss:                         | `:kiss:`                         |\n| :droplet:                      | `:droplet:`                      |\n| :ear:                          | `:ear:`                          |\n| :eyes:                         | `:eyes:`                         |\n| :nose:                         | `:nose:`                         |\n| :tongue:                       | `:tongue:`                       |\n| :love_letter:                  | `:love_letter:`                  |\n| :bust_in_silhouette:           | `:bust_in_silhouette:`           |\n| :busts_in_silhouette:          | `:busts_in_silhouette:`          |\n| :speech_balloon:               | `:speech_balloon:`               |\n| :thought_balloon:              | `:thought_balloon:`              |\n\n### Symbols\n\n| -                                 | -                                   |\n| --------------------------------- | ----------------------------------- |\n| :one:                             | `:one:`                             |\n| :two:                             | `:two:`                             |\n| :three:                           | `:three:`                           |\n| :four:                            | `:four:`                            |\n| :five:                            | `:five:`                            |\n| :six:                             | `:six:`                             |\n| :seven:                           | `:seven:`                           |\n| :eight:                           | `:eight:`                           |\n| :nine:                            | `:nine:`                            |\n| :keycap_ten:                      | `:keycap_ten:`                      |\n| :1234:                            | `:1234:`                            |\n| :zero:                            | `:zero:`                            |\n| :hash:                            | `:hash:`                            |\n| :symbols:                         | `:symbols:`                         |\n| :arrow_backward:                  | `:arrow_backward:`                  |\n| :arrow_down:                      | `:arrow_down:`                      |\n| :arrow_forward:                   | `:arrow_forward:`                   |\n| :arrow_left:                      | `:arrow_left:`                      |\n| :capital_abcd:                    | `:capital_abcd:`                    |\n| :abcd:                            | `:abcd:`                            |\n| :abc:                             | `:abc:`                             |\n| :arrow_lower_left:                | `:arrow_lower_left:`                |\n| :arrow_lower_right:               | `:arrow_lower_right:`               |\n| :arrow_right:                     | `:arrow_right:`                     |\n| :arrow_up:                        | `:arrow_up:`                        |\n| :arrow_upper_left:                | `:arrow_upper_left:`                |\n| :arrow_upper_right:               | `:arrow_upper_right:`               |\n| :arrow_double_down:               | `:arrow_double_down:`               |\n| :arrow_double_up:                 | `:arrow_double_up:`                 |\n| :arrow_down_small:                | `:arrow_down_small:`                |\n| :arrow_heading_down:              | `:arrow_heading_down:`              |\n| :arrow_heading_up:                | `:arrow_heading_up:`                |\n| :leftwards_arrow_with_hook:       | `:leftwards_arrow_with_hook:`       |\n| :arrow_right_hook:                | `:arrow_right_hook:`                |\n| :left_right_arrow:                | `:left_right_arrow:`                |\n| :arrow_up_down:                   | `:arrow_up_down:`                   |\n| :arrow_up_small:                  | `:arrow_up_small:`                  |\n| :arrows_clockwise:                | `:arrows_clockwise:`                |\n| :arrows_counterclockwise:         | `:arrows_counterclockwise:`         |\n| :rewind:                          | `:rewind:`                          |\n| :fast_forward:                    | `:fast_forward:`                    |\n| :information_source:              | `:information_source:`              |\n| :ok:                              | `:ok:`                              |\n| :twisted_rightwards_arrows:       | `:twisted_rightwards_arrows:`       |\n| :repeat:                          | `:repeat:`                          |\n| :repeat_one:                      | `:repeat_one:`                      |\n| :new:                             | `:new:`                             |\n| :top:                             | `:top:`                             |\n| :up:                              | `:up:`                              |\n| :cool:                            | `:cool:`                            |\n| :free:                            | `:free:`                            |\n| :ng:                              | `:ng:`                              |\n| :cinema:                          | `:cinema:`                          |\n| :koko:                            | `:koko:`                            |\n| :signal_strength:                 | `:signal_strength:`                 |\n| :u6e80:                           | `:u6e80:`                           |\n| :sa:                              | `:sa:`                              |\n| :restroom:                        | `:restroom:`                        |\n| :mens:                            | `:mens:`                            |\n| :womens:                          | `:womens:`                          |\n| :baby_symbol:                     | `:baby_symbol:`                     |\n| :no_smoking:                      | `:no_smoking:`                      |\n| :parking:                         | `:parking:`                         |\n| :wheelchair:                      | `:wheelchair:`                      |\n| :metro:                           | `:metro:`                           |\n| :baggage_claim:                   | `:baggage_claim:`                   |\n| :accept:                          | `:accept:`                          |\n| :wc:                              | `:wc:`                              |\n| :potable_water:                   | `:potable_water:`                   |\n| :put_litter_in_its_place:         | `:put_litter_in_its_place:`         |\n| :secret:                          | `:secret:`                          |\n| :congratulations:                 | `:congratulations:`                 |\n| :m:                               | `:m:`                               |\n| :passport_control:                | `:passport_control:`                |\n| :left_luggage:                    | `:left_luggage:`                    |\n| :customs:                         | `:customs:`                         |\n| :ideograph_advantage:             | `:ideograph_advantage:`             |\n| :cl:                              | `:cl:`                              |\n| :sos:                             | `:sos:`                             |\n| :id:                              | `:id:`                              |\n| :no_entry_sign:                   | `:no_entry_sign:`                   |\n| :underage:                        | `:underage:`                        |\n| :no_mobile_phones:                | `:no_mobile_phones:`                |\n| :do_not_litter:                   | `:do_not_litter:`                   |\n| :non-potable_water:               | `:non-potable_water:`               |\n| :no_bicycles:                     | `:no_bicycles:`                     |\n| :no_pedestrians:                  | `:no_pedestrians:`                  |\n| :children_crossing:               | `:children_crossing:`               |\n| :no_entry:                        | `:no_entry:`                        |\n| :eight_spoked_asterisk:           | `:eight_spoked_asterisk:`           |\n| :sparkle:                         | `:sparkle:`                         |\n| :eight_pointed_black_star:        | `:eight_pointed_black_star:`        |\n| :heart_decoration:                | `:heart_decoration:`                |\n| :vs:                              | `:vs:`                              |\n| :vibration_mode:                  | `:vibration_mode:`                  |\n| :mobile_phone_off:                | `:mobile_phone_off:`                |\n| :chart:                           | `:chart:`                           |\n| :currency_exchange:               | `:currency_exchange:`               |\n| :aries:                           | `:aries:`                           |\n| :taurus:                          | `:taurus:`                          |\n| :gemini:                          | `:gemini:`                          |\n| :cancer:                          | `:cancer:`                          |\n| :leo:                             | `:leo:`                             |\n| :virgo:                           | `:virgo:`                           |\n| :libra:                           | `:libra:`                           |\n| :scorpius:                        | `:scorpius:`                        |\n| :sagittarius:                     | `:sagittarius:`                     |\n| :capricorn:                       | `:capricorn:`                       |\n| :aquarius:                        | `:aquarius:`                        |\n| :pisces:                          | `:pisces:`                          |\n| :ophiuchus:                       | `:ophiuchus:`                       |\n| :six_pointed_star:                | `:six_pointed_star:`                |\n| :negative_squared_cross_mark:     | `:negative_squared_cross_mark:`     |\n| :a:                               | `:a:`                               |\n| :b:                               | `:b:`                               |\n| :ab:                              | `:ab:`                              |\n| :o2:                              | `:o2:`                              |\n| :diamond_shape_with_a_dot_inside: | `:diamond_shape_with_a_dot_inside:` |\n| :recycle:                         | `:recycle:`                         |\n| :end:                             | `:end:`                             |\n| :back:                            | `:back:`                            |\n| :on:                              | `:on:`                              |\n| :soon:                            | `:soon:`                            |\n| :clock1:                          | `:clock1:`                          |\n| :clock130:                        | `:clock130:`                        |\n| :clock10:                         | `:clock10:`                         |\n| :clock1030:                       | `:clock1030:`                       |\n| :clock11:                         | `:clock11:`                         |\n| :clock1130:                       | `:clock1130:`                       |\n| :clock12:                         | `:clock12:`                         |\n| :clock1230:                       | `:clock1230:`                       |\n| :clock2:                          | `:clock2:`                          |\n| :clock230:                        | `:clock230:`                        |\n| :clock3:                          | `:clock3:`                          |\n| :clock330:                        | `:clock330:`                        |\n| :clock4:                          | `:clock4:`                          |\n| :clock430:                        | `:clock430:`                        |\n| :clock5:                          | `:clock5:`                          |\n| :clock530:                        | `:clock530:`                        |\n| :clock6:                          | `:clock6:`                          |\n| :clock630:                        | `:clock630:`                        |\n| :clock7:                          | `:clock7:`                          |\n| :clock730:                        | `:clock730:`                        |\n| :clock8:                          | `:clock8:`                          |\n| :clock830:                        | `:clock830:`                        |\n| :clock9:                          | `:clock9:`                          |\n| :clock930:                        | `:clock930:`                        |\n| :heavy_dollar_sign:               | `:heavy_dollar_sign:`               |\n| :copyright:                       | `:copyright:`                       |\n| :registered:                      | `:registered:`                      |\n| :tm:                              | `:tm:`                              |\n| :x:                               | `:x:`                               |\n| :heavy_exclamation_mark:          | `:heavy_exclamation_mark:`          |\n| :bangbang:                        | `:bangbang:`                        |\n| :interrobang:                     | `:interrobang:`                     |\n| :o:                               | `:o:`                               |\n| :heavy_multiplication_x:          | `:heavy_multiplication_x:`          |\n| :heavy_plus_sign:                 | `:heavy_plus_sign:`                 |\n| :heavy_minus_sign:                | `:heavy_minus_sign:`                |\n| :heavy_division_sign:             | `:heavy_division_sign:`             |\n| :white_flower:                    | `:white_flower:`                    |\n| :100:                             | `:100:`                             |\n| :heavy_check_mark:                | `:heavy_check_mark:`                |\n| :ballot_box_with_check:           | `:ballot_box_with_check:`           |\n| :radio_button:                    | `:radio_button:`                    |\n| :link:                            | `:link:`                            |\n| :curly_loop:                      | `:curly_loop:`                      |\n| :wavy_dash:                       | `:wavy_dash:`                       |\n| :part_alternation_mark:           | `:part_alternation_mark:`           |\n| :trident:                         | `:trident:`                         |\n| :black_small_square:              | `:black_small_square:`              |\n| :white_small_square:              | `:white_small_square:`              |\n| :black_medium_small_square:       | `:black_medium_small_square:`       |\n| :white_medium_small_square:       | `:white_medium_small_square:`       |\n| :black_medium_square:             | `:black_medium_square:`             |\n| :white_medium_square:             | `:white_medium_square:`             |\n| :black_large_square:              | `:black_large_square:`              |\n| :white_large_square:              | `:white_large_square:`              |\n| :white_check_mark:                | `:white_check_mark:`                |\n| :black_square_button:             | `:black_square_button:`             |\n| :white_square_button:             | `:white_square_button:`             |\n| :black_circle:                    | `:black_circle:`                    |\n| :white_circle:                    | `:white_circle:`                    |\n| :red_circle:                      | `:red_circle:`                      |\n| :large_blue_circle:               | `:large_blue_circle:`               |\n| :large_blue_diamond:              | `:large_blue_diamond:`              |\n| :large_orange_diamond:            | `:large_orange_diamond:`            |\n| :small_blue_diamond:              | `:small_blue_diamond:`              |\n| :small_orange_diamond:            | `:small_orange_diamond:`            |\n| :small_red_triangle:              | `:small_red_triangle:`              |\n| :small_red_triangle_down:         | `:small_red_triangle_down:`         |\n\n### Objects {.row-span-2}\n\n| -                                | -                                  |\n| -------------------------------- | ---------------------------------- |\n| :bamboo:                         | `:bamboo:`                         |\n| :gift_heart:                     | `:gift_heart:`                     |\n| :dolls:                          | `:dolls:`                          |\n| :school_satchel:                 | `:school_satchel:`                 |\n| :mortar_board:                   | `:mortar_board:`                   |\n| :flags:                          | `:flags:`                          |\n| :fireworks:                      | `:fireworks:`                      |\n| :sparkler:                       | `:sparkler:`                       |\n| :wind_chime:                     | `:wind_chime:`                     |\n| :rice_scene:                     | `:rice_scene:`                     |\n| :jack_o_lantern:                 | `:jack_o_lantern:`                 |\n| :ghost:                          | `:ghost:`                          |\n| :santa:                          | `:santa:`                          |\n| :christmas_tree:                 | `:christmas_tree:`                 |\n| :gift:                           | `:gift:`                           |\n| :bell:                           | `:bell:`                           |\n| :no_bell:                        | `:no_bell:`                        |\n| :tanabata_tree:                  | `:tanabata_tree:`                  |\n| :tada:                           | `:tada:`                           |\n| :confetti_ball:                  | `:confetti_ball:`                  |\n| :balloon:                        | `:balloon:`                        |\n| :crystal_ball:                   | `:crystal_ball:`                   |\n| :cd:                             | `:cd:`                             |\n| :dvd:                            | `:dvd:`                            |\n| :floppy_disk:                    | `:floppy_disk:`                    |\n| :camera:                         | `:camera:`                         |\n| :video_camera:                   | `:video_camera:`                   |\n| :movie_camera:                   | `:movie_camera:`                   |\n| :computer:                       | `:computer:`                       |\n| :tv:                             | `:tv:`                             |\n| :iphone:                         | `:iphone:`                         |\n| :phone:                          | `:phone:`                          |\n| :telephone:                      | `:telephone:`                      |\n| :telephone_receiver:             | `:telephone_receiver:`             |\n| :pager:                          | `:pager:`                          |\n| :fax:                            | `:fax:`                            |\n| :minidisc:                       | `:minidisc:`                       |\n| :vhs:                            | `:vhs:`                            |\n| :sound:                          | `:sound:`                          |\n| :speaker:                        | `:speaker:`                        |\n| :mute:                           | `:mute:`                           |\n| :loudspeaker:                    | `:loudspeaker:`                    |\n| :mega:                           | `:mega:`                           |\n| :hourglass:                      | `:hourglass:`                      |\n| :hourglass_flowing_sand:         | `:hourglass_flowing_sand:`         |\n| :alarm_clock:                    | `:alarm_clock:`                    |\n| :watch:                          | `:watch:`                          |\n| :radio:                          | `:radio:`                          |\n| :satellite:                      | `:satellite:`                      |\n| :loop:                           | `:loop:`                           |\n| :mag:                            | `:mag:`                            |\n| :mag_right:                      | `:mag_right:`                      |\n| :unlock:                         | `:unlock:`                         |\n| :lock:                           | `:lock:`                           |\n| :lock_with_ink_pen:              | `:lock_with_ink_pen:`              |\n| :closed_lock_with_key:           | `:closed_lock_with_key:`           |\n| :key:                            | `:key:`                            |\n| :bulb:                           | `:bulb:`                           |\n| :flashlight:                     | `:flashlight:`                     |\n| :high_brightness:                | `:high_brightness:`                |\n| :low_brightness:                 | `:low_brightness:`                 |\n| :electric_plug:                  | `:electric_plug:`                  |\n| :battery:                        | `:battery:`                        |\n| :calling:                        | `:calling:`                        |\n| :email:                          | `:email:`                          |\n| :mailbox:                        | `:mailbox:`                        |\n| :postbox:                        | `:postbox:`                        |\n| :bath:                           | `:bath:`                           |\n| :bathtub:                        | `:bathtub:`                        |\n| :shower:                         | `:shower:`                         |\n| :toilet:                         | `:toilet:`                         |\n| :wrench:                         | `:wrench:`                         |\n| :nut_and_bolt:                   | `:nut_and_bolt:`                   |\n| :hammer:                         | `:hammer:`                         |\n| :seat:                           | `:seat:`                           |\n| :moneybag:                       | `:moneybag:`                       |\n| :yen:                            | `:yen:`                            |\n| :dollar:                         | `:dollar:`                         |\n| :pound:                          | `:pound:`                          |\n| :euro:                           | `:euro:`                           |\n| :credit_card:                    | `:credit_card:`                    |\n| :money_with_wings:               | `:money_with_wings:`               |\n| :e-mail:                         | `:e-mail:`                         |\n| :inbox_tray:                     | `:inbox_tray:`                     |\n| :outbox_tray:                    | `:outbox_tray:`                    |\n| :envelope:                       | `:envelope:`                       |\n| :incoming_envelope:              | `:incoming_envelope:`              |\n| :postal_horn:                    | `:postal_horn:`                    |\n| :mailbox_closed:                 | `:mailbox_closed:`                 |\n| :mailbox_with_mail:              | `:mailbox_with_mail:`              |\n| :mailbox_with_no_mail:           | `:mailbox_with_no_mail:`           |\n| :package:                        | `:package:`                        |\n| :door:                           | `:door:`                           |\n| :smoking:                        | `:smoking:`                        |\n| :bomb:                           | `:bomb:`                           |\n| :gun:                            | `:gun:`                            |\n| :hocho:                          | `:hocho:`                          |\n| :pill:                           | `:pill:`                           |\n| :syringe:                        | `:syringe:`                        |\n| :page_facing_up:                 | `:page_facing_up:`                 |\n| :page_with_curl:                 | `:page_with_curl:`                 |\n| :bookmark_tabs:                  | `:bookmark_tabs:`                  |\n| :bar_chart:                      | `:bar_chart:`                      |\n| :chart_with_upwards_trend:       | `:chart_with_upwards_trend:`       |\n| :chart_with_downwards_trend:     | `:chart_with_downwards_trend:`     |\n| :scroll:                         | `:scroll:`                         |\n| :clipboard:                      | `:clipboard:`                      |\n| :calendar:                       | `:calendar:`                       |\n| :date:                           | `:date:`                           |\n| :card_index:                     | `:card_index:`                     |\n| :file_folder:                    | `:file_folder:`                    |\n| :open_file_folder:               | `:open_file_folder:`               |\n| :scissors:                       | `:scissors:`                       |\n| :pushpin:                        | `:pushpin:`                        |\n| :paperclip:                      | `:paperclip:`                      |\n| :black_nib:                      | `:black_nib:`                      |\n| :pencil2:                        | `:pencil2:`                        |\n| :straight_ruler:                 | `:straight_ruler:`                 |\n| :triangular_ruler:               | `:triangular_ruler:`               |\n| :closed_book:                    | `:closed_book:`                    |\n| :green_book:                     | `:green_book:`                     |\n| :blue_book:                      | `:blue_book:`                      |\n| :orange_book:                    | `:orange_book:`                    |\n| :notebook:                       | `:notebook:`                       |\n| :notebook_with_decorative_cover: | `:notebook_with_decorative_cover:` |\n| :ledger:                         | `:ledger:`                         |\n| :books:                          | `:books:`                          |\n| :bookmark:                       | `:bookmark:`                       |\n| :name_badge:                     | `:name_badge:`                     |\n| :microscope:                     | `:microscope:`                     |\n| :telescope:                      | `:telescope:`                      |\n| :newspaper:                      | `:newspaper:`                      |\n| :football:                       | `:football:`                       |\n| :basketball:                     | `:basketball:`                     |\n| :soccer:                         | `:soccer:`                         |\n| :baseball:                       | `:baseball:`                       |\n| :tennis:                         | `:tennis:`                         |\n| :8ball:                          | `:8ball:`                          |\n| :rugby_football:                 | `:rugby_football:`                 |\n| :bowling:                        | `:bowling:`                        |\n| :golf:                           | `:golf:`                           |\n| :mountain_bicyclist:             | `:mountain_bicyclist:`             |\n| :bicyclist:                      | `:bicyclist:`                      |\n| :horse_racing:                   | `:horse_racing:`                   |\n| :snowboarder:                    | `:snowboarder:`                    |\n| :swimmer:                        | `:swimmer:`                        |\n| :surfer:                         | `:surfer:`                         |\n| :ski:                            | `:ski:`                            |\n| :spades:                         | `:spades:`                         |\n| :hearts:                         | `:hearts:`                         |\n| :clubs:                          | `:clubs:`                          |\n| :diamonds:                       | `:diamonds:`                       |\n| :gem:                            | `:gem:`                            |\n| :ring:                           | `:ring:`                           |\n| :trophy:                         | `:trophy:`                         |\n| :musical_score:                  | `:musical_score:`                  |\n| :musical_keyboard:               | `:musical_keyboard:`               |\n| :violin:                         | `:violin:`                         |\n| :space_invader:                  | `:space_invader:`                  |\n| :video_game:                     | `:video_game:`                     |\n| :black_joker:                    | `:black_joker:`                    |\n| :flower_playing_cards:           | `:flower_playing_cards:`           |\n| :game_die:                       | `:game_die:`                       |\n| :dart:                           | `:dart:`                           |\n| :mahjong:                        | `:mahjong:`                        |\n| :clapper:                        | `:clapper:`                        |\n| :memo:                           | `:memo:`                           |\n| :pencil:                         | `:pencil:`                         |\n| :book:                           | `:book:`                           |\n| :art:                            | `:art:`                            |\n| :microphone:                     | `:microphone:`                     |\n| :headphones:                     | `:headphones:`                     |\n| :trumpet:                        | `:trumpet:`                        |\n| :saxophone:                      | `:saxophone:`                      |\n| :guitar:                         | `:guitar:`                         |\n| :shoe:                           | `:shoe:`                           |\n| :sandal:                         | `:sandal:`                         |\n| :high_heel:                      | `:high_heel:`                      |\n| :lipstick:                       | `:lipstick:`                       |\n| :boot:                           | `:boot:`                           |\n| :shirt:                          | `:shirt:`                          |\n| :tshirt:                         | `:tshirt:`                         |\n| :necktie:                        | `:necktie:`                        |\n| :womans_clothes:                 | `:womans_clothes:`                 |\n| :dress:                          | `:dress:`                          |\n| :running_shirt_with_sash:        | `:running_shirt_with_sash:`        |\n| :jeans:                          | `:jeans:`                          |\n| :kimono:                         | `:kimono:`                         |\n| :bikini:                         | `:bikini:`                         |\n| :ribbon:                         | `:ribbon:`                         |\n| :tophat:                         | `:tophat:`                         |\n| :crown:                          | `:crown:`                          |\n| :womans_hat:                     | `:womans_hat:`                     |\n| :mans_shoe:                      | `:mans_shoe:`                      |\n| :closed_umbrella:                | `:closed_umbrella:`                |\n| :briefcase:                      | `:briefcase:`                      |\n| :handbag:                        | `:handbag:`                        |\n| :pouch:                          | `:pouch:`                          |\n| :purse:                          | `:purse:`                          |\n| :eyeglasses:                     | `:eyeglasses:`                     |\n| :fishing_pole_and_fish:          | `:fishing_pole_and_fish:`          |\n| :coffee:                         | `:coffee:`                         |\n| :tea:                            | `:tea:`                            |\n| :sake:                           | `:sake:`                           |\n| :baby_bottle:                    | `:baby_bottle:`                    |\n| :beer:                           | `:beer:`                           |\n| :beers:                          | `:beers:`                          |\n| :cocktail:                       | `:cocktail:`                       |\n| :tropical_drink:                 | `:tropical_drink:`                 |\n| :wine_glass:                     | `:wine_glass:`                     |\n| :fork_and_knife:                 | `:fork_and_knife:`                 |\n| :pizza:                          | `:pizza:`                          |\n| :hamburger:                      | `:hamburger:`                      |\n| :fries:                          | `:fries:`                          |\n| :poultry_leg:                    | `:poultry_leg:`                    |\n| :meat_on_bone:                   | `:meat_on_bone:`                   |\n| :spaghetti:                      | `:spaghetti:`                      |\n| :curry:                          | `:curry:`                          |\n| :fried_shrimp:                   | `:fried_shrimp:`                   |\n| :bento:                          | `:bento:`                          |\n| :sushi:                          | `:sushi:`                          |\n| :fish_cake:                      | `:fish_cake:`                      |\n| :rice_ball:                      | `:rice_ball:`                      |\n| :rice_cracker:                   | `:rice_cracker:`                   |\n| :rice:                           | `:rice:`                           |\n| :ramen:                          | `:ramen:`                          |\n| :stew:                           | `:stew:`                           |\n| :oden:                           | `:oden:`                           |\n| :dango:                          | `:dango:`                          |\n| :egg:                            | `:egg:`                            |\n| :bread:                          | `:bread:`                          |\n| :doughnut:                       | `:doughnut:`                       |\n| :custard:                        | `:custard:`                        |\n| :icecream:                       | `:icecream:`                       |\n| :ice_cream:                      | `:ice_cream:`                      |\n| :shaved_ice:                     | `:shaved_ice:`                     |\n| :birthday:                       | `:birthday:`                       |\n| :cake:                           | `:cake:`                           |\n| :cookie:                         | `:cookie:`                         |\n| :chocolate_bar:                  | `:chocolate_bar:`                  |\n| :candy:                          | `:candy:`                          |\n| :lollipop:                       | `:lollipop:`                       |\n| :honey_pot:                      | `:honey_pot:`                      |\n| :apple:                          | `:apple:`                          |\n| :green_apple:                    | `:green_apple:`                    |\n| :tangerine:                      | `:tangerine:`                      |\n| :lemon:                          | `:lemon:`                          |\n| :cherries:                       | `:cherries:`                       |\n| :grapes:                         | `:grapes:`                         |\n| :watermelon:                     | `:watermelon:`                     |\n| :strawberry:                     | `:strawberry:`                     |\n| :peach:                          | `:peach:`                          |\n| :melon:                          | `:melon:`                          |\n| :banana:                         | `:banana:`                         |\n| :pear:                           | `:pear:`                           |\n| :pineapple:                      | `:pineapple:`                      |\n| :sweet_potato:                   | `:sweet_potato:`                   |\n| :eggplant:                       | `:eggplant:`                       |\n| :tomato:                         | `:tomato:`                         |\n| :corn:                           | `:corn:`                           |\n\n### Places\n\n| -                         | -                           |\n| ------------------------- | --------------------------- |\n| :house:                   | `:house:`                   |\n| :house_with_garden:       | `:house_with_garden:`       |\n| :school:                  | `:school:`                  |\n| :office:                  | `:office:`                  |\n| :post_office:             | `:post_office:`             |\n| :hospital:                | `:hospital:`                |\n| :bank:                    | `:bank:`                    |\n| :convenience_store:       | `:convenience_store:`       |\n| :love_hotel:              | `:love_hotel:`              |\n| :hotel:                   | `:hotel:`                   |\n| :wedding:                 | `:wedding:`                 |\n| :church:                  | `:church:`                  |\n| :department_store:        | `:department_store:`        |\n| :european_post_office:    | `:european_post_office:`    |\n| :city_sunrise:            | `:city_sunrise:`            |\n| :city_sunset:             | `:city_sunset:`             |\n| :japanese_castle:         | `:japanese_castle:`         |\n| :european_castle:         | `:european_castle:`         |\n| :tent:                    | `:tent:`                    |\n| :factory:                 | `:factory:`                 |\n| :tokyo_tower:             | `:tokyo_tower:`             |\n| :japan:                   | `:japan:`                   |\n| :mount_fuji:              | `:mount_fuji:`              |\n| :sunrise_over_mountains:  | `:sunrise_over_mountains:`  |\n| :sunrise:                 | `:sunrise:`                 |\n| :stars:                   | `:stars:`                   |\n| :statue_of_liberty:       | `:statue_of_liberty:`       |\n| :bridge_at_night:         | `:bridge_at_night:`         |\n| :carousel_horse:          | `:carousel_horse:`          |\n| :rainbow:                 | `:rainbow:`                 |\n| :ferris_wheel:            | `:ferris_wheel:`            |\n| :fountain:                | `:fountain:`                |\n| :roller_coaster:          | `:roller_coaster:`          |\n| :ship:                    | `:ship:`                    |\n| :speedboat:               | `:speedboat:`               |\n| :boat:                    | `:boat:`                    |\n| :sailboat:                | `:sailboat:`                |\n| :rowboat:                 | `:rowboat:`                 |\n| :anchor:                  | `:anchor:`                  |\n| :rocket:                  | `:rocket:`                  |\n| :airplane:                | `:airplane:`                |\n| :helicopter:              | `:helicopter:`              |\n| :steam_locomotive:        | `:steam_locomotive:`        |\n| :tram:                    | `:tram:`                    |\n| :mountain_railway:        | `:mountain_railway:`        |\n| :bike:                    | `:bike:`                    |\n| :aerial_tramway:          | `:aerial_tramway:`          |\n| :suspension_railway:      | `:suspension_railway:`      |\n| :mountain_cableway:       | `:mountain_cableway:`       |\n| :tractor:                 | `:tractor:`                 |\n| :blue_car:                | `:blue_car:`                |\n| :oncoming_automobile:     | `:oncoming_automobile:`     |\n| :car:                     | `:car:`                     |\n| :red_car:                 | `:red_car:`                 |\n| :taxi:                    | `:taxi:`                    |\n| :oncoming_taxi:           | `:oncoming_taxi:`           |\n| :articulated_lorry:       | `:articulated_lorry:`       |\n| :bus:                     | `:bus:`                     |\n| :oncoming_bus:            | `:oncoming_bus:`            |\n| :rotating_light:          | `:rotating_light:`          |\n| :police_car:              | `:police_car:`              |\n| :oncoming_police_car:     | `:oncoming_police_car:`     |\n| :fire_engine:             | `:fire_engine:`             |\n| :ambulance:               | `:ambulance:`               |\n| :minibus:                 | `:minibus:`                 |\n| :truck:                   | `:truck:`                   |\n| :train:                   | `:train:`                   |\n| :station:                 | `:station:`                 |\n| :train2:                  | `:train2:`                  |\n| :bullettrain_front:       | `:bullettrain_front:`       |\n| :bullettrain_side:        | `:bullettrain_side:`        |\n| :light_rail:              | `:light_rail:`              |\n| :monorail:                | `:monorail:`                |\n| :railway_car:             | `:railway_car:`             |\n| :trolleybus:              | `:trolleybus:`              |\n| :ticket:                  | `:ticket:`                  |\n| :fuelpump:                | `:fuelpump:`                |\n| :vertical_traffic_light:  | `:vertical_traffic_light:`  |\n| :traffic_light:           | `:traffic_light:`           |\n| :warning:                 | `:warning:`                 |\n| :construction:            | `:construction:`            |\n| :beginner:                | `:beginner:`                |\n| :atm:                     | `:atm:`                     |\n| :slot_machine:            | `:slot_machine:`            |\n| :busstop:                 | `:busstop:`                 |\n| :barber:                  | `:barber:`                  |\n| :hotsprings:              | `:hotsprings:`              |\n| :checkered_flag:          | `:checkered_flag:`          |\n| :crossed_flags:           | `:crossed_flags:`           |\n| :izakaya_lantern:         | `:izakaya_lantern:`         |\n| :moyai:                   | `:moyai:`                   |\n| :circus_tent:             | `:circus_tent:`             |\n| :performing_arts:         | `:performing_arts:`         |\n| :round_pushpin:           | `:round_pushpin:`           |\n| :triangular_flag_on_post: | `:triangular_flag_on_post:` |\n| :jp:                      | `:jp:`                      |\n| :kr:                      | `:kr:`                      |\n| :cn:                      | `:cn:`                      |\n| :us:                      | `:us:`                      |\n| :fr:                      | `:fr:`                      |\n| :es:                      | `:es:`                      |\n| :it:                      | `:it:`                      |\n| :ru:                      | `:ru:`                      |\n| :gb:                      | `:gb:`                      |\n| :uk:                      | `:uk:`                      |\n| :de:                      | `:de:`                      |\n\n### Nature\n\n| -                              | -                                |\n| ------------------------------ | -------------------------------- |\n| :sunny:                        | `:sunny:`                        |\n| :umbrella:                     | `:umbrella:`                     |\n| :cloud:                        | `:cloud:`                        |\n| :snowflake:                    | `:snowflake:`                    |\n| :snowman:                      | `:snowman:`                      |\n| :zap:                          | `:zap:`                          |\n| :cyclone:                      | `:cyclone:`                      |\n| :foggy:                        | `:foggy:`                        |\n| :ocean:                        | `:ocean:`                        |\n| :cat:                          | `:cat:`                          |\n| :dog:                          | `:dog:`                          |\n| :mouse:                        | `:mouse:`                        |\n| :hamster:                      | `:hamster:`                      |\n| :rabbit:                       | `:rabbit:`                       |\n| :wolf:                         | `:wolf:`                         |\n| :frog:                         | `:frog:`                         |\n| :tiger:                        | `:tiger:`                        |\n| :koala:                        | `:koala:`                        |\n| :bear:                         | `:bear:`                         |\n| :pig:                          | `:pig:`                          |\n| :pig_nose:                     | `:pig_nose:`                     |\n| :cow:                          | `:cow:`                          |\n| :boar:                         | `:boar:`                         |\n| :monkey_face:                  | `:monkey_face:`                  |\n| :monkey:                       | `:monkey:`                       |\n| :horse:                        | `:horse:`                        |\n| :racehorse:                    | `:racehorse:`                    |\n| :camel:                        | `:camel:`                        |\n| :sheep:                        | `:sheep:`                        |\n| :elephant:                     | `:elephant:`                     |\n| :panda_face:                   | `:panda_face:`                   |\n| :snake:                        | `:snake:`                        |\n| :bird:                         | `:bird:`                         |\n| :baby_chick:                   | `:baby_chick:`                   |\n| :hatched_chick:                | `:hatched_chick:`                |\n| :hatching_chick:               | `:hatching_chick:`               |\n| :chicken:                      | `:chicken:`                      |\n| :penguin:                      | `:penguin:`                      |\n| :turtle:                       | `:turtle:`                       |\n| :bug:                          | `:bug:`                          |\n| :honeybee:                     | `:honeybee:`                     |\n| :ant:                          | `:ant:`                          |\n| :beetle:                       | `:beetle:`                       |\n| :snail:                        | `:snail:`                        |\n| :octopus:                      | `:octopus:`                      |\n| :tropical_fish:                | `:tropical_fish:`                |\n| :fish:                         | `:fish:`                         |\n| :whale:                        | `:whale:`                        |\n| :whale2:                       | `:whale2:`                       |\n| :dolphin:                      | `:dolphin:`                      |\n| :cow2:                         | `:cow2:`                         |\n| :ram:                          | `:ram:`                          |\n| :rat:                          | `:rat:`                          |\n| :water_buffalo:                | `:water_buffalo:`                |\n| :tiger2:                       | `:tiger2:`                       |\n| :rabbit2:                      | `:rabbit2:`                      |\n| :dragon:                       | `:dragon:`                       |\n| :goat:                         | `:goat:`                         |\n| :rooster:                      | `:rooster:`                      |\n| :dog2:                         | `:dog2:`                         |\n| :pig2:                         | `:pig2:`                         |\n| :mouse2:                       | `:mouse2:`                       |\n| :ox:                           | `:ox:`                           |\n| :dragon_face:                  | `:dragon_face:`                  |\n| :blowfish:                     | `:blowfish:`                     |\n| :crocodile:                    | `:crocodile:`                    |\n| :dromedary_camel:              | `:dromedary_camel:`              |\n| :leopard:                      | `:leopard:`                      |\n| :cat2:                         | `:cat2:`                         |\n| :poodle:                       | `:poodle:`                       |\n| :paw_prints:                   | `:paw_prints:`                   |\n| :bouquet:                      | `:bouquet:`                      |\n| :cherry_blossom:               | `:cherry_blossom:`               |\n| :tulip:                        | `:tulip:`                        |\n| :four_leaf_clover:             | `:four_leaf_clover:`             |\n| :rose:                         | `:rose:`                         |\n| :sunflower:                    | `:sunflower:`                    |\n| :hibiscus:                     | `:hibiscus:`                     |\n| :maple_leaf:                   | `:maple_leaf:`                   |\n| :leaves:                       | `:leaves:`                       |\n| :fallen_leaf:                  | `:fallen_leaf:`                  |\n| :herb:                         | `:herb:`                         |\n| :mushroom:                     | `:mushroom:`                     |\n| :cactus:                       | `:cactus:`                       |\n| :palm_tree:                    | `:palm_tree:`                    |\n| :evergreen_tree:               | `:evergreen_tree:`               |\n| :deciduous_tree:               | `:deciduous_tree:`               |\n| :chestnut:                     | `:chestnut:`                     |\n| :seedling:                     | `:seedling:`                     |\n| :blossom:                      | `:blossom:`                      |\n| :ear_of_rice:                  | `:ear_of_rice:`                  |\n| :shell:                        | `:shell:`                        |\n| :globe_with_meridians:         | `:globe_with_meridians:`         |\n| :sun_with_face:                | `:sun_with_face:`                |\n| :full_moon_with_face:          | `:full_moon_with_face:`          |\n| :new_moon_with_face:           | `:new_moon_with_face:`           |\n| :new_moon:                     | `:new_moon:`                     |\n| :waxing_crescent_moon:         | `:waxing_crescent_moon:`         |\n| :first_quarter_moon:           | `:first_quarter_moon:`           |\n| :waxing_gibbous_moon:          | `:waxing_gibbous_moon:`          |\n| :full_moon:                    | `:full_moon:`                    |\n| :waning_gibbous_moon:          | `:waning_gibbous_moon:`          |\n| :last_quarter_moon:            | `:last_quarter_moon:`            |\n| :waning_crescent_moon:         | `:waning_crescent_moon:`         |\n| :last_quarter_moon_with_face:  | `:last_quarter_moon_with_face:`  |\n| :first_quarter_moon_with_face: | `:first_quarter_moon_with_face:` |\n| :crescent_moon:                | `:crescent_moon:`                |\n| :earth_africa:                 | `:earth_africa:`                 |\n| :earth_americas:               | `:earth_americas:`               |\n| :earth_asia:                   | `:earth_asia:`                   |\n| :volcano:                      | `:volcano:`                      |\n| :milky_way:                    | `:milky_way:`                    |\n| :partly_sunny:                 | `:partly_sunny:`                 |\n| :carrot:                       | `:carrot:`                       |\n"
  },
  {
    "path": "source/_posts/es6.md",
    "content": "---\ntitle: ES6\ndate: 2023-01-08 18:26:55\nbackground: bg-[#edc545]\ntags:\n  - config\n  - format\ncategories:\n  - Programming\nintro: |\n  A quick reference cheatsheet of what's new in JavaScript for ES2015, ES2016, ES2017, ES2018 and beyond\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### Block-scoped {.row-span-2}\n\n#### Let\n\n```js{2,4}\nfunction fn () {\n  let x = 0\n  if (true) {\n    let x = 1 // only inside this `if`\n  }\n}\n```\n\n#### Const\n\n```js\nconst a = 1;\n```\n\n`let` is the new `var`. Constants (`const`) work just like `let`, but cannot be reassigned. See:\n[Let and const](https://babeljs.io/learn-es2015/#let--const)\n\n### Template Strings {.row-span-2}\n\n#### Interpolation\n\n```js\nconst message = `Hello ${name}`;\n```\n\n#### Multi-line string\n\n```js\nconst str = `\nhello\nthe world\n`;\n```\n\nTemplates and multiline strings. See: [template strings](https://babeljs.io/learn-es2015/#template-strings)\n\n### Binary and octal literals\n\n```js\nlet bin = 0b1010010;\nlet oct = 0o755;\n```\n\nSee: [Binary and Octal Literals](https://babeljs.io/learn-es2015/#binary-and-octal-literals)\n\n### Exponential Operator\n\n```js {1}\nconst byte = 2 ** 8;\n```\n\nSame as: Math.pow(2, 8)\n\n### New library additions\n\n#### New string methods\n\n```js\n'hello'.repeat(3);\n'hello'.includes('ll');\n'hello'.startsWith('he');\n'hello'.padStart(8); // \"hello\"\n'hello'.padEnd(8); // \"hello\"\n'hello'.padEnd(8, '!'); // hello!!!\n'\\u1E9B\\u0323'.normalize('NFC');\n```\n\n#### New Number Methods\n\n```js\nNumber.EPSILON;\nNumber.isInteger(Infinity); // false\nNumber.isNaN('NaN'); // false\n```\n\n#### New Math methods\n\n```js\nMath.acosh(3); // 1.762747174039086\nMath.hypot(3, 4); // 5\nMath.imul(Math.pow(2, 32) - 1, Math.pow(2, 32) - 2); // 2\n```\n\n#### New Array methods\n\n```js\n//return a real array\nArray.from(document.querySelectorAll('*'));\n//similar to new Array(...), but without the special single-argument behavior\nArray.of(1, 2, 3);\n```\n\nSee: [New library additions](https://babeljs.io/learn-es2015/#math--number--string--object-apis)\n\n### kind\n\n```js\nclass Circle extends Shape {\n```\n\n#### Constructor\n\n```js {1}\nconstructor (radius) {\n  this.radius = radius\n}\n```\n\n#### method\n\n```js {1}\ngetArea () {\n  return Math.PI *2 *this.radius\n}\n```\n\n#### Call the superclass method\n\n```js {2}\nexpand(n) {\n  return super.expand(n) *Math.PI\n}\n```\n\n#### Static methods\n\n```js {1}\nstatic createFromDiameter(diameter) {\n  return new Circle(diameter /2)\n}\n```\n\nSyntactic sugar for prototypes. See: [classes](https://babeljs.io/learn-es2015/#classes)\n\n### Private class\n\nThe javascript default field is public (`public`), if you need to indicate private, you can use (`#`)\n\n```js\nclass Dog {\n  #name;\n  constructor(name) {\n    this.#name = name;\n  }\n  printName() {\n    // Only private fields can be called inside the class\n    console.log(`Your name is ${this.#name}`);\n  }\n}\n\nconst dog = new Dog('putty');\n//console.log(this.#name)\n//Private identifiers are not allowed outside class bodies.\ndog.printName();\n```\n\n#### Static private class\n\n```js\nclass ClassWithPrivate {\n  static #privateStaticField;\n  static #privateStaticFieldWithInitializer = 42;\n\n  static #privateStaticMethod() {\n    // …\n  }\n}\n```\n\n## Promises\n\n### make the commitment\n\n```js {1}\nnew Promise((resolve, reject) => {\n  if (ok) {\n    resolve(result);\n  } else {\n    reject(error);\n  }\n});\n```\n\nfor asynchronous programming. See: [Promises](https://babeljs.io/learn-es2015/#promises)\n\n### Using Promises\n\n```js{2,3}\npromise\n  .then((result) => { ··· })\n  .catch((error) => { ··· })\n```\n\n### Using Promises in finally\n\n```js {4}\npromise\n  .then((result) => { ··· })\n  .catch((error) => { ··· })\n  .finally(() => {\n    /*logic independent of success/error */\n  })\n```\n\nThe handler is called when the promise is fulfilled or rejected\n\n### Promise function\n\n```js\nPromise.all(···)\nPromise.race(···)\nPromise.reject(···)\nPromise.resolve(···)\n```\n\n### Async-await\n\n```js{2,3}\nasync function run () {\n  const user = await getUser()\n  const tweets = await getTweets(user)\n  return [user, tweets]\n}\n```\n\n`async` functions are another way to use functions. See:\n[Async Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function)\n\n## Destructuring\n\n### Destructuring assignment\n\n#### Arrays\n\n```js {1}\nconst [first, last] = ['Nikola', 'Tesla'];\n```\n\n#### Objects\n\n```js {1}\nlet { title, author } = {\n  title: 'The Silkworm',\n  author: 'R. Galbraith'\n};\n```\n\nSupports matching arrays and objects. See: [Destructuring](https://babeljs.io/learn-es2015/#destructuring)\n\n### Defaults\n\n```js\nconst scores = [22, 33];\nconst [math = 50, sci = 50, arts = 50] = scores;\n```\n\n---\n\n```js\n//Result:\n//math === 22, sci === 33, arts === 50\n```\n\nA default value can be assigned when destructuring an array or object\n\n### Function parameters\n\n```js {1}\nfunction greet({ name, greeting }) {\n  console.log(`${greeting}, ${name}!`);\n}\n```\n\n---\n\n```js\ngreet({ name: 'Larry', greeting: 'Ahoy' });\n```\n\nDestructuring of objects and arrays can also be done in function parameters\n\n### Defaults\n\n```js {1}\nfunction greet({ name = 'Rauno' } = {}) {\n  console.log(`Hi ${name}!`);\n}\n```\n\n---\n\n```js\ngreet(); // Hi Rauno!\ngreet({ name: 'Larry' }); // Hi Larry!\n```\n\n### Reassign keys\n\n```js {1}\nfunction printCoordinates({ left: x, top: y }) {\n  console.log(`x: ${x}, y: ${y}`);\n}\n```\n\n---\n\n```js\nprintCoordinates({ left: 25, top: 90 });\n```\n\nThis example assigns `x` to the value of the `left` key\n\n### Loop\n\n```js {1}\nfor (let {title, artist} of songs) {\n  ···\n}\n```\n\nAssignment expressions also work in loops\n\n### Object Deconstruction\n\n```js {1}\nconst { id, ...detail } = song;\n```\n\nUse the `rest(...)` operator to extract some keys individually and the rest of the keys in the object\n\n## Spread Operator {.cols-2}\n\n### Object Extensions\n\n#### with object extensions\n\n```js {2}\nconst options = {\n  ...defaults,\n  visible: true\n};\n```\n\n#### No object extension\n\n```js\nconst options = Object.assign({}, defaults, { visible: true });\n```\n\nThe object spread operator allows you to build new objects from other objects. See:\n[Object Spread](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator)\n\n### Array Expansion\n\n#### with array extension\n\n```js{2,3}\nconst users = [\n  ...admins,\n  ...editors,\n  'rstacruz'\n]\n```\n\n#### No array expansion\n\n```js\nconst users = admins.concat(editors).concat(['rstacruz']);\n```\n\nThe spread operator allows you to build new arrays in the same way. See:\n[Spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator)\n\n## Functions\n\n### Function parameters {.row-span-3}\n\n#### Default parameters\n\n```js {1}\nfunction greet(name = 'Jerry') {\n  return `Hello ${name}`;\n}\n```\n\n#### Rest parameters\n\n```js {1}\nfunction fn(x, ...y) {\n  // y is an array\n  return x * y.length;\n}\n```\n\n#### Extensions\n\n```js {1}\nfn(...[1, 2, 3]);\n//same as fn(1, 2, 3)\n```\n\nDefault (default), rest, spread (extension). See:\n[function parameters](https://babeljs.io/learn-es2015/#default--rest--spread)\n\n### Arrow function {.row-span-3}\n\n#### Arrow functions\n\n```js {1}\nsetTimeout(() => {\n  ···\n})\n```\n\n#### with parameters\n\n```js {1}\nreadFile('text.txt', (err, data) => {\n  ...\n})\n```\n\n#### implicit return\n\n```js{1,4,5,6}\narr.map(n => n*2)\n//no curly braces = implicit return\n//Same as: arr.map(function (n) { return n*2 })\narr.map(n => ({\n  result: n*2\n}))\n//Implicitly returning an object requires parentheses around the object\n```\n\nLike a function, but preserves `this`. See: [Arrow functions](https://babeljs.io/learn-es2015/#arrows-and-lexical-this)\n\n### Parameter setting default value\n\n```js\nfunction log(x, y = 'World') {\n  console.log(x, y);\n}\n\nlog('Hello'); // Hello World\nlog('Hello', 'China'); // Hello China\nlog('Hello', ''); // Hello\n```\n\n### Used in conjunction with destructuring assignment defaults\n\n```js\nfunction foo({ x, y = 5 } = {}) {\n  console.log(x, y);\n}\n\nfoo(); // undefined 5\n```\n\n### name attribute\n\n```js\nfunction foo() {}\nfoo.name; // \"foo\"\n```\n\n### length property\n\n```js\nfunction foo(a, b) {}\nfoo.length; // 2\n```\n\n## Objects\n\n### Shorthand Syntax\n\n```js\nmodule.exports = { hello, bye };\n```\n\nsame below:\n\n```js\nmodule.exports = {\n  hello: hello,\n  bye: bye\n};\n```\n\nSee: [Object Literals Enhanced](https://babeljs.io/learn-es2015/#enhanced-object-literals)\n\n### method\n\n```js {2}\nconst App = {\n  start() {\n    console.log('running');\n  }\n};\n//Same as: App = { start: function () {···} }\n```\n\nSee: [Object Literals Enhanced](https://babeljs.io/learn-es2015/#enhanced-object-literals)\n\n### Getters and setters\n\n```js{2,5}\nconst App = {\n  get closed () {\n    return this.status === 'closed'\n  },\n  set closed (value) {\n    this.status = value ? 'closed' : 'open'\n  }\n}\n```\n\nSee: [Object Literals Enhanced](https://babeljs.io/learn-es2015/#enhanced-object-literals)\n\n### Computed property name\n\n```js {3}\nlet event = 'click';\nlet handlers = {\n  [`on${event}`]: true\n};\n//Same as: handlers = { 'onclick': true }\n```\n\nSee: [Object Literals Enhanced](https://babeljs.io/learn-es2015/#enhanced-object-literals)\n\n### Extract value\n\n```js{3,5}\nconst fatherJS = { age: 57, name: \"Zhang San\" }\nObject.values(fatherJS)\n//[57, \"Zhang San\"]\nObject.entries(fatherJS)\n//[[\"age\", 57], [\"name\", \"Zhang San\"]]\n```\n\n## Modules module\n\n### Imports import\n\n```js\nimport 'helpers';\n//aka: require('···')\n```\n\n---\n\n```js\nimport Express from 'express';\n//aka: const Express = require('···').default || require('···')\n```\n\n---\n\n```js\nimport { indent } from 'helpers';\n//aka: const indent = require('···').indent\n```\n\n---\n\n```js\nimport * as Helpers from 'helpers';\n//aka: const Helpers = require('···')\n```\n\n---\n\n```js\nimport { indentSpaces as indent } from 'helpers';\n//aka: const indent = require('···').indentSpaces\n```\n\n`import` is the new `require()`. See: [Module imports](https://babeljs.io/learn-es2015/#modules)\n\n### Exports export\n\n```js\nexport default function () { ··· }\n//aka: module.exports.default = ···\n```\n\n---\n\n```js\nexport function mymethod () { ··· }\n//aka: module.exports.mymethod = ···\n```\n\n---\n\n```js\nexport const pi = 3.14159;\n//aka: module.exports.pi = ···\n```\n\n---\n\n```js\nconst firstName = 'Michael';\nconst lastName = 'Jackson';\nconst year = 1958;\nexport { firstName, lastName, year };\n```\n\n---\n\n```js\nexport * from 'lib/math';\n```\n\n`export` is the new `module.exports`. See: [Module exports](https://babeljs.io/learn-es2015/#modules)\n\n### `as` keyword renaming\n\n```js{2,8,12-14}\nimport {\n  lastName as surname // import rename\n} from './profile.js';\n\nfunction v1() { ... }\nfunction v2() { ... }\n\nexport { v1 as default };\n//Equivalent to export default v1;\n\nexport {\n  v1 as streamV1, // export rename\n  v2 as streamV2, // export rename\n  v2 as streamLatestVersion // export rename\n};\n```\n\n### Dynamically load modules\n\n```js\nbutton.addEventListener('click', (event) => {\n  import('./dialogBox.js')\n    .then((dialogBox) => {\n      dialogBox.open();\n    })\n    .catch((error) => {\n      /*Error handling */\n    });\n});\n```\n\n[ES2020 Proposal](https://github.com/tc39/proposal-dynamic-import) introduce `import()` function\n\n### import() allows module paths to be dynamically generated\n\n```js\nconst main = document.querySelector('main');\n\nimport(`./modules/${someVariable}.js`)\n  .then((module) => {\n    module.loadPageInto(main);\n  })\n  .catch((err) => {\n    main.textContent = err.message;\n  });\n```\n\n### import.meta\n\n[ES2020](https://github.com/tc39/proposal-import-meta) Added a meta property `import.meta` to the `import` command,\nwhich returns the meta information of the current module\n\n```js\nnew URL('data.txt', import.meta.url);\n```\n\nIn the Node.js environment, `import.meta.url` always returns a local path, that is, a string of the `file:URL` protocol,\nsuch as `file:/// home/user/foo.js`\n\n### Import Assertions {.col-span-2}\n\n#### static import\n\n```js\nimport json from './package.json' assert { type: 'json' };\n//Import all objects in the json file\n```\n\n#### Dynamic Import\n\n```js\nconst json = await import('./package.json', { assert: { type: 'json' } });\n```\n\n## Generators\n\n### Generator function\n\n```js\nfunction* idMaker() {\n  let id = 0;\n  while (true) {\n    yield id++;\n  }\n}\n```\n\n---\n\n```js\nlet gen = idMaker();\ngen.next().value; // → 0\ngen.next().value; // → 1\ngen.next().value; // → 2\n```\n\nit's complicated. See: [Generators](https://babeljs.io/learn-es2015/#generators)\n\n### For..of + iterator {.row-span-2}\n\n```js\nlet fibonacci = {\n  [Symbol.iterator]() {\n    let pre = 0,\n      cur = 1;\n    return {\n      next() {\n        [pre, cur] = [cur, pre + cur];\n        return { done: false, value: cur };\n      }\n    };\n  }\n};\n\nfor (var n of fibonacci) {\n  // truncate sequence at 1000\n  if (n > 1000) break;\n  console.log(n);\n}\n```\n\nFor iterating over generators and arrays. See: [For..of iteration](https://babeljs.io/learn-es2015/#iterators--forof)\n\n### Relationship with Iterator interface\n\n```js\nvar gen = {};\ngen[Symbol.iterator] = function* () {\n  yield 1;\n  yield 2;\n  yield 3;\n};\n\n[...gen]; // => [1, 2, 3]\n```\n\nThe `Generator` function is assigned to the `Symbol.iterator` property, so that the `gen` object has the `Iterator`\ninterface, which can be traversed by the `...` operator\n\n### Symbol.iterator property\n\n```js\nfunction* gen() {\n  /*some code */\n}\nvar g = gen();\n\ng[Symbol.iterator]() === g; // true\n```\n\n`gen` is a `Generator` function, calling it will generate a traverser object `g`. Its `Symbol.iterator` property, which\nis also an iterator object generation function, returns itself after execution\n\n## see also\n\n- [Learn ES2015](https://babeljs.io/docs/en/learn/)_(babeljs.io)_\n- [ECMAScript 6 Features Overview](https://github.com/lukehoban/es6features#readme) _(github.com)_\n"
  },
  {
    "path": "source/_posts/express.md",
    "content": "---\ntitle: Express\ndate: 2023-02-26 15:23:31\nbackground: bg-[#edc545]\ntags:\n  - config\n  - format\ncategories:\n  - Programming\nintro: |\n  A quick reference cheatsheet for Express, a flexible and streamlined web framework for Node.js\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Hello World {.row-span-2}\n\n- \"Create project, add `package.json` configuration\n\n  ```bash\n  $ mkdir myapp # create directory\n  $ cd myapp    # enter the directory\n  $ npm init -y # Initialize a configuration\n  ```\n\n- Install dependencies\n\n  ```bash\n  $ npm install express\n  ```\n\n- Entry file `index.js` add code:\n\n  ```js\n  const express = require('express');\n  const app = express();\n  const port = 3000;\n  app.get('/', (req, res) => {\n    res.send('Hello World!');\n  });\n  app.listen(port, () => {\n    console.log(`Listening port on ${port}`);\n  });\n  ```\n\n- Run the application using the following command\n  ```bash\n  $ node index.js\n  ```\n  {.marker-timeline}\n\n### express -h {.row-span-2}\n\n```bash\nUsage: express [options] [dir]\nOptions:\n  -h, --help output usage information\n      --version output version number\n  -e, --ejs add ejs engine support\n      --hbs add hbs engine support\n      --pug add pug engine support\n  -H, --hogan add hogan.js engine support\n      --no-view No view engine generated\n  -v, --view <engine> add view <engine> support (ejs|hbs|hjs|jade|pug|twig|vash) (default jade)\n  -c, --css <engine> add stylesheet <engine> support (less|stylus|compass|sass) (default css)\n      --git add .gitignore\n  -f, --force force non-empty directories\n```\n\n{.wrap-text}\n\nCreate a `myapp` project\n\n```bash\n$ express --view=pug myapp\n# run the application\n$ DEBUG=myapp:*npm start\n```\n\n### express()\n\n| :-                     | :-                                                          |\n| :--------------------- | :---------------------------------------------------------- |\n| `express.json()`       | [#](http://expressjs.com/en/4x/api.html#express.json)       |\n| `express.raw()`        | [#](http://expressjs.com/en/4x/api.html#express.raw)        |\n| `express.Router()`     | [#](http://expressjs.com/en/4x/api.html#express.router)     |\n| `express.static()`     | [#](http://expressjs.com/en/4x/api.html#express.static)     |\n| `express.text()`       | [#](http://expressjs.com/en/4x/api.html#express.text)       |\n| `express.urlencoded()` | [#](http://expressjs.com/en/4x/api.html#express.urlencoded) |\n\n### Router\n\n| :-                | :-                                                     |\n| :---------------- | :----------------------------------------------------- |\n| `router.all()`    | [#](http://expressjs.com/en/4x/api.html#router.all)    |\n| `router.METHOD()` | [#](http://expressjs.com/en/4x/api.html#router.METHOD) |\n| `router.param()`  | [#](http://expressjs.com/en/4x/api.html#router.param)  |\n| `router.route()`  | [#](http://expressjs.com/en/4x/api.html#router.route)  |\n| `router.use()`    | [#](http://expressjs.com/en/4x/api.html#router.use)    |\n\n### Application\n\n```js\nvar express = require('express');\nvar app = express();\n\nconsole.dir(app.locals.title);\n//=> 'My App'\nconsole.dir(app.locals.email);\n//=> 'me@myapp.com'\n```\n\n#### Attribute\n\n| :-              | :-                                                                                        |\n| :-------------- | :---------------------------------------------------------------------------------------- |\n| `app.locals`    | Local variables in the application [#](http://expressjs.com/en/4x/api.html#app.locals)    |\n| `app.mountpath` | Path pattern for mounting sub-apps [#](http://expressjs.com/en/4x/api.html#app.mountpath) |\n\n#### Events\n\n| :-      | :-                                                                                                                                                                   |\n| :------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `mount` | The child application is mounted on the parent application, and the event is triggered on the child application [#](http://expressjs.com/en/4x/api.html#app.onmount) |\n\n#### Method\n\n| :-                        | :-                                                         |\n| :------------------------ | :--------------------------------------------------------- |\n| `app.all()`               | [#](http://expressjs.com/en/4x/api.html#app.all)           |\n| `app.delete()`            | [#](http://expressjs.com/en/4x/api.html#app.delete.method) |\n| `app.disable()`           | [#](http://expressjs.com/en/4x/api.html#app.disable)       |\n| `app.disabled()`          | [#](http://expressjs.com/en/4x/api.html#app.disabled)      |\n| `app.enable()`            | [#](http://expressjs.com/en/4x/api.html#app.enable)        |\n| `app.enabled()`           | [#](http://expressjs.com/en/4x/api.html#app.enabled)       |\n| `app.engine()`            | [#](http://expressjs.com/en/4x/api.html#app.engine)        |\n| `app.get(name)`           | [#](http://expressjs.com/en/4x/api.html#app.get)           |\n| `app.get(path, callback)` | [#](http://expressjs.com/en/4x/api.html#app.get.method)    |\n| `app.listen()`            | [#](http://expressjs.com/en/4x/api.html#app.listen)        |\n| `app.METHOD()`            | [#](http://expressjs.com/en/4x/api.html#app.METHOD)        |\n| `app.param()`             | [#](http://expressjs.com/en/4x/api.html#app.param)         |\n| `app.path()`              | [#](http://expressjs.com/en/4x/api.html#app.path)          |\n| `app.post()`              | [#](http://expressjs.com/en/4x/api.html#app.post.method)   |\n| `app.put()`               | [#](http://expressjs.com/en/4x/api.html#app.put.method)    |\n| `app.render()`            | [#](http://expressjs.com/en/4x/api.html#app.render)        |\n| `app.route()`             | [#](http://expressjs.com/en/4x/api.html#app.route)         |\n| `app.set()`               | [#](http://expressjs.com/en/4x/api.html#app.set)           |\n| `app.use()`               | [#](http://expressjs.com/en/4x/api.html#app.use)           |\n\n### Request\n\n#### Attribute\n\n| :-                  | :-                                                         |\n| :------------------ | :--------------------------------------------------------- |\n| `req.app`           | [#](http://expressjs.com/en/4x/api.html#req.app)           |\n| `req.baseUrl`       | [#](http://expressjs.com/en/4x/api.html#req.baseUrl)       |\n| `req.body`          | [#](http://expressjs.com/en/4x/api.html#req.body)          |\n| `req.cookies`       | [#](http://expressjs.com/en/4x/api.html#req.cookies)       |\n| `req.fresh`         | [#](http://expressjs.com/en/4x/api.html#req.fresh)         |\n| `req.hostname`      | [#](http://expressjs.com/en/4x/api.html#req.hostname)      |\n| `req.ip`            | [#](http://expressjs.com/en/4x/api.html#req.ip)            |\n| `req.ips`           | [#](http://expressjs.com/en/4x/api.html#req.ips)           |\n| `req.method`        | [#](http://expressjs.com/en/4x/api.html#req.method)        |\n| `req.originalUrl`   | [#](http://expressjs.com/en/4x/api.html#req.originalUrl)   |\n| `req.params`        | [#](http://expressjs.com/en/4x/api.html#req.params)        |\n| `req.path`          | [#](http://expressjs.com/en/4x/api.html#req.path)          |\n| `req.protocol`      | [#](http://expressjs.com/en/4x/api.html#req.protocol)      |\n| `req.query`         | [#](http://expressjs.com/en/4x/api.html#req.query)         |\n| `req.route`         | [#](http://expressjs.com/en/4x/api.html#req.route)         |\n| `req.secure`        | [#](http://expressjs.com/en/4x/api.html#req.secure)        |\n| `req.signedCookies` | [#](http://expressjs.com/en/4x/api.html#req.signedCookies) |\n| `req.stale`         | [#](http://expressjs.com/en/4x/api.html#req.stale)         |\n| `req.subdomains`    | [#](http://expressjs.com/en/4x/api.html#req.subdomains)    |\n| `req.xhr`           | [#](http://expressjs.com/en/4x/api.html#req.xhr)           |\n\n#### Method\n\n| :-                       | :-                                                                              |\n| :----------------------- | :------------------------------------------------------------------------------ |\n| `req.accepts()`          | [#](http://expressjs.com/en/4x/api.html#req.accepts)                            |\n| `req.acceptsCharsets()`  | [#](http://expressjs.com/en/4x/api.html#req.acceptsCharsets)                    |\n| `req.acceptsEncodings()` | [#](http://expressjs.com/en/4x/api.html#req.acceptsEncodings)                   |\n| `req.acceptsLanguages()` | [#](http://expressjs.com/en/4x/api.html#req.acceptsLanguages)                   |\n| `req.get()`              | Get HTTP request header fields [#](http://expressjs.com/en/4x/api.html#req.get) |\n| `req.is()`               | [#](http://expressjs.com/en/4x/api.html#req.is)                                 |\n| `req.param()`            | [#](http://expressjs.com/en/4x/api.html#req.param)                              |\n| `req.range()`            | [#](http://expressjs.com/en/4x/api.html#req.range)                              |\n\n### Response\n\n```js\napp.get('/', function (req, res) {\n  console.dir(res.headersSent); //false\n  res.send('OK');\n  console.dir(res.headersSent); //true\n});\n```\n\n#### Attribute\n\n| :-                | :-                                                       |\n| :---------------- | :------------------------------------------------------- |\n| `res.app`         | [#](http://expressjs.com/en/4x/api.html#res.app)         |\n| `res.headersSent` | [#](http://expressjs.com/en/4x/api.html#res.headersSent) |\n| `res.locals`      | [#](http://expressjs.com/en/4x/api.html#res.locals)      |\n\n#### Method\n\n| :-                  | :-                                                                                    |\n| :------------------ | :------------------------------------------------------------------------------------ |\n| `res.append()`      | [#](http://expressjs.com/en/4x/api.html#res.append)                                   |\n| `res.attachment()`  | [#](http://expressjs.com/en/4x/api.html#res.attachment)                               |\n| `res.cookie()`      | [#](http://expressjs.com/en/4x/api.html#res.cookie)                                   |\n| `res.clearCookie()` | [#](http://expressjs.com/en/4x/api.html#res.clearCookie)                              |\n| `res.download()`    | Prompt for files to download [#](http://expressjs.com/en/4x/api.html#res.download)    |\n| `res.end()`         | end the response process [#](http://expressjs.com/en/4x/api.html#res.end)             |\n| `res.format()`      | [#](http://expressjs.com/en/4x/api.html#res.format)                                   |\n| `res.get()`         | [#](http://expressjs.com/en/4x/api.html#res.get)                                      |\n| `res.json()`        | Send JSON response [#](http://expressjs.com/en/4x/api.html#res.json)                  |\n| `res.jsonp()`       | Send a response with JSONP support [#](http://expressjs.com/en/4x/api.html#res.jsonp) |\n| `res.links()`       | [#](http://expressjs.com/en/4x/api.html#res.links)                                    |\n| `res.location()`    | [#](http://expressjs.com/en/4x/api.html#res.location)                                 |\n| `res.redirect()`    | Redirect request [#](http://expressjs.com/en/4x/api.html#res.redirect)                |\n| `res.render()`      | render view template [#](http://expressjs.com/en/4x/api.html#res.render)              |\n| `res.send()`        | Send various types of responses [#](http://expressjs.com/en/4x/api.html#res.send)     |\n| `res.sendFile()`    | Send a file as an octet stream [#](http://expressjs.com/en/4x/api.html#res.sendFile)  |\n| `res.sendStatus()`  | [#](http://expressjs.com/en/4x/api.html#res.sendStatus)                               |\n| `res.set()`         | [#](http://expressjs.com/en/4x/api.html#res.set)                                      |\n| `res.status()`      | [#](http://expressjs.com/en/4x/api.html#res.status)                                   |\n| `res.type()`        | [#](http://expressjs.com/en/4x/api.html#res.type)                                     |\n| `res.vary()`        | [#](http://expressjs.com/en/4x/api.html#res.vary)                                     |\n\n## Example\n\n### Router {. row-span-2}\n\nCalled for any request passed to this router\n\n```js\nrouter.use(function (req, res, next) {\n  //.. some logic here .. like any other middleware\n  next();\n});\n```\n\nwill handle any request ending in `/events`\n\n```js\n//depends on where the router \"use()\"\nrouter.get('/events', (req, res, next) => {\n  //..\n});\n```\n\n### Response\n\nThe `res` object represents the HTTP response sent by the `Express` application when it receives an HTTP request\n\n```js\napp.get('/user/:id', (req, res) => {\n  res.send('user' + req.params.id);\n});\n```\n\n### Request\n\nA `req` object represents an `HTTP` request and has properties for the request query string, parameters, body, HTTP\nheaders, etc.\n\n```js\napp.get('/user/:id', (req, res) => {\n  res.send('user' + req.params.id);\n});\n```\n\n### res. end()\n\n```js\nres.end();\nres.status(404).end();\n```\n\nEnd the response process. This method actually comes from the Node core, specifically the `response.end()` method of\n`http.ServerResponse`\n\n### res.json([body])\n\n```js\nres.json(null);\nres.json({ user: 'tobi' });\nres.status(500).json({ error: 'message' });\n```\n\n### app.all\n\n```js\napp.all('/secret', function (req, res, next) {\n  console.log('access secret section...');\n  next(); // Pass control to the next handler\n});\n```\n\n### app.delete\n\n```js\napp.delete('/', function (req, res) {\n  res.send('DELETE request to homepage');\n});\n```\n\n### app.disable(name)\n\n```js\napp.disable('trust proxy');\napp.get('trust proxy');\n// => false\n```\n\n### app.disabled(name)\n\n```js\napp.disabled('trust proxy');\n// => true\n\napp.enable('trust proxy');\napp.disabled('trust proxy');\n// => false\n```\n\n### app.engine(ext, callback)\n\n```js\nvar engines = require('consolidate');\n\napp.engine('haml', engines.haml);\napp.engine('html', engines.hogan);\n```\n\n### app.listen([port[, host[, backlog]]][, callback])\n\n```js\nvar express = require('express');\n\nvar app = express();\napp.listen(3000);\n```\n\n### Routing\n\n```js\nconst express = require('express');\nconst app = express();\n\n//Respond to \"hello world\" when making a GET request to the homepage\napp.get('/', (req, res) => {\n  res.send('hello world');\n});\n```\n\n```js\n// GET method routing\napp.get('/', (req, res) => {\n  res.send('GET request to the homepage');\n});\n\n// POST method routing\napp.post('/', (req, res) => {\n  res.send('POST request to the homepage');\n});\n```\n\n### Middleware\n\n```js\nfunction logOriginalUrl(req, res, next) {\n  console.log('ReqURL:', req.originalUrl);\n  next();\n}\n\nfunction logMethod(req, res, next) {\n  console.log('Request Type:', req.method);\n  next();\n}\n\nconst log = [logOriginalUrl, logMethod];\n\napp.get('/user/:id', log, (req, res, next) => {\n  res.send('User Info');\n});\n```\n\n### Using templates\n\n```js\napp.set('view engine', 'pug');\n```\n\nCreate a `Pug` template file named `index.pug` in the `views` directory with the following content\n\n```pug\nhtml\n  the head\n    title= title\n  the body\n    h1=message\n```\n\nCreate a route to render the `index.pug` file. If the view engine property is not set, the extension of the view file\nmust be specified\n\n```js\napp.get('/', (req, res) => {\n  res.render('index', {\n    title: 'Hey',\n    message: 'Hello there!'\n  });\n});\n```\n"
  },
  {
    "path": "source/_posts/fastapi.md",
    "content": "---\ntitle: FastAPI\ndate: 2025-06-07 18:40:00\nbackground: bg-[#3730a3]\ntags:\n  - web\n  - python\n  - backend\ncategories:\n  - Programming\nintro: |\n  A concise cheatsheet for FastAPI, a fast and modern web framework for building APIs with Python 3.7+.\nplugins:\n  - copyCode\n---\n\n## Getting Started {.cols-3}\n\n### Install & Run\n\n```bash\npip install fastapi uvicorn\nuvicorn main:app --reload\n```\n\n### Hello World\n\n```python\nfrom fastapi import FastAPI\napp = FastAPI()\n\n@app.get(\"/\")\ndef root():\n    return {\"message\": \"Hello FastAPI\"}\n```\n\n### CLI Run Hint\n\n```bash\nuvicorn main:app --reload\n```\n\n## Routing & Parameters {.cols-3}\n\n### Path Parameter\n\n```python\n@app.get(\"/items/{id}\")\ndef read(id: int):\n    return {\"id\": id}\n```\n\n### Query Parameter\n\n```python\n@app.get(\"/search\")\ndef find(q: str = \"default\"):\n    return {\"q\": q}\n```\n\n### Optional Query\n\n```python\n@app.get(\"/filter\")\ndef filter_data(limit: int = 10, active: bool = True):\n    return {\"limit\": limit, \"active\": active}\n```\n\n## Request Body & Validation {.cols-3}\n\n### Using Pydantic\n\n```python\nfrom pydantic import BaseModel\n\nclass Item(BaseModel):\n    name: str\n    price: float\n```\n\n### JSON Body\n\n```python\n@app.post(\"/items/\")\ndef create(item: Item):\n    return item\n```\n\n### Response Model\n\n```python\n@app.post(\"/items/\", response_model=Item)\ndef create(item: Item):\n    return item\n```\n\n## Forms, Files, Headers {.cols-3}\n\n### Form Input\n\n```python\nfrom fastapi import Form\n\n@app.post(\"/login\")\ndef login(user: str = Form(...)):\n    return {\"user\": user}\n```\n\n### File Upload\n\n```python\nfrom fastapi import UploadFile, File\n\n@app.post(\"/upload\")\ndef upload(f: UploadFile = File(...)):\n    return {\"filename\": f.filename}\n```\n\n### Headers / Cookies\n\n```python\nfrom fastapi import Header, Cookie\n\n@app.get(\"/info\")\ndef info(ua: str = Header(None)):\n    return {\"UA\": ua}\n```\n\n## Middleware & Dependency {.cols-2}\n\n### Middleware\n\n```python\n@app.middleware(\"http\")\nasync def log_req(req, call_next):\n    res = await call_next(req)\n    return res\n```\n\n### Dependency\n\n```python\nfrom fastapi import Depends\n\ndef auth(token: str = \"\"):\n    if token != \"xyz\": raise HTTPException(401)\n    return True\n\n@app.get(\"/secure\")\ndef secure(_: bool = Depends(auth)):\n    return {\"secure\": True}\n```\n\n## Errors & JSON API {.cols-2}\n\n### HTTP Error\n\n```python\nfrom fastapi import HTTPException\n\n@app.get(\"/err\")\ndef error():\n    raise HTTPException(404, \"Not Found\")\n```\n\n### JSON API\n\n```python\nfrom fastapi import FastAPI\n\n@app.get(\"/json\")\ndef get_data():\n    return {\"status\": \"ok\"}\n```\n\n## Templates & Static {.cols-2}\n\n### Mount Static\n\n```python\nfrom fastapi.staticfiles import StaticFiles\napp.mount(\"/static\", StaticFiles(directory=\"static\"), name=\"static\")\n```\n\n### Jinja2 Support\n\n```python\nfrom fastapi.templating import Jinja2Templates\ntemplates = Jinja2Templates(\"templates\")\n```\n\n## Routers & Structure {.cols-2}\n\n### Routers (Blueprints)\n\n```python\nfrom fastapi import APIRouter\nrouter = APIRouter()\n\n@router.get(\"/\")\ndef admin():\n    return {\"admin\": True}\n\napp.include_router(router, prefix=\"/admin\")\n```\n\n### Folder Layout\n\n```bash\nproject/\n├── main.py\n├── static/\n├── templates/\n├── routers/\n│   └── admin.py\n└── models/\n```\n\n## Docs & Status {.cols-2}\n\n### Built-in Docs\n\n- Swagger: `/docs`\n- ReDoc: `/redoc`\n\n### Custom Status Code\n\n```python\nfrom fastapi import status\n\n@app.post(\"/create\", status_code=status.HTTP_201_CREATED)\ndef create():\n    return {\"msg\": \"Created\"}\n```\n"
  },
  {
    "path": "source/_posts/feedly.md",
    "content": "---\ntitle: Feedly\ndate: 2022-11-23 16:23:31.705686\nbackground: bg-[#55a955]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 25 keyboard shortcuts found on the Feedly app\n---\n\n## Keyboard Shortcuts\n\n### Navigation {.row-span-2}\n\n| Shortcut    | Action                        |\n| ----------- | ----------------------------- |\n| `G` `T`     | Show Today                    |\n| `G` `A`     | Show All                      |\n| `G` `F`     | Show Favorites                |\n| `G` `G`     | Jump to...                    |\n| `G` `L`     | Read later                    |\n| `G` `I`     | Index                         |\n| `G` `O`     | Organize sources              |\n| `Shift` `J` | Next source or collection     |\n| `Shift` `K` | Previous source or collection |\n| `R`         | Refresh                       |\n\n{.shortcuts}\n\n### Lists\n\n| Shortcut    | Action                      |\n| ----------- | --------------------------- |\n| `J`         | Inline next article         |\n| `K`         | Inline previous article     |\n| `N`         | Select the next article     |\n| `P`         | Select the previous article |\n| `Shift` `A` | Mark all as read            |\n\n{.shortcuts}\n\n### Selected Article {.row-span-2}\n\n| Shortcut    | Action                                         |\n| ----------- | ---------------------------------------------- |\n| `O`         | Inline or close the currently selected article |\n| `V`         | View the original in a new tab                 |\n| `M`         | Toggle mark as read                            |\n| `X`         | Mark as read and hide                          |\n| `S`         | Read later                                     |\n| `T`         | Save to Board                                  |\n| `B`         | Save to Buffer                                 |\n| `C`         | Clip to Evernote                               |\n| `Shift` `V` | Preview                                        |\n\n{.shortcuts}\n\n### Help\n\n| Shortcut | Action                  |\n| -------- | ----------------------- |\n| `?`      | Show keyboard shortcuts |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Feedly](https://blog.feedly.com/keyboard-shortcuts/) _(blog.feedly.com)_\n"
  },
  {
    "path": "source/_posts/figma.md",
    "content": "---\ntitle: Figma\ndate: 2022-11-23 16:23:31.706507\nbackground: bg-[#935aee]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 119 keyboard shortcuts found in Figma\n---\n\n## Keyboard Shortcuts\n\n### Essential\n\n| Shortcut   | Action       |\n| ---------- | ------------ |\n| `Ctrl` `\\` | Show/Hide UI |\n| `Ctrl` `C` | Pick Color   |\n| `Ctrl` `/` | Search Menu  |\n\n{.shortcuts}\n\n### Tools\n\n| Shortcut    | Action            |\n| ----------- | ----------------- |\n| `V`         | Move Tool         |\n| `F`         | Frame Tool        |\n| `P`         | Pen Tool          |\n| `Shift` `P` | Pencil Tool       |\n| `T`         | Text Tool         |\n| `R`         | Rectangle Tool    |\n| `O`         | Ellipse Tool      |\n| `L`         | Line Tool         |\n| `Shift` `L` | Arrow Tool        |\n| `C`         | Add/Show Comments |\n| `Ctrl` `C`  | Pick Color        |\n| `S`         | Slice Tool        |\n\n{.shortcuts}\n\n### View\n\n| Shortcut         | Action                   |\n| ---------------- | ------------------------ |\n| `Shift` `R`      | Toggle Rulers            |\n| `Ctrl` `Y`       | Show Outlines            |\n| `Ctrl` `P`       | Pixel Preview            |\n| `Ctrl` `G`       | Layout Grids             |\n| `Ctrl` `'`       | Pixel Grid               |\n| `Ctrl` `\\`       | Show/Hide UI             |\n| `Ctrl` `Alt` `\\` | Show Multiplayer Cursors |\n| `Alt` `1`        | Show Layers              |\n| `Alt` `2`        | Show Components          |\n| `Alt` `3`        | Show Team Library        |\n\n{.shortcuts}\n\n### Zoom\n\n| Shortcut         | Action                 |\n| ---------------- | ---------------------- |\n| `Space` `(drag)` | Pan                    |\n| `+`              | Zoom In                |\n| `-`              | Zoom Out               |\n| `Shift` `0`      | Zoom to 100%           |\n| `Shift` `1`      | Zoom to Fit            |\n| `Shift` `2`      | Zoom to Selection      |\n| `Shift` `N`      | Zoom to Previous Frame |\n| `N`              | Zoom to Next Frame     |\n| `PgUp`           | Previous Page          |\n| `PgDown`         | Next Page              |\n| `Home`           | Find Previous Frame    |\n| `End`            | Find Next Frame        |\n\n{.shortcuts}\n\n### Text\n\n| Shortcut             | Action                |\n| -------------------- | --------------------- |\n| `Ctrl` `B`           | Bold                  |\n| `Ctrl` `I`           | Italic                |\n| `Ctrl` `U`           | Underline             |\n| `Ctrl` `Shift` `V`   | Paste and Match Style |\n| `Ctrl` `Alt` `L`     | Text Alight Left      |\n| `Ctrl` `Alt` `T`     | Text Align Center     |\n| `Ctrl` `Alt` `R`     | Text Align Right      |\n| `Ctrl` `Alt` `J`     | Text Align Justified  |\n| `Ctrl` `Shift` `</>` | Adjust Font Size      |\n| `Alt` `,/.`          | Adjust Letter Spacing |\n| `Alt` `Shift` `</>`  | Adjust Line Height    |\n\n{.shortcuts}\n\n### Shape\n\n| Shortcut            | Action                                             |\n| ------------------- | -------------------------------------------------- |\n| `P`                 | Pen                                                |\n| `Shift` `P`         | Pencil                                             |\n| `B`                 | Paint Bucket (while editing shape)                 |\n| `Ctrl`              | Bend Tool (while editing shape)                    |\n| `Alt` `/`           | Remove Fill                                        |\n| `/`                 | Remove Stroke                                      |\n| `Shift` `X`         | Swap Fill and Stroke                               |\n| `Ctrl` `Shift` `O`  | Outline Stroke                                     |\n| `Ctrl` `E`          | Flatten Selection                                  |\n| `Ctrl` `J`          | Join Selection (after selecting points)            |\n| `Ctrl` `Shift` `J`  | Smooth Join Selection (after selecting points)     |\n| `Shift` `Backspace` | Delete and Heal Selection (after selecting points) |\n\n{.shortcuts}\n\n### Selection\n\n| Shortcut               | Action                  |\n| ---------------------- | ----------------------- |\n| `Ctrl` `A`             | Select All              |\n| `Ctrl` `Shift` `A`     | Select Inverse          |\n| `Esc`                  | Select None             |\n| `Ctrl` `(click)`       | Deep Select             |\n| `Ctrl` `(right click)` | Select Layer Menu       |\n| `Enter`                | Select Child            |\n| `Shift` `Enter`        | Select Parents          |\n| `Tab`                  | Select Next Sibling     |\n| `Shift` `Tab`          | Select Previous Sibling |\n| `Ctrl` `G`             | Group Selection         |\n| `Ctrl` `Shift` `G`     | Ungroup Selection       |\n| `Ctrl` `Alt` `G`       | Frame Selection         |\n| `Ctrl` `Shift` `H`     | Show/Hide Selection     |\n| `Ctrl` `Shift` `L`     | Lock/Unlock Selection   |\n\n{.shortcuts}\n\n### Cursor\n\n| Shortcut               | Action                                                  |\n| ---------------------- | ------------------------------------------------------- |\n| `Alt`                  | Measure to Selection (while pointing)                   |\n| `Alt`                  | Duplicate Selection (while moving)                      |\n| `Ctrl` `(click)`       | Deep Select (while clicking)                            |\n| `Ctrl` `(right click)` | Select Layer Menu (while clicking)                      |\n| `Ctrl` `(drag)`        | Deep Select Within Rectangle (while dragging to select) |\n| `Alt`                  | Resize from Center (while resizing)                     |\n| `Shift`                | Resize Proportionally (while resizing)                  |\n| `Space`                | Move While Resizing                                     |\n| `Ctrl`                 | Ignore Constraints (Frames Only)                        |\n\n{.shortcuts}\n\n### Edit\n\n| Shortcut           | Action                       |\n| ------------------ | ---------------------------- |\n| `Ctrl` `C`         | Copy                         |\n| `Ctrl` `X`         | Cut                          |\n| `Ctrl` `V`         | Paste                        |\n| `Ctrl` `Shift` `V` | Paste Over Selection         |\n| `Ctrl` `D`         | Duplicate Selection in Place |\n| `Ctrl` `R`         | Rename Selection             |\n| `Ctrl` `Shift` `E` | Export                       |\n| `Ctrl` `Alt` `C`   | Copy Properties              |\n| `Ctrl` `Alt` `V`   | Paste Properties             |\n\n{.shortcuts}\n\n### Transform\n\n| Shortcut           | Action              |\n| ------------------ | ------------------- |\n| `Shift` `H`        | Flip Horizontal     |\n| `Shift` `V`        | Flip Vertical       |\n| `Ctrl` `M`         | Use as Mask         |\n| `Enter`            | Edit Shape or Image |\n| `Ctrl` `Shift` `K` | Place Image         |\n| `Alt` `(click x2)` | Crop Image          |\n| `1`                | Set Opacity to 10%  |\n| `5`                | Set Opacity to 50%  |\n| `0`                | Set Opacity to 100% |\n\n{.shortcuts}\n\n### Arrange\n\n| Shortcut         | Action                        |\n| ---------------- | ----------------------------- |\n| `Ctrl` `]`       | Bring Forward                 |\n| `Ctrl` `[`       | Send Backward                 |\n| `Ctrl` `Alt` `]` | Bring to Front                |\n| `Ctrl` `Alt` `[` | Send to Back                  |\n| `Alt` `A`        | Align Left                    |\n| `Alt` `D`        | Align Right                   |\n| `Alt` `W`        | Align Top                     |\n| `Alt` `S`        | Align Bottom                  |\n| `Alt` `H`        | Align Horizontal Centers      |\n| `Alt` `V`        | Align Vertical Centers        |\n| `Ctrl` `Alt` `T` | Tidy Up                       |\n| `Ctrl` `Alt` `H` | Distribute Horizontal Spacing |\n| `Ctrl` `Alt` `V` | Distribute Vertical Spacing   |\n\n{.shortcuts}\n\n### Components\n\n| Shortcut           | Action                                               |\n| ------------------ | ---------------------------------------------------- |\n| `Alt` `2`          | Show Components                                      |\n| `Ctrl` `Shift` `O` | Team Library                                         |\n| `Ctrl` `Shift` `K` | Create Component                                     |\n| `Ctrl` `Shift` `B` | Detach Instance                                      |\n| `Alt`              | Swap Component Instance (while dragging from Assets) |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Figma](https://help.figma.com/article/77-keyboard-shortcuts) _(help.figma.com)_\n"
  },
  {
    "path": "source/_posts/filezilla.md",
    "content": "---\ntitle: FileZilla\ndate: 2022-11-23 16:23:31.705296\nbackground: bg-[#a42115]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 30 keyboard shortcuts found on the FileZilla program\n---\n\n## Keyboard Shortcuts {.cols-2}\n\n### General Shortcuts I\n\n| Shortcut           | Action                                                                              |\n| ------------------ | ----------------------------------------------------------------------------------- |\n| `F2`               | Rename selected file                                                                |\n| `F3`               | Search remote files                                                                 |\n| `F5`               | Refreshes local and remote file and folder views                                    |\n| `Tab`              | Switches to the next view                                                           |\n| `Alt` `Down`       | Transfers the currently selected item to an item of the same name in the other pane |\n| `Alt` `Up`         | Navigates up one line in a tree view, navigates to parent folder in file view       |\n| `Ctrl` `B`         | Add bookmark                                                                        |\n| `Ctrl` `Shift` `B` | Manage bookmarks                                                                    |\n| `Ctrl` `C`         | Stops the current operation                                                         |\n| `Ctrl` `D`         | Disconnects from server                                                             |\n| `Ctrl` `E`         | Show files currently being edited                                                   |\n| `Ctrl` `I`         | Directory listing filters...                                                        |\n| `Ctrl` `M`         | Manual transfer                                                                     |\n| `Ctrl` `Shift` `N` | Create a new directory                                                              |\n| `Ctrl` `O`         | Enable directory comparison                                                         |\n\n{.shortcuts}\n\n### General Shortcuts II\n\n| Shortcut      | Action                                                                                |\n| ------------- | ------------------------------------------------------------------------------------- |\n| `Ctrl` `P`    | Process queue                                                                         |\n| `Ctrl` `Q`    | Exit                                                                                  |\n| `Ctrl` `R`    | Reconnects to server                                                                  |\n| `Ctrl` `S`    | Opens the site manager                                                                |\n| `Ctrl` `T`    | Opens a new tab                                                                       |\n| `Ctrl` `U`    | Preserve the timestamps of transferred files                                          |\n| `Ctrl` `Y`    | Toggle synchronized browsing                                                          |\n| `Ctrl` `W`    | Close tab                                                                             |\n| `Enter`       | Transfer the currently selected item if it is a file, or expands if it is a directory |\n| `Ctrl` `PgUp` | Switches to the next tab                                                              |\n| `Ctrl` `PgDn` | Switches to the previous tab                                                          |\n| `Up`          | Moves up one item in the current view                                                 |\n| `Down`        | Moves down one item in the current view                                               |\n| `Left`        | Nothing in a files view, up on level in a tree view                                   |\n| `Right`       | Down one level in a tree view if there are subfolders, nothing if there are none      |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for FileZilla](https://wiki.filezilla-project.org/Keyboard_shortcuts)\n  _(wiki.filezilla-project.org)_\n"
  },
  {
    "path": "source/_posts/find.md",
    "content": "---\ntitle: Find\ndate: 2020-12-28 16:52:20\ntags:\n  - search\n  - file\n  - directory\ncategories:\n  - Linux Command\nintro: |\n  This is a quick reference list of cheatsheet for linux find command, contains common options and examples.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Usage\n\n```shell script\n$ find [path...] [options] [expression]\n```\n\nWildcard\n\n```shell script\n$ find . -name \"*.txt\"\n$ find . -name \"2020*.csv\"\n$ find . -name \"json_*\"\n```\n\n---\n\n- [Regex reference](/regex) _(cheatsheets.zip)_\n- [Find cheatsheet](https://gist.github.com/gr1ev0us/3a9b9d9dbdd38f6379288eb2686fc538) _(gist.github.com)_\n\n### Option Examples {.col-span-2}\n\n| Option      | Example                                    | Description                                 |\n| ----------- | ------------------------------------------ | ------------------------------------------- |\n| `-type`     | find . -type d                             | Find only directories                       |\n| `-name`     | find . -type f -name \"\\*.txt\"              | Find file by name                           |\n| `-iname`    | find . -type f -iname \"hello\"              | Find file by name (case-insensitive)        |\n| `-size`     | find . -size +1G                           | Find files larger than 1G                   |\n| `-user`     | find . -type d -user jack                  | Find jack's file                            |\n| `-regex`    | find /var -regex '.\\*/tmp/.\\*[0-9]\\*.file' | Using Regex with find. See [regex](/regex)  |\n| `-maxdepth` | find . -maxdepth 1 -name \"a.txt\"           | In the current directory and subdirectories |\n| `-mindepth` | find / -mindepth 3 -maxdepth 5 -name pass  | Between sub-directory level 2 and 4         |\n\n{.show-header}\n\n### Type\n\n|           |                      |\n| --------- | -------------------- |\n| `-type d` | Directory            |\n| `-type f` | File                 |\n| `-type l` | Symbolic link        |\n| `-type b` | Buffered block       |\n| `-type c` | Unbuffered character |\n| `-type p` | Named pipe           |\n| `-type s` | Socket               |\n\n### Size\n\n|           |                           |\n| --------- | ------------------------- |\n| `-size b` | 512-byte blocks (default) |\n| `-size c` | Bytes                     |\n| `-size k` | Kilobytes                 |\n| `-size M` | Megabytes                 |\n| `-size G` | Gigabytes                 |\n| `-size T` | Terabytes _(only BSD)_    |\n| `-size P` | Petabytes _(only BSD)_    |\n\n### Size +/-\n\nFind all bigger than 10MB files\n\n```shell script\n$ find / -size +10M\n```\n\nFind all smaller than 10MB files\n\n```shell script\n$ find / -size -10M\n```\n\nFind all files that are exactly 10M\n\n```shell script\n$ find / -size 10M\n```\n\nFind Size between 100MB and 1GB\n\n```shell script\n$ find / -size +100M -size -1G\n```\n\nThe `+` and `-` prefixes signify greater than and less than, as usual.\n\n### Names\n\nFind files using name in current directory\n\n```shell script\n$ find . -name tecmint.txt\n```\n\nFind files under home directory\n\n```shell script\n$ find /home -name tecmint.txt\n```\n\nFind files using name and ignoring case\n\n```shell script\n$ find /home -iname tecmint.txt\n```\n\nFind directories using name\n\n```shell script\n$ find / -type d -name tecmint\n```\n\nFind php files using name\n\n```shell script\n$ find . -type f -name tecmint.php\n```\n\nFind all php files in directory\n\n```shell script\n$ find . -type f -name \"*.php\"\n```\n\n### Permissions\n\nFind the files whose permissions are 777.\n\n```shell script\n$ find . -type f -perm 0777 -print\n```\n\nFind the files without permission 777.\n\n```shell script\n$ find / -type f ! -perm 777\n```\n\nFind SUID set files.\n\n```shell script\n$ find / -perm /u=s\n```\n\nFind SGID set files.\n\n```shell script\n$ find / -perm /g=s\n```\n\nFind Read Only files.\n\n```shell script\n$ find / -perm /u=r\n```\n\nFind Executable files.\n\n```shell script\n$ find / -perm /a=x\n```\n\n### Owners and Groups\n\nFind single file based on user\n\n```shell script\n$ find / -user root -name tecmint.txt\n```\n\nFind all files based on user\n\n```shell script\n$ find /home -user tecmint\n```\n\nFind all files based on group\n\n```shell script\n$ find /home -group developer\n```\n\nFind particular files of user\n\n```shell script\n$ find /home -user tecmint -iname \"*.txt\"\n```\n\n### Multiple filenames\n\n```shell script {.wrap}\n$ find . -type f \\( -name \"*.sh\" -o -name \"*.txt\" \\)\n```\n\nFind files with `.sh` and `.txt` extensions\n\n### Multiple dirs\n\n```shell script {.wrap}\n$ find /opt /usr /var -name foo.scala -type f\n```\n\nFind files with multiple dirs\n\n### Empty\n\n```shell script\n$ find . -type d -empty\n```\n\nDelete all empty files in a directory\n\n```shell script\n$ find . -type f -empty -delete\n```\n\n## Find Date and Time\n\n### Means {.col-span-2}\n\n| Option  | Description                                                     |\n| ------- | --------------------------------------------------------------- |\n| `atime` | access time (last time file <yel>opened</yel>)                  |\n| `mtime` | modified time (last time file <yel>contents was modified</yel>) |\n| `ctime` | changed time (last time file <yel>inode was changed</yel>)      |\n\n#### Example\n\n| Option          | Description                                                |\n| --------------- | ---------------------------------------------------------- |\n| `-mtime +0`     | Modified greater than 24 hours ago                         |\n| `-mtime 0`      | Modified between now and 1 day ago                         |\n| `-mtime -1`     | Modified less than 1 day ago (same as `-mtime 0`)          |\n| `-mtime 1`      | Modified between 24 and 48 hours ago                       |\n| `-mtime +1`     | Modified more than 48 hours ago                            |\n| `-mtime +1w`    | Last modified more than 1 week ago                         |\n| `-atime 0`      | Last accessed between now and 24 hours ago                 |\n| `-atime +0`     | Accessed more than 24 hours ago                            |\n| `-atime 1`      | Accessed between 24 and 48 hours ago                       |\n| `-atime +1`     | Accessed more than 48 hours ago                            |\n| `-atime -1`     | Accessed less than 24 hours ago (same as `-atime 0`)       |\n| `-ctime -6h30m` | File status changed within the last 6 hours and 30 minutes |\n\n### Examples\n\nFind last 50 days modified files\n\n```shell script\n$ find / -mtime 50\n```\n\nfind last 50 days accessed files\n\n```shell script\n$ find / -atime 50\n```\n\nfind last 50-100 days modified files\n\n```shell script\n$ find / -mtime +50 –mtime -100\n```\n\nfind changed files in last 1 hour\n\n```shell script\n$ find / -cmin -60\n```\n\nfind modified files in last 1 hour\n\n```shell script\n$ find / -mmin -60\n```\n\nfind accessed files in last 1 hour\n\n```shell script\n$ find / -amin -60\n```\n\n## Find and {.cols-2}\n\n### Find and delete {.row-span-2}\n\nFind and remove multiple files\n\n```shell script\n$ find . -type f -name \"*.mp3\" -exec rm -f {} \\;\n```\n\nFind and remove single file\n\n```shell script\n$ find . -type f -name \"tecmint.txt\" -exec rm -f {} \\;\n```\n\nFind and delete 100mb files\n\n```shell script\n$ find / -type f -size +100m -exec rm -f {} \\;\n```\n\nFind specific files and delete\n\n```shell script\n$ find / -type f -name *.mp3 -size +10m -exec rm {} \\;\n```\n\n### Find and replace\n\nFind all files and modify the content `const` to `let`\n\n```shell script {.wrap}\n$ find ./ -type f -exec sed -i 's/const/let/g' {} \\;\n```\n\nFind readable and writable files and modify the content `old` to `new`\n\n```shell script {.wrap}\n$ find ./ -type f -readable -writable -exec sed -i \"s/old/new/g\" {} \\;\n```\n\nSee also: [sed cheatsheet](/sed)\n\n### Find and rename\n\nFind and suffix (added `.bak`)\n\n```shell script {.wrap}\n$ find . -type f -name 'file*' -exec mv {} {}.bak\\;\n```\n\nFind and rename extension (`.html` => `.gohtml`)\n\n```shell script {.wrap}\n$ find ./ -depth -name \"*.html\" -exec sh -c 'mv \"$1\" \"${1%.html}.gohtml\"' _ {} \\;\n```\n\n### Find and move\n\n```shell script\n$ find . -name '*.mp3' -exec mv {} /tmp/music \\;\n```\n\nFind and move it to a specific directory (`/tmp/music`)\n\n### Find and copy\n\n```shell script\n$ find . -name '*2020*.xml' -exec cp -r \"{}\" /tmp/backup \\;\n```\n\nFind matching files and copy to a specific directory (`/tmp/backup`)\n\n### Find and concatenate\n\nMerge all csv files in the download directory into `merged.csv`\n\n```shell script\n$ find download -type f -iname '*.csv' | xargs cat > merged.csv\n```\n\nMerge all sorted csv files in the download directory into `merged.csv`\n\n```shell script {.wrap}\n$ find download -type f -iname '*.csv' | sort | xargs cat > merged.csv\n```\n\n### Find and sort\n\nFind and sort in ascending\n\n```shell script\n$ find . -type f | sort\n```\n\nfind and sort descending\n\n```shell script\n$ find . -type f | sort -r\n```\n\n### Find and chmod {.row-span-1}\n\nFind files and set permissions to 644.\n\n```shell script\n$ find / -type f -perm 0777 -print -exec chmod 644 {} \\;\n```\n\nFind directories and set permissions to 755.\n\n```shell script\n$ find / -type d -perm 777 -print -exec chmod 755 {} \\;\n```\n\n### Find and compress\n\nFind all `.java` files and compress it into `java.tar`\n\n```shell script\n$ find . -type f -name \"*.java\" | xargs tar cvf java.tar\n```\n\nFind all `.csv` files and compress it into `cheatsheets.zip`\n\n```shell script\n$ find . -type f -name \"*.csv\" | xargs zip cheatsheets.zip\n```\n"
  },
  {
    "path": "source/_posts/finder.md",
    "content": "---\ntitle: Finder\ndate: 2022-11-23 16:23:31.693285\nbackground: bg-[#4b9be8]\nlabel: Mac\ntags:\n  -\n  - mac\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 55 keyboard shortcuts found in Finder. This application is part of MacOS.\n---\n\n## Keyboard Shortcuts {.cols-2}\n\n### Finder Shortcuts\n\n| Shortcut                 | Action                                                                             |\n| ------------------------ | ---------------------------------------------------------------------------------- |\n| `Cmd` `D`                | Duplicate the selected files                                                       |\n| `Cmd` `E`                | Eject the selected disk or volume                                                  |\n| `Cmd` `F`                | Start a Spotlight search in the Finder window                                      |\n| `Cmd` `I`                | Show the get info window for a selected file                                       |\n| `Cmd` `R`                | When an alias is selected in the Finder, show original file for the selected alias |\n| `Cmd` `Shift` `C`        | Open the Computer window                                                           |\n| `Cmd` `Shift` `D`        | Open the desktop folder                                                            |\n| `Cmd` `Shift` `F`        | Open the Recents window, showing all files you viewed or changed recently          |\n| `Cmd` `Shift` `G`        | Open a Go to Folder window                                                         |\n| `Cmd` `Shift` `H`        | Open the Home folder of the current MacOS user account                             |\n| `Cmd` `Shift` `I`        | Open the iCloud drive                                                              |\n| `Cmd` `Shift` `K`        | Open the Network window                                                            |\n| `Cmd` `Opt` `L`          | Open the Downloads folder                                                          |\n| `Cmd` `Shift` `N`        | Create a new folder                                                                |\n| `Cmd` `Shift` `O`        | Open the Documents folder                                                          |\n| `Cmd` `Shift` `P`        | Show or hide the Preview pane in Finder windows                                    |\n| `Cmd` `Shift` `R`        | Open the AirDrop window                                                            |\n| `Cmd` `Shift` `T`        | Show or hide the tab bar in Finder windows                                         |\n| `Ctrl` `Cmd` `Shift` `T` | Add selected Finder items to the Dock                                              |\n| `Cmd` `Shift` `U`        | Open the Utilities folder                                                          |\n| `Cmd` `Opt` `D`          | Show or hide the Dock                                                              |\n| `Cmd` `Ctrl` `T`         | Add the selected item to the sidebar                                               |\n| `Cmd` `Opt` `P`          | Hide or show the path bar in Finder windows                                        |\n| `Cmd` `Opt` `S`          | Hide or show the Sidebar in Finder windows                                         |\n| `Cmd` `/`                | Hide or show the status bar in Finder windows                                      |\n| `Cmd` `J`                | Show view options                                                                  |\n| `Cmd` `K`                | Open the Connect to Server window                                                  |\n\n{.shortcuts}\n\n### Finder Shortcuts\n\n| Shortcut                  | Action                                                                               |\n| ------------------------- | ------------------------------------------------------------------------------------ |\n| `Cmd` `Ctrl` `A`          | Make an alias of the selected item                                                   |\n| `Cmd` `N`                 | Open a new Finder window                                                             |\n| `Cmd` `Opt` `N`           | Create a new Smart Folder                                                            |\n| `Cmd` `T`                 | Show or hide the tab bar when a single tab is open in the current Finder window      |\n| `Cmd` `Opt` `T`           | Show or hide the toolbar when a single tab is open in the current Finder window      |\n| `Cmd` `Opt` `V`           | Move the files in the Clipboard from their original location to the current location |\n| `Cmd` `Y`                 | Use Quick Look to preview the selected files                                         |\n| `Cmd` `Opt` `Y`           | View a Quick Look slideshow of the selected files                                    |\n| `Cmd` `1`                 | View the items in the Finder window as icons                                         |\n| `Cmd` `2`                 | View the items in a Finder window as a list                                          |\n| `Cmd` `3`                 | View the items in a Finder window in columns                                         |\n| `Cmd` `4`                 | View the items in a Finder window in a gallery                                       |\n| `Cmd` `[`                 | Go to the previous folder                                                            |\n| `Cmd` `]`                 | Go to the next folder                                                                |\n| `Cmd` `Up`                | Open the folder that contains the current folder                                     |\n| `Cmd` `Ctrl` `Up`         | Open the folder that contains the current folder, in a new window                    |\n| `Cmd` `Down`              | Open the selected item                                                               |\n| `Right`                   | Open the selected folder, this only works when in list view                          |\n| `Left`                    | Close the selected folder, this only works when in list view                         |\n| `Cmd` `Del`               | Move the selected item to the trash                                                  |\n| `Cmd` `Shift` `Del`       | Empty the trash                                                                      |\n| `Cmd` `Opt` `Shift` `Del` | Empty the trash without the confirmation dialogue                                    |\n| `Cmd` `Bright-Down`       | Turn video mirroring on or off when your Mac is connected to more than one display   |\n| `Cmd` `Bright-Up`         | Open Displays preferences                                                            |\n| `Ctrl` `Bright`           | Change the brightness of your external display, if supported                         |\n| `Opt` `Shift` `Bright`    | Adjust the display brightness in smaller steps                                       |\n| `Ctrl` `Down`             | Show all windows of the front app                                                    |\n| `Opt` `Vol`               | Open Sound preferences                                                               |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for MacOS Finder](https://support.apple.com/en-us/HT201236) _(support.apple.com)_\n"
  },
  {
    "path": "source/_posts/firefox.md",
    "content": "---\ntitle: Firefox\ndate: 2022-11-23 16:23:31.703957\nbackground: bg-[#e34e4b]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 116 keyboard shortcuts found in Firefox\n---\n\n## Keyboard Shortcuts\n\n### Navigation\n\n| Shortcut           | Action                  |\n| ------------------ | ----------------------- |\n| `Alt` `Left`       | Back                    |\n| `Alt` `Right`      | Forward                 |\n| `Alt` `Home`       | Home                    |\n| `Ctrl` `O`         | Open File               |\n| `Ctrl` `R`         | Reload                  |\n| `Ctrl` `Shift` `R` | Reload (override cache) |\n| `Ctrl` `.`         | Stop                    |\n\n{.shortcuts}\n\n### Current Page\n\n| Shortcut        | Action                             |\n| --------------- | ---------------------------------- |\n| `Tab`           | Focus Next Link or Input Field     |\n| `Shift` `Tab`   | Focus Previous Link or Input Field |\n| `Space`         | Go Down a Screen                   |\n| `Shift` `Space` | Go Up a Screen                     |\n| `Ctrl` `Down`   | Go to Bottom of Page               |\n| `Ctrl` `Up`     | Go to Top of Page                  |\n| `F6`            | Move to Next Frame                 |\n| `Shift` `F6`    | Move to Previous Frame             |\n| `Ctrl` `P`      | Print                              |\n| `Ctrl` `S`      | Save Page As                       |\n| `Ctrl` `+`      | Zoom In                            |\n| `Ctrl` `-`      | Zoom Out                           |\n| `Ctrl` `0`      | Zoom Reset                         |\n\n{.shortcuts}\n\n### Editing\n\n| Shortcut           | Action                  |\n| ------------------ | ----------------------- |\n| `Ctrl` `C`         | Copy                    |\n| `Ctrl` `X`         | Cut                     |\n| `Backspace`        | Delete                  |\n| `Home`             | Go to Beginning of Line |\n| `End`              | Go to End of Line       |\n| `Ctrl` `V`         | Paste                   |\n| `Ctrl` `Shift` `V` | Paste (as plain text)   |\n| `Ctrl` `Shift` `Z` | Redo                    |\n| `Ctrl` `A`         | Select All              |\n| `Ctrl` `Z`         | Undo                    |\n\n{.shortcuts}\n\n### Search\n\n| Shortcut           | Action                                             |\n| ------------------ | -------------------------------------------------- |\n| `Ctrl` `F`         | Find                                               |\n| `Ctrl` `G`         | Find Again                                         |\n| `Ctrl` `Shift` `G` | Find Previous                                      |\n| `'`                | Quick Find within link-text only                   |\n| `/`                | Quick Find                                         |\n| `Esc`              | Close the Find or Quick Find bar                   |\n| `Ctrl` `K`         | Focus Search bar                                   |\n| `Ctrl` `Up/Down`   | Change the Default Search Engine                   |\n| `Alt` `Up/Down`    | View menu to switch, add, or manage search engines |\n\n{.shortcuts}\n\n### Windows and Tabs {.row-span-2}\n\n| Shortcut                | Action                                       |\n| ----------------------- | -------------------------------------------- |\n| `Ctrl` `W`              | Close Tab                                    |\n| `Ctrl` `Shift` `W`      | Close Window                                 |\n| `Ctrl` `Tab`            | Cycle through Tabs in Recently Used Order    |\n| `Ctrl` `Q`              | Quit                                         |\n| `Ctrl` `PgUp`           | Go one Tab to the Left                       |\n| `Ctrl` `PgDown`         | Go one Tab to the Right                      |\n| `Ctrl` `Shift` `PgUp`   | Move Tab Left                                |\n| `Ctrl` `Shift` `PgDown` | Move Tab Right                               |\n| `Ctrl` `Shift` `Home`   | Move Tab in focus to start                   |\n| `Ctrl` `Shift` `End`    | Move Tab in focus to end                     |\n| `Ctrl` `M`              | Mute/Unmute Audio                            |\n| `Ctrl` `T`              | New Tab                                      |\n| `Ctrl` `N`              | New Window                                   |\n| `Ctrl` `Shift` `P`      | New Private Window                           |\n| `Alt` `Enter`           | Open Address in New Foreground Tab           |\n| `Enter`                 | Open Focused Bookmark or Link in Current Tab |\n| `Ctrl` `Enter`          | Open Focused Bookmark in New Foreground Tab  |\n| `Ctrl` `Shift` `Enter`  | Open Focused Bookmark in New Background Tab  |\n| `Ctrl` `Enter`          | Open Focused Link in New Background Tab      |\n| `Shift` `Enter`         | Open Focused Bookmark or Link in New Window  |\n| `Ctrl` `Shift` `T`      | Undo Close Tab                               |\n| `Ctrl` `Shift` `N`      | Undo Close Window                            |\n| `Ctrl` `1-8`            | Select Tab 1-8                               |\n| `Ctrl` `9`              | Select Last Tab                              |\n| `Ctrl` `Shift` `X`      | Moves the URL left or right                  |\n\n{.shortcuts}\n\n### History\n\n| Shortcut                | Action               |\n| ----------------------- | -------------------- |\n| `Ctrl` `Shift` `H`      | History sidebar      |\n| `Ctrl` `Shift` `Delete` | Clear Recent History |\n\n{.shortcuts}\n\n### Bookmarks\n\n| Shortcut                            | Action                     |\n| ----------------------------------- | -------------------------- |\n| `Ctrl` `Shift` `D`                  | Bookmark All Tabs          |\n| `Ctrl` `D`                          | Bookmark This Page         |\n| `Ctrl` `B`                          | Bookmarks sidebar          |\n| `Ctrl` `Shift` `S`                  | Library window (Bookmarks) |\n| `(search field in Library)` `Space` | Search for all Bookmarks   |\n\n{.shortcuts}\n\n### Tools\n\n| Shortcut           | Action                 |\n| ------------------ | ---------------------- |\n| `Ctrl` `J`         | Downloads              |\n| `Ctrl` `Shift` `A` | Add-ons                |\n| `Ctrl` `Alt` `I`   | Toggle Developer Tools |\n| `Ctrl` `Alt` `K`   | Web Console            |\n| `Ctrl` `Alt` `C`   | Inspector              |\n| `Ctrl` `Alt` `S`   | Debugger               |\n| `Shift` `F7`       | Style Editor           |\n| `Shift` `F5`       | Profiler               |\n| `Ctrl` `Alt` `E`   | Network                |\n| `Shift` `F2`       | Developer Toolbar      |\n| `Ctrl` `Alt` `M`   | Responsive Design View |\n| `Shift` `F4`       | Scratchpad             |\n| `Ctrl` `U`         | Page Source            |\n| `Ctrl` `Shift` `J` | Browser Console        |\n| `Ctrl` `I`         | Page Info              |\n\n{.shortcuts}\n\n### PDF Viewer\n\n| Shortcut         | Action                          |\n| ---------------- | ------------------------------- |\n| `N/J/Right`      | Next page                       |\n| `P/K/Left`       | Previous page                   |\n| `Ctrl` `+`       | Zoom in                         |\n| `Ctrl` `-`       | Zoom out                        |\n| `Ctrl` `0`       | Automatic Zoom                  |\n| `R`              | Rotate the document clockwise   |\n| `Ctrl` `R`       | Rotate counterclockwise         |\n| `Ctrl` `Alt` `P` | Switch to Presentation Mode     |\n| `S`              | Choose Text Selection Tool      |\n| `H`              | Choose Hand Tool                |\n| `Ctrl` `Alt` `G` | Focus the Page Number input box |\n\n{.shortcuts}\n\n### Miscellaneous\n\n| Shortcut               | Action                             |\n| ---------------------- | ---------------------------------- |\n| `Ctrl` `Enter`         | Complete .com address              |\n| `Shift` `Enter`        | Complete .net address              |\n| `Ctrl` `Shift` `Enter` | Complete .org address              |\n| `Shift` `Delete`       | Delete Selected Autocomplete Entry |\n| `Ctrl` `Shift` `F`     | Toggle Full Screen                 |\n| `Ctrl` `Alt` `R`       | Toggle Reader Mode                 |\n| `F7`                   | Caret Browsing                     |\n| `Ctrl` `L`             | Select Location Bar                |\n\n{.shortcuts}\n\n### Media Shortcuts\n\n| Shortcut       | Action                  |\n| -------------- | ----------------------- |\n| `Space`        | Toggle Play/Pause       |\n| `Down`         | Decrease volume         |\n| `Up`           | Increase volume         |\n| `Ctrl` `Down`  | Mute audio              |\n| `Ctrl` `Up`    | Unmute audio            |\n| `Left`         | Seek back 15 seconds    |\n| `Ctrl` `Left`  | Seek back 10%           |\n| `Right`        | Seek forward 15 seconds |\n| `Ctrl` `Right` | Seek forward 10%        |\n| `Home`         | Seek to the beginning   |\n| `End`          | Seek to the end         |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Firefox](https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly)\n  _(support.mozilla.org)_\n"
  },
  {
    "path": "source/_posts/flask.md",
    "content": "---\ntitle: Flask\ndate: 2025-06-07 19:05:00\nbackground: bg-[#3598db]\ntags:\n  - web\n  - python\n  - backend\ncategories:\n  - Programming\nintro: |\n  A concise cheatsheet for Flask, a lightweight WSGI web application framework for Python.\nplugins:\n  - copyCode\n---\n\n## Getting Started {.cols-3}\n\n### Install Flask\n\n```bash\npip install flask\n```\n\n### Hello World\n\n```python\nfrom flask import Flask\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef hello():\n    return \"Hello, World!\"\n\napp.run(debug=True)\n```\n\n### Flask CLI\n\n```bash\nexport FLASK_APP=app.py\nflask run\n```\n\n## App Config & Environment {.cols-3}\n\n### App Object\n\n```python\nfrom flask import Flask\napp = Flask(__name__)\n```\n\n### Configuration\n\n```python\napp.config[\"DEBUG\"] = True\napp.config.from_pyfile(\"config.py\")\n```\n\n### Common Config Keys\n\n| Key | Description |\n| | -- |\n| `DEBUG` | Enable debug mode |\n| `SECRET_KEY` | For sessions/cookies |\n| `ENV` | Set to 'development' |\n\n## Routing & Methods {.cols-3}\n\n### Basic Route\n\n```python\n@app.route(\"/\")\ndef home():\n    return \"Home\"\n```\n\n### Methods\n\n```python\n@app.route(\"/login\", methods=[\"GET\", \"POST\"])\ndef login():\n    return \"Login\"\n```\n\n### Dynamic Routes\n\n```python\n@app.route(\"/user/<name>\")\ndef user(name):\n    return f\"User: {name}\"\n```\n\n## Request & Response {.cols-3}\n\n### Request Object\n\n```python\nfrom flask import request\n\n@app.route(\"/data\", methods=[\"POST\"])\ndef data():\n    return request.json\n```\n\n### Request Attributes\n\n- `request.args`: Query params\n- `request.form`: Form data\n- `request.json`: JSON body\n\n### Custom Response\n\n```python\nfrom flask import make_response\n\n@app.route(\"/custom\")\ndef custom():\n    res = make_response(\"Custom\", 200)\n    res.headers[\"X-Test\"] = \"True\"\n    return res\n```\n\n## Templates & Static {.cols-3}\n\n### Render Template\n\n```python\nfrom flask import render_template\n\n@app.route(\"/\")\ndef page():\n    return render_template(\"index.html\", name=\"Flask\")\n```\n\n### Jinja Syntax\n\n```html\n<h1>Hello {{ name }}</h1>\n{% if name %}\n<p>Hi!</p>\n{% endif %}\n```\n\n### Static Files\n\n```html\n<link href=\"{{ url_for('static', filename='style.css') }}\" />\n```\n\n## Sessions & Cookies {.cols-2}\n\n### Using Sessions\n\n```python\nfrom flask import session\napp.secret_key = \"secret\"\n\n@app.route(\"/login\")\ndef login():\n    session[\"user\"] = \"admin\"\n    return \"Logged in\"\n```\n\n### Access Cookies\n\n```python\nfrom flask import request, make_response\n\n@app.route(\"/cookie\")\ndef cookie():\n    resp = make_response(\"Set cookie\")\n    resp.set_cookie(\"site\", \"Flask\")\n    return resp\n```\n\n## JSON API & Middleware {.cols-2}\n\n### JSON Response\n\n```python\nfrom flask import jsonify\n\n@app.route(\"/api\")\ndef api():\n    return jsonify(message=\"Hello\")\n```\n\n### Middleware\n\n```python\n@app.before_request\ndef before():\n    print(\"Before\")\n\n@app.after_request\ndef after(res):\n    print(\"After\")\n    return res\n```\n\n## Error Handling & Blueprints {.cols-2}\n\n### Error Handling\n\n```python\n@app.errorhandler(404)\ndef not_found(e):\n    return \"Page not found\", 404\n```\n\n### Blueprint\n\n```python\nfrom flask import Blueprint\n\nadmin = Blueprint(\"admin\", __name__, url_prefix=\"/admin\")\n\n@admin.route(\"/\")\ndef dash():\n    return \"Admin\"\n\napp.register_blueprint(admin)\n```\n\n## Project Structure {.cols-2}\n\n### File Structure\n\n```bash\nproject/\n├── app.py\n├── templates/\n│   └── index.html\n├── static/\n│   └── style.css\n└── config.py\n```\n\n### Run Server\n\n```bash\npython app.py\n# or using CLI\nexport FLASK_APP=app.py\nflask run\n```\n"
  },
  {
    "path": "source/_posts/fortnite.md",
    "content": "---\ntitle: Fortnite\ndate: 2022-11-23 16:23:31.699229\nbackground: bg-[#8d2fc9]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 26 default keyboard shortcuts found in Fortnite\n---\n\n## Keyboard Shortcuts\n\n### Main Controls\n\n| Shortcut     | Action                                    |\n| ------------ | ----------------------------------------- |\n| `R`          | Reload                                    |\n| `Q`          | Switch between combat mode and build mode |\n| `Space`      | Jump                                      |\n| `Left Ctrl`  | Crouch                                    |\n| `Left Shift` | Sprint                                    |\n| `=`          | Auto run                                  |\n| `W`          | Move forward                              |\n| `S`          | Move backwards                            |\n| `A`          | Move left                                 |\n| `D`          | Move right                                |\n| `M`          | Toggle map                                |\n| `Tab`        | Toggle inventory                          |\n| `E`          | Use or interact with object               |\n| `F`          | Select pickaxe                            |\n| `1-5`        | Select weapon slot 1-5                    |\n\n{.shortcuts}\n\n### Building\n\n| Shortcut | Action                                                  |\n| -------- | ------------------------------------------------------- |\n| `R`      | Rotate building piece                                   |\n| `Z`      | Wall mode                                               |\n| `X`      | Floor mode                                              |\n| `C`      | Stair mode                                              |\n| `V`      | Pyramid mode                                            |\n| `Y`      | Trap mode                                               |\n| `F3`     | Select trap                                             |\n| `H`      | Upgrade building piece of repair damaged building piece |\n| `G`      | Edit building piece                                     |\n\n{.shortcuts}\n\n### Communication\n\n| Shortcut | Action |\n| -------- | ------ |\n| `Enter`  | Chat   |\n| `B`      | Emote  |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Fortnite](https://fortnite.gamepedia.com/Controls) _(fortnite.gamepedia.com)_\n"
  },
  {
    "path": "source/_posts/framer-x.md",
    "content": "---\ntitle: Framer X\ndate: 2022-11-23 16:23:31.701096\nbackground: bg-[#2151ed]\nlabel: Mac\ntags:\n  -\n  - mac\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 45 keyboard shortcuts found in Framer X. This application is MacOS-only.\n---\n\n## Keyboard Shortcuts\n\n### Tools\n\n| Shortcut | Action     |\n| -------- | ---------- |\n| `F`      | Frame      |\n| `U`      | Round      |\n| `T`      | Text       |\n| `S`      | Stack      |\n| `L`      | Link       |\n| `Space`  | Pan Canvas |\n\n{.shortcuts}\n\n### Graphics\n\n| Shortcut          | Action    |\n| ----------------- | --------- |\n| `G`               | Graphic   |\n| `P`               | Path      |\n| `R`               | Rectangle |\n| `O`               | Oval      |\n| `V`               | Vector    |\n| `Cmd` `G`         | Group     |\n| `Cmd` `Shift` `G` | Ungroup   |\n\n{.shortcuts}\n\n### Layout\n\n| Shortcut            | Action         |\n| ------------------- | -------------- |\n| `Cmd` `Enter`       | Add Frame      |\n| `Cmd` `Opt` `Enter` | Add Stack      |\n| `Cmd` `Del`         | Remove Wrapper |\n| `Cmd` `Opt` `Up`    | Move Forward   |\n| `Cmd` `Opt` `Down`  | Move Backward  |\n\n{.shortcuts}\n\n### Components\n\n| Shortcut          | Action             |\n| ----------------- | ------------------ |\n| `Cmd` `K`         | Create from Design |\n| `Cmd` `Shift` `K` | Create from Code   |\n\n{.shortcuts}\n\n### Text\n\n| Shortcut  | Action          |\n| --------- | --------------- |\n| `Cmd` `B` | Bold            |\n| `Cmd` `I` | Italic          |\n| `Cmd` `U` | Underline       |\n| `Cmd` `T` | Select Typeface |\n\n{.shortcuts}\n\n### Editing\n\n| Shortcut                 | Action              |\n| ------------------------ | ------------------- |\n| `Cmd` `(arrows)`         | Object Size         |\n| `Cmd` `Shift` `(arrows)` | Object Size by 10px |\n| `0-9`                    | Opacity             |\n| `Opt`                    | Show Distance       |\n| `Cmd` `D`                | Duplicate in Place  |\n| `Cmd` `Opt` `C`          | Copy Style          |\n| `Cmd` `Opt` `V`          | Paste Style         |\n| `Ctrl` `C`               | Color Picker        |\n| `Cmd` `A`                | Select All Layers   |\n| `Cmd` `Shift` `A`        | Select All Siblings |\n| `Cmd` `Opt` `A`          | Select All Children |\n\n{.shortcuts}\n\n### View\n\n| Shortcut   | Action                |\n| ---------- | --------------------- |\n| `Z`        | Zoom                  |\n| `Cmd` `+`  | Zoom In               |\n| `Cmd` `-`  | Zoom Out              |\n| `Cmd` `1`  | Zoom to Fit           |\n| `Cmd` `2`  | Zoom to Fit Selection |\n| `Cmd` `0`  | Zoom to 100%          |\n| `Ctrl` `R` | Show Rulers           |\n\n{.shortcuts}\n\n### Window\n\n| Shortcut          | Action   |\n| ----------------- | -------- |\n| `Cmd` `M`         | Minimize |\n| `Cmd` `Shift` `1` | Welcome  |\n| `Cmd` `P`         | Preview  |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Framer X](https://www.framer.com/support/using-framer-x/shortcuts/) _(www.framer.com)_\n"
  },
  {
    "path": "source/_posts/gimp.md",
    "content": "---\ntitle: GIMP\ndate: 2022-11-23 16:23:31.696743\nbackground: bg-[#554f42]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 97 keyboard shortcuts found in GIMP\n---\n\n## Keyboard Shortcuts\n\n### Toolbox {.row-span-2}\n\n| Shortcut    | Action           |\n| ----------- | ---------------- |\n| `R`         | Rectangle select |\n| `E`         | Ellipse select   |\n| `F`         | Free select      |\n| `U`         | Fuzzy select     |\n| `Shift` `O` | Select by color  |\n| `I`         | Scissors         |\n| `B`         | Paths            |\n| `O`         | Color picker     |\n| `M`         | Move             |\n| `Shift` `C` | Crop and resize  |\n| `Shift` `R` | Rotate           |\n| `Shift` `T` | Scale            |\n| `Shift` `S` | Shear            |\n| `Shift` `P` | Perspective      |\n| `Shift` `F` | Flip             |\n| `T`         | Text             |\n| `Shift` `B` | Bucket fill      |\n| `L`         | Blend            |\n| `N`         | Pencil           |\n| `P`         | Paintbrush       |\n| `Shift` `E` | Eraser           |\n| `A`         | Airbrush         |\n| `K`         | Ink              |\n| `C`         | Clone            |\n| `V`         | Convolve         |\n| `S`         | Smudge           |\n| `Shift` `D` | Dodge or burn    |\n| `X`         | Swap colors      |\n| `D`         | Default colors   |\n\n{.shortcuts}\n\n### File\n\n| Shortcut         | Action                      |\n| ---------------- | --------------------------- |\n| `Ctrl` `N`       | New image                   |\n| `Ctrl` `O`       | Open image                  |\n| `Ctrl` `Alt` `N` | Open image as new layer     |\n| `Ctrl` `D`       | Duplicate image             |\n| `Ctrl` `1-0`     | Open recent image 1-10      |\n| `Ctrl` `S`       | Save image                  |\n| `Ctrl` `S`       | Save image under a new name |\n| `Ctrl` `Q`       | Quit                        |\n\n{.shortcuts}\n\n### Dialogs\n\n| Shortcut            | Action                              |\n| ------------------- | ----------------------------------- |\n| `Ctrl` `L`          | Layers                              |\n| `Ctrl` `Shift` `B`  | Brushes                             |\n| `Ctrl` `Shift` `P`  | Patterns                            |\n| `Ctrl` `G`          | Gradients                           |\n| `Ctrl` `Shift` `T`  | Tool options                        |\n| `Ctrl` `P`          | Palettes                            |\n| `Ctrl` `Shift` `I`  | Info window                         |\n| `Ctrl` `Shift` `N`  | Navigation window                   |\n| `Tab`               | Jump to next widget                 |\n| `Shift` `Tab`       | Jump to previous widget             |\n| `Enter`             | Set the new value                   |\n| `Space`             | Activate the current button or list |\n| `Ctrl` `Alt` `PgUp` | In a multi-tab dialog, switch tabs  |\n| `Shift` `L`         | Open location                       |\n| `Alt` `Up`          | Up folder                           |\n| `Alt` `Down`        | Down folder                         |\n| `Alt` `Home`        | Home folder                         |\n| `Esc`               | Close dialog                        |\n\n{.shortcuts}\n\n### View\n\n| Shortcut           | Action                |\n| ------------------ | --------------------- |\n| `F10`              | Main menu             |\n| `Shift` `F10`      | Drop-down menu        |\n| `F11`              | Toggle fullscreen     |\n| `Shift` `Q`        | Toggle quickmask      |\n| `Ctrl` `W`         | Close document window |\n| `+`                | Zoom in               |\n| `-`                | Zoom out              |\n| `1`                | Zoom 1:1              |\n| `Ctrl` `E`         | Shrink wrap           |\n| `Ctrl` `Shift` `E` | Fit image in window   |\n| `Ctrl` `Shift` `R` | Toggle rulers         |\n| `Ctrl` `Shift` `T` | Toggle guides         |\n\n{.shortcuts}\n\n### Layers\n\n| Shortcut   | Action                 |\n| ---------- | ---------------------- |\n| `PgUp`     | Select the layer above |\n| `PgDn`     | Select the layer below |\n| `Home`     | Select the first layer |\n| `End`      | Select the last layer  |\n| `Ctrl` `M` | Merge visible layers   |\n| `Ctrl` `H` | Anchor layer           |\n\n{.shortcuts}\n\n### Edit {.row-span-2}\n\n| Shortcut           | Action                     |\n| ------------------ | -------------------------- |\n| `Ctrl` `Z`         | Undo                       |\n| `Ctrl` `Y`         | Redo                       |\n| `Ctrl` `C`         | Copy selection             |\n| `Ctrl` `X`         | Cut selection              |\n| `Ctrl` `Shift` `C` | Copy visible               |\n| `Ctrl` `Shift` `V` | Paste as new image         |\n| `Ctrl` `V`         | Paste clipboard            |\n| `Ctrl` `K`         | Clears selection           |\n| `Ctrl` `Shift` `C` | Named copy selection       |\n| `Ctrl` `Shift` `X` | Named cut selection        |\n| `Ctrl` `Shift` `V` | Named paste clipboard      |\n| `Ctrl` `,`         | Fill with foreground color |\n| `Ctrl` `.`         | Fill with background color |\n| `Ctrl` `;`         | Fill with pattern          |\n\n{.shortcuts}\n\n### Selections\n\n| Shortcut           | Action            |\n| ------------------ | ----------------- |\n| `Ctrl` `T`         | Toggle selections |\n| `Ctrl` `A`         | Select all        |\n| `Ctrl` `Shift` `A` | Select none       |\n| `Ctrl` `I`         | Invert selection  |\n| `Ctrl` `Shift` `L` | Float selection   |\n| `Shift` `V`        | Path to selection |\n\n{.shortcuts}\n\n### Plug-Ins\n\n| Shortcut           | Action              |\n| ------------------ | ------------------- |\n| `Ctrl` `F`         | Repeat last plug-in |\n| `Ctrl` `Shift` `F` | Reshow last plug-in |\n\n{.shortcuts}\n\n### Help\n\n| Shortcut     | Action       |\n| ------------ | ------------ |\n| `F1`         | Help         |\n| `Shift` `F1` | Context help |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for GIMP](https://www.gimpusers.com/gimp/hotkeys) _(www.gimpusers.com)_\n"
  },
  {
    "path": "source/_posts/git.md",
    "content": "---\ntitle: Git\ndate: 2020-11-25 18:28:43\nbackground: bg-[#d7593e]\ntags:\n  - github\n  - gitlab\n  - version\n  - VCS\ncategories:\n  - Linux Command\nintro: This cheat sheet summarizes commonly used Git command line instructions for quick reference.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Create a Repository\n\nCreate a new local repository\n\n```shell script\n$ git init [project name]\n```\n\nClone a repository\n\n```shell script\n$ git clone git_url\n```\n\nClone a repository into a specified directory\n\n```shell script\n$ git clone git_url my_directory\n```\n\n### Make a change {.row-span-2}\n\nShow modified files in working directory, staged for your next commit\n\n```shell script\n$ git status\n```\n\nStages the file, ready for commit\n\n```shell script\n$ git add [file]\n```\n\nStage all changed files, ready for commit\n\n```shell script\n$ git add .\n```\n\nCommit all staged files to version history\n\n```shell script\n$ git commit -m \"commit message\"\n```\n\nCommit all your tracked files to version history\n\n```shell script\n$ git commit -am \"commit message\"\n```\n\nDiscard changes in working directory which is not staged\n\n```shell script\n$ git restore [file]\n```\n\nUnstage a staged file or file which is staged\n\n```shell script\n$ git restore --staged [file]\n```\n\nUnstage a file, keeping the file changes\n\n```shell script\n$ git reset [file]\n```\n\nRevert everything to the last commit\n\n```shell script\n$ git reset --hard\n```\n\nDiff of what is changed but not staged\n\n```shell script\n$ git diff\n```\n\nDiff of what is staged but not yet committed\n\n```shell script\n$ git diff --staged\n```\n\nApply any commits of current branch ahead of specified one\n\n```shell script\n$ git rebase [branch]\n```\n\n### Configuration\n\nSet the name that will be attached to your commits and tags\n\n```shell script\n$ git config --global user.name \"name\"\n```\n\nSet an email address that will be attached to your commits and tags\n\n```shell script\n$ git config --global user.email \"email\"\n```\n\nEnable some colorization of Git output\n\n```shell script\n$ git config --global color.ui auto\n```\n\nEdit the global configuration file in a text editor\n\n```shell script\n$ git config --global --edit\n```\n\n### Working with Branches\n\nList all local branches\n\n```shell script\n$ git branch\n```\n\nList all branches, local and remote\n\n```shell script\n$ git branch -av\n```\n\nSwitch to my_branch, and update working directory\n\n```shell script\n$ git checkout my_branch\n```\n\nCreate a new branch called new_branch\n\n```shell script\n$ git checkout -b new_branch\n```\n\nDelete the branch called my_branch\n\n```shell script\n$ git branch -d my_branch\n```\n\nMerge branchA into branchB\n\n```shell script\n$ git checkout branchB\n$ git merge branchA\n```\n\nTag the current commit\n\n```shell script\n$ git tag my_tag\n```\n\n### Observe your Repository\n\nShow the commit history for the currently active branch\n\n```shell script\n$ git log\n```\n\nShow the commits on branchA that are not on branchB\n\n```shell script\n$ git log branchB..branchA\n```\n\nShow the commits that changed file, even across renames\n\n```shell script\n$ git log --follow [file]\n```\n\nShow the diff of what is in branchA that is not in branchB\n\n```shell script\n$ git diff branchB...branchA\n```\n\nShow any object in Git in human-readable format\n\n```shell script\n$ git show [SHA]\n```\n\n### Synchronize\n\nFetch down all the branches from that Git remote\n\n```shell script\n$ git fetch [alias]\n```\n\nMerge a remote branch into your current branch to bring it up to date\n\n```shell script\n$ git merge [alias]/[branch]\n# No fast-forward\n$ git merge --no-ff [alias]/[branch]\n# Only fast-forward\n$ git merge --ff-only [alias]/[branch]\n```\n\nTransmit local branch commits to the remote repository branch\n\n```shell script\n$ git push [alias] [branch]\n```\n\nFetch and merge any commits from the tracking remote branch\n\n```shell script\n$ git pull\n```\n\nMerge just one specific commit from another branch to your current branch\n\n```shell script\n$ git cherry-pick [commit_id]\n```\n\n### Remote\n\nAdd a git URL as an alias\n\n```shell script\n$ git remote add [alias] [url]\n```\n\nShow the names of the remote repositories you've set up\n\n```shell script\n$ git remote\n```\n\nShow the names and URLs of the remote repositories\n\n```shell script\n$ git remote -v\n```\n\nRemove a remote repository\n\n```shell script\n$ git remote rm [remote repo name]\n```\n\nChange the URL of the git repo\n\n```shell script\n$ git remote set-url origin [git_url]\n```\n\n### Temporary Commits\n\nSave modified and staged changes\n\n```shell script\n$ git stash\n```\n\nList stack-order of stashed file changes\n\n```shell script\n$ git stash list\n```\n\nWrite working from top of stash stack\n\n```shell script\n$ git stash pop\n```\n\nDiscard the changes from top of stash stack\n\n```shell script\n$ git stash drop\n```\n\n### Tracking path Changes\n\nDelete the file from project and stage the removal for commit\n\n```shell script\n$ git rm [file]\n```\n\nChange an existing file path and stage the move\n\n```shell script\n$ git mv [existing-path] [new-path]\n```\n\nShow all commit logs with indication of any paths that moved\n\n```shell script\n$ git log --stat -M\n```\n\n### Ignoring Files\n\n```\n/logs/*\n\n# \"!\" means don't ignore\n!logs/.gitkeep\n\n/# Ignore Mac system files\n.DS_store\n\n# Ignore node_modules folder\nnode_modules\n\n# Ignore SASS config files\n.sass-cache\n```\n\nA `.gitignore` file specifies intentionally untracked files that Git should ignore\n\n## Git Tricks\n\n### Rename branch\n\n- #### **Renamed** to `new_name`\n  ```shell script\n  $ git branch -m <new_name>\n  ```\n- #### **Push** and reset\n  ```shell script\n  $ git push origin -u <new_name>\n  ```\n- #### **Delete** remote branch\n  ```shell script\n  $ git push origin --delete <old>\n  ```\n  {.marker-timeline}\n\n### Log\n\nSearch change by content\n\n```shell script\n$ git log -S'<a term in the source>'\n```\n\nShow changes over time for specific file\n\n```shell script\n$ git log -p <file_name>\n```\n\nPrint out a cool visualization of your log\n\n```shell script {.wrap}\n$ git log --pretty=oneline --graph --decorate --all\n```\n\nList files changed in a commit \n\n```shell script\n$ git log --name-only <commit-id>\n```\n\nList files changed in commits excluding merges\n\n```shell script\n$ git log --no-merges --name-only\n```\n\nLimit commits to the last N entries \n\n```shell script\n$ git log -<number>\n```\n\nLimit commits to the last N entries (alternate syntax) \n\n```shell script\n$ git log -n <number>\n```\n\nLimit commits to a maximum of N entries \n\n```shell script\n$ git log --max-count=<number>\n```\n\nShow commits more recent than a specific date \n\n```shell script\n$ git log --after=\"YYYY-MM-DD HH:MM:SS ±HHMM\"\n```\n\nShow commits older than a specific date \n\n```shell script\n$ git log --before=\"YYYY-MM-DD HH:MM:SS ±HHMM\"\n```\n\nFilter commits by author matching a pattern \n\n```shell script\n$ git log --author=<pattern>\n```\n\nFilter commits by commit message matching a pattern \n\n```shell script\n$ git log --grep=<pattern>\n```\n\nShow commit graph of the current branch with reference decorations\n\n```shell script\n$ git log --graph --decorate\n```\n\nShow commit graph of a specific branch without switching to it\n\n```shell script\n$ git log --graph --decorate <branch>\n```\n\nShow commit graph for commits in one branch not in another\n\n```shell script\n$ git log --graph --decorate <branchB>..<branchA>\n```\n\nShow commit graph of all branches\n\n```shell script\n$ git log --graph --decorate --all\n```\n\n### Branch {.row-span-2}\n\nList all branches and their upstreams\n\n```shell script\n$ git branch -vv\n```\n\nQuickly switch to the previous branch\n\n```shell script\n$ git checkout -\n```\n\nGet only remote branches\n\n```shell script\n$ git branch -r\n```\n\nCheckout a single file from another branch\n\n```shell script\n$ git checkout <branch> -- <file>\n```\n\n### Rewriting history\n\nRewrite last commit message\n\n```shell script\n$ git commit --amend -m \"new message\"\n```\n\nAmend the latest commit without changing the commit message.\n\n```shell script\n$ git commit --amend --no-edit\n```\n\nSee also: [Rewriting history](https://www.atlassian.com/git/tutorials/rewriting-history)\n\n### Git Aliases\n\n```cmd\ngit config --global alias.co checkout\ngit config --global alias.br branch\ngit config --global alias.ci commit\ngit config --global alias.st status\n```\n\nSee also: [More Aliases](https://gist.github.com/johnpolacek/69604a1f6861129ef088)\n\n## Advanced Git\n\n### Worktrees\n\nCreate a new working tree at the specified path. If a branch is specified, it checks out that branch. If no branch is given, a new one is created based on HEAD and named after the new directory.\n\n```shell script\n$ git worktree add <path> [<branch>]\n```\n\nList all of the active working trees associated with the repository.\n\n```shell script\n$ git worktree list\n```\n\nRemove the specified working tree.\n\n```shell script\n$ git worktree remove <path>\n```\n\nClean up stale or manually deleted working trees.\n\n```shell script\n$ git worktree prune\n```\n\nRelocate the working tree to a new path.\n\n```shell script\n$  git worktree move <old_path> <new_path>\n```\n\n### Submodules\n\nCreate a new submodule within your repository:\n\n```shell script\n$ git submodule add <repository_url> <path>\n```\n\nClone a repository and initialize its submodules:\n\n```shell script\n$ git clone --recursive <repository_url>\n```\n\nUpdate all the submodules in your repository to the latest commit of their respective branches:\n\n```shell script\n$ git submodule update\n```\n\nPull the latest changes from the remote repositories of the submodules and update them in your main repository:\n\n```shell script\n$ git submodule update --remote\n```\n\nRemove a submodule from your repository:\n\n```shell script\n$ git submodule deinit <path>\n$ git rm <path>\n$ git commit -m \"Removed submodule\"\n```\n\n### Cherry-picking\n\nCherry-picking allows you to apply a specific commit from one branch to another branch.\n\n```shell script\n$ git cherry-pick <commit_hash>\n```\n\n### Reflog\n\nDisplay the reflog, showing the history of HEAD and branch movements:\n\n```shell script\n$ git reflog\n```\n\nFind the hash of the lost commit or branch using the reflog and then checkout to that hash to restore it:\n\n```shell script\n$ git checkout <commit_or_branch_hash>\n```\n"
  },
  {
    "path": "source/_posts/github-actions.md",
    "content": "---\ntitle: Github Actions\ndate: 2023-11-28\nicon:\nbackground: bg-[#808080]\ntags:\n  - Github\n  - CICD\ncategories:\n  - Toolkit\nintro:\n  A quick reference to Github Actions for the automation of software workflows, allowing developers to build, test, and\n  deploy code right from their GitHub repositories.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Introduction\n\n[GitHub Actions](https://docs.github.com/en/actions) is a CI/CD platform that enables automation of software workflows,\nallowing developers to build, test, and deploy code right from their GitHub repositories.\n\n---\n\n### Workflow Files\n\nGithub Action Workflows are defined in special YAML files, typically stored in a `.github/workflows` directory in the\ngithub repository.\n\n```yaml\nname: hello-world\non: push\njobs:\n  hello-world-job:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Hello World\n        run: echo \"Hello World!\"\n```\n\n**Viewing your workflow runs**\n\n- On GitHub.com, navigate to the main page of the repository.\n- Under your repository name, click `Actions`.\n- In the left sidebar, click the workflow you want to display, in this example \"hello-world\"\n\n---\n\n### Workflow Syntax\n\n```yaml\nname: learn-github-actions\nrun-name: ${{ github.actor }} is learning GitHub Actions\non: [push]\njobs:\n  check-bats-version:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v3\n        with:\n          node-version: '14'\n      - run: npm install -g bats\n      - run: bats -v\n```\n\n### Workflow Syntax Descriptions\n\n| Line                  | Description                                                                                                                                                                   |\n| :-------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `name:`               | Sets the name of the GitHub Actions workflow. It's a label used for identifying the workflow in the repository.                                                               |\n| `run-name:`           | Sets a custom name for the run, using a GitHub context `${{ github.actor }}` to include the name of the user who initiated the run.                                           |\n| `on:`                 | Specifies the event that triggers the workflow. In this case, the workflow is triggered on any `push` event to the repository.                                                |\n| `jobs:`               | Defines a group of jobs that will be executed as part of the workflow. Each job runs independently in the workflow.                                                           |\n| `check-bats-version:` | Identifier for a specific job within the workflow. This job is named `check-bats-version`.                                                                                    |\n| `runs-on:`            | Specifies the type of machine to run the job on. Here, it's set to run on the latest version of Ubuntu.                                                                       |\n| `steps:`              | Contains a sequence of tasks (steps) that will be executed as part of the job.                                                                                                |\n| `uses:`               | Used to specify an action to include as part of a step. For example, `actions/checkout@v4` checks out the repository, and `actions/setup-node@v3` sets up a Node environment. |\n| `with:`               | Specifies additional parameters for the action. It's used in conjunction with `uses` to configure the action.                                                                 |\n| `node-version:`       | Contains parameter under `with`, specifying the version of Node.js to be set up by the `setup-node` action. In this case, it's set to version '14'.                           |\n\n### Events\n\n```yaml\nname: Event-trigger-on-push-example\n\non: [push] # event is defined here\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - name: Run a script\n        run: echo \"This workflow runs on every push to the repository.\"\n```\n\n**Event Triggers**\n\n| Event Name                    | Description                                     |\n| :---------------------------- | :---------------------------------------------- |\n| `push`                        | Triggers on a push to the repository.           |\n| `pull_request`                | Triggers on pull request events.                |\n| `pull_request_review`         | Triggers on pull request review events.         |\n| `pull_request_review_comment` | Triggers on comments on pull request reviews.   |\n| `pull_request_target`         | For workflows in forked repositories.           |\n| `fork`                        | Triggers when a repository is forked.           |\n| `issue_comment`               | Triggers on issue and PR comments.              |\n| `issues`                      | Triggers on issue events.                       |\n| `label`                       | Triggers on label events.                       |\n| `milestone`                   | Triggers on milestone events.                   |\n| `deployment`                  | Triggers on deployment.                         |\n| `deployment_status`           | Triggers on deployment status updates.          |\n| `public`                      | Triggers when repo goes from private to public. |\n| `repository_dispatch`         | Triggers on a custom repository event.          |\n| `schedule`                    | Triggers on a defined schedule.                 |\n| `workflow_dispatch`           | Allows manual triggering of the workflow.       |\n| `workflow_run`                | Triggers on the completion of another workflow. |\n| `create`                      | Triggers when a branch or tag is created.       |\n| `delete`                      | Triggers when a branch or tag is deleted.       |\n| `page_build`                  | Triggers on GitHub Pages build events.          |\n| `release`                     | Triggers on release events.                     |\n| `watch`                       | Triggers when someone stars the repo.           |\n| `registry_package`            | Triggers on registry package events.            |\n| `status`                      | Triggers on status updates to a Git commit.     |\n| `project`                     | Triggers on project board events.               |\n| `project_card`                | Triggers on project card events.                |\n| `project_column`              | Triggers on project column events.              |\n| `member`                      | Triggers on collaborator events.                |\n| `gollum`                      | Triggers on wiki page updates.                  |\n\n### Jobs\n\nSingle Job:\n\n```yaml\nname: Single Job\non: [push]\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - name: Run a build script\n        run: script/build\n```\n\nMultiple Jobs:\n\n```yaml\nname: CI Workflow\n\non: [push]\n\njobs:\n  job-1:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - name: Runs job 1\n        run: echo \"Running Job 1\"\n\n  job-2:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - name: Runs job 2\n        run: echo \"Running Job 2\"\n\n  job-3:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - name: Runs job 3\n        run: echo \"Running Job 3\"\n```\n\n### Steps\n\n```yaml\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      # step 1\n      - name: Check out repository\n        uses: actions/checkout@v2\n\n      # step 2\n      - name: Set up Node.js\n        uses: actions/setup-node@v2\n        with:\n          node-version: '14'\n\n      # step 3\n      - name: Install dependencies\n        run: npm install\n\n      # step 4\n      - name: Run tests\n        run: npm test\n```\n\n### Github Runners & Self Hosted Runners\n\n[Github Hosted Runner](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners):\n\n```yaml\nname: Workflow\non: [push]\njobs:\n  build:\n    runs-on: ubuntu-latest # default runner\n    steps:\n      - uses: actions/checkout@v2\n      - name: Run a script\n        run: echo \"Hello, world!\"\n```\n\n[Self Hosted Runner](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners)\n\n```yaml\nname: Workflow with Self-Hosted Runner\non: [push]\njobs:\n  build:\n    runs-on: self-hosted\n    steps:\n      - uses: actions/checkout@v2\n      - name: Run a script\n        run: echo \"Hello from self-hosted runner!\"\n```\n\n### Environment Variables\n\nCustom variable defined using environments.\n\n```yaml\njobs:\n  build:\n    runs-on: ubuntu-latest\n    env:\n      CUSTOM_VARIABLE: 'Hello, World!' # Custom variable defined using env:\n    steps:\n      - name: Check environment variable\n        run: echo \"Value of CUSTOM_VAR is $CUSTOM_VAR\"\n```\n\n### Secrets\n\nTo add a new secret in your github repository nagivate to `Repository` > `Settings` > `Security` >\n`Secrets and Variables` > `Actions` > `New Repository Secret`\n\nExample Secrets workflow:\n\n```yaml\nname: Workflow with Secrets\n\non: [push]\n\njobs:\n  example_job:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout repository\n        uses: actions/checkout@v2\n      - name: Use a secret\n        run: echo \"The secret is ${{ secrets.MY_SECRET }}\"\n```\n\n### Artifacts\n\nTo access your artifact navigate to `Repository` > `Actions` > `Workflow Run` > `Artifacts`\n\n```yaml\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Build project\n        run: make build\n      - name: Upload build artifact\n        uses: actions/upload-artifact@v3 # upload Artifacts prebuilt action\n        with:\n          name: my-artifact\n          path: path/to/artifact\n```\n\n### Caching Dependencies\n\nDependency caches stores downloaded packages or compiled binaries of your workflows.\n\n```yaml\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - name: Cache dependencies\n        uses: actions/cache@v2 # stores downloaded packages or compiled binaries\n        with:\n          path: |\n            path/to/dependencies\n            another/path\n          key: ${{ runner.os }}-deps-${{ hashFiles('**/lockfile') }} # hash of the dependency lock file is generated in the OS\n      - name: Install dependencies\n        run: install-command\n```\n\n### Matrix Strategies\n\n```yaml\njobs:\n  build:\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        node-version: [12.x, 14.x, 16.x]\n        # matrix strategy runs enables you to run jobs across multiple combinations of environments and OS's\n        os: [ubuntu-latest, windows-latest, macOS-latest]\n    steps:\n      - uses: actions/checkout@v2\n      - name: Use Node.js ${{ matrix.node-version }}\n        uses: actions/setup-node@v1\n        with:\n          node-version: ${{ matrix.node-version }}\n      - run: npm install\n      - run: npm test\n        env:\n          CI: true\n```\n\n### Conditions and Expressions\n\nBranch Conditions:\n\n```yaml\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v2\n      - name: Run build\n        if: github.ref == 'refs/heads/main' # \"Run build\" step will only execute if the current branch is main.\n        run: make build\n```\n\nEvent Trigger Conditions:\n\n```yaml\njobs:\n  test:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v2\n      - name: Run tests\n        if: github.event_name == 'pull_request' # \"Run tests\" step is executed only when the workflow is triggered by a pull request event\n        run: npm test\n```\n\n### Workflow Commands\n\nDepending on your OS, if you are running ubuntu-latest, bash commands should work\n\n```yaml\nsteps:\n  - name: Set environment variable\n    run: echo \"NAME=value\" >> $GITHUB_ENV\n```\n\n### Concurrency\n\nThe concurrency field creates a group based on the `github.head_ref`. If a new run starts within the same concurrency\ngroup, it cancels any in-progress runs.\n\n```yaml\njobs:\n  my_job:\n    runs-on: ubuntu-latest\n    concurrency:\n      group: ${{ github.head_ref }}\n      cancel-in-progress: true\n    steps:\n      - name: Run a script\n        run: echo \"Running script...\"\n```\n\n## Also see\n\n- [YAML](/yaml) _(cheatsheets.zip)_\n- [Github](/github) _(cheatsheets.zip)_\n- [Github Actions Documentation](https://docs.github.com/en/actions)_(docs.github.com/en/actions)_\n"
  },
  {
    "path": "source/_posts/github-cli.md",
    "content": "---\ntitle: Github CLI\ndate: 2023-11-29\nicon:\nbackground: bg-[#808080]\ntags:\n  - Github\n  - CICD\n  - CLI\ncategories:\n  - Toolkit\nintro: A quick reference to Github CLI, an open-source command line tool that enables GitHub on your terminal.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Installation\n\n**Windows**\n\n| Tool   | Install                          | Upgrade                          |\n| :----- | :------------------------------- | :------------------------------- |\n| WinGet | `winget install --id Github.cli` | `winget upgrade --id GitHub.cli` |\n| Scoop  | `scoop install gh`               | `scoop update gh`                |\n| Choco  | `choco install gh`               | `choco upgrade gh`               |\n\n{.show-header}\n\n**Mac OS**\n\n| Tool     | Install                | Upgrade                                        |\n| :------- | :--------------------- | :--------------------------------------------- |\n| Brew     | `brew install gh`      | `brew upgrade gh`                              |\n| MacPorts | `sudo port install gh` | `sudo port selfupdate && sudo port upgrade gh` |\n\n{.show-header}\n\n**Linux**\n\nSee the [install instructions](https://github.com/cli/cli/blob/trunk/docs/install_linux.md) for other Linux\ndistributions.\n\nInstallation Script:\n\n```bash\ntype -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)\ncurl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \\\n&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \\\n&& echo \"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main\" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \\\n&& sudo apt update \\\n&& sudo apt install gh -y\n```\n\n---\n\n### Basic Usage\n\n**Help and Documentation**\n\nDisplay command options:\n\n| Command             | Description                                                                                                    |\n| :------------------ | :------------------------------------------------------------------------------------------------------------- |\n| `gh help [command]` | Help provides help for any command in the application. Simply type gh help [path to command] for full details. |\n\n**Authentication**\n\n| Command             | Description                                                       |\n| :------------------ | :---------------------------------------------------------------- |\n| `gh auth login`     | Default authentication with web-based browser                     |\n| `gh auth logout`    | Removes the authentication configuration for a host               |\n| `gh auth refresh`   | Expand or fix the permission scopes for stored credentials        |\n| `gh auth setup-git` | Configures git to use GitHub CLI as a credential helper           |\n| `gh auth status`    | Verifies and displays information about your authentication state |\n| `gh auth token`     | Print the auth token gh is configured to use                      |\n\nWith Github token:\n\n```shell\n$ gh auth --with-token < token.txt\n```\n\n### Repository Management\n\n**General**\n\n| Command                 | Description                                       |\n| :---------------------- | :------------------------------------------------ |\n| `gh repo create`        | Create a new GitHub repository                    |\n| `gh repo list [target]` | List repositories owned by a user or organization |\n\n**Targets**\n\n| Command                      | Description                                                    |\n| :--------------------------- | :------------------------------------------------------------- |\n| `gh repo archive [repo]`     | Archive a GitHub repository                                    |\n| `gh repo clone [dir]`        | Clone a GitHub repository locally                              |\n| `gh repo delete [repo]`      | Delete a GitHub repository                                     |\n| `gh repo deploy-key`         | Manage deploy keys in a repository                             |\n| `gh repo edit [repo]`        | Edit repository settings                                       |\n| `gh repo fork [repo]`        | Create a fork of a repository                                  |\n| `gh repo rename [name]`      | Rename a GitHub repository                                     |\n| `gh repo set-default [repo]` | This command sets the default remote repository                |\n| `gh repo sync [dest-repo]`   | Sync destination repository from source repository             |\n| `gh repo view [repo]`        | Display the description and the README of a GitHub repository. |\n\n### Issues\n\n**Search Issues**\n\n| Command                    | Description                 |\n| :------------------------- | :-------------------------- |\n| `gh search issues [query]` | Search for issues on GitHub |\n\n**Examples**\n\n```bash\n# search issues matching set of keywords \"readme\" and \"typo\"\n$ gh search issues readme typo\n\n# search issues matching phrase \"broken feature\"\n$ gh search issues \"broken feature\"\n\n# search issues and pull requests in cli organization\n$ gh search issues --include-prs --owner=cli\n\n# search open issues assigned to yourself\n$ gh search issues --assignee=@me --state=open\n\n# search issues with numerous comments\n$ gh search issues --comments=\">100\"\n\n# search issues without label \"bug\"\n$ gh search issues -- -label:bug\n```\n\n### Pull Requests\n\n**Pull Request Actions**\n\n| Command        | Description                               |\n| :------------- | :---------------------------------------- |\n| `gh pr create` | Create a pull request on GitHub           |\n| `gh pr list`   | List pull requests in a GitHub repository |\n| `gh pr status` | Show status of relevant pull requests     |\n\n**Example**\n\n```shell\n$ gh pr status\n```\n\nSample Output:\n\n```\nCurrent branch\n  #12 Remove the test feature [user:patch-2]\n   - All checks failing - Review required\n\nCreated by you\n  You have no open pull requests\n\nRequesting a code review from you\n  #13 Fix tests [branch]\n  - 3/4 checks failing - Review required\n  #15 New feature [branch]\n   - Checks passing - Approved\n```\n\n### Github Actions\n\n**General Actions**\n\n| Command               | Description                                                                         |\n| :-------------------- | :---------------------------------------------------------------------------------- |\n| `gh workflow disable` | Disable a workflow, preventing it from running or showing up when listing workflows |\n| `gh workflow enable`  | Enable a workflow, allowing it to be run and show up when listing workflows         |\n| `gh workflow list`    | List workflow files, hiding disabled workflows by default                           |\n| `gh workflow run`     | Create a workflow_dispatch event for a given workflow                               |\n| `gh workflow view`    | View the summary of a workflow                                                      |\n\n**Running Actions**\n\n| Command           | Description                                                         |\n| :---------------- | :------------------------------------------------------------------ |\n| `gh run cancel`   | Cancel a workflow run                                               |\n| `gh run delete`   | Delete a workflow run                                               |\n| `gh run download` | Download artifacts generated by a GitHub Actions workflow run       |\n| `gh run list`     | List recent workflow runs                                           |\n| `gh run rerun`    | Rerun an entire run, only failed jobs, or a specific job from a run |\n| `gh run view`     | View a summary of a workflow run                                    |\n| `gh run watch`    | Watch a run until it completes, showing its progress                |\n\n### Aliases\n\n**General Alias Settings**\n\n| Command           | Description                                                      |\n| :---------------- | :--------------------------------------------------------------- |\n| `gh alias delete` | Delete set aliases                                               |\n| `gh alias import` | Import aliases from the contents of a YAML file                  |\n| `gh alias list`   | Prints out all of the aliases gh is configured to use            |\n| `gh alias set`    | Define a word that will expand to a full gh command when invoked |\n\n### Releases\n\n**General Actions**\n\n| Command             | Description                                  |\n| :------------------ | :------------------------------------------- |\n| `gh release create` | Create a new GitHub Release for a repository |\n| `gh release list`   | List releases in a repository                |\n\n**Target Commands**\n\n| Command                   | Description                             |\n| :------------------------ | :-------------------------------------- |\n| `gh release delete`       | Delete a release                        |\n| `gh release delete-asset` | Delete an asset from a release          |\n| `gh release download`     | Download assets from a GitHub release   |\n| `gh release edit`         | Edit a release                          |\n| `gh release upload`       | Upload asset files to a GitHub Release  |\n| `gh release view`         | View information about a GitHub Release |\n\n### Configuration\n\n**Targeted Settings**\n\n| Command                 | Description                                         |\n| :---------------------- | :-------------------------------------------------- |\n| `gh config clear-cache` | Clear the cli cache                                 |\n| `gh config get`         | Print the value of a given configuration key        |\n| `gh config list`        | Print a list of configuration keys and values       |\n| `gh config set`         | Update configuration with a value for the given key |\n"
  },
  {
    "path": "source/_posts/github.md",
    "content": "---\ntitle: Github\ndate: 2022-11-23 16:23:31.704787\nbackground: bg-[#17191e]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 80 keyboard shortcuts found on Github.com\n---\n\n## Keyboard Shortcuts\n\n### Site wide shortcuts\n\n| Shortcut | Action                                                        |\n| -------- | ------------------------------------------------------------- |\n| `S`      | Focus the search bar                                          |\n| `G` `N`  | Go to your notifications                                      |\n| `H`      | Opens and focuses on a user, issue, or pull request hovercard |\n| `Esc`    | When focused on above, closes hovercard                       |\n\n{.shortcuts}\n\n### Repositories\n\n| Shortcut | Action                      |\n| -------- | --------------------------- |\n| `G` `C`  | Go to the Code tab          |\n| `G` `I`  | Go to the Issues tab        |\n| `G` `P`  | Go to the Pull requests tab |\n| `G` `B`  | Go to the Projects tab      |\n| `G` `W`  | Go to the Wiki tab          |\n\n{.shortcuts}\n\n### Source code editing\n\n| Shortcut           | Action                         |\n| ------------------ | ------------------------------ |\n| `Ctrl` `F`         | Start searching in file editor |\n| `Ctrl` `G`         | Find next                      |\n| `Ctrl` `Shift` `G` | Find previous                  |\n| `Ctrl` `Shift` `F` | Replace                        |\n| `Ctrl` `Shift` `R` | Replace all                    |\n| `Alt` `G`          | Jump to line                   |\n| `Ctrl` `Z`         | Undo                           |\n| `Ctrl` `Y`         | Redo                           |\n\n{.shortcuts}\n\n### Source code browsing\n\n| Shortcut | Action                             |\n| -------- | ---------------------------------- |\n| `T`      | Activates the file finder          |\n| `L`      | Jump to a line in your code        |\n| `W`      | Switch to a new branch or tag      |\n| `Y`      | Expand a URL to its canonical form |\n| `I`      | Show or hide comments on diffs     |\n| `B`      | Open blame view                    |\n\n{.shortcuts}\n\n### Comments\n\n| Shortcut           | Action                                                                       |\n| ------------------ | ---------------------------------------------------------------------------- |\n| `Ctrl` `B`         | Inserts Markdown formatting for bolding text                                 |\n| `Ctrl` `I`         | Inserts Markdown formatting for italicizing text                             |\n| `Ctrl` `K`         | Inserts Markdown formatting for creating a link                              |\n| `Ctrl` `Shift` `P` | Toggles between the Write and Preview comment tabs                           |\n| `Ctrl` `Enter`     | Submits a comment                                                            |\n| `Ctrl` `.`         | Opens saved replies menu and then autofills comment field with a saved reply |\n| `Ctrl` `G`         | Inserts a suggestions                                                        |\n| `R`                | Quote the selected text in your reply                                        |\n\n{.shortcuts}\n\n### Issue and pull request lists\n\n| Shortcut   | Action                                                      |\n| ---------- | ----------------------------------------------------------- |\n| `C`        | Create an issue                                             |\n| `Ctrl` `/` | Focus your cursor on the issues or pull requests search bar |\n| `U`        | Filter by author                                            |\n| `L`        | Filter by or edit labels                                    |\n| `M`        | Filter by or edit milestones                                |\n| `A`        | Filter by or edit assignee                                  |\n| `O`        | Open issue                                                  |\n\n{.shortcuts}\n\n### Issues and pull requests\n\n| Shortcut | Action             |\n| -------- | ------------------ |\n| `Q`      | Request a reviewer |\n| `M`      | Set a milestone    |\n| `L`      | Apply a label      |\n| `A`      | Set an assignee    |\n\n{.shortcuts}\n\n### Changes in pull requests\n\n| Shortcut               | Action                                                                                 |\n| ---------------------- | -------------------------------------------------------------------------------------- |\n| `C`                    | Open the list of commits in the pull request                                           |\n| `T`                    | Open the list of changed files in the pull request                                     |\n| `J`                    | Move selection down in the list                                                        |\n| `K`                    | Move selection up in the list                                                          |\n| `Ctrl` `Shift` `Enter` | Add a single comment on a pull request diff                                            |\n| `Alt` `(click)`        | Toggle between collapsing and expanding all outdated review comments in a pull request |\n\n{.shortcuts}\n\n### Project boards {.row-span-2}\n\n| Shortcut                 | Action                                             |\n| ------------------------ | -------------------------------------------------- |\n| `Enter/Space`            | Start moving the focused column                    |\n| `Esc`                    | Cancel the move in progress                        |\n| `Enter`                  | Complete the move in progress                      |\n| `Left/H`                 | Move column to the left                            |\n| `Ctrl` `Left/H`          | Move column to the leftmost position               |\n| `Right/L`                | Move column to the right                           |\n| `Ctrl` `Right/L`         | Move column to the rightmost position              |\n| `Enter/Space`            | Start moving the focused card                      |\n| `Esc`                    | Cancel the move in progress                        |\n| `Enter`                  | Complete the move in progress                      |\n| `Down/J`                 | Move card down                                     |\n| `Ctrl` `Down/J`          | Move card to the bottom of the column              |\n| `Up/K`                   | Move card up                                       |\n| `Ctrl` `Up/K`            | Move card to the top of the column                 |\n| `Left/H`                 | Move card to the bottom of the column on the left  |\n| `Shift` `Left/H`         | Move card to the top of the column on the left     |\n| `Ctrl` `Left/H`          | Move card to the bottom of the leftmost column     |\n| `Ctrl` `Shift` `Left/H`  | Move card to the top of the leftmost column        |\n| `Right`                  | Move card to the bottom of the column on the right |\n| `Shift` `Right/L`        | Move card to the top of the column on the right    |\n| `Ctrl` `Right/L`         | Move card to the bottom of the rightmost column    |\n| `Ctrl` `Shift` `Right/L` | Move card to the top of the rightmost column       |\n\n{.shortcuts}\n\n### Notifications\n\n| Shortcut    | Action       |\n| ----------- | ------------ |\n| `E/L/Y`     | Mark as read |\n| `Shift` `M` | Mute thread  |\n\n{.shortcuts}\n\n### Network graph\n\n| Shortcut          | Action                   |\n| ----------------- | ------------------------ |\n| `Left/H`          | Scroll left              |\n| `Right/L`         | Scroll right             |\n| `Up/K`            | Scroll up                |\n| `Down/J`          | Scroll down              |\n| `Shift` `Left/H`  | Scroll all the way left  |\n| `Shift` `Right/L` | Scroll all the way right |\n| `Shift` `Up/K`    | Scroll all the way up    |\n| `Shift` `Down/J`  | Scroll all the way down  |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Github](https://help.github.com/articles/using-keyboard-shortcuts/) _(help.github.com)_\n"
  },
  {
    "path": "source/_posts/gitlab.md",
    "content": "---\ntitle: GitLab\ndate: 2022-11-23 16:23:31.693478\nbackground: bg-[#e47030]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 58 keyboard shortcuts found in GitLab\n---\n\n## Keyboard Shortcuts\n\n### Global\n\n| Shortcut           | Action                                                                   |\n| ------------------ | ------------------------------------------------------------------------ |\n| `?`                | Show or hide the shortcut reference sheet                                |\n| `Shift` `P`        | Go to your projects page                                                 |\n| `Shift` `G`        | Go to your groups page                                                   |\n| `Shift` `A`        | Go to your activity page                                                 |\n| `Shift` `L`        | Go to your milestones page                                               |\n| `Shift` `S`        | Go to your snippets page                                                 |\n| `S`                | Put the cursor in the issues or merge requests search                    |\n| `Shift` `I`        | Go to your issues page                                                   |\n| `Shift` `T`        | Go to your merge requests page                                           |\n| `P` `B`            | Show or hide the performance bar                                         |\n| `Up`               | Edit your last comment, you must be in a blank text field below a thread |\n| `Ctrl` `Shift` `P` | Toggle markdown preview when editing text in a text field                |\n\n{.shortcuts}\n\n### Project\n\n| Shortcut | Action                                                |\n| -------- | ----------------------------------------------------- |\n| `G` `P`  | Go to the project home page                           |\n| `G` `V`  | Go to the project activity feed                       |\n| `G` `R`  | Go to the project releases list                       |\n| `G` `F`  | Go to the project files list                          |\n| `T`      | Go to the project file search page                    |\n| `G` `C`  | Go to the project commits list                        |\n| `G` `N`  | Go to the repository graph page                       |\n| `G` `D`  | Go to the repository charts                           |\n| `G` `I`  | Go to the project issues list                         |\n| `I`      | Go to the new issue page                              |\n| `G` `B`  | Go to the project issues boards list                  |\n| `G` `M`  | Go to the project merge requests list                 |\n| `G` `J`  | Go to the CI/CD jobs list                             |\n| `G` `L`  | Go to the project metrics                             |\n| `G` `E`  | Go to the project environments                        |\n| `G` `K`  | Go to the project Kubernetes cluster integration page |\n| `G` `S`  | Go to the project snippets list                       |\n| `G` `W`  | Go to the project wiki, if enabled                    |\n\n{.shortcuts}\n\n### Issues and Merge Requests\n\n| Shortcut | Action                                                             |\n| -------- | ------------------------------------------------------------------ |\n| `E`      | Edit description                                                   |\n| `A`      | Change assignee                                                    |\n| `M`      | Change milestone                                                   |\n| `L`      | Change label                                                       |\n| `R`      | Start writing a comment, if any text is selected it will be quoted |\n| `N`      | Move to next unresolved discussion, merge requests only            |\n| `P`      | Move to previous unresolved discussion, merge requests only        |\n| `]`      | Move to next file, merge requests only                             |\n| `[`      | Move to previous file, merge requests only                         |\n\n{.shortcuts}\n\n### Project Files\n\n| Shortcut | Action                                                      |\n| -------- | ----------------------------------------------------------- |\n| `Up`     | Move selection up                                           |\n| `Down`   | Move selection down                                         |\n| `Enter`  | Open selection                                              |\n| `Esc`    | Go back to file list screen, only while searching for files |\n| `Y`      | Go to file permalink, only while viewing a file             |\n\n{.shortcuts}\n\n### Web IDE\n\n| Shortcut       | Action                                              |\n| -------------- | --------------------------------------------------- |\n| `Ctrl` `P`     | Search for, and then open, another file for editing |\n| `Ctrl` `Enter` | Commit, when editing the commit message             |\n\n{.shortcuts}\n\n### Repository Graph\n\n| Shortcut       | Action           |\n| -------------- | ---------------- |\n| `Left`         | Scroll left      |\n| `Right`        | Scroll right     |\n| `Up`           | Scroll up        |\n| `Down`         | Scroll down      |\n| `Shift` `Up`   | Scroll to top    |\n| `Shift` `Down` | Scroll to bottom |\n\n{.shortcuts}\n\n### Wiki Pages\n\n| Shortcut | Action         |\n| -------- | -------------- |\n| `E`      | Edit wiki page |\n\n{.shortcuts}\n\n### Filtered Search\n\n| Shortcut           | Action                     |\n| ------------------ | -------------------------- |\n| `Ctrl` `Backspace` | Clear entire search filter |\n| `Alt` `Backspace`  | Clear one token at a time  |\n\n{.shortcuts}\n\n### Epics\n\n| Shortcut | Action                                                             |\n| -------- | ------------------------------------------------------------------ |\n| `R`      | Start writing a comment, if any text is selected it will be quoted |\n| `E`      | Edit description                                                   |\n| `L`      | Change a label                                                     |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for GitLab](https://docs.gitlab.com/ee/user/shortcuts.html) _(docs.gitlab.com)_\n"
  },
  {
    "path": "source/_posts/gmail.md",
    "content": "---\ntitle: Gmail\ndate: 2022-11-23 16:23:31.699967\nbackground: bg-[#d8503f]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 90 keyboard shortcuts found on Gmail\n---\n\n## Keyboard Shortcuts\n\n### Compose and Chat\n\n| Shortcut           | Action                                   |\n| ------------------ | ---------------------------------------- |\n| `P`                | Previous message in an open conversation |\n| `N`                | Next message in an open conversation     |\n| `Shift` `Esc`      | Focus main window                        |\n| `Esc`              | Focus latest chat or compose             |\n| `Ctrl` `.`         | Advance to the next chat or compose      |\n| `Ctrl` `,`         | Advance to the previous chat or compose  |\n| `Ctrl` `Enter`     | Send                                     |\n| `Ctrl` `Shift` `C` | Add cc recipients                        |\n| `Ctrl` `Shift` `B` | Add bcc recipients                       |\n| `Ctrl` `Shift` `F` | Access custom from                       |\n| `Ctrl` `K`         | Insert a link                            |\n| `Cmd` `;`          | Go to next misspelled word (Mac only)    |\n| `Ctrl` `M`         | Open spelling suggestions                |\n\n{.shortcuts}\n\n### Formatting Text\n\n| Shortcut           | Action             |\n| ------------------ | ------------------ |\n| `Ctrl` `Shift` `5` | Previous font      |\n| `Ctrl` `Shift` `6` | Next font          |\n| `Ctrl` `Shift` `-` | Decrease font size |\n| `Ctrl` `Shift` `+` | Increase font size |\n| `Ctrl` `B`         | Bold               |\n| `Ctrl` `I`         | Italics            |\n| `Ctrl` `U`         | Underline          |\n| `Ctrl` `Shift` `7` | Numbered list      |\n| `Ctrl` `Shift` `8` | Bulleted list      |\n| `Ctrl` `Shift` `9` | Quote              |\n| `Ctrl` `[`         | Indent less        |\n| `Ctrl` `]`         | Indent more        |\n| `Ctrl` `Shift` `L` | Align left         |\n| `Ctrl` `Shift` `E` | Align center       |\n| `Ctrl` `Shift` `R` | Align right        |\n| `Ctrl` `\\`         | Remove formatting  |\n\n{.shortcuts}\n\n### Actions {.row-span-2}\n\n| Shortcut    | Action                                          |\n| ----------- | ----------------------------------------------- |\n| `,`         | Move focus to toolbar                           |\n| `X`         | Select conversation                             |\n| `S`         | Toggle star or rotate among superstars          |\n| `E`         | Archive                                         |\n| `M`         | Mute conversation                               |\n| `Shift` `1` | Report as spam                                  |\n| `Shift` `3` | Delete                                          |\n| `R`         | Reply                                           |\n| `Shift` `R` | Reply in a new window                           |\n| `A`         | Reply all                                       |\n| `Shift` `A` | Reply all in a new window                       |\n| `F`         | Forward                                         |\n| `Shift` `F` | Forward in a new window                         |\n| `Shift` `N` | Update conversation                             |\n| `]/[`       | Archive conversation and go to previous or next |\n| `Z`         | Undo last action                                |\n| `Shift` `I` | Mark as read                                    |\n| `Shift` `U` | Mark as unread                                  |\n| `Shift` `-` | Mark unread from the selected message           |\n| `=`         | Mark as important                               |\n| `-`         | Mark as not important                           |\n| `B`         | Snooze                                          |\n| `;`         | Expand entire conversation                      |\n| `Shift` `;` | Collapse entire conversation                    |\n| `Shift` `T` | Add conversation to tasks                       |\n\n{.shortcuts}\n\n### Hangouts\n\n| Shortcut | Action                         |\n| -------- | ------------------------------ |\n| `H` `M`  | Show menu                      |\n| `H` `A`  | Show archived hangouts         |\n| `H` `I`  | Show hangout requests          |\n| `H` `C`  | Focus on the conversation list |\n| `H` `P`  | Open phone                     |\n\n{.shortcuts}\n\n### Jumping\n\n| Shortcut           | Action                                                              |\n| ------------------ | ------------------------------------------------------------------- |\n| `G` `I`            | Go to inbox                                                         |\n| `G` `S`            | Go to starred conversations                                         |\n| `G` `B`            | Go to snoozed conversations                                         |\n| `G` `T`            | Go to sent messages                                                 |\n| `S` `D`            | Go to drafts                                                        |\n| `G` `A`            | Go to all mail                                                      |\n| `Ctrl` `Alt` `,/.` | Switch between the calendar, keep, and tasks sidebar and your inbox |\n| `G` `K`            | Go to tasks                                                         |\n| `G` `L`            | Go to label                                                         |\n\n{.shortcuts}\n\n### Threadlist Selection\n\n| Shortcut        | Action                         |\n| --------------- | ------------------------------ |\n| `Shift` `8` `A` | Select all conversations       |\n| `Shift` `8` `N` | Deselect all conversations     |\n| `Shift` `8` `R` | Select read conversations      |\n| `Shift` `8` `U` | Select unread conversations    |\n| `Shift` `8` `S` | Select starred conversations   |\n| `Shift` `8` `T` | Select unstarred conversations |\n\n{.shortcuts}\n\n### Navigation\n\n| Shortcut                | Action                       |\n| ----------------------- | ---------------------------- |\n| `G` `N`                 | Go to next page              |\n| `G` `P`                 | Go to previous page          |\n| `U`                     | Back to threadlist           |\n| `K`                     | Newer conversation           |\n| `J`                     | Older conversation           |\n| `Enter`                 | Open conversation            |\n| <code>\\`</code>         | Go to next inbox section     |\n| `Shift` <code>\\`</code> | Go to previous inbox section |\n\n{.shortcuts}\n\n### Application\n\n| Shortcut | Action                      |\n| -------- | --------------------------- |\n| `C`      | Compose                     |\n| `D`      | Compose in a new tab        |\n| `/`      | Search mail                 |\n| `G`      | Search chat contacts        |\n| `.`      | Open more actions menu      |\n| `V`      | Open move to menu           |\n| `L`      | Open label as menu          |\n| `?`      | Open keyboard shortcut help |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Gmail](https://support.google.com/mail/answer/6594?hl=en) _(support.google.com)_\n"
  },
  {
    "path": "source/_posts/gnome-desktop.md",
    "content": "---\ntitle: Gnome Desktop\ndate: 2024-06-05 16:23:31.705009\nbackground: bg-[#5885c9]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for Gnome Desktop\n---\n\n## Keyboard Shortcuts\n\n### Actions\n\n| Shortcut      | Action              |\n| ------------- | ------------------- |\n| `Alt+Super+8` | Turn zoom on or off |\n| `Alt+Super+=` | Zoom in             |\n| `Alt+Super+-` | Zoom out            |\n\n{.shortcuts}\n\n### Launchers\n\n| Shortcut     | Action              |\n| ------------ | ------------------- |\n| `Super+F1`   | Launch Help Browser |\n| `Ctrl+Alt+T` | Launch Terminal     |\n\n{.shortcuts}\n\n### Screenshots\n\n| Shortcut           | Action                            |\n| ------------------ | --------------------------------- |\n| `Shift+Ctrl+Alt+R` | Record a screencast interactively |\n| `Shift+Print`      | Take a screenshot                 |\n| `Print`            | Take a screenshot interactively   |\n| `Alt+Print`        | Take a screenshot of a window     |\n\n{.shortcuts}\n\n### System\n\n| Shortcut       | Action                         |\n| -------------- | ------------------------------ |\n| `Super+N`      | Focus the active notification  |\n| `Super+L`      | Lock screen                    |\n| `Ctrl+Alt+Del` | Log out                        |\n| `Super+F10`    | Open the application menu      |\n| `Super+Escape` | Restore the keyboard shortcuts |\n| `Super+A`      | Show all applications          |\n| `Super+V`      | Show the notification list     |\n| `Super+S`      | Show the overview              |\n| `Alt+F2`       | Show the run command prompt    |\n\n{.shortcuts}\n\n### Typing\n\n| Shortcut            | Action                          |\n| ------------------- | ------------------------------- |\n| `Super+space`       | Switch to next typing source    |\n| `Shift+Super+Space` | Switch to previous input source |\n\n{.shortcuts}\n\n### Windows\n\n| Shortcut      | Action                    |\n| ------------- | ------------------------- |\n| `Alt+Space`   | Activate the window menu  |\n| `Alt+F1`      | Close the window          |\n| `Super+H`     | Hide window               |\n| `Super+Up`    | Maximize window           |\n| `Alt+F7`      | Move window               |\n| `Alt+F8`      | Resize Window             |\n| `Super+Down`  | Restore window            |\n| `Alt+F10`     | Toggle maximization state |\n| `Super+Left`  | View split on left        |\n| `Super+Right` | View split on right       |\n\n{.shortcuts}\n\n### Navigation\n\n| Shortcut                | Action                                 |\n| ----------------------- | -------------------------------------- |\n| `Ctrl+Super+D`          | Hide all normal windows                |\n| `Super+Page Up`         | Move to workspace on the left          |\n| `Super+Page Down`       | Move to workspace on the right         |\n| `Shift+Super+Down`      | Move window one monitor down           |\n| `Shift+Super+Left`      | Move window one monitor to the left    |\n| `Shift+Super+Right`     | Move window one monitor to the right   |\n| `Shift+Super+Up`        | Move window one monitor up             |\n| `Shift+Super+Page Up`   | Move window one workspace to the left  |\n| `Shift+Super+Page Down` | Move window one workspace to the right |\n| `Shift+Super+End`       | Move window to last workspace          |\n| `Shift+Super+Home`      | Move window to workspace 1             |\n| `Super+Tab`             | Switch applications                    |\n| `Ctrl+Alt+Tab`          | Switch system controls                 |\n| `Ctrl+Alt+Escape`       | Switch system controls directly        |\n| `Super+End`             | Switch to last workspace               |\n| `Super+Home`            | Switch to workspace 1                  |\n| `Alt+Tab`               | Switch windows                         |\n| `Alt+Escape`            | Switch windows directly                |\n| `Alt+F6`                | Switch windows of an app directly      |\n| `Super+`                | Switch windows of an application       |\n\n{.shortcuts}\n\n## Also see\n\n- [Gnome Shell Cheatsheet](https://wiki.gnome.org/Projects/GnomeShell/CheatSheet) _(www.gnome.org)_\n"
  },
  {
    "path": "source/_posts/gnupg.md",
    "content": "---\ntitle: GnuPG\ncategories:\n  - Linux Command\nintro: A cheatsheet for GnuPG, the encryption and signing software.\n---\n\n## Getting Started\n\n### Software\n\nGpg4win and the GPG Suite have OS-specific features.\n\n- [GnuPG](https://gnupg.org/)\n- [Gpg4win](https://www.gpg4win.org/) (Windows)\n- [GPG Suite](https://gpgtools.org/) (macOS)\n\nSometimes GPG keys are referred as PGP keys. They're interchangeable, as they follow the\n[OpenPGP Standard](https://www.rfc-editor.org/rfc/rfc9580.html).\n\n### Create a key-pair\n\nGenerate your keys:\n\n```shell script\n$ gpg --generate-key\n```\n\n... or fully configure your keys.\n\n```shell script\n$ gpg --generate-full-keys\n```\n\n**Note:** Choose a strong passphrase! The encryption is only as strong as your passphrase.\n\n### Key management\n\nList your keys:\n\n```shell script\n$ gpg --list-keys\n```\n\nList your secret keys:\n\n```shell script\n$ gpg --list-secret-keys\n```\n\nExport your public key:\n\n```shell script\n$ gpg --export --armor <ID>\n```\n\nExport your secret key:\n\n```shell script\n$ gpg --export-secret-key --armor <ID>\n```\n\nDelete your public key:\n\n```shell script\n$ gpg --delete-key <ID>\n```\n\nDelete your secret key:\n\n```shell script\n$ gpg --delete-secret-key <ID>\n```\n\n## Encryption\n\n### Symmetric\n\nEncrypt with a passphrase:\n\n```shell script\n$ gpg -c <FILE>\n```\n\nEncrypt as ASCII with `-a` flag:\n\n```shell script\n$ gpg -ac <FILE>\n```\n\nSet output file path with `-o` flag:\n\n```shell script\n$ gpg -c <FILE> -o <PATH>\n```\n\nDecrypt with a passphrase:\n\n```shell script\n$ gpg <FILE>\n```\n\n**Note:** Choose a strong passphrase! The encryption is only as strong as your passphrase.\n\n### Asymmetric\n\nEncrypt using public-private key encryption:\n\n```shell script\n$ gpg -e -r <RECIPIENT> <FILE>\n```\n\nEncrypt as ASCII output with `-a` flag:\n\n```shell script\n$ gpg -ea -r <RECIPIENT> <FILE>\n```\n\nEncrypt and sign with `-s` flag:\n\n```shell script\n$ gpg -se -r <RECIPIENT> <FILE>\n```\n\nAdd multiple recipients:\n\n```shell script\n$ gpg -e -r <RECIPIENT1> -r <RECIPIENT2> <FILE>\n```\n\nSet output file path with `-o` flag:\n\n```shell script\n$ gpg -e -o <PATH> -r <RECIPIENT> <FILE>\n```\n\nDecrypt with your private key:\n\n```shell script\n$ gpg <FILE>\n```\n\nReplace `<RECIPIENT>` with your intended recipient's [imported public key](#importing-a-public-key) ID.\n\n### Importing a public key\n\nImport using a file:\n\n```shell script\n$ gpg --import <FILE>\n```\n\nImport using a link (macOS/Linux):\n\n```shell script\n$ curl <WEBSITE> | gpg --import\n```\n\nDon't forget to sign the imported key:\n\n```shell script\n$ gpg --sign-key <ID>\n```\n\n## Commit Signing\n\n### Local Git Setup\n\nEnable GPG signing:\n\n```shell script\n$ git config --global commit.gpgsign true\n```\n\nSet the signing key:\n\n```shell script\n$ git config --global user.signingkey <ID>\n```\n\nSet location of GPG:\n\n```shell script\n$ git config --global gpg.program <PROGRAM>\n```\n\n**Note:** Your name and email must match on Git and GnuPG.\n\n### GPG Program List\n\nReplace `<PROGRAM>` with one of the following:\n\n| Platform    | Value                                      |\n| ----------- | ------------------------------------------ |\n| Windows     | `C:\\Program Files (x86)\\GnuPG\\bin\\gpg.exe` |\n| macOS/Linux | /usr/local/bin/gpg                         |\n\n{.left-text}\n\n### Exporting your public key\n\nExport as ASCII:\n\n```shell script\n$ gpg --export --armor <ID>\n```\n\n**Note:** Platforms, like GitHub, may ask you to verify the email you set in Git and GnuPG.\n\n## Windows: Add to Startup Apps {.cols-1}\n\n### PowerShell Commands\n\nWhen you do a full restart, the GPG agent might not automatically start. Add the GnuPG's IPC tool to Startup Apps using\nPowerShell:\n\n```shell script\n$ $shell = New-Object -ComObject WScript.Shell\n$ $shortcut = $shell.CreateShortcut(\"C:\\Users\\$($Env:UserName)\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\gpg-connect-agent.lnk\")\n$ $shortcut.TargetPath = \"C:\\Program Files (x86)\\GnuPG\\bin\\gpg-connect-agent.exe\"\n$ $shortcut.Arguments = \"/bye\"\n$ $shortcut.Save()\n```\n\nStart up manually instead:\n\n```shell script\n$ gpgconf --launch gpg-agent\n```\n\nCheck if it was successfully added [here](ms-settings:startupapps).\n"
  },
  {
    "path": "source/_posts/go.md",
    "content": "---\ntitle: Go\ndate: 2020-12-17 21:51:44\nbackground: bg-[#4ba4cc]\ntags:\n  - Go\ncategories:\n  - Programming\nintro: |\n  This cheat sheet provided basic syntax and methods to help you using [Go](https://go.dev/).\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### hello.go\n\n```go\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n    fmt.Println(\"Hello, world!\")\n}\n```\n\nRun directly\n\n```shell script\n$ go run hello.go\nHello, world!\n```\n\nOr try it out in the [Go repl](https://repl.it/languages/go)\n\n### Variables\n\n```go\nvar s1 string\ns1 = \"Learn Go!\"\n\n// declare multiple variables at once\nvar b, c int = 1, 2\nvar d = true\n```\n\nShort declaration\n\n```go\ns1 := \"Learn Go!\"        // string\nb, c := 1, 2             // int\nd := true                // bool\n```\n\nSee: [Basic types](#go-basic-types)\n\n### Functions\n\n```go\npackage main\n\nimport \"fmt\"\n\n// The entry point of the programs\nfunc main() {\n    fmt.Println(\"Hello world!\")\n    say(\"Hello Go!\")\n}\n\nfunc say(message string) {\n    fmt.Println(\"You said: \", message)\n}\n```\n\nSee: [Functions](#go-functions)\n\n### Comments\n\n```go\n// Single line comment\n\n/* Multi-\n line comment */\n```\n\n### If statement\n\n```go\nif true {\n    fmt.Println(\"Yes!\")\n}\n```\n\nSee: [Flow control](#go-flow-control)\n\n## Go Basic types\n\n### Strings\n\n```go\ns1 := \"Hello\" + \"World\"\n\ns2 := `A \"raw\" string literal\ncan include line breaks.`\n\n// Outputs: 10\nfmt.Println(len(s1))\n\n// Outputs: Hello\nfmt.Println(string(s1[0:5]))\n```\n\nStrings are of type `string`.\n\n### Numbers\n\n```go\nnum := 3         // int\nnum := 3.        // float64\nnum := 3 + 4i    // complex128\nnum := byte('a') // byte (alias: uint8)\n\nvar u uint = 7        // uint (unsigned)\nvar p float32 = 22.7  // 32-bit float\n```\n\n#### Operators\n\n```go\nx := 5\nx++\nfmt.Println(\"x + 4 =\", x + 4)\nfmt.Println(\"x * 4 =\", x * 4)\n```\n\nSee: [More Operators](#go-operators-and-punctuation)\n\n### Booleans\n\n```go\nisTrue   := true\nisFalse  := false\n```\n\n#### Operators\n\n```go\nfmt.Println(true && true)   // true\nfmt.Println(true && false)  // false\nfmt.Println(true || true)   // true\nfmt.Println(true || false)  // true\nfmt.Println(!true)          // false\n```\n\nSee: [More Operators](#go-operators-and-punctuation)\n\n### Arrays {.row-span-2}\n\n```go\n┌────┬────┬────┬────┬─────┬─────┐\n| 2  | 3  | 5  | 7  | 11  | 13  |\n└────┴────┴────┴────┴─────┴─────┘\n  0    1    2    3     4     5\n```\n\n---\n\n```go\nprimes := [...]int{2, 3, 5, 7, 11, 13}\nfmt.Println(len(primes)) // => 6\n\n// Outputs: [2 3 5 7 11 13]\nfmt.Println(primes)\n\n// Same as [:3], Outputs: [2 3 5]\nfmt.Println(primes[0:3])\n```\n\n---\n\n```go\nvar a [2]string\na[0] = \"Hello\"\na[1] = \"World\"\n\nfmt.Println(a[0], a[1]) //=> Hello World\nfmt.Println(a)   // => [Hello World]\n```\n\n#### 2d array\n\n```go\nvar twoDimension [2][3]int\nfor i := 0; i < 2; i++ {\n    for j := 0; j < 3; j++ {\n        twoDimension[i][j] = i + j\n    }\n}\n// => 2d:  [[0 1 2] [1 2 3]]\nfmt.Println(\"2d: \", twoDimension)\n```\n\n### Pointers\n\n```go\nfunc main () {\n  b := *getPointer()\n  fmt.Println(\"Value is\", b)\n}\n```\n\n```go\nfunc getPointer () (myPointer *int) {\n  a := 234\n  return &a\n}\n```\n\n```go\na := new(int)\n*a = 234\n```\n\nSee: [Pointers](https://tour.go.dev/moretypes/1)\n\n### Slices\n\n```go\ns := make([]string, 3)\ns[0] = \"a\"\ns[1] = \"b\"\ns = append(s, \"d\")\ns = append(s, \"e\", \"f\")\n\nfmt.Println(s)\nfmt.Println(s[1])\nfmt.Println(len(s))\nfmt.Println(s[1:3])\n\nslice := []int{2, 3, 4}\n```\n\nSee also: [Slices example](https://gobyexample.com/slices)\n\n### Constants\n\n```go\nconst s string = \"constant\"\nconst Phi = 1.618\nconst n = 500000000\nconst d = 3e20 / n\nfmt.Println(d)\n```\n\n### Type conversions\n\n```go\ni := 90\nf := float64(i)\nu := uint(i)\n\n// Will be equal to the character Z\ns := string(i)\n```\n\n#### How to get int string?\n\n```go\ni := 90\n\n// need import \"strconv\"\ns := strconv.Itoa(i)\nfmt.Println(s) // Outputs: 90\n```\n\n## Go Strings\n\n### Strings function\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\ts \"strings\"\n)\n\nfunc main() {\n    /* Need to import strings as s */\n\tfmt.Println(s.Contains(\"test\", \"e\"))\n\n    /* Build in */\n    fmt.Println(len(\"hello\"))  // => 5\n    // Outputs: 101\n\tfmt.Println(\"hello\"[1])\n    // Outputs: e\n\tfmt.Println(string(\"hello\"[1]))\n\n}\n```\n\n### fmt.Printf {.row-span-2 .col-span-2}\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n)\n\ntype point struct {\n\tx, y int\n}\n\nfunc main() {\n\tp := point{1, 2}\n\tfmt.Printf(\"%v\\n\", p)                        // => {1 2}\n\tfmt.Printf(\"%+v\\n\", p)                       // => {x:1 y:2}\n\tfmt.Printf(\"%#v\\n\", p)                       // => main.point{x:1, y:2}\n\tfmt.Printf(\"%T\\n\", p)                        // => main.point\n\tfmt.Printf(\"%t\\n\", true)                     // => TRUE\n\tfmt.Printf(\"%d\\n\", 123)                      // => 123\n\tfmt.Printf(\"%b\\n\", 14)                       // => 1110\n\tfmt.Printf(\"%c\\n\", 33)                       // => !\n\tfmt.Printf(\"%x\\n\", 456)                      // => 1c8\n\tfmt.Printf(\"%f\\n\", 78.9)                     // => 78.9\n\tfmt.Printf(\"%e\\n\", 123400000.0)              // => 1.23E+08\n\tfmt.Printf(\"%E\\n\", 123400000.0)              // => 1.23E+08\n\tfmt.Printf(\"%s\\n\", \"\\\"string\\\"\")             // => \"string\"\n\tfmt.Printf(\"%q\\n\", \"\\\"string\\\"\")             // => \"\\\"string\\\"\"\n\tfmt.Printf(\"%x\\n\", \"hex this\")               // => 6.86578E+15\n\tfmt.Printf(\"%p\\n\", &p)                       // => 0xc00002c040\n\tfmt.Printf(\"|%6d|%6d|\\n\", 12, 345)           // => |    12|   345|\n\tfmt.Printf(\"|%6.2f|%6.2f|\\n\", 1.2, 3.45)     // => |  1.20|  3.45|\n\tfmt.Printf(\"|%-6.2f|%-6.2f|\\n\", 1.2, 3.45)   // => |1.20  |3.45  |\n\tfmt.Printf(\"|%6s|%6s|\\n\", \"foo\", \"b\")        // => |   foo|     b|\n\tfmt.Printf(\"|%-6s|%-6s|\\n\", \"foo\", \"b\")      // => |foo   |b     |\n\n\ts := fmt.Sprintf(\"a %s\", \"string\")\n\tfmt.Println(s)\n\n\tfmt.Fprintf(os.Stderr, \"an %s\\n\", \"error\")\n}\n\n```\n\nSee also: [fmt](https://go.dev/pkg/fmt/)\n\n### Function examples\n\n| Example                       | Result      |\n| ----------------------------- | ----------- |\n| Contains(\"test\", \"es\")        | true        |\n| Count(\"test\", \"t\")            | 2           |\n| HasPrefix(\"test\", \"te\")       | true        |\n| HasSuffix(\"test\", \"st\")       | true        |\n| Index(\"test\", \"e\")            | 1           |\n| Join([]string{\"a\", \"b\"}, \"-\") | a-b         |\n| Repeat(\"a\", 5)                | aaaaa       |\n| Replace(\"foo\", \"o\", \"0\", -1)  | f00         |\n| Replace(\"foo\", \"o\", \"0\", 1)   | f0o         |\n| Split(\"a-b-c-d-e\", \"-\")       | [a b c d e] |\n| ToLower(\"TEST\")               | test        |\n| ToUpper(\"test\")               | TEST        |\n\n## Go Flow control\n\n### Conditional\n\n```go\n\na := 10\n\nif a > 20 {\n    fmt.Println(\">\")\n} else if a < 20 {\n    fmt.Println(\"<\")\n} else {\n    fmt.Println(\"=\")\n}\n```\n\n### Statements in if\n\n```go\nx := \"hello go!\"\n\nif count := len(x); count > 0 {\n    fmt.Println(\"Yes\")\n}\n\n```\n\n---\n\n```go\n\nif _, err := doThing(); err != nil {\n    fmt.Println(\"Uh oh\")\n}\n```\n\n### Switch\n\n```go {.wrap}\nx := 42.0\nswitch x {\ncase 0:\ncase 1, 2:\n    fmt.Println(\"Multiple matches\")\ncase 42:   // Don't \"fall through\".\n    fmt.Println(\"reached\")\ncase 43:\n    fmt.Println(\"Unreached\")\ndefault:\n    fmt.Println(\"Optional\")\n}\n```\n\nSee: [Switch](https://github.com/golang/go/wiki/Switch)\n\n### For loop\n\n```go\nfor i := 0; i <= 10; i++ {\n  fmt.Println(\"i: \", i)\n}\n```\n\n### For-Range loop\n\n```go {.wrap}\nnums := []int{2, 3, 4}\nsum := 0\nfor _, num := range nums {\n    sum += num\n}\nfmt.Println(\"sum:\", sum)\n```\n\n### While loop\n\n```go\ni := 1\nfor i <= 3 {\n    fmt.Println(i)\n    i++\n}\n```\n\n### Continue keyword\n\n```go\nfor i := 0; i <= 5; i++ {\n    if i % 2 == 0 {\n        continue\n    }\n    fmt.Println(i)\n}\n```\n\n### Break keyword\n\n```go\nfor {\n    fmt.Println(\"loop\")\n    break\n}\n```\n\n## Go Structs & Maps\n\n### Defining {.row-span-2}\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n)\n\ntype Vertex struct {\n\tX int\n\tY int\n}\n\nfunc main() {\n\tv := Vertex{1, 2}\n\tv.X = 4\n\tfmt.Println(v.X, v.Y) // => 4 2\n}\n```\n\nSee: [Structs](https://tour.go.dev/moretypes/2)\n\n### Literals\n\n```go\nv := Vertex{X: 1, Y: 2}\n// Field names can be omitted\nv := Vertex{1, 2}\n// Y is implicit\nv := Vertex{X: 1}\n```\n\nYou can also put field names.\n\n### Maps {.row-span-2}\n\n```go\nm := make(map[string]int)\nm[\"k1\"] = 7\nm[\"k2\"] = 13\nfmt.Println(m) // => map[k1:7 k2:13]\n\nv1 := m[\"k1\"]\nfmt.Println(v1)     // => 7\nfmt.Println(len(m)) // => 2\n\ndelete(m, \"k2\")\nfmt.Println(m) // => map[k1:7]\n\n_, prs := m[\"k2\"]\nfmt.Println(prs) // => false\n\nn := map[string]int{\"foo\": 1, \"bar\": 2}\nfmt.Println(n) // => map[bar:2 foo:1]\n```\n\n### Pointers to structs\n\n```go\nv := &Vertex{1, 2}\nv.X = 2\n```\n\nDoing `v.X` is the same as doing `(*v).X`, when `v` is a pointer.\n\n## Go Functions\n\n### Multiple arguments\n\n```go\nfunc plus(a int, b int) int {\n    return a + b\n}\nfunc plusPlus(a, b, c int) int {\n    return a + b + c\n}\nfmt.Println(plus(1, 2))\nfmt.Println(plusPlus(1, 2, 3))\n```\n\n### Multiple return\n\n```go\nfunc vals() (int, int) {\n    return 3, 7\n}\n\na, b := vals()\nfmt.Println(a)    // => 3\nfmt.Println(b)    // => 7\n```\n\n### Function literals\n\n```go\nr1, r2 := func() (string, string) {\n    x := []string{\"hello\", \"cheatsheets.zip\"}\n    return x[0], x[1]\n}()\n\n// => hello cheatsheets.zip\nfmt.Println(r1, r2)\n```\n\n### Naked returns\n\n```go\nfunc split(sum int) (x, y int) {\n  x = sum * 4 / 9\n  y = sum - x\n  return\n}\n\nx, y := split(17)\nfmt.Println(x)   // => 7\nfmt.Println(y)   // => 10\n```\n\nNote that using naked returns hurts readability.\n\n### Variadic functions\n\n```go\nfunc sum(nums ...int) {\n    fmt.Print(nums, \" \")\n    total := 0\n    for _, num := range nums {\n        total += num\n    }\n    fmt.Println(total)\n}\nsum(1, 2)     //=> [1 2] 3\nsum(1, 2, 3)  // => [1 2 3] 6\n\nnums := []int{1, 2, 3, 4}\nsum(nums...)  // => [1 2 3 4] 10\n```\n\n### init function\n\n```go\nimport --> const --> var --> init()\n```\n\n---\n\n```go\nvar num = setNumber()\n\nfunc setNumber() int {\n    return 42\n}\nfunc init() {\n    num = 0\n}\nfunc main() {\n    fmt.Println(num) // => 0\n}\n```\n\n### Functions as values\n\n```go\nfunc main() {\n    // assign a function to a name\n    add := func(a, b int) int {\n        return a + b\n    }\n    // use the name to call the function\n    fmt.Println(add(3, 4)) // => 7\n}\n```\n\n### Closures 1\n\n```go\nfunc scope() func() int{\n    outer_var := 2\n    foo := func() int {return outer_var}\n    return foo\n}\n\n// Outpus: 2\nfmt.Println(scope()())\n```\n\n### Closures 2\n\n```go\nfunc outer() (func() int, int) {\n    outer_var := 2\n    inner := func() int {\n        outer_var += 99\n        return outer_var\n    }\n    inner()\n    return inner, outer_var\n}\ninner, val := outer()\nfmt.Println(inner()) // => 200\nfmt.Println(val)     // => 101\n```\n\n## Go Packages\n\n### Importing {.row-span-2}\n\n```go\nimport \"fmt\"\nimport \"math/rand\"\n```\n\n#### Same as\n\n```go\nimport (\n  \"fmt\"        // gives fmt.Println\n  \"math/rand\"  // gives rand.Intn\n)\n```\n\nSee: [Importing](https://tour.go.dev/basics/1)\n\n### Aliases {.row-span-2}\n\n```go\nimport r \"math/rand\"\n```\n\n---\n\n```go\nimport (\n    \"fmt\"\n    r \"math/rand\"\n)\n```\n\n---\n\n```go\nr.Intn()\n```\n\n### Packages\n\n```go\npackage main\n\n// An internal package may be imported only by another package\n// that is inside the tree rooted at the parent of the internal directory\npackage internal\n```\n\nSee: [Internal packages](https://go.dev/doc/go1.4#internalpackages)\n\n### Exporting names\n\n```go\n// Begin with a capital letter\nfunc Hello () {\n  ···\n}\n```\n\nSee: [Exported names](https://tour.go.dev/basics/3)\n\n## Go Concurrency\n\n### Goroutines {.row-span-2}\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n)\n\nfunc f(from string) {\n\tfor i := 0; i < 3; i++ {\n\t\tfmt.Println(from, \":\", i)\n\t}\n}\n\nfunc main() {\n\tf(\"direct\")\n\tgo f(\"goroutine\")\n\n\tgo func(msg string) {\n\t\tfmt.Println(msg)\n\t}(\"going\")\n\n\ttime.Sleep(time.Second)\n\tfmt.Println(\"done\")\n}\n```\n\nSee: [Goroutines](https://tour.go.dev/concurrency/1), [Channels](https://tour.go.dev/concurrency/2)\n\n### WaitGroup {.row-span-2}\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"sync\"\n\t\"time\"\n)\n\nfunc w(id int, wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\tfmt.Printf(\"%d starting\\n\", id)\n\n\ttime.Sleep(time.Second)\n\tfmt.Printf(\"%d done\\n\", id)\n}\n\nfunc main() {\n\tvar wg sync.WaitGroup\n\tfor i := 1; i <= 5; i++ {\n\t\twg.Add(1)\n\t\tgo w(i, &wg)\n\t}\n\twg.Wait()\n}\n```\n\nSee: [WaitGroup](https://go.dev/pkg/sync/#WaitGroup)\n\n### Closing channels\n\n```go\nch <- 1\nch <- 2\nch <- 3\nclose(ch) // Closes a channel\n```\n\n---\n\n```go\n// Iterate the channel until closed\nfor i := range ch {\n  ···\n}\n```\n\n---\n\n```go\n// Closed if `ok == false`\nv, ok := <- ch\n```\n\nSee: [Range and close](https://tour.go.dev/concurrency/4)\n\n### Buffered channels\n\n```go\nch := make(chan int, 2)\nch <- 1\nch <- 2\nch <- 3\n// fatal error:\n// all goroutines are asleep - deadlock\n```\n\nSee: [Buffered channels](https://tour.go.dev/concurrency/3)\n\n## Go Error control\n\n### Deferring functions\n\n```go\nfunc main() {\n  defer func() {\n    fmt.Println(\"Done\")\n  }()\n  fmt.Println(\"Working...\")\n}\n```\n\n### Lambda defer\n\n```go\nfunc main() {\n  var d = int64(0)\n  defer func(d *int64) {\n    fmt.Printf(\"& %v Unix Sec\\n\", *d)\n  }(&d)\n  fmt.Print(\"Done \")\n  d = time.Now().Unix()\n}\n```\n\nThe defer func uses current value of d, unless we use a pointer to get final value at end of main.\n\n### Defer\n\n```go\nfunc main() {\n  defer fmt.Println(\"Done\")\n  fmt.Println(\"Working...\")\n}\n```\n\nSee: [Defer, panic and recover](https://blog.go.dev/defer-panic-and-recover)\n\n## Go Methods {.cols-2}\n\n### Receivers\n\n```go\ntype Vertex struct {\n  X, Y float64\n}\n```\n\n```go\nfunc (v Vertex) Abs() float64 {\n  return math.Sqrt(v.X * v.X + v.Y * v.Y)\n}\n```\n\n```go\nv := Vertex{1, 2}\nv.Abs()\n```\n\nSee: [Methods](https://tour.go.dev/methods/1)\n\n### Mutation\n\n```go\nfunc (v *Vertex) Scale(f float64) {\n  v.X = v.X * f\n  v.Y = v.Y * f\n}\n```\n\n```go\nv := Vertex{6, 12}\nv.Scale(0.5)\n// `v` is updated\n```\n\nSee: [Pointer receivers](https://tour.go.dev/methods/4)\n\n## Go Interfaces {.cols-2}\n\n### A basic interface\n\n```go\ntype Shape interface {\n  Area() float64\n  Perimeter() float64\n}\n```\n\n### Struct\n\n```go\ntype Rectangle struct {\n  Length, Width float64\n}\n```\n\nStruct `Rectangle` implicitly implements interface `Shape` by implementing all of its methods.\n\n### Methods\n\n```go\nfunc (r Rectangle) Area() float64 {\n  return r.Length * r.Width\n}\n\nfunc (r Rectangle) Perimeter() float64 {\n  return 2 * (r.Length + r.Width)\n}\n```\n\nThe methods defined in `Shape` are implemented in `Rectangle`.\n\n### Interface example\n\n```go {.wrap}\nfunc main() {\n  var r Shape = Rectangle{Length: 3, Width: 4}\n  fmt.Printf(\"Type of r: %T, Area: %v, Perimeter: %v.\", r, r.Area(), r.Perimeter())\n}\n\n```\n\n## Go generics {.cols-2}\n\n### example 1\n\n```go\n// comparable represents types that can be compared.\ntype comparable interface {\n\tint | float64 | string\n}\n\n// Max returns the maximum of two comparable values.\nfunc Max[T comparable](a, b T) T {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}\n\nfunc main() {\n\t// Find the maximum of two integers.\n\tmaxInt := Max(10, 20)\n\tfmt.Println(\"Max integer:\", maxInt)\n\n\t// Find the maximum of two floats.\n\tmaxFloat := Max(3.14, 2.71)\n\tfmt.Println(\"Max float:\", maxFloat)\n\n\t// Find the maximum of two strings.\n\tmaxString := Max(\"apple\", \"banana\")\n\tfmt.Println(\"Max string:\", maxString)\n}\n\n```\n\n### example 2\n\n```go\n\n// Pair[T, U] represents a generic pair of values.\ntype Pair[T, U any] struct {\n\tFirst  T\n\tSecond U\n}\n\nfunc main() {\n\tpair := Pair[int, string]{First: 42, Second: \"hello\"}\n\n\tfmt.Println(\"First:\", pair.First)\n\tfmt.Println(\"Second:\", pair.Second)\n\n\t// Print the types of the values in the pair.\n\tfmt.Println(\"Type of First:\", reflect.TypeOf(pair.First))\n\tfmt.Println(\"Type of Second:\", reflect.TypeOf(pair.Second))\n}\n\n```\n\n## Go File I/O {.cols-2}\n\n### Reading a File\n\nRead the contents of a file into memory.\n\n```go\ndata, err := os.ReadFile(\"file.txt\")\nif err != nil {\n    log.Fatal(err)\n}\n```\n\n### Writing to a File\n\nWrite data to a file with specific permissions (e.g., 0644 for read-write).\n\n```go\nerr := os.WriteFile(\"file.txt\", []byte(\"Hello, Go!\"), 0644)\n```\n\n## Go Testing {.cols-2}\n\n### Unit Test\n\nUnit Test: A basic unit test follows the below naming convention and uses t.Errorf() to report failures.\n\n```go\nfunc TestAdd(t *testing.T) {\n    result := add(2, 3)\n    if result != 5 {\n        t.Errorf(\"Expected 5, got %d\", result)\n    }\n}\n```\n\n### Unit Test\n\nBenchmark: Benchmark tests measure performance, using b.N to control iterations.\n\n```go\nfunc BenchmarkAdd(b *testing.B) {\n    for i := 0; i < b.N; i++ {\n        add(1, 2)\n    }\n}\n```\n\n## Go JSON Handling {.cols-2}\n\n### JSON Encoding\n\nConvert a Go struct to JSON.\n\n```go\ndata, _ := json.Marshal(person)\n```\n\n### JSON Decoding\n\nParse JSON data into a Go struct.\n\n```go\njson.Unmarshal(data, &person)\n```\n\n## Go Server {.cols-2}\n\n### net/http (Standard Library)\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"net/http\"\n)\n\nfunc handler(w http.ResponseWriter, r *http.Request) {\n    fmt.Fprint(w, \"Hello from net/http!\")\n}\n\nfunc main() {\n\n    http.HandleFunc(\"/\", handler)\n\n    http.ListenAndServe(\":8080\", nil)\n}\n\n```\n\n### gorilla/mux\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"net/http\"\n    \"github.com/gorilla/mux\"\n)\n\nfunc main() {\n\n    r := mux.NewRouter()\n\n    r.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n        fmt.Fprint(w, \"Hello from Gorilla Mux!\")\n    })\n\n    http.ListenAndServe(\":8081\", r)\n}\n\n```\n\n### chi\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"net/http\"\n    \"github.com/go-chi/chi/v5\"\n)\n\nfunc main() {\n\n    r := chi.NewRouter()\n\n    r.Get(\"/\", func(w http.ResponseWriter, r *http.Request) {\n        fmt.Fprint(w, \"Hello from Chi!\")\n    })\n\n    http.ListenAndServe(\":8082\", r)\n}\n```\n\n### gin\n\n```go\npackage main\n\nimport (\n    \"github.com/gin-gonic/gin\"\n)\n\nfunc main() {\n\n    r := gin.Default()\n\n    r.GET(\"/\", func(c *gin.Context) {\n        c.String(200, \"Hello from Gin!\")\n    })\n\n    r.Run(\":8083\")\n}\n```\n\n### fiber\n\n```go\npackage main\n\nimport (\n    \"github.com/gofiber/fiber/v3\"\n)\n\nfunc main() {\n\n    app := fiber.New()\n\n    app.Get(\"/\", func(c *fiber.Ctx) error {\n        return c.SendString(\"Hello from Fiber!\")\n    })\n\n    app.Listen(\":8084\")\n}\n```\n\n### beego\n\n```go\npackage main\n\nimport (\n    \"github.com/beego/beego/v2/server/web\"\n)\n\nfunc main() {\n\n    web.Get(\"/\", func(ctx *web.Context) {\n        ctx.Output.Body([]byte(\"Hello from Beego!\"))\n    })\n\n    web.Run()\n}\n\n```\n\n## Miscellaneous\n\n### Keywords\n\n- `break`\n- `default`\n- `func`\n- `interface`\n- `select`\n- `case`\n- `defer`\n- `go`\n- `map`\n- `struct`\n- `chan`\n- `else`\n- `goto`\n- `package`\n- `switch`\n- `const`\n- `fallthrough`\n- `if`\n- `range`\n- `type`\n- `continue`\n- `for`\n- `import`\n- `return`\n- `var`\n- `iota`\n\n{.cols-3 .marker-none}\n\n### Operators and punctuation\n\n|                 |                 |                  |                  |                   |      |       |     |     |\n| --------------- | --------------- | ---------------- | ---------------- | ----------------- | ---- | ----- | --- | --- |\n| `+`             | `&`             | `+=`             | `&=`             | `&&`              | `==` | `!=`  | `(` | `)` |\n| `-`             | <code>\\|</code> | `-=`             | <code>\\|=</code> | <code>\\|\\|</code> | `<`  | `<=`  | `[` | `]` |\n| <code>\\*</code> | `^`             | <code>\\*=</code> | `^=`             | `<-`              | `>`  | `>=`  | `{` | `}` |\n| `/`             | `<<`            | `/=`             | `<<=`            | `++`              | `=`  | `:=`  | `,` | `;` |\n| `%`             | `>>`            | `%=`             | `>>=`            | `--`              | `!`  | `...` | `.` | `:` |\n|                 | `&^`            | `&^=`            |                  |                   |      |       |     |     |\n\n## Also see {.cols-1}\n\n- [Devhints](https://devhints.io/go) _(devhints.io)_\n- [A tour of Go](https://tour.go.dev/welcome/1) _(tour.go.dev)_\n- [Go wiki](https://github.com/golang/go/wiki/) _(github.com)_\n- [Effective Go](https://go.dev/doc/effective_go) _(go.dev)_\n- [Go by Example](https://gobyexample.com/) _(gobyexample.com)_\n- [Awesome Go](https://awesome-go.com/) _(awesome-go.com)_\n- [JustForFunc Youtube](https://www.youtube.com/channel/UC_BzFbxG2za3bp5NRRRXJSw) _(youtube.com)_\n- [Style Guide](https://github.com/golang/go/wiki/CodeReviewComments) _(github.com)_\n"
  },
  {
    "path": "source/_posts/google-chrome.md",
    "content": "---\ntitle: Google Chrome\ndate: 2022-11-23 16:23:31.696190\nbackground: bg-[#ca4732]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 65 keyboard shortcuts found in Google Chrome\n---\n\n## Keyboard Shortcuts {.cols-2}\n\n### Tab and window\n\n| Shortcut             | Action                                                      |\n| -------------------- | ----------------------------------------------------------- |\n| `Ctrl` `N`           | Open a new window                                           |\n| `Ctrl` `Shift` `N`   | Open a new window in Incognito mode                         |\n| `Ctrl` `T`           | Open a new tab, and jump to it                              |\n| `Ctrl` `Shift` `T`   | Reopen the last closed tab, and jump to it                  |\n| `Ctrl` `Tab`         | Jump to the next open tab                                   |\n| `Ctrl` `Shift` `Tab` | Jump to the previous open tab                               |\n| `Ctrl` `1-8`         | Jump to a specific tab                                      |\n| `Ctrl` `9`           | Jump to the last tab                                        |\n| `Alt` `Home`         | Open your home page in the current tab                      |\n| `Alt` `Left`         | Open the previous page from your history in the current tab |\n| `Alt` `Right`        | Open the next page from your history in the current tab     |\n| `Ctrl` `W`           | Close the current tab                                       |\n| `Ctrl` `Shift` `W`   | Close the current window                                    |\n| `Alt` `Space` `N`    | Minimize the current window                                 |\n| `Alt` `Space` `X`    | Maximize the current window                                 |\n| `Alt` `F4`           | Close the current window                                    |\n| `Ctrl` `Shift` `Q`   | Quite Google Chrome                                         |\n\n{.shortcuts}\n\n### Google Chrome features\n\n| Shortcut                | Action                                             |\n| ----------------------- | -------------------------------------------------- |\n| `Alt` `F`               | Open the Chrome menu                               |\n| `Ctrl` `Shift` `B`      | Show or hide the Bookmarks bar                     |\n| `Ctrl` `Shift` `O`      | Open the Bookmarks manager                         |\n| `Ctrl` `H`              | Open the History page in a new tab                 |\n| `Ctrl` `J`              | Open the Downloads page in a new tab               |\n| `Shift` `Esc`           | Open the Chrome Task Manager                       |\n| `Shift` `Alt` `T`       | Set focus on the first item in the Chrome toolbar  |\n| `F10`                   | Set focus on the last item in the Chrome toolbar   |\n| `F6`                    | Switch focus to unfocused dialog (if showing)      |\n| `Ctrl` `F`              | Open the Find Bar to search the current page       |\n| `Ctrl` `G`              | Jump to the next match to your Find Bar search     |\n| `Ctrl` `Shift` `G`      | Jump to the previous match to your Find Bar search |\n| `F12`                   | Open Developer Tools                               |\n| `Ctrl` `Shift` `Delete` | Open the Clear Browsing Data options               |\n| `F1`                    | Open the Chrome Help Center in a new tab           |\n| `Ctrl` `Shift` `M`      | Log in a different user or browse as a Guest       |\n| `Alt` `Shift` `I`       | Open a feedback form                               |\n\n{.shortcuts}\n\n### Address bar\n\n| Shortcut         | Action                                                        |\n| ---------------- | ------------------------------------------------------------- |\n| `(type)` `Enter` | Search with your default search engine                        |\n| `(type)` `Tab`   | Search using a different search engine                        |\n| `Ctrl` `Enter`   | Add www. and .com to a site name, and open in the current tab |\n| `Alt` `Enter`    | Open a new tab and perform a Google search                    |\n| `Ctrl` `L`       | Jump to the address bar                                       |\n| `Ctrl` `K`       | Search from anywhere on the page                              |\n| `Shift` `Delete` | Remove predictions from your address bar                      |\n\n{.shortcuts}\n\n### Webpage shortcuts\n\n| Shortcut                 | Action                                                             |\n| ------------------------ | ------------------------------------------------------------------ |\n| `Ctrl` `P`               | Open options to print the current page                             |\n| `Ctrl` `S`               | Open options to save the current page                              |\n| `Ctrl` `R`               | Reload the current page                                            |\n| `Ctrl` `Shift` `R`       | Reload the current page, ignoring cached content                   |\n| `Esc`                    | Stop the page loading                                              |\n| `Tab`                    | Browse clickable items moving forward                              |\n| `Shift` `Tab`            | Browse clickable items moving backward                             |\n| `Ctrl` `O`               | Open a file from your computer in Chrome                           |\n| `Ctrl` `U`               | Display non-editable HTML source code for the current page         |\n| `Ctrl` `D`               | Save your current webpage as a bookmark                            |\n| `Ctrl` `Shift` `D`       | Save all open tabs as bookmarks in a new folder                    |\n| `F11`                    | Turn full-screen mode on or off                                    |\n| `Ctrl` `+`               | Make everything on the page bigger                                 |\n| `Ctrl` `-`               | Make everything on the page smaller                                |\n| `Ctrl` `0`               | Return everything on the page to default size                      |\n| `Space`                  | Scroll down a webpage, a screen at a time                          |\n| `Shift` `Space`          | Scroll up a webpage, a screen at a time                            |\n| `Home`                   | Go to the top of the page                                          |\n| `End`                    | Go to the bottom of the page                                       |\n| `Shift` `(scroll mouse)` | Scroll horizontally on the page                                    |\n| `Ctrl` `Left`            | Move your cursor to the front of the previous word in a text field |\n| `Ctrl` `Right`           | Move your cursor to the back of the next word in a text field      |\n| `Ctrl` `Backspace`       | Delete the previous word in a text field                           |\n| `Alt` `Home`             | Open the Home page in the current tab                              |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Google Chrome](https://support.google.com/chrome/answer/157179?hl=en) _(support.google.com)_\n"
  },
  {
    "path": "source/_posts/google-drive.md",
    "content": "---\ntitle: Google Drive\ndate: 2022-11-23 16:23:31.701360\nbackground: bg-[#479b61]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 54 keyboard shortcuts found in Google Drive on the web\n---\n\n## Keyboard Shortcuts\n\n### Navigation and views\n\n| Shortcut | Action                                     |\n| -------- | ------------------------------------------ |\n| `G` `N`  | Go to navigation panel (folders list)      |\n| `G` `L`  | Go to items view                           |\n| `V`      | Switch between grid and list in items view |\n| `G` `D`  | Go to details pane                         |\n| `G` `T`  | Go to top of application (Google bar)      |\n| `G` `A`  | Go to download status                      |\n| `G` `U`  | Go to upload status                        |\n| `D`      | Show or hide details pane                  |\n| `I`      | Show or hide activity pane                 |\n\n{.shortcuts}\n\n### Select items\n\n| Shortcut        | Action                        |\n| --------------- | ----------------------------- |\n| `X`             | Select or deselect item       |\n| `J/Down`        | Select next item down         |\n| `K/Up`          | Select next item up           |\n| `H/Left`        | Select next item to the left  |\n| `L/Right`       | Select next item to the right |\n| `Shift` `Down`  | Extend selection down         |\n| `Shift` `Up`    | Extend selection up           |\n| `Shift` `Left`  | Extend selection left         |\n| `Shift` `Right` | Extend selection right        |\n| `Shift` `A`     | Select all visible items      |\n| `Shift` `N`     | Clear all selections          |\n\n{.shortcuts}\n\n### Move between items\n\n| Shortcut       | Action                                |\n| -------------- | ------------------------------------- |\n| `Ctrl` `Down`  | Move down without changing selection  |\n| `Ctrl` `Up`    | Move up without changing selection    |\n| `Ctrl` `Left`  | Move left without changing selection  |\n| `Ctrl` `Right` | Move right without changing selection |\n\n{.shortcuts}\n\n### Take action on selected items\n\n| Shortcut           | Action                                     |\n| ------------------ | ------------------------------------------ |\n| `Enter`            | Open selected item                         |\n| `N`                | Rename selected item                       |\n| `.`                | Share selected items                       |\n| `Z`                | Move selected items to new folder          |\n| `S`                | Star or unstar selected items              |\n| `Shift` `Z`        | Add selected items to an additional folder |\n| `Delete`           | Remove selected items                      |\n| `Ctrl` `Z`         | Undo last action                           |\n| `Ctrl` `Shift` `Z` | Redo last undone action                    |\n\n{.shortcuts}\n\n### Create new items\n\n| Shortcut    | Action       |\n| ----------- | ------------ |\n| `Shift` `T` | Document     |\n| `Shift` `P` | Presentation |\n| `Shift` `S` | Spreadsheet  |\n| `Shift` `D` | Drawing      |\n| `Shift` `F` | Folder       |\n| `Shift` `O` | Form         |\n\n{.shortcuts}\n\n### Open menus\n\n| Shortcut | Action                      |\n| -------- | --------------------------- |\n| `C`      | Create menu                 |\n| `A`      | More actions menu           |\n| `F`      | Current folder actions menu |\n| `R`      | Sort menu                   |\n| `T`      | Settings menu               |\n\n{.shortcuts}\n\n### Application actions\n\n| Shortcut    | Action                          |\n| ----------- | ------------------------------- |\n| `Shift` `/` | Display keyboard shortcuts list |\n| `Q` `Q`     | Choose next visual density      |\n| `Ctrl` `F`  | Find/find next                  |\n| `Ctrl` `P`  | Print                           |\n| `M`         | Show last message               |\n| `/`         | Search your drive               |\n\n{.shortcuts}\n\n### Preview mode actions\n\n| Shortcut | Action     |\n| -------- | ---------- |\n| `Esc`    | Close      |\n| `Space`  | Play/pause |\n| `+/=`    | Zoom in    |\n| `-`      | Zoom out   |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Google Drive](https://support.google.com/drive/answer/2563044?hl=en) _(support.google.com)_\n"
  },
  {
    "path": "source/_posts/google-search.md",
    "content": "---\ntitle: Google Search\ndate: 2023-01-10 09:51:44\nbackground: bg-[#d3594a]\ntags:\ncategories:\n  - Other\nintro: |\n  This quick reference cheat sheet lists of Google advanced search operators.\n---\n\n## Getting Started {.cols-2}\n\n### Google Advanced Search Operators\n\n| Operator    | Description                                                                                                                                                                                   | Category   |\n| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |\n| `\"\"`        | Allows searching for a specific phrase - exact match search. Individual word prevents synonyms                                                                                                | Basic,Mail |\n| `OR`/`AND`  | Boolean search function for OR searches as Google defaults to AND between words - must be all caps                                                                                            | Basic,Mail |\n| `\\`         | Implements OR                                                                                                                                                                                 | Basic      |\n| `()`        | Allows grouping of operators and helps dictate order                                                                                                                                          | Basic,Mail |\n| `-`         | Excludes a word from results                                                                                                                                                                  | Basic,Mail |\n| `*`         | Acts as a wildcard and will match any word or phrase                                                                                                                                          | Basic      |\n| `#..#`      | # represents a number in this instance. Use to find numbers in a series.                                                                                                                      | Basic      |\n| `$`         | Allows for search of USD                                                                                                                                                                      | Basic      |\n| `€`         | Allows for search of Euro                                                                                                                                                                     | Basic      |\n| `in`        | Allows searches for unit conversion (currency, unit or measure)                                                                                                                               | Basic      |\n| `~`         | Prefix - Include synonyms (potentially defunct)                                                                                                                                               | Basic      |\n| `+`         | Prefix - Force exact match on single phrase                                                                                                                                                   | Basic,Mail |\n| `AROUND(X)` | This is sandwiched between two words and the X declares how many words they must be mentioned between. I.e. if it’s (4) then the two keywords must be mentioned within 4 words of each other. | Advanced   |\n| `_`         | Acts as wildcard for autocomplete                                                                                                                                                             | Advanced   |\n\n### Search with url\n\n| Operator    | Description                                                                                                                                | Category |\n| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ | -------- |\n| `inurl:`    | Only returns results where the queried keyword(s) is present in the URL                                                                    | Advanced |\n| `allinurl:` | As above but only containing all of the specified words in the URL                                                                         | Advanced |\n| `blogurl:`  | Find blog URLs under a specific domain. This was used in Google blog search, but I’ve found it does return some results in regular search. | Advanced |\n| `site:`     | Limit results to those from one site                                                                                                       | Advanced |\n| `related:`  | Find similar domains to the queried domain                                                                                                 | Advanced |\n\n### Search with dates\n\n| Operator     | Description                                                                                          | Category   |\n| ------------ | ---------------------------------------------------------------------------------------------------- | ---------- |\n| `daterange:` | Return results in a specified range (requires julian dates)                                          | Advanced   |\n| `after:`     | Allows you to search drive or mail for files modified or mail sent/received anytime after a set date | Drive,Mail |\n| `before:`    | Allows you to search drive or mail for files modified or mail sent/received before a certain date    | Drive,Mail |\n| `older:`     | Search for messages older than a certain date                                                        | Mail       |\n| `newer:`     | Search for messages newer than a certain date                                                        | Mail       |\n\n### Search files\n\n| Operator        | Description                                                                                          | Category   |\n| --------------- | ---------------------------------------------------------------------------------------------------- | ---------- |\n| `filename:`     | Search for messages with a particular type of file attached, or the exact name of a file             | Mail       |\n| `type:`         | Allows you to search drive by file type                                                              | Drive      |\n| `owner:`        | Allows you to search drive by owner of file or folder                                                | Drive      |\n| `to:`           | Allows you to search drive for files shared with a specific person                                   | Drive      |\n| `title:`        | Searches drive for files with the keyword in their title alone                                       | Drive      |\n| `source:domain` | Allows you to search for files or folders shared with everyone in your business                      | Drive      |\n| `filetype:`     | Returns only files of a particular type associated with the keyword searched                         | Advanced   |\n| `ext:`          | As above, based on extension                                                                         | Advanced   |\n| `after:`        | Allows you to search drive or mail for files modified or mail sent/received anytime after a set date | Drive,Mail |\n| `before:`       | Allows you to search drive or mail for files modified or mail sent/received before a certain date    | Drive,Mail |\n| `is:trashed`    | Searches for the item in the Drive bin                                                               | Drive      |\n\n### Search with page content\n\n| Operator       | Description                                                                                                         | Category |\n| -------------- | ------------------------------------------------------------------------------------------------------------------- | -------- |\n| `link:`        | Find pages that link to the target domain                                                                           | Advanced |\n| `inanchor:`    | Find pages linked to with the specified anchor text/ phrase. Data is heavily sampled.                               | Advanced |\n| `allinanchor:` | Find pages with all individual terms after \"inanchor:\" in the inbound anchor text.                                  | Advanced |\n| `intitle:`     | Returns pages based on the searched query appearing in their title                                                  | Advanced |\n| `allintitle:`  | Similar to intitle: but only returns titles where all the words in the title match                                  | Advanced |\n| `inposttile:`  | Finds pages with keywords in their post titles (i.e. for researching blogs)                                         | &nbsp;   |\n| `intext:`      | Finds pages where the keyword(s) are mentioned within the page content.                                             | Advanced |\n| `allintext:`   | Similar to “intext,” but only results containing all of the specified words somewhere on the page will be returned. | Advanced |\n\n### Keywords\n\n| Operator          | Description                                                                                      | Category |\n| ----------------- | ------------------------------------------------------------------------------------------------ | -------- |\n| `Business`        | type E.g. cafe, restaurant, bar etc will return a selection of appropriate businesses in the are | Maps     |\n| `Petrol/Charging` | Station EV near me or perol station near me returns                                              | Maps     |\n| `Search`          | for a message with a google sheet attached                                                       | Mail     |\n| `Search`          | for a message with a google presentation attached                                                | Mail     |\n\n### Search on emails\n\n| Operator           | Description                                                                                           | Category   |\n| ------------------ | ----------------------------------------------------------------------------------------------------- | ---------- |\n| `+`                | Prefix - Force exact match on single phrase                                                           | Basic,Mail |\n| `()`               | Allows grouping of operators and helps dictate order                                                  | Basic,Mail |\n| `-`                | Excludes a word from results                                                                          | Basic,Mail |\n| `\"\"`               | Allows searching for a specific phrase - exact match search. Individual word prevents synonyms        | Basic,Mail |\n| `OR`/`AND`         | Boolean search function for OR searches as Google defaults to AND between words - must be all caps    | Basic,Mail |\n| `after:`           | Allows you to search drive or mail for files modified or mail sent/received anytime after a set date  | Drive,Mail |\n| `before:`          | Allows you to search drive or mail for files modified or mail sent/received before a certain date     | Drive,Mail |\n| `is:starred`       | Searches only items that have been starred in drive                                                   | Drive,Mail |\n| `from:`            | Specify the sender in google mail                                                                     | Mail       |\n| `to:`              | Specify the recipient in google mail                                                                  | Mail       |\n| `cc:`              | Search by a recipient that was copied into an email                                                   | Mail       |\n| `bcc:`             | Search by a recipient that was blind copied into an email                                             | Mail       |\n| `older:`           | Search for messages older than a certain date                                                         | Mail       |\n| `newer:`           | Search for messages newer than a certain date                                                         | Mail       |\n| `Search`           | for a message with a google sheet attached                                                            | Mail       |\n| `Search`           | for a message with a google presentation attached                                                     | Mail       |\n| `AROUND`           | Similar to the normal google search function, allows you to search for keywords near each other.      | Mail       |\n| `subject:`         | Search by keywords featured in the subject line                                                       | Mail       |\n| `{}`               | Use for OR in mail instead of the OR function                                                         | Mail       |\n| `label:`           | Search for messages that have a certain label                                                         | Mail       |\n| `has:attachment`   | Search for messages that have an item attached                                                        | Mail       |\n| `has:drive`        | Search for messages with a google drive attached                                                      | Mail       |\n| `has:document`     | Search for messages with a google doc attached                                                        | Mail       |\n| `has:youtube`      | Search for a message containing a youtube video                                                       | Mail       |\n| `list:`            | Search for all messages from a particular mailing list                                                | Mail       |\n| `in:anywhere`      | Includes all folders in your search, including spam and bin                                           | Mail       |\n| `is:important`     | Search for messages that have been marked as important                                                | Mail       |\n| `label:important`  | Same as is:important                                                                                  | Mail       |\n| `is:snoozed`       | Searches for messages that have been snoozed                                                          | Mail       |\n| `is:unread`        | Searches for unread messages                                                                          | Mail       |\n| `is:read`          | searches for read messages only                                                                       | Mail       |\n| `has:yellow-star`  | Searches for messages with coloured star icon                                                         | Mail       |\n| `has:blue-info`    | Searches for messages with colourd icon                                                               | Mail       |\n| `is:chat`          | Searches for messagse from chat                                                                       | Mail       |\n| `deliveredto:`     | Search by email address for delivered messages                                                        | Mail       |\n| `category:`        | Searches by messages based on category. Follow the colon with the categoy name, i.e. category:primary | Mail       |\n| `size:`            | Messages larger than a certain size in bytes                                                          | Mail       |\n| `larger:`          | Messages larger than a certain size in bytes                                                          | Mail       |\n| `smaller:`         | Messages smaller than a certain size in bytes                                                         | Mail       |\n| `has:userlabels`   | Search for messages that have custom user labels                                                      | Mail       |\n| `has:nouserlabels` | Search for messages that have no custom user labels                                                   | Mail       |\n\n### Some other useful search operators\n\n| Operator    | Description                                                                                                                                                            | Category |\n| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |\n| `define:`   | Pulls a card response from Google displaying the dictionary definition of the word or phrase                                                                           | Advanced |\n| `cache:`    | Returns the most up to date cache of an indexed web page                                                                                                               | Advanced |\n| `weather:`  | Brings up the featured snipped for weather for that location                                                                                                           | Advanced |\n| `stocks:`   | Returns stock information for the specified ticker                                                                                                                     | Advanced |\n| `map:`      | Force google map results for a particular query                                                                                                                        | Advanced |\n| `movie:`    | Find information for the specified movie (particularly useful when that movie has an ambiguous name). If the movie is still in theatres it’ll also return screen times | Advanced |\n| `source:`   | Use in google news, returns results from the specified source                                                                                                          | Advanced |\n| `loc:`      | Returns results for a specific location                                                                                                                                | Advanced |\n| `location:` | As above but with Google news                                                                                                                                          | Advanced |\n| `info:`     | Returns information related to a domain (pages with domain text, similar on-site pages, cache etc)                                                                     | Advanced |\n| `near`      | Part of the google maps lazy searches e.g. book shops near work                                                                                                        | Maps     |\n\n## Also see\n\n- [Google Search Operators Cheat Sheet](https://static.semrush.com/blog/uploads/files/39/12/39121580a18160d3587274faed6323e2.pdf)\n  _(static.semrush.com)_\n"
  },
  {
    "path": "source/_posts/gospinwheel.md",
    "content": "---\ntitle: GoSpinWheel\ndate: 2025-12-16 17:20:00\nbackground: bg-gradient-to-br from-indigo-500 via-purple-500 to-pink-500\ntags:\n  - Tool\n  - Productivity\n  - Streaming\ncategories:\n  - Other\nintro: Quick-reference cheatsheet for GoSpinWheel — a modern random wheel spinner, name picker, and decision maker.\nplugins:\n  - copyCode\n---\n\n## Essentials\n\n### What is GoSpinWheel?\n\n**[GoSpinWheel random wheel spinner](https://gospinwheel.com)** is a free, modern online tool for random selection and decision making. It’s a privacy-focused alternative to older “wheel spinner” sites, with a clean UI made for everyday use.\n\n- **Core use cases**: Giveaways, classroom name picking, party games, quick decisions.\n- **Login**: Not required (uses local browser storage).\n- **Cost**: Free to use.\n\n### Unique Features {.col-span-2}\n\n| Feature              | Description                                                                            |\n| :------------------- | :------------------------------------------------------------------------------------- |\n| **Multi-Wheel Sync** | Run up to 6 wheels at once (e.g., one for names, one for prizes).                      |\n| **True Randomness**  | Uses `crypto.getRandomValues()` instead of `Math.random()` for cryptographic fairness. |\n| **Elimination Mode** | Option to temporarily remove a winner from the wheel after they are picked.            |\n| **Share Links**      | Generate a shareable link to publish a wheel and send it to friends.                   |\n| **Auto-Save & Sync** | Auto-saves to Local Storage and keeps your wheel state in sync on the same device.     |\n| **Import / Export**  | Export wheel configurations for backup, then import them later to restore.             |\n| **Streamer Mode**    | Optimized for OBS/Zoom with a clean UI and fullscreen capabilities.                    |\n| **Privacy**          | Data is stored locally in your browser, not on external servers.                       |\n\n## Controls & Fairness\n\n### Shortcuts & Actions\n\n| Action    | Description    |\n| :-------- | :------------- |\n| `Space`   | Start spinning |\n| `Cmd` `K` | Search wheels  |\n\n{.shortcuts}\n\n### Customization Options\n\n- **Entries**: Add bulk names/items via the right panel.\n- **Weight**: Adjust probability for specific items (advanced).\n- **Themes**: Switch between light/dark, or custom color palettes.\n- **Sound**: Toggle spin sounds and winning fanfares.\n\n### Sharing & Backup\n\n- **Share publicly**: Generate a share link and send it to friends (great for games, raffles, or classroom use).\n- **Local Storage sync**: Changes are auto-saved and stay consistent on the same device/browser.\n- **Export / import**: Save your wheel configuration locally (backup/transfer), then import it back anytime.\n\n### Randomness Audit\n\n**Fairness Tech**: Uses `crypto.getRandomValues()` (CSPRNG) instead of predictable `Math.random()`.\n\n**Verification**:\n\n- Visit the [GoSpinWheel randomness audit tool](https://gospinwheel.com/randomness-audit).\n- Use the **Audit Tool** to run 10,000+ simulations.\n- Verify the deviation is statistically insignificant.\n\n## Popular Templates\n\n### Party Games\n\n- **[Truth or Dare](https://gospinwheel.com/truth-or-dare)**: Dual-wheel spinner for players and actions. Spice up the party.\n- **[Who Pays?](https://gospinwheel.com/who-pays-for-dinner)**: Left wheel decides \"What to eat\", right wheel decides \"Who pays\".\n- **[Love Calculator](https://gospinwheel.com/love-calculator)**: Will they text back? Ask the universe with this fun calculator.\n- **[Rock Paper Scissors](https://gospinwheel.com/rock-paper-scissors)**: Need an impartial referee? Let the wheel throw for you.\n\n### Utility Tools\n\n- **[Name Picker](https://gospinwheel.com/name-picker)**: Pick winners fairly with weighted entries. Perfect for raffles and teams.\n- **[Student Picker](https://gospinwheel.com/student-picker)**: The essential classroom tool. Pick students fairly for questions or tasks.\n\n### Decision Making\n\n- **[Yes or No](https://gospinwheel.com/yes-or-no)**: The fastest way to make a decision. Yes, No, or Maybe?\n- **[What to Eat](https://gospinwheel.com/what-to-eat)**: Solve the \"What should we eat?\" debate instantly.\n- **[Movie Picker](https://gospinwheel.com/movie-picker)**: Cure Netflix \"doom scrolling\" and pick a film for movie night.\n\n## Comparison\n\n### vs. Competitors {.col-span-3}\n\n| Feature         |      GoSpinWheel      | Wheel of Names | Picker Wheel  |\n| :-------------- | :-------------------: | :------------: | :-----------: |\n| **Randomness**  | **Crypto** (Verified) | Math.random()  | Math.random() |\n| **Ads**         |  **Minimal / None**   |      High      |     High      |\n| **Multi-Wheel** |    **Yes (Sync)**     |       No       |      No       |\n| **UI/UX**       |    **Modern 2024**    |     Dated      |     Dated     |\n| **Speed**       |       **Fast**        |    Average     |    Average    |\n\n{.show-header}\n"
  },
  {
    "path": "source/_posts/graphql.md",
    "content": "---\ntitle: GraphQL\ndate: 2021-07-15 20:51:44\nbackground: bg-[#cc44a2]\ntags:\n  - query\n  - API\ncategories:\n  - Programming\nintro: |\n  This quick reference cheat sheet provides a brief overview of GraphQL.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Overview\n\n- An alternative approach to RESTful APIs\n- GraphQL is a query language for APIs\n- Easily describe the shape of the GraphQL API using clear shared terms.\n- Clients issue queries/mutations to read and update data\n- GraphQL syntax can express complex entity relations\n- Libraries to implement GraphQL in [different languages](https://graphql.org/code/)\n\n[GraphQL](https://graphql.org/) {.link-arrow}\n\n### Schema\n\n|                |                                  |\n| -------------- | -------------------------------- |\n| `schema`       | GraphQL schema definition        |\n| `query`        | Read and traverse data           |\n| `mutation`     | Modify data or trigger an action |\n| `subscription` | Run a query when an event occurs |\n\n### Built-in Scalar Types\n\n|           |                                              |\n| --------- | -------------------------------------------- |\n| `Int`     | Signed 32‐bit integer                        |\n| `Float`   | Signed double-precision floating-point value |\n| `String`  | UTF‐8 character sequence                     |\n| `Boolean` | true or false                                |\n| `ID`      | A Unique identifier                          |\n\n### Type Definitions\n\n|             |                   |\n| ----------- | ----------------- |\n| `scalar`    | Scalar Type       |\n| `type`      | Object Type       |\n| `interface` | Interface Type    |\n| `union`     | Union Type        |\n| `enum`      | Enum Type         |\n| `input`     | Input Object Type |\n\n### Type Modifiers\n\n|              |                                   |\n| ------------ | --------------------------------- |\n| `String`     | Nullable String                   |\n| `String!`    | Non-null String                   |\n| `[String]`   | List of nullable Strings          |\n| `[String]!`  | Non-null list of nullable Strings |\n| `[String!]!` | Non-null list of non-null Strings |\n\n### Input Arguments {.row-span-2}\n\n#### Basic Input\n\n```js\ntype Query {\n    users(limit: Int): [User]\n}\n```\n\n#### Input with default value\n\n```js\ntype Query {\n    users(limit: Int = 10): [User]\n}\n```\n\n#### Input with multiple arguments\n\n```js\ntype Query {\n    users(limit: Int, sort: String): [User]\n}\n```\n\n#### Input with multiple arguments and default values\n\n```js {.wrap}\ntype Query {\n    users(limit: Int = 10, sort: String): [User]\n}\ntype Query {\n    users(limit: Int, sort: String = \"asc\"): [User]\n}\ntype Query {\n    users(limit: Int = 10, sort: String = \"asc\"): [User]\n}\n```\n\n### Input Types\n\n```js\ninput ListUsersInput {\n    limit: Int\n    since_id: ID\n}\n```\n\n```js\ntype Mutation {\n    users(params: ListUsersInput): [User]!\n}\n```\n\n### Custom Scalars\n\n```js\nscalar Url\ntype User {\n    name: String\n    homepage: Url\n}\n```\n\n### Interfaces\n\n```js\ninterface Foo {\n    is_foo: Boolean\n}\ninterface Goo {\n    is_goo: Boolean\n}\ntype Bar implements Foo {\n    is_foo: Boolean\n    is_bar: Boolean\n}\ntype Baz implements Foo, Goo {\n    is_foo: Boolean\n    is_goo: Boolean\n    is_baz: Boolean\n}\n```\n\nObject implementing one or more Interfaces\n\n### Unions\n\n```js\ntype Foo {\n    name: String\n}\ntype Bar {\n    is_bar: String\n}\nunion SingleUnion = Foo\nunion MultipleUnion = Foo | Bar\ntype Root {\n    single: SingleUnion\n    multiple: MultipleUnion\n}\n```\n\nUnion of one or more Objects\n\n### Enums\n\n```js {.wrap}\nenum USER_STATE {\n    NOT_FOUND\n    ACTIVE\n    INACTIVE\n    SUSPENDED\n}\ntype Root {\n    stateForUser(userID: ID!): USER_STATE!\n    users(state: USER_STATE, limit: Int = 10): [User]\n}\n```\n\n## Also see\n\n- [GraphQL Schema Language Cheat Sheet](https://github.com/sogko/graphql-schema-language-cheat-sheet) _(github.com)_\n"
  },
  {
    "path": "source/_posts/grep.md",
    "content": "---\ntitle: Grep\ndate: 2020-11-25 18:28:43\nbackground: bg-indigo-400\ntags:\n  - egrep\n  - search\n  - pattern\n  - text\ncategories:\n  - Linux Command\nintro:\n  This cheat sheet is intended to be a quick reminder for the main concepts involved in using the command line program\n  grep and assumes you already understand its usage.\nplugins:\n  - copyCode\n---\n\n## Getting Started {.cols-5}\n\n### Usage {.col-span-2}\n\nSearch standard output (i.e. a stream of text)\n\n```shell script\n$ grep [options] search_string\n```\n\nSearch for an exact string in file:\n\n```shell script\n$ grep [options] search_string path/to/file\n```\n\nPrint lines in myfile.txt containing the string \"mellon\"\n\n```shell script\n$ grep 'mellon' myfile.txt\n```\n\nWildcards are accepted in filename.\n\n### Option examples {.col-span-3}\n\n| Option | Example                                   | Operation                                            |\n| ------ | ----------------------------------------- | ---------------------------------------------------- |\n| `-i`   | grep -i ^DA demo.txt                      | Forgets about case sensitivity                       |\n| `-w`   | grep -w \"of\" demo.txt                     | Search only for the full word                        |\n| `-A`   | grep -A 3 'Exception' error.log           | Display 3 lines after matching string                |\n| `-B`   | grep -B 4 'Exception' error.log           | Display 4 lines before matching string               |\n| `-C`   | grep -C 5 'Exception' error.log           | Display 5 lines around matching string               |\n| `-r`   | grep -r 'cheatsheets.zip' /var/log/nginx/ | Recursive search _(within subdirs)_                  |\n| `-v`   | grep -v 'warning' /var/log/syslog         | Return all lines which don't match the pattern       |\n| `-e`   | grep -e '^al' filename                    | Use regex _(lines starting with 'al')_               |\n| `-E`   | grep -E 'ja(s\\|cks)on' filename           | Extended regex _(lines containing jason or jackson)_ |\n| `-c`   | grep -c 'error' /var/log/syslog           | Count the number of matches                          |\n| `-l`   | grep -l 'robot' /var/log/\\*               | Print the name of the file(s) of matches             |\n| `-o`   | grep -o search_string filename            | Only show the matching part of the string            |\n| `-n`   | grep -n \"go\" demo.txt                     | Show the line numbers of the matches                 |\n\n## Grep regular expressions\n\n### Refer\n\n- [Regex syntax](/regex) _(cheatsheets.zip)_\n- [Regex examples](/regex#regex-examples) _(cheatsheets.zip)_\n\nPlease refer to the full version of the regex cheat sheet for more complex requirements.\n\n### Wildcards\n\n| -               | -                                      |\n| --------------- | -------------------------------------- |\n| .               | Any character.                         |\n| `?            ` | Optional and can only occur once.      |\n| `*            ` | Optional and can occur more than once. |\n| `+            ` | Required and can occur more than once. |\n\n### Quantifiers\n\n| -               | -                                            |\n| --------------- | -------------------------------------------- |\n| `{n}          ` | Previous item appears exactly n times.       |\n| `{n,}         ` | Previous item appears n times or more.       |\n| `{,m}         ` | Previous item appears n times maximum.       |\n| `{n,m}        ` | Previous item appears between n and m times. |\n\n### POSIX\n\n| -               | -                                         |\n| --------------- | ----------------------------------------- |\n| `[:alpha:]   `  | Any lower and upper case letter.          |\n| `[:digit:]   `  | Any number.                               |\n| `[:alnum:]   `  | Any lower and upper case letter or digit. |\n| `[:space:]    ` | Any whites­pace.                          |\n\n### Character\n\n| -               | -                                         |\n| --------------- | ----------------------------------------- |\n| `[A-Z­a-z]    ` | Any lower and upper case letter.          |\n| `[0-9]        ` | Any number.                               |\n| `[0-9­A-Z­a-z]` | Any lower and upper case letter or digit. |\n\n### Position\n\n|      |                    |\n| ---- | ------------------ |\n| `^ ` | Beginning of line. |\n| `$ ` | End of line.       |\n| `^$` | Empty line.        |\n| `\\<` | Start of word.     |\n| `\\>` | End of word.       |\n"
  },
  {
    "path": "source/_posts/guitar-pro.md",
    "content": "---\ntitle: Guitar Pro\ndate: 2022-11-23 16:23:31.693917\nbackground: bg-[#659af0]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 129 keyboard shortcuts found in Guitar Pro\n---\n\n## Keyboard Shortcuts\n\n### Track\n\n| Shortcut                | Action     |\n| ----------------------- | ---------- |\n| `Ctrl` `Shift` `Insert` | Add        |\n| `Ctrl` `Shift` `Delete` | Delete     |\n| `Ctrl` `Alt` `Up`       | Move up    |\n| `Ctrl` `Alt` `Down`     | Move down  |\n| `F6`                    | Properties |\n\n{.shortcuts}\n\n### Bar - General {.row-span-2}\n\n| Shortcut        | Action             |\n| --------------- | ------------------ | --------- |\n| `Ctrl` `Insert` | Insert bar         |\n| `Ctrl` `Delete` | Delete bar         |\n| `K`             | Clef               |\n| `Ctrl` `K`      | Key signature      |\n| `Ctrl` `T`      | Time signature     |\n| `Ctrl` `/`      | Triplet feel       |\n| `               | `                  | Free time |\n| `[`             | Repeat open        |\n| `]`             | Repeat close       |\n| `D`             | Directions         |\n| `Ctrl` `R`      | Multi rest         |\n| `Ctrl` `Enter`  | Force line break   |\n| `Shift` `7`     | Prevent line break |\n\n{.shortcuts}\n\n### Bar - Section\n\n| Shortcut         | Action           |\n| ---------------- | ---------------- |\n| `Shift` `Insert` | Insert or remove |\n| `Alt` `Left`     | Previous section |\n| `Alt` `Right`    | Next section     |\n\n{.shortcuts}\n\n### Bar - Simile Mark\n\n| Shortcut           | Action          |\n| ------------------ | --------------- |\n| `Shift` `5`        | Repeat one bar  |\n| `Ctrl` `Shift` `5` | Repeat two bars |\n\n{.shortcuts}\n\n### Note - Duration\n\n| Shortcut           | Action                                            |\n| ------------------ | ------------------------------------------------- |\n| `+/-`              | Increase or decrease (whole note, half note, etc) |\n| `Shift` `5`        | Dotting                                           |\n| `Ctrl` `Shift` `5` | Double dotting                                    |\n| `/`                | Triplet                                           |\n\n{.shortcuts}\n\n### Note - General {.row-span-6}\n\n| Shortcut           | Action                    |\n| ------------------ | ------------------------- |\n| `Insert`           | Insert a beat             |\n| `Shift` `Delete`   | Delete the beats          |\n| `C`                | Copy the beats at the end |\n| `L`                | Tie note                  |\n| `Shift` `L`        | Tie the beat              |\n| `F`                | Fermata                   |\n| `R`                | Rest                      |\n| `Ctrl` `D`         | Brush downstroke          |\n| `Ctrl` `U`         | Brush upstroke            |\n| `Ctrl` `Shift` `D` | Arpeggio down             |\n| `Ctrl` `Shift` `U` | Arpeggio up               |\n| `Shift` `R`        | Rasgueado                 |\n| `Shift` `D`        | PickStroke down           |\n| `Shift` `U`        | PickStroke up             |\n| `Shift` `-`        | One semi-town down        |\n| `Shift` `+`        | One semi-tone up          |\n| `Alt` `Down`       | Shift down                |\n| `Alt` `Up`         | Shift up                  |\n| `A`                | Chord                     |\n| `Shift` `I`        | Barre                     |\n| `Shift` `2`        | Timer                     |\n| `T`                | Text                      |\n\n{.shortcuts}\n\n### Effects - General {.row-span-6}\n\n| Shortcut             | Action                |\n| -------------------- | --------------------- |\n| `X`                  | Dead note             |\n| `O`                  | Ghost note            |\n| `;`                  | Accented note         |\n| `Shift` `;`          | Heavily accented note |\n| `Shift` `1`          | Staccato              |\n| `Shift` `-`          | Tenuto                |\n| `Shift` `H`          | Legato                |\n| `I`                  | Let ring              |\n| `[`                  | Palm mute note        |\n| `]`                  | Palm-mute on beat     |\n| `Y`                  | Natural harmonic      |\n| `Alt` `Y`            | Artificial harmonic   |\n| `B`                  | Bend                  |\n| `Shift` `W`          | Tremolo bar           |\n| `H`                  | Hammer on or pull-off |\n| `Shift` `9`          | Left-hand tapping     |\n| `Shift` `0`          | Tapping               |\n| `Shift` `4`          | Slap                  |\n| `Ctrl` `Shift` `4`   | Pop                   |\n| `N`                  | Trill                 |\n| `Shift` `,`          | Fade in               |\n| `Shift` `.`          | Fade out              |\n| `Ctrl` `Shift` `./,` | Volume swell          |\n| `Alt` `O`            | Wah open              |\n| `Alt` `C`            | Wah close             |\n\n{.shortcuts}\n\n### Note - Accidentals\n\n| Shortcut         | Action                |\n| ---------------- | --------------------- |\n| `Ctrl` `Alt` `7` | Double flat           |\n| `Ctrl` `7`       | Flat                  |\n| `Ctrl` `8`       | Natural               |\n| `Ctrl` `9`       | Sharp                 |\n| `Ctrl` `Alt` `9` | Double sharp          |\n| `Ctrl` `Alt` `8` | Change the accidental |\n\n{.shortcuts}\n\n### Effects - Grace Note\n\n| Shortcut  | Action          |\n| --------- | --------------- |\n| `G`       | Before the beat |\n| `Alt` `G` | On the beat     |\n\n{.shortcuts}\n\n### Effects - Vibrato\n\n| Shortcut  | Action                     |\n| --------- | -------------------------- |\n| `V`       | Left-hand vibrato (slight) |\n| `Alt` `V` | Left-hand vibrato (wide)   |\n\n{.shortcuts}\n\n### Effects - Vibrato with Trem. Bar\n\n| Shortcut  | Action                          |\n| --------- | ------------------------------- |\n| `W`       | Vibrato with trem. bar (slight) |\n| `Alt` `W` | Vibrato with trem. bar (wide)   |\n\n{.shortcuts}\n\n### Effects - Slide\n\n| Shortcut  | Action       |\n| --------- | ------------ |\n| `S`       | Legato slide |\n| `Alt` `S` | Shift slide  |\n\n{.shortcuts}\n\n### Effects - Tremolo\n\n| Shortcut    | Action             |\n| ----------- | ------------------ |\n| `Shift` `'` | Thirty-second note |\n\n{.shortcuts}\n\n### Tools\n\n| Shortcut           | Action                   |\n| ------------------ | ------------------------ |\n| `F4`               | Check the bars' duration |\n| `Ctrl` `Shift` `M` | Move or swap voices      |\n\n{.shortcuts}\n\n### Sound\n\n| Shortcut       | Action                        |\n| -------------- | ----------------------------- |\n| `Space`        | Play                          |\n| `Ctrl` `Space` | Play from the beginning       |\n| `Ctrl` `Home`  | First bar                     |\n| `Ctrl` `Left`  | Rewind                        |\n| `Ctrl` `Right` | Fast forward                  |\n| `Ctrl` `End`   | Last bar                      |\n| `F9`           | Play in loops (speed trainer) |\n| `F2`           | RSI (Realistic Sound Engine)  |\n\n{.shortcuts}\n\n### View\n\n| Shortcut         | Action         |\n| ---------------- | -------------- |\n| `Ctrl` `Alt` `D` | Design mode    |\n| `F3`             | Multitrack     |\n| `Ctrl` `B`       | Enable browser |\n| `F6`             | Fretboard      |\n| `F6`             | Keyboard       |\n| `F6`             | Drums          |\n| `F11`            | Full screen    |\n\n{.shortcuts}\n\n### Edit\n\n| Shortcut           | Action           |\n| ------------------ | ---------------- |\n| `Ctrl` `Z`         | Undo             |\n| `Ctrl` `Shift` `Z` | Redo             |\n| `Ctrl` `X`         | Cut              |\n| `Ctrl` `C`         | Copy             |\n| `Ctrl` `V`         | Paste            |\n| `Ctrl` `Shift` `X` | Multitrack cut   |\n| `Ctrl` `Shift` `C` | Multitrack copy  |\n| `Ctrl` `Shift` `V` | Special paste    |\n| `Ctrl` `A`         | Select all       |\n| `Ctrl` `G`         | Go to            |\n| `F10`              | Edit automations |\n| `Ctrl` `1-4`       | Voices           |\n\n{.shortcuts}\n\n### General\n\n| Shortcut           | Action            |\n| ------------------ | ----------------- |\n| `Ctrl` `N`         | New steel guitar  |\n| `Ctrl` `O`         | Open              |\n| `Ctrl` `W`         | Close             |\n| `Ctrl` `S`         | Save              |\n| `Ctrl` `Shift` `S` | Save As           |\n| `F5`               | Score information |\n| `F7`               | Stylesheet        |\n| `F8`               | Print preview     |\n| `Ctrl` `P`         | Print             |\n| `F12`              | Preferences       |\n| `Ctrl` `Q`         | Quit              |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Guitar Pro](https://shredaddict.com/guitar-pro-shortcuts/) _(shredaddict.com)_\n"
  },
  {
    "path": "source/_posts/homebrew.md",
    "content": "---\ntitle: Homebrew\ndate: 2023-04-12\nbackground: bg-[#fbb041]\ntags:\n  - packages manager\n  - macos\ncategories:\n  - Toolkit\nintro: This is a quick reference cheat sheet to getting started with homebrew.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Install\n\nIf not installed, install Command Line Tools (CLT)\n\n```bash\nxcode-select --install\n```\n\nInstall Homebrew :\n\n```bash {.wrap}\n/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"\n```\n\n[Official Website](https://brew.sh/) {.link-arrow}\n\n### Commands\n\n|                            |                                        |\n| -------------------------- | -------------------------------------- |\n| `brew install git`         | Install a package                      |\n| `brew uninstall git`       | Uninstall a package                    |\n| `brew upgrade git`         | Upgrade package                        |\n| `brew unlink git`          | Unlink                                 |\n| `brew link git`            | Link                                   |\n| `brew list --versions git` | List the installed versions of package |\n\n### Help\n\nDisplay the version of Homebrew.\n\n```bash\nbrew --version\n```\n\nPrint Help Information\n\n```bash\nbrew help\n```\n\nPrint Help Info for a brew command\n\n```bash\nbrew help <sub-command>\n```\n\nCheck system for potential problems.\n\n```bash\nbrew doctor\n```\n\n### Updates\n\nFetch latest version of homebrew and formula\n\n```bash\nbrew update\n```\n\nShow formulae with an updated version available\n\n```bash\nbrew outdated\n```\n\nUpgrade all outdated and unpinned brews\n\n```bash\nbrew upgrade\n```\n\nUpgrade only the specified brew\n\n```bash\nbrew upgrade <formula>\n```\n\nPrevent the specified formulae from being upgraded\n\n```bash\nbrew pin <formula>\n```\n\nAllow the specified formulae to be upgraded.\n\n```bash\nbrew unpin <formula>\n```\n\n### Repositories\n\nList all the current tapped repositories (taps)\n\n```bash\nbrew tap\n```\n\nTap a formula repository from Github using https for tap https://github.com/user/homebrew-repo\n\n```bash\nbrew tap <user/repo>\n```\n\nTap a formula repository from the specified URL\n\n```bash\nbrew tap <user/repo> <URL>\n```\n\nRemove the given tap from the repository\n\n```bash\nbrew untap <user/repo>\n```\n\n### Cask\n\nTap the Cask repository from Github.\n\n```bash\nbrew tap homebrew/cask\n```\n\nList all the installed casks .\n\n```bash\nbrew list --cask\n```\n\nSearch all known casks based on the substring text.\n\n```bash\nbrew search <text>\n```\n\nInstall the given cask.\n\n```bash\nbrew install --cask <cask>\n```\n\nReinstalls the given Cask\n\n```bash\nbrew reinstall --cask <cask>\n```\n\nUninstall the given cask.\n\n```bash\nbrew uninstall --cask <cask>\n```\n\n### Search, Install, Remove\n\nList all the installed formulae.\n\n```bash\nbrew list\n```\n\nDisplay all locally available formulae for brewing.\n\n```bash\nbrew search\n```\n\nPerform a substring search of formulae names for brewing.\n\n```bash\nbrew search <text>\n```\n\nDisplay information about the formula.\n\n```bash\nbrew info <formula>\n```\n\nInstall the formula.\n\n```bash\nbrew install <formula>\n```\n\nUninstall the formula.\n\n```bash\nbrew uninstall <formula>\n```\n\n### Cleanup\n\nRemove older versions of installed formulae.\n\n```bash\nbrew cleanup\n```\n\nRemove older versions of specified formula.\n\n```bash\nbrew cleanup <formula>\n```\n\nDisplay all formula that will be removed (dry run)\n\n```bash\nbrew cleanup -n\n```\n"
  },
  {
    "path": "source/_posts/hook.md",
    "content": "---\ntitle: Hook\ndate: 2024-03-13 18:20:00\nicon: icon-style\nbackground: bg-[#1131e2]\ntags:\n  - script\n  - interpret\ncategories:\n  - Programming\nintro: |\n  The [Hook](https://github.com/hook-lang/hook/) cheat sheet is a one-page reference sheet for the Hook programming language.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Introduction\n\n- [GitHub](https://github.com/hook-lang/hook)\n- [Playground](https://hook-lang.github.io/hook-playground)\n- [Examples](https://github.com/hook-lang/hook/tree/main/examples)\n- [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=fabiosvm.hook)\n\n### What does Hook look like?\n\n```rs\nfn factorial(n) {\n  if (n == 0)\n    return 1;\n  return n * factorial(n - 1);\n}\n```\n\nHook features a modern syntax similar to `C`.\n\n### Hello, world!\n\n```js\nprintln('Hello, World!');\n// Hello, World!\n```\n\nThe `Hello, World!` program in Hook.\n\n### Installing with Homebrew\n\n```text\nbrew tap hook-lang/hook\nbrew install hook\nhook --help\n```\n\nThe interpreter is available on [`Homebrew`](https://brew.sh).\n\n### Installing on Windows {.col-span-2}\n\n```text\ncd %tmp%\ncurl -sSLO https://raw.githubusercontent.com/hook-lang/hook/main/scripts/install.bat\ninstall\n```\n\nThis is how you can install it on `Windows`.\n\n## Types and Values\n\n### Basic Types\n\n|          |           |\n| -------- | :-------- |\n| `Nil`    | `Bool`    |\n| `Number` | `String`  |\n| `Range`  | `Array`   |\n| `Record` | `Closure` |\n\nList of basic types.\n\n### Bool\n\n```js\nlet x = true;\nlet y = false;\n```\n\nBool is a boolean type. So, it can be `true` or `false`.\n\n### Numbers\n\n```js\nlet x = 0;\nlet degree = 45; // integer number\nlet pi = 3.14; // floating-point number\n```\n\nNumbers can be integers or floating-point.\n\n### Strings\n\n```js\nlet empty = '';\n\nlet name = 'John';\n\nlet message = 'Hello, \"John\"!';\n```\n\nStrings can be single or double-quoted.\n\n### Ranges\n\n```js\nlet range = 1..5;\n\nprintln(range);\n// 1..5\n```\n\nRanges are a sequence of integers.\n\n### Arrays\n\n```js\nlet fruits = ['apple', 'banana', 'cherry'];\n\nprintln(fruits);\n// [\"apple\", \"banana\", \"cherry\"]\n```\n\nArrays are a sequence of elements.\n\n### Records\n\n```js\nlet p = { x: 5, y: 10 };\n\nprintln(p);\n// {x: 5, y: 10}\n```\n\nRecords maps fields to values.\n\n### The **nil** value\n\n```swift\nlet x = nil;\nvar y;\n```\n\n```js\nprintln(x); // nil\nprintln(y); // nil\n```\n\n`nil` is the absence of a value.\n\n### Falsy values\n\n```swift\nif (nil) \"true\" else \"false\";   // false\nif (false) \"true\" else \"false\"; // false\nif (true) \"true\" else \"false\";  // true\nif (0) \"true\" else \"false\";     // true\nif (1) \"true\" else \"false\";     // true\nif (\"\") \"true\" else \"false\";    // true\nif ([]) \"true\" else \"false\";    // true\nif ({}) \"true\" else \"false\";    // true\n```\n\nJust `nil` and `false` are falsy.\n\n## Syntax\n\n### Comments\n\n```js\n// This is a single-line comment.\n\n// And this is\n// a multi-line\n// comment. ;)\n```\n\nHook supports single-line comments only. Sorry!\n\n### Semi-colons {.col-span-2}\n\n<!-- prettier-ignore -->\n```js\nprintln(1) ; println(2) ; println(3) ;\nprintln(4) ; println(5)\n; println(6) ;\n;                                      // error: unexpected token `;`\n```\n\nSemi-colons are required and empty statements are not allowed.\n\n### Blocks\n\n```js\n{\n  println('Hello');\n  {\n    println('World');\n  }\n}\n```\n\nBlocks are used to define a scope.\n\n### Reserved words\n\n|         |          |            |         |\n| ------- | :------- | :--------- | :------ |\n| `as`    | `break`  | `continue` | `do`    |\n| `else`  | `false`  | `fn`       | `for`   |\n| `from`  | `if`     | `import`   | `in`    |\n| `inout` | `let`    | `loop`     | `match` |\n| `nil`   | `return` | `struct`   | `trait` |\n| `true`  | `var`    | `while`    |         |\n\nThere are few reserved words.\n\n### Identifiers\n\n```php\nvar lowercase;\nvar CAPS_LOCK;\nvar camelCase;\nvar PascalCase;\nvar snake_case;\nvar _123;\n```\n\nIdentifiers are case-sensitive.\n\n## Variables\n\n### Variables\n\n```js\nvar x; // x contains nil\nx = 5; // now, x contains a number\nx = 'foo'; // a string\n\nprintln(x);\n```\n\nValues have types, but variables don't.\n\n### Immutable variables {.col-span-2}\n\n```js\nlet x = 5;\n\nx = 10; // error: cannot assign to immutable variable `x`\n\nlet y; // error: unexpected token `;`\n```\n\nImmutable variables must be initialized when declared.\n\n### Scopes {.col-span-2}\n\n```js\nlet x = 5;\n{\n  let y = 15;\n  println(x); // 10\n  println(y); // 15\n}\nprintln(x); // 5\nprintln(y); // error: variable `y` is used but not defined\n```\n\nWhen a heap-allocated variable goes out of scope, it is automatically deallocated.\n\n### Shadowing\n\n```js\nlet x = 5;\n{\n  let x = 10; // shadows the outer `x`\n  println(x); // 10\n}\nprintln(x); // 5\n```\n\nVariables can be shadowed.\n\n## Operators and Expressions\n\n### Arithmetic\n\n```js\nprintln(5 + 10); // 15\nprintln(5 - 10); // -5\nprintln(5 * 10); // 50\nprintln(5 / 10); // 0.5\nprintln(5 % 10); // 5\nprintln(-5); // -5\n```\n\nThe basic arithmetic operators.\n\n### Comparison\n\n```js\nprintln(5 == 10); // false\nprintln(5 != 10); // true\nprintln(5 < 10); // true\nprintln(5 > 10); // false\nprintln(5 <= 10); // true\nprintln(5 >= 10); // false\n```\n\nThe comparison operators.\n\n### Logical\n\n```js\nprintln(true && false); // false\nprintln(true || false); // true\nprintln(!true); // false\n```\n\nThe logical operators.\n\n### Bitwise and shift\n\n```js\nprintln(5 & 10); // 0\nprintln(5 | 10); // 15\nprintln(5 ^ 10); // 15\nprintln(~5); // -6\nprintln(5 << 1); // 10\nprintln(5 >> 1); // 2\n```\n\nThe bitwise and shift operators.\n\n### Assignments\n\n```js\nvar x = 5; // 5\nx += 10; // 15\nx -= 10; // 5\nx *= 10; // 50\nx /= 10; // 5\nx %= 10; // 5\nx &= 10; // 0\nx |= 10; // 10\nx ^= 5; // 15\nx <<= 5; // 480\nx >>= 5; // 15\nx++; // 16\nx--; // 15\n```\n\nThe assignment operators.\n\n### The ternary operator\n\n```js\nlet x = 5;\nlet y = if (x > 5) 10 else 20;\n\nprintln(y);\n// 20\n```\n\nIn Hook, the ternary operator is `if else`.\n\n## Branching\n\n### If\n\n```js\nlet x = 10;\n\nif (x > 5) {\n  println('x is greater than 5');\n}\n// x is greater than 5\n```\n\nThe `if` statement.\n\n### If else\n\n```js\nlet x = 11;\n\nif (x == 5) {\n  println('x is 5');\n} else if (x == 10) {\n  println('x is 10');\n} else {\n  println('x is neither 5 nor 10');\n}\n// x is neither 5 nor 10\n```\n\nThe `if else` statement.\n\n### Match\n\n```rs\nlet x = 5;\n\nmatch (x) {\n  1 => println(\"one\");\n  2 => println(\"two\");\n  3 => println(\"three\");\n  _ => println(\"other\");\n}\n// other\n```\n\nThe `match` statement.\n\n## Looping\n\n### While\n\n```js\nvar x = 0;\n\nwhile (x < 5) {\n  print(x);\n  x += 1;\n}\n// 01234\n```\n\nThe `while` loop.\n\n### Do while\n\n```js\nvar x = 0;\n\ndo {\n  print(x);\n  x += 1;\n} while (x < 5);\n// 01234\n```\n\nThe `do while` loop.\n\n### For\n\n```js\nfor (var i = 0; i < 5; i++) {\n  print(i);\n}\n// 01234\n```\n\nThe classic `for` loop.\n\n### Loop\n\n```rs\nloop {\n  println(\"Press Ctrl+C to stop\");\n}\n```\n\nThe unconditional `loop`.\n\n### Break\n\n```js\nvar i = 0;\n```\n\n```rs\nloop {\n  if (i == 5) break;\n\n  print(i);\n  i += 1;\n}\n// 01234\n```\n\nUse `break` to exit a loop.\n\n### Continue\n\n```js\nvar i = 0;\n```\n\n```rs\nloop {\n  i += 1;\n  if (i % 2 == 0) continue;\n\n  print(i);\n\nif (i == 5) break;\n}\n// 135\n```\n\nUse `continue` to skip the rest of the loop body.\n\n## Strings\n\n### Indexing a string\n\n```js\nlet s = 'Hello';\n\nprintln(s[0]); // H\nprintln(s[1]); // e\nprintln(s[4]); // o\n```\n\nIndexing a string returns a 1-character string.\n\n### Slicing a string\n\n```js\nlet s = \"Hello, World!\";\n\nprintln(s[0..5]);        // Hello,\nprintln(s[7..12]);       // World!\n```\n\nPass a range to slice a string.\n\n### Concatening strings\n\n```js\nlet greeting = 'Hi' + ' there!';\n\nprintln(greeting);\n// Hi there!\n```\n\nUse the `+` operator to concatenate strings.\n\n## Arrays\n\n### Indexing an array\n\n```js\nlet a = [1, 2, 3];\n\nprintln(a[0]); // 1\nprintln(a[1]); // 2\nprintln(a[2]); // 3\n```\n\nIndexing an array returns an element.\n\n### Slicing an array\n\n```js\nlet a = [1, 2, 3, 4];\n\nprintln(a[0..2]);            // [1, 2, 3]\nprintln(a[1..3]);            // [2, 3, 4]\nprintln(a[2 .. len(a) - 1]); // [3, 4]\n```\n\nArrays are zero-indexed.\n\n### Appending an element\n\n```js\nvar a = [1, 2];\n\na[] = 3;\n\nprintln(a);\n// [1, 2, 3]\n```\n\nArrays are mutable. Use `[]` to append an element.\n\n### Element assignment\n\n```js\nvar a = [1, 2, 3];\n\na[0] = 4;\n\nprintln(a);\n// [4, 2, 3]\n```\n\nUpdate an element in an array.\n\n### Concatening arrays\n\n```js\nlet a = [1, 2];\nlet b = [3];\nlet c = a + b;\n\nprintln(c);\n// [1, 2, 3]\n```\n\nUse the `+` operator to concatenate arrays.\n\n### Subtracting arrays\n\n```js\nlet a = [1, 2, 2, 3];\nlet b = [2];\nlet c = a - b;\n\nprintln(c);\n// [1, 3]\n```\n\nGet the difference between two arrays.\n\n## Functions and Closures\n\n### Function declaration\n\n```rs\nfn sum(a, b) {\n  return a + b;\n}\n\nprintln(sum(5, 10));\n// 15\n```\n\nFunctions are first-class citizens.\n\n### Function call\n\n```rs\nfn greet(name) {\n  println(\"Hi, \" + name + \"!\");\n}\n\ngreet(\"John\", \"Doe\");\n// Hi, John!\n```\n\nThe number of arguments is adjusted.\n\n### Anonymous functions\n\n```js\nlet sum = |a, b| {\n  return a + b;\n};\n\nprintln(sum(5, 10));\n// 15\n```\n\nAnonymous functions are also supported.\n\n### Closures\n\n```js\nlet pi = 3.14;\n```\n\n```rs\nfn area(r) {\n  return pi * r * r;\n}\n\nprintln(area(5));\n// 78.5\n```\n\nClosures in Hook capture values only.\n\n### Higher-order functions\n\n```rs\nfn apply(f, x) {\n  return f(x);\n}\n\nfn double(x) {\n  return x * 2;\n}\n\nprintln(apply(double, 5));\n// 10\n```\n\nFunctions can be passed as arguments or returned.\n\n### Syntax sugar for functions\n\n```rs\nfn factorial(n) =>\n  if (n == 0) 1\n  else n * factorial(n - 1);\n\nprintln(factorial(5));\n// 120\n```\n\nUse `=>` when the body is a single expression.\n\n### Recursion\n\n```rs\nfn fib(n) {\n  if (n < 2)\n    return n;\n  return fib(n - 1) + fib(n - 2);\n}\n\nprintln(fib(10));\n// 55\n```\n\nRecursion is supported.\n\n### Built-in functions\n\n```js\nprintln(type(5));\n// number\nprintln('1' + to_string(2));\n// 12\nprintln(len('foo'));\n// 3\n```\n\nThere are many built-in functions.\n\n### More built-in functions\n\n|             |           |             |\n| ----------- | :-------- | :---------- |\n| `print`     | `println` | `type`      |\n| `is_nil`    | `is_bool` | `to_number` |\n| `to_string` | `hex`     | `len`       |\n| `exit`      | `assert`  | `panic`     |\n\nSee: [Built-in Functions](https://github.com/hook-lang/hook/blob/main/docs/built-in.md)\n\n## Structs\n\n### Structs\n\n```rs\nstruct Point {\n  x, y\n}\n```\n\n```js\nlet p = Point { 5, 10 };\n\nprintln(p);\n// {x: 5, y: 10}\n```\n\nA struct is a prototype for a record.\n\n### Accessing fields\n\n```js\nprintln(p.x); // 5\nprintln(p.y); // 10\n```\n\nUse `.` to access a field in a record.\n\n### Field assignment\n\n```js\np.x = 10;\np.y = 20;\n\nprintln(p);\n// {x: 10, y: 20}\n```\n\nUpdate a value of a field in a record.\n\n## Destructuring\n\n### Destructuring an array\n\n```js\nlet a = [1, 2];\nlet [x, y] = a;\n\nprintln(x); // 1\nprintln(y); // 2\n```\n\nVaruables are declared and assigned.\n\n### Destructuring a record\n\n```js\nlet p = { x: 5, y: 10 };\nlet { x } = p;\n\nprintln(x);\n// 5\n```\n\nUse `{}` to destructure a record.\n\n### Placeholder\n\n```js\nlet a = [1, 2];\nlet [x] = a;\nlet [_, y] = a;\n\nprintln(x); // 1\nprintln(y); // 2\n```\n\nUse `_` skip leading or middle elements.\n\n## Modularity\n\n### Importing a module\n\n```js\nimport math;\n```\n\n```js\nprintln(math.sqrt(25));\n// 5\n```\n\nUse `import` to bring a module into scope.\n\n### Exporting symbols\n\n```rs\n// my_module.hk\nfn useful_fn() {\n  return \"Nothing\";\n}\n\nreturn { useful: useful_fn };\n```\n\nReturn a record with the symbols to export.\n\n### Importing local modules\n\n```python\nimport \"./my_module.hk\" as my;\n```\n\n```js\nprintln(my.useful());\n// Nothing\n```\n\nSpecify the path to the local module.\n\n### Selective import\n\n```js\nimport { pow, sqrt } from math;\n\nlet [ b, c ] = [ 4, 3 ];\nlet a = sqrt(pow(b, 2) + pow(c, 2));\n\nprintln(a);\n// 5\n```\n\nUse `{}` to import specific symbols.\n\n### Core modules\n\n|            |          |        |           |\n| ---------- | :------- | :----- | :-------- |\n| `math`     | `os`     | `io`   | `numbers` |\n| `strings`  | `arrays` | `utf8` | `hashing` |\n| `encoding` | `socket` | `json` | `lists`   |\n\nSee: [Core Modules](https://github.com/hook-lang/hook/blob/main/docs/core-modules.md)\n\n### Extension modules\n\n|           |           |         |           |\n| --------- | :-------- | :------ | :-------- |\n| `bigint`  | `crypto`  | `curl`  | `fastcgi` |\n| `geohash` | `leveldb` | `mysql` | `redis`   |\n| `regex`   | `sqlite`  | `uuid`  | `zeromq`  |\n\nThis is a list of extension modules.\n\n### **io** module\n\n```js\nimport { stderr, writeln } from io;\n\nwriteln(stderr, \"Something went wrong\");\n// Something went wrong\n```\n\nPrinting to `stderr` using `io` module.\n\n### **hashing** module\n\n```python\nimport hashing as h;\n```\n\n```js\nlet d = h.sha256('Hello, world!');\n\nprintln(hex(d));\n// 315f5bdb76d078c43b8ac0064e4a...\n```\n\n`hashing` module provides hash functions.\n\n### **json** module\n\n```js\nimport json;\n```\n\n```js\nlet j = '{\"x\": 1, \"y\": 2}';\nlet p = json.decode(j);\n\nprintln(p.x); // 1\n\nlet k = json.encode(p);\nprintln(type(k)); // string\n```\n\nUse `json` module for working with JSON.\n\n## Error Handling\n\n### Errors {.col-span-2}\n\n```js\nprintln(to_int('foo'));\n\n// runtime error: type error: argument #1 is not a convertible string\n//   at to_int() in <native>\n//   at main() in example.hk:1\n```\n\nHook uses panic mode for error handling. When an error occurs, the interpreter stops.\n\n### Syntax error\n\n```js\nprintln('Hello, World!');\n\n// syntax error: unexpected end of file\n//   at main() in example.hk:1,25\n```\n\nHook has a strict syntax.\n\n### Panic\n\n```js\npanic('Something went wrong');\n\n// panic: Something went wrong\n//   at main() in example.hk:1\n```\n\nUse the `panic` built-in function to raise an error.\n\n### Assert {.col-span-2}\n\n```js\nassert(5 > 10, '5 is not greater than 10');\n\n// assert: 5 is not greater than 10\n//   at main() in example.hk:1\n```\n\nUse the `assert` built-in function to check a condition.\n\n### Returning errors {.col-span-2}\n\n```rs\nfn divide(a, b) {\n  if (b == 0)\n    return [nil, \"division by zero\"];\n  return a / b;\n}\n\nif (let [ok, err] = divide(5, 0); ok) {\n  println(ok);\n} else {\n  println(err);\n}\n// division by zero\n```\n\nUse a pair to return a value and an error.\n\n### Passing errors\n\n```rs\nif (let [ok, err] = divide(5, 0); err) {\n  return [nil, err];\n}\n```\n\nPass an error without handling it.\n"
  },
  {
    "path": "source/_posts/html-char.md",
    "content": "---\ntitle: HTML Characters Entities\ndate: 2022-01-13 11:44:21\ntags:\n  - html\n  - code\n  - characters\ncategories:\n  - Other\nintro: |\n  This cheatsheet is a complete list of HTML entities with their numbers and names. Also included is a full list of ASCII characters that can be represented in HTML.\n---\n\n## HTML Character Entity References {.cols-1}\n\n### HTML Special Characters\n\n| HTML       | Symbol | Numeric  | Description            | Hex           | CSS (ISO) | JS (Octal)                                                |\n| ---------- | ------ | -------- | ---------------------- | ------------- | --------- | --------------------------------------------------------- |\n| `&quot;`   | \"      | `&#34;`  | quotation mark         | u+0022 ISOnum | \\\\0022    | <a href='javascript:alert(&quot;\\42&quot;)'>\\42</a>       |\n| `&num;`    | #      | `&#35;`  | number sign            | u+0023 ISOnum | \\\\0023    | <a href='javascript:alert(&quot;\\43&quot;)'>\\43</a>       |\n| `&dollar;` | $      | `&#36;`  | dollar sign            | u+0024 ISOnum | \\\\0024    | <a href='javascript:alert(&quot;\\44&quot;)'>\\44</a>       |\n| `&percnt;` | %      | `&#37;`  | percent sign           | u+0025 ISOnum | \\\\0025    | <a href='javascript:alert(&quot;\\45&quot;)'>\\45</a>       |\n| `&amp;`    | &      | `&#38;`  | ampersand              | u+0026 ISOnum | \\\\0026    | <a href='javascript:alert(&quot;\\46&quot;)'>\\46</a>       |\n| `&apos;`   | '      | `&#39;`  | apostrophe             | u+0027 ISOnum | \\\\0027    | <a href='javascript:alert(&quot;\\47&quot;)'>\\47</a>       |\n| `&lpar;`   | (      | `&#40;`  | left parenthesis       | u+0028 ISOnum | \\\\0028    | <a href='javascript:alert(&quot;\\50&quot;)'>\\50</a>       |\n| `&rpar;`   | )      | `&#41;`  | right parenthesis      | u+0029 ISOnum | \\\\0029    | <a href='javascript:alert(&quot;\\51&quot;)'>\\51</a>       |\n| `&ast;`    | \\*     | `&#42;`  | asterisk               | u+002A ISOnum | \\\\002a    | <a href='javascript:alert(&quot;\\52&quot;)'>\\52</a>       |\n| `&plus;`   | +      | `&#43;`  | plus sign              | u+002B ISOnum | \\\\002b    | <a href='javascript:alert(&quot;\\53&quot;)'>\\53</a>       |\n| `&comma;`  | ,      | `&#44;`  | comma                  | u+002C ISOnum | \\\\002c    | <a href='javascript:alert(&quot;\\54&quot;)'>\\54</a>       |\n| `&minus;`  | -      | `&#45;`  | hyphen-minus           | u+002D ISOnum | \\\\002d    | <a href='javascript:alert(&quot;\\55&quot;)'>\\55</a>       |\n| `&period;` | .      | `&#46;`  | full stop; period      | u+002E ISOnum | \\\\002e    | <a href='javascript:alert(&quot;\\56&quot;)'>\\56</a>       |\n| `&sol;`    | /      | `&#47;`  | solidus; slash         | u+002F ISOnum | \\\\002f    | <a href='javascript:alert(&quot;\\57&quot;)'>\\57</a>       |\n| `&colon;`  | :      | `&#58;`  | colon                  | u+003A ISOnum | \\\\003a    | <a href='javascript:alert(&quot;\\72&quot;)'>\\72</a>       |\n| `&semi;`   | ;      | `&#59;`  | semicolon              | u+003B ISOnum | \\\\003b    | <a href='javascript:alert(&quot;\\73&quot;)'>\\73</a>       |\n| `&lt;`     | <      | `&#60;`  | less-than              | u+003C ISOnum | \\\\003c    | <a href='javascript:alert(&quot;\\74&quot;)'>\\74</a>       |\n| `&equals;` | =      | `&#61;`  | equals                 | u+003D ISOnum | \\\\003d    | <a href='javascript:alert(&quot;\\75&quot;)'>\\75</a>       |\n| `&gt;`     | >      | `&#62;`  | greater-than sign      | u+003E ISOnum | \\\\003e    | <a href='javascript:alert(&quot;\\76&quot;)'>\\76</a>       |\n| `&quest;`  | ?      | `&#63;`  | question mark          | u+003F ISOnum | \\\\003f    | <a href='javascript:alert(&quot;\\77&quot;)'>\\77</a>       |\n| `&commat;` | @      | `&#64;`  | at sign; commercial at | u+0040 ISOnum | \\\\0040    | <a href='javascript:alert(&quot;\\100&quot;)'>\\100</a>     |\n| `&lsqb;`   | [      | `&#91;`  | left square bracket    | u+005B ISOnum | \\\\005b    | <a href='javascript:alert(&quot;\\133&quot;)'>\\133</a>     |\n| `&bsol;`   | \\      | `&#92;`  | backslash              | u+005C ISOnum | \\\\005c    | <a href='javascript:alert(&quot;\\134&quot;)'>\\134</a>     |\n| `&rsqb;`   | ]      | `&#93;`  | right square bracket   | u+005D ISOnum | \\\\005d    | <a href='javascript:alert(&quot;\\135&quot;)'>\\135</a>     |\n| `&Hat;`    | ^      | `&#94;`  | circumflex accent      | u+005E ISOnum | \\\\005e    | <a href='javascript:alert(&quot;\\136&quot;)'>\\136</a>     |\n| `&lowbar;` | \\_     | `&#95;`  | low line               | u+005F ISOnum | \\\\005f    | <a href='javascript:alert(&quot;\\137&quot;)'>\\137</a>     |\n| `&grave;`  | &#96;  | `&#96;`  | grave accent           | u+0060 ISOnum | \\\\0060    | <a href='javascript:alert(&quot;\\u0060&quot;)'>\\u0060</a> |\n| `&lcub;`   | {      | `&#123;` | left curly bracket     | u+007b ISOnum | \\\\007b    | <a href='javascript:alert(&quot;\\173&quot;)'>\\173</a>     |\n| `&verbar;` | \\|     | `&#124;` | vertical bar           | u+007c ISOnum | \\\\007c    | <a href='javascript:alert(&quot;\\174&quot;)'>\\174</a>     |\n| `&rcub;`   | }      | `&#125;` | right curly bracket    | u+007d ISOnum | \\\\007d    | <a href='javascript:alert(&quot;\\175&quot;)'>\\175</a>     |\n|            | ~      | `&#126;` | tilde                  | u+007e ISOnum | \\\\007e    | <a href='javascript:alert(&quot;\\176&quot;)'>\\176</a>     |\n\n{.show-header}\n\n### HTML Latin\n\n| HTML       | Symbol | Numeric    | Description                         | Hex    | CSS (ISO) | JS (Octal)                                                |\n| ---------- | ------ | ---------- | ----------------------------------- | ------ | --------- | --------------------------------------------------------- |\n| `&nbsp;`   |        | `&#160;`   | no-break space                      | %A0    | \\\\00a0    | <a href='javascript:alert(&quot;\\240&quot;)'>\\240</a>     |\n| `&iexcl;`  | ¡      | `&#161;`   | inverted exclamation mark           | %A1    | \\\\00a1    | <a href='javascript:alert(&quot;\\241&quot;)'>\\241</a>     |\n| `&cent;`   | ¢      | `&#162;`   | cent sign                           | %A2    | \\\\00a2    | <a href='javascript:alert(&quot;\\242&quot;)'>\\242</a>     |\n| `&pound;`  | £      | `&#163;`   | pound sterling sign                 | %A3    | \\\\00a3    | <a href='javascript:alert(&quot;\\243&quot;)'>\\243</a>     |\n| `&curren;` | ¤      | `&#164;`   | general currency sign               | %A4    | \\\\00a4    | <a href='javascript:alert(&quot;\\244&quot;)'>\\244</a>     |\n| `&yen;`    | ¥      | `&#165;`   | yen sign                            | %A5    | \\\\00a5    | <a href='javascript:alert(&quot;\\245&quot;)'>\\245</a>     |\n| `&#x20B9;` | ₹      | `&#x20B9;` | Indian Rupee (INR) sign             | U+20B9 | \\\\20B9    | <a href='javascript:alert(&quot;\\u20B9&quot;)'>\\u20B9</a> |\n| `&brvbar;` | ¦      | `&#166;`   | broken (vertical) bar               | %A6    | \\\\00a6    | <a href='javascript:alert(&quot;\\246&quot;)'>\\246</a>     |\n| `&sect;`   | §      | `&#167;`   | section sign                        | %A7    | \\\\00a7    | <a href='javascript:alert(&quot;\\247&quot;)'>\\247</a>     |\n| `&uml;`    | ¨      | `&#168;`   | umlaut (dieresis)                   | %A8    | \\\\00a8    | <a href='javascript:alert(&quot;\\250&quot;)'>\\250</a>     |\n| `&copy;`   | ©     | `&#169;`   | copyright sign                      | %A9    | \\\\00a9    | <a href='javascript:alert(&quot;\\251&quot;)'>\\251</a>     |\n| `&ordf;`   | ª      | `&#170;`   | ordinal indicator, feminine         | %AA    | \\\\00aa    | <a href='javascript:alert(&quot;\\252&quot;)'>\\252</a>     |\n| `&laquo;`  | «      | `&#171;`   | angle quotation mark, left          | %AB    | \\\\00ab    | <a href='javascript:alert(&quot;\\253&quot;)'>\\253</a>     |\n| `&not;`    | ¬      | `&#172;`   | not sign                            | %AC    | \\\\00ac    | <a href='javascript:alert(&quot;\\254&quot;)'>\\254</a>     |\n| `&shy;`    | ­      | `&#173;`   | soft hyphen                         | %AD    | \\\\00ad    | <a href='javascript:alert(&quot;\\255&quot;)'>\\255</a>     |\n| `&reg;`    | ®     | `&#174;`   | registered sign                     | %AE    | \\\\00ae    | <a href='javascript:alert(&quot;\\256&quot;)'>\\256</a>     |\n| `&macr;`   | ¯      | `&#175;`   | macron                              | %AF    | \\\\00af    | <a href='javascript:alert(&quot;\\257&quot;)'>\\257</a>     |\n| `&deg;`    | °      | `&#176;`   | degree sign                         | %B0    | \\\\00b0    | <a href='javascript:alert(&quot;\\260&quot;)'>\\260</a>     |\n| `&plusmn;` | ±      | `&#177;`   | plus-or-minus sign                  | %B1    | \\\\00b1    | <a href='javascript:alert(&quot;\\261&quot;)'>\\261</a>     |\n| `&sup2;`   | ²      | `&#178;`   | superscript two                     | %B2    | \\\\00b2    | <a href='javascript:alert(&quot;\\262&quot;)'>\\262</a>     |\n| `&sup3;`   | ³      | `&#179;`   | superscript three                   | %B3    | \\\\00b3    | <a href='javascript:alert(&quot;\\263&quot;)'>\\263</a>     |\n| `&acute;`  | ´      | `&#180;`   | acute accent                        | %B4    | \\\\00b4    | <a href='javascript:alert(&quot;\\264&quot;)'>\\264</a>     |\n| `&micro;`  | µ      | `&#181;`   | micro sign                          | %B5    | \\\\00b5    | <a href='javascript:alert(&quot;\\265&quot;)'>\\265</a>     |\n| `&para;`   | ¶      | `&#182;`   | pilcrow (paragraph sign)            | %B6    | \\\\00b6    | <a href='javascript:alert(&quot;\\266&quot;)'>\\266</a>     |\n| `&middot;` | ·      | `&#183;`   | middle dot                          | %B7    | \\\\00b7    | <a href='javascript:alert(&quot;\\267&quot;)'>\\267</a>     |\n| `&cedil;`  | ¸      | `&#184;`   | cedilla                             | %B8    | \\\\00b8    | <a href='javascript:alert(&quot;\\270&quot;)'>\\270</a>     |\n| `&sup1;`   | ¹      | `&#185;`   | superscript one                     | %B9    | \\\\00b9    | <a href='javascript:alert(&quot;\\271&quot;)'>\\271</a>     |\n| `&ordm;`   | º      | `&#186;`   | ordinal indicator, masculine        | %BA    | \\\\00ba    | <a href='javascript:alert(&quot;\\272&quot;)'>\\272</a>     |\n| `&raquo;`  | »      | `&#187;`   | angle quotation mark, right         | %BB    | \\\\00bb    | <a href='javascript:alert(&quot;\\273&quot;)'>\\273</a>     |\n| `&frac14;` | ¼      | `&#188;`   | fraction one-quarter                | %BC    | \\\\00bc    | <a href='javascript:alert(&quot;\\274&quot;)'>\\274</a>     |\n| `&frac12;` | ½      | `&#189;`   | fraction one-half                   | %BD    | \\\\00bd    | <a href='javascript:alert(&quot;\\275&quot;)'>\\275</a>     |\n| `&frac34;` | ¾      | `&#190;`   | fraction three-quarters             | %BE    | \\\\00be    | <a href='javascript:alert(&quot;\\276&quot;)'>\\276</a>     |\n| `&iquest;` | ¿      | `&#191;`   | inverted question mark              | %BF    | \\\\00bf    | <a href='javascript:alert(&quot;\\277&quot;)'>\\277</a>     |\n| `&Agrave;` | À      | `&#192;`   | capital A, grave accent             | %C0    | \\\\00c0    | <a href='javascript:alert(&quot;\\300&quot;)'>\\300</a>     |\n| `&Aacute;` | Á      | `&#193;`   | capital A, acute accent             | %C1    | \\\\00c1    | <a href='javascript:alert(&quot;\\301&quot;)'>\\301</a>     |\n| `&Acirc;`  | Â      | `&#194 ;`  | capital A, circumflex accent        | %C2    | \\\\00c2    | <a href='javascript:alert(&quot;\\302&quot;)'>\\302</a>     |\n| `&Atilde;` | Ã      | `&#195;`   | capital A, tilde                    | %C3    | \\\\00c3    | <a href='javascript:alert(&quot;\\303&quot;)'>\\303</a>     |\n| `&Auml;`   | Ä      | `&#196;`   | capital A, dieresis or umlaut mark  | %C4    | \\\\00c4    | <a href='javascript:alert(&quot;\\304&quot;)'>\\304</a>     |\n| `&Aring;`  | Å      | `&#197;`   | capital A, ring                     | %C5    | \\\\00c5    | <a href='javascript:alert(&quot;\\305&quot;)'>\\305</a>     |\n| `&AElig;`  | Æ      | `&#198;`   | capital AE diphthong (ligature)     | %C6    | \\\\00c6    | <a href='javascript:alert(&quot;\\306&quot;)'>\\306</a>     |\n| `&Ccedil;` | Ç      | `&#199;`   | capital C, cedilla                  | %C7    | \\\\00c7    | <a href='javascript:alert(&quot;\\307&quot;)'>\\307</a>     |\n| `&Egrave;` | È      | `&#200;`   | capital E, grave accent             | %C8    | \\\\00c8    | <a href='javascript:alert(&quot;\\310&quot;)'>\\310</a>     |\n| `&Eacute;` | É      | `&#201;`   | capital E, acute accent             | %C9    | \\\\00c9    | <a href='javascript:alert(&quot;\\311&quot;)'>\\311</a>     |\n| `&Ecirc;`  | Ê      | `&#202;`   | capital E, circumflex accent        | %CA    | \\\\00ca    | <a href='javascript:alert(&quot;\\312&quot;)'>\\312</a>     |\n| `&Euml;`   | Ë      | `&#203;`   | capital E, dieresis or umlaut mark  | %CB    | \\\\00cb    | <a href='javascript:alert(&quot;\\313&quot;)'>\\313</a>     |\n| `&Igrave;` | Ì      | `&#204;`   | capital I, grave accent             | %CC    | \\\\00cc    | <a href='javascript:alert(&quot;\\314&quot;)'>\\314</a>     |\n| `&Iacute;` | Í      | `&#205;`   | capital I, acute accent             | %CD    | \\\\00cd    | <a href='javascript:alert(&quot;\\315&quot;)'>\\315</a>     |\n| `&Icirc;`  | Î      | `&#206;`   | capital I, circumflex accent        | %CE    | \\\\00ce    | <a href='javascript:alert(&quot;\\316&quot;)'>\\316</a>     |\n| `&Iuml;`   | Ï      | `&#207;`   | capital I, dieresis or umlaut mark  | %CF    | \\\\00cf    | <a href='javascript:alert(&quot;\\317&quot;)'>\\317</a>     |\n| `&ETH;`    | Ð      | `&#208;`   | capital Eth, Icelandic              | %D0    | \\\\00d0    | <a href='javascript:alert(&quot;\\320&quot;)'>\\320</a>     |\n| `&Ntilde;` | Ñ      | `&#209;`   | capital N, tilde                    | %D1    | \\\\00d1    | <a href='javascript:alert(&quot;\\321&quot;)'>\\321</a>     |\n| `&Ograve;` | Ò      | `&#210;`   | capital O, grave accent             | %D2    | \\\\00d2    | <a href='javascript:alert(&quot;\\322&quot;)'>\\322</a>     |\n| `&Oacute;` | Ó      | `&#211;`   | capital O, acute accent             | %D3    | \\\\00d3    | <a href='javascript:alert(&quot;\\323&quot;)'>\\323</a>     |\n| `&Ocirc;`  | Ô      | `&#212;`   | capital O, circumflex accent        | %D4    | \\\\00d4    | <a href='javascript:alert(&quot;\\324&quot;)'>\\324</a>     |\n| `&Otilde;` | Õ      | `&#213;`   | capital O, tilde                    | %D5    | \\\\00d5    | <a href='javascript:alert(&quot;\\325&quot;)'>\\325</a>     |\n| `&Ouml;`   | Ö      | `&#214;`   | capital O, dieresis or umlaut mark  | %D6    | \\\\00d6    | <a href='javascript:alert(&quot;\\326&quot;)'>\\326</a>     |\n| `&times;`  | ×      | `&#215;`   | multiply sign                       | %D7    | \\\\00d7    | <a href='javascript:alert(&quot;\\327&quot;)'>\\327</a>     |\n| `&Oslash;` | Ø      | `&#216;`   | capital O, slash                    | %D8    | \\\\00d8    | <a href='javascript:alert(&quot;\\330&quot;)'>\\330</a>     |\n| `&Ugrave;` | Ù      | `&#217;`   | capital U, grave accent             | %D9    | \\\\00d9    | <a href='javascript:alert(&quot;\\331&quot;)'>\\331</a>     |\n| `&Uacute;` | Ú      | `&#218;`   | capital U, acute accent             | %DA    | \\\\00da    | <a href='javascript:alert(&quot;\\332&quot;)'>\\332</a>     |\n| `&Ucirc;`  | Û      | `&#219;`   | capital U, circumflex accent        | %DB    | \\\\00db    | <a href='javascript:alert(&quot;\\333&quot;)'>\\333</a>     |\n| `&Uuml;`   | Ü      | `&#220;`   | capital U, dieresis or umlaut mark  | %DC    | \\\\00dc    | <a href='javascript:alert(&quot;\\334&quot;)'>\\334</a>     |\n| `&Yacute;` | Ý      | `&#221;`   | capital Y, acute accent             | %DD    | \\\\00dd    | <a href='javascript:alert(&quot;\\335&quot;)'>\\335</a>     |\n| `&THORN;`  | Þ      | `&#222;`   | capital THORN, Icelandic            | %DE    | \\\\00de    | <a href='javascript:alert(&quot;\\336&quot;)'>\\336</a>     |\n| `&szlig;`  | ß      | `&#223;`   | small sharp s, German (sz ligature) | %DF    | \\\\00df    | <a href='javascript:alert(&quot;\\337&quot;)'>\\337</a>     |\n| `&agrave;` | à      | `&#224;`   | small a, grave accent               | %E0    | \\\\00e0    | <a href='javascript:alert(&quot;\\340&quot;)'>\\340</a>     |\n| `&aacute;` | á      | `&#225;`   | small a, acute accent               | %E1    | \\\\00e1    | <a href='javascript:alert(&quot;\\341&quot;)'>\\341</a>     |\n| `&acirc;`  | â      | `&#226;`   | small a, circumflex accent          | %E2    | \\\\00e2    | <a href='javascript:alert(&quot;\\342&quot;)'>\\342</a>     |\n| `&atilde;` | ã      | `&#227;`   | small a, tilde                      | %E3    | \\\\00e3    | <a href='javascript:alert(&quot;\\343&quot;)'>\\343</a>     |\n| `&auml;`   | ä      | `&#228;`   | small a, dieresis or umlaut mark    | %E4    | \\\\00e4    | <a href='javascript:alert(&quot;\\344&quot;)'>\\344</a>     |\n| `&aring;`  | å      | `&#229;`   | small a, ring                       | %E5    | \\\\00e5    | <a href='javascript:alert(&quot;\\345&quot;)'>\\345</a>     |\n| `&aelig;`  | æ      | `&#230;`   | small ae diphthong (ligature)       | %E6    | \\\\00e6    | <a href='javascript:alert(&quot;\\346&quot;)'>\\346</a>     |\n| `&ccedil;` | ç      | `&#231;`   | small c, cedilla                    | %E7    | \\\\00e7    | <a href='javascript:alert(&quot;\\347&quot;)'>\\347</a>     |\n| `&egrave;` | è      | `&#232;`   | small e, grave accent               | %E8    | \\\\00e8    | <a href='javascript:alert(&quot;\\350&quot;)'>\\350</a>     |\n| `&eacute;` | é      | `&#233;`   | small e, acute accent               | %E9    | \\\\00e9    | <a href='javascript:alert(&quot;\\351&quot;)'>\\351</a>     |\n| `&ecirc;`  | ê      | `&#234;`   | small e, circumflex accent          | %EA    | \\\\00ea    | <a href='javascript:alert(&quot;\\352&quot;)'>\\352</a>     |\n| `&euml;`   | ë      | `&#235;`   | small e, dieresis or umlaut mark    | %EB    | \\\\00eb    | <a href='javascript:alert(&quot;\\353&quot;)'>\\353</a>     |\n| `&igrave;` | ì      | `&#236;`   | small i, grave accent               | %EC    | \\\\00ec    | <a href='javascript:alert(&quot;\\354&quot;)'>\\354</a>     |\n| `&iacute;` | í      | `&#237;`   | small i, acute accent               | %ED    | \\\\00ed    | <a href='javascript:alert(&quot;\\355&quot;)'>\\355</a>     |\n| `&icirc;`  | î      | `&#238;`   | small i, circumflex accent          | %EE    | \\\\00ee    | <a href='javascript:alert(&quot;\\356&quot;)'>\\356</a>     |\n| `&iuml;`   | ï      | `&#239;`   | small i, dieresis or umlaut mark    | %EF    | \\\\00ef    | <a href='javascript:alert(&quot;\\357&quot;)'>\\357</a>     |\n| `&eth;`    | ð      | `&#240;`   | small eth, Icelandic                | %F0    | \\\\00f0    | <a href='javascript:alert(&quot;\\360&quot;)'>\\360</a>     |\n| `&ntilde;` | ñ      | `&#241;`   | small n, tilde                      | %F1    | \\\\00f1    | <a href='javascript:alert(&quot;\\361&quot;)'>\\361</a>     |\n| `&ograve;` | ò      | `&#242;`   | small o, grave accent               | %F2    | \\\\00f2    | <a href='javascript:alert(&quot;\\362&quot;)'>\\362</a>     |\n| `&oacute;` | ó      | `&#243;`   | small o, acute accent               | %F3    | \\\\00f3    | <a href='javascript:alert(&quot;\\363&quot;)'>\\363</a>     |\n| `&ocirc;`  | ô      | `&#244;`   | small o, circumflex accent          | %F4    | \\\\00f4    | <a href='javascript:alert(&quot;\\364&quot;)'>\\364</a>     |\n| `&otilde;` | õ      | `&#245;`   | small o, tilde                      | %F5    | \\\\00f5    | <a href='javascript:alert(&quot;\\365&quot;)'>\\365</a>     |\n| `&ouml;`   | ö      | `&#246;`   | small o, dieresis or umlaut mark    | %F6    | \\\\00f6    | <a href='javascript:alert(&quot;\\366&quot;)'>\\366</a>     |\n| `&divide;` | ÷      | `&#247;`   | divide sign                         | %F7    | \\\\00f7    | <a href='javascript:alert(&quot;\\367&quot;)'>\\367</a>     |\n| `&oslash;` | ø      | `&#248;`   | small o, slash                      | %F8    | \\\\00f8    | <a href='javascript:alert(&quot;\\370&quot;)'>\\370</a>     |\n| `&ugrave;` | ù      | `&#249;`   | small u, grave accent               | %F9    | \\\\00f9    | <a href='javascript:alert(&quot;\\371&quot;)'>\\371</a>     |\n| `&uacute;` | ú      | `&#250;`   | small u, acute accent               | %FA    | \\\\00fa    | <a href='javascript:alert(&quot;\\372&quot;)'>\\372</a>     |\n| `&ucirc;`  | û      | `&#251;`   | small u, circumflex accent          | %FB    | \\\\00fb    | <a href='javascript:alert(&quot;\\373&quot;)'>\\373</a>     |\n| `&uuml;`   | ü      | `&#252;`   | small u, dieresis or umlaut mark    | %FC    | \\\\00fc    | <a href='javascript:alert(&quot;\\374&quot;)'>\\374</a>     |\n| `&yacute;` | ý      | `&#253;`   | small y, acute accent               | %FD    | \\\\00fd    | <a href='javascript:alert(&quot;\\375&quot;)'>\\375</a>     |\n| `&thorn;`  | þ      | `&#254;`   | small thorn, Icelandic              | %FE    | \\\\00fe    | <a href='javascript:alert(&quot;\\376&quot;)'>\\376</a>     |\n| `&yuml;`   | ÿ      | `&#255;`   | small y, dieresis or umlaut mark    | %FF    | \\\\00ff    | <a href='javascript:alert(&quot;\\377&quot;)'>\\377</a>     |\n\n{.show-header}\n\n### HTML Latin Extended\n\n| HTML       | Symbol | Numeric  | Description                           | Hex            | CSS (ISO) | JS (Octal)                                                |\n| ---------- | ------ | -------- | ------------------------------------- | -------------- | --------- | --------------------------------------------------------- |\n| `&OElig;`  | Œ      | `&#338;` | latin capital ligature oe             | u+0152 ISOlat2 | \\\\0152    | <a href='javascript:alert(&quot;\\u0152&quot;)'>\\u0152</a> |\n| `&oelig;`  | œ      | `&#339;` | latin small ligature oe               | u+0153 ISOlat2 | \\\\0153    | <a href='javascript:alert(&quot;\\u0153&quot;)'>\\u0153</a> |\n| `&Scaron;` | Š      | `&#352;` | latin capital letter s with caron     | u+0160 ISOlat2 | \\\\0160    | <a href='javascript:alert(&quot;\\u0160&quot;)'>\\u0160</a> |\n| `&scaron;` | š      | `&#353;` | latin small letter s with caron       | u+0161 ISOlat2 | \\\\0161    | <a href='javascript:alert(&quot;\\u0161&quot;)'>\\u0161</a> |\n| `&Yuml;`   | Ÿ      | `&#376;` | latin capital letter y with diaeresis | u+0178 ISOlat2 | \\\\0178    | <a href='javascript:alert(&quot;\\u0178&quot;)'>\\u0178</a> |\n| `&fnof;`   | ƒ      | `&#402;` | latin small f with hook               | u+0192 ISOtech | \\\\0192    | <a href='javascript:alert(&quot;\\u0192&quot;)'>\\u0192</a> |\n\n{.show-header}\n\n### HTML Spacing Modifier Letters\n\n| HTML      | Symbol | Numeric | Description                       | Hex           | CSS (ISO) | JS (Octal)                                                |\n| --------- | ------ | ------- | --------------------------------- | ------------- | --------- | --------------------------------------------------------- |\n| `&circ;`  | ˆ      |         | modifier letter circumflex accent | u+02C6 ISOpub | \\\\02c6    | <a href='javascript:alert(&quot;\\u02c6&quot;)'>\\u02c6</a> |\n| `&tilde;` | ˜      |         | small tilde                       | u+02DC ISOdia | \\\\02dc    | <a href='javascript:alert(&quot;\\u02dc&quot;)'>\\u02dc</a> |\n\n{.show-header}\n\n### HTML Greek\n\n| HTML         | Symbol | Numeric  | Description                     | Hex            | CSS (ISO) | JS (Octal)                                                |\n| ------------ | ------ | -------- | ------------------------------- | -------------- | --------- | --------------------------------------------------------- |\n| `&Alpha;`    | Α      | `&#913;` | greek capital letter alpha      | u+0391         | \\\\0391    | <a href='javascript:alert(&quot;\\u0391&quot;)'>\\u0391</a> |\n| `&Beta;`     | Β      | `&#914;` | greek capital letter beta       | u+0392         | \\\\0392    | <a href='javascript:alert(&quot;\\u0392&quot;)'>\\u0392</a> |\n| `&Gamma;`    | Γ      | `&#915;` | greek capital letter gamma      | u+0393 ISOgrk3 | \\\\0393    | <a href='javascript:alert(&quot;\\u0395&quot;)'>\\u0395</a> |\n| `&Delta;`    | Δ      | `&#916;` | greek capital letter delta      | u+0394 ISOgrk3 | \\\\0394    | <a href='javascript:alert(&quot;\\u0394&quot;)'>\\u0394</a> |\n| `&Epsilon;`  | Ε      | `&#917;` | greek capital letter epsilon    | u+0395         | \\\\0395    | <a href='javascript:alert(&quot;\\u0395&quot;)'>\\u0395</a> |\n| `&Zeta;`     | Ζ      | `&#918;` | greek capital letter zeta       | u+0396         | \\\\0396    | <a href='javascript:alert(&quot;\\u0396&quot;)'>\\u0396</a> |\n| `&Eta;`      | Η      | `&#919;` | greek capital letter eta        | u+0397         | \\\\0397    | <a href='javascript:alert(&quot;\\u0397&quot;)'>\\u0397</a> |\n| `&Theta;`    | Θ      | `&#920;` | greek capital letter theta      | u+0398 ISOgrk3 | \\\\0398    | <a href='javascript:alert(&quot;\\u0398&quot;)'>\\u0398</a> |\n| `&Iota;`     | Ι      | `&#921;` | greek capital letter iota       | u+0399         | \\\\0399    | <a href='javascript:alert(&quot;\\u0399&quot;)'>\\u0399</a> |\n| `&Kappa;`    | Κ      | `&#922;` | greek capital letter kappa      | u+039A         | \\\\039a    | <a href='javascript:alert(&quot;\\u039a&quot;)'>\\u039a</a> |\n| `&Lambda;`   | Λ      | `&#923;` | greek capital letter lambda     | u+039B ISOgrk3 | \\\\039b    | <a href='javascript:alert(&quot;\\u039b&quot;)'>\\u039b</a> |\n| `&Mu;`       | Μ      | `&#924;` | greek capital letter mu         | u+039C         | \\\\039c    | <a href='javascript:alert(&quot;\\u039c&quot;)'>\\u039c</a> |\n| `&Nu;`       | Ν      | `&#925;` | greek capital letter nu         | u+039D         | \\\\039d    | <a href='javascript:alert(&quot;\\u039D&quot;)'>\\u039D</a> |\n| `&Xi;`       | Ξ      | `&#926;` | greek capital letter xi         | u+039E ISOgrk3 | \\\\039e    | <a href='javascript:alert(&quot;\\u039e&quot;)'>\\u039e</a> |\n| `&Omicron;`  | Ο      | `&#927;` | greek capital letter omicron    | u+039F         | \\\\039f    | <a href='javascript:alert(&quot;\\u039f&quot;)'>\\u039f</a> |\n| `&Pi;`       | Π      | `&#928;` | greek capital letter pi         | u+03A0 ISOgrk3 | \\\\03a0    | <a href='javascript:alert(&quot;\\u03a0&quot;)'>\\u03a0</a> |\n| `&Rho;`      | Ρ      | `&#929;` | greek capital letter rho        | u+03A1         | \\\\03a1    | <a href='javascript:alert(&quot;\\u03a1&quot;)'>\\u03a1</a> |\n| `&Sigma;`    | Σ      | `&#931;` | greek capital letter sigma      | u+03A3 ISOgrk3 | \\\\03a3    | <a href='javascript:alert(&quot;\\u03A3&quot;)'>\\u03A3</a> |\n| `&Tau;`      | Τ      | `&#932;` | greek capital letter tau        | u+03A4         | \\\\03a4    | <a href='javascript:alert(&quot;\\u03A4&quot;)'>\\u03A4</a> |\n| `&Upsilon;`  | Υ      | `&#933;` | greek capital letter upsilon    | u+03A5 ISOgrk3 | \\\\03a5    | <a href='javascript:alert(&quot;\\u03A5&quot;)'>\\u03A5</a> |\n| `&Phi;`      | Φ      | `&#934;` | greek capital letter phi        | u+03A6 ISOgrk3 | \\\\03a6    | <a href='javascript:alert(&quot;\\u03A6&quot;)'>\\u03A6</a> |\n| `&Chi;`      | Χ      | `&#935;` | greek capital letter chi        | u+03A7         | \\\\03a7    | <a href='javascript:alert(&quot;\\u03A7&quot;)'>\\u03A7</a> |\n| `&Psi;`      | Ψ      | `&#936;` | greek capital letter psi        | u+03A8 ISOgrk3 | \\\\03a8    | <a href='javascript:alert(&quot;\\u03A8&quot;)'>\\u03A8</a> |\n| `&Omega;`    | Ω      | `&#937;` | greek capital letter omega      | u+03A9 ISOgrk3 | \\\\03a9    | <a href='javascript:alert(&quot;\\u03A9&quot;)'>\\u03A9</a> |\n| `&alpha;`    | α      | `&#945;` | greek small letter alpha        | u+03B1 ISOgrk3 | \\\\03b1    | <a href='javascript:alert(&quot;\\u03b1&quot;)'>\\u03b1</a> |\n| `&beta;`     | β      | `&#946;` | greek small letter beta         | u+03B2 ISOgrk3 | \\\\03b2    | <a href='javascript:alert(&quot;\\u03b2&quot;)'>\\u03b2</a> |\n| `&gamma;`    | γ      | `&#947;` | greek small letter gamma        | u+03B3 ISOgrk3 | \\\\03b3    | <a href='javascript:alert(&quot;\\u03b3&quot;)'>\\u03b3</a> |\n| `&delta;`    | δ      | `&#948;` | greek small letter delta        | u+03B4 ISOgrk3 | \\\\03b4    | <a href='javascript:alert(&quot;\\u03b4&quot;)'>\\u03b4</a> |\n| `&epsilon;`  | ε      | `&#949;` | greek small letter epsilon      | u+03B5 ISOgrk3 | \\\\03b5    | <a href='javascript:alert(&quot;\\u03b5&quot;)'>\\u03b5</a> |\n| `&zeta;`     | ζ      | `&#950;` | greek small letter zeta         | u+03B6 ISOgrk3 | \\\\03b6    | <a href='javascript:alert(&quot;\\u03b6&quot;)'>\\u03b6</a> |\n| `&eta;`      | η      | `&#951;` | greek small letter eta          | u+03B7 ISOgrk3 | \\\\03b7    | <a href='javascript:alert(&quot;\\u03b7&quot;)'>\\u03b7</a> |\n| `&theta;`    | θ      | `&#952;` | greek small letter theta        | u+03B8 ISOgrk3 | \\\\03b8    | <a href='javascript:alert(&quot;\\u03b8&quot;)'>\\u03b8</a> |\n| `&iota;`     | ι      | `&#953;` | greek small letter iota         | u+03B9 ISOgrk3 | \\\\03b9    | <a href='javascript:alert(&quot;\\u03b9&quot;)'>\\u03b9</a> |\n| `&kappa;`    | κ      | `&#954;` | greek small letter kappa        | u+03BA ISOgrk3 | \\\\03ba    | <a href='javascript:alert(&quot;\\u03ba&quot;)'>\\u03ba</a> |\n| `&lambda;`   | λ      | `&#955;` | greek small letter lambda       | u+03BB ISOgrk3 | \\\\03bb    | <a href='javascript:alert(&quot;\\u03bb&quot;)'>\\u03bb</a> |\n| `&mu;`       | μ      | `&#956;` | greek small letter mu           | u+03BC ISOgrk3 | \\\\03bc    | <a href='javascript:alert(&quot;\\u03bc&quot;)'>\\u03bc</a> |\n| `&nu;`       | ν      | `&#957;` | greek small letter nu           | u+03BD ISOgrk3 | \\\\03bd    | <a href='javascript:alert(&quot;\\u03bd&quot;)'>\\u03bd</a> |\n| `&xi;`       | ξ      | `&#958;` | greek small letter xi           | u+03BE ISOgrk3 | \\\\03be    | <a href='javascript:alert(&quot;\\u03be&quot;)'>\\u03be</a> |\n| `&omicron;`  | ο      | `&#959;` | greek small letter omicron      | u+03BF NEW     | \\\\03bf    | <a href='javascript:alert(&quot;\\u03bf&quot;)'>\\u03bf</a> |\n| `&pi;`       | π      | `&#960;` | greek small letter pi           | u+03C0 ISOgrk3 | \\\\03c0    | <a href='javascript:alert(&quot;\\u03c0&quot;)'>\\u03c0</a> |\n| `&rho;`      | ρ      | `&#961;` | greek small letter rho          | u+03C1 ISOgrk3 | \\\\03c1    | <a href='javascript:alert(&quot;\\u03c1&quot;)'>\\u03c1</a> |\n| `&sigmaf;`   | ς      | `&#962;` | greek small letter final sigma  | u+03C2 ISOgrk3 | \\\\03C2    | <a href='javascript:alert(&quot;\\u03c2&quot;)'>\\u03c2</a> |\n| `&sigma;`    | σ      | `&#963;` | greek small letter sigma        | u+03C3 ISOgrk3 | \\\\03C3    | <a href='javascript:alert(&quot;\\u03c3&quot;)'>\\u03c3</a> |\n| `&tau;`      | τ      | `&#964;` | greek small letter tau          | u+03C4 ISOgrk3 | \\\\03C4    | <a href='javascript:alert(&quot;\\u03c4&quot;)'>\\u03c4</a> |\n| `&upsilon;`  | υ      | `&#965;` | greek small letter upsilon      | u+03C5 ISOgrk3 | \\\\03C5    | <a href='javascript:alert(&quot;\\u03c5&quot;)'>\\u03c5</a> |\n| `&phi;`      | φ      | `&#966;` | greek small letter phi          | u+03C6 ISOgrk3 | \\\\03C6    | <a href='javascript:alert(&quot;\\03c6&quot;)'>\\03c6</a>   |\n| `&chi;`      | χ      | `&#967;` | greek small letter chi          | u+03C7 ISOgrk3 | \\\\03C7    | <a href='javascript:alert(&quot;\\u03c7&quot;)'>\\u03c7</a> |\n| `&psi;`      | ψ      | `&#968;` | greek small letter psi          | u+03C8 ISOgrk3 | \\\\03C8    | <a href='javascript:alert(&quot;\\u03c8&quot;)'>\\u03c8</a> |\n| `&omega;`    | ω      | `&#969;` | greek small letter omega        | u+03C9 ISOgrk3 | \\\\03C9    | <a href='javascript:alert(&quot;\\u03c9&quot;)'>\\u03c9</a> |\n| `&thetasym;` | ϑ      | `&#977;` | greek small letter theta symbol | u+03D1 NEW     | \\\\03D1    | <a href='javascript:alert(&quot;\\u03D1&quot;)'>\\u03D1</a> |\n| `&upsih;`    | ϒ      | `&#978;` | greek upsilon with hook symbol  | u+03D2 NEW     | \\\\03D2    | <a href='javascript:alert(&quot;\\u03D2&quot;)'>\\u03D2</a> |\n| `&piv;`      | ϖ      | `&#982;` | greek pi symbol                 | u+03D6 ISOgrk3 | \\\\03D6    | <a href='javascript:alert(&quot;\\u03D6&quot;)'>\\u03D6</a> |\n\n{.show-header}\n\n### HTML Punctuation\n\n| HTML       | Symbol | Numeric   | Description                                | Hex                 | CSS (ISO) | JS (Octal)                                                |\n| ---------- | ------ | --------- | ------------------------------------------ | ------------------- | --------- | --------------------------------------------------------- |\n| `&ensp;`   |        | `&#8194;` | en space                                   | u+2002 ISOpub       | \\\\2002    | <a href='javascript:alert(&quot;\\u2002&quot;)'>\\u2002</a> |\n| `&emsp;`   |        | `&#8195;` | em space                                   | u+2003 ISOpub       | \\\\2003    | <a href='javascript:alert(&quot;\\u2003&quot;)'>\\u2003</a> |\n| `&thinsp;` |        | `&#8201;` | thin space                                 | u+2009 ISOpub       | \\\\2009    | <a href='javascript:alert(&quot;\\u2009&quot;)'>\\u2009</a> |\n| `&zwnj;`   | ‌      | `&#8204;` | zero width non-joiner                      | u+200C NEW RFC 2070 | \\\\200C    | <a href='javascript:alert(&quot;\\u200C&quot;)'>\\u200C</a> |\n| `&zwj;`    | ‍      | `&#8205;` | zero width joiner                          | u+200D NEW RFC 2070 | \\\\200D    | <a href='javascript:alert(&quot;\\u200d&quot;)'>\\u200d</a> |\n| `&lrm;`    | ‎      | `&#8206;` | left-to-right mark                         | u+200E NEW RFC 2070 | \\\\200E    | <a href='javascript:alert(&quot;\\u200e&quot;)'>\\u200e</a> |\n| `&rlm;`    | ‏      | `&#8207;` | right-to-left mark                         | u+200F NEW RFC 2070 | \\\\200F    | <a href='javascript:alert(&quot;\\u200f&quot;)'>\\u200f</a> |\n| `&ndash;`  | –      | `&#8211;` | en dash                                    | u+2013 ISOpub       | \\\\2013    | <a href='javascript:alert(&quot;\\u2013&quot;)'>\\u2013</a> |\n| `&mdash;`  | —      | `&#8212;` | em dash                                    | u+2014 ISOpub       | \\\\2014    | <a href='javascript:alert(&quot;\\u2014&quot;)'>\\u2014</a> |\n| `&lsquo;`  | ‘      | `&#8216;` | left single quotation mark                 | u+2018 ISOnum       | \\\\2018    | <a href='javascript:alert(&quot;\\u2018&quot;)'>\\u2018</a> |\n| `&rsquo;`  | ’      | `&#8217;` | right single quotation mark                | u+2019 ISOnum       | \\\\2019    | <a href='javascript:alert(&quot;\\u2019&quot;)'>\\u2019</a> |\n| `&sbquo;`  | ‚      | `&#8218;` | single low-9 quotation mark                | u+201A NEW          | \\\\201A    | <a href='javascript:alert(&quot;\\u201a&quot;)'>\\u201a</a> |\n| `&ldquo;`  | “      | `&#8220;` | left double quotation mark                 | u+201C ISOnum       | \\\\201C    | <a href='javascript:alert(&quot;\\u201c&quot;)'>\\u201c</a> |\n| `&rdquo;`  | ”      | `&#8221;` | right double quotation mark                | u+201D ISOnum       | \\\\201D    | <a href='javascript:alert(&quot;\\u201d&quot;)'>\\u201d</a> |\n| `&bdquo;`  | „      | `&#8222;` | double low-9 quotation mark                | u+201E NEW          | \\\\201E    | <a href='javascript:alert(&quot;\\u201e&quot;)'>\\u201e</a> |\n| `&dagger;` | †      | `&#8224;` | dagger                                     | u+2020 ISOpub       | \\\\2020    | <a href='javascript:alert(&quot;\\u2020&quot;)'>\\u2020</a> |\n| `&Dagger;` | ‡      | `&#8225;` | double dagger                              | u+2021 ISOpub       | \\\\2021    | <a href='javascript:alert(&quot;\\u2021&quot;)'>\\u2021</a> |\n| `&permil;` | ‰      | `&#8240;` | per mille sign                             | u+2030 ISOtech      | \\\\2030    | <a href='javascript:alert(&quot;\\u2030&quot;)'>\\u2030</a> |\n| `&lsaquo;` | ‹      | `&#8249;` | single left-pointing angle quotation mark  | u+2039 ISO proposed | \\\\2039    | <a href='javascript:alert(&quot;\\u2039&quot;)'>\\u2039</a> |\n| `&rsaquo;` | ›      | `&#8250;` | single right-pointing angle quotation mark | u+203A ISO proposed | \\\\203A    | <a href='javascript:alert(&quot;\\u203a&quot;)'>\\u203a</a> |\n| `&bull;`   | •      | `&#8226;` | bullet, aka. black small circle            | u+2022 ISOpub       | \\\\2022    | <a href='javascript:alert(&quot;\\u2219&quot;)'>\\u2219</a> |\n| `&hellip;` | …      | `&#8230;` | horizontal ellipsis, aka three dot leader  | u+2026 ISOpub       | \\\\2026    | <a href='javascript:alert(&quot;\\u2026&quot;)'>\\u2026</a> |\n| `&prime;`  | ′      | `&#8242;` | prime, aka minutes, aka feet               | u+2032 ISOtech      | \\\\2032    | <a href='javascript:alert(&quot;\\u2032&quot;)'>\\u2032</a> |\n| `&Prime;`  | ″      | `&#8243;` | double prime, aka seconds, aka inches      | u+2033 ISOtech      | \\\\2033    | <a href='javascript:alert(&quot;\\u2033&quot;)'>\\u2033</a> |\n| `&oline;`  | ‾      | `&#8254;` | overline, aka spacing overscore            | u+203E NEW          | \\\\203E    | <a href='javascript:alert(&quot;\\u203e&quot;)'>\\u203e</a> |\n| `&frasl;`  | ⁄      | `&#8260;` | fraction slash                             | u+2044 NEW          | \\\\2044    | <a href='javascript:alert(&quot;\\u8260&quot;)'>\\u8260</a> |\n\n{.show-header}\n\n### HTML Letter-like Symbols\n\n| HTML        | Symbol | Numeric   | Description                                        | Hex            | CSS (ISO) | JS (Octal)                                                |\n| ----------- | ------ | --------- | -------------------------------------------------- | -------------- | --------- | --------------------------------------------------------- |\n| `&weierp;`  | ℘      | `&#8472;` | script capital P, aka power set, aka Weierstrass p | u+2118 ISOamso | \\\\2118    | <a href='javascript:alert(&quot;\\u2118&quot;)'>\\u2118</a> |\n| `&image;`   | ℑ      | `&#8465;` | blackletter capital I, aka imaginary part          | u+2111 ISOamso | \\\\2111    | <a href='javascript:alert(&quot;\\u2111&quot;)'>\\u2111</a> |\n| `&real;`    | ℜ      | `&#8476;` | blackletter capital R, aka real part symbol        | u+211C ISOamso | \\\\211C    | <a href='javascript:alert(&quot;\\u211c&quot;)'>\\u211c</a> |\n| `&trade;`   | ™     | `&#8482;` | trade mark sign                                    | u+2122 ISOnum  | \\\\2122    | <a href='javascript:alert(&quot;\\u2122&quot;)'>\\u2122</a> |\n| `&alefsym;` | ℵ      | `&#8501;` | alef symbol                                        | u+2135 NEW     | \\\\2135    | <a href='javascript:alert(&quot;\\u&quot;)'>\\u</a>         |\n\n{.show-header}\n\n### HTML Arrows\n\n| HTML      | Symbol | Numeric   | Description                                                | Hex            | CSS (ISO) | JS (Octal)                                                |\n| --------- | ------ | --------- | ---------------------------------------------------------- | -------------- | --------- | --------------------------------------------------------- |\n| `&larr;`  | ←      | `&#8592;` | leftwards arrow                                            | u+2190 ISOnum  | \\\\2190    | <a href='javascript:alert(&quot;\\u2190&quot;)'>\\u2190</a> |\n| `&uarr;`  | ↑      | `&#8593;` | upwards arrow                                              | u+2191 ISOnum  | \\\\2191    | <a href='javascript:alert(&quot;\\u2191&quot;)'>\\u2191</a> |\n| `&rarr;`  | →      | `&#8594;` | rightwards arrow                                           | u+2192 ISOnum  | \\\\2192    | <a href='javascript:alert(&quot;\\u2192&quot;)'>\\u2192</a> |\n| `&darr;`  | ↓      | `&#8595;` | downwards arrow                                            | u+2193 ISOnum  | \\\\2193    | <a href='javascript:alert(&quot;\\u2193&quot;)'>\\u2193</a> |\n| `&harr;`  | ↔     | `&#8596;` | left right arrow                                           | u+2194 ISOamsa | \\\\2194    | <a href='javascript:alert(&quot;\\u2194&quot;)'>\\u2194</a> |\n| `&crarr;` | ↵      | `&#8629;` | downwards arrow with corner leftwards, aka carriage return | u+21B5 NEW     | \\\\21B5    | <a href='javascript:alert(&quot;\\u21b5&quot;)'>\\u21b5</a> |\n| `&lArr;`  | ⇐      | `&#8656;` | leftwards double arrow can be used for ‘is implied by’     | u+21D0 ISOtech | \\\\21D0    | <a href='javascript:alert(&quot;\\u21d0&quot;)'>\\u21d0</a> |\n| `&uArr;`  | ⇑      | `&#8657;` | upwards double arrow                                       | u+21D1 ISOamsa | \\\\21D1    | <a href='javascript:alert(&quot;\\u21d1&quot;)'>\\u21d1</a> |\n| `&rArr;`  | ⇒      | `&#8658;` | rightwards double arrow                                    | u+21D2 ISOtech | \\\\21D2    | <a href='javascript:alert(&quot;\\u21d2&quot;)'>\\u21d2</a> |\n| `&dArr;`  | ⇓      | `&#8659;` | downwards double arrow                                     | u+21D3 ISOamsa | \\\\21D3    | <a href='javascript:alert(&quot;\\ud1d3&quot;)'>\\ud1d3</a> |\n| `&hArr;`  | ⇔      | `&#8660;` | left right double arrow                                    | u+21D4 ISOamsa | \\\\21D4    | <a href='javascript:alert(&quot;\\u21d4&quot;)'>\\u21d4</a> |\n|           | ◄      | `&#9668;` | black left pointing triangle                               | U+25C0         | \\\\25C0    | <a href='javascript:alert(&quot;\\u25c0&quot;)'>\\u25c0</a> |\n|           | ►      | `&#9658;` | black right pointing triangle                              | u+25B6         | \\\\25b6    | <a href='javascript:alert(&quot;\\u25b6&quot;)'>\\u25b6</a> |\n|           | ▲      | `&#9650;` | black up pointing triangle                                 | u+25B2         | \\\\25b2    | <a href='javascript:alert(&quot;\\25b2&quot;)'>\\25b2</a>   |\n|           | ▼      | `&#9660;` | black down pointing triangle                               | u+25BC         | \\\\25bc    | <a href='javascript:alert(&quot;\\25bc&quot;)'>\\25bc</a>   |\n\n{.show-header}\n\n### HTML Mathematical Operators\n\n| HTML       | Symbol | Numeric   | Description                           | Hex            | CSS (ISO) | JS (Octal)                                                |\n| ---------- | ------ | --------- | ------------------------------------- | -------------- | --------- | --------------------------------------------------------- |\n| `&forall;` | ∀      | `&#8704;` | for all                               | u+2200 ISOtech | \\\\2200    | <a href='javascript:alert(&quot;\\u2200&quot;)'>\\u2200</a> |\n| `&part;`   | ∂      | `&#8706;` | partial differential                  | u+2202 ISOtech | \\\\2202    | <a href='javascript:alert(&quot;\\u2202&quot;)'>\\u2202</a> |\n| `&exist;`  | ∃      | `&#8707;` | there exists                          | u+2203 ISOtech | \\\\2203    | <a href='javascript:alert(&quot;\\u2203&quot;)'>\\u2203</a> |\n| `&empty;`  | ∅      | `&#8709;` | empty set, aka null set, aka diameter | u+2205 ISOamso | \\\\2205    | <a href='javascript:alert(&quot;\\u2205&quot;)'>\\u2205</a> |\n| `&nabla;`  | ∇      | `&#8711;` | nabla, aka bakad difference           | u+2207 ISOtech | \\\\2207    | <a href='javascript:alert(&quot;\\u2207&quot;)'>\\u2207</a> |\n| `&isin;`   | ∈      | `&#8712;` | element of                            | u+2208 ISOtech | \\\\2208    | <a href='javascript:alert(&quot;\\u2208&quot;)'>\\u2208</a> |\n| `&notin;`  | ∉      | `&#8713;` | not an element of                     | u+2209 ISOtech | \\\\2209    | <a href='javascript:alert(&quot;\\u2209&quot;)'>\\u2209</a> |\n| `&ni;`     | ∋      | `&#8715;` | contains as member                    | u+220B ISOtech | \\\\220B    | <a href='javascript:alert(&quot;\\u220b&quot;)'>\\u220b</a> |\n| `&prod;`   | ∏      | `&#8719;` | n-ary product, aka product sign       | u+220F ISOamsb | \\\\220F    | <a href='javascript:alert(&quot;\\u03a0&quot;)'>\\u03a0</a> |\n| `&sum;`    | ∑      | `&#8721;` | n-ary sumation                        | u+2211 ISOamsb | \\\\2211    | <a href='javascript:alert(&quot;\\u03a3&quot;)'>\\u03a3</a> |\n| `&minus;`  | −      | `&#8722;` | minus sign                            | u+2212 ISOtech | \\\\2212    | <a href='javascript:alert(&quot;\\u2212&quot;)'>\\u2212</a> |\n| `&lowast;` | ∗      | `&#8727;` | asterisk operator                     | u+2217 ISOtech | \\\\2217    | <a href='javascript:alert(&quot;\\u2217&quot;)'>\\u2217</a> |\n| `&radic;`  | √      | `&#8730;` | square root, aka radical sign         | u+221A ISOtech | \\\\221A    | <a href='javascript:alert(&quot;\\u221a&quot;)'>\\u221a</a> |\n| `&prop;`   | ∝      | `&#8733;` | proportional to                       | u+221D ISOtech | \\\\221D    | <a href='javascript:alert(&quot;\\u221d&quot;)'>\\u221d</a> |\n| `&infin;`  | ∞      | `&#8734;` | infinity                              | u+221E ISOtech | \\\\221E    | <a href='javascript:alert(&quot;\\u221e&quot;)'>\\u221e</a> |\n| `&ang;`    | ∠      | `&#8736;` | angle                                 | u+2220 ISOamso | \\\\2220    | <a href='javascript:alert(&quot;\\u2220&quot;)'>\\u2220</a> |\n| `&and;`    | ⊥      | `&#8869;` | logical and, aka wedge                | u+2227 ISOtech | \\\\2227    | <a href='javascript:alert(&quot;\\u2227&quot;)'>\\u2227</a> |\n| `&or;`     | ⊦      | `&#8870;` | logical or, aka vee                   | u+2228 ISOtech | \\\\2228    | <a href='javascript:alert(&quot;\\u2228&quot;)'>\\u2228</a> |\n| `&cap;`    | ∩      | `&#8745;` | intersection, aka cap                 | u+2229 ISOtech | \\\\2229    | <a href='javascript:alert(&quot;\\u2229&quot;)'>\\u2229</a> |\n| `&cup;`    | ∪      | `&#8746;` | union, aka cup                        | u+222A ISOtech | \\\\222A    | <a href='javascript:alert(&quot;\\u222a&quot;)'>\\u222a</a> |\n| `&int;`    | ∫      | `&#8747;` | integral                              | u+222B ISOtech | \\\\222B    | <a href='javascript:alert(&quot;\\u222b&quot;)'>\\u222b</a> |\n| `&there4;` | ∴      | `&#8756;` | therefore                             | u+2234 ISOtech | \\\\2234    | <a href='javascript:alert(&quot;\\u2234&quot;)'>\\u2234</a> |\n| `&sim;`    | ∼      | `&#8764;` | tilde                                 | u+223C ISOtech | \\\\223C    | <a href='javascript:alert(&quot;\\u223c&quot;)'>\\u223c</a> |\n| `&cong;`   | ≅      | `&#8773;` | approximately equal to                | u+2245 ISOtech | \\\\2245    | <a href='javascript:alert(&quot;\\u2245&quot;)'>\\u2245</a> |\n| `&asymp;`  | ≈      | `&#8776;` | almost equal to, aka asymptotic to    | u+2248 ISOamsr | \\\\2248    | <a href='javascript:alert(&quot;\\u2248&quot;)'>\\u2248</a> |\n| `&ne;`     | ≠      | `&#8800;` | not equal to                          | u+2260 ISOtech | \\\\2260    | <a href='javascript:alert(&quot;\\u2260&quot;)'>\\u2260</a> |\n| `&equiv;`  | ≡      | `&#8801;` | identical to                          | u+2261 ISOtech | \\\\2261    | <a href='javascript:alert(&quot;\\u2261&quot;)'>\\u2261</a> |\n| `&le;`     | ≤      | `&#8804;` | less-than or equal to                 | u+2264 ISOtech | \\\\2264    | <a href='javascript:alert(&quot;\\u2264&quot;)'>\\u2264</a> |\n| `&ge;`     | ≥      | `&#8805;` | greater-than or equal to              | u+2265 ISOtech | \\\\2265    | <a href='javascript:alert(&quot;\\u2265&quot;)'>\\u2265</a> |\n| `&sub;`    | ⊂      | `&#8834;` | subset of                             | u+2282 ISOtech | \\\\2282    | <a href='javascript:alert(&quot;\\u2282&quot;)'>\\u2282</a> |\n| `&sup;`    | ⊃      | `&#8835;` | superset of                           | u+2283 ISOtech | \\\\2283    | <a href='javascript:alert(&quot;\\u2283&quot;)'>\\u2283</a> |\n| `&nsub;`   | ⊄      | `&#8836;` | not a subset of                       | u+2284 ISOamsn | \\\\2284    | <a href='javascript:alert(&quot;\\u2284&quot;)'>\\u2284</a> |\n| `&sube;`   | ⊆      | `&#8838;` | subset of or equal to                 | u+2286 ISOtech | \\\\2286    | <a href='javascript:alert(&quot;\\u2286&quot;)'>\\u2286</a> |\n| `&supe;`   | ⊇      | `&#8839;` | superset of or equal to               | u+2287 ISOtech | \\\\2287    | <a href='javascript:alert(&quot;\\u2287&quot;)'>\\u2287</a> |\n| `&oplus;`  | ⊕      | `&#8853;` | circled plus, aka direct sum          | u+2295 ISOamsb | \\\\2295    | <a href='javascript:alert(&quot;\\u2295&quot;)'>\\u2295</a> |\n| `&otimes;` | ⊗      | `&#8855;` | circled times, aka vector product     | u+2297 ISOamsb | \\\\2297    | <a href='javascript:alert(&quot;\\u2297&quot;)'>\\u2297</a> |\n| `&perp;`   | ⊥      | `&#8869;` | up tack                               | u+22A5 ISOtech | \\\\22A5    | <a href='javascript:alert(&quot;\\u22a5&quot;)'>\\u22a5</a> |\n| `&sdot;`   | ⋅      | `&#8901;` | dot operator                          | u+22C5 ISOamsb | \\\\22C5    | <a href='javascript:alert(&quot;\\u22c5&quot;)'>\\u22c5</a> |\n\n{.show-header}\n\n### HTML Technical\n\n| HTML       | Symbol | Numeric   | Description                   | Hex            | CSS (ISO) | JS (Octal)                                                |\n| ---------- | ------ | --------- | ----------------------------- | -------------- | --------- | --------------------------------------------------------- |\n| `&lceil;`  | ⌈      | `&#8968;` | left ceiling, aka apl upstile | u+2308 ISOamsc | \\\\2308    | <a href='javascript:alert(&quot;\\u2308&quot;)'>\\u2308</a> |\n| `&rceil;`  | ⌉      | `&#8969;` | right ceiling                 | u+2309 ISOamsc | \\\\2309    | <a href='javascript:alert(&quot;\\u2309&quot;)'>\\u2309</a> |\n| `&lfloor;` | ⌊      | `&#8970;` | left floor, aka apl downstile | u+230A ISOamsc | \\\\230A    | <a href='javascript:alert(&quot;\\u230a&quot;)'>\\u230a</a> |\n| `&rfloor;` | ⌋      | `&#8971;` | right floor                   | u+230B ISOamsc | \\\\230B    | <a href='javascript:alert(&quot;\\u230b&quot;)'>\\u230b</a> |\n| `&lang;`   | 〈     | `&#9001;` | left-pointing angle bracket   | u+2329 ISOtech | \\\\2329    | <a href='javascript:alert(&quot;\\u2329&quot;)'>\\u2329</a> |\n| `&rang;`   | 〉     | `&#9002;` | right-pointing angle bracket  | u+232A ISOtech | \\\\232A    | <a href='javascript:alert(&quot;\\u232a&quot;)'>\\u232a</a> |\n\n{.show-header}\n\n### HTML Miscellaneous\n\n| HTML       | Symbol | Numeric   | Description                     | Hex           | CSS (ISO) | JS (Octal)                                                |\n| ---------- | ------ | --------- | ------------------------------- | ------------- | --------- | --------------------------------------------------------- |\n| `&loz;`    | ◊      | `&#9674;` | lozenge                         | u+25CA ISOpub | \\\\25CA    | <a href='javascript:alert(&quot;\\u25ca&quot;)'>\\u25ca</a> |\n| `&spades;` | ♠     | `&#9824;` | black spade suit                | u+2660 ISOpub | \\\\2660    | <a href='javascript:alert(&quot;\\u2660&quot;)'>\\u2660</a> |\n| `&clubs;`  | ♣     | `&#9827;` | black club suit, aka shamrock   | u+2663 ISOpub | \\\\2663    | <a href='javascript:alert(&quot;\\u2663&quot;)'>\\u2663</a> |\n| `&hearts;` | ♥     | `&#9829;` | black heart suit, aka valentine | u+2665 ISOpub | \\\\2665    | <a href='javascript:alert(&quot;\\u2665&quot;)'>\\u2665</a> |\n| `&diams;`  | ♦     | `&#9830;` | black diamond suit              | u+2666 ISOpub | \\\\2666    | <a href='javascript:alert(&quot;\\u2666&quot;)'>\\u2666</a> |\n\n{.show-header}\n"
  },
  {
    "path": "source/_posts/html.md",
    "content": "---\ntitle: HTML\ndate: 2021-07-20 19:16:42\nbackground: bg-[#cc5534]\ntags:\n  - web\ncategories:\n  - Programming\nintro: |\n  This HTML quick reference cheat sheet lists the common HTML and HTML5 tags in readable layout.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### hello.html {.col-span-2 .row-span-2}\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>HTML5 Boilerplate</title>\n  </head>\n  <body>\n    <h1>Hello world, hello CheatSheets.zip!</h1>\n  </body>\n</html>\n```\n\nOr try it out in the [jsfiddle](https://jsfiddle.net/Fechin/1e4wz20b/)\n\n### Comment\n\n```html\n<!-- this is a comment -->\n\n<!--\n    Or you can comment out a\n    large number of lines.\n-->\n```\n\n### Paragraph\n\n```html\n<p>I'm from CheatSheets.zip</p>\n<p>Share quick reference cheat sheet.</p>\n```\n\nSee: [The Paragraph element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p)\n\n### HTML link\n\n```html\n<a href=\"https://cheatsheets.zip\">CheatSheets</a>\n<a href=\"mailto:jack@abc.com\">Email</a>\n<a href=\"tel:+12345678\">Call</a>\n<a href=\"sms:+12345678&body=ha%20ha\">Msg</a>\n```\n\n---\n\n|     |          |                                                                 |\n| --- | -------- | --------------------------------------------------------------- |\n|     | `href`   | The URL that the hyperlink points to                            |\n|     | `rel`    | Relationship of the linked URL                                  |\n|     | `target` | Link target location: <br/>`_self`, `_blank`, `_top`, `_parent` |\n\n{.left-text}\n\nSee: [The \\<a> Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes)\n\n### Image Tag\n\n```html {.wrap}\n<img\n  loading=\"lazy\"\n  src=\"https://xxx.png\"\n  alt=\"Describe image here\"\n  width=\"400\"\n  height=\"400\"\n/>\n```\n\n---\n\n|     |           |                                          |\n| --- | --------- | ---------------------------------------- |\n|     | `src`     | Required, Image location _(URL \\| Path)_ |\n|     | `alt`     | Describe of the image                    |\n|     | `width`   | Width of the image                       |\n|     | `height`  | Height of the image                      |\n|     | `loading` | How the browser should load              |\n\n{.left-text}\n\nSee: [The Image Embed element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img)\n\n### Text Formatting Tags\n\n```html\n<b>Bold Text</b>\n<strong>This text is important</strong>\n<i>Italic Text</i>\n<em>This text is emphasized</em>\n<u>Underline Text</u>\n<pre>Pre-formatted Text</pre>\n<code>Source code</code>\n<del>Deleted text</del>\n<mark>Highlighted text (HTML5)</mark>\n<ins>Inserted text</ins>\n<sup>Makes text superscripted</sup>\n<sub>Makes text subscripted</sub>\n<small>Makes text smaller</small>\n<kbd>Ctrl</kbd>\n<blockquote>Text Block Quote</blockquote>\n```\n\n### Headings\n\n```html\n<h1>This is Heading 1</h1>\n<h2>This is Heading 2</h2>\n<h3>This is Heading 3</h3>\n<h4>This is Heading 4</h4>\n<h5>This is Heading 5</h5>\n<h6>This is Heading 6</h6>\n```\n\nYou should only have one h1 on your page\n\n### Section Divisions\n\n|                 |                                      |\n| --------------- | ------------------------------------ |\n| `<div></div>`   | Division or Section of Page Content  |\n| `<span></span>` | Section of text within other content |\n| `<p></p>`       | Paragraph of Text                    |\n| `<br>`          | Line Break                           |\n| `<hr>`          | Basic Horizontal Line                |\n\nThese are the tags used to divide your page up into sections\n\n### Inline Frame {.row-span-2}\n\n```html {.wrap}\n<iframe\n  title=\"New York\"\n  width=\"342\"\n  height=\"306\"\n  id=\"gmap_canvas\"\n  src=\"https://maps.google.com/maps?q=2880%20Broadway,%20New%20York&t=&z=13&ie=UTF8&iwloc=&output=embed\"\n  scrolling=\"no\"\n>\n</iframe>\n```\n\n#### ↓ Preview\n\n<iframe title=\"New York\"\n    width=\"342\"\n    height=\"306\"\n    id=\"gmap_canvas\"\n    src=\"https://maps.google.com/maps?q=2880%20Broadway,%20New%20York&t=&z=13&ie=UTF8&iwloc=&output=embed\"\n    scrolling=\"no\">\n</iframe>\n\nSee: [The Inline Frame element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe)\n\n### JavaScript in HTML\n\n```html\n<script type=\"text/javascript\">\n  let text = 'Hello CheatSheets.zip';\n  alert(text);\n</script>\n```\n\n#### External JavaScript\n\n```html\n<body>\n  ...\n\n  <script src=\"app.js\"></script>\n</body>\n```\n\n### CSS in HTML\n\n```html\n<style type=\"text/css\">\n  h1 {\n    color: purple;\n  }\n</style>\n```\n\n#### External stylesheet\n\n```html\n<head>\n  ...\n  <link rel=\"stylesheet\" href=\"style.css\" />\n</head>\n```\n\n## HTML5 Tags\n\n### Document\n\n```html\n<body>\n  <header>\n    <nav>...</nav>\n  </header>\n  <main>\n    <h1>CheatSheets.zip</h1>\n  </main>\n  <footer>\n    <p>©2023 CheatSheets.zip</p>\n  </footer>\n</body>\n```\n\n### Header Navigation\n\n```html\n<header>\n  <nav>\n    <ul>\n      <li><a href=\"#\">Edit Page</a></li>\n      <li><a href=\"#\">Twitter</a></li>\n      <li><a href=\"#\">Facebook</a></li>\n    </ul>\n  </nav>\n</header>\n```\n\n### HTML5 Tags {.row-span-4}\n\n|                                                                                    |                                        |\n| ---------------------------------------------------------------------------------- | -------------------------------------- |\n| [article](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/article)       | Content that’s independent             |\n| [aside](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside)           | Secondary content                      |\n| [audio](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio)           | Embeds a sound, or an audio stream     |\n| [bdi](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bdi)               | The Bidirectional Isolate element      |\n| [canvas](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas)         | Draw graphics via JavaScript           |\n| [data](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/data)             | Machine readable content               |\n| [datalist](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist)     | A set of pre-defined options           |\n| [details](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details)       | Additional information                 |\n| [dialog](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog)         | A dialog box or sub-window             |\n| [embed](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/embed)           | Embeds external application            |\n| [figcaption](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figcaption) | A caption or legend for a figure       |\n| [figure](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figure)         | A figure illustrated                   |\n| [footer](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/footer)         | Footer or least important              |\n| [header](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/header)         | Masthead or important information      |\n| [main](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/main)             | The main content of the document       |\n| [mark](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/mark)             | Text highlighted                       |\n| [meter](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meter)           | A scalar value within a known range    |\n| [nav](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/nav)               | A section of navigation links          |\n| [output](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/output)         | The result of a calculation            |\n| [picture](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture)       | A container for multiple image sources |\n| [progress](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress)     | The completion progress of a task      |\n| [rp](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/rp)                 | Provides fall-back parenthesis         |\n| [rt](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/rt)                 | Defines the pronunciation of character |\n| [ruby](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ruby)             | Represents a ruby annotation           |\n| [section](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section)       | A group in a series of related content |\n| [source](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source)         | Resources for the media elements       |\n| [summary](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/summary)       | A summary for the \\<details> element   |\n| [template](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template)     | Defines the fragments of HTML          |\n| [time](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time)             | A time or date                         |\n| [track](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track)           | Text tracks for the media elements     |\n| [video](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video)           | Embeds video                           |\n| [wbr](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/wbr)               | A line break opportunity               |\n\n### HTML5 Video\n\n```html {.wrap}\n<video controls=\"\" width=\"100%\">\n  <source\n    src=\"https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4\"\n    type=\"video/mp4\"\n  />\n  Sorry, your browser doesn't support embedded videos.\n</video>\n```\n\n#### ↓ Preview\n\n<video controls=\"\" width=\"100%\">\n    <source src=\"https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4\" type=\"video/mp4\">\n    Sorry, your browser doesn't support embedded videos.\n</video>\n\n### HTML5 Audio\n\n```html {.wrap}\n<audio\n  controls\n  src=\"https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3\"\n>\n  Your browser does not support the audio element.\n</audio>\n```\n\n#### ↓ Preview\n\n<audio controls class=\"w-full\"\n    src=\"https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3\"> Your browser does not support the\naudio element. </audio>\n\n### HTML5 Ruby\n\n```html {.wrap}\n<ruby>\n  汉 <rp>(</rp><rt>hàn</rt><rp>)</rp> 字 <rp>(</rp><rt>zì</rt><rp>)</rp>\n</ruby>\n```\n\n#### ↓ Preview\n\n<ruby class=\"mt-4 text-center text-5xl\">\n  汉 <rp>(</rp><rt>hàn</rt><rp>)</rp>\n  字 <rp>(</rp><rt>zì</rt><rp>)</rp>\n</ruby>\n\n### HTML5 kdi\n\n```html\n<ul>\n  <li>User <bdi>hrefs</bdi>: 60 points</li>\n  <li>User <bdi>jdoe</bdi>: 80 points</li>\n  <li>User <bdi>إيان</bdi>: 90 points</li>\n</ul>\n```\n\n#### ↓ Preview\n\n<ul>\n <li>User <bdi>hrefs</bdi>: 60 points</li>\n <li>User <bdi>jdoe</bdi>: 80 points</li>\n <li>User <bdi>إيان</bdi>: 90 points</li>\n</ul>\n\n### HTML5 progress\n\n```html\n<progress value=\"50\" max=\"100\"></progress>\n```\n\n<progress value=\"50\" max=\"100\" class=\"w-full\"></progress>\n\n### HTML5 mark\n\n```html\n<p>I Love <mark>CheatSheets.zip</mark></p>\n```\n\n<p>I Love <mark>CheatSheets.zip</mark></p>\n\n## HTML Tables\n\n### Table Example {.row-span-2}\n\n```html\n<table>\n  <thead>\n    <tr>\n      <td>name</td>\n      <td>age</td>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>Roberta</td>\n      <td>39</td>\n    </tr>\n    <tr>\n      <td>Oliver</td>\n      <td>25</td>\n    </tr>\n  </tbody>\n</table>\n```\n\n### HTML Table Tags {.row-span-2}\n\n| Tag                                                                               | Description                      |\n| --------------------------------------------------------------------------------- | -------------------------------- |\n| [\\<table>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table)       | Defines a table                  |\n| [\\<th>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th)             | Defines a header cell in a table |\n| [\\<tr>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr)             | Defines a row in a table         |\n| [\\<td>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td)             | Defines a cell in a table        |\n| [\\<caption>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption)   | Defines a table caption          |\n| [\\<colgroup>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup) | Defines a group of columns       |\n| [\\<col>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col)           | Defines a column within a table  |\n| [\\<thead>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead)       | Groups the header content        |\n| [\\<tbody>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody)       | Groups the body content          |\n| [\\<tfoot>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tfoot)       | Groups the footer content        |\n\n### \\<td> Attributes\n\n| Attribute | Description                                   |\n| --------- | --------------------------------------------- |\n| `colspan` | Number of columns a cell should span          |\n| `headers` | One or more header cells a cell is related to |\n| `rowspan` | Number of rows a cell should span             |\n\nSee: [td\\#Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attributes)\n\n### \\<th> Attributes\n\n| Attribute                                                                        | Description                                   |\n| -------------------------------------------------------------------------------- | --------------------------------------------- |\n| `colspan`                                                                        | Number of columns a cell should span          |\n| `headers`                                                                        | One or more header cells a cell is related to |\n| `rowspan`                                                                        | Number of rows a cell should span             |\n| `abbr`                                                                           | Description of the cell's content             |\n| [scope](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope) | The header element relates to                 |\n\nSee: [th\\#Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attributes)\n\n## HTML Lists\n\n### Unordered list\n\n```html\n<ul>\n  <li>I'm an item</li>\n  <li>I'm another item</li>\n  <li>I'm another item</li>\n</ul>\n```\n\nSee: [The Unordered List element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul)\n\n### Ordered list\n\n```html\n<ol>\n  <li>I'm the first item</li>\n  <li>I'm the second item</li>\n  <li>I'm the third item</li>\n</ol>\n```\n\nSee: [The Ordered List element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol)\n\n### Definition list\n\n```html\n<dl>\n  <dt>A Term</dt>\n  <dd>Definition of a term</dd>\n  <dt>Another Term</dt>\n  <dd>Definition of another term</dd>\n</dl>\n```\n\nSee: [The Description List element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl)\n\n## HTML Forms\n\n### Form tags {.row-span-2}\n\n```html\n<form method=\"POST\" action=\"api/login\">\n  <label for=\"mail\">Email: </label>\n  <input type=\"email\" id=\"mail\" name=\"mail\" />\n  <br />\n  <label for=\"pw\">Password: </label>\n  <input type=\"password\" id=\"pw\" name=\"pw\" />\n  <br />\n  <input type=\"submit\" value=\"Login\" />\n  <br />\n  <input type=\"checkbox\" id=\"ck\" name=\"ck\" />\n  <label for=\"ck\">Remember me</label>\n</form>\n```\n\n#### ↓ Preview\n\n<form method=\"POST\" action=\"api/login\" style=\"padding: 20px;\">\n    <label for=\"email\">Email: </label> \n    <input type=\"email\" id=\"email\" name=\"email\" class=\"border border-slate-400 mt-2\">\n    <br/>\n    <label for=\"pwd\">Password: </label> \n    <input type=\"password\" id=\"pwd\" name=\"pwd\" class=\"border border-slate-400 mt-2\">\n    <br/>\n    <input type=\"submit\" value=\"Login\" class=\"mt-2\">\n    <br/>\n    <input type=\"checkbox\" id=\"ck\" name=\"ck\" class=\"mt-2\">\n    <label for=\"ck\">Remember me</label> \n</form>\n\nThe HTML `<form>` element is used to collect and send information to an external source.\n\n### Form Attribute\n\n| Attribute  | Description                                                                                         |\n| ---------- | --------------------------------------------------------------------------------------------------- |\n| `name`     | Name of form for scripting                                                                          |\n| `action`   | URL of form script                                                                                  |\n| `method`   | HTTP method, `POST` / `GET` _(default)_                                                             |\n| `enctype`  | Media type, See [enctype](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/enctype) |\n| `onsubmit` | Runs when the form was submit                                                                       |\n| `onreset`  | Runs when the form was reset                                                                        |\n\n### Label tags\n\n```html\n<!-- Nested label -->\n<label\n  >Click me\n  <input type=\"text\" id=\"user\" name=\"name\" />\n</label>\n```\n\n---\n\n```html\n<!-- 'for' attribute -->\n<label for=\"user\">Click me</label>\n<input id=\"user\" type=\"text\" name=\"name\" />\n```\n\n`for` in a label references an input's `id` attribute\n\n### Input tags\n\n```html\n<label for=\"Name\">Name:</label> <input type=\"text\" name=\"Name\" id=\"\" />\n```\n\n#### ↓ Preview\n\n<form style=\"padding: 20px;\">\n    <label for=\"username\">Username:</label>\n    <input type=\"text\" name=\"username\" id=\"username\" class=\"border border-slate-400\">\n</form>\n\nSee: [HTML input Tags](/html#html-input-tags)\n\n### Textarea tags\n\n```html {.wrap}\n<textarea rows=\"2\" cols=\"30\" name=\"address\" id=\"address\"></textarea>\n```\n\n#### ↓ Preview\n\n<form style=\"padding: 20px;\">\n    <textarea rows=\"2\" cols=\"30\" name=\"address\" id=\"address\" class=\"border border-slate-400\"style=\"width: 100%\"></textarea>\n</form>\n\nTextarea is a multiple-line text input control\n\n### Radio Buttons\n\n```html\n<input type=\"radio\" name=\"gender\" id=\"m\" />\n<label for=\"m\">Male</label>\n<input type=\"radio\" name=\"gender\" id=\"f\" />\n<label for=\"f\">Female</label>\n```\n\n#### ↓ Preview\n\n<form style=\"padding: 20px;\">\n    <input type=\"radio\" name=\"gender\" id=\"m\">\n    <label for=\"m\">Male</label>\n    <input type=\"radio\" name=\"gender\" id=\"f\">\n    <label for=\"f\">Female</label>\n</form>\n\nRadio buttons are used to let the user select exactly one\n\n### Checkboxes\n\n```html\n<input type=\"checkbox\" name=\"s\" id=\"soc\" />\n<label for=\"soc\">Soccer</label>\n<input type=\"checkbox\" name=\"s\" id=\"bas\" />\n<label for=\"bas\">Baseball</label>\n```\n\n#### ↓ Preview\n\n<form style=\"padding: 20px;\">\n    <input type=\"checkbox\" name=\"sports\" id=\"soccer\">\n    <label for=\"soccer\">Soccer</label>\n    <input type=\"checkbox\" name=\"sports\" id=\"baseball\">\n    <label for=\"baseball\">Baseball</label>\n</form>\n\nCheckboxes allows the user to select one or more\n\n### Select tags\n\n```html\n<label for=\"city\">City:</label>\n<select name=\"city\" id=\"city\">\n  <option value=\"1\">Sydney</option>\n  <option value=\"2\">Melbourne</option>\n  <option value=\"3\">Cromwell</option>\n</select>\n```\n\n#### ↓ Preview\n\n<form style=\"padding: 20px\">\n    <label for=\"city\">City:</label>\n    <select name=\"city\" id=\"city\" class=\"border border-slate-400\">\n        <option value=\"1\">Sydney</option>\n        <option value=\"2\">Melbourne</option>\n        <option value=\"3\">Cromwell</option>\n    </select>\n</form>\n\nA select box is a dropdown list of options\n\n### Fieldset tags\n\n```html\n<fieldset>\n  <legend>Your favorite monster</legend>\n  <input type=\"radio\" id=\"kra\" name=\"m\" />\n  <label for=\"kraken\">Kraken</label><br />\n  <input type=\"radio\" id=\"sas\" name=\"m\" />\n  <label for=\"sas\">Sasquatch</label>\n</fieldset>\n```\n\n#### ↓ Preview\n\n<form style=\"padding: 20px\">\n    <fieldset class=\"border border-slate-400\" style=\"padding: 20px\">\n        <legend>Your favorite monster</legend>\n        <input type=\"radio\" id=\"kra\" name=\"monster\">\n        <label for=\"kra\">Kraken</label><br/>\n        <input type=\"radio\" id=\"sas\" name=\"monster\">\n        <label for=\"sas\">Sasquatch</label>\n    </fieldset>\n</form>\n\n### Datalist tags(HTML5)\n\n```html\n<label for=\"b\">Choose a browser: </label>\n<input list=\"list\" id=\"b\" name=\"browser\" />\n<datalist id=\"list\">\n  <option value=\"Chrome\"></option>\n  <option value=\"Firefox\"></option>\n  <option value=\"Internet Explorer\"></option>\n  <option value=\"Opera\"></option>\n  <option value=\"Safari\"></option>\n  <option value=\"Microsoft Edge\"></option>\n</datalist>\n```\n\n#### ↓ Preview\n\n<form style=\"padding: 20px\">\n    <label for=\"myBrowser\">Choose a browser:</label>\n    <input list=\"browsers\" id=\"myBrowser\" name=\"myBrowser\" class=\"border border-slate-400\"/>\n    <datalist id=\"browsers\">\n      <option value=\"Chrome\">\n      <option value=\"Firefox\">\n      <option value=\"Internet Explorer\">\n      <option value=\"Opera\">\n      <option value=\"Safari\">\n      <option value=\"Microsoft Edge\">\n    </datalist>\n</form>\n\n### Submit and Reset Buttons\n\n```html\n<form action=\"register.php\" method=\"post\">\n  <label for=\"foo\">Name:</label>\n  <input type=\"text\" name=\"name\" id=\"foo\" />\n  <input type=\"submit\" value=\"Submit\" />\n  <input type=\"reset\" value=\"Reset\" />\n</form>\n```\n\n#### ↓ Preview\n\n<form action=\"register.php\" method=\"post\" style=\"padding: 20px\">\n    <label for=\"name\">Name:</label>\n    <input type=\"text\" name=\"name\" id=\"name\" class=\"border border-slate-400\">\n    <input type=\"submit\" value=\"Submit\">\n    <input type=\"reset\" value=\"Reset\">\n</form>\n\n`Submit` the data to server; `Reset` to default values\n\n## HTML input Tags {.cols-2}\n\n### Input Attributes {.row-span-2}\n\nThe input tag is an empty element, identifying the particular type of field information to obtain from a user.\n\n```html {.wrap}\n<input type=\"text\" name=\"?\" value=\"?\" minlength=\"6\" required />\n```\n\n---\n\n| -   |                         |                                                                                                                               |\n| --- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------- |\n|     | `type=\"…\"`              | The type of data that is being input                                                                                          |\n|     | `value=\"…\"`             | Default value                                                                                                                 |\n|     | `name=\"…\"`              | Used to describe this data in the HTTP request                                                                                |\n|     | `id=\"…\"`                | Unique identifier that other HTML elements                                                                                    |\n|     | `readonly`              | Stops the user from modifying                                                                                                 |\n|     | `disabled`              | Stops any interaction                                                                                                         |\n|     | `checked`               | The radio or checkbox select or not                                                                                           |\n|     | `required`              | Being compulsory, See [required](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required#example)               |\n|     | `placeholder=\"…\"`       | Adds a temporary, See [::placeholder](https://developer.mozilla.org/en-US/docs/Web/CSS/::placeholder#examples)                |\n|     | `autocomplete=\"off\"`    | Disable auto completion                                                                                                       |\n|     | `autocapitalize=\"none\"` | Disable auto capitalization                                                                                                   |\n|     | `inputmode=\"…\"`         | Display a specific keyboard, See [inputmode](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode)   |\n|     | `list=\"…\"`              | The id of an associated [datalist](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist)                        |\n|     | `maxlength=\"…\"`         | Maximum number of characters                                                                                                  |\n|     | `minlength=\"…\"`         | Minimum number of characters                                                                                                  |\n|     | `min=\"…\"`               | Minimum numerical value on range & number                                                                                     |\n|     | `max=\"…\"`               | Maximum numerical value on range & number                                                                                     |\n|     | `step=\"…\"`              | How the number will increment in range & number                                                                               |\n|     | `pattern=\"…\"`           | Specifies a [Regular expression](/regex), See [pattern](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern) |\n|     | `autofocus`             | Be focused                                                                                                                    |\n|     | `spellcheck`            | Perform spell checking                                                                                                        |\n|     | `multiple`              | Whether to allow [multiple](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/multiple) values                     |\n|     | `accept=\"\"`             | Expected file type in [file](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file) upload controls            |\n\n{.left-text}\n\nAlso see:\n[Attributes for the \\<input> element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes)\n\n### Input types\n\n|                   |                                                                                                                                          |\n| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |\n| `type=\"checkbox\"` | <input type=\"checkbox\" class=\"border border-slate-400\">                                                                                  |\n| `type=\"radio\"`    | <input type=\"radio\" class=\"border border-slate-400\">                                                                                     |\n| `type=\"file\"`     | <input type=\"file\" class=\"border border-slate-400\">                                                                                      |\n| `type=\"hidden\"`   | <input type=\"hidden\" class=\"border border-slate-400\">                                                                                    |\n| `type=\"text\"`     | <input type=\"text\" class=\"border border-slate-400\">                                                                                      |\n| `type=\"password\"` | <input type=\"password\" class=\"border border-slate-400\">                                                                                  |\n| `type=\"image\"`    | <input type=\"image\" src=\"https://raw.githubusercontent.com/mdn/learning-area/master/html/forms/image-type-example/login.png\" width=\"70\"> |\n| `type=\"reset\"`    | <input type=\"reset\" class=\"border border-slate-400\">                                                                                     |\n| `type=\"button\"`   | <input type=\"button\" class=\"border border-slate-400\" value=\"button\">                                                                     |\n| `type=\"submit\"`   | <input type=\"submit\" class=\"border border-slate-400\">                                                                                    |\n\n#### New Input Types in HTML5\n\n|                         |                                                                      |\n| ----------------------- | -------------------------------------------------------------------- |\n| `type=\"color\"`          | <input type=\"color\" value=\"#0FB881\" class=\"border border-slate-400\"> |\n| `type=\"date\"`           | <input type=\"date\" class=\"border border-slate-400\">                  |\n| `type=\"time\"`           | <input type=\"time\" class=\"border border-slate-400\">                  |\n| `type=\"month\"`          | <input type=\"month\" class=\"border border-slate-400\">                 |\n| `type=\"datetime-local\"` | <input type=\"datetime-local\" class=\"border border-slate-400\">        |\n| `type=\"week\"`           | <input type=\"week\" class=\"border border-slate-400\">                  |\n| `type=\"email\"`          | <input type=\"email\" class=\"border border-slate-400\">                 |\n| `type=\"tel\"`            | <input type=\"tel\" class=\"border border-slate-400\">                   |\n| `type=\"url\"`            | <input type=\"url\" class=\"border border-slate-400\">                   |\n| `type=\"number\"`         | <input type=\"number\" class=\"border border-slate-400\">                |\n| `type=\"search\"`         | <input type=\"search\" class=\"border border-slate-400\">                |\n| `type=\"range\"`          | <input type=\"range\" class=\"border border-slate-400\">                 |\n\n### Input CSS selectors\n\n|               |                           |\n| ------------- | ------------------------- |\n| `input:focus` | When its keyboard focused |\n\nSee: [Input pseudo classes](/css#input-pseudo-classes)\n\n## HTML meta Tags {.cols-2}\n\n### Meta tags {.row-span-3}\n\nThe meta tag describes meta data within an HTML document. It explains additional material about the HTML.\n\n```html\n<meta charset=\"utf-8\" />\n```\n\n```html\n<!-- title -->\n<title>···</title>\n<meta property=\"og:title\" content=\"···\" />\n<meta name=\"twitter:title\" content=\"···\" />\n```\n\n---\n\n```html\n<!-- url -->\n<link rel=\"canonical\" href=\"https://···\" />\n<meta property=\"og:url\" content=\"https://···\" />\n<meta name=\"twitter:url\" content=\"https://···\" />\n```\n\n---\n\n```html\n<!-- description -->\n<meta name=\"description\" content=\"···\" />\n<meta property=\"og:description\" content=\"···\" />\n<meta name=\"twitter:description\" content=\"···\" />\n```\n\n---\n\n```html\n<!-- image -->\n<meta property=\"og:image\" content=\"https://···\" />\n<meta name=\"twitter:image\" content=\"https://···\" />\n```\n\n---\n\n```html\n<!-- ua -->\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\" />\n```\n\n---\n\n```html\n<!-- viewport -->\n<meta name=\"viewport\" content=\"width=device-width\" />\n<meta name=\"viewport\" content=\"width=1024\" />\n```\n\n### Open Graph\n\n```html\n<meta property=\"og:type\" content=\"website\" />\n<meta property=\"og:locale\" content=\"en_CA\" />\n<meta property=\"og:title\" content=\"HTML cheatsheet\" />\n<meta property=\"og:url\" content=\"https://cheatsheets.zip/html\" />\n<meta property=\"og:image\" content=\"https://xxx.com/image.jpg\" />\n<meta property=\"og:site_name\" content=\"Name of your website\" />\n<meta property=\"og:description\" content=\"Description of this page\" />\n```\n\nUsed by Facebook, Instagram, Pinterest, LinkedIn, etc.\n\n### Twitter Cards\n\n```html\n<meta name=\"twitter:card\" content=\"summary\" />\n<meta name=\"twitter:site\" content=\"@FechinLi\" />\n<meta name=\"twitter:title\" content=\"HTML cheatsheet\" />\n<meta name=\"twitter:url\" content=\"https://cheatsheets.zip/html\" />\n<meta name=\"twitter:description\" content=\"Description of this page\" />\n<meta name=\"twitter:image\" content=\"https://xxx.com/image.jpg\" />\n```\n\nSee: [Twitter Card Documentation](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/summary)\n\n### Geotagging\n\n```html\n<meta name=\"ICBM\" content=\"45.416667,-75.7\" />\n<meta name=\"geo.position\" content=\"45.416667;-75.7\" />\n<meta name=\"geo.region\" content=\"ca-on\" />\n<meta name=\"geo.placename\" content=\"Ottawa\" />\n```\n\nSee: [Geotagging](https://en.wikipedia.org/wiki/Geotagging#HTML_pages)\n\n## Also see\n\n- [HTML 4.01 Specification](https://www.w3.org/TR/REC-html40/cover.html#minitoc) _(w3.org)_\n"
  },
  {
    "path": "source/_posts/htmx.md",
    "content": "---\ntitle: HTMX\ndate: 2025-06-07 19:30:00\nbackground: bg-[#ff5f4d]\ntags:\n  - frontend\n  - javascript\n  - htmx\ncategories:\n  - Programming\nintro: |\n  A modern, minimal JavaScript library that allows you to create dynamic web interfaces using HTML attributes.\nplugins:\n  - copyCode\n---\n\n## Getting Started {.cols-3}\n\n### CDN Import\n\n```html\n<script src=\"https://unpkg.com/htmx.org@1.9.2\"></script>\n```\n\n### Basic Usage\n\n```html\n<button hx-get=\"/hello\" hx-target=\"#result\">Say Hi</button>\n<div id=\"result\"></div>\n```\n\n### Server Response\n\n```html\n<!-- /hello response -->\n<p>Hello from server</p>\n```\n\n## Core Attributes {.cols-3}\n\n### `hx-get`, `hx-post`, etc.\n\n```html\n<a hx-get=\"/page\">Load Page</a>\n<form hx-post=\"/submit\"></form>\n```\n\n### `hx-target`\n\n```html\n<button hx-get=\"/data\" hx-target=\"#box\"></button>\n<div id=\"box\"></div>\n```\n\n### `hx-trigger`\n\n```html\n<input\n  hx-get=\"/search\"\n  hx-trigger=\"keyup changed delay:300ms\"\n  hx-target=\"#results\"\n/>\n```\n\n## Swap & Out of Band {.cols-3}\n\n### `hx-swap`\n\n```html\n<div hx-get=\"/frag\" hx-swap=\"innerHTML\"></div>\n```\n\n- `outerHTML`\n- `innerHTML`\n- `beforebegin`, `afterbegin`, etc.\n\n### `hx-swap-oob`\n\n```html\n<div hx-swap-oob=\"true\" id=\"msg\"></div>\n```\n\n_Useful for global updates from partials._\n\n### Swap Modifiers\n\n```html\nhx-swap=\"outerHTML transition:true swap:1s\"\n```\n\n## Forms & Events {.cols-3}\n\n### Auto POST on Submit\n\n```html\n<form hx-post=\"/submit\" hx-target=\"#status\">\n  <input name=\"name\" />\n  <button type=\"submit\">Send</button>\n</form>\n<div id=\"status\"></div>\n```\n\n### `hx-include`\n\n```html\n<input id=\"user-id\" name=\"id\" />\n<button hx-post=\"/update\" hx-include=\"#user-id\">Update</button>\n```\n\n### `hx-vals`\n\n```html\n<button hx-post=\"/save\" hx-vals='{\"id\": 42, \"active\": true}'>Save</button>\n```\n\n## Advanced Features {.cols-3}\n\n### Loading Indicator\n\n```html\n<button hx-get=\"/load\" hx-indicator=\"#spinner\">Load</button>\n<div id=\"spinner\" class=\"htmx-indicator\">Loading...</div>\n```\n\n### `hx-push-url`\n\n```html\n<a hx-get=\"/page\" hx-push-url=\"true\">Go</a>\n```\n\n### Polling\n\n```html\n<div hx-get=\"/time\" hx-trigger=\"every 5s\"></div>\n```\n\n## Events & Extensions {.cols-3}\n\n### Listen to Events\n\n```js\ndocument.body.addEventListener('htmx:afterSwap', (e) => {\n  console.log('Swap complete');\n});\n```\n\n### Event Hooks\n\n- `htmx:beforeRequest`\n- `htmx:afterSwap`\n- `htmx:responseError`\n\n### Extensions\n\n```html\n<script src=\"https://unpkg.com/htmx.org/dist/ext/json-enc.js\"></script>\n<form hx-post=\"/api\" hx-ext=\"json-enc\"></form>\n```\n\n## Example Use Case {.cols-2}\n\n### Python Backend (Flask)\n\n```python\n@app.route(\"/hello\")\ndef hello():\n    return \"<p>Hello, HTMX!</p>\"\n```\n\n### HTML Client\n\n```html\n<button hx-get=\"/hello\" hx-target=\"#msg\">Click</button>\n<div id=\"msg\"></div>\n```\n"
  },
  {
    "path": "source/_posts/http-status-code.md",
    "content": "---\ntitle: HTTP Status Code\nbackground: bg-[#3b7dc0]\ndate: 2020-12-26 16:09:09\ntags:\n  - response\n  - server\ncategories:\n  - Other\nintro: |\n  The HTTP status codes cheat sheet. A quick reference to every HTTP status code.\nplugins:\n  - tooltip\n---\n\n## HTTP Status code\n\n### Means\n\n<!-- prettier-ignore -->\n- [1xx: Informational](#1xx-information){data-tooltip=\"It means the request has been received and the process is continuing.\"}\n- [2xx: Success](#2xx-successful){data-tooltip=\"It means the action was successfully received, understood, and accepted.\"}\n- [3xx: Redirection](#3xx-redirection){data-tooltip=\"It means further action must be taken in order to complete the request.\"}\n- [4xx: Client Error](#4xx-client-error){data-tooltip=\"It means the request contains incorrect syntax or cannot be fulfilled.\"}\n- [5xx: Server Error](#5xx-server-error){data-tooltip=\"It means the server failed to fulfill an apparently valid request.\"}\n\n### 2xx. Successful {.row-span-2}\n\n<!-- prettier-ignore -->\n- [200: OK](https://tools.ietf.org/html/rfc7231#section-6.3.1){data-tooltip=\"The request is OK.\"}\n- [201: Created](https://tools.ietf.org/html/rfc7231#section-6.3.2){data-tooltip=\"The request is complete, and a new resource is created.\"}\n- [202: Accepted](https://tools.ietf.org/html/rfc7231#section-6.3.3){data-tooltip=\"The request is accepted for processing, but the processing is not complete.\"}\n- [203: Non-Authoritative Information](https://tools.ietf.org/html/rfc7231#section-6.3.4){data-tooltip=\"The information in the entity header is from a local or third-party copy, not from the original server.\"}\n- [204: No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5){data-tooltip=\"A status code and a header are given in the response, but there is no entity-body in the reply.\"}\n- [205: Reset Content](https://tools.ietf.org/html/rfc7231#section-6.3.6){data-tooltip=\"The browser should clear the form used for this transaction for additional input.\"}\n- [206: Partial Content](https://tools.ietf.org/html/rfc7233#section-4.1){data-tooltip=\"The server is returning partial data of the size requested. Used in response to a request specifying a Range header. The server must specify the range included in the response with the Content-Range header.\"}\n- [207: Multi-Status](https://tools.ietf.org/html/rfc4918#section-11.1){data-tooltip=\"Provides status for multiple independent operations.\"}\n- [208: Already Reported](https://tools.ietf.org/html/rfc5842#section-7.1){data-tooltip=\"Used inside a DAV: propstat response element to avoid enumerating the internal members of multiple bindings to the same collection repeatedly.\"}\n- [226: IM Used](https://tools.ietf.org/html/rfc3229#section-10.4.1){data-tooltip=\"The server has fulfilled a request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.\"}\n\n### 4xx. Client Error {.row-span-3}\n\n<!-- prettier-ignore -->\n- [400: Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1){data-tooltip=\"The server did not understand the request.\"}\n- [401: Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1){data-tooltip=\"The requested page needs a username and a password.\"}\n- [402: Payment Required](https://tools.ietf.org/html/rfc7231#section-6.5.2){data-tooltip=\"You can not use this code yet.\"}\n- [403: Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3){data-tooltip=\"Access is forbidden to the requested page.\"}\n- [404: Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4){data-tooltip=\"The server can not find the requested page.\"}\n- [405: Method Not Allowed](https://tools.ietf.org/html/rfc7231#section-6.5.5){data-tooltip=\"The method specified in the request is not allowed.\"}\n- [406: Not Acceptable](https://tools.ietf.org/html/rfc7231#section-6.5.6){data-tooltip=\"The server can only generate a response that is not accepted by the client.\"}\n- [407: Proxy Authentication Required](https://tools.ietf.org/html/rfc7235#section-3.2){data-tooltip=\"You must authenticate with a proxy server before this request can be served.\"}\n- [408: Request Timeout](https://tools.ietf.org/html/rfc7231#section-6.5.7){data-tooltip=\"The request took longer than the server was prepared to wait.\"}\n- [409: Conflict](https://tools.ietf.org/html/rfc7231#section-6.5.8){data-tooltip=\"The request could not be completed because of a conflict.\"}\n- [410: Gone](https://tools.ietf.org/html/rfc7231#section-6.5.9){data-tooltip=\"The requested page is no longer available.\"}\n- [411: Length Required](https://tools.ietf.org/html/rfc7231#section-6.5.10){data-tooltip=\"The \"Content-Length\" is not defined. The server will not accept the request without it.\"}\n- [412: Precondition Failed](https://tools.ietf.org/html/rfc7232#section-4.2){data-tooltip=\"The pre condition given in the request evaluated to false by the server.\"}\n- [413: Payload Too Large](https://tools.ietf.org/html/rfc7231#section-6.5.11){data-tooltip=\"The server will not accept the request, because the request entity is too large.\"}\n- [414: URI Too Long](https://tools.ietf.org/html/rfc7231#section-6.5.12){data-tooltip=\"The server will not accept the request, because the URL is too long. Occurs when you convert a \"post\" request to a \"get\" request with a long query information.\"}\n- [415: Unsupported Media Type](https://tools.ietf.org/html/rfc7231#section-6.5.13){data-tooltip=\"The server will not accept the request, because the media type is not supported.\"}\n- [416: Range Not Satisfiable](https://tools.ietf.org/html/rfc7233#section-4.4){data-tooltip=\"The requested byte range is not available and is out of bounds.\"}\n- [417: Expectation Failed](https://tools.ietf.org/html/rfc7231#section-6.5.14){data-tooltip=\"The expectation given in an Expect request-header field could not be met by this server.\"}\n- [421: Misdirected Request](https://tools.ietf.org/html/rfc7540#section-9.1.2){data-tooltip=\"The request was directed at a server that is not able to produce a response.\"}\n- [426: Upgrade Required](https://tools.ietf.org/html/rfc7231#section-6.5.15){data-tooltip=\"The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol.\"}\n- [428: Precondition Required](https://tools.ietf.org/html/rfc6585#section-3){data-tooltip=\"The origin server requires the request to be conditional.\"}\n- [429: Too Many Requests](https://tools.ietf.org/html/rfc6585#section-4){data-tooltip=\"The user has sent too many requests in a given amount of time.\"}\n- [431: Request Header Fields Too Large](https://tools.ietf.org/html/rfc6585#section-5){data-tooltip=\"The server is unwilling to process the request because its header fields are too large.\"}\n- [451: Unavailable For Legal Reasons](https://datatracker.ietf.org/doc/html/rfc7725#section-3){data-tooltip=\"This status code indicates that the server is denying access to the resource as a consequence of a legal demand.\"}\n\n### 1xx. Information\n\n<!-- prettier-ignore -->\n- [100: Continue](https://tools.ietf.org/html/rfc7231#section-6.2.1){data-tooltip=\"Only a part of the request has been received by the server, but as long as it has not been rejected, the client should continue with the request.\"}\n- [101: Switching Protocols](https://tools.ietf.org/html/rfc7231#section-6.2.2){data-tooltip=\"The server switches protocol.\"}\n- [102: Processing](https://tools.ietf.org/html/rfc2518#section-10.1){data-tooltip=\"An interim response used to inform the client that the server has accepted the complete request, but has not yet completed it.\"}\n- [103: Early Hints](https://tools.ietf.org/html/rfc8297){data-tooltip=\"Indicates to the client that the server is likely to send a final response with the header fields included in the informational response.\"}\n\n### 3xx. Redirection\n\n<!-- prettier-ignore -->\n- [300: Multiple Choices](https://tools.ietf.org/html/rfc7231#section-6.4.1){data-tooltip=\"A link list. The user can select a link and go to that location. Maximum five addresses.\"}\n- [301: Moved Permanently](https://tools.ietf.org/html/rfc7231#section-6.4.2){data-tooltip=\"The requested page has moved to a new URL.\"}\n- [302: Found](https://tools.ietf.org/html/rfc7231#section-6.4.3){data-tooltip=\"The requested page has moved temporarily to a new URL.\"}\n- [303: See Other](https://tools.ietf.org/html/rfc7231#section-6.4.4){data-tooltip=\"The requested page can be found under a different URL.\"}\n- [304: Not Modified](https://tools.ietf.org/html/rfc7232#section-4.1){data-tooltip=\"This is the response code to an If-Modified-Since or If-None-Match header, where the URL has not been modified since the specified date.\"}\n- [305: Use Proxy](https://tools.ietf.org/html/rfc7231#section-6.4.5){data-tooltip=\"The requested URL must be accessed through the proxy mentioned in the Location header.\"}\n- [306: Unused](https://tools.ietf.org/html/rfc7231#section-6.4.6){data-tooltip=\"This code was used in a previous version. It is no longer used, but the code is reserved.\"}\n- [307: Temporary Redirect](https://tools.ietf.org/html/rfc7231#section-6.4.7){data-tooltip=\"The requested page has moved temporarily to a new URL.\"}\n- [308: Permanent Redirect](https://tools.ietf.org/html/rfc7538#section-3){data-tooltip=\"The request and all future requests should be repeated using another URI.\"}\n\n### 5xx. Server Error\n\n<!-- prettier-ignore -->\n- [500: Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1){data-tooltip=\"The request was not completed. The server met an unexpected condition.\"}\n- [501: Not Implemented](https://tools.ietf.org/html/rfc7231#section-6.6.2){data-tooltip=\"The request was not completed. The server did not support the functionality required.\"}\n- [502: Bad Gateway](https://tools.ietf.org/html/rfc7231#section-6.6.3){data-tooltip=\"The request was not completed. The server received an invalid response from the upstream server.\"}\n- [503: Service Unavailable](https://tools.ietf.org/html/rfc7231#section-6.6.4){data-tooltip=\"The request was not completed. The server is temporarily overloading or down.\"}\n- [504: Gateway Timeout](https://tools.ietf.org/html/rfc7231#section-6.6.5){data-tooltip=\"The gateway has timed out.\"}\n- [505: HTTP Version Not Supported](https://tools.ietf.org/html/rfc7231#section-6.6.6){data-tooltip=\"The server does not support the \"http protocol\" version.\"}\n- [506: Variant Also Negotiates](https://tools.ietf.org/html/rfc2295#section-8.1){data-tooltip=\"Transparent content negotiation for the request results in a circular reference.\"}\n- [507: Insufficient Storage](https://tools.ietf.org/html/rfc4918#section-11.5){data-tooltip=\"The server is unable to store the representation needed to complete the request.\"}\n- [508: Loop Detected](https://tools.ietf.org/html/rfc5842#section-7.2){data-tooltip=\"The server detected an infinite loop while processing the request.\"}\n- [510: Not Extended](https://tools.ietf.org/html/rfc2774#section-7){data-tooltip=\"Further extensions to the request are required for the server to fulfill it.\"}\n- [511: Network Authentication Required](https://tools.ietf.org/html/rfc6585#section-6){data-tooltip=\"The client needs to authenticate to gain network access.\"}\n"
  },
  {
    "path": "source/_posts/idea.md",
    "content": "---\ntitle: IntelliJ IDEA\ndate: 2020-12-17 21:51:44\nbackground: bg-gradient-to-r from-pink-500 via-violet-400 to-blue-400 hover:from-pink-700 hover:via-violet-600 hover:to-blue-500\ntags:\n  - jetbrains\n  - java\n  - shortcut\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  IntelliJ IDEA is a very good Java IDE, most of its commands have shortcuts to keep your hands from leaving the keyboard\n---\n\n## IDEA Windows & Linux Keymap\n\n### Editing {.row-span-5}\n\n| shortcut                   | description                                      |\n| -------------------------- | :----------------------------------------------- |\n| `Ctrl` `Space`             | Basic code completion                            |\n| `Ctrl` `Shift` `Space`     | Smart code completion                            |\n| `Ctrl` `Shift` `Enter`     | Complete statement                               |\n| `Ctrl` `P`                 | Parameter info                                   |\n| `Ctrl` `Q`                 | Quick documentation lookup                       |\n| `Shift` `F1`               | External Doc                                     |\n| `Ctrl` `hover`             | Brief Info                                       |\n| `Ctrl` `F1`                | Error or warning at caret                        |\n| `Alt` `Insert`             | Generate code                                    |\n| `Ctrl` `O`                 | Override methods                                 |\n| `Ctrl` `I`                 | Implement methods                                |\n| `Ctrl` `Alt` `T`           | Surround with                                    |\n| `Ctrl` `/`                 | Comment or uncomment line                        |\n| `Ctrl` `Shift` `/`         | Comment or uncomment block                       |\n| `Ctrl` `W`                 | Select successively increasing code blocks       |\n| `Ctrl` `Shift` `W`         | Decrease current selection to previous state     |\n| `Alt` `Q`                  | Context info                                     |\n| `Alt` `Enter`              | Show intention actions and quick-fixes           |\n| `Ctrl` `Alt` `L`           | Reformat code                                    |\n| `Ctrl` `Alt` `O`           | Optimize imports                                 |\n| `Ctrl` `Alt` `I`           | Auto-indent line(s)                              |\n| `Tab`                      | Indent selected lines                            |\n| `Shift` `Tab`              | Unindent selected lines                          |\n| `Ctrl` `X`                 | Cut current line or selected block to clipboard  |\n| `Ctrl` `C`                 | Copy current line or selected block to clipboard |\n| `Ctrl` `V`                 | Paste from clipboard                             |\n| `Ctrl` `Shift` `V`         | Paste from recent buffers                        |\n| `Ctrl` `D`                 | Duplicate current line or selected block         |\n| `Ctrl` `Y`                 | Delete line at caret                             |\n| `Ctrl` `Shift` `J`         | Smart line join                                  |\n| `Ctrl` `Enter`             | Smart line split                                 |\n| `Shift` `Enter`            | Start new line                                   |\n| `Ctrl` `Shift` `U`         | Toggle case for word at caret or selected block  |\n| `Ctrl` `Shift` `]` _/_ `[` | Select till code block end/start                 |\n| `Ctrl` `Backspace`         | Delete to word end/start                         |\n| `Ctrl` `+` _/_ `-`         | Expand/collapse code block                       |\n| `Ctrl` `Shift` `+`         | Expand all                                       |\n| `Ctrl` `Shift` `-`         | Collapse all                                     |\n| `Ctrl` `F4`                | Close active editor tab                          |\n\n{.shortcuts}\n\n### Usage Search\n\n| shortcut                   | description                     |\n| -------------------------- | :------------------------------ |\n| `Alt` `F7` _/_ `Ctrl` `F7` | Find usages/Find usages in file |\n| `Ctrl` `Shift` `F7`        | Highlight usages in file        |\n| `Ctrl` `Alt` `F7`          | Show usages                     |\n\n{.shortcuts}\n\n### Navigation {.row-span-4}\n\n| shortcut                        | description                               |\n| ------------------------------- | :---------------------------------------- |\n| `Ctrl` `N`                      | Go to class                               |\n| `Ctrl` `Shift` `N`              | Go to file                                |\n| `Ctrl` `Alt` `Shift` `N`        | Go to symbol                              |\n| `Alt` `Right` _/_ `Left`        | Go to next / previous editor tab          |\n| `F12`                           | Go back to previous tool window           |\n| `Esc`                           | Go to editor                              |\n| `Shift` `Esc`                   | Hide active or last active window         |\n| `Ctrl` `Shift` `F4`             | Close active run, messages...             |\n| `Ctrl` `G`                      | Go to line                                |\n| `Ctrl` `E`                      | Recent files popup                        |\n| `Ctrl` `Alt` `Left` _/_ `Right` | Navigate back / forward                   |\n| `Ctrl` `Shift` `Backspace`      | Navigate to last edit location            |\n| `Alt` `F1`                      | Select current file or symbol in any view |\n| `Ctrl` `B` _/_ `Ctrl` `Click`   | Go to declaration                         |\n| `Ctrl` `Alt` `B`                | Go to implementation(s)                   |\n| `Ctrl` `Shift` `I`              | Open quick definition lookup              |\n| `Ctrl` `Shift` `B`              | Go to type declaration                    |\n| `Ctrl` `U`                      | Go to super-method / super-class          |\n| `Alt` `Up` _/_ `Down`           | Go to previous / next method              |\n| `Ctrl` `]/[`                    | Move to code block end/start              |\n| `Ctrl` `F12`                    | File structure popup                      |\n| `Ctrl` `H`                      | Type hierarchy                            |\n| `Ctrl` `Shift` `H`              | Method hierarchy                          |\n| `Ctrl` `Alt` `H`                | Call hierarchy                            |\n| `F2` _/_ `Shift` `F2`           | Next/previous highlighted error           |\n| `F4` _/_ `Ctrl` `Enter`         | Edit source / View source                 |\n| `Alt` `Home`                    | Show navigation bar                       |\n| `F11`                           | Toggle bookmark                           |\n| `Ctrl` `F11`                    | Toggle bookmark with mnemonic             |\n| `Ctrl` `0...9`                  | Go to numbered bookmark                   |\n| `Shift` `F11`                   | Show bookmarks                            |\n\n{.shortcuts}\n\n### Search/Replace\n\n| shortcut           | description               |\n| ------------------ | :------------------------ |\n| `Double Shift`     | Search everywhere         |\n| `Ctrl` `F`         | Find                      |\n| `F3` `Shift` `F3`  | Find next / Find previous |\n| `Ctrl` `R`         | Replace                   |\n| `Ctrl` `Shift` `F` | Find in path              |\n| `Ctrl` `Shift` `R` | Replace in path           |\n\n{.shortcuts}\n\n### Live Templates\n\n| shortcut         | description                                       |\n| ---------------- | :------------------------------------------------ |\n| `Ctrl` `Alt` `J` | Surround with Live Template                       |\n| `Ctrl` `J`       | Insert Live Template                              |\n| `iter`           | Iteration according to Java SDK 1.5 style         |\n| `inst`           | Check object type with instanceof and downcast it |\n| `itco`           | Iterate elements of java.util.Collection          |\n| `itit`           | Iterate elements of java.util.Iterator            |\n| `itli`           | Iterate elements of java.util.List                |\n| `psf`            | public static final                               |\n| `thr`            | throw new                                         |\n\n{.shortcuts}\n\n### Refactoring\n\n| shortcut         | description       |\n| ---------------- | :---------------- |\n| `F5`             | Copy              |\n| `F6`             | Move              |\n| `Alt` `Delete`   | Safe Delete       |\n| `Shift` `F6`     | Rename            |\n| `Ctrl` `F6`      | Change Signature  |\n| `Ctrl` `Alt` `N` | Inline            |\n| `Ctrl` `Alt` `M` | Extract Method    |\n| `Ctrl` `Alt` `V` | Extract Variable  |\n| `Ctrl` `Alt` `F` | Extract Field     |\n| `Ctrl` `Alt` `C` | Extract Constant  |\n| `Ctrl` `Alt` `P` | Extract Parameter |\n\n{.shortcuts}\n\n### Debugging\n\n| shortcut                      | description              |\n| ----------------------------- | :----------------------- |\n| `F8/F7`                       | Step over/Step into      |\n| `Shift` `F7` _/_ `Shift` `F8` | Smart step into/Step out |\n| `Alt` `F9`                    | Run to cursor            |\n| `Alt` `F8`                    | Evaluate expression      |\n| `F9`                          | Resume program           |\n| `Ctrl` `F8`                   | Toggle breakpoint        |\n| `Ctrl` `Shift` `F8`           | View breakpoints         |\n\n{.shortcuts}\n\n### Compile and Run\n\n| shortcut                     | description                              |\n| ---------------------------- | :--------------------------------------- |\n| `Ctrl` `F9`                  | Make project                             |\n| `Ctrl` `Shift` `F9`          | Compile selected file, package or module |\n| `Alt` `Shift` `F10` _/_ `F9` | Select configuration and run/and debug   |\n| `Shift` `F10` _/_ `F9`       | Run/Debug                                |\n| `Ctrl` `Shift` `F10`         | Run context configuration from editor    |\n\n{.shortcuts}\n\n### VCS/Local History\n\n| shortcut            | description           |\n| ------------------- | :-------------------- |\n| `Ctrl` `K`          | Commit project to VCS |\n| `Ctrl` `T`          | Update from VCS       |\n| `Alt` `Shift` `C`   | View recent changes   |\n| `Alt` <kbd>\\`</kbd> | VCS Operations Popup  |\n\n{.shortcuts}\n\n### General\n\n| shortcut                 | description                    |\n| ------------------------ | :----------------------------- |\n| `Alt` `0...9`            | Open corresponding tool window |\n| `Ctrl` `S`               | Save all                       |\n| `Ctrl` `Alt` `Y`         | Synchronize                    |\n| `Ctrl` `Shift` `F12`     | Toggle maximizing editor       |\n| `Alt` `Shift` `F`        | Add to Favorites               |\n| `Alt` `Shift` `I`        | Inspect current file           |\n| `Ctrl` <kbd>\\`</kbd>     | Quick switch current scheme    |\n| `Ctrl` `Alt` `S`         | Open Settings dialog           |\n| `Ctrl` `Alt` `Shift` `S` | Open Project Structure dialog  |\n| `Ctrl` `Shift` `A`       | Find Action                    |\n| `Ctrl` `Tab`             | Switch between tool and tabs   |\n\n{.shortcuts}\n"
  },
  {
    "path": "source/_posts/ini.md",
    "content": "---\ntitle: INI\ndate: 2022-12-30 09:51:44\nbackground: bg-[#6d94c7]\ntags:\ncategories:\n  - Programming\nintro: |\n  This is a quick reference cheat sheet for understanding and writing INI-format configuration files.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Introduction\n\n- INI is a configuration file with a fixed standard format\n- Base elements are keys or properties\n- Each key consists of a **name** and a **value**, separated by an equal sign (`=`)\n- **key name** is displayed to the **left side** of the equals sign\n- Equal sign (`=`) and semicolon (`;`) are **reserved** characters\n- INI configuration method comes from the MS-DOS operating system\n\nNow an informal standard for many configurations, other operating systems may use `.conf` or `.cfg` as a suffix\n\n### Example\n\n```ini\n; Here are the comments\n[owner]\nname=John Doe\norganization=Acme Products\n\n[database]\n; Here are the comments\nserver=192.0.2.42\nport=143\nfile=\"acme payroll.dat\"\n\n[section.subsection]\nfoo = bar\n```\n\n### Comments\n\nComment (`;`)\n\n```ini\n; This is the comment text and will be ignored\n```\n\nComment (`#`)\n\n```ini\n# Here is the comment text, ⚠️ Some compilers support it\n```\n\nComments after a line (`;`,`#`) _(not standard)_\n\n```ini\nvar = a ; this is an inline comment\nfoo = bar # this is another inline comment\n```\n\nComments must appear alone on lines in some cases\n\n### Sections\n\n- The name appears on a line by itself\n- Names are enclosed in square brackets `[` and `]`\n- No explicit `section end` delimiter\n- End at the next `section` declaration or at the end of the file\n- Section and attribute names are case insensitive\n<!--rehype:className=style-round-->\n\n```ini\n[section]\nkey1 = a\nkey2 = b\n```\n\nThe same as `JSON` below 👇\n\n```json\n{\n  \"section\": {\n    \"key1\": \"a\",\n    \"key2\": \"b\"\n  }\n}\n```\n\n### Nesting (supported by some parsers)\n\n```ini\n[section]\ndomain = cheatsheets.zip\n[section.subsection]\nfoo = bar\n```\n\nThe same as `JSON` below 👇\n\n```json\n{\n  \"section\": {\n    \"domain\": \"cheatsheets.zip\"\n    \"subsection\": {\n      \"foo\": \"bar\"\n    }\n  }\n}\n```\n\nNest to previous section (shorthand)\n\n```ini\n[section]\ndomain = cheatsheets.zip\n[.subsection]\nfoo = bar\n```\n\n### Escape character\n\n| sequence | meaning                                                                                          |\n| :------- | :----------------------------------------------------------------------------------------------- |\n| `\\\\`     | \\ (single backslash, escape escape character)                                                    |\n| `\\'`     | apostrophe                                                                                       |\n| `\\\"`     | double quotes                                                                                    |\n| `\\0`     | null character                                                                                   |\n| `\\a`     | ringtone/alert/sound                                                                             |\n| `\\b`     | Backspace, [Bell character] for some applications (https://en.wikipedia.org/wiki/Bell_character) |\n| `\\t`     | tab character                                                                                    |\n| `\\r`     | carriage return                                                                                  |\n| `\\n`     | newline                                                                                          |\n| `\\;`     | semicolon                                                                                        |\n| `\\#`     | number sign                                                                                      |\n| `\\=`     | equal sign                                                                                       |\n| `\\:`     | colon                                                                                            |\n| `\\x????` | Unicode character for the hexadecimal code point corresponding to ????                           |\n\n### Array\n\n```ini\n[section]\ndomain = cheatsheets.zip\narray[]=first value\narray[]=second value\n```\n\nThe same as `JSON` below 👇\n\n```json\n{\n  \"section\": {\n    \"domain\": \"cheatsheets.zip\",\n    \"array\": [\"first value\", \"second value\"]\n  }\n}\n```\n\n### Interpreter\n\n- [@go-ini/ini](https://github.com/go-ini/ini) _(golang)_\n- [@npm/ini](https://www.npmjs.com/package/ini) _(nodejs)_\n- [@zonyitoo/rust-ini](https://github.com/zonyitoo/rust-inii) _(rust)_\n- [@rxi/ini](https://www.npmjs.com/package/ini) _(c)_\n- [@pulzed/mINI](https://github.com/pulzed/mINI) _(c++)_\n- [@rickyah/ini-parser](https://github.com/rickyah/ini-parser) _(c#)_\n- [@Enichan/Ini](https://github.com/Enichan/Ini) _(c#)_\n\n## See also\n\n- [INI file configuration](https://en.wikipedia.org/wiki/INI_file)_(wikipedia.org)_\n"
  },
  {
    "path": "source/_posts/iso-639-1.md",
    "content": "---\ntitle: ISO 639-1 Language Code\ndate: 2022-01-11 17:21:54\ntags:\n  - code\n  - i18n\n  - language\ncategories:\n  - Other\nintro: |\n  This is a list of the ISO language codes that conform to the ISO 639-1 standard, it provide reference for multi-language website.\n---\n\n## Getting Started {.cols-2}\n\n### Introduction\n\n- The [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) is a standardized nomenclature used to classify languages\n- The ISO 639-1 codes cover the world's major languages\n- These codes are a useful international and formal shorthand for indicating languages\n- Two-letter codes\n- Used to multilingual websites, aka Internationalization (`i18n`)\n- [i18n](https://en.wikipedia.org/wiki/Internationalization_and_localization) language codes\n\n{.marker-round}\n\n### Multi-format of 639-1 codes\n\n- [Markdown Table](https://tableconvert.com/html-to-markdown?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [Template](https://tableconvert.com/html-to-template?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [LaTeX Table](https://tableconvert.com/html-to-latex?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [CSV](https://tableconvert.com/html-to-csv?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [Excel](https://tableconvert.com/html-to-excel?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [JSON Array](https://tableconvert.com/html-to-json?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [HTML Table](https://tableconvert.com/html-to-html?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [Insert SQL](https://tableconvert.com/html-to-sql?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [YAML Sequence](https://tableconvert.com/html-to-yaml?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [XML](https://tableconvert.com/html-to-xml?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [ASCII](https://tableconvert.com/html-to-ascii?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [MediaWiki Table](https://tableconvert.com/html-to-mediawiki?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [AsciiDoc Table](https://tableconvert.com/html-to-asciidoc?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [Jira Table](https://tableconvert.com/html-to-jira?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [Textile Table](https://tableconvert.com/html-to-textile?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [reStructuredText](https://tableconvert.com/html-to-restructuredtext?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [PHP Array](https://tableconvert.com/html-to-php?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [Ruby Array](https://tableconvert.com/html-to-ruby?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [ASP Array](https://tableconvert.com/html-to-asp?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [ActionScript](https://tableconvert.com/html-to-actionscript?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [BBCode](https://tableconvert.com/html-to-bbcode?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [PDF](https://tableconvert.com/html-to-pdf?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n- [JPEG](https://tableconvert.com/html-to-jpeg?data=https://cheatsheets.zip/iso-639-1#TableGenerator)\n\n{.cols-4 .marker-none}\n\n## List of ISO 639-1 codes {.cols-1}\n\n### Full codes\n\n| 639-1 code | ISO language name   | Native name (endonym) |\n| ---------- | ------------------- | :-------------------- |\n| `aa`       | Afar                | Afaraf                |\n| `ab`       | Abkhaz              | аҧсуа бызшәа          |\n| `ae`       | Avestan             | avesta                |\n| `af`       | Afrikaans           | Afrikaans             |\n| `ak`       | Akan                | Akan                  |\n| `am`       | Amharic             | አማርኛ                  |\n| `an`       | Aragonese           | aragonés              |\n| `ar`       | Arabic              | اللغة العربية         |\n| `as`       | Assamese            | অসমীয়া               |\n| `av`       | Avaric              | авар мацӀ             |\n| `ay`       | Aymara              | aymar aru             |\n| `az`       | Azerbaijani         | azərbaycan dili       |\n| `ba`       | Bashkir             | башҡорт теле          |\n| `be`       | Belarusian          | беларуская мова       |\n| `bg`       | Bulgarian           | български език        |\n| `bh`       | Bihari              | भोजपुरी               |\n| `bi`       | Bislama             | Bislama               |\n| `bm`       | Bambara             | bamanankan            |\n| `bn`       | Bengali             | বাংলা                 |\n| `bo`       | Tibetan             | བོད་ཡིག               |\n| `br`       | Breton              | brezhoneg             |\n| `bs`       | Bosnian             | bosanski jezik        |\n| `ca`       | Catalan             | Català                |\n| `ce`       | Chechen             | нохчийн мотт          |\n| `ch`       | Chamorro            | Chamoru               |\n| `co`       | Corsican            | corsu                 |\n| `cr`       | Cree                | ᓀᐦᐃᔭᐍᐏᐣ               |\n| `cs`       | Czech               | čeština               |\n| `cu`       | Old Church Slavonic | ѩзыкъ словѣньскъ      |\n| `cv`       | Chuvash             | чӑваш чӗлхи           |\n| `cy`       | Welsh               | Cymraeg               |\n| `da`       | Danish              | dansk                 |\n| `de`       | German              | Deutsch               |\n| `dv`       | Divehi              | Dhivehi               |\n| `dz`       | Dzongkha            | རྫོང་ཁ                |\n| `ee`       | Ewe                 | Eʋegbe                |\n| `el`       | Greek               | Ελληνικά              |\n| `en`       | English             | English               |\n| `eo`       | Esperanto           | Esperanto             |\n| `es`       | Spanish             | Español               |\n| `et`       | Estonian            | eesti                 |\n| `eu`       | Basque              | euskara               |\n| `fa`       | Persian             | فارسی                 |\n| `ff`       | Fula                | Fulfulde              |\n| `fi`       | Finnish             | suomi                 |\n| `fj`       | Fijian              | Vakaviti              |\n| `fo`       | Faroese             | føroyskt              |\n| `fr`       | French              | Français              |\n| `fy`       | Western Frisian     | Frysk                 |\n| `ga`       | Irish               | Gaeilge               |\n| `gd`       | Scottish Gaelic     | Gàidhlig              |\n| `gl`       | Galician            | galego                |\n| `gu`       | Gujarati            | ગુજરાતી               |\n| `gv`       | Manx                | Gaelg                 |\n| `ha`       | Hausa               | هَوُسَ                |\n| `he`       | Hebrew              | עברית                 |\n| `hi`       | Hindi               | हिन्दी                |\n| `ho`       | Hiri Motu           | Hiri Motu             |\n| `hr`       | Croatian            | Hrvatski              |\n| `ht`       | Haitian             | Kreyòl ayisyen        |\n| `hu`       | Hungarian           | magyar                |\n| `hy`       | Armenian            | Հայերեն               |\n| `hz`       | Herero              | Otjiherero            |\n| `ia`       | Interlingua         | Interlingua           |\n| `id`       | Indonesian          | Bahasa Indonesia      |\n| `ie`       | Interlingue         | Interlingue           |\n| `ig`       | Igbo                | Asụsụ Igbo            |\n| `ii`       | Nuosu               | ꆈꌠ꒿ Nuosuhxop      |\n| `ik`       | Inupiaq             | Iñupiaq               |\n| `io`       | Ido                 | Ido                   |\n| `is`       | Icelandic           | Íslenska              |\n| `it`       | Italian             | Italiano              |\n| `iu`       | Inuktitut           | ᐃᓄᒃᑎᑐᑦ                |\n| `ja`       | Japanese            | 日本語                |\n| `jv`       | Javanese            | basa Jawa             |\n| `ka`       | Georgian            | ქართული               |\n| `kg`       | Kongo               | Kikongo               |\n| `ki`       | Kikuyu              | Gĩkũyũ                |\n| `kj`       | Kwanyama            | Kuanyama              |\n| `kk`       | Kazakh              | қазақ тілі            |\n| `kl`       | Kalaallisut         | kalaallisut           |\n| `km`       | Khmer               | ខេមរភាសា              |\n| `kn`       | Kannada             | ಕನ್ನಡ                 |\n| `ko`       | Korean              | 한국어                |\n| `kr`       | Kanuri              | Kanuri                |\n| `ks`       | Kashmiri            | कश्मीरी               |\n| `ku`       | Kurdish             | Kurdî                 |\n| `kv`       | Komi                | коми кыв              |\n| `kw`       | Cornish             | Kernewek              |\n| `ky`       | Kyrgyz              | Кыргызча              |\n| `la`       | Latin               | latine                |\n| `lb`       | Luxembourgish       | Lëtzebuergesch        |\n| `lg`       | Ganda               | Luganda               |\n| `li`       | Limburgish          | Limburgs              |\n| `ln`       | Lingala             | Lingála               |\n| `lo`       | Lao                 | ພາສາ                  |\n| `lt`       | Lithuanian          | lietuvių kalba        |\n| `lu`       | Luba-Katanga        | Tshiluba              |\n| `lv`       | Latvian             | latviešu valoda       |\n| `mg`       | Malagasy            | fiteny malagasy       |\n| `mh`       | Marshallese         | Kajin M̧ajeļ           |\n| `mi`       | Māori               | te reo Māori          |\n| `mk`       | Macedonian          | македонски јазик      |\n| `ml`       | Malayalam           | മലയാളം                |\n| `mn`       | Mongolian           | Монгол хэл            |\n| `mr`       | Marathi             | मराठी                 |\n| `ms`       | Malay               | Bahasa Malaysia       |\n| `mt`       | Maltese             | Malti                 |\n| `my`       | Burmese             | ဗမာစာ                 |\n| `na`       | Nauru               | Ekakairũ Naoero       |\n| `nb`       | Norwegian Bokmål    | Norsk bokmål          |\n| `nd`       | Northern Ndebele    | isiNdebele            |\n| `ne`       | Nepali              | नेपाली                |\n| `ng`       | Ndonga              | Owambo                |\n| `nl`       | Dutch               | Nederlands            |\n| `nn`       | Norwegian Nynorsk   | Norsk nynorsk         |\n| `no`       | Norwegian           | Norsk                 |\n| `nr`       | Southern Ndebele    | isiNdebele            |\n| `nv`       | Navajo              | Diné bizaad           |\n| `ny`       | Chichewa            | chiCheŵa              |\n| `oc`       | Occitan             | occitan               |\n| `oj`       | Ojibwe              | ᐊᓂᔑᓈᐯᒧᐎᓐ              |\n| `om`       | Oromo               | Afaan Oromoo          |\n| `or`       | Oriya               | ଓଡ଼ିଆ                 |\n| `os`       | Ossetian            | ирон æвзаг            |\n| `pa`       | Panjabi             | ਪੰਜਾਬੀ                |\n| `pi`       | Pāli                | पाऴि                  |\n| `pl`       | Polish              | Polski                |\n| `ps`       | Pashto              | پښتو                  |\n| `pt`       | Portuguese          | Português             |\n| `qu`       | Quechua             | Runa Simi             |\n| `rm`       | Romansh             | rumantsch grischun    |\n| `rn`       | Kirundi             | Ikirundi              |\n| `ro`       | Romanian            | Română                |\n| `ru`       | Russian             | Русский               |\n| `rw`       | Kinyarwanda         | Ikinyarwanda          |\n| `sa`       | Sanskrit            | संस्कृतम्             |\n| `sc`       | Sardinian           | sardu                 |\n| `sd`       | Sindhi              | सिन्धी                |\n| `se`       | Northern Sami       | Davvisámegiella       |\n| `sg`       | Sango               | yângâ tî sängö        |\n| `si`       | Sinhala             | සිංහල                 |\n| `sk`       | Slovak              | slovenčina            |\n| `sl`       | Slovenian           | slovenščina           |\n| `sn`       | Shona               | chiShona              |\n| `so`       | Somali              | Soomaaliga            |\n| `sq`       | Albanian            | Shqip                 |\n| `sr`       | Serbian             | српски језик          |\n| `ss`       | Swati               | SiSwati               |\n| `st`       | Southern Sotho      | Sesotho               |\n| `su`       | Sundanese           | Basa Sunda            |\n| `sv`       | Swedish             | Svenska               |\n| `sw`       | Swahili             | Kiswahili             |\n| `ta`       | Tamil               | தமிழ்                 |\n| `te`       | Telugu              | తెలుగు                |\n| `tg`       | Tajik               | тоҷикӣ                |\n| `th`       | Thai                | ไทย                   |\n| `ti`       | Tigrinya            | ትግርኛ                  |\n| `tk`       | Turkmen             | Türkmen               |\n| `tl`       | Tagalog             | Wikang Tagalog        |\n| `tn`       | Tswana              | Setswana              |\n| `to`       | Tonga               | faka Tonga            |\n| `tr`       | Turkish             | Türkçe                |\n| `ts`       | Tsonga              | Xitsonga              |\n| `tt`       | Tatar               | татар теле            |\n| `tw`       | Twi                 | Twi                   |\n| `ty`       | Tahitian            | Reo Tahiti            |\n| `ug`       | Uyghur              | ئۇيغۇرچە‎             |\n| `uk`       | Ukrainian           | Українська            |\n| `ur`       | Urdu                | اردو                  |\n| `uz`       | Uzbek               | Ўзбек                 |\n| `ve`       | Venda               | Tshivenḓa             |\n| `vi`       | Vietnamese          | Tiếng Việt            |\n| `vo`       | Volapük             | Volapük               |\n| `wa`       | Walloon             | walon                 |\n| `wo`       | Wolof               | Wollof                |\n| `xh`       | Xhosa               | isiXhosa              |\n| `yi`       | Yiddish             | ייִדיש                |\n| `yo`       | Yoruba              | Yorùbá                |\n| `za`       | Zhuang              | Saɯ cueŋƅ             |\n| `zh`       | Chinese             | 中文                  |\n| `zu`       | Zulu                | isiZulu               |\n\n{.show-header}\n"
  },
  {
    "path": "source/_posts/java.md",
    "content": "---\ntitle: Java\ndate: 2021-03-10 19:50:01\nbackground: bg-[#d33731]\ntags:\n  - object-oriented\n  - class\ncategories:\n  - Programming\nintro: |\n  This cheat sheet is a crash course for Java beginners and help review the basic syntax of the Java language.\nplugins:\n  - tooltip\n  - copyCode\n---\n\n## Getting Started\n\n### Hello.java {.row-span-2}\n\n```java\npublic class Hello {\n  // main method\n  public static void main(String[] args)\n  {\n    // Output: Hello, world!\n    System.out.println(\"Hello, world!\");\n  }\n}\n```\n\nCompiling and running\n\n```bash\n$ javac Hello.java\n$ java Hello\nHello, world!\n```\n\n### Variables\n\n```java\nint num = 5;\nfloat floatNum = 5.99f;\nchar letter = 'D';\nboolean bool = true;\nString site = \"cheatsheets.zip\";\n```\n\n### Primitive Data Types {.row-span-2}\n\n| Data Type | Size   | Default | Range               |\n| --------- | ------ | ------- | :------------------ |\n| `byte`    | 1 byte | 0       | -128 ^to^ 127       |\n| `short`   | 2 byte | 0       | -2^15^ ^to^ 2^15^-1 |\n| `int`     | 4 byte | 0       | -2^31^ ^to^ 2^31^-1 |\n| `long`    | 8 byte | 0       | -2^63^ ^to^ 2^63^-1 |\n| `float`   | 4 byte | 0.0f    | _N/A_               |\n| `double`  | 8 byte | 0.0d    | _N/A_               |\n| `char`    | 2 byte | \\\\u0000 | 0 ^to^ 65535        |\n| `boolean` | _N/A_  | false   | true / false        |\n\n{.show-header}\n\n### Strings\n\n```java\nString first = \"John\";\nString last = \"Doe\";\nString name = first + \" \" + last;\nSystem.out.println(name);\n```\n\nSee: [Strings](#java-strings)\n\n### Loops\n\n```java\nString word = \"CheatSheets\";\nfor (char c: word.toCharArray()) {\n  System.out.print(c + \"-\");\n}\n// Outputs: C-h-e-a-t-S-h-e-e-t-s-\n```\n\nSee: [Loops](#java-loops)\n\n### Arrays\n\n```java\nchar[] chars = new char[10];\nchars[0] = 'a'\nchars[1] = 'b'\n\nString[] letters = {\"A\", \"B\", \"C\"};\nint[] mylist = {100, 200};\nboolean[] answers = {true, false};\n```\n\nSee: [Arrays](#java-arrays)\n\n### Swap\n\n```java\nint a = 1;\nint b = 2;\nSystem.out.println(a + \" \" + b); // 1 2\n\nint temp = a;\na = b;\nb = temp;\nSystem.out.println(a + \" \" + b); // 2 1\n```\n\n### Type Casting\n\n```java\n// Widening\n// byte<short<int<long<float<double\nint i = 10;\nlong l = i;               // 10\n\n// Narrowing\ndouble d = 10.02;\nlong l = (long)d;         // 10\n\nString.valueOf(10);       // \"10\"\nInteger.parseInt(\"10\");   // 10\nDouble.parseDouble(\"10\"); // 10.0\n```\n\n### Conditionals\n\n```java\nint j = 10;\n\nif (j == 10) {\n  System.out.println(\"I get printed\");\n} else if (j > 10) {\n  System.out.println(\"I don't\");\n} else {\n  System.out.println(\"I also don't\");\n}\n```\n\nSee: [Conditionals](#java-conditionals)\n\n### User Input\n\n```java\nScanner in = new Scanner(System.in);\nString str = in.nextLine();\nSystem.out.println(str);\n\nint num = in.nextInt();\nSystem.out.println(num);\n```\n\n## Java Strings\n\n### Basic\n\n```java\nString str1 = \"value\";\nString str2 = new String(\"value\");\nString str3 = String.valueOf(123);\n```\n\n### Concatenation\n\n```java\nString s = 3 + \"str\" + 3;     // 3str3\nString s = 3 + 3 + \"str\";     // 6str\nString s = \"3\" + 3 + \"str\";   // 33str\nString s = \"3\" + \"3\" + \"23\";  // 3323\nString s = \"\" + 3 + 3 + \"23\"; // 3323\nString s = 3 + 3 + 23;        // Incompatible types\n```\n\n### StringBuilder {.row-span-3}\n\n`StringBuilder sb = new StringBuilder(10);`\n\n```java\n┌───┬───┬───┬───┬───┬───┬───┬───┬───┐\n|   |   |   |   |   |   |   |   |   |\n└───┴───┴───┴───┴───┴───┴───┴───┴───┘\n0   1   2   3   4   5   6   7   8   9\n```\n\n`sb.append(\"QuickRef\");`\n\n```java\n┌───┬───┬───┬───┬───┬───┬───┬───┬───┐\n| Q | u | i | c | k | R | e | f |   |\n└───┴───┴───┴───┴───┴───┴───┴───┴───┘\n0   1   2   3   4   5   6   7   8   9\n```\n\n`sb.delete(5, 9);`\n\n```java\n┌───┬───┬───┬───┬───┬───┬───┬───┬───┐\n| Q | u | i | c | k |   |   |   |   |\n└───┴───┴───┴───┴───┴───┴───┴───┴───┘\n0   1   2   3   4   5   6   7   8   9\n```\n\n`sb.insert(0, \"My \");`\n\n```java\n┌───┬───┬───┬───┬───┬───┬───┬───┬───┐\n| M | y |   | Q | u | i | c | k |   |\n└───┴───┴───┴───┴───┴───┴───┴───┴───┘\n0   1   2   3   4   5   6   7   8   9\n```\n\n`sb.append(\"!\");`\n\n```java\n┌───┬───┬───┬───┬───┬───┬───┬───┬───┐\n| M | y |   | Q | u | i | c | k | ! |\n└───┴───┴───┴───┴───┴───┴───┴───┴───┘\n0   1   2   3   4   5   6   7   8   9\n```\n\n### Comparison\n\n```java\nString s1 = new String(\"cheatsheets.zip\");\nString s2 = new String(\"cheatsheets.zip\");\n\ns1 == s2          // false\ns1.equals(s2)     // true\n\n\"AB\".equalsIgnoreCase(\"ab\")  // true\n```\n\n### Manipulation\n\n```java\nString str = \"Abcd\";\n\nstr.toUpperCase();     // ABCD\nstr.toLowerCase();     // abcd\nstr.concat(\"#\");       // Abcd#\nstr.replace(\"b\", \"-\"); // A-cd\n\n\"  abc \".trim();       // abc\n\"ab\".toCharArray();    // {'a', 'b'}\n```\n\n### Information\n\n```java\nString str = \"abcd\";\n\nstr.charAt(2);       // c\nstr.indexOf(\"a\")     // 0\nstr.indexOf(\"z\")     // -1\nstr.length();        // 4\nstr.toString();      // abcd\nstr.substring(2);    // cd\nstr.substring(2,3);  // c\nstr.contains(\"c\");   // true\nstr.endsWith(\"d\");   // true\nstr.startsWith(\"a\"); // true\nstr.isEmpty();       // false\n```\n\n### Immutable\n\n```java\nString str = \"hello\";\nstr.concat(\"world\");\n\n// Outputs: hello\nSystem.out.println(str);\n```\n\n---\n\n```java\nString str = \"hello\";\nString concat = str.concat(\"world\");\n\n// Outputs: helloworld\nSystem.out.println(concat);\n```\n\nOnce created cannot be modified, any modification creates a new String\n\n## Java Arrays\n\n### Declare\n\n```java\nint[] a1;\nint[] a2 = {1, 2, 3};\nint[] a3 = new int[]{1, 2, 3};\n\nint[] a4 = new int[3];\na4[0] = 1;\na4[2] = 2;\na4[3] = 3;\n```\n\n### Modify\n\n```java\nint[] a = {1, 2, 3};\nSystem.out.println(a[0]); // 1\n\na[0] = 9;\nSystem.out.println(a[0]); // 9\n\nSystem.out.println(a.length); // 3\n```\n\n### Loop (Read & Modify)\n\n```java\nint[] arr = {1, 2, 3};\nfor (int i=0; i < arr.length; i++) {\n    arr[i] = arr[i] * 2;\n    System.out.print(arr[i] + \" \");\n}\n// Outputs: 2 4 6\n```\n\n### Loop (Read)\n\n```java\nString[] arr = {\"a\", \"b\", \"c\"};\nfor (String a: arr) {\n    System.out.print(a + \" \");\n}\n// Outputs: a b c\n```\n\n### Multidimensional Arrays\n\n```java\nint[][] matrix = { {1, 2, 3}, {4, 5} };\n\nint x = matrix[1][0];  // 4\n// [[1, 2, 3], [4, 5]]\nArrays.deepToString(matrix);\n\nint[][] a = matrix;\nfor (int i = 0; i < a.length; ++i) {\n  for(int j = 0; j < a[i].length; ++j) {\n    System.out.println(a[i][j]);\n  }\n}\n// Outputs: 1 2 3 4 5 6 7\n```\n\n### Sort\n\n```java\nchar[] chars = {'b', 'a', 'c'};\nArrays.sort(chars);\n\n// [a, b, c]\nArrays.toString(chars);\n```\n\n## Java Conditionals\n\n### Operators {.row-span-2}\n\n- <a data-tooltip=\"Additive operator (also used for String concatenation)\">+</a>\n- <a data-tooltip=\"Subtraction operator\">-</a>\n- <a data-tooltip=\"Multiplication operator\">\\*</a>\n- <a data-tooltip=\"Division operator\">/</a>\n- <a data-tooltip=\"Remainder operator\">%</a>\n- <a data-tooltip=\"Simple assignment operator\">=</a>\n- <a data-tooltip=\"Increment operator; increments a value by 1\">++</a>\n- <a data-tooltip=\"Decrement operator; decrements a value by 1\">--</a>\n- <a data-tooltip=\"Logical complement operator; inverts the value of a boolean\">!</a>\n\n{.marker-none .cols-4}\n\n---\n\n- <a data-tooltip=\"Equal to\">==</a>\n- <a data-tooltip=\"Not equal to\">!=</a>\n- <a data-tooltip=\"Greater than\">></a>\n- <a data-tooltip=\"Greater than or equal to\">>=</a>\n- <a data-tooltip=\"Less than\"><</a>\n- <a data-tooltip=\"Less than or equal to\"><=</a>\n\n{.marker-none .cols-4}\n\n---\n\n- <a data-tooltip=\"Conditional-AND\">&&</a>\n- <a data-tooltip=\"Conditional-OR\">||</a>\n- [?:](#ternary-operator){data-tooltip=\"Ternary (shorthand for if-then-else statement)\"}\n\n{.marker-none .cols-4}\n\n---\n\n- <a data-tooltip=\"Compares an object to a specified type\">instanceof</a>\n\n{.marker-none}\n\n---\n\n- <a data-tooltip=\"Unary bitwise complement\">~</a>\n- <a data-tooltip=\"Signed left shift\"><<</a>\n- <a data-tooltip=\"Signed right shift\">>></a>\n- <a data-tooltip=\"Unsigned right shift\">>>></a>\n- <a data-tooltip=\"Bitwise AND\">&</a>\n- <a data-tooltip=\"Bitwise exclusive OR\">^</a>\n- <a data-tooltip=\"Bitwise inclusive OR\">|</a>\n\n{.marker-none .cols-4}\n\n### If else\n\n```java\nint k = 15;\nif (k > 20) {\n  System.out.println(1);\n} else if (k > 10) {\n  System.out.println(2);\n} else {\n  System.out.println(3);\n}\n```\n\n### Switch {.row-span-2}\n\n```java\nint month = 3;\nString str;\nswitch (month) {\n  case 1:\n    str = \"January\";\n    break;\n  case 2:\n    str = \"February\";\n    break;\n  case 3:\n    str = \"March\";\n    break;\n  default:\n    str = \"Some other month\";\n    break;\n}\n\n// Outputs: Result March\nSystem.out.println(\"Result \" + str);\n```\n\n### Ternary operator\n\n```java\nint a = 10;\nint b = 20;\nint max = (a > b) ? a : b;\n\n// Outputs: 20\nSystem.out.println(max);\n```\n\n## Java Loops\n\n### For Loop\n\n```java\nfor (int i = 0; i < 10; i++) {\n  System.out.print(i);\n}\n// Outputs: 0123456789\n```\n\n---\n\n```java\nfor (int i = 0,j = 0; i < 3; i++,j--) {\n  System.out.print(j + \"|\" + i + \" \");\n}\n// Outputs: 0|0 -1|1 -2|2\n```\n\n### Enhanced For Loop\n\n```java\nint[] numbers = {1,2,3,4,5};\n\nfor (int number: numbers) {\n  System.out.print(number);\n}\n// Outputs: 12345\n```\n\nUsed to loop around array's or List's\n\n### While Loop\n\n```java\nint count = 0;\n\nwhile (count < 5) {\n  System.out.print(count);\n  count++;\n}\n// Outputs: 01234\n```\n\n### Do While Loop\n\n```java\nint count = 0;\n\ndo {\n  System.out.print(count);\n  count++;\n} while (count < 5);\n// Outputs: 01234\n```\n\n### Continue Statement\n\n```java\nfor (int i = 0; i < 5; i++) {\n  if (i == 3) {\n    continue;\n  }\n  System.out.print(i);\n}\n// Outputs: 0124\n```\n\n### Break Statement\n\n```java\nfor (int i = 0; i < 5; i++) {\n  System.out.print(i);\n  if (i == 3) {\n    break;\n  }\n}\n// Outputs: 0123\n```\n\n## Java Collections Framework\n\n### Java Collections {.col-span-2}\n\n| Collection                                                                                                         | Interface   | Ordered | Sorted | Thread safe | Duplicate | Nullable           |\n| ------------------------------------------------------------------------------------------------------------------ | ----------- | ------- | ------ | ----------- | --------- | ------------------ |\n| [ArrayList](https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html)                                    | List        | Y       | _N_    | _N_         | Y         | Y                  |\n| [Vector](https://docs.oracle.com/javase/8/docs/api/java/util/Vector.html)                                          | List        | Y       | _N_    | Y           | Y         | Y                  |\n| [LinkedList](https://docs.oracle.com/javase/8/docs/api/java/util/LinkedList.html)                                  | List, Deque | Y       | _N_    | _N_         | Y         | Y                  |\n| [CopyOnWriteArrayList](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CopyOnWriteArrayList.html)   | List        | Y       | _N_    | Y           | Y         | Y                  |\n| [HashSet](https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html)                                        | Set         | _N_     | _N_    | _N_         | _N_       | One `null`         |\n| [LinkedHashSet](https://docs.oracle.com/javase/8/docs/api/java/util/LinkedHashSet.html)                            | Set         | Y       | _N_    | _N_         | _N_       | One `null`         |\n| [TreeSet](https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html)                                        | Set         | Y       | Y      | _N_         | _N_       | _N_                |\n| [CopyOnWriteArraySet](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CopyOnWriteArraySet.html)     | Set         | Y       | _N_    | Y           | _N_       | One `null`         |\n| [ConcurrentSkipListSet](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentSkipListSet.html) | Set         | Y       | Y      | Y           | _N_       | _N_                |\n| [HashMap](https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html)                                        | Map         | _N_     | _N_    | _N_         | _N (key)_ | One `null` _(key)_ |\n| [HashTable](https://docs.oracle.com/javase/8/docs/api/java/util/Hashtable.html)                                    | Map         | _N_     | _N_    | Y           | _N (key)_ | _N (key)_          |\n| [LinkedHashMap](https://docs.oracle.com/javase/8/docs/api/java/util/LinkedHashMap.html)                            | Map         | Y       | _N_    | _N_         | _N (key)_ | One `null` _(key)_ |\n| [TreeMap](https://docs.oracle.com/javase/8/docs/api/java/util/TreeMap.html)                                        | Map         | Y       | Y      | _N_         | _N (key)_ | _N (key)_          |\n| [ConcurrentHashMap](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMap.html)         | Map         | _N_     | _N_    | Y           | _N (key)_ | _N_                |\n| [ConcurrentSkipListMap](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentSkipListMap.html) | Map         | Y       | Y      | Y           | _N (key)_ | _N_                |\n| [ArrayDeque](https://docs.oracle.com/javase/8/docs/api/java/util/ArrayDeque.html)                                  | Deque       | Y       | _N_    | _N_         | Y         | _N_                |\n| [PriorityQueue](https://docs.oracle.com/javase/8/docs/api/java/util/PriorityQueue.html)                            | Queue       | Y       | _N_    | _N_         | Y         | _N_                |\n| [ConcurrentLinkedQueue](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentLinkedQueue.html) | Queue       | Y       | _N_    | Y           | Y         | _N_                |\n| [ConcurrentLinkedDeque](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentLinkedDeque.html) | Deque       | Y       | _N_    | Y           | Y         | _N_                |\n| [ArrayBlockingQueue](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ArrayBlockingQueue.html)       | Queue       | Y       | _N_    | Y           | Y         | _N_                |\n| [LinkedBlockingDeque](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/LinkedBlockingDeque.html)     | Deque       | Y       | _N_    | Y           | Y         | _N_                |\n| [PriorityBlockingQueue](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/PriorityBlockingQueue.html) | Queue       | Y       | _N_    | Y           | Y         | _N_                |\n\n{.show-header .left-text}\n\n### ArrayList\n\n```java\nList<Integer> nums = new ArrayList<>();\n\n// Adding\nnums.add(2);\nnums.add(5);\nnums.add(8);\n\n// Retrieving\nSystem.out.println(nums.get(0));\n\n// Indexed for loop iteration\nfor (int i = 0; i < nums.size(); i++) {\n    System.out.println(nums.get(i));\n}\n\nnums.remove(nums.size() - 1);\nnums.remove(0); // VERY slow\n\nfor (Integer value : nums) {\n    System.out.println(value);\n}\n```\n\n### HashMap\n\n```java\nMap<Integer, String> m = new HashMap<>();\nm.put(5, \"Five\");\nm.put(8, \"Eight\");\nm.put(6, \"Six\");\nm.put(4, \"Four\");\nm.put(2, \"Two\");\n\n// Retrieving\nSystem.out.println(m.get(6));\n\n// Lambda forEach\nm.forEach((key, value) -> {\n    String msg = key + \": \" + value;\n    System.out.println(msg);\n});\n```\n\n### HashSet\n\n```java\nSet<String> set = new HashSet<>();\nif (set.isEmpty()) {\n    System.out.println(\"Empty!\");\n}\n\nset.add(\"dog\");\nset.add(\"cat\");\nset.add(\"mouse\");\nset.add(\"snake\");\nset.add(\"bear\");\n\nif (set.contains(\"cat\")) {\n    System.out.println(\"Contains cat\");\n}\n\nset.remove(\"cat\");\nfor (String element : set) {\n    System.out.println(element);\n}\n```\n\n### ArrayDeque\n\n```java\nDeque<String> a = new ArrayDeque<>();\n\n// Using add()\na.add(\"Dog\");\n\n// Using addFirst()\na.addFirst(\"Cat\");\n\n// Using addLast()\na.addLast(\"Horse\");\n\n// [Cat, Dog, Horse]\nSystem.out.println(a);\n\n// Access element\nSystem.out.println(a.peek());\n\n// Remove element\nSystem.out.println(a.pop());\n```\n\n## Misc\n\n### Access Modifiers {.col-span-2}\n\n| Modifier    | Class | Package | Subclass | World |\n| ----------- | ----- | ------- | -------- | ----- |\n| public      | Y     | Y       | Y        | Y     |\n| protected   | Y     | Y       | Y        | _N_   |\n| no modifier | Y     | Y       | _N_      | _N_   |\n| private     | Y     | _N_     | _N_      | _N_   |\n\n{.show-header .left-text}\n\n### Regular expressions\n\n```java\nString text = \"I am learning Java\";\n// Removing All Whitespace\ntext.replaceAll(\"\\\\s+\", \"\");\n\n// Splitting a String\ntext.split(\"\\\\|\");\ntext.split(Pattern.quote(\"|\"));\n```\n\nSee: [Regex in java](/regex#regex-in-java)\n\n### Comment\n\n```java\n// I am a single line comment!\n\n/*\nAnd I am a\nmulti-line comment!\n*/\n\n/**\n * This\n * is\n * documentation\n * comment\n */\n```\n\n### Keywords {.col-span-2}\n\n- `abstract`\n- `continue`\n- `for`\n- `new`\n- `switch`\n- `assert`\n- `default`\n- `goto`\n- `package`\n- `synchronized`\n- `boolean`\n- `do`\n- `if`\n- `private`\n- `this`\n- `break`\n- `double`\n- `implements`\n- `protected`\n- `throw`\n- `byte`\n- `else`\n- `import`\n- `public`\n- `throws`\n- `case`\n- `enum`\n- `instanceof`\n- `return`\n- `transient`\n- `catch`\n- `extends`\n- `int`\n- `short`\n- `try`\n- `char`\n- `final`\n- `interface`\n- `static`\n- `void`\n- `class`\n- `finally`\n- `long`\n- `strictfp`\n- `volatile`\n- `const`\n- `float`\n- `native`\n- `super`\n- `while`\n\n{.marker-none .cols-6}\n\n### Math methods\n\n| Method                | Description            |\n| --------------------- | :--------------------- |\n| `Math.max(a,b)`       | Maximum of a and b     |\n| `Math.min(a,b)`       | Minimum of a and b     |\n| `Math.abs(a)`         | Absolute value a       |\n| `Math.sqrt(a)`        | Square-root of a       |\n| `Math.pow(a,b)`       | Power of b             |\n| `Math.round(a)`       | Closest integer        |\n| `Math.sin(ang)`       | Sine of ang            |\n| `Math.cos(ang)`       | Cosine of ang          |\n| `Math.tan(ang)`       | Tangent of ang         |\n| `Math.asin(ang)`      | Inverse sine of ang    |\n| `Math.log(a)`         | Natural logarithm of a |\n| `Math.toDegrees(rad)` | Angle rad in degrees   |\n| `Math.toRadians(deg)` | Angle deg in radians   |\n\n### Try/Catch/Finally\n\n```java\ntry {\n  // something\n} catch (Exception e) {\n  e.printStackTrace();\n} finally {\n  System.out.println(\"always printed\");\n}\n```\n"
  },
  {
    "path": "source/_posts/javascript.md",
    "content": "---\ntitle: JavaScript\ndate: 2020-12-24 17:12:25\nbackground: bg-[#ebd94e]\ntags:\n  - js\n  - web\ncategories:\n  - Programming\nintro: |\n  A JavaScript cheat sheet with the most important concepts, functions, methods, and more. A complete quick reference for beginners.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### Introduction\n\nJavaScript is a lightweight, interpreted programming language.\n\n- [JSON cheatsheet](/json) _(cheatsheets.zip)_\n- [Regex in JavaScript](/regex#regex-in-javascript) _(cheatsheets.zip)_\n\n### Console\n\n```javascript\n// => Hello world!\nconsole.log('Hello world!');\n\n// => Hello CheatSheets.zip\nconsole.warn('hello %s', 'CheatSheets.zip');\n\n// Prints error message to stderr\nconsole.error(new Error('Oops!'));\n```\n\n### Numbers\n\n```javascript\nlet amount = 6;\nlet price = 4.99;\n```\n\n### Variables\n\n```javascript\nlet x = null;\nlet name = 'Tammy';\nconst found = false;\n\n// => Tammy, false, null\nconsole.log(name, found, x);\n\nvar a;\nconsole.log(a); // => undefined\n```\n\n### Strings\n\n```javascript\nlet singleQuotes = 'Wheres my bandit hat?';\nlet doubleQuotes = \"Wheres my bandit hat?\";\n// this is used to embed expressions or for creating multi-line strings\nlet backTicks = `Wheres my bandit hat? ${some_value}`;\n\n// they can also be mixed,\n// NOTE: if you need the functionality of the backticks, use it as the surrounding quotes\nlet mixedQuotes = `hello ${'dear' + name}, \"let's have a great day today`;\n\n// => 21\nconsole.log(singleQuotes.length);\n```\n\n### Arithmetic Operators\n\n```javascript\n5 + 5 = 10     // Addition\n10 - 5 = 5     // Subtraction\n5 * 10 = 50    // Multiplication\n10 / 5 = 2     // Division\n10 % 5 = 0     // Modulo\n```\n\n### Comments\n\n```javascript\n// This line will denote a comment\n\n/*\nThe below configuration must be\nchanged before deployment.\n*/\n```\n\n### Assignment Operators\n\n```javascript\nlet number = 100;\n\n// Both statements will add 10\nnumber = number + 10;\nnumber += 10;\n\nconsole.log(number);\n// => 120\n```\n\n### String Interpolation\n\n```javascript\nlet age = 7;\n\n// String concatenation\n'Tommy is ' + age + ' years old.';\n\n// String interpolation\n`Tommy is ${age} years old.`;\n```\n\n### let Keyword\n\n```javascript\nlet count;\nconsole.log(count); // => undefined\ncount = 10;\nconsole.log(count); // => 10\n```\n\n### const Keyword\n\n```javascript\nconst numberOfColumns = 4;\n\n// TypeError: Assignment to constant...\nnumberOfColumns = 8;\n```\n\n## JavaScript Conditionals\n\n### if Statement\n\n```javascript\nconst isMailSent = true;\n\nif (isMailSent) {\n  console.log('Mail sent to recipient');\n}\n```\n\n### Ternary Operator\n\n```javascript\n// The ternary operator is a concise way to write an if-else statement in a single line: condition ? exprIfTrue : exprIfFalse.\n\nvar x = 1;\n\n// true, (condition) ? value_if_true : value_if_false\nresult = x == 1 ? true : false;\n```\n\n### Operators {.row-span-2}\n\n```javascript\ntrue || false; // true\n10 > 5 || 10 > 20; // true\nfalse || false; // false\n10 > 100 || 10 > 20; // false\n```\n\n#### Logical Operator &&\n\n```javascript\ntrue && true; // true\n1 > 2 && 2 > 1; // false\ntrue && false; // false\n4 === 4 && 3 > 1; // true\n```\n\n#### Comparison Operators\n\n```javascript\n1 > 3; // false\n3 > 1; // true\n250 >= 250; // true\n1 === 1; // true\n1 === 2; // false\n1 === '1'; // false\n```\n\n#### Logical Operator !\n\n```javascript\nlet lateToWork = true;\nlet oppositeValue = !lateToWork;\n\n// => false\nconsole.log(oppositeValue);\n```\n\n#### Nullish coalescing operator ??\n\n```javascript\nnull ?? 'I win'; //  'I win'\nundefined ?? 'Me too'; //  'Me too'\n\nfalse ?? 'I lose'; //  false\n0 ?? 'I lose again'; //  0\n'' ?? 'Damn it'; //  ''\n```\n\n#### Optional Chaining ?.\n\n```javascript\nconst obj = {\n  name: 'John Doe',\n  age: 8\n};\n\nconsole.log(obj?.address);\n```\n\n### else if\n\n```javascript\nconst size = 10;\n\nif (size > 100) {\n  console.log('Big');\n} else if (size > 20) {\n  console.log('Medium');\n} else if (size > 4) {\n  console.log('Small');\n} else {\n  console.log('Tiny');\n}\n// Print: Small\n```\n\n### switch Statement\n\n```javascript\nconst food = 'salad';\n\nswitch (food) {\n  case 'oyster':\n    console.log('The taste of the sea');\n    break;\n  case 'pizza':\n    console.log('A delicious pie');\n    break;\n  default:\n    console.log('Enjoy your meal');\n}\n```\n\n### Object Lookup\n\n```javascript\nconst food = 'salad';\n\nconst foods = {\n  oyster: 'The taste of the sea',\n  pizza: 'A delicious pie'\n};\n\nconsole.log(foods[food] || 'Enjoy your meal');\n```\n\n### == vs ===\n\n```javascript\n0 == false; // true\n0 === false; // false, different type\n1 == '1'; // true,  automatic type conversion\n1 === '1'; // false, different type\nnull == undefined; // true\nnull === undefined; // false\n'0' == false; // true\n'0' === false; // false\n```\n\nThe `==` just check the value, `===` check both the value and the type.\n\n## JavaScript Functions\n\n### Functions\n\n```javascript\n// Defining the function:\nfunction sum(num1, num2) {\n  return num1 + num2;\n}\n\n// Calling the function:\nsum(3, 6); // 9\n```\n\n### Anonymous Functions\n\n```javascript\n// Named function\nfunction rocketToMars() {\n  return 'BOOM!';\n}\n\n// Anonymous function\nconst rocketToMars = function () {\n  return 'BOOM!';\n};\n```\n\n### Arrow Functions (ES6) {.row-span-2}\n\n#### With two arguments\n\n```javascript\nconst sum = (param1, param2) => {\n  return param1 + param2;\n};\nconsole.log(sum(2, 5)); // => 7\n```\n\n#### With no arguments\n\n```javascript\nconst printHello = () => {\n  console.log('hello');\n};\nprintHello(); // => hello\n```\n\n#### With a single argument\n\n```javascript\nconst checkWeight = (weight) => {\n  console.log(`Weight : ${weight}`);\n};\ncheckWeight(25); // => Weight : 25\n```\n\n#### Concise arrow functions\n\n```javascript\nconst multiply = (a, b) => a * b;\n// => 60\nconsole.log(multiply(2, 30));\n```\n\n[Arrow function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) available\nstarting ES2015\n\n### return Keyword\n\n```javascript\n// With return\nfunction sum(num1, num2) {\n  return num1 + num2;\n}\n\n// The function doesn't output the sum\nfunction sum(num1, num2) {\n  num1 + num2;\n}\n```\n\n### Calling Functions\n\n```javascript\n// Defining the function\nfunction sum(num1, num2) {\n  return num1 + num2;\n}\n\n// Calling the function\nsum(2, 4); // 6\n```\n\n### Function Expressions\n\n```javascript\nconst dog = function () {\n  return 'Woof!';\n};\n```\n\n### Function Parameters\n\n```javascript\n// The parameter is name\nfunction sayHello(name) {\n  return `Hello, ${name}!`;\n}\n```\n\n### Function Declaration\n\n```javascript\nfunction add(num1, num2) {\n  return num1 + num2;\n}\n```\n\n## JavaScript Scope\n\n### Scope\n\n```javascript\nfunction myFunction() {\n  var pizzaName = 'Margarita';\n  // Code here can use pizzaName\n}\n\n// Code here can't use pizzaName\n```\n\n### Block Scoped Variables\n\n```javascript\nconst isLoggedIn = true;\n\nif (isLoggedIn == true) {\n  const statusMessage = 'Logged in.';\n}\n\n// Uncaught ReferenceError...\nconsole.log(statusMessage);\n```\n\n### Global Variables\n\n```javascript\n// Variable declared globally\nconst color = 'blue';\n\nfunction printColor() {\n  console.log(color);\n}\n\nprintColor(); // => blue\n```\n\n### let vs var\n\n```javascript\nfor (let i = 0; i < 3; i++) {\n  // This is the Max Scope for 'let'\n  // i accessible ✔️\n}\n// i not accessible ❌\n```\n\n---\n\n```javascript\nfor (var i = 0; i < 3; i++) {\n  // i accessible ✔️\n}\n// i accessible ✔️\n```\n\n`var` is scoped to the nearest function block, and `let` is scoped to the nearest enclosing block.\n\n### Loops with closures\n\n```javascript{.wrap}\n// Prints 3 thrice, not what we meant.\nfor (var i = 0; i < 3; i++) {\n  setTimeout(_ => console.log(i), 10);\n}\n```\n\n---\n\n```javascript{.wrap}\n// Prints 0, 1 and 2, as expected.\nfor (let j = 0; j < 3; j++) {\n  setTimeout(_ => console.log(j), 10);\n}\n```\n\nThe variable has its own copy using `let`, and the variable has shared copy using `var`.\n\n## JavaScript Arrays\n\n### Arrays\n\n```javascript\nconst fruits = ['apple', 'orange', 'banana'];\n\n// Different data types\nconst data = [1, 'chicken', false];\n```\n\n### Property .length\n\n```javascript\nconst numbers = [1, 2, 3, 4];\n\nnumbers.length; // 4\n```\n\n### Index\n\n```javascript\n// Accessing an array element\nconst myArray = [100, 200, 300];\n\nconsole.log(myArray[0]); // 100\nconsole.log(myArray[1]); // 200\n```\n\n### Mutable chart\n\n|           | add | remove | start | end |\n| :-------- | :-: | :----: | :---: | :-: |\n| `push`    |  ✔  |        |       |  ✔  |\n| `pop`     |     |   ✔    |       |  ✔  |\n| `unshift` |  ✔  |        |   ✔   |     |\n| `shift`   |     |   ✔    |   ✔   |     |\n\n{.show-header}\n\n### Array.push()\n\n```javascript\n// Adding a single element:\nconst cart = ['apple', 'orange'];\ncart.push('pear');\n\n// Adding multiple elements:\nconst numbers = [1, 2];\nnumbers.push(3, 4, 5);\n```\n\nAdd items to the end and returns the new array length.\n\n### Array.pop()\n\n```javascript\nconst fruits = ['apple', 'orange', 'banana'];\n\nconst fruit = fruits.pop(); // 'banana'\nconsole.log(fruits); // [\"apple\", \"orange\"]\n```\n\nRemove an item from the end and returns the removed item.\n\n### Array.shift()\n\n```javascript\nlet cats = ['Bob', 'Willy', 'Mini'];\n\ncats.shift(); // ['Willy', 'Mini']\n```\n\nRemove an item from the beginning and returns the removed item.\n\n### Array.unshift()\n\n```javascript\nlet cats = ['Bob'];\n\n// => ['Willy', 'Bob']\ncats.unshift('Willy');\n\n// => ['Puff', 'George', 'Willy', 'Bob']\ncats.unshift('Puff', 'George');\n```\n\nAdd items to the beginning and returns the new array length.\n\n### Array.concat()\n\n```javascript\nconst numbers = [3, 2, 1];\nconst newFirstNumber = 4;\n\n// => [ 4, 3, 2, 1 ]\n[newFirstNumber].concat(numbers);\n\n// => [ 3, 2, 1, 4 ]\nnumbers.concat(newFirstNumber);\n```\n\nIf you want to avoid mutating your original array, you can use concat.\n\n### Destructuring\n\n```javascript\nconst [name, age] = ['John Doe', 8];\n\nconsole.log(name);\nconsole.log(age);\n```\n\n## JavaScript Set\n\n### Create Set\n\n```javascript\n// Empty Set Object\nconst emptySet = new Set();\n\n// Set Object with values\nconst setObj = new Set([1, true, 'hi']);\n```\n\n### Add\n\n```javascript\nconst emptySet = new Set();\n\n// add values\nemptySet.add('a'); // 'a'\nemptySet.add(1); // 'a', 1\nemptySet.add(true); // 'a', 1, true\nemptySet.add('a'); // 'a', 1, true\n```\n\n### Delete\n\n```javascript\nconst emptySet = new Set([1, true, 'a']);\n\n// delete values\nemptySet.delete('a'); // 1, true\nemptySet.delete(true); // 1\nemptySet.delete(1); //\n```\n\n### Has\n\n```javascript\nconst setObj = new Set([1, true, 'a']);\n\n// returns true or false\nsetObj.has('a'); // true\nsetObj.has(1); // true\nsetObj.has(false); // false\n```\n\n### Clear\n\n```javascript\nconst setObj = new Set([1, true, 'a']);\n\n// clears the set\nconsole.log(setObj); // 1, true, 'a'\nsetObj.clear(); //\n```\n\n### Size\n\n```javascript\nconst setObj = new Set([1, true, 'a']);\n\nconsoloe.log(setObj.size); // 3\n```\n\n### ForEach\n\n```javascript\nconst setObj = new Set([1, true, 'a']);\n\nsetObj.forEach(function (value) {\n  console.log(value);\n});\n\n// 1\n// true\n// 'a'\n```\n\n## JavaScript Loops\n\n### While Loop\n\n```javascript\nwhile (condition) {\n  // code block to be executed\n}\n\nlet i = 0;\nwhile (i < 5) {\n  console.log(i);\n  i++;\n}\n```\n\n### Reverse Loop\n\n```javascript\nconst fruits = ['apple', 'orange', 'banana'];\n\nfor (let i = fruits.length - 1; i >= 0; i--) {\n  console.log(`${i}. ${fruits[i]}`);\n}\n\n// => 2. banana\n// => 1. orange\n// => 0. apple\n```\n\n### Do…While Statement\n\n```javascript\nx = 0;\ni = 0;\n\ndo {\n  x = x + i;\n  console.log(x);\n  i++;\n} while (i < 5);\n// => 0 1 3 6 10\n```\n\n### For Loop\n\n```javascript\nfor (let i = 0; i < 4; i += 1) {\n  console.log(i);\n}\n\n// => 0, 1, 2, 3\n```\n\n### Looping Through Arrays\n\n```javascript\nfor (let i = 0; i < array.length; i++) {\n  console.log(array[i]);\n}\n\n// => Every item in the array\n```\n\n### Break\n\n```javascript\nfor (let i = 0; i < 99; i += 1) {\n  if (i > 5) {\n    break;\n  }\n  console.log(i);\n}\n// => 0 1 2 3 4 5\n```\n\n### Continue\n\n```javascript\nfor (i = 0; i < 10; i++) {\n  if (i === 3) {\n    continue;\n  }\n  text += 'The number is ' + i + '<br>';\n}\n```\n\n### Nested\n\n```javascript\nfor (let i = 0; i < 2; i += 1) {\n  for (let j = 0; j < 3; j += 1) {\n    console.log(`${i}-${j}`);\n  }\n}\n```\n\n### for...in loop\n\n```javascript\nconst fruits = ['apple', 'orange', 'banana'];\n\n// 1. Print only indexes\nfor (let index in fruits) {\n  console.log(index);\n}\n// => 0\n// => 1\n// => 2\n\n// 2. Print only values\nfor (let index in fruits) {\n  console.log(fruits[index]);\n}\n// => apple\n// => orange\n// => banana\n\n// 3. Print index with value\nfor (let index in fruits) {\n  console.log(index, fruits[index]);\n}\n// => 0 apple\n// => 1 orange\n// => 2 banana\n```\n\n### for...of loop\n\n```javascript\nconst fruits = ['apple', 'orange', 'banana'];\n\nfor (let fruit of fruits) {\n  console.log(fruit);\n}\n// => apple\n// => orange\n// => banana\n\nfor (let [index, value] of fruits.entries()) {\n  console.log(index, value);\n}\n// => 0 apple\n// => 1 orange\n// => 2 banana\n```\n\n## JavaScript Iterators {.cols-2}\n\n### Functions Assigned to Variables\n\n```javascript\nlet plusFive = (number) => {\n  return number + 5;\n};\n// f is assigned the value of plusFive\nlet f = plusFive;\n\nplusFive(3); // 8\n// Since f has a function value, it can be invoked.\nf(9); // 14\n```\n\n### Callback Functions\n\n```javascript\nconst isEven = (n) => {\n  return n % 2 == 0;\n};\n\nlet printMsg = (evenFunc, num) => {\n  const isNumEven = evenFunc(num);\n  console.log(`${num} is an even number: ${isNumEven}.`);\n};\n\n// Pass in isEven as the callback function\nprintMsg(isEven, 4);\n// => 4 is an even number: True.\n```\n\n### Array.reduce()\n\n```javascript\nconst numbers = [1, 2, 3, 4];\n\nconst sum = numbers.reduce((accumulator, curVal) => {\n  return accumulator + curVal;\n});\n\nconsole.log(sum); // 10\n```\n\n### Array.map()\n\n```javascript\nconst members = ['Taylor', 'Donald', 'Don', 'Natasha', 'Bobby'];\n\nconst announcements = members.map((member) => {\n  return member + ' joined the contest.';\n});\n\nconsole.log(announcements);\n```\n\n### Array.forEach()\n\n```javascript\nconst numbers = [28, 77, 45, 99, 27];\n\nnumbers.forEach((number) => {\n  console.log(number);\n});\n```\n\n### Array.filter()\n\n```javascript\nconst randomNumbers = [4, 11, 42, 14, 39];\nconst filteredArray = randomNumbers.filter((n) => {\n  return n > 5;\n});\n```\n\n## JavaScript Objects {.cols-2}\n\n### Accessing Properties\n\n```javascript\nconst apple = {\n  color: 'Green',\n  price: { bulk: '$3/kg', smallQty: '$4/kg' }\n};\nconsole.log(apple.color); // => Green\nconsole.log(apple.price.bulk); // => $3/kg\n```\n\n### Naming Properties\n\n```javascript\n// Example of invalid key names\nconst trainSchedule = {\n  // Invalid because of the space between words.\n  platform num: 10,\n  // Expressions cannot be keys.\n  40 - 10 + 2: 30,\n  // A + sign is invalid unless it is enclosed in quotations.\n  +compartment: 'C'\n}\n```\n\n### Non-existent properties\n\n```javascript\nconst classElection = {\n  date: 'January 12'\n};\n\nconsole.log(classElection.place); // undefined\n```\n\n### Mutable {.row-span-2}\n\n```javascript\nconst student = {\n  name: 'Sheldon',\n  score: 100,\n  grade: 'A'\n};\n\nconsole.log(student);\n// { name: 'Sheldon', score: 100, grade: 'A' }\n\ndelete student.score;\nstudent.grade = 'F';\nconsole.log(student);\n// { name: 'Sheldon', grade: 'F' }\n\nstudent = {};\n// TypeError: Assignment to constant variable.\n```\n\n### Assignment shorthand syntax\n\n```javascript\nconst person = {\n  name: 'Tom',\n  age: '22'\n};\nconst { name, age } = person;\nconsole.log(name); // 'Tom'\nconsole.log(age); // '22'\n```\n\n### Delete operator\n\n```javascript\nconst person = {\n  firstName: 'Matilda',\n  age: 27,\n  hobby: 'knitting',\n  goal: 'learning JavaScript'\n};\n\ndelete person.hobby; // or delete person[hobby];\n\nconsole.log(person);\n/*\n{\n  firstName: \"Matilda\"\n  age: 27\n  goal: \"learning JavaScript\"\n}\n*/\n```\n\n### Objects as arguments\n\n```javascript\nconst origNum = 8;\nconst origObj = { color: 'blue' };\n\nconst changeItUp = (num, obj) => {\n  num = 7;\n  obj.color = 'red';\n};\n\nchangeItUp(origNum, origObj);\n\n// Will output 8 since integers are passed by value.\nconsole.log(origNum);\n\n// Will output 'red' since objects are passed\n// by reference and are therefore mutable.\nconsole.log(origObj.color);\n```\n\n### Shorthand object creation\n\n```javascript\nconst activity = 'Surfing';\nconst beach = { activity };\nconsole.log(beach); // { activity: 'Surfing' }\n```\n\n### this Keyword\n\n```javascript\nconst cat = {\n  name: 'Pipey',\n  age: 8,\n  whatName() {\n    return this.name;\n  }\n};\nconsole.log(cat.whatName()); // => Pipey\n```\n\n### Factory functions\n\n```javascript\n// A factory function that accepts 'name',\n// 'age', and 'breed' parameters to return\n// a customized dog object.\nconst dogFactory = (name, age, breed) => {\n  return {\n    name: name,\n    age: age,\n    breed: breed,\n    bark() {\n      console.log('Woof!');\n    }\n  };\n};\n```\n\n### Object methods\n\n```javascript\nconst engine = {\n  // method shorthand, with one argument\n  start(adverb) {\n    console.log(`The engine starts up ${adverb}...`);\n  },\n  // anonymous arrow function expression with no arguments\n  sputter: () => {\n    console.log('The engine sputters...');\n  }\n};\n\nengine.start('noisily');\nengine.sputter();\n```\n\n### Getters and setters\n\n```javascript\nconst myCat = {\n  _name: 'Dottie',\n  get name() {\n    return this._name;\n  },\n  set name(newName) {\n    this._name = newName;\n  }\n};\n\n// Reference invokes the getter\nconsole.log(myCat.name);\n\n// Assignment invokes the setter\nmyCat.name = 'Yankee';\n```\n\n### Destructuring\n\n```javascript\nconst obj = {\n  name: 'John Doe',\n  age: 8\n};\n\nconst { name, age } = obj;\n\nconsole.log(name);\nconsole.log(age);\n```\n\n## JavaScript Classes\n\n### Static Methods\n\n```javascript\nclass Dog {\n  constructor(name) {\n    this._name = name;\n  }\n\n  introduce() {\n    console.log('This is ' + this._name + ' !');\n  }\n\n  // A static method\n  static bark() {\n    console.log('Woof!');\n  }\n}\n\nconst myDog = new Dog('Buster');\nmyDog.introduce();\n\n// Calling the static method\nDog.bark();\n```\n\n### Class\n\n```javascript\nclass Song {\n  constructor() {\n    this.title;\n    this.author;\n  }\n\n  play() {\n    console.log('Song playing!');\n  }\n}\n\nconst mySong = new Song();\nmySong.play();\n```\n\n### Class Constructor\n\n```javascript\nclass Song {\n  constructor(title, artist) {\n    this.title = title;\n    this.artist = artist;\n  }\n}\n\nconst mySong = new Song('Bohemian Rhapsody', 'Queen');\nconsole.log(mySong.title);\n```\n\n### Class Methods\n\n```javascript\nclass Song {\n  play() {\n    console.log('Playing!');\n  }\n\n  stop() {\n    console.log('Stopping!');\n  }\n}\n```\n\n### extends\n\n```javascript\n// Parent class\nclass Media {\n  constructor(info) {\n    this.publishDate = info.publishDate;\n    this.name = info.name;\n  }\n}\n\n// Child class\nclass Song extends Media {\n  constructor(songData) {\n    super(songData);\n    this.artist = songData.artist;\n  }\n}\n\nconst mySong = new Song({\n  artist: 'Queen',\n  name: 'Bohemian Rhapsody',\n  publishDate: 1975\n});\n```\n\n## JavaScript Modules {.cols-2}\n\n### Export\n\n```javascript\n// myMath.js\n\n// Default export\nexport default function add(x, y) {\n  return x + y;\n}\n\n// Normal export\nexport function subtract(x, y) {\n  return x - y;\n}\n\n// Multiple exports\nfunction multiply(x, y) {\n  return x * y;\n}\nfunction duplicate(x) {\n  return x * 2;\n}\nexport { multiply, duplicate };\n```\n\n### Import\n\n```javascript\n// main.js\nimport add, { subtract, multiply, duplicate } from './myMath.js';\n\nconsole.log(add(6, 2)); // 8\nconsole.log(subtract(6, 2)) // 4\nconsole.log(multiply(6, 2)); // 12\nconsole.log(duplicate(5)) // 10\n\n// index.html\n<script type=\"module\" src=\"main.js\"></script>\n```\n\n### Export Module\n\n```javascript\n// myMath.js\n\nfunction add(x, y) {\n  return x + y;\n}\nfunction subtract(x, y) {\n  return x - y;\n}\nfunction multiply(x, y) {\n  return x * y;\n}\nfunction duplicate(x) {\n  return x * 2;\n}\n\n// Multiple exports in node.js\nmodule.exports = {\n  add,\n  subtract,\n  multiply,\n  duplicate\n};\n```\n\n### Require Module\n\n```javascript\n// main.js\nconst myMath = require('./myMath.js');\n\nconsole.log(myMath.add(6, 2)); // 8\nconsole.log(myMath.subtract(6, 2)); // 4\nconsole.log(myMath.multiply(6, 2)); // 12\nconsole.log(myMath.duplicate(5)); // 10\n```\n\n## JavaScript Promises {.cols-2}\n\n### Promise states {.row-span-2}\n\n```javascript\nconst promise = new Promise((resolve, reject) => {\n  const res = true;\n  // An asynchronous operation.\n  if (res) {\n    resolve('Resolved!');\n  } else {\n    reject(Error('Error'));\n  }\n});\n\npromise.then(\n  (res) => console.log(res),\n  (err) => console.error(err)\n);\n```\n\n### Executor function\n\n```javascript\nconst executorFn = (resolve, reject) => {\n  resolve('Resolved!');\n};\n\nconst promise = new Promise(executorFn);\n```\n\n### setTimeout()\n\n```javascript\nconst loginAlert = () => {\n  console.log('Login');\n};\n\nsetTimeout(loginAlert, 6000);\n```\n\n### .then() method\n\n```javascript\nconst promise = new Promise((resolve, reject) => {\n  setTimeout(() => {\n    resolve('Result');\n  }, 200);\n});\n\npromise.then(\n  (res) => {\n    console.log(res);\n  },\n  (err) => {\n    console.error(err);\n  }\n);\n```\n\n### Promise.catch()\n\n```javascript\nconst promise = new Promise((resolve, reject) => {\n  setTimeout(() => {\n    reject(Error('Promise Rejected Unconditionally.'));\n  }, 1000);\n});\n\npromise.then((res) => {\n  console.log(value);\n});\n\npromise.catch((err) => {\n  console.error(err);\n});\n```\n\n### Promise.all()\n\n```javascript\nconst promise1 = new Promise((resolve, reject) => {\n  setTimeout(() => {\n    resolve(3);\n  }, 300);\n});\nconst promise2 = new Promise((resolve, reject) => {\n  setTimeout(() => {\n    resolve(2);\n  }, 200);\n});\n\nPromise.all([promise1, promise2]).then((res) => {\n  console.log(res[0]);\n  console.log(res[1]);\n});\n```\n\n### Promise.allSettled()\n\n```javascript\nconst promise1 = Promise.resolve(3);\nconst promise2 = new Promise((resolve, reject) => {\n  setTimeout(() => {\n    reject(2);\n  }, 100);\n});\n\nPromise.allSettled([promise1, promise2]).then((res) => {\n  console.log(res[0].status);\n  console.log(res[1].status);\n});\n```\n\n### Avoiding nested Promise and .then()\n\n```javascript\nconst promise = new Promise((resolve, reject) => {\n  setTimeout(() => {\n    resolve('*');\n  }, 1000);\n});\n\nconst twoStars = (star) => {\n  return star + star;\n};\n\nconst oneDot = (star) => {\n  return star + '.';\n};\n\nconst print = (val) => {\n  console.log(val);\n};\n\n// Chaining them all together\npromise.then(twoStars).then(oneDot).then(print);\n```\n\n### Creating\n\n```javascript\nconst executorFn = (resolve, reject) => {\n  console.log('The executor function of the promise!');\n};\n\nconst promise = new Promise(executorFn);\n```\n\n### Chaining multiple .then()\n\n```javascript\nconst promise = new Promise((resolve) =>\n  setTimeout(() => resolve('dAlan'), 100)\n);\n\npromise\n  .then((res) => {\n    return res === 'Alan'\n      ? Promise.resolve('Hey Alan!')\n      : Promise.reject('Who are you?');\n  })\n  .then(\n    (res) => {\n      console.log(res);\n    },\n    (err) => {\n      console.error(err);\n    }\n  );\n```\n\n### Fake http Request with Promise\n\n```javascript\nconst mock = (success, timeout = 1000) => {\n  return new Promise((resolve, reject) => {\n    setTimeout(() => {\n      if (success) {\n        resolve({ status: 200, data: {} });\n      } else {\n        reject({ message: 'Error' });\n      }\n    }, timeout);\n  });\n};\nconst someEvent = async () => {\n  try {\n    await mock(true, 1000);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n## JavaScript Async-Await {.cols-2}\n\n### Asynchronous\n\n```javascript\nfunction helloWorld() {\n  return new Promise((resolve) => {\n    setTimeout(() => {\n      resolve('Hello World!');\n    }, 2000);\n  });\n}\n\nconst msg = async function () {\n  //Async Function Expression\n  const msg = await helloWorld();\n  console.log('Message:', msg);\n};\n\nconst msg1 = async () => {\n  //Async Arrow Function\n  const msg = await helloWorld();\n  console.log('Message:', msg);\n};\n\nmsg(); // Message: Hello World! <-- after 2 seconds\nmsg1(); // Message: Hello World! <-- after 2 seconds\n```\n\n### Resolving Promises\n\n```javascript\nlet pro1 = Promise.resolve(5);\nlet pro2 = 44;\nlet pro3 = new Promise(function (resolve, reject) {\n  setTimeout(resolve, 100, 'foo');\n});\n\nPromise.all([pro1, pro2, pro3]).then(function (values) {\n  console.log(values);\n});\n// expected => Array [5, 44, \"foo\"]\n```\n\n### Async Await Promises\n\n```javascript\nfunction helloWorld() {\n  return new Promise((resolve) => {\n    setTimeout(() => {\n      resolve('Hello World!');\n    }, 2000);\n  });\n}\n\nasync function msg() {\n  const msg = await helloWorld();\n  console.log('Message:', msg);\n}\n\nmsg(); // Message: Hello World! <-- after 2 seconds\n```\n\n### Error Handling\n\n```javascript\nlet json = '{ \"age\": 30 }'; // incomplete data\n\ntry {\n  let user = JSON.parse(json); // <-- no errors\n  console.log(user.name); // no name!\n} catch (e) {\n  console.error('Invalid JSON data!');\n}\n```\n\n### Aysnc await operator\n\n```javascript\nfunction helloWorld() {\n  return new Promise((resolve) => {\n    setTimeout(() => {\n      resolve('Hello World!');\n    }, 2000);\n  });\n}\n\nasync function msg() {\n  const msg = await helloWorld();\n  console.log('Message:', msg);\n}\n\nmsg(); // Message: Hello World! <-- after 2 seconds\n```\n\n## JavaScript Requests\n\n### JSON\n\n```json\nconst jsonObj = {\n  \"name\": \"Rick\",\n  \"id\": \"11A\",\n  \"level\": 4\n};\n```\n\nAlso see: [JSON cheatsheet](/json)\n\n### XMLHttpRequest\n\n```javascript\nconst xhr = new XMLHttpRequest();\nxhr.open('GET', 'mysite.com/getjson');\n```\n\n`XMLHttpRequest` is a browser-level API that enables the client to script data transfers via JavaScript, NOT part of the\nJavaScript language.\n\n### GET\n\n```javascript\nconst req = new XMLHttpRequest();\nreq.responseType = 'json';\nreq.open('GET', '/getdata?id=65');\nreq.onload = () => {\n  console.log(xhr.response);\n};\n\nreq.send();\n```\n\n### POST {.row-span-2}\n\n```javascript\nconst data = {\n  fish: 'Salmon',\n  weight: '1.5 KG',\n  units: 5\n};\nconst xhr = new XMLHttpRequest();\nxhr.open('POST', '/inventory/add');\nxhr.responseType = 'json';\nxhr.send(JSON.stringify(data));\n\nxhr.onload = () => {\n  console.log(xhr.response);\n};\n```\n\n### fetch api {.row-span-2}\n\n```javascript\nfetch(url, {\n    method: 'POST',\n    headers: {\n      'Content-type': 'application/json',\n      'apikey': apiKey\n    },\n    body: data\n  }).then(response => {\n    if (response.ok) {\n      return response.json();\n    }\n    throw new Error('Request failed!');\n  }, networkError => {\n    console.log(networkError.message)\n  })\n}\n```\n\n### JSON Formatted\n\n```javascript\nfetch('url-that-returns-JSON')\n  .then((response) => response.json())\n  .then((jsonResponse) => {\n    console.log(jsonResponse);\n  });\n```\n\n### promise url parameter fetch api\n\n```javascript\nfetch('url')\n.then(\n  response  => {\n    console.log(response);\n  },\n rejection => {\n    console.error(rejection.message);\n);\n```\n\n### Fetch API Function\n\n```javascript\nfetch('https://api-xxx.com/endpoint', {\n  method: 'POST',\n  body: JSON.stringify({ id: '200' })\n})\n  .then(\n    (response) => {\n      if (response.ok) {\n        return response.json();\n      }\n      throw new Error('Request failed!');\n    },\n    (networkError) => {\n      console.log(networkError.message);\n    }\n  )\n  .then((jsonResponse) => {\n    console.log(jsonResponse);\n  });\n```\n\n### async await syntax {.col-span-2}\n\n```javascript\nconst getSuggestions = async () => {\n  const wordQuery = inputField.value;\n  const endpoint = `${url}${queryParams}${wordQuery}`;\n  try {\n    const response = await fetch(endpoint, { cache: 'no-cache' });\n    if (response.ok) {\n      const jsonResponse = await response.json();\n    }\n  } catch (error) {\n    console.log(error);\n  }\n};\n```\n"
  },
  {
    "path": "source/_posts/jest.md",
    "content": "---\ntitle: Jest Cheat Sheet\ndate: 2022-09-09 00:00:00\nbackground: bg-blue-500\ndescription: A complete cheat sheet on  Jest for testing React applications effectively.\ntags: React\n  Testing\n  Jest\ncategories:\n  - Testing\nintro:\n  Jest is a JavaScript testing framework designed by Facebook. It works out of the box with modern\n  JavaScript apps especially those built with React or Node.js. Its main goal is to simplify testing by providing all required features in one package test runner, assertion library, mocking, spies, coverage reports, and snapshot testing.\n---\n\n---\n\n## A Quick Overview to Jest\n\nJest is a delightful JavaScript testing framework maintained by Facebook. It is widely used for **unit testing**, **integration testing**, and even **end-to-end testing** in modern JavaScript and Node.js applications. Jest comes with a powerful set of features, including a built-in test runner, assertion library, mocking utilities, snapshot testing, and test coverage reporting.\n\nThis guide targets **Jest v20** and gives a concise yet practical overview of how to use it effectively.\n\n### Key Concepts Explained\n\n- **`describe()`**: Used to group related test cases into a test suite.\n- **`test()` / `it()`**: Define a single test case. `it()` is just a BDD-style alias for `test()`.\n- **`expect()`**: Assertion library that checks whether a value meets expectations.\n- **`beforeEach()` / `afterEach()`**: Runs code before or after every test in a suite.\n- **`beforeAll()` / `afterAll()`**: Runs setup/teardown code once before or after all tests.\n- **`.only` / `.skip`**: Focus or ignore specific tests/suites.\n- **Snapshot testing**: Captures the rendered output and compares it across test runs.\n- **Mock functions**: Simulate function behavior or monitor how functions are called.\n- **Timer mocks**: Test time-based behavior like `setTimeout()` and `setInterval()`.\n- **Async testing**: Write tests that handle Promises or `async/await`.\n\n---\n\n### 🚀 Quick Start\n\n```bash\nnpm install --save-dev jest babel-jest\n```\n\nAdd this to your `package.json`:\n\n```json\n\"scripts\": {\n  \"test\": \"jest\"\n}\n```\n\nRun your tests:\n\n```bash\nnpm test -- --watch\n```\n\n📖 See: [Getting Started](https://jestjs.io/docs/getting-started)\n\n---\n\n## ✍️ Writing Tests\n\n```js\ndescribe('My work', () => {\n  test('works', () => {\n    expect(2).toEqual(2);\n  });\n});\n```\n\n- **describe**: Group related tests.\n- **test** or **it**: Define individual test cases.\n- **expect**: Make assertions.\n\n🔄 `it()` is an alias for `test()`.\n\n---\n\n## 🔧 Setup Hooks\n\nUse these for setup/teardown routines:\n\n```js\nbeforeEach(() => { ... });\nafterEach(() => { ... });\nbeforeAll(() => { ... });\nafterAll(() => { ... });\n```\n\n---\n\n## 🎯 Focusing or Skipping Tests\n\n**Focusing tests:**\n\n```js\ndescribe.only(...);\nit.only(...); // or fit()\n```\n\n**Skipping tests:**\n\n```js\ndescribe.skip(...);\nit.skip(...); // or xit()\n```\n\n---\n\n## 🏁 Optional CLI Flags\n\n| Flag                  | Description                             |\n| --------------------- | --------------------------------------- |\n| `--coverage`          | Show test coverage summary              |\n| `--detectOpenHandles` | Detect unclosed handles (e.g., sockets) |\n| `--runInBand`         | Run tests serially (useful for CI)      |\n\n---\n\n## ✅ Expectations (Matchers)\n\n### Basic\n\n```js\nexpect(value).not.toBe(value);\nexpect(value).toEqual(value);\nexpect(value).toBeTruthy();\n```\n\n> Note: `toEqual` performs deep equality.\n\n### Snapshots\n\n```js\nexpect(value).toMatchSnapshot();\nexpect(value).toMatchInlineSnapshot();\n```\n\n> Inline snapshots require Prettier.\n\n### Errors\n\n```js\nexpect(fn).toThrow(error);\nexpect(fn).toThrowErrorMatchingSnapshot();\n```\n\n### Booleans\n\n```js\nexpect(value).toBeFalsy();\nexpect(value).toBeNull();\nexpect(value).toBeTruthy();\nexpect(value).toBeUndefined();\nexpect(value).toBeDefined();\n```\n\n### Numbers\n\n```js\nexpect(value).toBeCloseTo(number, digits);\nexpect(value).toBeGreaterThan(number);\nexpect(value).toBeLessThanOrEqual(number);\n```\n\n### Objects\n\n```js\nexpect(value).toBeInstanceOf(Class);\nexpect(value).toMatchObject(obj);\nexpect(value).toHaveProperty('key', value);\n```\n\n### Arrays/Strings\n\n```js\nexpect(value).toContain(item);\nexpect(value).toHaveLength(number);\nexpect(value).toMatch(/pattern/);\n```\n\n### Custom Matchers\n\n```js\nexpect.extend(customMatchers);\nexpect.any(Constructor);\nexpect.assertions(1);\n```\n\n---\n\n## ⏱️ Async Tests\n\n### Promises\n\n```js\ntest('resolves correctly', () => {\n  return somePromise().then(data => {\n    expect(data).toEqual(...);\n  });\n});\n```\n\n### Async/Await\n\n```js\ntest('awaits correctly', async () => {\n  const result = await asyncFunc();\n  expect(result).toBe(...);\n});\n```\n\n📖 See: [Jest Async Testing](https://jestjs.io/docs/asynchronous)\n\n---\n\n## 📸 Snapshot Testing\n\n```js\nit('renders correctly', () => {\n  const output = something();\n  expect(output).toMatchSnapshot();\n});\n```\n\nFor React components:\n\n```js\nimport renderer from 'react-test-renderer';\n\nit('matches snapshot', () => {\n  const tree = renderer.create(<Component />).toJSON();\n  expect(tree).toMatchSnapshot();\n});\n```\n\n---\n\n## ⏲️ Timers\n\n```js\njest.useFakeTimers();\n\nit('delays call', () => {\n  jest.runOnlyPendingTimers();\n  jest.runAllTimers();\n});\n```\n\n📖 See: [Timer Mocks](https://jestjs.io/docs/timer-mocks)\n\n---\n\n## 🧪 Mock Functions\n\n### Creating Mocks\n\n```js\nconst fn = jest.fn();\nconst squared = jest.fn((n) => n * n);\n```\n\n### Assertions\n\n```js\nexpect(fn).toHaveBeenCalled();\nexpect(fn).toHaveBeenCalledTimes(2);\nexpect(fn).toHaveBeenCalledWith(arg1, arg2);\n```\n\n### Flexible Matchers\n\n```js\nexpect(fn).toHaveBeenCalledWith(expect.any(String));\nexpect(fn).toHaveBeenCalledWith(expect.arrayContaining([1, 2]));\n```\n\n### Instances\n\n```js\nconst MyClass = jest.fn();\nconst a = new MyClass();\nconst b = new MyClass();\nMyClass.mock.instances; // [a, b]\n```\n\n### Call Data\n\n```js\nfn.mock.calls.length;\nfn.mock.calls[0][0];\n```\n\n### Return Values\n\n```js\njest.fn().mockReturnValue('hello');\njest.fn().mockReturnValueOnce('hi');\n```\n\n### Mock Implementations\n\n```js\nconst fn = jest\n  .fn()\n  .mockImplementationOnce(() => 1)\n  .mockImplementationOnce(() => 2);\n```\n\n---\n\nThis comprehensive guide helps you get started with Jest testing or use it like a pro. It pairs perfectly with the React Testing Library for a user-centric testing workflow.\n"
  },
  {
    "path": "source/_posts/jira.md",
    "content": "---\ntitle: Jira\ndate: 2022-11-23 16:23:31.697708\nbackground: bg-[#417eef]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 44 keyboard shortcuts found in Jira\n---\n\n## Keyboard Shortcuts\n\n### Global Shortcuts\n\n| Shortcut                     | Action                           |\n| ---------------------------- | -------------------------------- |\n| `G` `D`                      | Go to Dashboard                  |\n| `G` `P`                      | Browse to a Project              |\n| `G` `A`                      | Go to Agile                      |\n| `G` `I`                      | Go to Issue Navigator            |\n| `G` `G`                      | Administration Search Dialog Box |\n| `/`                          | Quick Search                     |\n| `C`                          | Create an Issue                  |\n| `?`                          | Open shortcut help               |\n| `Ctrl` `Alt` `D`             | Dashboards drop-down menu        |\n| `Ctrl` `Alt` `P`             | Projects drop-down menu          |\n| `Ctrl` `Alt` `I`             | Issues drop-down menu            |\n| `Ctrl` `Alt` `G`             | Agile drop-down menu             |\n| `Ctrl` `Alt` `S`             | Form Submit                      |\n| `Ctrl` `Alt` <code>\\`</code> | Cancel Form                      |\n\n{.shortcuts}\n\n### Agile Shortcuts\n\n| Shortcut | Action                        |\n| -------- | ----------------------------- |\n| `J`      | Next Issue                    |\n| `K`      | Previous Issue                |\n| `N`      | Next Column                   |\n| `P`      | Previous Column               |\n| `-`      | Expand/Collapse All Swimlanes |\n| `T`      | Hide/Show Detail View         |\n| `O`      | View Issue                    |\n| `Enter`  | Add a New Line                |\n| `Enter`  | Submit changes                |\n| `Esc`    | Cancel changes                |\n| `I`      | Assign to Me                  |\n| `S` `T`  | Send to Top                   |\n| `S` `B`  | Send to Bottom                |\n| `E`      | Edit Issue                    |\n| `Z`      | Projector Mode                |\n\n{.shortcuts}\n\n### Issue Actions and Navigator Shortcuts\n\n| Shortcut | Action                 |\n| -------- | ---------------------- |\n| `O`      | View selected issue    |\n| `J`      | Next Issue             |\n| `K`      | Previous Issue         |\n| `U`      | Back to the Navigator  |\n| `[`      | Hide/Show Left Section |\n| `N`      | Next Activity          |\n| `P`      | Previous Activity      |\n| `F`      | Focus search field     |\n| `Esc`    | Escape field           |\n| `E`      | Edit Issue             |\n| `A`      | Assign Issue           |\n| `M`      | Comment on Issue       |\n| `L`      | Edit Issue Labels      |\n| `S`      | Share Issue            |\n| `.`      | Operations dialog box  |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Atlassian's Jira](https://confluence.atlassian.com/agile066/jira-agile-user-s-guide/using-keyboard-shortcuts)\n  _(confluence.atlassian.com)_\n"
  },
  {
    "path": "source/_posts/jquery.md",
    "content": "---\ntitle: jQuery\ndate: 2020-12-24 21:08:21\nbackground: bg-[#2c63a2]\ntags:\n  - web\n  - js\n  - javascript\n  - library\ncategories:\n  - Programming\nintro: |\n  This [jQuery](https://jquery.com/) cheat sheet is a great reference for both beginners and experienced developers.\nplugins:\n  - tooltip\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### Including jQuery\n\n```html {.wrap}\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js\"></script>\n```\n\n#### Official CDN\n\n```html {.wrap}\n<script\n  src=\"https://code.jquery.com/jquery-3.5.1.min.js\"\n  crossorigin=\"anonymous\"\n></script>\n```\n\n### jQuery syntax\n\n```javascript\n$(selector).methodOrFunction();\n```\n\n#### Example:\n\n```javascript\n$('#menu').on('click', function () {\n  $(this).hide();\n});\n\n$('body').css('background', 'red');\n```\n\n### jQuery document ready\n\n```javascript\n$(document).ready(function () {\n  // Runs after the DOM is loaded.\n  alert('DOM fully loaded!');\n});\n```\n\n```javascript\n$(function () {\n  // Runs after the DOM is loaded.\n  alert('DOM fully loaded!');\n});\n```\n\n## jQuery Selectors\n\n### Examples {.secondary}\n\n```javascript\n$('button').click(() => {\n  $(':button').css('color', 'red');\n});\n```\n\n#### Combining selectors\n\n```javascript\n$('selector1, selector2 ...selectorn');\n```\n\n### Basics\n\n<!-- prettier-ignore -->\n- [*](https://api.jquery.com/all-selector/){data-tooltip=\"Selects all elements.\"}\n- [.class](https://api.jquery.com/class-selector/){data-tooltip=\"Selects all elements with the given class. \"}\n- [element](https://api.jquery.com/element-selector/){data-tooltip=\"Selects all elements with the given tag name.\"}\n- [#id](https://api.jquery.com/id-selector/){data-tooltip=\"Selects a single element with the given id attribute. \"}\n- [:hidden](https://api.jquery.com/hidden-selector/){data-tooltip=\"Selects all elements that are hidden.\"}\n- [:visible](https://api.jquery.com/visible-selector/){data-tooltip=\"Selects all elements that are visible.\"}\n- [:contains()](https://api.jquery.com/contains-selector/){data-tooltip=\"Select all elements that contain the specified text.\"}\n- [:empty](https://api.jquery.com/empty-selector/){data-tooltip=\"Select all elements that have no children (including text nodes).\"}\n- [:has()](https://api.jquery.com/has-selector/){data-tooltip=\"Selects elements which contain at least one element that matches the specified selector.\"}\n- [:parent](https://api.jquery.com/parent-selector/){data-tooltip=\"Select all elements that have at least one child node (either an element or text).\"}\n- [parent &gt; child](https://api.jquery.com/child-selector/){data-tooltip=\"Selects all direct child elements specified by child of elements specified by parent.\"}\n- [ancestor descendant](https://api.jquery.com/descendant-selector/){data-tooltip=\"Selects all elements that are descendants of a given ancestor.\"}\n- [prev + next](https://api.jquery.com/next-adjacent-selector/){data-tooltip=\"Selects all next elements matching next that are immediately preceded by a sibling prev.\"}\n- [prev ~ siblings](https://api.jquery.com/next-siblings-selector/){data-tooltip=\"Selects all sibling elements that follow after the prev element, have the same parent, and match the filtering siblings selector.\"}\n\n{.marker-none .cols-3}\n\n### Basic Filters\n\n<!-- prettier-ignore -->\n- [:animated](https://api.jquery.com/animated-selector/){data-tooltip=\"Select all elements that are in the progress of an animation at the time the selector is run.\"}\n- [:eq()](https://api.jquery.com/eq-selector/){data-tooltip=\"Select the element at index n within the matched set.\"}\n- [:even](https://api.jquery.com/even-selector/){data-tooltip=\"Selects even elements, zero-indexed.  See also :odd.\"}\n- [:first](https://api.jquery.com/first-selector/){data-tooltip=\"Selects the first matched DOM element.\"}\n- [:gt()](https://api.jquery.com/gt-selector/){data-tooltip=\"Select all elements at an index greater than index within the matched set.\"}\n- [:header](https://api.jquery.com/header-selector/){data-tooltip=\"Selects all elements that are headers, like h1, h2, h3 and so on.\"}\n- [:lang()](https://api.jquery.com/lang-selector/){data-tooltip=\"Selects all elements of the specified language.\"}\n- [:last](https://api.jquery.com/last-selector/){data-tooltip=\"Selects the last matched element.\"}\n- [:lt()](https://api.jquery.com/lt-selector/){data-tooltip=\"Select all elements at an index less than index within the matched set.\"}\n- [:not()](https://api.jquery.com/not-selector/){data-tooltip=\"Selects all elements that do not match the given selector.\"}\n- [:odd](https://api.jquery.com/odd-selector/){data-tooltip=\"Selects odd elements, zero-indexed.  See also :even.\"}\n- [:root](https://api.jquery.com/root-selector/){data-tooltip=\"Selects the element that is the root of the document.\"}\n- [:target](https://api.jquery.com/target-selector/){data-tooltip=\"Selects the target element indicated by the fragment identifier of the document&apos;s URI.\"}\n\n{.marker-none .cols-3}\n\n### Attribute\n\n<!-- prettier-ignore -->\n- [[name|=\"value\"]](https://api.jquery.com/attribute-contains-prefix-selector/){data-tooltip=\"Selects elements that have the specified attribute with a value either equal to a given string or starting with that string followed by a hyphen (-).\"}\n- [[name*=\"value\"]](https://api.jquery.com/attribute-contains-selector/){data-tooltip=\"Selects elements that have the specified attribute with a value containing a given substring.\"}\n- [[name~=\"value\"]](https://api.jquery.com/attribute-contains-word-selector/){data-tooltip=\"Selects elements that have the specified attribute with a value containing a given word, delimited by spaces.\"}\n- [[name$=\"value\"]](https://api.jquery.com/attribute-ends-with-selector/){data-tooltip=\"Selects elements that have the specified attribute with a value ending exactly with a given string. The comparison is case sensitive.\"}\n- [[name=\"value\"]](https://api.jquery.com/attribute-equals-selector/){data-tooltip=\"Selects elements that have the specified attribute with a value exactly equal to a certain value.\"}\n- [[name!=\"value\"]](https://api.jquery.com/attribute-not-equal-selector/){data-tooltip=\"Select elements that either don&apos;t have the specified attribute, or do have the specified attribute but not with a certain value.\"}\n- [[name^=\"value\"]](https://api.jquery.com/attribute-starts-with-selector/){data-tooltip=\"Selects elements that have the specified attribute with a value beginning exactly with a given string.\"}\n- [[name]](https://api.jquery.com/has-attribute-selector/){data-tooltip=\"Selects elements that have the specified attribute, with any value. \"}\n- [[name=\"value\"][name2=\"value2\"]](https://api.jquery.com/multiple-attribute-selector/){data-tooltip=\"Matches elements that match all of the specified attribute filters.\"} {.col-span-2}\n\n{.marker-none .cols-2}\n\n### Child Filters\n\n<!-- prettier-ignore -->\n- [:first-child](https://api.jquery.com/first-child-selector/){data-tooltip=\"Selects all elements that are the first child of their parent.\"}\n- [:first-of-type](https://api.jquery.com/first-of-type-selector/){data-tooltip=\"Selects all elements that are the first among siblings of the same element name.\"}\n- [:last-child](https://api.jquery.com/last-child-selector/){data-tooltip=\"Selects all elements that are the last child of their parent.\"}\n- [:last-of-type](https://api.jquery.com/last-of-type-selector/){data-tooltip=\"Selects all elements that are the last among siblings of the same element name.\"}\n- [:nth-child()](https://api.jquery.com/nth-child-selector/){data-tooltip=\"Selects all elements that are the nth-child of their parent.\"}\n- [:nth-last-child()](https://api.jquery.com/nth-last-child-selector/){data-tooltip=\"Selects all elements that are the nth-child of their parent, counting from the last element to the first.\"}\n- [:nth-last-of-type()](https://api.jquery.com/nth-last-of-type-selector/){data-tooltip=\"Selects all the elements that are the nth-child of their parent in relation to siblings with the same element name, counting from the last element to the first.\"}\n- [:nth-of-type()](https://api.jquery.com/nth-of-type-selector/){data-tooltip=\"Selects all elements that are the nth child of their parent in relation to siblings with the same element name.\"}\n- [:only-child](https://api.jquery.com/only-child-selector/){data-tooltip=\"Selects all elements that are the only child of their parent.\"}\n- [:only-of-type()](https://api.jquery.com/only-of-type-selector/){data-tooltip=\"Selects all elements that have no siblings with the same element name.\"}\n\n{.marker-none .cols-2}\n\n### Forms\n\n<!-- prettier-ignore -->\n- [:button](https://api.jquery.com/button-selector/){data-tooltip=\"Selects all button elements and elements of type button.\"}\n- [:checkbox](https://api.jquery.com/checkbox-selector/){data-tooltip=\"Selects all elements of type checkbox.\"}\n- [:checked](https://api.jquery.com/checked-selector/){data-tooltip=\"Matches all elements that are checked or selected.\"}\n- [:disabled](https://api.jquery.com/disabled-selector/){data-tooltip=\"Selects all elements that are disabled.\"}\n- [:enabled](https://api.jquery.com/enabled-selector/){data-tooltip=\"Selects all elements that are enabled.\"}\n- [:focus](https://api.jquery.com/focus-selector/){data-tooltip=\"Selects element if it is currently focused.\"}\n- [:file](https://api.jquery.com/file-selector/){data-tooltip=\"Selects all elements of type file.\"}\n- [:image](https://api.jquery.com/image-selector/){data-tooltip=\"Selects all elements of type image.\"}\n- [:input](https://api.jquery.com/input-selector/){data-tooltip=\"Selects all input, textarea, select and button elements.\"}\n- [:password](https://api.jquery.com/password-selector/){data-tooltip=\"Selects all elements of type password.\"}\n- [:radio](https://api.jquery.com/radio-selector/){data-tooltip=\"Selects all  elements of type radio.\"}\n- [:reset](https://api.jquery.com/reset-selector/){data-tooltip=\"Selects all elements of type reset.\"}\n- [:selected](https://api.jquery.com/selected-selector/){data-tooltip=\"Selects all elements that are selected.\"}\n- [:submit](https://api.jquery.com/submit-selector/){data-tooltip=\"Selects all elements of type submit.\"}\n- [:text](https://api.jquery.com/text-selector/){data-tooltip=\"Selects all input elements of type text.\"}\n\n{.marker-none .cols-3}\n\n## jQuery Attributes\n\n### Examples {.secondary .row-span-2}\n\n```javascript\n$('h2').css({\n  color: 'blue',\n  backgroundColor: 'gray',\n  fontSize: '24px'\n});\n```\n\n#### jQuery addClass\n\n```javascript\n$('.button').addClass('active');\n```\n\n#### jQuery removeClass\n\n```javascript\n$('.button').on('mouseleave', (evt) => {\n  let e = evt.currentTarget;\n  $(e).removeClass('active');\n});\n```\n\n#### jQuery .toggleClass\n\n```javascript\n$('.choice').toggleClass('highlighted');\n```\n\n### Attributes\n\n<!-- prettier-ignore -->\n- [.attr()](https://api.jquery.com/attr/){data-tooltip=\"Get the value of an attribute for the first element in the set of matched elements.\"}\n- [.prop()](https://api.jquery.com/prop/){data-tooltip=\"Get the value of a property for the first element in the set of matched elements.\"}\n- [.removeAttr()](https://api.jquery.com/removeAttr/){data-tooltip=\"Remove an attribute from each element in the set of matched elements.\"}\n- [.removeProp()](https://api.jquery.com/removeProp/){data-tooltip=\"Remove a property for the set of matched elements.\"}\n- [.val()](https://api.jquery.com/val/){data-tooltip=\"Get the current value of the first element in the set of matched elements.\"}\n\n{.marker-none .cols-2}\n\n#### Data\n\n<!-- prettier-ignore -->\n- [jQuery.data()](https://api.jquery.com/jQuery.data/){data-tooltip=\"Store arbitrary data associated with the specified element. Returns the value that was set.\"}\n- [.data()](https://api.jquery.com/data/){data-tooltip=\"Store arbitrary data associated with the matched elements.\"}\n- [jQuery.hasData()](https://api.jquery.com/jQuery.hasData/){data-tooltip=\"Determine whether an element has any jQuery data associated with it.\"}\n- [jQuery.removeData()](https://api.jquery.com/jQuery.removeData/){data-tooltip=\"Remove a previously-stored piece of data.\"}\n- [.removeData()](https://api.jquery.com/removeData/){data-tooltip=\"Remove a previously-stored piece of data.\"}\n\n{.marker-none .cols-2}\n\n### CSS\n\n<!-- prettier-ignore -->\n- [.addClass()](https://api.jquery.com/addClass/){data-tooltip=\"Adds the specified class(es) to each element in the set of matched elements.\"}\n- [.hasClass()](https://api.jquery.com/hasClass/){data-tooltip=\"Determine whether any of the matched elements are assigned the given class.\"}\n- [.removeClass()](https://api.jquery.com/removeClass/){data-tooltip=\"Remove a single class, multiple classes, or all classes from each element in the set of matched elements.\"}\n- [.toggleClass()](https://api.jquery.com/toggleClass/){data-tooltip=\"Add or remove one or more classes from each element in the set of matched elements, depending on either the class&apos;s presence or the value of the state argument.\"}\n- [.css()](https://api.jquery.com/css/){data-tooltip=\"Get the computed style properties for the first element in the set of matched elements.\"}\n- [jQuery.cssHooks](https://api.jquery.com/jQuery.cssHooks/){data-tooltip=\"Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties.\"}\n- [jQuery.cssNumber](https://api.jquery.com/jQuery.cssNumber/){data-tooltip=\"An object containing all CSS properties that may be used without a unit. The .css() method uses this object to see if it may append px to unitless values.\"}\n- [jQuery.escapeSelector()](https://api.jquery.com/jQuery.escapeSelector/){data-tooltip=\"Escapes any character that has a special meaning in a CSS selector.\"}\n\n{.marker-none .cols-2}\n\n### Dimensions\n\n<!-- prettier-ignore -->\n- [.height()](https://api.jquery.com/height/){data-tooltip=\"Get the current computed height for the first element in the set of matched elements.\"}\n- [.innerHeight()](https://api.jquery.com/innerHeight/){data-tooltip=\"Get the current computed height for the first element in the set of matched elements, including padding but not border.\"}\n- [.innerWidth()](https://api.jquery.com/innerWidth/){data-tooltip=\"Get the current computed inner width for the first element in the set of matched elements, including padding but not border.\"}\n- [.outerHeight()](https://api.jquery.com/outerHeight/){data-tooltip=\"Get the current computed outer height (including padding, border, and optionally margin) for the first element in the set of matched elements.\"}\n- [.outerWidth()](https://api.jquery.com/outerWidth/){data-tooltip=\"Get the current computed outer width (including padding, border, and optionally margin) for the first element in the set of matched elements.\"}\n- [.width()](https://api.jquery.com/width/){data-tooltip=\"Get the current computed width for the first element in the set of matched elements.\"}\n\n{.marker-none .cols-2}\n\n### Offset\n\n<!-- prettier-ignore -->\n- [.offset()](https://api.jquery.com/offset/){data-tooltip=\"Get the current coordinates of the first element in the set of matched elements, relative to the document.\"}\n- [.offsetParent()](https://api.jquery.com/offsetParent/){data-tooltip=\"Get the closest ancestor element that is positioned.\"}\n- [.position()](https://api.jquery.com/position/){data-tooltip=\"Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.\"}\n- [.scrollLeft()](https://api.jquery.com/scrollLeft/){data-tooltip=\"Get the current horizontal position of the scroll bar for the first element in the set of matched elements.\"}\n- [.scrollTop()](https://api.jquery.com/scrollTop/){data-tooltip=\"Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element.\"}\n\n{.marker-none .cols-2}\n\n## jQuery Manipulation\n\n### Examples {.secondary .row-span-3}\n\n```javascript\n/*<span>Span.</span>*/\n$('span').after('<p>Paragraph.</p>');\n/*<span>Span.</span><p>Paragraph.</p>*/\n\n/*<span>Span.</span>*/\n$('<span>Span.</span>').replaceAll('p');\n/*<p>Span.</p>*/\n\n/*<span>This is span.</span>*/\n$('span').wrap('<p></p>');\n/*<p><span>This is span.</span></p>*/\n```\n\n### Copying\n\n<!-- prettier-ignore -->\n- [.clone()](https://api.jquery.com/clone/){data-tooltip=\"Create a deep copy of the set of matched elements.\"}\n\n{.marker-none .cols-3}\n\n### DOM Insertion, Around\n\n<!-- prettier-ignore -->\n- [.wrap()](https://api.jquery.com/wrap/){data-tooltip=\"Wrap an HTML structure around each element in the set of matched elements.\"}\n- [.wrapAll()](https://api.jquery.com/wrapAll/){data-tooltip=\"Wrap an HTML structure around all elements in the set of matched elements.\"}\n- [.wrapInner()](https://api.jquery.com/wrapInner/){data-tooltip=\"Wrap an HTML structure around the content of each element in the set of matched elements.\"}\n\n{.marker-none .cols-3}\n\n### DOM Insertion, Inside\n\n<!-- prettier-ignore -->\n- [.append()](https://api.jquery.com/append/){data-tooltip=\"Insert content, specified by the parameter, to the end of each element in the set of matched elements.\"}\n- [.appendTo()](https://api.jquery.com/appendTo/){data-tooltip=\"Insert every element in the set of matched elements to the end of the target.\"}\n- [.html()](https://api.jquery.com/html/){data-tooltip=\"Get the HTML contents of the first element in the set of matched elements.\"}\n- [.prepend()](https://api.jquery.com/prepend/){data-tooltip=\"Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.\"}\n- [.prependTo()](https://api.jquery.com/prependTo/){data-tooltip=\"Insert every element in the set of matched elements to the beginning of the target.\"}\n- [.text()](https://api.jquery.com/text/){data-tooltip=\"Get the combined text contents of each element in the set of matched elements, including their descendants.\"}\n{.marker-none .cols-3}\n\n### DOM Insertion, Outside\n\n<!-- prettier-ignore -->\n- [.after()](https://api.jquery.com/after/){data-tooltip=\"Insert content, specified by the parameter, after each element in the set of matched elements.\"}\n- [.before()](https://api.jquery.com/before/){data-tooltip=\"Insert content, specified by the parameter, before each element in the set of matched elements.\"}\n- [.insertAfter()](https://api.jquery.com/insertAfter/){data-tooltip=\"Insert every element in the set of matched elements after the target.\"}\n- [.insertBefore()](https://api.jquery.com/insertBefore/){data-tooltip=\"Insert every element in the set of matched elements before the target.\"}\n\n{.marker-none .cols-3}\n\n### DOM Removal\n\n<!-- prettier-ignore -->\n- [.detach()](https://api.jquery.com/detach/){data-tooltip=\"Remove the set of matched elements from the DOM.\"}\n- [.empty()](https://api.jquery.com/empty/){data-tooltip=\"Remove all child nodes of the set of matched elements from the DOM.\"}\n- [.remove()](https://api.jquery.com/remove/){data-tooltip=\"Remove the set of matched elements from the DOM.\"}\n- [.unwrap()](https://api.jquery.com/unwrap/){data-tooltip=\"Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.\"}\n\n{.marker-none .cols-3}\n\n### DOM Replacement\n\n<!-- prettier-ignore -->\n- [.replaceAll()](https://api.jquery.com/replaceAll/){data-tooltip=\"Replace each target element with the set of matched elements.\"}\n- [.replaceWith()](https://api.jquery.com/replaceWith/){data-tooltip=\"Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.\"}\n\n{.marker-none .cols-3}\n\n## jQuery Traversing\n\n### Filtering\n\n<!-- prettier-ignore -->\n- [.eq()](https://api.jquery.com/eq/){data-tooltip=\"Reduce the set of matched elements to the one at the specified index.\"}\n- [.filter()](https://api.jquery.com/filter/){data-tooltip=\"Reduce the set of matched elements to those that match the selector or pass the function&apos;s test. \"}\n- [.first()](https://api.jquery.com/first/){data-tooltip=\"Reduce the set of matched elements to the first in the set.\"}\n- [.has()](https://api.jquery.com/has/){data-tooltip=\"Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.\"}\n- [.is()](https://api.jquery.com/is/){data-tooltip=\"Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.\"}\n- [.last()](https://api.jquery.com/last/){data-tooltip=\"Reduce the set of matched elements to the final one in the set.\"}\n- [.map()](https://api.jquery.com/map/){data-tooltip=\"Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.\"}\n- [.not()](https://api.jquery.com/not/){data-tooltip=\"Remove elements from the set of matched elements.\"}\n- [.slice()](https://api.jquery.com/slice/){data-tooltip=\"Reduce the set of matched elements to a subset specified by a range of indices.\"}\n\n{.marker-none .cols-3}\n\n### Miscellaneous Traversing\n\n<!-- prettier-ignore -->\n- [.add()](https://api.jquery.com/add/){data-tooltip=\"Create a new jQuery object with elements added to the set of matched elements.\"}\n- [.addBack()](https://api.jquery.com/addBack/){data-tooltip=\"Add the previous set of elements on the stack to the current set, optionally filtered by a selector.\"}\n- [.andSelf()](https://api.jquery.com/andSelf/){data-tooltip=\"Add the previous set of elements on the stack to the current set.\"}\n- [.contents()](https://api.jquery.com/contents/){data-tooltip=\"Get the children of each element in the set of matched elements, including text and comment nodes.\"}\n- [.each()](https://api.jquery.com/each/){data-tooltip=\"Iterate over a jQuery object, executing a function for each matched element. \"}\n- [.end()](https://api.jquery.com/end/){data-tooltip=\"End the most recent filtering operation in the current chain and return the set of matched elements to its previous state.\"}\n\n{.marker-none .cols-3}\n\n### Tree Traversal\n\n<!-- prettier-ignore -->\n- [.children()](https://api.jquery.com/children/){data-tooltip=\"Get the children of each element in the set of matched elements, optionally filtered by a selector.\"}\n- [.closest()](https://api.jquery.com/closest/){data-tooltip=\"For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.\"}\n- [.find()](https://api.jquery.com/find/){data-tooltip=\"Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.\"}\n- [.next()](https://api.jquery.com/next/){data-tooltip=\"Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.\"}\n- [.nextAll()](https://api.jquery.com/nextAll/){data-tooltip=\"Get all following siblings of each element in the set of matched elements, optionally filtered by a selector.\"}\n- [.nextUntil()](https://api.jquery.com/nextUntil/){data-tooltip=\"Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed.\"}\n- [.parent()](https://api.jquery.com/parent/){data-tooltip=\"Get the parent of each element in the current set of matched elements, optionally filtered by a selector.\"}\n- [.parents()](https://api.jquery.com/parents/){data-tooltip=\"Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector.\"}\n- [.parentsUntil()](https://api.jquery.com/parentsUntil/){data-tooltip=\"Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object.\"}\n- [.prev()](https://api.jquery.com/prev/){data-tooltip=\"Get the immediately preceding sibling of each element in the set of matched elements. If a selector is provided, it retrieves the previous sibling only if it matches that selector.\"}\n- [.prevAll()](https://api.jquery.com/prevAll/){data-tooltip=\"Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector.\"}\n- [.prevUntil()](https://api.jquery.com/prevUntil/){data-tooltip=\"Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.\"}\n- [.siblings()](https://api.jquery.com/siblings/){data-tooltip=\"Get the siblings of each element in the set of matched elements, optionally filtered by a selector.\"}\n\n{.marker-none .cols-3}\n\n## jQuery Events\n\n### Examples {.secondary .row-span-6}\n\n```javascript\n// A mouse event 'click'\n$('#menu-button').on('click', () => {\n  $('#menu').show();\n});\n\n// A keyboard event 'keyup'\n$('#textbox').on('keyup', () => {\n  $('#menu').show();\n});\n\n// A scroll event 'scroll'\n$('#menu-button').on('scroll', () => {\n  $('#menu').show();\n});\n```\n\n#### Event object\n\n```javascript\n$('#menu').on('click', (event) => {\n  $(event.currentTarget).hide();\n});\n```\n\n#### Method chaining\n\n```javascript\n$('#menu-btn')\n  .on('mouseenter', () => {\n    $('#menu').show();\n  })\n  .on('mouseleave', () => {\n    $('#menu').hide();\n  });\n```\n\n#### Prevents the event\n\n```javascript\n$('p').click(function (event) {\n  event.stopPropagation();\n  // Do something\n});\n```\n\n### Browser Events\n\n<!-- prettier-ignore -->\n- [.error()](https://api.jquery.com/error/){data-tooltip=\"Bind an event handler to the error JavaScript event.\"}\n- [.resize()](https://api.jquery.com/resize/){data-tooltip=\"Bind an event handler to the resize JavaScript event, or trigger that event on an element.\"}\n- [.scroll()](https://api.jquery.com/scroll/){data-tooltip=\"Bind an event handler to the scroll JavaScript event, or trigger that event on an element.\"}\n\n{.marker-none .cols-3}\n\n### Event Object {.row-span-6}\n\n<!-- prettier-ignore -->\n- [event.currentTarget](https://api.jquery.com/event.currentTarget/){data-tooltip=\" The current DOM element within the event bubbling phase.  \"}\n- [event.delegateTarget](https://api.jquery.com/event.delegateTarget/){data-tooltip=\"The element where the currently-called jQuery event handler was attached.\"}\n- [event.data](https://api.jquery.com/event.data/){data-tooltip=\"An optional object of data passed to an event method when the current executing handler is bound.  \"}\n- [event.isDefaultPrevented()](https://api.jquery.com/event.isDefaultPrevented/){data-tooltip=\"Returns whether event.preventDefault() was ever called on this event object. \"}\n- [event.isImmediatePropagationStopped()](https://api.jquery.com/event.isImmediatePropagationStopped/){data-tooltip=\"  Returns whether event.stopImmediatePropagation() was ever called on this event object. \"}\n- [event.isPropagationStopped()](https://api.jquery.com/event.isPropagationStopped/){data-tooltip=\"  Returns whether event.stopPropagation() was ever called on this event object. \"}\n- [event.metaKey](https://api.jquery.com/event.metaKey/){data-tooltip=\"Indicates whether the META key was pressed when the event fired.\"}\n- [event.namespace](https://api.jquery.com/event.namespace/){data-tooltip=\"The namespace specified when the event was triggered.\"}\n- [event.pageX](https://api.jquery.com/event.pageX/){data-tooltip=\"The mouse position relative to the left edge of the document.\"}\n- [event.pageY](https://api.jquery.com/event.pageY/){data-tooltip=\"The mouse position relative to the top edge of the document.\"}\n- [event.preventDefault()](https://api.jquery.com/event.preventDefault/){data-tooltip=\"If this method is called, the default action of the event will not be triggered.\"}\n- [event.relatedTarget](https://api.jquery.com/event.relatedTarget/){data-tooltip=\"The other DOM element involved in the event, if any.\"}\n- [event.result](https://api.jquery.com/event.result/){data-tooltip=\"The last value returned by an event handler that was triggered by this event, unless the value was undefined.\"}\n- [event.stopImmediatePropagation()](https://api.jquery.com/event.stopImmediatePropagation/){data-tooltip=\"Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree.\"}\n- [event.stopPropagation()](https://api.jquery.com/event.stopPropagation/){data-tooltip=\"Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.\"}\n- [event.target](https://api.jquery.com/event.target/){data-tooltip=\" The DOM element that initiated the event.  \"}\n- [event.timeStamp](https://api.jquery.com/event.timeStamp/){data-tooltip=\"The difference in milliseconds between the time the browser created the event and January 1, 1970.\"}\n- [event.type](https://api.jquery.com/event.type/){data-tooltip=\"Describes the nature of the event.\"}\n- [event.which](https://api.jquery.com/event.which/){data-tooltip=\"For key or mouse events, this property indicates the specific key or button that was pressed.\"}\n\n{.marker-none .cols-1}\n\n### Document Loading\n\n<!-- prettier-ignore -->\n- [.load()](https://api.jquery.com/load-event/){data-tooltip=\"Bind an event handler to the load JavaScript event.\"}\n- [.ready()](https://api.jquery.com/ready/){data-tooltip=\"Specify a function to execute when the DOM is fully loaded.\"}\n- [.unload()](https://api.jquery.com/unload/){data-tooltip=\"Bind an event handler to the unload JavaScript event.\"}\n\n{.marker-none .cols-3}\n\n### Event Handler Attachment\n\n<!-- prettier-ignore -->\n- [.bind()](https://api.jquery.com/bind/){data-tooltip=\"Attach a handler to an event for the elements.\"}\n- [.delegate()](https://api.jquery.com/delegate/){data-tooltip=\"Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.\"}\n- [.die()](https://api.jquery.com/die/){data-tooltip=\"Remove event handlers previously attached using .live() from the elements.\"}\n- [.live()](https://api.jquery.com/live/){data-tooltip=\"Attach an event handler for all elements which match the current selector, now and in the future.\"}\n- [.off()](https://api.jquery.com/off/){data-tooltip=\"Remove an event handler.\"}\n- [.on()](https://api.jquery.com/on/){data-tooltip=\"Attach an event handler function for one or more events to the selected elements.\"}\n- [.one()](https://api.jquery.com/one/){data-tooltip=\"Attach a handler to an event for the elements. The handler is executed at most once per element per event type.\"}\n- [.trigger()](https://api.jquery.com/trigger/){data-tooltip=\"Execute all handlers and behaviors attached to the matched elements for the given event type.\"}\n- [.triggerHandler()](https://api.jquery.com/triggerHandler/){data-tooltip=\"Execute all handlers attached to an element for an event.\"}\n- [.unbind()](https://api.jquery.com/unbind/){data-tooltip=\"Remove a previously-attached event handler from the elements.\"}\n- [.undelegate()](https://api.jquery.com/undelegate/){data-tooltip=\"Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.\"}\n\n{.marker-none .cols-3}\n\n### Form Events\n\n<!-- prettier-ignore -->\n- [.blur()](https://api.jquery.com/blur/){data-tooltip=\"Bind an event handler to the blur JavaScript event, or trigger that event on an element.\"}\n- [.change()](https://api.jquery.com/change/){data-tooltip=\"Bind an event handler to the change JavaScript event, or trigger that event on an element.\"}\n- [.focus()](https://api.jquery.com/focus/){data-tooltip=\"Bind an event handler to the focus JavaScript event, or trigger that event on an element.\"}\n- [.focusin()](https://api.jquery.com/focusin/){data-tooltip=\"Bind an event handler to the focusin event.\"}\n- [.focusout()](https://api.jquery.com/focusout/){data-tooltip=\"Bind an event handler to the focusout JavaScript event.\"}\n- [.select()](https://api.jquery.com/select/){data-tooltip=\"Bind an event handler to the select JavaScript event, or trigger that event on an element.\"}\n- [.submit()](https://api.jquery.com/submit/){data-tooltip=\"Bind an event handler to the submit JavaScript event, or trigger that event on an element.\"}\n\n{.marker-none .cols-3}\n\n### Keyboard Events\n\n<!-- prettier-ignore -->\n- [.keydown()](https://api.jquery.com/keydown/){data-tooltip=\"Bind an event handler to the keydown JavaScript event, or trigger that event on an element.\"}\n- [.keypress()](https://api.jquery.com/keypress/){data-tooltip=\"Bind an event handler to the keypress JavaScript event, or trigger that event on an element.\"}\n- [.keyup()](https://api.jquery.com/keyup/){data-tooltip=\"Bind an event handler to the keyup JavaScript event, or trigger that event on an element.\"}\n{.marker-none .cols-3}\n\n### Mouse Events\n\n<!-- prettier-ignore -->\n- [.click()](https://api.jquery.com/click/){data-tooltip=\"Bind an event handler to the click JavaScript event, or trigger that event on an element.\"}\n- [.contextMenu()](https://api.jquery.com/contextmenu/){data-tooltip=\"Bind an event handler to the contextmenu JavaScript event, or trigger that event on an element.\"}\n- [.dblclick()](https://api.jquery.com/dblclick/){data-tooltip=\"Bind an event handler to the dblclick JavaScript event, or trigger that event on an element.\"}\n- [.hover()](https://api.jquery.com/hover/){data-tooltip=\"Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.\"}\n- [.mousedown()](https://api.jquery.com/mousedown/){data-tooltip=\"Bind an event handler to the mousedown JavaScript event, or trigger that event on an element.\"}\n- [.mouseenter()](https://api.jquery.com/mouseenter/){data-tooltip=\"Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element.\"}\n- [.mouseleave()](https://api.jquery.com/mouseleave/){data-tooltip=\"Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element.\"}\n- [.mousemove()](https://api.jquery.com/mousemove/){data-tooltip=\"Bind an event handler to the mousemove JavaScript event, or trigger that event on an element.\"}\n- [.mouseout()](https://api.jquery.com/mouseout/){data-tooltip=\"Bind an event handler to the mouseout JavaScript event, or trigger that event on an element.\"}\n- [.mouseover()](https://api.jquery.com/mouseover/){data-tooltip=\"Bind an event handler to the mouseover JavaScript event, or trigger that event on an element.\"}\n- [.mouseup()](https://api.jquery.com/mouseup/){data-tooltip=\"Bind an event handler to the mouseup JavaScript event, or trigger that event on an element.\"}\n- [.toggle()](https://api.jquery.com/toggle-event/){data-tooltip=\"Bind two or more handlers to the matched elements, to be executed on alternate clicks.\"}\n\n{.marker-none .cols-3}\n\n## jQuery Effects\n\n### Examples {.secondary .row-span-2}\n\n```javascript\n$('#menu-button').on('click', () => {\n  // $('#menu').fadeIn(400, 'swing')\n  $('#menu').fadeIn();\n});\n```\n\n#### fadeOut effect\n\n```javascript\n$('#menu-button').on('click', () => {\n  // $('#menu').fadeOut(400, 'swing')\n  $('#menu').fadeOut();\n});\n```\n\n### Basics\n\n<!-- prettier-ignore -->\n- [.hide()](https://api.jquery.com/hide/){data-tooltip=\"Hide the matched elements.\"}\n- [.show()](https://api.jquery.com/show/){data-tooltip=\"Display the matched elements.\"}\n- [.toggle()](https://api.jquery.com/toggle/){data-tooltip=\"Display or hide the matched elements.\"}\n\n{.marker-none .cols-3}\n\n### Sliding\n\n<!-- prettier-ignore -->\n- [.slideDown()](https://api.jquery.com/slideDown/){data-tooltip=\"Display the matched elements with a sliding motion.\"}\n- [.slideToggle()](https://api.jquery.com/slideToggle/){data-tooltip=\"Display or hide the matched elements with a sliding motion.\"}\n- [.slideUp()](https://api.jquery.com/slideUp/){data-tooltip=\"Hide the matched elements with a sliding motion.\"}\n\n{.marker-none .cols-3}\n\n### Custom\n\n<!-- prettier-ignore -->\n- [.animate()](https://api.jquery.com/animate/){data-tooltip=\"Perform a custom animation of a set of CSS properties.\"}\n- [.clearQueue()](https://api.jquery.com/clearQueue/){data-tooltip=\"Remove from the queue all items that have not yet been run.\"}\n- [.delay()](https://api.jquery.com/delay/){data-tooltip=\"Set a timer to delay execution of subsequent items in the queue.\"}\n- [.dequeue()](https://api.jquery.com/dequeue/){data-tooltip=\"Execute the next function on the queue for the matched elements.\"}\n- [jQuery.dequeue()](https://api.jquery.com/jQuery.dequeue/){data-tooltip=\"Execute the next function on the queue for the matched element.\"}\n- [.finish()](https://api.jquery.com/finish/){data-tooltip=\"Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements.\"}\n- [jQuery.fx.interval](https://api.jquery.com/jQuery.fx.interval/){data-tooltip=\"The rate (in milliseconds) at which animations fire.\"}\n- [jQuery.fx.off](https://api.jquery.com/jQuery.fx.off/){data-tooltip=\"Globally disable all animations.\"}\n- [jQuery.speed](https://api.jquery.com/jQuery.speed/){data-tooltip=\"Creates an object containing a set of properties ready to be used in the definition of custom animations.\"}\n- [.queue()](https://api.jquery.com/queue/){data-tooltip=\"Show the queue of functions to be executed on the matched elements.\"}\n- [jQuery.queue()](https://api.jquery.com/jQuery.queue/){data-tooltip=\"Show the queue of functions to be executed on the matched element.\"}\n- [.stop()](https://api.jquery.com/stop/){data-tooltip=\"Stop the currently-running animation on the matched elements.\"}\n\n{.marker-none .cols-3}\n\n### Fading\n\n<!-- prettier-ignore -->\n- [.fadeIn()](https://api.jquery.com/fadeIn/){data-tooltip=\"Display the matched elements by fading them to opaque.\"}\n- [.fadeOut()](https://api.jquery.com/fadeOut/){data-tooltip=\"Hide the matched elements by fading them to transparent.\"}\n- [.fadeTo()](https://api.jquery.com/fadeTo/){data-tooltip=\"Adjust the opacity of the matched elements.\"}\n- [.fadeToggle()](https://api.jquery.com/fadeToggle/){data-tooltip=\"Display or hide the matched elements by animating their opacity.\"}\n\n{.marker-none .cols-3}\n\n## jQuery Ajax\n\n### Examples {.secondary .row-span-2}\n\n```javascript\n$.ajax({\n  url: this.action,\n  type: this.method,\n  data: $(this).serialize()\n})\n  .done(function (server_data) {\n    console.log('success' + server_data);\n  })\n  .fail(function (jqXHR, status, err) {\n    console.log('fail' + err);\n  });\n```\n\n### Global Ajax Event Handlers\n\n<!-- prettier-ignore -->\n- [.ajaxComplete()](https://api.jquery.com/ajaxComplete/){data-tooltip=\"Register a handler to be called when Ajax requests complete. This is an AjaxEvent.\"}\n- [.ajaxError()](https://api.jquery.com/ajaxError/){data-tooltip=\"Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event.\"}\n- [.ajaxSend()](https://api.jquery.com/ajaxSend/){data-tooltip=\"Attach a function to be executed before an Ajax request is sent. This is an Ajax Event.\"}\n- [.ajaxStart()](https://api.jquery.com/ajaxStart/){data-tooltip=\"Register a handler to be called when the first Ajax request begins. This is an Ajax Event.\"}\n- [.ajaxStop()](https://api.jquery.com/ajaxStop/){data-tooltip=\"Register a handler to be called when all Ajax requests have completed. This is an Ajax Event.\"}\n- [.ajaxSuccess()](https://api.jquery.com/ajaxSuccess/){data-tooltip=\"Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event.\"}\n\n{.marker-none .cols-2}\n\n### Helper Functions\n\n<!-- prettier-ignore -->\n- [jQuery.param()](https://api.jquery.com/jQuery.param/){data-tooltip=\"Create a serialized representation of an array, a plain object, or a jQuery object suitable for use in a URL query string or Ajax request. In case a jQuery object is passed, it should contain input elements with name/value properties.\"}\n- [.serialize()](https://api.jquery.com/serialize/){data-tooltip=\"Encode a set of form elements as a string for submission.\"}\n- [.serializeArray()](https://api.jquery.com/serializeArray/){data-tooltip=\"Encode a set of form elements as an array of names and values.\"}\n\n{.marker-none .cols-2}\n\n### Low-Level Interface\n\n<!-- prettier-ignore -->\n- [jQuery.ajax()](https://api.jquery.com/jQuery.ajax/){data-tooltip=\"Perform an asynchronous HTTP (Ajax) request.\"}\n- [jQuery.prefilter()](https://api.jquery.com/jQuery.ajaxPrefilter/){data-tooltip=\"Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().\"}\n- [jQuery.ajaxSetup()](https://api.jquery.com/jQuery.ajaxSetup/){data-tooltip=\"Set default values for future Ajax requests. Its use is not recommended.\"}\n- [jQuery.ajaxTransport()](https://api.jquery.com/jQuery.ajaxTransport/){data-tooltip=\"Creates an object that handles the actual transmission of Ajax data.\"}\n\n{.marker-none .cols-2}\n\n### Shorthand Methods\n\n<!-- prettier-ignore -->\n- [jQuery.get()](https://api.jquery.com/jQuery.get/){data-tooltip=\"Load data from the server using a HTTP GET request.\"}\n- [jQuery.getJSON()](https://api.jquery.com/jQuery.getJSON/){data-tooltip=\"Load JSON-encoded data from the server using a GET HTTP request.\"}\n- [jQuery.getScript()](https://api.jquery.com/jQuery.getScript/){data-tooltip=\"Load a JavaScript file from the server using a GET HTTP request, then execute it.\"}\n- [jQuery.post()](https://api.jquery.com/jQuery.post/){data-tooltip=\"Send data to the server using a HTTP POST request.\"}\n- [.load()](https://api.jquery.com/load/){data-tooltip=\"Load data from the server and place the returned HTML into the matched elements.\"}\n\n{.marker-none .cols-2}\n\n## Miscellaneous\n\n### jQuery Object\n\n<!-- prettier-ignore -->\n- [jQuery()](https://api.jquery.com/jQuery/){data-tooltip=\"Accepts a string containing a CSS selector which is then used to match a set of elements.\"}\n- [jQuery.noConflict()](https://api.jquery.com/jQuery.noConflict/){data-tooltip=\"Relinquish jQuery&apos;s control of the $ variable.\"}\n- [jQuery.sub()](https://api.jquery.com/jQuery.sub/){data-tooltip=\"Creates a new copy of jQuery whose properties and methods can be modified without affecting the original jQuery object.\"}\n- [jQuery.holdReady()](https://api.jquery.com/jQuery.holdReady/){data-tooltip=\"Holds or releases the execution of jQuery&apos;s ready event.\"}\n- [jQuery.when()](https://api.jquery.com/jQuery.when/){data-tooltip=\"Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events.\"}\n\n{.marker-none .cols-2}\n\n### Deferred Object {.row-span-2}\n\n<!-- prettier-ignore -->\n- [jQuery.Deferred()](https://api.jquery.com/jQuery.Deferred/){data-tooltip=\" A factory function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function.\"}\n- [deferred.always()](https://api.jquery.com/deferred.always/){data-tooltip=\" Add handlers to be called when the Deferred object is either resolved or rejected. \"}\n- [deferred.done()](https://api.jquery.com/deferred.done/){data-tooltip=\" Add handlers to be called when the Deferred object is resolved. \"}\n- [deferred.fail()](https://api.jquery.com/deferred.fail/){data-tooltip=\" Add handlers to be called when the Deferred object is rejected. \"}\n- [deferred.isRejected()](https://api.jquery.com/deferred.isRejected/){data-tooltip=\" Determine whether a Deferred object has been rejected. \"}\n- [deferred.isResolved()](https://api.jquery.com/deferred.isResolved/){data-tooltip=\" Determine whether a Deferred object has been resolved. \"}\n- [deferred.notify()](https://api.jquery.com/deferred.notify/){data-tooltip=\" Call the progressCallbacks on a Deferred object with the given args. \"}\n- [deferred.notifyWith()](https://api.jquery.com/deferred.notifyWith/){data-tooltip=\" Call the progressCallbacks on a Deferred object with the given context and args. \"}\n- [deferred.pipe()](https://api.jquery.com/deferred.pipe/){data-tooltip=\" Utility method to filter and/or chain Deferreds.  \"}\n- [deferred.progress()](https://api.jquery.com/deferred.progress/){data-tooltip=\" Add handlers to be called when the Deferred object generates progress notifications.\"}\n- [deferred.promise()](https://api.jquery.com/deferred.promise/){data-tooltip=\" Return a Deferred&apos;s Promise object. \"}\n- [deferred.reject()](https://api.jquery.com/deferred.reject/){data-tooltip=\" Reject a Deferred object and call any failCallbacks with the given args. \"}\n- [deferred.rejectWith()](https://api.jquery.com/deferred.rejectWith/){data-tooltip=\" Reject a Deferred object and call any failCallbacks with the given context and args. \"}\n- [deferred.resolve()](https://api.jquery.com/deferred.resolve/){data-tooltip=\" Resolve a Deferred object and call any doneCallbacks with the given args. \"}\n- [deferred.resolveWith()](https://api.jquery.com/deferred.resolveWith/){data-tooltip=\" Resolve a Deferred object and call any doneCallbacks with the given context and args. \"}\n- [deferred.state()](https://api.jquery.com/deferred.state/){data-tooltip=\"Determine the current state of a Deferred object. \"}\n- [deferred.then()](https://api.jquery.com/deferred.then/){data-tooltip=\"Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. \"}\n- [.promise()](https://api.jquery.com/promise/){data-tooltip=\" Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished. \"}\n\n{.marker-none .cols-2}\n\n### Utilities {.row-span-3}\n\n<!-- prettier-ignore -->\n- [jQuery.boxModel](https://api.jquery.com/jQuery.boxModel/){data-tooltip=\"States if the current page, in the user&apos;s browser, is being rendered using the W3C CSS Box Model.\"}\n- [jQuery.browser](https://api.jquery.com/jQuery.browser/){data-tooltip=\"Contains flags for the useragent, read from navigator.userAgent. This property was removed in jQuery 1.9 and is available only through the jQuery.migrate plugin. Please try to use feature detection instead.\"}\n- [jQuery.contains()](https://api.jquery.com/jQuery.contains/){data-tooltip=\"Check to see if a DOM element is a descendant of another DOM element.\"}\n- [jQuery.each()](https://api.jquery.com/jQuery.each/){data-tooltip=\"A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function&apos;s arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.\"}\n- [jQuery.extend()](https://api.jquery.com/jQuery.extend/){data-tooltip=\"Merge the contents of two or more objects together into the first object.\"}\n- [jQuery.globalEval()](https://api.jquery.com/jQuery.globalEval/){data-tooltip=\"Execute some JavaScript code globally.\"}\n- [jQuery.grep()](https://api.jquery.com/jQuery.grep/){data-tooltip=\"Finds the elements of an array which satisfy a filter function. The original array is not affected.\"}\n- [jQuery.inArray()](https://api.jquery.com/jQuery.inArray/){data-tooltip=\"Search for a specified value within an array and return its index (or -1 if not found).\"}\n- [jQuery.isArray()](https://api.jquery.com/jQuery.isArray/){data-tooltip=\"Determine whether the argument is an array.\"}\n- [jQuery.isEmptyObject()](https://api.jquery.com/jQuery.isEmptyObject/){data-tooltip=\"Check to see if an object is empty (contains no enumerable properties).\"}\n- [jQuery.isFunction()](https://api.jquery.com/jQuery.isFunction/){data-tooltip=\"Determines if its argument is callable as a function.\"}\n- [jQuery.isNumeric()](https://api.jquery.com/jQuery.isNumeric/){data-tooltip=\"Determines whether its argument represents a JavaScript number.\"}\n- [jQuery.isPlainObject()](https://api.jquery.com/jQuery.isPlainObject/){data-tooltip=\"Check to see if an object is a plain object.\"}\n- [jQuery.isWindow()](https://api.jquery.com/jQuery.isWindow/){data-tooltip=\"Determine whether the argument is a window.\"}\n- [jQuery.isXMLDoc()](https://api.jquery.com/jQuery.isXMLDoc/){data-tooltip=\"Check to see if a DOM node is within an XML document (or is an XML document).\"}\n- [jQuery.makeArray()](https://api.jquery.com/jQuery.makeArray/){data-tooltip=\"Convert an array-like object into a true JavaScript array.\"}\n- [jQuery.map()](https://api.jquery.com/jQuery.map/){data-tooltip=\"Translate all items in an array or object to new array of items.\"}\n- [jQuery.merge()](https://api.jquery.com/jQuery.merge/){data-tooltip=\"Merge the contents of two arrays together into the first array. \"}\n- [jQuery.noop()](https://api.jquery.com/jQuery.noop/){data-tooltip=\"An empty function.\"}\n- [jQuery.now()](https://api.jquery.com/jQuery.now/){data-tooltip=\"Return a number representing the current time.\"}\n- [jQuery.parseHTML()](https://api.jquery.com/jQuery.parseHTML/){data-tooltip=\"Parses a string into an array of DOM nodes.\"}\n- [jQuery.parseJSON()](https://api.jquery.com/jQuery.parseJSON/){data-tooltip=\"Takes a well-formed JSON string and returns the resulting JavaScript value.\"}\n- [jQuery.parseXML()](https://api.jquery.com/jQuery.parseXML/){data-tooltip=\"Parses a string into an XML document.\"}\n- [jQuery.proxy()](https://api.jquery.com/jQuery.proxy/){data-tooltip=\"Takes a function and returns a new one that will always have a particular context.\"}\n- [jQuery.support](https://api.jquery.com/jQuery.support/){data-tooltip=\"A collection of properties that represent the presence of different browser features or bugs. Intended for jQuery&apos;s internal use; specific properties may be removed when they are no longer needed internally to improve page startup performance. For your own project&apos;s feature-detection needs, we strongly recommend the use of an external library such as Modernizr instead of dependency on properties in jQuery.support.\"}\n- [jQuery.trim()](https://api.jquery.com/jQuery.trim/){data-tooltip=\"Remove the whitespace from the beginning and end of a string.\"}\n- [jQuery.type()](https://api.jquery.com/jQuery.type/){data-tooltip=\"Determine the internal JavaScript [[Class]] of an object.\"}\n- [jQuery.unique()](https://api.jquery.com/jQuery.unique/){data-tooltip=\"Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.\"}\n- [jQuery.uniqueSort()](https://api.jquery.com/jQuery.uniqueSort/){data-tooltip=\"Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.\"}\n\n{.marker-none .cols-2}\n\n### DOM Element Methods\n\n<!-- prettier-ignore -->\n- [.get()](https://api.jquery.com/get/){data-tooltip=\"Retrieve one of the elements matched by the jQuery object.\"}\n- [.index()](https://api.jquery.com/index/){data-tooltip=\"Search for a given element from among the matched elements.\"}\n- [.size()](https://api.jquery.com/size/){data-tooltip=\"Return the number of elements in the jQuery object.\"}\n- [.toArray()](https://api.jquery.com/toArray/){data-tooltip=\"Retrieve all the elements contained in the jQuery set, as an array.\"}\n\n{.marker-none .cols-2}\n\n### Internals\n\n<!-- prettier-ignore -->\n- [.jquery](https://api.jquery.com/jquery-2/){data-tooltip=\"A string containing the jQuery version number.\"}\n- [.context](https://api.jquery.com/context/){data-tooltip=\"The DOM node context originally passed to jQuery(); if none was passed then context will likely be the document.\"}\n- [jQuery.error()](https://api.jquery.com/jQuery.error/){data-tooltip=\"Takes a string and throws an exception containing it.\"}\n- [.length](https://api.jquery.com/length/){data-tooltip=\"The number of elements in the jQuery object.\"}\n- [.pushStack()](https://api.jquery.com/pushStack/){data-tooltip=\"Add a collection of DOM elements onto the jQuery stack.\"}\n- [.selector](https://api.jquery.com/selector/){data-tooltip=\"A selector representing selector passed to jQuery(), if any, when creating the original set.\"}\n\n{.marker-none .cols-2}\n\n### Callbacks Object\n\n<!-- prettier-ignore -->\n- [jQuery.Callbacks()](https://api.jquery.com/jQuery.Callbacks/){data-tooltip=\"A multi-purpose callbacks list object that provides a powerful way to manage callback lists.\"}\n- [callbacks.add()](https://api.jquery.com/callbacks.add/){data-tooltip=\"Add a callback or a collection of callbacks to a callback list.\"}\n- [callbacks.disable()](https://api.jquery.com/callbacks.disable/){data-tooltip=\"Disable a callback list from doing anything more.\"}\n- [callbacks.disabled()](https://api.jquery.com/callbacks.disabled/){data-tooltip=\"Determine if the callbacks list has been disabled.\"}\n- [callbacks.empty()](https://api.jquery.com/callbacks.empty/){data-tooltip=\"Remove all of the callbacks from a list.\"}\n- [callbacks.fire()](https://api.jquery.com/callbacks.fire/){data-tooltip=\"Call all of the callbacks with the given arguments.\"}\n- [callbacks.fired()](https://api.jquery.com/callbacks.fired/){data-tooltip=\"Determine if the callbacks have already been called at least once.\"}\n- [callbacks.fireWith()](https://api.jquery.com/callbacks.fireWith/){data-tooltip=\"Call all callbacks in a list with the given context and arguments.\"}\n- [callbacks.has()](https://api.jquery.com/callbacks.has/){data-tooltip=\"Determine whether or not the list has any callbacks attached. If a callback is provided as an argument, determine whether it is in a list.\"}\n- [callbacks.lock()](https://api.jquery.com/callbacks.lock/){data-tooltip=\"Lock a callback list in its current state.\"}\n- [callbacks.locked()](https://api.jquery.com/callbacks.locked/){data-tooltip=\"Determine if the callbacks list has been locked.\"}\n- [callbacks.remove()](https://api.jquery.com/callbacks.remove/){data-tooltip=\"Remove a callback or a collection of callbacks from a callback list.\"}\n\n{.marker-none .cols-2}\n"
  },
  {
    "path": "source/_posts/json.md",
    "content": "---\ntitle: JSON\ndate: 2021-09-14 18:26:55\nbackground: bg-[#646464]\ntags:\n  - config\n  - format\ncategories:\n  - Programming\nintro: |\n  This is a quick reference cheat sheet for understanding and writing JSON format configuration files.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Introduction\n\n[JSON](https://json.org/) is a lightweight text-based open standard designed for human-readable data interchange.\n\n- JSON stands for JavaScript Object Notation\n- JSON is easy to read and write.\n- JSON is language agnostic data-interchange format\n- JSON filename extension is `.json`\n- JSON Internet Media type is `application/json`\n\n{.marker-round}\n\n### Examples\n\n```json\n{\n  \"name\": \"Jason\",\n  \"age\": 39,\n  \"height\": 1.92,\n  \"gender\": \"M\",\n  \"salary\": 70000,\n  \"married\": true,\n  \"children\": [\n    { \"name\": \"Tom\", \"age\": 9, \"gender\": \"M\" },\n    { \"name\": \"Ava\", \"age\": 7, \"gender\": \"F\" }\n  ]\n}\n```\n\n### Types\n\n| Type      | Description                             |\n| --------- | :-------------------------------------- |\n| `Number`  | Double precision floating-point         |\n| `String`  | Series of characters                    |\n| `Boolean` | `true` or `false`                       |\n| `Array`   | Ordered sequence of values              |\n| `Value`   | String, Number, Boolean, null etc       |\n| `Object`  | Unordered collection of key/value pairs |\n| `null`    | Null or Empty                           |\n\n### String {.row-span-3}\n\n|      |                            |\n| ---- | :------------------------- |\n| `\\\"` | Double quote               |\n| `\\\\` | Backslash                  |\n| `\\/` | Forward slash              |\n| `\\b` | Backspace                  |\n| `\\f` | Form feed                  |\n| `\\n` | Newline                    |\n| `\\r` | Carriage return            |\n| `\\t` | Tab                        |\n| `\\u` | Trailed by four hex digits |\n\n#### Examples\n\n```json {.wrap}\n{\n  \"url\": \"https://cheatsheets.zip\",\n  \"msg\": \"Hi,\\n\\\"CheatSheets.zip\\\"\",\n  \"intro\": \"Share quick reference and cheat sheet for developers.\"\n}\n```\n\n#### Invalid String\n\n```json\n{ \"foo\": \"bar\" }\n```\n\nHave to be delimited by double quotes\n\n### Number {.row-span-2}\n\n| Type       | Description                            |\n| ---------- | :------------------------------------- |\n| `Integer`  | Digits 1-9, 0 and positive or negative |\n| `Fraction` | Fractions like 0.3, 3.9                |\n| `Exponent` | Exponent like e, e+, e-, E, E+, E      |\n\n#### Examples\n\n```json\n{\n  \"positive\": 12,\n  \"negative\": -1,\n  \"fraction\": 10.25,\n  \"exponent\": 1.0e2,\n  \"zero\": 0\n}\n```\n\n#### Invalid Number\n\n```json\n{ \"foo\": 0xff }\n```\n\nIn JSON you can use only Decimal Literals\n\n### Objects\n\n```json\n{\n  \"color\": \"Purple\",\n  \"id\": \"210\",\n  \"composition\": {\n    \"R\": 70,\n    \"G\": 39,\n    \"B\": 89\n  },\n  \"empty_object\": {}\n}\n```\n\nMultiple key/value pairs separated by a comma\n\n### Arrays\n\n```json\n[1, 2, 3, 4, 5]\n```\n\nBegins with `[` and ends with `]`\n\n### Array of objects\n\n```json\n{\n  \"children\": [\n    { \"name\": \"Jimmy Smith\", \"age\": 15 },\n    { \"name\": \"Sammy Sosa\", \"age\": 12 }\n  ]\n}\n```\n\n### Object of arrays\n\n```json\n{\n  \"attributes\": [\"a1\", \"a2\"],\n  \"methods\": [\"getter\", \"setter\"],\n  \"empty_array\": []\n}\n```\n\n### 2D Array\n\n```json\n{\n  \"my_sequences\": [\n    [1, 2, 3],\n    [4, 5, 6],\n    [7, 8, 9, 0],\n    [10, 11]\n  ]\n}\n```\n\n### Object of objects\n\n```json\n{\n  \"Mark McGwire\": {\n    \"hr\": 65,\n    \"avg\": 0.278\n  },\n  \"Sammy Sosa\": {\n    \"hr\": 63,\n    \"avg\": 0.288\n  }\n}\n```\n\n### Nested\n\n```json\n{\n  \"Jack\": {\n    \"id\": 1,\n    \"name\": \"Franc\",\n    \"salary\": 25000,\n    \"hobby\": [\"a\", \"b\"],\n    \"location\": {\n      \"country\": \"A\",\n      \"city\": \"A-A\"\n    }\n  }\n}\n```\n\n## Access JSON in JavaScript\n\n### Access Object\n\n```javascript\nlet myObject = {\n  name: 'Jason',\n  last: 'Doe',\n  age: 39,\n  gender: 'M',\n  salary: 70000,\n  married: true\n};\n```\n\n---\n\n|                    |           |\n| ------------------ | :-------- |\n| `myObject.name`    | \"Jason\"   |\n| `myObject[\"name\"]` | \"Jason\"   |\n| `myObject.age`     | 39        |\n| `myObject.other`   | undefined |\n| `myObject[0]`      | undefined |\n\n### Access Nested {.row-span-2}\n\n```javascript\nlet myObject = {\n  ref: {\n    name: 0,\n    last: 1,\n    age: 2,\n    gender: 3,\n    salary: 4,\n    married: 5\n  },\n  jdoe: ['Jason', 'Doe', 39, 'M', 70000, true],\n  jsmith: ['Tom', 'Smith', 42, 'F', 80000, true]\n};\n```\n\n---\n\n|                          |                          |\n| ------------------------ | :----------------------- |\n| `myObject.ref.age`       | 2                        |\n| `myObject[\"ref\"][\"age\"]` | 2                        |\n| `myObject.jdoe`          | [\"Jason\", \"Doe\", 39 ...] |\n| `myObject.jsmith[3]`     | \"F\"                      |\n| `myObject[1]`            | undefined                |\n\n### Access Array of Objects {.row-span-2}\n\n```javascript\nlet myArray = [\n  {\n    name: 'Jason',\n    last: 'Doe',\n    age: 39,\n    gender: 'M',\n    salary: 70000,\n    married: true\n  },\n  {\n    name: 'Tom',\n    last: 'Smith',\n    age: 42,\n    gender: 'F',\n    salary: 80000,\n    married: true\n  },\n  {\n    name: 'Amy',\n    last: 'Burnquist',\n    age: 29,\n    gender: 'F',\n    salary: 60000,\n    married: false\n  }\n];\n```\n\n---\n\n|                     |                            |\n| ------------------- | :------------------------- |\n| `myArray[0]`        | `{`\"name\": \"Jason\", ...`}` |\n| `myArray[1].name`   | \"Tom\"                      |\n| `myArray[1][2]`     | 42                         |\n| `myArray[3]`        | undefined                  |\n| `myArray[3].gender` | TypeError: Cannot read...  |\n\n### Access Array\n\n```javascript\nlet myArray = ['Jason', 'Doe', 39, 'M', 70000, true];\n```\n\n---\n\n|              |           |\n| ------------ | :-------- |\n| `myArray[1]` | \"Doe\"     |\n| `myArray[5]` | true      |\n| `myArray[6]` | undefined |\n\n## Also see {.cols-1}\n\n- [JSON](https://www.json.org/json-en.html) _(json.org)_\n- [JSON Editor Online](http://jsoneditoronline.org/) _(jsoneditoronline.org)_\n- [Convert JSON Array to Markdown Table, CSV and more](https://tableconvert.com/json-to-markdown) _(tableconvert.com)_\n"
  },
  {
    "path": "source/_posts/kanbanmail.md",
    "content": "---\ntitle: KanbanMail\ndate: 2022-11-23 16:23:31.698423\nbackground: bg-[#4d74e6]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 29 keyboard shortcuts found in KanbanMail\n---\n\n## Keyboard Shortcuts\n\n### Global\n\n| Shortcut   | Action            |\n| ---------- | ----------------- |\n| `Ctrl` `\\` | Toggle split view |\n\n{.shortcuts}\n\n### Board\n\n| Shortcut   | Action                                       |\n| ---------- | -------------------------------------------- |\n| `C`        | Open composer                                |\n| `Ctrl` `N` | New note in the to-do column                 |\n| `/`        | Focus the search bar                         |\n| `Esc`      | Clear search, if it's on                     |\n| `1-5`      | Select the first thread in column \\<number\\> |\n\n{.shortcuts}\n\n### Email {.row-span-2}\n\n| Shortcut    | Action                                   |\n| ----------- | ---------------------------------------- |\n| `S`         | Star or unstar                           |\n| `I`         | Mark as important or not important       |\n| `U`         | Mark as read or unread                   |\n| `Shift` `P` | Pin                                      |\n| `R`         | Reply                                    |\n| `A`         | Reply all                                |\n| `F`         | Forward                                  |\n| `E`         | Move to archived                         |\n| `1-5`       | Move to column \\<number\\>                |\n| `Shift` `3` | Move to trash                            |\n| `P`         | Go to the previous message in the thread |\n| `N`         | Go to the next message in the thread     |\n| `Shift` `U` | Unsubscribe                              |\n| `Enter`     | Open selected thread                     |\n| `Esc`       | Close thread viewer, if open             |\n| `Esc`       | Clear selected threads                   |\n\n{.shortcuts}\n\n### Composer\n\n| Shortcut       | Action         |\n| -------------- | -------------- |\n| `Ctrl` `Enter` | Send email     |\n| `Ctrl` `S`     | Save as draft  |\n| `Esc`          | Close composer |\n\n{.shortcuts}\n\n### Editor\n\n| Shortcut   | Action        |\n| ---------- | ------------- |\n| `Ctrl` `B` | Bold          |\n| `Ctrl` `I` | Italic        |\n| `Ctrl` `U` | Underline     |\n| `Ctrl` `K` | Add hyperlink |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for KanbanMail](https://guides.kanbanmail.app/keyboard-shortcuts) _(guides.kanbanmail.app)_\n"
  },
  {
    "path": "source/_posts/kotlin.md",
    "content": "---\ntitle: Kotlin\ndate: 2023-02-26 16:24:31\nbackground: bg-[#7954f6]\ntags:\n  - Cross-platform\n  - Android\ncategories:\n  - Programming\nintro: |\n  A quick reference cheatsheet for Kotlin that includes usage, examples, and more.\nplugins:\n  - copyCode\n---\n\n## Introduction to Kotlin\n\n### main()\n\n```kotlin\nfun main() {\n  println(\"Greetings, CheatSheets.zip!\")\n  // Code goes here\n}\n```\n\nThe main() function is the starting point of every Kotlin program and must be included in the code before execution\n\n### Print statement\n\n```kotlin\nprintln(\"Greetings, earthling!\")\nprint(\"Take me to \")\nprint(\"your leader.\")\n\n/*\nPrint:\nGreetings, earthling!\nTake me to your leader.\n*/\n```\n\n### Notes\n\n```kotlin\n// this is a single line comment\n\n/*\nthis\nnote\nfor\nmany\n*/\n```\n\n### Execution order\n\n```kotlin\nfun main() {\n  println(\"I will be printed first.\")\n  println(\"I will be printed second.\")\n  println(\"I will be printed third.\")\n}\n```\n\n## Data Types and Variables\n\n### Mutable variables\n\n```kotlin\nvar age = 25\nage = 26\n```\n\n### Immutable variables\n\n```kotlin\nval goldenRatio = 1.618\n```\n\n### Type inference\n\n```kotlin\n// The following variables are assigned a literal value inside double quotes\n// so the inferred type is String\n\nvar color = \"Purple\"\n```\n\n### String concatenation\n\n```kotlin\nvar streetAddress = \"123 Main St.\"\nvar cityState = \"Brooklyn, NY\"\n\nprintln(streetAddress + \" \" + cityState)\n// Print: 123 Main St. Brooklyn, NY\n```\n\n### String Templates\n\n```kotlin\nvar address = \"123 Main St.\"\nprintln(\"The address is $address\")\n// prints: The address is 123 Main St.\n```\n\n### Built-in Properties and Functions\n\n```kotlin\nvar monument = \"the Statue of Liberty\"\n\nprintln(monument. capitalize())\n// print: The Statue of Liberty\nprintln(monument. length)\n// print: 21\n```\n\n### Character escape {.row-span-2}\n\n```kotlin {.wrap}\nprint(\"\\\"Excellent!\\\" I cried. \\\"Elementary,\\\" said he.\")\n\n// Print: \"Excellent!\" I cried. \"Elementary,\" said he.\n```\n\n- `\\n` insert new line\n- `\\t` inserts a tab\n- `\\r` inserts carriage return\n- `\\'` inserts a single quote\n- `\\\"` inserts a double quote\n- `\\\\` inserts a backslash\n- `\\$` inserts a dollar sign\n\n### Arithmetic Operators\n\n```kotlin\n5 + 7  // 12\n9 -2   // 7\n8 *4   // 32\n25 /5  // 5\n31 % 2 // 1\n```\n\n`+` addition, `-` subtraction, `*` multiplication, `/` division, and `%` modulus\n\n### Order of operations\n\n```kotlin\n5 + 8 *2 /4 -3 // 6\n3 + (4 + 4) /2 // 7\n4 *2 + 1 *7    // 15\n3 + 18 /2 *1   // 12\n6 -3 % 2 + 2   // 7\n```\n\n### Enhanced assignment operator\n\n```kotlin\nvar batteryPercentage = 80\n\n// long syntax\nbatteryPercentage = batteryPercentage + 10\n\n// short syntax with augmented assignment operator\nbatteryPercentage += 10\n```\n\n### Increment and decrement operators\n\n```kotlin\nvar year = 2019\nyear++   // 2020\nyear--   // 2019\n```\n\n### Math library\n\n```kotlin\nMath.pow(2.0, 3.0) // 8.0\nMath.min(6, 9)     // 6\nMath.max(10, 12)   // 12\nMath. round(13.7)  // 14\n```\n\n## Conditional Expression\n\n### If expression\n\n```kotlin\nvar morning = true\n\nif (morning) {\n  println(\"Rise and shine!\")\n}\n// Print: Rise and shine!\n```\n\n### Else-expression\n\n```kotlin\nvar rained = false\n\nif (rained) {\n  println(\"No need to water the plants today.\")\n} else {\n  println(\"The plant needs to be watered!\")\n}\n// print: The plant needs watering!\n```\n\n### Else-If expressions\n\n```kotlin\nvar age = 65\n\nif (age < 18 ) {\n  println(\"You are considered a minor\")\n} else if (age < 60) {\n  println(\"You are considered an adult\")\n} else {\n  println(\"You are considered senior\")\n}\n\n// print: you are considered senior\n```\n\n### Comparison Operators\n\n```kotlin\nvar myAge = 19\nvar sisterAge = 11\nvar cousinAge = 11\n\nmyAge > sisterAge  // true\nmyAge < cousinAge  // false\nmyAge >= cousinAge // true\nmyAge <= sisterAge // false\n```\n\n### Logical Operators\n\n```kotlin\nvar humid = true\nvar raining = true\nvar jacket = false\n\nprintln(!humid)\n// print: false\nprintln(jacket && raining)\n// print: true\nprintln(humid || raining)\n// print: true\n```\n\n### AND operator: &&\n\n```kotlin\nvar humid = true\nvar raining = true\nvar shorts = false\nvar sunny = false\n\n// true AND true\nprintln(humid && raining) // true\n// true AND false\nprintln(humid && shorts)  // false\n// false AND true\nprintln(sunny && raining) // false\n// false AND false\nprintln(shorts && sunny)  // false\n```\n\n### Or operator:||\n\n```kotlin\nvar late = true\nvar skipBreakfast = true\nvar underslept = false\nvar checkEmails = false\n\n// true OR true\nprintln(skipBreakfast || late) // true\n// true OR false\nprintln(late || checkEmails)   // true\n// false OR true\nprintln(underslept || late)    // true\n// false OR false\nprintln(checkEmails || underslept) // false\n```\n\n### NOT operator\n\n```kotlin\nvar hungry = true\nvar full = false\n\nprintln(!hungry) // false\nprintln(!full)   // true\n```\n\n### Evaluation order\n\n```kotlin\n!true && (false || true) // false\n/*\n(false || true) is evaluated first to return true.\nThen, evaluate !true && true and return the final result false\n*/\n\n!false && true || false // true\n/*\n!false is evaluated first to return true.\nThen true && true is evaluated, returning true.\nthen, true || evaluates to false and eventually returns true\n*/\n```\n\n### Nested conditions\n\n```kotlin\nvar studied = true\nvar wellRested = true\n\nif (wellRested) {\n  println(\"Good luck today!\")\n  if (studied) {\n    println(\"You should prepare for the exam!\")\n  } else {\n    println(\"Spend a few hours studying before the exam!\")\n  }\n}\n\n// Print: Good luck today!\n// print: You should be ready for the exam!\n```\n\n### When expression\n\n```kotlin\nvar grade = \"A\"\n\nwhen (grade) {\n  \"A\" -> println(\"Great job!\")\n  \"B\" -> println(\"Great job!\")\n  \"C\" -> println(\"You passed!\")\n  else -> println(\"Close! Be sure to prepare more next time!\")\n}\n// print: Great job!\n```\n\n### Range operator\n\n```kotlin {.wrap}\nvar height = 46 // inches\n\nif (height in 1..53) {\n  println(\"Sorry, you must be at least 54 inches to ride the coaster\")\n}\n// Prints: Sorry, you must be at least 54 inches to ride the roller coaster\n```\n\n### Equality Operators\n\n```kotlin\nvar myAge = 22\nvar sisterAge = 21\n\nmyAge == sisterAge // false\nmyAge != sisterAge // true\n```\n\n## Null-Safety\n\n### Nullable vs Not-Nullable\n\n```kotlin\nvar a: String = \"Kotlin\" // a can never be null\na = null // compilation error\nvar b: String? = \"Kotlin\" // b can be null\nb = null // ok\n```\n\n### Safe-Calls\n\n```kotlin\nval a = \"Kotlin\"\nval b: String? = null\nprintln(a.length) // can be called safely, because a is never null\nprintln(b?.length) // b?.length returns the length of b, or null if b is null\nprintln(a?.length) // Unnecessary safe call\n```\n\n### Chaining Safe-Calls\n\n```kotlin\nbob?.department?.head?.name // chain returns null if any property is null\n```\n\n### Elvis Operator\n\n```kotlin\nval l = b?.length ?: -1 // if b is null, return the default value -1\n// equval to:\nval l: Int = if (b != null) b.length else -1\n```\n\n### Not Null Assertion Operator\n\n```kotlin\nval l = b!!.length // throws a NullPointerException, if b is null\n```\n\n## Collections\n\n### Immutable list\n\n```kotlin {.wrap}\nvar programmingLanguages = listOf(\"C#\", \"Java\", \"Kotlin\", \"Ruby\")\n```\n\n### Mutable List\n\n```kotlin {.wrap}\nvar fruits = mutableListOf(\"Orange\", \"Apple\", \"Banana\", \"Mango\")\n```\n\n### Access List\n\n```kotlin {.wrap}\nvar cars = listOf(\"BMW\", \"Ferrari\", \"Volvo\", \"Tesla\")\n\nprintln(cars[2]) // Prints: Volvo\n```\n\n### Size Attribute\n\n```kotlin {.wrap}\nvar worldContinents = listOf(\"Asia\", \"Africa\", \"North America\", \"South America\", \"Antarctica\", \"Europe\", \"Australia\")\n\nprintln(worldContinents.size) // Prints: 7\n```\n\n### List Manipulation {.row-span-2}\n\n```kotlin {.wrap}\nvar seas = listOf(\"Black Sea\", \"Caribbean Sea\", \"North Sea\")\nprintln(seas. contains(\"North Sea\")) // Prints: true\n\n// The contains() function performs a read operation on any list and determines if the element exists\nseas.add(\"Baltic Sea\") // Error: cannot write to immutable list\n// The add() function can only be called on mutable lists, so the code above throws an error\n```\n\n### Immutable Sets\n\n```kotlin {.wrap}\nvar primaryColors = setOf(\"Red\", \"Blue\", \"Yellow\")\n```\n\n### Mutable Sets\n\n```kotlin {.wrap}\nvar womenInTech = mutableSetOf(\"Ada Lovelace\", \"Grace Hopper\", \"Radia Perlman\", \"Sister Mary Kenneth Keller\")\n```\n\n### Access Collection Elements {.row-span-2}\n\n```kotlin {.wrap}\nvar companies = setOf(\"Facebook\", \"Apple\", \"Netflix\", \"Google\")\n\nprintln(companies.elementAt(3))\n// Prints: Google\nprintln(companies.elementAt(4))\n// Returns and Error\nprintln(companies.elementAtOrNull(4))\n// Prints: null\n```\n\n### Immutable Map\n\n```kotlin {.wrap}\nvar averageTemp = mapOf(\"winter\" to 35,  \"spring\" to 60,  \"summer\" to 85, \"fall\" to 55)\n```\n\n### Mutable Mapping\n\n```kotlin {.wrap}\nvar europeanDomains = mutableMapOf(\"Germany\" to \"de\", \"Slovakia\" to \"sk\", \"Hungary\" to \"hu\", \"Norway\" to \"no\")\n```\n\n### Retrieve map keys and values\n\n```kotlin {.wrap}\nvar oscarWinners = mutableMapOf(\"Parasite\" to \"Bong Joon-ho\", \"Green Book\" to \"Jim Burke\", \"The Shape Of Water\" to \"Guillermo del Toro\")\n\nprintln(oscarWinners.keys)\n// Prints: [Parasite, Green Book, The Shape Of Water]\n\nprintln(oscarWinners.values)\n// Prints: [Bong Joon-ho, Jim Burke, Guillermo del Toro]\nprintln(oscarWinners[\"Parasite\"])\n// Prints: Bong Joon-ho\n```\n\n### Add and remove map entries\n\n```kotlin {.wrap}\nvar worldCapitals = mutableMapOf(\"United States\" to \"Washington D.C.\", \"Germany\" to \"Berlin\", \"Mexico\" to \"Mexico City\", \"France\" to \"Paris\")\n\nworldCapitals.put(\"Brazil\", \"Brasilia\")\nprintln(worldCapitals)\n// Prints: {United States=Washington D.C., Germany=Berlin, Mexico=Mexico City, France=Paris, Brazil=Brasilia}\n\nworldCapitals.remove(\"Germany\")\nprintln(worldCapitals)\n// Prints: {United States=Washington D.C., Mexico=Mexico City, France=Paris, Brazil=Brasilia}\n```\n\n## Function\n\n### Function\n\n```kotlin\nfun greet() {\n  println(\"Hey there!\")\n}\n\nfun main() {\n  //Function call\n  greet() //Prints: Hey there!\n}\n```\n\n### Function Parameters\n\n```kotlin {.wrap}\nfun birthday(name: String, age: Int) {\n   println(\"Happy birthday $name! You turn $age today!\")\n}\n\nfun main() {\n  birthday(\"Oscar\", 26)\n  //Prints: Happy birthday Oscar! You turn 25 today!\n  birthday(\"Amarah\", 30)\n  //Prints: Happy birthday Amarah! You turn 30 today!\n}\n```\n\n### Default Parameters\n\n```kotlin {.wrap}\nfun favoriteLanguage(name: String, language: String = \"Kotlin\") {\n  println(\"Hello, $name. Your favorite programming language is $language\")\n}\n\nfun main() {\n  favoriteLanguage(\"Manon\")\n  //Prints: Hello, Manon. Your favorite programming language is Kotlin\n\n  favoriteLanguage(\"Lee\", \"Java\")\n  //Prints: Hello, Lee. Your favorite programming language is Java\n}\n```\n\n### Named Parameters\n\n```kotlin {.wrap}\nfun findMyAge(currentYear: Int, birthYear: Int) {\n   var myAge = currentYear -birthYear\nprintln(\"I am $myAge years old.\")\n}\n\nfun main() {\n  findMyAge(currentYear = 2020, birthYear = 1995)\n  //Prints: I am 25 years old.\n  findMyAge(birthYear = 1920, currentYear = 2020)\n  //Prints: I am 100 years old.\n}\n```\n\n### Return Statement\n\n```kotlin {.wrap}\n//Return type is declared outside the parentheses\nfun getArea(length: Int, width: Int): Int {\n  var area = length *width\n\n  //return statement\n  return area\n}\n\nfun main() {\n  var myArea = getArea(10, 8)\nprintln(\"The area is $myArea.\")\n//Prints: The area is 80.\n}\n```\n\n### Single expression function\n\n```kotlin{.wrap}\nfun fullName(firstName: String, lastName: String) = \"$firstName $lastName\"\n\nfun main() {\n  println(fullName(\"Ariana\", \"Ortega\"))\n  //Prints: Ariana Ortega\n  println(fullName(\"Kai\", \"Gittens\"))\n  //Prints: Kai Gittens\n}\n```\n\n### Function Literals\n\n```kotlin{.wrap}\nfun main() {\n  //Anonymous Function:\n  var getProduct = fun(num1: Int, num2: Int): Int {\nreturn num1 *num2\n  }\n  println(getProduct(8, 3))\n  //Prints: 24\n//Lambda Expression\n  var getDifference = { num1: Int, num2: Int -> num1 -num2 }\n  println(getDifference(10, 3))\n  //Prints: 7\n}\n```\n\n## Class\n\n### Class Example\n\n```kotlin\n//class with properties containing default values\nclass Student {\n  var name = \"Lucia\"\n  var semester = \"Fall\"\n  var gpa = 3.95\n}\n\n//shorthand syntax without class body\nclass Student\n```\n\n### Class Instance\n\n```kotlin\n// Class\nclass Student {\n  var name = \"Lucia\"\n  var semester = \"Fall\"\nvar gpa = 3.95\n}\n\nfun main() {\n  var student = Student()\n  // Instance\n  println(student.name)\n  // Prints: Lucia\n  println(student.semester)\n  // Prints: Fall\n  println(student.gpa)\n  // Prints: 3.95\n}\n```\n\n### Primary Constructor\n\n```kotlin {.wrap}\nclass Student(val name: String, val gpa: Double, val semester: String, val estimatedGraduationYear: Int)\n\nfun main() {\n  var student = Student(\"Lucia\", 3.95, \"Fall\", 2022)\n  println(student.name)\n  //Prints: Lucia\n  println(student.gpa)\n  //Prints: 3.95\n  println(student.semester)\n  //Prints: Fall\n  println(student.estimatedGraduationYear)\n  //Prints: 2022\n}\n```\n\n### Initialization Block\n\n```kotlin {.wrap}\nclass Student(val name: String, val gpa: Double, val semester: String, val estimatedGraduationYear: Int) {\n  init {\n    println(\"$name has ${estimatedGraduationYear -2020} years left in college.\")\n  }\n}\n\nfun main() {\n  var student = Student(\"Lucia\", 3.95, \"Fall\", 2022)\n//Prints: Lucia has 2 years left in college.\n}\n```\n\n### Member Function {.col-span-2}\n\n```kotlin {.wrap}\nclass Student(val name: String, val gpa: Double, val semester: String, val estimatedGraduationYear: Int) {\n\n  init {\nprintln(\"$name has ${estimatedGraduationYear -2020} years left in college.\")\n  }\n\n  //member function\n  fun calculateLetterGrade(): String {\n    return when {\n      gpa >= 3.0 -> \"A\"\n      gpa >= 2.7 -> \"B\"\n      gpa >= 1.7 -> \"C\"\ngpa >= 1.0 -> \"D\"\n      else -> \"E\"\n    }\n  }\n}\n\n//When the instance is created and the function is called, the when expression will be executed and return the letter grade\nfun main() {\n  var student = Student(\"Lucia\", 3.95, \"Fall\", 2022)\n//Prints: Lucia has 2 years left in college.\n  println(\"${student.name}'s letter grade is ${student.calculateLetterGrade()}.\")\n  //Prints: Lucia's letter grade is A.\n}\n```\n\n## See Also\n\n- [Kotlin Language Official Documentation](https://kotlinlang.org/) _(kotlinlang.org)_\n"
  },
  {
    "path": "source/_posts/kubernetes.md",
    "content": "---\ntitle: Kubernetes\ndate: 2023-01-09 10:26:55\nbackground: bg-[#416cde]\ntags:\n  - config\n  - format\ncategories:\n  - Programming\nintro: |\n  This page contains a list of commonly used kubectl commands and flags.\nplugins:\n  - copyCode\n---\n\n## Viewing and finding resources {.cols-2}\n\n### Nodes\n\n```bash\nkubectl get no # Display all node information\nkubectl get no -o wide # Show more information about all nodes\nkubectl describe no # Display node details\nkubectl get no -o yaml # Display node details in yaml format\nkubectl get node --selector=[label_name] # Filter the node with the specified label\nkubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=\"ExternalIP\")].address}'\n# Output the field information defined by the jsonpath expression\nkubectl top node [node_name] # Display node (CPU/memory/storage) usage\n```\n\nResource name: nodes, abbreviation: no\n\n### Pods\n\n```bash\nkubectl get po # Display all container group information\nkubectl get po -o wide\nkubectl describe po\nkubectl get po --show-labels # View the labels of the container group\nkubectl get po -l app=nginx\nkubectl get po -o yaml\nkubectl get pod [pod_name] -o yaml --export\nkubectl get pod [pod_name] -o yaml --export > nameoffile.yaml\n# Export container group information to yaml file in yaml format\nkubectl get pods --field-selector status.phase=Running\n# Use the field selector to filter out container group information\n```\n\nResource name: pods, abbreviation: po\n\n### Namespaces\n\n```bash\nkubectl get ns\nkubectl get ns -o yaml\nkubectl describe ns\n```\n\nResource name: namespaces, abbreviation: ns\n\n### Deployments\n\n```bash\nkubectl get deploy\nkubectl describe deploy\nkubectl get deploy -o wide\nkubectl get deploy -o yaml\n```\n\nResource name: deployments, abbreviation: deploy\n\n### Services\n\n```bash\nkubectl get svc\nkubectl describe svc\nkubectl get svc -o wide\nkubectl get svc -o yaml\nkubectl get svc --show-labels\n```\n\nResource name: services, abbreviation: svc\n\n### Daemon Sets\n\n```bash\nkubectl get ds\nkubectl describe ds --all-namespaces\nkubectl describe ds [daemonset_name] -n [namespace_name]\nkubectl get ds [ds_name] -n [ns_name] -o yaml\n```\n\nResource name: daemonsets, abbreviation: ds\n\n### Events\n\n```bash\nkubectl get events\nkubectl get events -n kube-system\nkubectl get events -w\n```\n\nResource name: events, abbreviation: ev\n\n### Logs\n\n```bash\nkubectl logs [pod_name]\nkubectl logs --since=1h [pod_name]\nkubectl logs --tail=20 [pod_name]\nkubectl logs -f -c [container_name] [pod_name]\nkubectl logs [pod_name] > pod.log\n```\n\n### Service Accounts\n\n```bash\nkubectl get sa\nkubectl get sa -o yaml\nkubectl get serviceaccounts default -o yaml >./sa.yaml\nkubectl replace serviceaccount default -f ./sa.yaml\n```\n\nResource name: serviceaccounts, abbreviation: ev\n\n### Replica Sets\n\n```bash\nkubectl get rs\nkubectl describe rs\nkubectl get rs -o wide\nkubectl get rs -o yaml\n```\n\nResource name: replicasets, abbreviation: rs\n\n### Roles\n\n```bash\nkubectl get roles --all-namespaces\nkubectl get roles --all-namespaces -o yaml\n```\n\n### Secrets\n\n```bash\nkubectl get secrets\nkubectl get secrets --all-namespaces\nkubectl get secrets -o yaml\n```\n\n### Config maps\n\nResource name: configmaps, abbreviation: cm\n\n```bash\nkubectl get cm\nkubectl get cm --all-namespaces\nkubectl get cm --all-namespaces -o yaml\n```\n\n### Ingresses\n\nResource name: ingresses, abbreviation: ing\n\n```bash\nkubectl get ing\nkubectl get ing --all-namespaces\n```\n\n### Persistent Volumes\n\nResource name: persistentvolumes, abbreviation: pv\n\n```bash\nkubectl get pv\nkubectl describe pv\n```\n\n### Persistent volume declaration\n\nResource name: persistentvolumeclaims, abbreviation: pvc\n\n```bash\nkubectl get pvc\nkubectl describe pvc\n```\n\n### storage class\n\nResource name: storageclasses, Abbreviation: sc\n\n```bash\nkubectl get sc\nkubectl get sc -o yaml\n```\n\n### Multiple resources\n\n```bash\nkubectl get svc, po\nkubectl get deploy, no\nkubectl get all\nkubectl get all --all-namespaces\n```\n\n## Updating resources\n\n### Taint\n\n```bash\nkubectl taint [node_name] [taint_name]\n```\n\n### Label\n\n```bash\nkubectl label [node_name] disktype=ssd\nkubectl label [pod_name] env=prod\n```\n\n### Maintain/Schedulable\n\n```bash\nkubectl cordon [node_name] # node maintenance\nkubectl uncordon [node_name] # node is schedulable\n```\n\n### clear\n\n```bash\nkubectl drain [node_name] # empty the node\n```\n\n### Node/Pod {.row-span-2}\n\n```bash\nkubectl delete node [node_name]\nkubectl delete pod [pod_name]\nkubectl edit node [node_name]\nkubectl edit pod [pod_name]\n```\n\n### Stateless/Namespaced {.row-span-2}\n\n```bash\nkubectl edit deploy [deploy_name]\nkubectl delete deploy [deploy_name]\nkubectl expose deploy [deploy_name] --port=80 --type=NodePort\nkubectl scale deploy [deploy_name] --replicas=5\nkubectl delete ns\nkubectl edit ns [ns_name]\n```\n\n### Service\n\n```bash\nkubectl edit svc [svc_name]\nkubectl delete svc [svc_name]\n```\n\n### Daemon set\n\n```bash\nkubectl edit ds [ds_name] -n kube-system\nkubectl delete ds [ds_name]\n```\n\n### Service account\n\n```bash\nkubectl edit sa [sa_name]\nkubectl delete sa [sa_name]\n```\n\n### Notes\n\n```bash\nkubectl annotate po [pod_name] [annotation]\nkubectl annotateno [node_name]\n```\n\n## Create resources\n\n### Create pod\n\n```bash\nkubectl create -f [name_of_file]\nkubectl apply -f [name_of_file]\nkubectl run [pod_name] --image=nginx --restart=Never\nkubectl run [pod_name] --generator=run-pod/v1 --image=nginx\nkubectl run [pod_name] --image=nginx --restart=Never\n```\n\n### Create Service\n\n```bash\nkubectl create svc nodeport [svc_name] --tcp=8080:80\n```\n\n### Create a stateless application\n\n```bash\nkubectl create -f [name_of_file]\nkubectl apply -f [name_of_file]\nkubectl create deploy [deploy_name] --image=nginx\n```\n\n### interaction\n\n```bash\nkubectl run [pod_name] --image=busybox --rm -it --restart=Never --sh\n```\n\n### Output YAML\n\n```bash\nkubectl create deploy [deploy_name] --image=nginx --dry-run -o yaml > deploy.yaml\nkubectl get po [pod_name] -o yaml --export > pod.yaml\n```\n\n### Help\n\n```bash\nkubectl -h\nkubectl create -h\nkubectl run -h\nkubectl explain deploy.spec\n```\n\n## Miscellaneous\n\n### APIs\n\n```bash\nkubectl get --raw /apis/metrics.k8s.io/\n```\n\n### Information\n\n```bash\nkubectl config\nkubectl cluster-info\nkubectl get componentstatus\n```\n\n## Also See\n\n- [Kubernetes Official Documentation](https://kubernetes.io/zh-cn/docs/reference/kubectl/) _(kubernetes.io)_\n"
  },
  {
    "path": "source/_posts/laravel.md",
    "content": "---\ntitle: Laravel\ndate: 2021-11-09 18:26:55\nbackground: bg-[#e44230]\nlabel: PHP\ntags:\n  - web\n  - framework\n  - php\ncategories:\n  - Programming\nintro: |\n  [Laravel](https://laravel.com/docs/8.x/) is an expressive and progressive web application framework for PHP. \n  This cheat sheet provides a reference for common commands and features for Laravel 8.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Requirements {.row-span-2}\n\n- PHP version >= 7.3\n- BCMath PHP Extension\n- Ctype PHP Extension\n- Fileinfo PHP Extension\n- JSON PHP Extension\n- Mbstring PHP Extension\n- OpenSSL PHP Extension\n- PDO PHP Extension\n- Tokenizer PHP Extension\n- XML PHP Extension\n\nEnsure your web server directs all requests to your application's `public/index.php` file, See:\n[Deployment](#deployment)\n\n### Windows\n\n- #### Install [Docker Desktop](https://www.docker.com/products/docker-desktop)\n- #### Install & enable [WSL2](https://docs.microsoft.com/en-us/windows/wsl/install)\n- #### Ensure that Docker Desktop is [configured to use WSL2](https://docs.docker.com/desktop/windows/wsl/)\n- #### In WSL2 terminal:\n      ```shell\n      $ curl -s https://laravel.build/example-app | bash\n      $ cd example-app\n      $ ./vendor/bin/sail up\n      ```\n  {.marker-timeline}\n\nAccess application via `http://localhost`\n\n### Mac\n\n- #### Install [Docker Desktop](https://www.docker.com/products/docker-desktop)\n- #### In terminal:\n      ```shell\n      $ curl -s https://laravel.build/example-app | bash\n      $ cd example-app\n      $ ./vendor/bin/sail up\n      ```\n  {.marker-timeline}\n\nAccess application via `http://localhost`\n\n### Linux\n\n```shell\n$ curl -s https://laravel.build/example-app | bash\n$ cd example-app\n$ ./vendor/bin/sail up\n```\n\nInstallation via [Composer](https://getcomposer.org)\n\n```bash\n$ composer create-project laravel/laravel example-app\n$ cd example-app\n$ php artisan serve\n```\n\nAccess application via `http://localhost`\n\n## Configuration\n\n### .env {.cols-2}\n\nRetrieve values from `.env` file\n\n```php\nenv('APP_DEBUG');\n\n// with default value\nenv('APP_DEBUG', false);\n```\n\nDetermine current environment\n\n```php\nuse Illuminate\\Support\\Facades\\App;\n\n$environment = App::environment();\n```\n\nAccessing configuration values using \"dot\" syntax\n\n```php\n// config/app.php --> ['timezone' => '']\n$value = config('app.timezone');\n\n// Retrieve a default value if the configuration value does not exist...\n$value = config('app.timezone', 'Asia/Seoul');\n```\n\nSet configuration values at runtime:\n\n```php\nconfig(['app.timezone' => 'America/Chicago']);\n```\n\n### Debug Mode\n\nTurn on (local dev):\n\n```php\n// .env file\nAPP_ENV=local\nAPP_DEBUG=true\n// ...\n```\n\nTurn off (production):\n\n```php\n// .env file\nAPP_ENV=production\nAPP_DEBUG=false\n// ...\n```\n\n### Maintenance Mode\n\nTemporarily disable application (503 status code)\n\n```bash\nphp artisan down\n```\n\n#### Disable maintenance mode\n\n```bash\nphp artisan up\n```\n\n#### Bypass Maintenance Mode\n\n```bash\nphp artisan down --secret=\"1630542a-246b-4b66-afa1-dd72a4c43515\"\n```\n\nVisit your application URL `https://example.com/1630542a-246b-4b66-afa1-dd72a4c43515` to set a cookie and bypass the\nmaintenance screen\n\n## Routing\n\n### Router HTTP Methods {.row-span-2}\n\n```php\nRoute::get($uri, $callback);\nRoute::post($uri, $callback);\nRoute::put($uri, $callback);\nRoute::patch($uri, $callback);\nRoute::delete($uri, $callback);\nRoute::options($uri, $callback);\n```\n\nMultiple HTTP methods\n\n```php\nRoute::match(['get', 'post'], '/', function () {\n    //\n});\n\nRoute::any('/', function () {\n    //\n});\n```\n\n### Basic Definition {.row-span-2}\n\n```php\nuse Illuminate\\Support\\Facades\\Route;\n\n// closure\nRoute::get('/greeting', function () {\n    return 'Hello World';\n});\n\n// controller action\nRoute::get(\n    '/user/profile',\n    [UserProfileController::class, 'show']\n);\n```\n\n### Dependency Injection\n\n```php\nuse Illuminate\\Http\\Request;\n\nRoute::get('/users', function (Request $request) {\n    // ...\n});\n```\n\nType hint concrete dependencies for auto-injection\n\n### View Routes\n\n```php\n// Argument 1: URI, Argument 2: view name\nRoute::view('/welcome', 'welcome');\n\n// with data\nRoute::view('/welcome', 'welcome', ['name' => 'Taylor']);\n```\n\nRoute only needs to return a view.\n\n### Route Model Binding {.row-span-4}\n\n#### Implicit binding\n\nWith closure\n\n```php\nuse App\\Models\\User;\n\nRoute::get('/users/{user}', function (User $user) {\n    return $user->email;\n});\n\n// /user/1 --> User::where('id', '=', 1);\n```\n\nWith controller action\n\n```php\nuse App\\Http\\Controllers\\UserController;\nuse App\\Models\\User;\n\n// Route definition...\nRoute::get('/users/{user}', [UserController::class, 'show']);\n\n// Controller method definition...\npublic function show(User $user)\n{\n    return view('user.profile', ['user' => $user]);\n}\n```\n\nWith custom resolution column\n\n```php\nuse App\\Models\\Post;\n\nRoute::get('/posts/{post:slug}', function (Post $post) {\n    return $post;\n});\n\n// /posts/my-post --> Post::where('slug', '=', 'my-post');\n```\n\nAlways use a different column to resolve\n\n```php\n// in App\\Models\\Post\npublic function getRouteKeyName()\n{\n    return 'slug';\n}\n```\n\nMultiple models - second is child of first\n\n```php\nuse App\\Models\\Post;\nuse App\\Models\\User;\n\nRoute::get('/users/{user}/posts/{post:slug}', function (User $user, Post $post) {\n    return $post;\n});\n```\n\nConvenient way to automatically inject the model instances directly into your routes\n\n### Route Parameters {.row-span-2}\n\nCapture segments of the URI within your route\n\n#### Required parameters\n\n```php\nRoute::get('/user/{id}', function ($id) {\n    return 'User '.$id;\n});\n```\n\nWith dependency injection\n\n```php\nuse Illuminate\\Http\\Request;\n\nRoute::get('/user/{id}', function (Request $request, $id) {\n    return 'User '.$id;\n});\n```\n\n#### Optional Parameters\n\n```php\nRoute::get('/user/{name?}', function ($name = null) {\n    return $name;\n});\n\nRoute::get('/user/{name?}', function ($name = 'John') {\n    return $name;\n});\n```\n\n### Redirect Routes\n\nHTTP `302` status\n\n```php\nRoute::redirect('/here', '/there');\n```\n\nSet the status code\n\n```php\nRoute::redirect('/here', '/there', 301);\n```\n\nPermanent `301` redirect\n\n```php\nRoute::permanentRedirect('/here', '/there');\n```\n\n### Regular Expression Constraints {.cols-2}\n\n```php\nRoute::get('/user/{name}', function ($name) {\n    //\n})->where('name', '[A-Za-z]+');\n\nRoute::get('/user/{id}', function ($id) {\n    //\n})->where('id', '[0-9]+');\n\nRoute::get('/user/{id}/{name}', function ($id, $name) {\n    //\n})->where(['id' => '[0-9]+', 'name' => '[a-z]+']);\n```\n\nSee also: [Regex Cheatsheet](/regex)\n\n### Named Routes\n\nRoute names should always be unique\n\n```php\nRoute::get('/user/profile', function () {\n    //\n})->name('profile');\n```\n\nSee: [Helpers](#helpers-cols-3)\n\n### Fallback Routes\n\n```php\nRoute::fallback(function () {\n    //\n});\n```\n\nExecuted when no other routes match\n\n### Route Groups\n\n#### Middleware\n\n```php\nRoute::middleware(['first', 'second'])->group(function () {\n    Route::get('/', function () {\n        // Uses first & second middleware...\n    });\n\n    Route::get('/user/profile', function () {\n        // Uses first & second middleware...\n    });\n});\n```\n\n#### URI Prefixes\n\n```php\nRoute::prefix('admin')->group(function () {\n    Route::get('/users', function () {\n        // Matches The \"/admin/users\" URL\n    });\n});\n```\n\n#### Name Prefix\n\n```php\nRoute::name('admin.')->group(function () {\n    Route::get('/users', function () {\n        // Route assigned name \"admin.users\"...\n    })->name('users');\n});\n```\n\nShare attributes across routes\n\n### Accessing current route\n\n```php\nuse Illuminate\\Support\\Facades\\Route;\n\n// Illuminate\\Routing\\Route\n$route = Route::current();\n\n// string\n$name = Route::currentRouteName();\n\n// string\n$action = Route::currentRouteAction();\n```\n\n## Helpers\n\n### routes {.row-span-2}\n\n#### Named route\n\n```php\n$url = route('profile');\n```\n\nWith parameters\n\n```php\n// Route::get('/user/{id}/profile', /*...*/ )->name('profile);\n\n$url = route('profile', ['id' => 1]);\n\n// /user/1/profile/\n```\n\nWith query string\n\n```php\n// Route::get('/user/{id}/profile', /*...*/ )->name('profile);\n\n$url = route('profile', ['id' => 1, 'photos'=>'yes']);\n\n// /user/1/profile?photos=yes\n```\n\n#### Redirects\n\n```php\n// Generating Redirects...\nreturn redirect()->route('profile');\n```\n\n#### Eloquent Models\n\n```php\necho route('post.show', ['post' => $post]);\n```\n\nThe route helper will automatically extract the model's route key. See [Routing](#routing-cols-4)\n\n### URL Generation\n\nGenerate arbitrary URLs for your application that will automatically use the scheme (HTTP or HTTPS) and host from the\ncurrent request\n\n```php\n$post = App\\Models\\Post::find(1);\n\necho url(\"/posts/{$post->id}\");\n\n// http://example.com/posts/1\n```\n\n#### Current URL\n\n```php\n// Get the current URL without the query string...\necho url()->current();\n\n// Get the current URL including the query string...\necho url()->full();\n\n// Get the full URL for the previous request...\necho url()->previous();\n```\n\n### Named Route URL\n\n```php\n$url = route('profile');\n```\n\nSee [Named Route](#named-route)\n\n### Error Handling\n\n```php\npublic function isValid($value)\n{\n    try {\n        // Validate the value...\n    } catch (Throwable $e) {\n        report($e);\n\n        return false;\n    }\n}\n```\n\nReport an exception but continue handling the current request\n\n### HTTP Exceptions\n\n```php\n// page not found\nabort(404);\n\n// Unauthorized\nabort(401);\n\n// Forbidden\nabort(403);\n\n// Server Error\nabort(500);\n```\n\nGenerate an HTTP exception response using status code\n\n## Controllers\n\n### Basic\n\n```php\nnamespace App\\Http\\Controllers;\n\nuse App\\Http\\Controllers\\Controller;\nuse App\\Models\\User;\n\nclass UserController extends Controller\n{\n    public function show($id)\n    {\n        return view('user.profile', [\n            'user' => User::findOrFail($id)\n        ]);\n    }\n}\n```\n\nDefine a route for this controller method:\n\n```php\nuse App\\Http\\Controllers\\UserController;\n\nRoute::get('/user/{id}', [UserController::class, 'show']);\n```\n\n## Requests\n\n### CSRF Protection\n\nLaravel automatically generates a CSRF \"token\" for each active user session.  \nThis token is used to verify that the authenticated user is the person actually making the requests.\n\nGet current session's token:\n\n```php\nRoute::get('/token', function (Request $request) {\n    $token = $request->session()->token();\n\n    $token = csrf_token();\n\n    // ...\n});\n```\n\n`POST`, `PUT`, `PATCH`, or `DELETE` forms should include a hidden CSRF `_token` field in the form to validate the\nrequest.\n\n```html\n<form method=\"POST\" action=\"/profile\">\n  @csrf\n\n  <!-- Equivalent to... -->\n  <input type=\"hidden\" name=\"_token\" value=\"{{ csrf_token() }}\" />\n</form>\n```\n\nSee [Forms](#forms-cols-3)\n\n### Accessing Request\n\nGet an instance of the current request by type-hinting the controller action or route closure\n\n```php\n// controller action\nclass UserController extends Controller\n{\n    public function store(Request $request)\n    {\n        $name = $request->input('name');\n    }\n}\n\n// closure\nRoute::get('/', function (Request $request) {\n    //\n});\n```\n\n[See Routing](#routing)\n\n### Path\n\nThe request's path information\n\n```php\n$uri = $request->path();\n\n// https://example.com/foo/bar --> foo/bar\n```\n\n#### Match path to pattern\n\nVerify that the incoming request path matches a given pattern\n\n```php\n// * is wildcard\nif ($request->is('admin/*')) {\n    //\n}\n```\n\nDetermine if the incoming request matches a named route\n\n```php\nif ($request->routeIs('admin.*')) {\n    //\n}\n```\n\n### URL\n\nFull URL for the incoming request\n\n```php\n// URL without the query string\n$url = $request->url();\n\n// URL including query string\n$urlWithQueryString = $request->fullUrl();\n\n// append data to query string\n$request->fullUrlWithQuery(['type' => 'phone']);\n```\n\n### Request Method\n\n```php\n$method = $request->method();\n\n// verify that the HTTP verb matches a given string\nif ($request->isMethod('post')) {\n    //\n}\n```\n\n### Client IP\n\n```php\n$ipAddress = $request->ip();\n```\n\n### Headers\n\n```php\n$value = $request->header('X-Header-Name');\n\n$value = $request->header('X-Header-Name', 'default value');\n\n// determine if the request contains a given header\nif ($request->hasHeader('X-Header-Name')) {\n    //\n}\n\n// retrieve a bearer token from the Authorization header\n$token = $request->bearerToken();\n```\n\n### Content Type\n\nReturn an array containing all the content types accepted by the request\n\n```php\n$contentTypes = $request->getAcceptableContentTypes();\n```\n\nBoolean check for content types are accepted by the request\n\n```php\nif ($request->accepts(['text/html', 'application/json'])) {\n    // ...\n}\n```\n\n### Input {.row-span-4}\n\nRetrieve all the incoming request's input data as an array\n\n```php\n$input = $request->all();\n```\n\nRetrieve all the incoming request's input data as a collection\n\n```php\n$input = $request->collect();\n\n// retrieve subset as collection\n$request->collect('users')->each(function ($user) {\n    // ...\n});\n```\n\nSee [Helpers](#helpers-cols-3)\n\nRetrieve user input (also gets values from query string)\n\n```php\n$name = $request->input('name');\n\n// with default value if none present\n$name = $request->input('name', 'Sally');\n```\n\nAccess array inputs\n\n```php\n$name = $request->input('products.0.name');\n\n$names = $request->input('products.*.name');\n```\n\nRetrieve all the input values as an associative array:\n\n```php\n$input = $request->input();\n```\n\nOnly retrieve values from the query string:\n\n```php\n$name = $request->query('name');\n\n// with default value\n$name = $request->query('name', 'Helen');\n```\n\nRetrieve all the query string values as an associative array:\n\n```php\n$query = $request->query();\n```\n\n#### Boolean Input Values\n\nHelpful for checkbox inputs or other booleans. Return `true` for `1`, `\"1\"`, `true`, `\"true\"`, `\"on\"`, and `\"yes\"`.  \nAll other values will return `false`\n\n```php\n$archived = $request->boolean('archived');\n```\n\n### Dynamic Properties\n\nAccess inputs via properties.  \nIf not found as an input, the route parameters will be checked.\n\n```php\n$name = $request->name;\n```\n\n### Retrieve Partial Input\n\n```php\n$input = $request->only(['username', 'password']);\n\n$input = $request->only('username', 'password');\n\n$input = $request->except(['credit_card']);\n\n$input = $request->except('credit_card');\n```\n\n### Check Existence\n\nDetermine if value(s) present\n\n```php\nif ($request->has('name')) {\n    //\n}\n\n// check if ALL values are present\nif ($request->has(['name', 'email'])) {\n    //\n}\n\n// if any values are present\nif ($request->hasAny(['name', 'email'])) {\n    //\n}\n\n// if a file is present on request\nif ($request->hasFile('image')) {\n    //\n}\n```\n\n### Old Input\n\nRetrieve input from the previous request\n\n```php\n$username = $request->old('username');\n```\n\nOr use the `old()` helper\n\n```php\n<input type=\"text\" name=\"username\" value=\"{{ old('username') }}\">\n```\n\nSee: [Helpers](#helpers-cols-3)  \nSee: [Forms](#forms-cols-3)\n\n### Uploaded Files\n\nRetrieve uploaded file from request\n\n```php\n$file = $request->file('photo');\n\n$file = $request->photo;\n```\n\nGet file path or extension\n\n```php\n$path = $request->photo->path();\n\n$extension = $request->photo->extension();\n```\n\nStore uploaded file with a randomly generated filename\n\n```php\n// path where the file should be stored relative to\n// the filesystem's configured root directory\n$path = $request->photo->store('images');\n\n// optional 2nd param to specify the filesystem disk\n$path = $request->photo->store('images', 's3');\n```\n\nStore uploaded file and specify the name\n\n```php\n$path = $request->photo->storeAs('images', 'filename.jpg');\n\n$path = $request->photo->storeAs('images', 'filename.jpg', 's3');\n```\n\nSee More: [Laravel File Storage](https://laravel.com/docs/8.x/filesystem)\n\n## Views\n\n### Intro\n\n- [Laravel Docs - Views](https://laravel.com/docs/8.x/views)\n\n```html\n<!-- View stored in resources/views/greeting.blade.php -->\n\n<html>\n  <body>\n    <h1>Hello, <?php echo $name; ?></h1>\n  </body>\n</html>\n```\n\nCreate a view by placing a file with the `.blade.php` extension in the `resources/views` directory.\n\n### Pass Data to Views\n\n#### As an array\n\n```php\nreturn view('greetings', ['name' => 'Victoria']);\n```\n\n#### Using with()\n\n```php\nreturn view('greeting')\n            ->with('name', 'Victoria')\n            ->with('occupation', 'Astronaut');\n```\n\nAccess each value using the data's keys\n\n```html\n<html>\n  <body>\n    <h1>Hello, {{ $name }}</h1>\n    <!-- Or -->\n    <h1>Hello, <?php echo $name; ?></h1>\n  </body>\n</html>\n```\n\n### view helper\n\nReturn a view from a route with the `view()` helper\n\n```php\nRoute::get('/', function () {\n    return view('greeting', ['name' => 'James']);\n});\n```\n\nSee: [View Routes](#view-routes) and [Helpers](#helpers)\n\n### Subdirectories\n\n```php\n// resources/views/admin.profile.blade.php\nreturn view('admin.profile');\n```\n\n## Blade Templates\n\n### Intro\n\n- [Laravel Docs - Blade Templates](https://laravel.com/docs/8.x/blade)\n\nBlade is the templating engine included in Laravel that also allows you to use plain PHP.\n\n### Views\n\nBlade views are returned using the `view()` helper\n\n```php\nRoute::get('/', function () {\n    return view('welcome', ['name' => 'Samantha']);\n});\n```\n\nSee: [Views](#view-helper)\n\n### Comments\n\n```html\n{{-- This comment will not be present in the rendered HTML --}}\n```\n\n### Directives {.row-span-3}\n\n#### if Statements\n\n```php\n@if (count($records) === 1)\n    I have one record!\n@elseif (count($records) > 1)\n    I have multiple records!\n@else\n    I don't have any records!\n@endif\n```\n\n#### isset & empty\n\n```php\n@isset($records)\n    // $records is defined and is not null...\n@endisset\n\n@empty($records)\n    // $records is \"empty\"...\n@endempty\n```\n\n#### Authentication\n\n```php\n@auth\n    // The user is authenticated...\n@endauth\n\n@guest\n    // The user is not authenticated...\n@endguest\n```\n\n#### Loops\n\n<!-- prettier-ignore -->\n```html\n@for ($i = 0; $i < 10; $i++)\n    The current value is {{ $i }}\n@endfor\n\n@foreach ($users as $user)\n    <p>This is user {{ $user->id }}</p>\n@endforeach\n\n@forelse ($users as $user)\n    <li>{{ $user->name }}</li>\n@empty\n    <p>No users</p>\n@endforelse\n\n@while (true)\n    <p>I'm looping forever.</p>\n@endwhile\n```\n\nLoop Iteration:\n\n```php\n@foreach ($users as $user)\n    @if ($loop->first)\n        This is the first iteration.\n    @endif\n\n    @if ($loop->last)\n        This is the last iteration.\n    @endif\n\n    <p>This is user {{ $user->id }}</p>\n@endforeach\n```\n\nSee more: [Laravel Loop Variable](https://laravel.com/docs/8.x/blade#the-loop-variable)\n\n### Displaying Data\n\nBlade's echo statements `{{ }}` are automatically sent through PHP's `htmlspecialchars` function to prevent XSS attacks.\n\nDisplay the contents of the name variable:\n\n```html\nHello, {{ $name }}.\n```\n\nDisplay results of a PHP function:\n\n```html\nThe current UNIX timestamp is {{ time() }}.\n```\n\nDisplay data without escaping with `htmlspecialchars`\n\n```html\nHello, {!! $name !!}.\n```\n\n### Including Subviews\n\nInclude a Blade view from within another view.  \nAll variables that are available to the parent view are also available to the included view\n\n```html\n<div>\n  <!-- resources/views/shared/errors/blade.php -->\n  @include('shared.errors')\n\n  <form>\n    <!-- Form Contents -->\n  </form>\n</div>\n```\n\n### Raw PHP\n\nExecute a block of plain PHP\n\n```php\n@php\n    $counter = 1;\n@endphp\n```\n\n### Stacks\n\nBlade allows you to push to named stacks which can be rendered in another view or layout.  \nUseful for javascript libraries required by child views\n\n```html\n<!-- Add to the stack -->\n@push('scripts')\n<script src=\"/example.js\"></script>\n@endpush\n```\n\nRender the stack\n\n```html\n<head>\n  <!-- Head Contents -->\n\n  @stack('scripts')\n</head>\n```\n\nPrepend to the beginning of a stack\n\n```php\n@push('scripts')\n    This will be second...\n@endpush\n\n// Later...\n\n@prepend('scripts')\n    This will be first...\n@endprepend\n```\n\n## Forms\n\n### Intro\n\n- [Laravel Docs - Forms](https://laravel.com/docs/8.x/blade#forms)\n\n### CSRF Field\n\nInclude a hidden CSRF token field to validate the request\n\n<!-- prettier-ignore -->\n```html\n<form method=\"POST\" action=\"/profile\">\n  @csrf\n\n  ...\n</form>\n```\n\nSee: [CSRF Protection](#csrf-protection)\n\n### Method Field\n\nSince HTML forms can't make `PUT`, `PATCH`, or `DELETE` requests, you will need to add a hidden `_method` field to spoof\nthese HTTP verbs:\n\n<!-- prettier-ignore -->\n```html\n<form action=\"/post/my-post\" method=\"POST\">\n  @method('PUT')\n\n  ...\n</form>\n```\n\n### Validation Errors\n\n<!-- prettier-ignore -->\n```html\n<!-- /resources/views/post/create.blade.php -->\n\n<label for=\"title\">Post Title</label>\n\n<input id=\"title\" type=\"text\" class=\"@error('title') is-invalid @enderror\" />\n\n@error('title')\n  <div class=\"alert alert-danger\">{{ $message }}</div>\n@enderror\n```\n\nSee: [Validation](#validation-cols-3)\n\n### Repopulating Forms\n\nWhen redirecting due to a validation error, request input is flashed to the session.  \nRetrieve the input from the previous request with the `old` method\n\n```php\n$title = $request->old('title');\n```\n\nOr the `old()` helper\n\n```html\n<input type=\"text\" name=\"title\" value=\"{{ old('title') }}\" />\n```\n\n## Validation\n\n### Intro\n\n- [Laravel Docs - Validation](https://laravel.com/docs/8.x/validation)\n\nIf validation fails, a redirect response to the previous URL will be generated.  \nIf the incoming request is an XHR request, a JSON response with the validation error messages will be returned.\n\n### Logic\n\n```php\n// in routes/web.php\nRoute::get('/post/create', [App\\Http\\Controllers\\PostController::class, 'create']);\nRoute::post('/post', [App\\Http\\Controllers\\PostController::class, 'store']);\n\n// in app/Http/Controllers/PostController...\npublic function store(Request $request)\n{\n    $validated = $request->validate([\n        // input name => validation rules\n        'title' => 'required|unique:posts|max:255',\n        'body' => 'required',\n    ]);\n\n    // The blog post is valid...\n}\n```\n\n### Rules {.row-span-5}\n\nCan also be passed as an array\n\n```php\n$validatedData = $request->validate([\n    'title' => ['required', 'unique:posts', 'max:255'],\n    'body' => ['required'],\n]);\n```\n\n#### after:date\n\nField must be a value after a given date.\n\n```php\n'start_date' => 'required|date|after:tomorrow'\n```\n\nInstead of a date string, you may specify another field to compare against the date\n\n```php\n'finish_date' => 'required|date|after:start_date'\n```\n\nSee [before:date](#beforedate)\n\n#### after_or_equal:date\n\nField must be a value after or equal to the given date.  \nSee [after:date](#afterdate)\n\n#### before:date\n\nField must be a value preceding the given date.  \nThe name of another field may be supplied as the value of `date`.  \nSee [after:date](#afterdate)\n\n#### alpha_num\n\nField must be entirely alpha-numeric characters\n\n#### boolean\n\nField must be able to be cast as a `boolean`.  \nAccepted input are `true`, `false`, `1`, `0`, `\"1\"`, and `\"0\"`\n\n#### confirmed\n\nField must have a matching field of `{field}_confirmation`.  \nFor example, if the field is password, a matching `password_confirmation` field must be present\n\n#### current_password\n\nField must match the authenticated user's password.\n\n#### date\n\nField must be a valid, non-relative date according to the `strtotime` PHP function.\n\n#### email\n\nField must be formatted as an email address.\n\n#### file\n\nField must be a successfully uploaded file.  \nSee: [Uploaded Files](#uploaded-files)\n\n#### max:value\n\nField must be less than or equal to a maximum value.  \nStrings, numerics, arrays, and files are evaluated like the [size](#sizevalue) rule.\n\n#### min:value\n\nField must have a minimum value.  \nStrings, numerics, arrays, and files are evaluated like the [size](#sizevalue) rule.\n\n#### mimetypes:text/plain,...\n\nFile must match one of the given MIME types:\n\n```php\n'video' => 'mimetypes:video/avi,video/mpeg,video/quicktime'\n```\n\nFile's contents will be read and the framework will attempt to guess the MIME type, regardless of the client's provided\nMIME type.\n\n#### mimes:foo,bar,...\n\nField must have a MIME type corresponding to one of the listed extensions.\n\n```php\n'photo' => 'mimes:jpg,bmp,png'\n```\n\nFile's contents will be read and the framework will attempt to guess the MIME type, regardless of the client's provided\nMIME type.\n\n[Full listing of MIME types & extensions](https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types)\n\n#### nullable\n\nField may be null.\n\n#### numeric\n\nField must be numeric.\n\n#### password\n\nField must match the authenticated user's password.\n\n#### prohibited\n\nField must be empty or not present.\n\n#### prohibited_if:anotherfield,value,...\n\nField must be empty or not present if the _anotherfield_ field is equal to any value.\n\n#### prohibited_unless:anotherfield,value,...\n\nField must be empty or not present unless the _anotherfield_ field is equal to any value.\n\n#### required\n\nField must be present in the input data and not empty.  \nA field is considered \"empty\" if one of the following conditions are true:\n\n- The value is `null`.\n- The value is an empty string.\n- The value is an empty array or empty `Countable` object.\n- The value is an uploaded file with no path.\n\n#### required_with:foo,bar,...\n\nField must be present and not empty, only if any of the other specified fields are present and not empty\n\n#### size:value\n\nField must have a size matching the given value.\n\n- For strings: number of characters\n- For numeric data: integer value (must also have the `numeric` or `integer` rule).\n- For arrays: count of the array\n- For files: file size in kilobytes\n\n```php\n// Validate that a string is exactly 12 characters long...\n'title' => 'size:12';\n// Validate that a provided integer equals 10...\n'seats' => 'integer|size:10';\n// Validate that an array has exactly 5 elements...\n'tags' => 'array|size:5';\n// Validate that an uploaded file is exactly 512 kilobytes...\n'image' => 'file|size:512';\n```\n\n#### unique:table,column\n\nField must not exist within the given database table\n\n#### url\n\nField must be a valid URL\n\n[See all available rules](https://laravel.com/docs/8.x/validation#available-validation-rules)\n\n### Validate Passwords\n\nEnsure passwords have an adequate level of complexity\n\n```php\n$validatedData = $request->validate([\n    'password' => ['required', 'confirmed', Password::min(8)],\n]);\n```\n\n`Password` rule object allows you to easily customize the password complexity requirements\n\n```php\n// Require at least 8 characters...\nPassword::min(8)\n\n// Require at least one letter...\nPassword::min(8)->letters()\n\n// Require at least one uppercase and one lowercase letter...\nPassword::min(8)->mixedCase()\n\n// Require at least one number...\nPassword::min(8)->numbers()\n\n// Require at least one symbol...\nPassword::min(8)->symbols()\n```\n\nEnsure a password has not been compromised in a public password data breach leak\n\n```php\nPassword::min(8)->uncompromised()\n```\n\n> _Uses the [k-Anonymity](https://en.wikipedia.org/wiki/K-anonymity) model via the\n> [haveibeenpwned.com](https://haveibeenpwned.com) service without sacrificing the user's privacy or security_\n\nMethods can be chained\n\n```php\nPassword::min(8)\n    ->letters()\n    ->mixedCase()\n    ->numbers()\n    ->symbols()\n    ->uncompromised()\n```\n\n### Display Validation Errors\n\n```php\n<!-- /resources/views/post/create.blade.php -->\n\n<h1>Create Post</h1>\n\n@if ($errors->any())\n    <div class=\"alert alert-danger\">\n        <ul>\n            @foreach ($errors->all() as $error)\n                <li>{{ $error }}</li>\n            @endforeach\n        </ul>\n    </div>\n@endif\n\n<!-- Create Post Form -->\n```\n\nSee: [Validation Errors](#validation-errors)\n\n### Optional Fields\n\nYou will often need to mark your \"optional\" request fields as `nullable` if you do not want the validator to consider\n`null` values as invalid\n\n```php\n// publish_at field may be either null or a valid date representation\n$request->validate([\n    'title' => 'required|unique:posts|max:255',\n    'body' => 'required',\n    'publish_at' => 'nullable|date',\n]);\n```\n\n### Validated Input\n\nRetrieve the request data that underwent validation\n\n```php\n$validated = $request->validated();\n```\n\nOr with `safe()`, which returns an instance of `Illuminate\\Support\\ValidatedInput`\n\n```php\n$validated = $request->safe()->only(['name', 'email']);\n\n$validated = $request->safe()->except(['name', 'email']);\n\n$validated = $request->safe()->all();\n```\n\n#### Iterate\n\n```php\nforeach ($request->safe() as $key => $value) {\n    //\n}\n```\n\n#### Access as an array\n\n```php\n$validated = $request->safe();\n\n$email = $validated['email'];\n```\n\n## Session\n\n### Intro\n\n- [Laravel Docs - Session](https://laravel.com/docs/8.x/session)\n\nLaravel ships with a variety of session backends that are accessed through a unified API. Memcached, Redis, and database\nsupport is included.\n\n#### Configuration\n\nSession configuration is in `config/session.php`.  \nBy default, Laravel is configured to use the file session driver\n\n### Check Isset / Exists\n\nReturns `true` if the item is present and is not `null`:\n\n```php\nif ($request->session()->has('users')) {\n    //\n}\n```\n\nReturns `true` if present, even if it's `null`:\n\n```php\nif ($request->session()->exists('users')) {\n    //\n}\n```\n\nReturns `true` if the item is `null` or is not present:\n\n```php\nif ($request->session()->missing('users')) {\n    //\n}\n```\n\n### Retrieving Data {.row-span-2}\n\n#### Via Request\n\n```php\n// ...\nclass UserController extends Controller\n{\n    public function show(Request $request, $id)\n    {\n        $value = $request->session()->get('key');\n\n        //\n    }\n}\n```\n\nPass a default value as the second argument to use if the key does not exist\n\n```php\n$value = $request->session()->get('key', 'default');\n\n// closure can be passed and executed as a default\n$value = $request->session()->get('key', function () {\n    return 'default';\n});\n```\n\n#### Via session helper\n\n```php\nRoute::get('/home', function () {\n    // Retrieve a piece of data from the session...\n    $value = session('key');\n\n    // Specifying a default value...\n    $value = session('key', 'default');\n\n    // Store a piece of data in the session...\n    session(['key' => 'value']);\n});\n```\n\nSee: [Session Helper]()\n\n#### All Session Data\n\n```php\n$data = $request->session()->all();\n```\n\n#### Retrieve and Delete\n\nRetrieve and delete an item from the session\n\n```php\n$value = $request->session()->pull('key', 'default');\n```\n\n### Store Data\n\nVia a request instance\n\n```php\n$request->session()->put('key', 'value');\n```\n\nVia the global \"session\" helper\n\n```php\nsession(['key' => 'value']);\n```\n\nPush a new value onto a session value that is an array\n\n```php\n// array of team names\n$request->session()->push('user.teams', 'developers');\n```\n\n## Logging\n\n### Configuration\n\nConfiguration options for logging behavior is in `config/logging.php`.  \nBy default, Laravel will use the stack channel when logging messages, which aggregates multiple log channels into a\nsingle channel.\n\n### Levels {.row-span-2}\n\nAll the log levels defined in the [RFC 5424 specification](https://tools.ietf.org/html/rfc5424) are available:\n\n- emergency\n- alert\n- critical\n- error\n- warning\n- notice\n- info\n- debug\n\n### Log Facade {.row-span-2}\n\n```php\nuse Illuminate\\Support\\Facades\\Log;\n\nLog::emergency($message);\nLog::alert($message);\nLog::critical($message);\nLog::error($message);\nLog::warning($message);\nLog::notice($message);\nLog::info($message);\nLog::debug($message);\n```\n\n### Contextual Info\n\n```php\nuse Illuminate\\Support\\Facades\\Log;\n\nLog::info('User failed to login.', ['id' => $user->id]);\n```\n\n## Deployment\n\n### Intro\n\n- [Laravel Docs - Deployment](https://laravel.com/docs/8.x/deployment)\n\nEnsure your web server directs all requests to your application's `public/index.php` file\n\n### Optimization\n\n#### Composer's autoloader map\n\n```bash\ncomposer install --optimize-autoloader --no-dev\n```\n\n#### Configuration Loading\n\nBe sure that you are only calling the `env` function from within your configuration files.  \nOnce the configuration has been cached, the `.env` file will not be loaded and all calls to the `env` function for\n`.env` variables will return `null`\n\n```bash\nphp artisan config:cache\n```\n\n#### Route Loading\n\n```bash\nphp artisan route:cache\n```\n\n#### View Loading\n\n```bash\nphp artisan view:cache\n```\n\n### Debug Mode\n\nThe debug option in your `config/app.php` determines how much information about an error is actually displayed to the\nuser.  \nBy default, this option is set to the value of the `APP_DEBUG` environment variable in your `.env` file. In your\nproduction environment, this value should always be `false`.  \nIf the `APP_DEBUG` variable is set to `true` in production, you risk exposing sensitive configuration values to end\nusers.\n\n## Also see\n\n- [Laravel Docs](https://laravel.com/docs/8.x)\n- [Laracasts](https://laracasts.com/)\n- [Laravel API](https://laravel.com/api/8.x/)\n"
  },
  {
    "path": "source/_posts/latex.md",
    "content": "---\ntitle: LaTeX\ndate: 2022-12-30 09:51:44\nbackground: bg-[#2a338a]\ntags:\ncategories:\n  - Programming\nintro: |\n  This cheat sheet summarizes a reference list of [LaTeX](https://www.latex-project.org/) commonly used display math notation and some application examples of [KaTeX](https://katex.org/).\nplugins:\n  - katex\n  - copyCode\n---\n\n## Getting Started\n\n### Introduction\n\n[LaTeX](https://www.latex-project.org/) A TEX-based typesetting system suitable for producing scientific, mathematical,\nand physical documents of high print quality.\n\n- [LaTeX official website](https://www.latex-project.org/) _(latex-project.org)_\n- [KaTeX official website](https://katex.org/) _(katex.org)_\n\nAnd [KaTeX](https://katex.org/) handles only a smaller subset of LaTeX's mathematical notation for display on the web\n\n### Example\n\n```KaTeX\n% \\f is defined as #1f(#2) using the macro\nf\\relax(x) = \\int_{-\\infty}^\\infty\n    f\\hat\\xi\\,e^{2 \\pi i \\xi x}\n    \\,d\\xi\n```\n\n---\n\n```LaTeX\n% \\f is defined as #1f(#2) using the macro\nf\\relax(x) = \\int_{-\\infty}^\\infty\n    f\\hat\\xi\\,e^{2 \\pi i \\xi x}\n    \\,d\\xi\n```\n\n### Inline\n\n```markdown\nBased on KaTeX in one lineExample  \nExample： `KaTeX:\\int_0^\\infty x^2 dx`\n```\n\nExample based on KaTeX showing on one line: `KaTeX:\\int_0^\\infty x^2 dx`\n\n## Supported Functions\n\n### Accents {.col-span-2 .row-span-2}\n\n| :-                                             | :-                                                                     | :-                                                               |\n| :--------------------------------------------- | :--------------------------------------------------------------------- | :--------------------------------------------------------------- |\n| `KaTeX:a'` <pur>`a'`</pur>                     | `KaTeX:\\tilde{a}` <pur>`\\tilde{a}`</pur>                               | `KaTeX:\\mathring{g}` <pur>`\\mathring{g}`</pur>                   |\n| `KaTeX:a''` <pur>`a''`</pur>                   | `KaTeX:\\widetilde{ac}` <pur>`\\widetilde{ac}`</pur>                     | `KaTeX:\\overgroup{AB}` <pur>`\\overgroup{AB}`</pur>               |\n| `KaTeX:a^{\\prime}` <pur>`a^{\\prime}`</pur>     | `KaTeX:\\utilde{AB}` <pur>`\\utilde{AB}`</pur>                           | `KaTeX:\\undergroup{AB}` <pur>`\\undergroup{AB}`</pur>             |\n| `KaTeX:\\acute{a}` <pur>`\\acute{a}`</pur>       | `KaTeX:\\vec{F}` <pur>`\\vec{F}`</pur>                                   | `KaTeX:\\Overrightarrow{AB}` <pur>`\\Overrightarrow{AB}`</pur>     |\n| `KaTeX:\\bar{y}` <pur>`\\bar{y}`</pur>           | `KaTeX:\\overleftarrow{AB}` <pur>`\\overleftarrow{AB}`</pur>             | `KaTeX:\\overrightarrow{AB}` <pur>`\\overrightarrow{AB}`</pur>     |\n| `KaTeX:\\breve{a}` <pur>`\\breve{a}`</pur>       | `KaTeX:\\underleftarrow{AB}` <pur>`\\underleftarrow{AB}`</pur>           | `KaTeX:\\underrightarrow{AB}` <pur>`\\underrightarrow{AB}`</pur>   |\n| `KaTeX:\\check{a}` <pur>`\\check{a}`</pur>       | `KaTeX:\\overleftharpoon{ac}` <pur>`\\overleftharpoon{ac}`</pur>         | `KaTeX:\\overrightharpoon{ac}` <pur>`\\overrightharpoon{ac}`</pur> |\n| `KaTeX:\\dot{a}` <pur>`\\dot{a}`</pur>           | `KaTeX:\\overleftrightarrow{AB}` <pur>`\\overleftrightarrow{AB}`</pur>   | `KaTeX:\\overbrace{AB}` <pur>`\\overbrace{AB}`</pur>               |\n| `KaTeX:\\ddot{a}` <pur>`\\ddot{a}`</pur>         | `KaTeX:\\underleftrightarrow{AB}` <pur>`\\underleftrightarrow{AB}`</pur> | `KaTeX:\\underbrace{AB}` <pur>`\\underbrace{AB}`</pur>             |\n| `KaTeX:\\grave{a}` <pur>`\\grave{a}`</pur>       | `KaTeX:\\overline{AB}` <pur>`\\overline{AB}`</pur>                       | `KaTeX:\\overlinesegment{AB}` <pur>`\\overlinesegment{AB}`</pur>   |\n| `KaTeX:\\hat{\\theta}` <pur>`\\hat{\\theta}`</pur> | `KaTeX:\\underline{AB}` <pur>`\\underline{AB}`</pur>                     | `KaTeX:\\underlinesegment{AB}` <pur>`\\underlinesegment{AB}`</pur> |\n| `KaTeX:\\widehat{ac}` <pur>`\\widehat{ac}`</pur> | `KaTeX:\\widecheck{ac}` <pur>`\\widecheck{ac}`</pur>                     | `KaTeX:\\underbar{X}` <pur>`\\underbar{X}`</pur>                   |\n\n### Emphasis in \\text&lcub;...&rcub;\n\n| :-                                                   | :-                               |\n| :--------------------------------------------------- | :------------------------------- |\n| `KaTeX:\\'{a}` <pur>`\\'{a}`</pur>                     | `KaTeX:\\~{a}` <pur>`\\~{a}`</pur> |\n| `KaTeX:\\.{a}` <pur>`\\.{a}`</pur>                     | `KaTeX:\\H{a}` <pur>`\\H{a}`</pur> |\n| ``KaTeX:\\\\\\`{a}`` <pur><code>\\\\&#96;{a}</code></pur> | `KaTeX:\\={a}` <pur>`\\={a}`</pur> |\n| `KaTeX:\\\"{a}` <pur>`\\\"{a}`</pur>                     | `KaTeX:\\v{a}` <pur>`\\v{a}`</pur> |\n| `KaTeX:\\^{a}` <pur>`\\^{a}`</pur>                     | `KaTeX:\\u{a}` <pur>`\\u{a}`</pur> |\n| `KaTeX:\\r{a}` <pur>`\\r{a}`</pur>                     |\n\n### Delimiter Sizing\n\n| :-                                  | :-                                       |\n| :---------------------------------- | :--------------------------------------- |\n| `KaTeX:\\left(\\LARGE{AB}\\right)`     | <pur>`\\left(\\LARGE{AB}\\right)`</pur>     |\n| `KaTeX:( \\big( \\Big( \\bigg( \\Bigg(` | <pur>`( \\big( \\Big( \\bigg( \\Bigg(`</pur> |\n\n---\n\n| :-        | :-      | :-       | :-       | :-       |\n| :-------- | :------ | :------- | :------- | :------- |\n| `\\left`   | `\\big`  | `\\bigl`  | `\\bigm`  | `\\bigr`  |\n| `\\middle` | `\\Big`  | `\\Bigl`  | `\\Bigm`  | `\\Bigr`  |\n| `\\right`  | `\\bigg` | `\\biggl` | `\\biggm` | `\\biggr` |\n| `\\`       | `\\Bigg` | `\\Biggl` | `\\Biggm` | `\\Biggr` |\n\n### Greek and Hebrew letters {.col-span-3}\n\n| preview          | method                | preview         | method               | preview          | method                | preview             | method                   | preview         | method               | preview          | method                |\n| :--------------- | :-------------------- | :-------------- | :------------------- | :--------------- | :-------------------- | :------------------ | :----------------------- | :-------------- | :------------------- | :--------------- | :-------------------- |\n| `KaTeX:\\alpha`   | <pur>`\\alpha`</pur>   | `KaTeX:\\kappa`  | <pur>`\\kappa`</pur>  | `KaTeX:\\psi`     | <pur>`\\psi`</pur>     | `KaTeX:\\digamma`    | <pur>`\\digamma`</pur>    | `KaTeX:\\Delta`  | <pur>`\\Delta`</pur>  | `KaTeX:\\Theta`   | <pur>`\\Theta`</pur>   |\n| `KaTeX:\\beta`    | <pur>`\\beta`</pur>    | `KaTeX:\\lambda` | <pur>`\\lambda`</pur> | `KaTeX:\\rho`     | <pur>`\\rho`</pur>     | `KaTeX:\\varepsilon` | <pur>`\\varepsilon`</pur> | `KaTeX:\\Gamma`  | <pur>`\\Gamma`</pur>  | `KaTeX:\\Upsilon` | <pur>`\\Upsilon`</pur> |\n| `KaTeX:\\chi`     | <pur>`\\chi`</pur>     | `KaTeX:\\mu`     | <pur>`\\mu`</pur>     | `KaTeX:\\sigma`   | <pur>`\\sigma`</pur>   | `KaTeX:\\varkappa`   | <pur>`\\varkappa`</pur>   | `KaTeX:\\Lambda` | <pur>`\\Lambda`</pur> | `KaTeX:\\Xi`      | <pur>`\\Xi`</pur>      |\n| `KaTeX:\\delta`   | <pur>`\\delta`</pur>   | `KaTeX:\\nu`     | <pur>`\\nu`</pur>     | `KaTeX:\\tau`     | <pur>`\\tau`</pur>     | `KaTeX:\\varphi`     | <pur>`\\varphi`</pur>     | `KaTeX:\\Omega`  | <pur>`\\Omega`</pur>  |                  |                       |\n| `KaTeX:\\epsilon` | <pur>`\\epsilon`</pur> | `KaTeX:o`       | <pur>`o`</pur>       | `KaTeX:\\theta`   | <pur>`\\theta`</pur>   | `KaTeX:\\varpi`      | <pur>`\\varpi`</pur>      | `KaTeX:\\Phi`    | <pur>`\\Phi`</pur>    | `KaTeX:\\aleph`   | <pur>`\\aleph`</pur>   |\n| `KaTeX:\\eta`     | <pur>`\\eta`</pur>     | `KaTeX:\\omega`  | <pur>`\\omega`</pur>  | `KaTeX:\\upsilon` | <pur>`\\upsilon`</pur> | `KaTeX:\\varrho`     | <pur>`\\varrho`</pur>     | `KaTeX:\\Pi`     | <pur>`\\Pi`</pur>     | `KaTeX:\\beth`    | <pur>`\\beth`</pur>    |\n| `KaTeX:\\gamma`   | <pur>`\\gamma`</pur>   | `KaTeX:\\phi`    | <pur>`\\phi`</pur>    | `KaTeX:\\xi`      | <pur>`\\xi`</pur>      | `KaTeX:\\varsigma`   | <pur>`\\varsigma`</pur>   | `KaTeX:\\Psi`    | <pur>`\\Psi`</pur>    | `KaTeX:\\daleth`  | <pur>`\\daleth`</pur>  |\n| `KaTeX:\\iota`    | <pur>`\\iota`</pur>    | `KaTeX:\\pi`     | <pur>`\\pi`</pur>     | `KaTeX:\\zeta`    | <pur>`\\zeta`</pur>    | `KaTeX:\\vartheta`   | <pur>`\\vartheta`</pur>   | `KaTeX:\\Sigma`  | <pur>`\\Sigma`</pur>  | `KaTeX:\\gimel`   | <pur>`\\gimel`</pur>   |\n\n{.left-align}\n\n#### Other letters\n\n| :-               | :-                    | :-               | :-                    | :-               | :-                    | :-                 | :-                      | :-                 | :-                      |\n| :--------------- | :-------------------- | :--------------- | :-------------------- | :--------------- | :-------------------- | :----------------- | :---------------------- | :----------------- | :---------------------- |\n| `KaTeX:\\imath`   | <pur>`\\imath`</pur>   | `KaTeX:\\nabla`   | <pur>`\\nabla`</pur>   | `KaTeX:\\Im`      | <pur>`\\Im`</pur>      | `KaTeX:\\Reals`     | <pur>`\\Reals`</pur>     | `KaTeX:\\text{\\OE}` | <pur>`\\text{\\OE}`</pur> |\n| `KaTeX:\\jmath`   | <pur>`\\jmath`</pur>   | `KaTeX:\\partial` | <pur>`\\partial`</pur> | `KaTeX:\\image`   | <pur>`\\image`</pur>   | `KaTeX:\\wp`        | <pur>`\\wp`</pur>        | `KaTeX:\\text{\\o}`  | <pur>`\\text{\\o}`</pur>  |\n| `KaTeX:\\aleph`   | <pur>`\\aleph`</pur>   | `KaTeX:\\Game`    | <pur>`\\Game`</pur>    | `KaTeX:\\Bbbk`    | <pur>`\\Bbbk`</pur>    | `KaTeX:\\weierp`    | <pur>`\\weierp`</pur>    | `KaTeX:\\text{\\O}`  | <pur>`\\text{\\O}`</pur>  |\n| `KaTeX:\\alef`    | <pur>`\\alef`</pur>    | `KaTeX:\\Finv`    | <pur>`\\Finv`</pur>    | `KaTeX:\\N`       | <pur>`\\N`</pur>       | `KaTeX:\\Z`         | <pur>`\\Z`</pur>         | `KaTeX:\\text{\\ss}` | <pur>`\\text{\\ss}`</pur> |\n| `KaTeX:\\alefsym` | <pur>`\\alefsym`</pur> | `KaTeX:\\cnums`   | <pur>`\\cnums`</pur>   | `KaTeX:\\natnums` | <pur>`\\natnums`</pur> | `KaTeX:\\text{\\aa}` | <pur>`\\text{\\aa}`</pur> | `KaTeX:\\text{\\i}`  | <pur>`\\text{\\i}`</pur>  |\n| `KaTeX:\\beth`    | <pur>`\\beth`</pur>    | `KaTeX:\\Complex` | <pur>`\\Complex`</pur> | `KaTeX:\\R`       | <pur>`\\R`</pur>       | `KaTeX:\\text{\\AA}` | <pur>`\\text{\\AA}`</pur> | `KaTeX:\\text{\\j}`  | <pur>`\\text{\\j}`</pur>  |\n| `KaTeX:\\gimel`   | <pur>`\\gimel`</pur>   | `KaTeX:\\ell`     | <pur>`\\ell`</pur>     | `KaTeX:\\Re`      | <pur>`\\Re`</pur>      | `KaTeX:\\text{\\ae}` | <pur>`\\text{\\ae}`</pur> |                    |                         |\n| `KaTeX:\\daleth`  | <pur>`\\daleth`</pur>  | `KaTeX:\\hbar`    | <pur>`\\hbar`</pur>    | `KaTeX:\\real`    | <pur>`\\real`</pur>    | `KaTeX:\\text{\\AE}` | <pur>`\\text{\\AE}`</pur> |                    |                         |\n| `KaTeX:\\eth`     | <pur>`\\eth`</pur>     | `KaTeX:\\hslash`  | <pur>`\\hslash`</pur>  | `KaTeX:\\reals`   | <pur>`\\reals`</pur>   | `KaTeX:\\text{\\oe}` | <pur>`\\text{\\oe}`</pur> |                    |                         |\n\n{.left-align}\n\n### Alphabets and Unicode {.col-span-3}\n\n| preview             | method                   | preview           | method                 | preview           | method                 | preview             | method                   |\n| :------------------ | :----------------------- | :---------------- | :--------------------- | :---------------- | :--------------------- | :------------------ | :----------------------- |\n| `KaTeX:\\Alpha`      | <pur>`\\Alpha`</pur>      | `KaTeX:\\Beta`     | <pur>`\\Beta`</pur>     | `KaTeX:\\Gamma`    | <pur>`\\Gamma`</pur>    | `KaTeX:\\Delta`      | <pur>`\\Delta`</pur>      |\n| `KaTeX:\\Epsilon`    | <pur>`\\Epsilon`</pur>    | `KaTeX:\\Zeta`     | <pur>`\\Zeta`</pur>     | `KaTeX:\\Eta`      | <pur>`\\Eta`</pur>      | `KaTeX:\\Theta`      | <pur>`\\Theta`</pur>      |\n| `KaTeX:\\Iota`       | <pur>`\\Iota`</pur>       | `KaTeX:\\Kappa`    | <pur>`\\Kappa`</pur>    | `KaTeX:\\Lambda`   | <pur>`\\Lambda`</pur>   | `KaTeX:\\Mu`         | <pur>`\\Mu`</pur>         |\n| `KaTeX:\\Nu`         | <pur>`\\Nu`</pur>         | `KaTeX:\\Xi`       | <pur>`\\Xi`</pur>       | `KaTeX:\\Omicron`  | <pur>`\\Omicron`</pur>  | `KaTeX:\\Pi`         | <pur>`\\Pi`</pur>         |\n| `KaTeX:\\Rho`        | <pur>`\\Rho`</pur>        | `KaTeX:\\Sigma`    | <pur>`\\Sigma`</pur>    | `KaTeX:\\Tau`      | <pur>`\\Tau`</pur>      | `KaTeX:\\Upsilon`    | <pur>`\\Upsilon`</pur>    |\n| `KaTeX:\\Phi`        | <pur>`\\Phi`</pur>        | `KaTeX:\\Chi`      | <pur>`\\Chi`</pur>      | `KaTeX:\\Psi`      | <pur>`\\Psi`</pur>      | `KaTeX:\\Omega`      | <pur>`\\Omega`</pur>      |\n| `KaTeX:\\varGamma`   | <pur>`\\varGamma`</pur>   | `KaTeX:\\varDelta` | <pur>`\\varDelta`</pur> | `KaTeX:\\varTheta` | <pur>`\\varTheta`</pur> | `KaTeX:\\varLambda`  | <pur>`\\varLambda`</pur>  |\n| `KaTeX:\\varXi`      | <pur>`\\varXi`</pur>      | `KaTeX:\\varPi`    | <pur>`\\varPi`</pur>    | `KaTeX:\\varSigma` | <pur>`\\varSigma`</pur> | `KaTeX:\\varUpsilon` | <pur>`\\varUpsilon`</pur> |\n| `KaTeX:\\varPhi`     | <pur>`\\varPhi`</pur>     | `KaTeX:\\varPsi`   | <pur>`\\varPsi`</pur>   | `KaTeX:\\varOmega` | <pur>`\\varOmega`</pur> |                     |                          |\n| `KaTeX:\\alpha`      | <pur>`\\alpha`</pur>      | `KaTeX:\\beta`     | <pur>`\\beta`</pur>     | `KaTeX:\\gamma`    | <pur>`\\gamma`</pur>    | `KaTeX:\\delta`      | <pur>`\\delta`</pur>      |\n| `KaTeX:\\epsilon`    | <pur>`\\epsilon`</pur>    | `KaTeX:\\zeta`     | <pur>`\\zeta`</pur>     | `KaTeX:\\eta`      | <pur>`\\eta`</pur>      | `KaTeX:\\theta`      | <pur>`\\theta`</pur>      |\n| `KaTeX:\\iota`       | <pur>`\\iota`</pur>       | `KaTeX:\\kappa`    | <pur>`\\kappa`</pur>    | `KaTeX:\\lambda`   | <pur>`\\lambda`</pur>   | `KaTeX:\\mu`         | <pur>`\\mu`</pur>         |\n| `KaTeX:\\nu`         | <pur>`\\nu`</pur>         | `KaTeX:\\xi`       | <pur>`\\xi`</pur>       | `KaTeX:\\omicron`  | <pur>`\\omicron`</pur>  | `KaTeX:\\pi`         | <pur>`\\pi`</pur>         |\n| `KaTeX:\\rho`        | <pur>`\\rho`</pur>        | `KaTeX:\\sigma`    | <pur>`\\sigma`</pur>    | `KaTeX:\\tau`      | <pur>`\\tau`</pur>      | `KaTeX:\\upsilon`    | <pur>`\\upsilon`</pur>    |\n| `KaTeX:\\phi`        | <pur>`\\phi`</pur>        | `KaTeX:\\chi`      | <pur>`\\chi`</pur>      | `KaTeX:\\psi`      | <pur>`\\psi`</pur>      | `KaTeX:\\omega`      | <pur>`\\omega`</pur>      |\n| `KaTeX:\\varepsilon` | <pur>`\\varepsilon`</pur> | `KaTeX:\\varkappa` | <pur>`\\varkappa`</pur> | `KaTeX:\\vartheta` | <pur>`\\vartheta`</pur> | `KaTeX:\\thetasym`   | <pur>`\\thetasym`</pur>   |\n| `KaTeX:\\varpi`      | <pur>`\\varpi`</pur>      | `KaTeX:\\varrho`   | <pur>`\\varrho`</pur>   | `KaTeX:\\varsigma` | <pur>`\\varsigma`</pur> | `KaTeX:\\varphi`     | <pur>`\\varphi`</pur>     |\n| `KaTeX:\\digamma`    | <pur>`\\digamma`</pur>    |\n\n{.show-header left-align}\n\n### Annotation {.col-span-3}\n\n| :-                                                    | :-                             | :-                                       | :-                                            |\n| :---------------------------------------------------- | :----------------------------- | :--------------------------------------- | :-------------------------------------------- |\n| `KaTeX:\\cancel{5}`                                    | <pur>`\\cancel{5}`</pur>        | `KaTeX:\\overbrace{a+b+c}^{\\text{note}}`  | <pur>`\\overbrace{a+b+c}^{\\text{note}}`</pur>  |\n| `KaTeX:\\bcancel{5}`                                   | <pur>`\\bcancel{5}`</pur>       | `KaTeX:\\underbrace{a+b+c}_{\\text{note}}` | <pur>`\\underbrace{a+b+c}_{\\text{note}}`</pur> |\n| `KaTeX:\\xcancel{ABC}`                                 | <pur>`\\xcancel{ABC}`</pur>     | `KaTeX:\\not =`                           | <pur>`\\not =`</pur>                           |\n| `KaTeX:\\sout{abc}`                                    | <pur>`\\sout{abc}`</pur>        | `KaTeX:\\boxed{\\pi=\\frac c d}`            | <pur>`\\boxed{\\pi=\\frac c d}`</pur>            |\n| `KaTeX:\\$a_{\\angl n}` _<red>MD syntax conflict</red>_ | <pur>`$a_{\\angl n}`</pur>      | `KaTeX:a_\\angln`                         | <pur>`a_\\angln`</pur>                         |\n| `KaTeX:\\phase{-78^\\circ}`                             | <pur>`\\phase{-78^\\circ}`</pur> |\n\n<pur>\\tag{hi} x+y^{2x}</pur>\n\n```KaTex\n\\tag{hi} x+y^{2x}\n```\n\n<pur>\\tag\\*{hi} x+y^{2x}</pur>\n\n```KaTex\n\\tag*{hi} x+y^{2x}\n```\n\n### Vertical layout {.col-span-3}\n\n| :-                                     | :-                                          | :-                      | :-                           | :-                                                          | :-                                                    |\n| :------------------------------------- | :------------------------------------------ | :---------------------- | :--------------------------- | :---------------------------------------------------------- | :---------------------------------------------------- |\n| `KaTeX:x_n`                            | <pur>`x_n`</pur>                            | `KaTeX:\\stackrel{!}{=}` | <pur>`\\stackrel{!}{=}`</pur> | `KaTeX:a \\atop b`                                           | `a \\atop b`                                           |\n| `KaTeX:e^x`                            | <pur>`e^x`</pur>                            | `KaTeX:\\overset{!}{=}`  | <pur>`\\overset{!}{=}`</pur>  | `KaTeX:a\\raisebox{0.25em}{$b$}c`                            | `a\\raisebox{0.25em}{$b$}c`                            |\n| `KaTeX:_u^o`                           | <pur>`_u^o`</pur>                           | `KaTeX:\\underset{!}{=}` | <pur>`\\underset{!}{=}`</pur> | `KaTeX:a+\\left(\\vcenter{\\hbox{$\\frac{\\frac a b}c$}}\\right)` | `a+\\left(\\vcenter{\\hbox{$\\frac{\\frac a b}c$}}\\right)` |\n| `KaTeX:\\sum_{\\substack{0<i<m\\\\0<j<n}}` | <pur>`\\sum_{\\substack{0<i<m\\\\0<j<n}}`</pur> |                         |                              |                                                             |                                                       |\n\n### Overlap and Spacing {.col-span-3}\n\n| :-                                                     | :-                                 | :-                                    |\n| :----------------------------------------------------- | :--------------------------------- | :------------------------------------ |\n| `KaTeX:{=}\\mathllap{/\\,}` <pur>{=}\\mathllap{/\\,}</pur> | `KaTeX:\\left(x^{\\smash{2}}\\right)` | <pur>\\left(x^{\\smash{2}}\\right)</pur> |\n| `KaTeX:\\mathrlap{\\,/}{=}` <pur>\\mathrlap{\\,/}{=}</pur> | `KaTeX:\\sqrt{\\smash[b]{y}}`        | <pur>\\sqrt{\\smash[b]{y}}</pur>        |\n\n`\\sum_{\\mathclap{1\\le i\\le j\\le n}} x_{ij}`\n\n```KaTex\n\\sum_{\\mathclap{1\\le i\\le j\\le n}} x_{ij}\n```\n\n### `KaTeX:\\LaTeX` math constructs {.col-span-3}\n\n| Preview                 | Method                       | Preview                 | Method                       | Preview                      | Method                            |\n| :---------------------- | :--------------------------- | :---------------------- | :--------------------------- | :--------------------------- | :-------------------------------- |\n| `KaTeX:\\frac{abc}{xyz}` | <pur>`\\frac{abc}{xyz}`</pur> | `KaTeX:\\overline{abc}`  | <pur>`\\overline{abc}`</pur>  | `KaTeX:\\overrightarrow{abc}` | <pur>`\\overrightarrow{abc}`</pur> |\n| `KaTeX:f'`              | <pur>`f'`</pur>              | `KaTeX:\\underline{abc}` | <pur>`\\underline{abc}`</pur> | `KaTeX:\\overleftarrow{abc}`  | <pur>`\\overleftarrow{abc}`</pur>  |\n| `KaTeX:\\sqrt{abc}`      | <pur>`\\sqrt{abc}`</pur>      | `KaTeX:\\widehat{abc}`   | <pur>`\\widehat{abc}`</pur>   | `KaTeX:\\overbrace{abc}`      | <pur>`\\overbrace{abc}`</pur>      |\n| `KaTeX:\\sqrt[n]{abc}`   | <pur>`\\sqrt[n]{abc}`</pur>   | `KaTeX:\\widetilde{abc}` | <pur>`\\widetilde{abc}`</pur> | `KaTeX:\\underbrace{abc}`     | <pur>`\\underbrace{abc}`</pur>     |\n\n### Delimiters {.col-span-3}\n\n| preview                                      | method                           | preview                 | method                         | preview     | method              | preview                          | method                                 | preview                 | method                       |\n| :------------------------------------------- | :------------------------------- | :---------------------- | :----------------------------- | :---------- | :------------------ | :------------------------------- | :------------------------------------- | :---------------------- | :--------------------------- |\n| `KaTeX:()`                                   | <pur>`()`</pur>                  | `KaTeX:\\lparen \\rparen` | <pur>`\\lparen` `\\rparen`</pur> | `KaTeX:⌈ ⌉` | <pur>`⌈ ⌉`</pur>    | `KaTeX:\\lceil \\rceil`            | <pur>`\\lceil` `\\rceil`</pur>           | `KaTeX:\\uparrow`        | <pur>`\\uparrow`</pur>        |\n| `KaTeX:[]`                                   | <pur>`[]`</pur>                  | `KaTeX:\\lbrack \\rbrack` | <pur>`\\lbrack` `\\rbrack`</pur> | `KaTeX:⌊ ⌋` | <pur>`⌊ ⌋`</pur>    | `KaTeX:\\lfloor \\rfloor`          | <pur>`\\lfloor` `\\rfloor`</pur>         | `KaTeX:\\downarrow`      | <pur>`\\downarrow`</pur>      |\n| `KaTeX:\\{ \\}`                                | <pur>`{}`</pur>                  | `KaTeX:\\lbrace \\rbrace` | <pur>`\\lbrace` `\\rbrace`</pur> | `KaTeX:⎰⎱`  | <pur>`⎰⎱`</pur>     | `KaTeX:\\lmoustache  \\rmoustache` | <pur>`\\lmoustache` `\\rmoustache`</pur> | `KaTeX:\\updownarrow`    | <pur>`\\updownarrow`</pur>    |\n| `KaTeX:⟨ ⟩`                                  | <pur>`⟨⟩`</pur>                  | `KaTeX:\\langle \\rangle` | <pur>`\\langle` `\\rangle`</pur> | `KaTeX:⟮ ⟯` | <pur>`⟮ ⟯`</pur>    | `KaTeX:\\lgroup \\rgroup`          | <pur>`\\lgroup` `\\rgroup`</pur>         | `KaTeX:\\Uparrow`        | <pur>`\\Uparrow`</pur>        |\n| `KaTeX:∣`                                    | <pur>`\\|`</pur>                  | `KaTeX:\\vert`           | <pur>`\\vert`</pur>             | `KaTeX:┌ ┐` | <pur>`┌ ┐`</pur>    | `KaTeX:\\ulcorner \\urcorner`      | <pur>`\\ulcorner` `\\urcorner`</pur>     | `KaTeX:\\Downarrow`      | <pur>`\\Downarrow`</pur>      |\n| `KaTeX:\\|` _(<red>MD syntax conflict</red>)_ | <pur><code>\\\\&#124;</code></pur> | `KaTeX:\\Vert`           | <pur>`\\Vert`</pur>             | `KaTeX:└ ┘` | <pur>`└ ┘`</pur>    | `KaTeX:\\llcorner \\lrcorner`      | <pur>`\\llcorner` `\\lrcorner`</pur>     | `KaTeX:\\Updownarrow`    | <pur>`\\Updownarrow`</pur>    |\n| `KaTeX:∣ ∣`                                  | <pur>`\\lvert` `\\rvert`</pur>     | `KaTeX:\\lVert \\rVert`   | <pur>`\\lVert` `\\rVert`</pur>   |             | <pur>`\\left.`</pur> |                                  | <pur>`\\right.`</pur>                   | `KaTeX:\\backslash`      | <pur>`\\backslash`</pur>      |\n| `KaTeX:\\lang` `KaTeX:\\rang`                  | <pur>`\\lang` `\\rang`<pur>        | `KaTeX:\\lt \\gt`         | <pur>`\\lt \\gt`</pur>           | `KaTeX:⟦ ⟧` | <pur>`⟦ ⟧`</pur>    | `KaTeX:\\llbracket \\rrbracket`    | <pur>`\\llbracket` `\\rrbracket`</pur>   | `KaTeX:\\lBrace \\rBrace` | <pur>`\\lBrace \\rBrace`</pur> |\n\n{.show-header left-align}\n\nThe pair of expressions `\\left` `KaTeX:s_1` and `\\right` `KaTeX:s_2` can be used to match the height of the separators\n`KaTeX:s_1` and `KaTeX:s_2` to the height of their content, e.g. :\n\n| :-              | :-           | :-               | :-              | :-           | :-               | :-                 | :-           | :-              |\n| :-------------- | :----------- | :--------------- | :-------------- | :----------- | :--------------- | :----------------- | :----------- | :-------------- |\n| `KaTeX:\\left\\|` | `KaTeX:expr` | `KaTeX:\\right\\|` | `KaTeX:\\left\\{` | `KaTeX:expr` | `KaTeX:\\right\\}` | `KaTeX:\\left\\Vert` | `KaTeX:expr` | `KaTeX:\\right.` |\n\n### Variable Size Symbols {.col-span-3}\n\n| preview         | method               | preview       | method             | preview           | method                 | preview            | method                  | preview           | method                 |\n| :-------------- | :------------------- | :------------ | :----------------- | :---------------- | :--------------------- | :----------------- | :---------------------- | :---------------- | :--------------------- |\n| `KaTeX:\\sum`    | <pur>`\\sum`</pur>    | `KaTeX:\\int`  | <pur>`\\int`</pur>  | `KaTeX:\\biguplus` | <pur>`\\biguplus`</pur> | `KaTeX:\\bigoplus`  | <pur>`\\bigoplus`</pur>  | `KaTeX:\\bigvee`   | <pur>`\\bigvee`</pur>   |\n| `KaTeX:\\prod`   | <pur>`\\prod`</pur>   | `KaTeX:\\oint` | <pur>`\\oint`</pur> | `KaTeX:\\bigcap`   | <pur>`\\bigcap`</pur>   | `KaTeX:\\bigotimes` | <pur>`\\bigotimes`</pur> | `KaTeX:\\bigwedge` | <pur>`\\bigwedge`</pur> |\n| `KaTeX:\\coprod` | <pur>`\\coprod`</pur> | `KaTeX:\\iint` | <pur>`\\iint`</pur> | `KaTeX:\\bigcup`   | <pur>`\\bigcup`</pur>   | `KaTeX:\\bigodot`   | <pur>`\\bigodot`</pur>   | `KaTeX:\\bigodot`  | <pur>`\\bigodot`</pur>  |\n\n{.show-header left-align}\n\n### standard function name{.col-span-3}\n\n| preview         | method               | preview         | method               | preview         | method               | preview         | method               |\n| :-------------- | :------------------- | :-------------- | :------------------- | :-------------- | :------------------- | :-------------- | :------------------- |\n| `KaTeX:\\arccos` | <pur>`\\arccos`</pur> | `KaTeX:\\arcsin` | <pur>`\\arcsin`</pur> | `KaTeX:\\arcsin` | <pur>`\\arcsin`</pur> | `KaTeX:\\arg`    | <pur>`\\arg`</pur>    |\n| `KaTeX:\\cos`    | <pur>`\\cos`</pur>    | `KaTeX:\\cosh`   | <pur>`\\cosh`</pur>   | `KaTeX:\\cot`    | <pur>`\\cot`</pur>    | `KaTeX:\\coth`   | <pur>`\\coth`</pur>   |\n| `KaTeX:\\csc`    | <pur>`\\csc`</pur>    | `KaTeX:\\deg`    | <pur>`\\deg`</pur>    | `KaTeX:\\det`    | <pur>`\\det`</pur>    | `KaTeX:\\dim`    | <pur>`\\dim`</pur>    |\n| `KaTeX:\\exp`    | <pur>`\\exp`</pur>    | `KaTeX:\\gcd`    | <pur>`\\gcd`</pur>    | `KaTeX:\\hom`    | <pur>`\\hom`</pur>    | `KaTeX:\\inf`    | <pur>`\\inf`</pur>    |\n| `KaTeX:\\ker`    | <pur>`\\ker`</pur>    | `KaTeX:\\lg`     | <pur>`\\lg`</pur>     | `KaTeX:\\lim`    | <pur>`\\lim`</pur>    | `KaTeX:\\liminf` | <pur>`\\liminf`</pur> |\n| `KaTeX:\\limsup` | <pur>`\\limsup`</pur> | `KaTeX:\\ln`     | <pur>`\\ln`</pur>     | `KaTeX:\\log`    | <pur>`\\log`</pur>    | `KaTeX:\\max`    | <pur>`\\max`</pur>    |\n| `KaTeX:\\min`    | <pur>`\\min`</pur>    | `KaTeX:\\Pr`     | <pur>`\\Pr`</pur>     | `KaTeX:\\sec`    | <pur>`\\sec`</pur>    | `KaTeX:\\sin`    | <pur>`\\sin`</pur>    |\n| `KaTeX:\\sinh`   | <pur>`\\sinh`</pur>   | `KaTeX:\\sup`    | <pur>`\\sup`</pur>    | `KaTeX:\\tan`    | <pur>`\\tan`</pur>    | `KaTeX:\\tanh`   | <pur>`\\tanh`</pur>   |\n\n{.show-header left-align}\n\n#### Function names should be in roman font, not italics, for example:\n\n| :-         | :-                         | :-                  | :-                    |\n| :--------- | :------------------------- | :------------------ | :-------------------- |\n| Correct:   | <pur>`\\tan(at-n\\pi)`</pur> | `KaTeX:\\rightarrow` | `KaTeX:\\tan(at-n\\pi)` |\n| Incorrect: | <pur>`tan(at-n\\pi)`</pur>  | `KaTeX:\\rightarrow` | `KaTeX:tan(at-n\\pi)`  |\n\n{.left-align}\n\n### Logic and Set Theory{.col-span-3}\n\n| :-               | :-                    | :-                  | :-                       | :-                      | :-                           | :-                         | :-                                      |\n| :--------------- | :-------------------- | :------------------ | :----------------------- | :---------------------- | :--------------------------- | :------------------------- | :-------------------------------------- |\n| `KaTeX:\\forall`  | <pur>`\\forall`</pur>  | `KaTeX:\\complement` | <pur>`\\complement`</pur> | `KaTeX:\\therefore`      | <pur>`\\therefore`</pur>      | `KaTeX:\\emptyset`          | <pur>`\\emptyset`</pur>                  |\n| `KaTeX:\\exists`  | <pur>`\\exists`</pur>  | `KaTeX:\\subset`     | <pur>`\\subset`</pur>     | `KaTeX:\\because`        | <pur>`\\because`</pur>        | `KaTeX:\\empty`             | <pur>`\\empty`</pur>                     |\n| `KaTeX:\\exist`   | <pur>`\\exist`</pur>   | `KaTeX:\\supset`     | <pur>`\\supset`</pur>     | `KaTeX:\\mapsto`         | <pur>`\\mapsto`</pur>         | `KaTeX:\\varnothing`        | <pur>`\\varnothing`</pur>                |\n| `KaTeX:\\nexists` | <pur>`\\nexists`</pur> | `KaTeX:\\mid`        | <pur>`\\mid`</pur>        | `KaTeX:\\to`             | <pur>`\\to`</pur>             | `KaTeX:\\implies`           | <pur>`\\implies`</pur>                   |\n| `KaTeX:\\in`      | <pur>`\\in`</pur>      | `KaTeX:\\land`       | <pur>`\\land`</pur>       | `KaTeX:\\gets`           | <pur>`\\gets`</pur>           | `KaTeX:\\impliedby`         | <pur>`\\impliedby`</pur>                 |\n| `KaTeX:\\isin`    | <pur>`\\isin`</pur>    | `KaTeX:\\lor`        | <pur>`\\lor`</pur>        | `KaTeX:\\leftrightarrow` | <pur>`\\leftrightarrow`</pur> | `KaTeX:\\iff`               | <pur>`\\iff`</pur>                       |\n| `KaTeX:\\notin`   | <pur>`\\notin`</pur>   | `KaTeX:\\ni`         | <pur>`\\ni`</pur>         | `KaTeX:\\notni`          | <pur>`\\notni`</pur>          | `KaTeX:\\neg` `KaTeX:\\lnot` | <pur>`\\neg`</pur> or <pur>`\\lnot`</pur> |\n\n{.left-align}\n\n---\n\n| :-                               | :-                                  | :-                   | :-                      |\n| :------------------------------- | :---------------------------------- | :------------------- | :---------------------- |\n| `KaTeX:\\Set{ x \\| x<\\frac 1 2 }` | <pur>\\Set{ x \\| x<\\frac 1 2 }</pur> | `KaTeX:\\set{x\\|x<5}` | <pur>\\set{x\\|x<5}</pur> |\n\n### special symbols{.col-span-3}\n\n| :-                 | :-                    | :-                 | :-                    | :-                                             | :-                                                  |\n| :----------------- | :-------------------- | :----------------- | :-------------------- | :--------------------------------------------- | :-------------------------------------------------- |\n| `KaTeX:\\bra{\\phi}` | <pur>\\bra{\\phi}</pur> | `KaTeX:\\ket{\\psi}` | <pur>\\ket{\\psi}</pur> | `KaTeX:\\braket{\\phi\\|\\psi}`                    | <pur>`\\braket{\\phi\\|\\psi}`</pur>                    |\n| `KaTeX:\\Bra{\\phi}` | <pur>\\Bra{\\phi}</pur> | `KaTeX:\\Ket{\\psi}` | <pur>\\Ket{\\psi}</pur> | `KaTeX:\\Braket{ ϕ \\| \\frac{∂^2}{∂ t^2} \\| ψ }` | <pur>`\\Braket{ ϕ \\| \\frac{∂^2}{∂ t^2} \\| ψ }`</pur> |\n\n{.left-align}\n\n## Operator\n\n### Mathematical operator {.col-span-3 row-span-2}\n\n| :-                                 | :-                                      | :-              | :-                   | :-               | :-                    | :-                        | :-                             |\n| :--------------------------------- | :-------------------------------------- | :-------------- | :------------------- | :--------------- | :-------------------- | :------------------------ | :----------------------------- |\n| `KaTeX:\\arcsin`                    | <pur>`\\arcsin`</pur>                    | `KaTeX:\\cosec`  | <pur>`\\cosec`</pur>  | `KaTeX:\\deg`     | <pur>`\\deg`</pur>     | `KaTeX:\\sec`              | <pur>`\\sec`</pur>              |\n| `KaTeX:\\arccos`                    | <pur>`\\arccos`</pur>                    | `KaTeX:\\cosh`   | <pur>`\\cosh`</pur>   | `KaTeX:\\dim`     | <pur>`\\dim`</pur>     | `KaTeX:\\sin`              | <pur>`\\sin`</pur>              |\n| `KaTeX:\\arctan`                    | <pur>`\\arctan`</pur>                    | `KaTeX:\\cot`    | <pur>`\\cot`</pur>    | `KaTeX:\\exp`     | <pur>`\\exp`</pur>     | `KaTeX:\\sinh`             | <pur>`\\sinh`</pur>             |\n| `KaTeX:\\arctg`                     | <pur>`\\arctg`</pur>                     | `KaTeX:\\cotg`   | <pur>`\\cotg`</pur>   | `KaTeX:\\hom`     | <pur>`\\hom`</pur>     | `KaTeX:\\sh`               | <pur>`\\sh`</pur>               |\n| `KaTeX:\\arcctg`                    | <pur>`\\arcctg`</pur>                    | `KaTeX:\\coth`   | <pur>`\\coth`</pur>   | `KaTeX:\\ker`     | <pur>`\\ker`</pur>     | `KaTeX:\\tan`              | <pur>`\\tan`</pur>              |\n| `KaTeX:\\arg`                       | <pur>`\\arg`</pur>                       | `KaTeX:\\csc`    | <pur>`\\csc`</pur>    | `KaTeX:\\lg`      | <pur>`\\lg`</pur>      | `KaTeX:\\tanh`             | <pur>`\\tanh`</pur>             |\n| `KaTeX:\\ch`                        | <pur>`\\ch`</pur>                        | `KaTeX:\\ctg`    | <pur>`\\ctg`</pur>    | `KaTeX:\\ln`      | <pur>`\\ln`</pur>      | `KaTeX:\\tg`               | <pur>`\\tg`</pur>               |\n| `KaTeX:\\cos`                       | <pur>`\\cos`</pur>                       | `KaTeX:\\cth`    | <pur>`\\cth`</pur>    | `KaTeX:\\log`     | <pur>`\\log`</pur>     | `KaTeX:\\th`               | <pur>`\\th`</pur>               |\n| `KaTeX:\\operatorname{f}`           | <pur>`\\operatorname{f}`</pur>           |                 |                      |                  |                       |                           |                                |\n| `KaTeX:\\argmax`                    | <pur>`\\argmax`</pur>                    | `KaTeX:\\injlim` | <pur>`\\injlim`</pur> | `KaTeX:\\min`     | <pur>`\\min`</pur>     | `KaTeX:\\varinjlim`        | <pur>`\\varinjlim`</pur>        |\n| `KaTeX:\\argmin`                    | <pur>`\\argmin`</pur>                    | `KaTeX:\\lim`    | <pur>`\\lim`</pur>    | `KaTeX:\\plim`    | <pur>`\\plim`</pur>    | `KaTeX:\\varliminf`        | <pur>`\\varliminf`</pur>        |\n| `KaTeX:\\det`                       | <pur>`\\det`</pur>                       | `KaTeX:\\liminf` | <pur>`\\liminf`</pur> | `KaTeX:\\Pr`      | <pur>`\\Pr`</pur>      | `KaTeX:\\varlimsup`        | <pur>`\\varlimsup`</pur>        |\n| `KaTeX:\\gcd`                       | <pur>`\\gcd`</pur>                       | `KaTeX:\\limsup` | <pur>`\\limsup`</pur> | `KaTeX:\\projlim` | <pur>`\\projlim`</pur> | `KaTeX:\\varprojlim`       | <pur>`\\varprojlim`</pur>       |\n| `KaTeX:\\inf`                       | <pur>`\\inf`</pur>                       | `KaTeX:\\max`    | <pur>`\\max`</pur>    | `KaTeX:\\sup`     | <pur>`\\sup`</pur>     | `KaTeX:\\operatorname*{f}` | <pur>`\\operatorname*{f}`</pur> |\n| `KaTeX:\\operatornamewithlimits{f}` | <pur>`\\operatornamewithlimits{f}`</pur> |\n\n{.left-align}\n\n### Big operator {.col-span-2}\n\n| :-             | :-                  | :-                | :-                     | :-                 | :-                      | :-                | :-                     |\n| :------------- | :------------------ | :---------------- | :--------------------- | :----------------- | :---------------------- | :---------------- | :--------------------- |\n| `KaTeX:\\sum`   | <pur>`\\sum`</pur>   | `KaTeX:\\prod`     | <pur>`\\prod`</pur>     | `KaTeX:\\bigotimes` | <pur>`\\bigotimes`</pur> | `KaTeX:\\bigvee`   | <pur>`\\bigvee`</pur>   |\n| `KaTeX:\\int`   | <pur>`\\int`</pur>   | `KaTeX:\\coprod`   | <pur>`\\coprod`</pur>   | `KaTeX:\\bigoplus`  | <pur>`\\bigoplus`</pur>  | `KaTeX:\\bigwedge` | <pur>`\\bigwedge`</pur> |\n| `KaTeX:\\iint`  | <pur>`\\iint`</pur>  | `KaTeX:\\intop`    | <pur>`\\intop`</pur>    | `KaTeX:\\bigodot`   | <pur>`\\bigodot`</pur>   | `KaTeX:\\bigcap`   | <pur>`\\bigcap`</pur>   |\n| `KaTeX:\\iiint` | <pur>`\\iiint`</pur> | `KaTeX:\\smallint` | <pur>`\\smallint`</pur> | `KaTeX:\\biguplus`  | <pur>`\\biguplus`</pur>  | `KaTeX:\\bigcup`   | <pur>`\\bigcup`</pur>   |\n| `KaTeX:\\oint`  | <pur>`\\oint`</pur>  | `KaTeX:\\oiint`    | <pur>`\\oiint`</pur>    | `KaTeX:\\oiiint`    | <pur>`\\oiiint`</pur>    | `KaTeX:\\bigsqcup` | <pur>`\\bigsqcup`</pur> |\n\n{.left-align}\n\n### Fractions and binomials {.row-span-2}\n\n| :-                                  | :-                                       | :-                                  | :-                                       |\n| :---------------------------------- | :--------------------------------------- | :---------------------------------- | :--------------------------------------- |\n| `KaTeX:\\frac{a}{b}`                 | <pur>`\\frac{a}{b}`</pur>                 | `KaTeX:\\tfrac{a}{b}`                | <pur>`\\tfrac{a}{b}`</pur>                |\n| `KaTeX:{a \\over b}`                 | <pur>`{a \\over b}`</pur>                 | `KaTeX:\\dfrac{a}{b}`                | <pur>`\\dfrac{a}{b}`</pur>                |\n| `KaTeX:\\genfrac ( ] {2pt}{1}a{a+1}` | <pur>`\\genfrac ( ] {2pt}{1}a{a+1}`</pur> | `KaTeX:{a \\above{2pt} b+1}`         | <pur>`{a \\above{2pt} b+1}`</pur>         |\n| `KaTeX:a/b`                         | <pur>`a/b`</pur>                         | `KaTeX:\\cfrac{a}{1 + \\cfrac{1}{b}}` | <pur>`\\cfrac{a}{1 + \\cfrac{1}{b}}`</pur> |\n\n{.left-align}\n\n| :-                    | :-                         | :-                    | :-                         |\n| :-------------------- | :------------------------- | :-------------------- | :------------------------- |\n| `KaTeX:\\binom{n}{k}`  | <pur>`\\binom{n}{k}`</pur>  | `KaTeX:\\dbinom{n}{k}` | <pur>`\\dbinom{n}{k}`</pur> |\n| `KaTeX:{n\\brace k}`   | <pur>`{n\\brace k}`</pur>   | `KaTeX:{n \\choose k}` | <pur>`{n \\choose k}`</pur> |\n| `KaTeX:\\tbinom{n}{k}` | <pur>`\\tbinom{n}{k}`</pur> | `KaTeX:{n\\brack k}`   | <pur>`{n\\brack k}`</pur>   |\n\n{.left-align}\n\n### \\sqrt {.col-span-2}\n\n| :-               | :-                    | :-                  | :-                       |\n| :--------------- | :-------------------- | :------------------ | :----------------------- |\n| `KaTeX:\\sqrt{x}` | <pur>`\\sqrt{x}`</pur> | `KaTeX:\\sqrt[3]{x}` | <pur>`\\sqrt[3]{x}`</pur> |\n\n{.left-align}\n\n### Binary operator {.col-span-3}\n\n| :-                | :-                     | :-                      | :-                           | :-                      | :-                           | :-                       | :-                            |\n| :---------------- | :--------------------- | :---------------------- | :--------------------------- | :---------------------- | :--------------------------- | :----------------------- | :---------------------------- |\n| `KaTeX:+`         | <pur>`+`</pur>         | `KaTeX:\\cdot`           | <pur>`\\cdot`</pur>           | `KaTeX:\\gtrdot`         | <pur>`\\gtrdot`</pur>         | `KaTeX:x \\pmod a`        | <pur>`x \\pmod a`</pur>        |\n| `KaTeX:-`         | <pur>`-`</pur>         | `KaTeX:\\cdotp`          | <pur>`\\cdotp`</pur>          | `KaTeX:\\intercal`       | <pur>`\\intercal`</pur>       | `KaTeX:x \\pod a`         | <pur>`x \\pod a`</pur>         |\n| `KaTeX:/`         | <pur>`/`</pur>         | `KaTeX:\\centerdot`      | <pur>`\\centerdot`</pur>      | `KaTeX:\\land`           | <pur>`\\land`</pur>           | `KaTeX:\\rhd`             | <pur>`\\rhd`</pur>             |\n| `KaTeX:*`         | <pur>`*`</pur>         | `KaTeX:\\circ`           | <pur>`\\circ`</pur>           | `KaTeX:\\leftthreetimes` | <pur>`\\leftthreetimes`</pur> | `KaTeX:\\rightthreetimes` | <pur>`\\rightthreetimes`</pur> |\n| `KaTeX:\\amalg`    | <pur>`\\amalg`</pur>    | `KaTeX:\\circledast`     | <pur>`\\circledast`</pur>     | `KaTeX:\\ldotp`          | <pur>`\\ldotp`</pur>          | `KaTeX:\\rtimes`          | <pur>`\\rtimes`</pur>          |\n| `KaTeX:\\And`      | <pur>`\\And`</pur>      | `KaTeX:\\circledcirc`    | <pur>`\\circledcirc`</pur>    | `KaTeX:\\lor`            | <pur>`\\lor`</pur>            | `KaTeX:\\setminus`        | <pur>`\\setminus`</pur>        |\n| `KaTeX:\\ast`      | <pur>`\\ast`</pur>      | `KaTeX:\\circleddash`    | <pur>`\\circleddash`</pur>    | `KaTeX:\\lessdot`        | <pur>`\\lessdot`</pur>        | `KaTeX:\\smallsetminus`   | <pur>`\\smallsetminus`</pur>   |\n| `KaTeX:\\barwedge` | <pur>`\\barwedge`</pur> | `KaTeX:\\Cup`            | <pur>`\\Cup`</pur>            | `KaTeX:\\lhd`            | <pur>`\\lhd`</pur>            | `KaTeX:\\sqcap`           | <pur>`\\sqcap`</pur>           |\n| `KaTeX:\\bigcirc`  | <pur>`\\bigcirc`</pur>  | `KaTeX:\\cup`            | <pur>`\\cup`</pur>            | `KaTeX:\\ltimes`         | <pur>`\\ltimes`</pur>         | `KaTeX:\\sqcup`           | <pur>`\\sqcup`</pur>           |\n| `KaTeX:\\bmod`     | <pur>`\\bmod`</pur>     | `KaTeX:\\curlyvee`       | <pur>`\\curlyvee`</pur>       | `KaTeX:x\\mod a`         | <pur>`x\\mod a`</pur>         | `KaTeX:\\times`           | <pur>`\\times`</pur>           |\n| `KaTeX:\\boxdot`   | <pur>`\\boxdot`</pur>   | `KaTeX:\\curlywedge`     | <pur>`\\curlywedge`</pur>     | `KaTeX:\\mp`             | <pur>`\\mp`</pur>             | `KaTeX:\\unlhd`           | <pur>`\\unlhd`</pur>           |\n| `KaTeX:\\boxminus` | <pur>`\\boxminus`</pur> | `KaTeX:\\div`            | <pur>`\\div`</pur>            | `KaTeX:\\odot`           | <pur>`\\odot`</pur>           | `KaTeX:\\unrhd`           | <pur>`\\unrhd`</pur>           |\n| `KaTeX:\\boxplus`  | <pur>`\\boxplus`</pur>  | `KaTeX:\\divideontimes`  | <pur>`\\divideontimes`</pur>  | `KaTeX:\\ominus`         | <pur>`\\ominus`</pur>         | `KaTeX:\\uplus`           | <pur>`\\uplus`</pur>           |\n| `KaTeX:\\boxtimes` | <pur>`\\boxtimes`</pur> | `KaTeX:\\dotplus`        | <pur>`\\dotplus`</pur>        | `KaTeX:\\oplus`          | <pur>`\\oplus`</pur>          | `KaTeX:\\vee`             | <pur>`\\vee`</pur>             |\n| `KaTeX:\\bullet`   | <pur>`\\bullet`</pur>   | `KaTeX:\\doublebarwedge` | <pur>`\\doublebarwedge`</pur> | `KaTeX:\\otimes`         | <pur>`\\otimes`</pur>         | `KaTeX:\\veebar`          | <pur>`\\veebar`</pur>          |\n| `KaTeX:\\Cap`      | <pur>`\\Cap`</pur>      | `KaTeX:\\doublecap`      | <pur>`\\doublecap`</pur>      | `KaTeX:\\oslash`         | <pur>`\\oslash`</pur>         | `KaTeX:\\wedge`           | <pur>`\\wedge`</pur>           |\n| `KaTeX:\\cap`      | <pur>`\\cap`</pur>      | `KaTeX:\\doublecup`      | <pur>`\\doublecup`</pur>      | `KaTeX:\\pm`             | <pur>`\\pm`</pur>             | `KaTeX:\\plusmn`          | <pur>`\\plusmn`</pur>          |\n| `KaTeX:\\wr`       | <pur>`\\wr`</pur>`      |\n\n{.left-align}\n\n## Relation\n\n### Relation {.col-span-3}\n\n| :-                        | :-                                                          | :-                     | :-                                                       | :-                     | :-                          | :-                        | :-                                              |\n| :------------------------ | :---------------------------------------------------------- | :--------------------- | :------------------------------------------------------- | :--------------------- | :-------------------------- | :------------------------ | :---------------------------------------------- |\n| `KaTeX:=`                 | <pur>`=`</pur>                                              | `KaTeX:\\doteqdot`      | <pur>`\\doteqdot`</pur>                                   | `KaTeX:\\lessapprox`    | <pur>`\\lessapprox`</pur>    | `KaTeX:\\smile`            | <pur>`\\smile`</pur>                             |\n| `KaTeX:<`                 | <pur>`<`</pur>                                              | `KaTeX:\\eqcirc`        | <pur>`\\eqcirc`</pur>                                     | `KaTeX:\\lesseqgtr`     | <pur>`\\lesseqgtr`</pur>     | `KaTeX:\\sqsubset`         | <pur>`\\sqsubset`</pur>                          |\n| `KaTeX:>`                 | <pur>`>`</pur>                                              | `KaTeX:\\eqcolon`       | <pur>`\\eqcolon`</pur> or <pur>`\\minuscolon`</pur>        | `KaTeX:\\lesseqqgtr`    | <pur>`\\lesseqqgtr`</pur>    | `KaTeX:\\sqsubseteq`       | <pur>`\\sqsubseteq`</pur>                        |\n| `KaTeX::`                 | <pur>`:`</pur>                                              | `KaTeX:\\Eqcolon`       | <pur>`\\Eqcolon`</pur> or <pur>`\\minuscoloncolon`</pur>   | `KaTeX:\\lessgtr`       | <pur>`\\lessgtr`</pur>       | `KaTeX:\\sqsupset`         | <pur>`\\sqsupset`</pur>                          |\n| `KaTeX:\\approx`           | <pur>`\\approx`</pur>                                        | `KaTeX:\\eqqcolon`      | <pur>`\\eqqcolon`</pur> or <pur>`\\equalscolon`</pur>      | `KaTeX:\\lesssim`       | <pur>`\\lesssim`</pur>       | `KaTeX:\\sqsupseteq`       | <pur>`\\sqsupseteq`</pur>                        |\n| `KaTeX:\\approxcolon`      | <pur>`\\approxcolon`</pur>                                   | `KaTeX:\\Eqqcolon`      | <pur>`\\Eqqcolon`</pur> or <pur>`\\equalscoloncolon`</pur> | `KaTeX:\\ll`            | <pur>`\\ll`</pur>            | `KaTeX:\\Subset`           | <pur>`\\Subset`</pur>                            |\n| `KaTeX:\\approxcoloncolon` | <pur>`\\approxcoloncolon`</pur>                              | `KaTeX:\\eqsim`         | <pur>`\\eqsim`</pur>                                      | `KaTeX:\\lll`           | <pur>`\\lll`</pur>           | `KaTeX:\\subset`           | <pur>`\\subset`</pur> or <pur>`\\sub`</pur>       |\n| `KaTeX:\\approxeq`         | <pur>`\\approxeq`</pur>                                      | `KaTeX:\\eqslantgtr`    | <pur>`\\eqslantgtr`</pur>                                 | `KaTeX:\\llless`        | <pur>`\\llless`</pur>        | `KaTeX:\\subseteq`         | <pur>`\\subseteq`</pur> or <pur>`\\sube`</pur>    |\n| `KaTeX:\\asymp`            | <pur>`\\asymp`</pur>                                         | `KaTeX:\\eqslantless`   | <pur>`\\eqslantless`</pur>                                | `KaTeX:\\lt`            | <pur>`\\lt`</pur>            | `KaTeX:\\subseteqq`        | <pur>`\\subseteqq`</pur>                         |\n| `KaTeX:\\backepsilon`      | <pur>`\\backepsilon`</pur>                                   | `KaTeX:\\equiv`         | <pur>`\\equiv`</pur>                                      | `KaTeX:\\mid`           | <pur>`\\mid`</pur>           | `KaTeX:\\succ`             | <pur>`\\succ`</pur>                              |\n| `KaTeX:\\backsim`          | <pur>`\\backsim`</pur>                                       | `KaTeX:\\fallingdotseq` | <pur>`\\fallingdotseq`</pur>                              | `KaTeX:\\models`        | <pur>`\\models`</pur>        | `KaTeX:\\succapprox`       | <pur>`\\succapprox`</pur>                        |\n| `KaTeX:\\backsimeq`        | <pur>`\\backsimeq`</pur>                                     | `KaTeX:\\frown`         | <pur>`\\frown`</pur>                                      | `KaTeX:\\multimap`      | <pur>`\\multimap`</pur>      | `KaTeX:\\succcurlyeq`      | <pur>`\\succcurlyeq`</pur>                       |\n| `KaTeX:\\between`          | <pur>`\\between`</pur>                                       | `KaTeX:\\ge`            | <pur>`\\ge`</pur>                                         | `KaTeX:\\origof`        | <pur>`\\origof`</pur>        | `KaTeX:\\succeq`           | <pur>`\\succeq`</pur>                            |\n| `KaTeX:\\bowtie`           | <pur>`\\bowtie`</pur>                                        | `KaTeX:\\geq`           | <pur>`\\geq`</pur>                                        | `KaTeX:\\owns`          | <pur>`\\owns`</pur>          | `KaTeX:\\succsim`          | <pur>`\\succsim`</pur>                           |\n| `KaTeX:\\bumpeq`           | <pur>`\\bumpeq`</pur>                                        | `KaTeX:\\geqq`          | <pur>`\\geqq`</pur>                                       | `KaTeX:\\parallel`      | <pur>`\\parallel`</pur>      | `KaTeX:\\Supset`           | <pur>`\\Supset`</pur>                            |\n| `KaTeX:\\Bumpeq`           | <pur>`\\Bumpeq`</pur>                                        | `KaTeX:\\geqslant`      | <pur>`\\geqslant`</pur>                                   | `KaTeX:\\perp`          | <pur>`\\perp`</pur>          | `KaTeX:\\supset`           | <pur>`\\supset`</pur>                            |\n| `KaTeX:\\circeq`           | <pur>`\\circeq`</pur>                                        | `KaTeX:\\gg`            | <pur>`\\gg`</pur>                                         | `KaTeX:\\pitchfork`     | <pur>`\\pitchfork`</pur>     | `KaTeX:\\supseteq`         | <pur>`\\supseteq`</pur> or <pur>`\\supe`</pur>    |\n| `KaTeX:\\colonapprox`      | <pur>`\\colonapprox`</pur>                                   | `KaTeX:\\ggg`           | <pur>`\\ggg`</pur>                                        | `KaTeX:\\prec`          | <pur>`\\prec`</pur>          | `KaTeX:\\supseteqq`        | <pur>`\\supseteqq`</pur>                         |\n| `KaTeX:\\Colonapprox`      | <pur>`\\Colonapprox`</pur> or <pur>`\\coloncolonapprox`</pur> | `KaTeX:\\gggtr`         | <pur>`\\gggtr`</pur>                                      | `KaTeX:\\precapprox`    | <pur>`\\precapprox`</pur>    | `KaTeX:\\thickapprox`      | <pur>`\\thickapprox`</pur>                       |\n| `KaTeX:\\coloneq`          | <pur>`\\coloneq`</pur> or <pur>`\\colonminus`</pur>           | `KaTeX:\\gt`            | <pur>`\\gt`</pur>                                         | `KaTeX:\\preccurlyeq`   | <pur>`\\preccurlyeq`</pur>   | `KaTeX:\\thicksim`         | <pur>`\\thicksim`</pur>                          |\n| `KaTeX:\\Coloneq`          | <pur>`\\Coloneq`</pur> or <pur>`\\coloncolonminus`</pur>      | `KaTeX:\\gtrapprox`     | <pur>`\\gtrapprox`</pur>                                  | `KaTeX:\\preceq`        | <pur>`\\preceq`</pur>        | `KaTeX:\\trianglelefteq`   | <pur>`\\trianglelefteq`</pur>                    |\n| `KaTeX:\\coloneqq`         | <pur>`\\coloneqq`</pur> or <pur>`\\colonequals`</pur>         | `KaTeX:\\gtreqless`     | <pur>`\\gtreqless`</pur>                                  | `KaTeX:\\precsim`       | <pur>`\\precsim`</pur>       | `KaTeX:\\triangleq`        | <pur>`\\triangleq`</pur>                         |\n| `KaTeX:\\Coloneqq`         | <pur>`\\Coloneqq`</pur> or <pur>`\\coloncolonequals`</pur>    | `KaTeX:\\gtreqqless`    | <pur>`\\gtreqqless`</pur>                                 | `KaTeX:\\propto`        | <pur>`\\propto`</pur>        | `KaTeX:\\trianglerighteq`  | <pur>`\\trianglerighteq`</pur>                   |\n| `KaTeX:\\colonsim`         | <pur>`\\colonsim`</pur>                                      | `KaTeX:\\gtrless`       | <pur>`\\gtrless`</pur>                                    | `KaTeX:\\risingdotseq`  | <pur>`\\risingdotseq`</pur>  | `KaTeX:\\varpropto`        | <pur>`\\varpropto`</pur>                         |\n| `KaTeX:\\Colonsim`         | <pur>`\\Colonsim`</pur> or <pur>`\\coloncolonsim`</pur>       | `KaTeX:\\gtrsim`        | <pur>`\\gtrsim`</pur>                                     | `KaTeX:\\shortmid`      | <pur>`\\shortmid`</pur>      | `KaTeX:\\vartriangle`      | <pur>`\\vartriangle`</pur>                       |\n| `KaTeX:\\cong`             | <pur>`\\cong`</pur>                                          | `KaTeX:\\imageof`       | <pur>`\\imageof`</pur>                                    | `KaTeX:\\shortparallel` | <pur>`\\shortparallel`</pur> | `KaTeX:\\vartriangleleft`  | <pur>`\\vartriangleleft`</pur>                   |\n| `KaTeX:\\curlyeqprec`      | <pur>`\\curlyeqprec`</pur>                                   | `KaTeX:\\in`            | <pur>`\\in`</pur> or <pur>`\\isin`</pur>                   | `KaTeX:\\sim`           | <pur>`\\sim`</pur>           | `KaTeX:\\vartriangleright` | <pur>`\\vartriangleright`</pur>                  |\n| `KaTeX:\\curlyeqsucc`      | <pur>`\\curlyeqsucc`</pur>                                   | `KaTeX:\\Join`          | <pur>`\\Join`</pur>                                       | `KaTeX:\\simcolon`      | <pur>`\\simcolon`</pur>      | `KaTeX:\\vcentcolon`       | <pur>`\\vcentcolon`</pur> or <pur>`\\ratio`</pur> |\n| `KaTeX:\\dashv`            | <pur>`\\dashv`</pur>                                         | `KaTeX:\\le`            | <pur>`\\le`</pur>                                         | `KaTeX:\\simcoloncolon` | <pur>`\\simcoloncolon`</pur> | `KaTeX:\\vdash`            | <pur>`\\vdash`</pur>                             |\n| `KaTeX:\\dblcolon`         | <pur>`\\dblcolon`</pur> or <pur>`\\coloncolon`</pur>          | `KaTeX:\\leq`           | <pur>`\\leq`</pur>                                        | `KaTeX:\\simeq`         | <pur>`\\simeq`</pur>         | `KaTeX:\\vDash`            | <pur>`\\vDash`</pur>                             |\n| `KaTeX:\\doteq`            | <pur>`\\doteq`</pur>                                         | `KaTeX:\\leqq`          | <pur>`\\leqq`</pur>                                       | `KaTeX:\\smallfrown`    | <pur>`\\smallfrown`</pur>    | `KaTeX:\\Vdash`            | <pur>`\\Vdash`</pur>                             |\n| `KaTeX:\\Doteq`            | <pur>`\\Doteq`</pur>                                         | `KaTeX:\\leqslant`      | <pur>`\\leqslant`</pur>                                   | `KaTeX:\\smallsmile`    | <pur>`\\smallsmile`</pur>    | `KaTeX:\\Vvdash`           | <pur>`\\Vvdash`</pur>                            |\n\n{.left-align}\n\n### Negative relationship {.col-span-3}\n\n| :-                 | :-                      | :-                      | :-                           | :-                        | :-                             | :-                     | :-                          |\n| :----------------- | :---------------------- | :---------------------- | :--------------------------- | :------------------------ | :----------------------------- | :--------------------- | :-------------------------- |\n| `KaTeX:\\gnapprox`  | <pur>`\\gnapprox`</pur>  | `KaTeX:\\ngeqslant`      | <pur>`\\ngeqslant`</pur>      | `KaTeX:\\nsubseteq`        | <pur>`\\nsubseteq`</pur>        | `KaTeX:\\precneqq`      | <pur>`\\precneqq`</pur>      |\n| `KaTeX:\\gneq`      | <pur>`\\gneq`</pur>      | `KaTeX:\\ngtr`           | <pur>`\\ngtr`</pur>           | `KaTeX:\\nsubseteqq`       | <pur>`\\nsubseteqq`</pur>       | `KaTeX:\\precnsim`      | <pur>`\\precnsim`</pur>      |\n| `KaTeX:\\gneqq`     | <pur>`\\gneqq`</pur>     | `KaTeX:\\nleq`           | <pur>`\\nleq`</pur>           | `KaTeX:\\nsucc`            | <pur>`\\nsucc`</pur>            | `KaTeX:\\subsetneq`     | <pur>`\\subsetneq`</pur>     |\n| `KaTeX:\\gnsim`     | <pur>`\\gnsim`</pur>     | `KaTeX:\\nleqq`          | <pur>`\\nleqq`</pur>          | `KaTeX:\\nsucceq`          | <pur>`\\nsucceq`</pur>          | `KaTeX:\\subsetneqq`    | <pur>`\\subsetneqq`</pur>    |\n| `KaTeX:\\gvertneqq` | <pur>`\\gvertneqq`</pur> | `KaTeX:\\nleqslant`      | <pur>`\\nleqslant`</pur>      | `KaTeX:\\nsupseteq`        | <pur>`\\nsupseteq`</pur>        | `KaTeX:\\succnapprox`   | <pur>`\\succnapprox`</pur>   |\n| `KaTeX:\\lnapprox`  | <pur>`\\lnapprox`</pur>  | `KaTeX:\\nless`          | <pur>`\\nless`</pur>          | `KaTeX:\\nsupseteqq`       | <pur>`\\nsupseteqq`</pur>       | `KaTeX:\\succneqq`      | <pur>`\\succneqq`</pur>      |\n| `KaTeX:\\lneq`      | <pur>`\\lneq`</pur>      | `KaTeX:\\nmid`           | <pur>`\\nmid`</pur>           | `KaTeX:\\ntriangleleft`    | <pur>`\\ntriangleleft`</pur>    | `KaTeX:\\succnsim`      | <pur>`\\succnsim`</pur>      |\n| `KaTeX:\\lneqq`     | <pur>`\\lneqq`</pur>     | `KaTeX:\\notin`          | <pur>`\\notin`</pur>          | `KaTeX:\\ntrianglelefteq`  | <pur>`\\ntrianglelefteq`</pur>  | `KaTeX:\\supsetneq`     | <pur>`\\supsetneq`</pur>     |\n| `KaTeX:\\lnsim`     | <pur>`\\lnsim`</pur>     | `KaTeX:\\notni`          | <pur>`\\notni`</pur>          | `KaTeX:\\ntriangleright`   | <pur>`\\ntriangleright`</pur>   | `KaTeX:\\supsetneqq`    | <pur>`\\supsetneqq`</pur>    |\n| `KaTeX:\\lvertneqq` | <pur>`\\lvertneqq`</pur> | `KaTeX:\\nparallel`      | <pur>`\\nparallel`</pur>      | `KaTeX:\\ntrianglerighteq` | <pur>`\\ntrianglerighteq`</pur> | `KaTeX:\\varsubsetneq`  | <pur>`\\varsubsetneq`</pur>  |\n| `KaTeX:\\ncong`     | <pur>`\\ncong`</pur>     | `KaTeX:\\nprec`          | <pur>`\\nprec`</pur>          | `KaTeX:\\nvdash`           | <pur>`\\nvdash`</pur>           | `KaTeX:\\varsubsetneqq` | <pur>`\\varsubsetneqq`</pur> |\n| `KaTeX:\\ne`        | <pur>`\\ne`</pur>        | `KaTeX:\\npreceq`        | <pur>`\\npreceq`</pur>        | `KaTeX:\\nvDash`           | <pur>`\\nvDash`</pur>           | `KaTeX:\\varsupsetneq`  | <pur>`\\varsupsetneq`</pur>  |\n| `KaTeX:\\neq`       | <pur>`\\neq`</pur>       | `KaTeX:\\nshortmid`      | <pur>`\\nshortmid`</pur>      | `KaTeX:\\nVDash`           | <pur>`\\nVDash`</pur>           | `KaTeX:\\varsupsetneqq` | <pur>`\\varsupsetneqq`</pur> |\n| `KaTeX:\\ngeq`      | <pur>`\\ngeq`</pur>      | `KaTeX:\\nshortparallel` | <pur>`\\nshortparallel`</pur> | `KaTeX:\\nVdash`           | <pur>`\\nVdash`</pur>           |                        |                             |\n| `KaTeX:\\ngeqq`     | <pur>`\\ngeqq`</pur>     | `KaTeX:\\nsim`           | <pur>`\\nsim`</pur>           | `KaTeX:\\precnapprox`      | <pur>`\\precnapprox`</pur>      |                        |                             |\n\n`KaTeX:\\not =` <pur>`\\not =`</pur>\n\n### Arrow {.col-span-3}\n\n| :-                        | :-                             | :-                           | :-                                | :-                         | :-                              |\n| :------------------------ | :----------------------------- | :--------------------------- | :-------------------------------- | :------------------------- | :------------------------------ |\n| `KaTeX:\\circlearrowleft`  | <pur>`\\circlearrowleft`</pur>  | `KaTeX:\\leftharpoonup`       | <pur>`\\leftharpoonup`</pur>       | `KaTeX:\\rArr`              | <pur>`\\rArr`</pur>              |\n| `KaTeX:\\circlearrowright` | <pur>`\\circlearrowright`</pur> | `KaTeX:\\leftleftarrows`      | <pur>`\\leftleftarrows`</pur>      | `KaTeX:\\rarr`              | <pur>`\\rarr`</pur>              |\n| `KaTeX:\\curvearrowleft`   | <pur>`\\curvearrowleft`</pur>   | `KaTeX:\\leftrightarrow`      | <pur>`\\leftrightarrow`</pur>      | `KaTeX:\\restriction`       | <pur>`\\restriction`</pur>       |\n| `KaTeX:\\curvearrowright`  | <pur>`\\curvearrowright`</pur>  | `KaTeX:\\Leftrightarrow`      | <pur>`\\Leftrightarrow`</pur>      | `KaTeX:\\rightarrow`        | <pur>`\\rightarrow`</pur>        |\n| `KaTeX:\\Darr`             | <pur>`\\Darr`</pur>             | `KaTeX:\\leftrightarrows`     | <pur>`\\leftrightarrows`</pur>     | `KaTeX:\\Rightarrow`        | <pur>`\\Rightarrow`</pur>        |\n| `KaTeX:\\dArr`             | <pur>`\\dArr`</pur>             | `KaTeX:\\leftrightharpoons`   | <pur>`\\leftrightharpoons`</pur>   | `KaTeX:\\rightarrowtail`    | <pur>`\\rightarrowtail`</pur>    |\n| `KaTeX:\\darr`             | <pur>`\\darr`</pur>             | `KaTeX:\\leftrightsquigarrow` | <pur>`\\leftrightsquigarrow`</pur> | `KaTeX:\\rightharpoondown`  | <pur>`\\rightharpoondown`</pur>  |\n| `KaTeX:\\dashleftarrow`    | <pur>`\\dashleftarrow`</pur>    | `KaTeX:\\Lleftarrow`          | <pur>`\\Lleftarrow`</pur>          | `KaTeX:\\rightharpoonup`    | <pur>`\\rightharpoonup`</pur>    |\n| `KaTeX:\\dashrightarrow`   | <pur>`\\dashrightarrow`</pur>   | `KaTeX:\\longleftarrow`       | <pur>`\\longleftarrow`</pur>       | `KaTeX:\\rightleftarrows`   | <pur>`\\rightleftarrows`</pur>   |\n| `KaTeX:\\downarrow`        | <pur>`\\downarrow`</pur>        | `KaTeX:\\Longleftarrow`       | <pur>`\\Longleftarrow`</pur>       | `KaTeX:\\rightleftharpoons` | <pur>`\\rightleftharpoons`</pur> |\n| `KaTeX:\\Downarrow`        | <pur>`\\Downarrow`</pur>        | `KaTeX:\\longleftrightarrow`  | <pur>`\\longleftrightarrow`</pur>  | `KaTeX:\\rightrightarrows`  | <pur>`\\rightrightarrows`</pur>  |\n| `KaTeX:\\downdownarrows`   | <pur>`\\downdownarrows`</pur>   | `KaTeX:\\Longleftrightarrow`  | <pur>`\\Longleftrightarrow`</pur>  | `KaTeX:\\rightsquigarrow`   | <pur>`\\rightsquigarrow`</pur>   |\n| `KaTeX:\\downharpoonleft`  | <pur>`\\downharpoonleft`</pur>  | `KaTeX:\\longmapsto`          | <pur>`\\longmapsto`</pur>          | `KaTeX:\\Rrightarrow`       | <pur>`\\Rrightarrow`</pur>       |\n| `KaTeX:\\downharpoonright` | <pur>`\\downharpoonright`</pur> | `KaTeX:\\longrightarrow`      | <pur>`\\longrightarrow`</pur>      | `KaTeX:\\Rsh`               | <pur>`\\Rsh`</pur>               |\n| `KaTeX:\\gets`             | <pur>`\\gets`</pur>             | `KaTeX:\\Longrightarrow`      | <pur>`\\Longrightarrow`</pur>      | `KaTeX:\\searrow`           | <pur>`\\searrow`</pur>           |\n| `KaTeX:\\Harr`             | <pur>`\\Harr`</pur>             | `KaTeX:\\looparrowleft`       | <pur>`\\looparrowleft`</pur>       | `KaTeX:\\swarrow`           | <pur>`\\swarrow`</pur>           |\n| `KaTeX:\\hArr`             | <pur>`\\hArr`</pur>             | `KaTeX:\\looparrowright`      | <pur>`\\looparrowright`</pur>      | `KaTeX:\\to`                | <pur>`\\to`</pur>                |\n| `KaTeX:\\harr`             | <pur>`\\harr`</pur>             | `KaTeX:\\Lrarr`               | <pur>`\\Lrarr`</pur>               | `KaTeX:\\twoheadleftarrow`  | <pur>`\\twoheadleftarrow`</pur>  |\n| `KaTeX:\\hookleftarrow`    | <pur>`\\hookleftarrow`</pur>    | `KaTeX:\\lrArr`               | <pur>`\\lrArr`</pur>               | `KaTeX:\\twoheadrightarrow` | <pur>`\\twoheadrightarrow`</pur> |\n| `KaTeX:\\hookrightarrow`   | <pur>`\\hookrightarrow`</pur>   | `KaTeX:\\lrarr`               | <pur>`\\lrarr`</pur>               | `KaTeX:\\Uarr`              | <pur>`\\Uarr`</pur>              |\n| `KaTeX:\\iff`              | <pur>`\\iff`</pur>              | `KaTeX:\\Lsh`                 | <pur>`\\Lsh`</pur>                 | `KaTeX:\\uArr`              | <pur>`\\uArr`</pur>              |\n| `KaTeX:\\impliedby`        | <pur>`\\impliedby`</pur>        | `KaTeX:\\mapsto`              | <pur>`\\mapsto`</pur>              | `KaTeX:\\uarr`              | <pur>`\\uarr`</pur>              |\n| `KaTeX:\\implies`          | <pur>`\\implies`</pur>          | `KaTeX:\\nearrow`             | <pur>`\\nearrow`</pur>             | `KaTeX:\\uparrow`           | <pur>`\\uparrow`</pur>           |\n| `KaTeX:\\Larr`             | <pur>`\\Larr`</pur>             | `KaTeX:\\nleftarrow`          | <pur>`\\nleftarrow`</pur>          | `KaTeX:\\Uparrow`           | <pur>`\\Uparrow`</pur>           |\n| `KaTeX:\\lArr`             | <pur>`\\lArr`</pur>             | `KaTeX:\\nLeftarrow`          | <pur>`\\nLeftarrow`</pur>          | `KaTeX:\\updownarrow`       | <pur>`\\updownarrow`</pur>       |\n| `KaTeX:\\larr`             | <pur>`\\larr`</pur>             | `KaTeX:\\nleftrightarrow`     | <pur>`\\nleftrightarrow`</pur>     | `KaTeX:\\Updownarrow`       | <pur>`\\Updownarrow`</pur>       |\n| `KaTeX:\\leadsto`          | <pur>`\\leadsto`</pur>          | `KaTeX:\\nLeftrightarrow`     | <pur>`\\nLeftrightarrow`</pur>     | `KaTeX:\\upharpoonleft`     | <pur>`\\upharpoonleft`</pur>     |\n| `KaTeX:\\leftarrow`        | <pur>`\\leftarrow`</pur>        | `KaTeX:\\nrightarrow`         | <pur>`\\nrightarrow`</pur>         | `KaTeX:\\upharpoonright`    | <pur>`\\upharpoonright`</pur>    |\n| `KaTeX:\\Leftarrow`        | <pur>`\\Leftarrow`</pur>        | `KaTeX:\\nRightarrow`         | <pur>`\\nRightarrow`</pur>         | `KaTeX:\\upuparrows`        | <pur>`\\upuparrows`</pur>        |\n| `KaTeX:\\leftarrowtail`    | <pur>`\\leftarrowtail`</pur>    | `KaTeX:\\nwarrow`             | <pur>`\\nwarrow`</pur>             |                            |                                 |\n| `KaTeX:\\leftharpoondown`  | <pur>`\\leftharpoondown`</pur>  | `KaTeX:\\Rarr`                | <pur>`\\Rarr`</pur>                |                            |                                 |\n\n{.left-align}\n\n### Extensible arrows {.col-span-3}\n\n| :-                               | :-                                    | :-                                | :-                                     |\n| :------------------------------- | :------------------------------------ | :-------------------------------- | :------------------------------------- |\n| `KaTeX:\\xleftarrow{abc}`         | <pur>`\\xleftarrow{abc}`</pur>         | `KaTeX:\\xrightarrow[under]{over}` | <pur>`\\xrightarrow[under]{over}`</pur> |\n| `KaTeX:\\xLeftarrow{abc}`         | <pur>`\\xLeftarrow{abc}`</pur>         | `KaTeX:\\xRightarrow{abc}`         | <pur>`\\xRightarrow{abc}`</pur>         |\n| `KaTeX:\\xleftrightarrow{abc}`    | <pur>`\\xleftrightarrow{abc}`</pur>    | `KaTeX:\\xLeftrightarrow{abc}`     | <pur>`\\xLeftrightarrow{abc}`</pur>     |\n| `KaTeX:\\xhookleftarrow{abc}`     | <pur>`\\xhookleftarrow{abc}`</pur>     | `KaTeX:\\xhookrightarrow{abc}`     | <pur>`\\xhookrightarrow{abc}`</pur>     |\n| `KaTeX:\\xtwoheadleftarrow{abc}`  | <pur>`\\xtwoheadleftarrow{abc}`</pur>  | `KaTeX:\\xtwoheadrightarrow{abc}`  | <pur>`\\xtwoheadrightarrow{abc}`</pur>  |\n| `KaTeX:\\xleftharpoonup{abc}`     | <pur>`\\xleftharpoonup{abc}`</pur>     | `KaTeX:\\xrightharpoonup{abc}`     | <pur>`\\xrightharpoonup{abc}`</pur>     |\n| `KaTeX:\\xleftharpoondown{abc}`   | <pur>`\\xleftharpoondown{abc}`</pur>   | `KaTeX:\\xrightharpoondown{abc}`   | <pur>`\\xrightharpoondown{abc}`</pur>   |\n| `KaTeX:\\xleftrightharpoons{abc}` | <pur>`\\xleftrightharpoons{abc}`</pur> | `KaTeX:\\xrightleftharpoons{abc}`  | <pur>`\\xrightleftharpoons{abc}`</pur>  |\n| `KaTeX:\\xtofrom{abc}`            | <pur>`\\xtofrom{abc}`</pur>            | `KaTeX:\\xmapsto{abc}`             | <pur>`\\xmapsto{abc}`</pur>             |\n| `KaTeX:\\xlongequal{abc}`         | <pur>`\\xlongequal{abc}`</pur>         |                                   |                                        |\n\n## Symbols and Punctuation\n\n### Symbols and Punctuation {.col-span-3}\n\n| :-                                | :-                                        | :-                           | :-                                | :-                            | :-                                 |\n| :-------------------------------- | :---------------------------------------- | :--------------------------- | :-------------------------------- | :---------------------------- | :--------------------------------- |\n| `KaTeX:% comment`                 | <pur>`% comment`</pur>                    | `KaTeX:\\dots`                | <pur>`\\dots`</pur>                | `KaTeX:\\KaTeX`                | <pur>`\\KaTeX`</pur>                |\n| `KaTeX:\\%`                        | <pur>`\\%`</pur>                           | `KaTeX:\\cdots`               | <pur>`\\cdots`</pur>               | `KaTeX:\\LaTeX`                | <pur>`\\LaTeX`</pur>                |\n| `KaTeX:\\#`                        | <pur>`\\#`</pur>                           | `KaTeX:\\ddots`               | <pur>`\\ddots`</pur>               | `KaTeX:\\TeX`                  | <pur>`\\TeX`</pur>                  |\n| `KaTeX:\\&`                        | <pur>`\\&`</pur>                           | `KaTeX:\\ldots`               | <pur>`\\ldots`</pur>               | `KaTeX:\\nabla`                | <pur>`\\nabla`</pur>                |\n| `KaTeX:\\_`                        | <pur>`\\_`</pur>                           | `KaTeX:\\vdots`               | <pur>`\\vdots`</pur>               | `KaTeX:\\infty`                | <pur>`\\infty`</pur>                |\n| `KaTeX:\\text{\\textunderscore}`    | <pur>`\\text{\\textunderscore}`</pur>       | `KaTeX:\\dotsb`               | <pur>`\\dotsb`</pur>               | `KaTeX:\\infin`                | <pur>`\\infin`</pur>                |\n| `KaTeX:\\text{--}`                 | <pur>`\\text{--}`</pur>                    | `KaTeX:\\dotsc`               | <pur>`\\dotsc`</pur>               | `KaTeX:\\checkmark`            | <pur>`\\checkmark`</pur>            |\n| `KaTeX:\\text{\\textendash}`        | <pur>`\\text{\\textendash}`</pur>           | `KaTeX:\\dotsi`               | <pur>`\\dotsi`</pur>               | `KaTeX:\\dag`                  | <pur>`\\dag`</pur>                  |\n| `KaTeX:\\text{---}`                | <pur>`\\text{---}`</pur>                   | `KaTeX:\\dotsm`               | <pur>`\\dotsm`</pur>               | `KaTeX:\\dagger`               | <pur>`\\dagger`</pur>               |\n| `KaTeX:\\text{\\textemdash}`        | <pur>`\\text{\\textemdash}`</pur>           | `KaTeX:\\dotso`               | <pur>`\\dotso`</pur>               | `KaTeX:\\text{\\textdagger}`    | <pur>`\\text{\\textdagger}`</pur>    |\n| `KaTeX:\\text{\\textasciitilde}`    | <pur>`\\text{\\textasciitilde}`</pur>       | `KaTeX:\\sdot`                | <pur>`\\sdot`</pur>                | `KaTeX:\\ddag`                 | <pur>`\\ddag`</pur>                 |\n| `KaTeX:\\text{\\textasciicircum}`   | <pur>`\\text{\\textasciicircum}`</pur>      | `KaTeX:\\mathellipsis`        | <pur>`\\mathellipsis`</pur>        | `KaTeX:\\ddagger`              | <pur>`\\ddagger`</pur>              |\n| <code>KaTeX:\\`</code>             | <pur>\\`</pur>                             | `KaTeX:\\text{\\textellipsis}` | <pur>`\\text{\\textellipsis}`</pur> | `KaTeX:\\text{\\textdaggerdbl}` | <pur>`\\text{\\textdaggerdbl}`</pur> |\n| `KaTeX:\\text{\\textquoteleft}`     | <pur>`text{\\textquoteleft}`</pur>         | `KaTeX:\\Box`                 | <pur>`\\Box`</pur>                 | `KaTeX:\\Dagger`               | <pur>`\\Dagger`</pur>               |\n| `KaTeX:\\lq`                       | <pur>`\\lq`</pur>                          | `KaTeX:\\square`              | <pur>`\\square`</pur>              | `KaTeX:\\angle`                | <pur>`\\angle`</pur>                |\n| `KaTeX:\\text{\\textquoteright}`    | <pur>`\\text{\\textquoteright}`</pur>       | `KaTeX:\\blacksquare`         | <pur>`\\blacksquare`</pur>         | `KaTeX:\\measuredangle`        | <pur>`\\measuredangle`</pur>        |\n| `KaTeX:\\rq`                       | <pur>`\\rq`</pur>                          | `KaTeX:\\triangle`            | <pur>`\\triangle`</pur>            | `KaTeX:\\sphericalangle`       | <pur>`\\sphericalangle`</pur>       |\n| `KaTeX:\\text{\\textquotedblleft}`  | <pur>`\\text{\\textquotedblleft}`</pur>     | `KaTeX:\\triangledown`        | <pur>`\\triangledown`</pur>        | `KaTeX:\\top`                  | <pur>`\\top`</pur>                  |\n| `KaTeX:\"`                         | <pur>`\"`</pur>                            | `KaTeX:\\triangleleft`        | <pur>`\\triangleleft`</pur>        | `KaTeX:\\bot`                  | <pur>`\\bot`</pur>                  |\n| `KaTeX:\\text{\\textquotedblright}` | <pur>`\\text{\\textquotedblright}`</pur>    | `KaTeX:\\triangleright`       | <pur>`\\triangleright`</pur>       | `KaTeX:\\$`                    | <pur>`\\$`</pur>                    |\n| `KaTeX:\\colon`                    | <pur>`\\colon`</pur>                       | `KaTeX:\\bigtriangledown`     | <pur>`\\bigtriangledown`</pur>     | `KaTeX:\\text{\\textdollar}`    | <pur>`\\text{\\textdollar}`</pur>    |\n| `KaTeX:\\backprime`                | <pur>`\\backprime`</pur>                   | `KaTeX:\\bigtriangleup`       | <pur>`\\bigtriangleup`</pur>       | `KaTeX:\\pounds`               | <pur>`\\pounds`</pur>               |\n| `KaTeX:\\prime`                    | <pur>`\\prime`</pur>                       | `KaTeX:\\blacktriangle`       | <pur>`\\blacktriangle`</pur>       | `KaTeX:\\mathsterling`         | <pur>`\\mathsterling`</pur>         |\n| `KaTeX:\\text{\\textless}`          | <pur>`\\text{\\textless}`</pur>             | `KaTeX:\\blacktriangledown`   | <pur>`\\blacktriangledown`</pur>   | `KaTeX:\\text{\\textsterling}`  | <pur>`\\text{\\textsterling}`</pur>  |\n| `KaTeX:\\text{\\textgreater}`       | <pur>`\\text{\\textgreater}`</pur>          | `KaTeX:\\blacktriangleleft`   | <pur>`\\blacktriangleleft`</pur>   | `KaTeX:\\yen`                  | <pur>`\\yen`</pur>                  |\n| `KaTeX:\\text{\\textbar}`           | <pur>`\\text{\\textbar}`</pur>              | `KaTeX:\\blacktriangleright`  | <pur>`\\blacktriangleright`</pur>  | `KaTeX:\\surd`                 | <pur>`\\surd`</pur>                 |\n| `KaTeX:\\text{\\textbardbl}`        | <pur>`\\text{\\textbardbl}`</pur>           | `KaTeX:\\diamond`             | <pur>`\\diamond`</pur>             | `KaTeX:\\degree`               | <pur>`\\degree`</pur>               |\n| `KaTeX:\\text{\\textbraceleft}`     | <pur>`\\text{\\textbraceleft}`</pur>        | `KaTeX:\\Diamond`             | <pur>`\\Diamond`</pur>             | `KaTeX:\\text{\\textdegree}`    | <pur>`\\text{\\textdegree}`</pur>    |\n| `KaTeX:\\text{\\textbraceright}`    | <pur>`\\text{\\textbraceright}`</pur>       | `KaTeX:\\lozenge`             | <pur>`\\lozenge`</pur>             | `KaTeX:\\mho`                  | <pur>`\\mho`</pur>                  |\n| `KaTeX:\\text{\\textbackslash}`     | <pur>`\\text{\\textbackslash}`</pur>        | `KaTeX:\\blacklozenge`        | <pur>`\\blacklozenge`</pur>        | `KaTeX:\\diagdown`             | <pur>`\\diagdown`</pur>             |\n| `KaTeX:\\text{\\P}`                 | <pur>`\\text{\\P}`</pur> or <pur>`\\P`</pur> | `KaTeX:\\star`                | <pur>`\\star`</pur>                | `KaTeX:\\diagup`               | <pur>`\\diagup`</pur>               |\n| `KaTeX:\\text{\\S}`                 | <pur>`\\text{\\S}`</pur> or <pur>`\\S`</pur> | `KaTeX:\\bigstar`             | <pur>`\\bigstar`</pur>             | `KaTeX:\\flat`                 | <pur>`\\flat`</pur>                 |\n| `KaTeX:\\text{\\sect}`              | <pur>`\\text{\\sect}`</pur>                 | `KaTeX:\\clubsuit`            | <pur>`\\clubsuit`</pur>            | `KaTeX:\\natural`              | <pur>`\\natural`</pur>              |\n| `KaTeX:\\copyright`                | <pur>`\\copyright`</pur>                   | `KaTeX:\\clubs`               | <pur>`\\clubs`</pur>               | `KaTeX:\\sharp`                | <pur>`\\sharp`</pur>                |\n| `KaTeX:\\circledR`                 | <pur>`\\circledR`</pur>                    | `KaTeX:\\diamondsuit`         | <pur>`\\diamondsuit`</pur>         | `KaTeX:\\heartsuit`            | <pur>`\\heartsuit`</pur>            |\n| `KaTeX:\\text{\\textregistered}`    | <pur>`\\text{\\textregistered}`</pur>       | `KaTeX:\\diamonds`            | <pur>`\\diamonds`</pur>            | `KaTeX:\\hearts`               | <pur>`\\hearts`</pur>               |\n| `KaTeX:\\circledS`                 | <pur>`\\circledS`</pur>                    | `KaTeX:\\spadesuit`           | <pur>`\\spadesuit`</pur>           | `KaTeX:\\spades`               | <pur>`\\spades`</pur>               |\n| `KaTeX:\\text{\\textcircled a}`     | <pur>`\\text{\\textcircled a}`</pur>        | `KaTeX:\\maltese`             | <pur>`\\maltese`</pur>             | `KaTeX:\\minuso`               | <pur>`\\minuso`</pur>               |\n\n## Environments\n\n### Environments 1\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\n\\begin{matrix}\n   a & b \\\\\n   c & d\n\\end{matrix}\n```\n\n<!--rehype:style=flex:1;-->\n\n```LaTeX\n\\begin{matrix}\n   a & b \\\\\n   c & d\n\\end{matrix}\n```\n\n<!--rehype:style=flex:1;-->\n\n### Environments 2\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\n\\begin{array}{cc}\n   a & b \\\\\n   c & d\n\\end{array}\n```\n\n<!--rehype:style=flex:1;-->\n\n```LaTeX\n\\begin{array}{cc}\n   a & b \\\\\n   c & d\n\\end{array}\n```\n\n### Environments 3\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\n\\begin{pmatrix}\n   a & b \\\\\n   c & d\n\\end{pmatrix}\n```\n\n<!--rehype:style=flex:1;-->\n\n```LaTeX\n\\begin{pmatrix}\n   a & b \\\\\n   c & d\n\\end{pmatrix}\n```\n\n<!--rehype:style=flex:1;-->\n\n### Environments 4\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\n\\begin{bmatrix}\n   a & b \\\\\n   c & d\n\\end{bmatrix}\n```\n\n```LaTeX\n\\begin{bmatrix}\n   a & b \\\\\n   c & d\n\\end{bmatrix}\n```\n\n### Environments 5\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\n\\begin{vmatrix}\n   a & b \\\\\n   c & d\n\\end{vmatrix}\n```\n\n<!--rehype:style=flex:1;-->\n\n```LaTeX\n\\begin{vmatrix}\n   a & b \\\\\n   c & d\n\\end{vmatrix}\n```\n\n<!--rehype:style=flex:1;-->\n\n### Environments 6\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\n\\begin{Vmatrix}\n   a & b \\\\\n   c & d\n\\end{Vmatrix}\n```\n\n<!--rehype:style=flex:1;-->\n\n```LaTeX\n\\begin{Vmatrix}\n   a & b \\\\\n   c & d\n\\end{Vmatrix}\n```\n\n<!--rehype:style=flex:1;-->\n\n### Environments 7\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\n\\begin{Bmatrix}\n   a & b \\\\\n   c & d\n\\end{Bmatrix}\n```\n\n```LaTeX\n\\begin{Bmatrix}\n   a & b \\\\\n   c & d\n\\end{Bmatrix}\n```\n\n### Environments 8\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\n\\def\\arraystretch{1.5}\n   \\begin{array}{c:c:c}\n   a & b & c \\\\ \\hline\n   d & e & f \\\\\n   \\hdashline\n   g & h & i\n\\end{array}\n```\n\n<!--rehype:style=flex:1;-->\n\n```LaTeX\n\\def\\arraystretch{1.5}\n   \\begin{array}{c:c:c}\n   a & b & c \\\\ \\hline\n   d & e & f \\\\\n   \\hdashline\n   g & h & i\n\\end{array}\n```\n\n### Environments 9\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\nx = \\begin{cases}\n   a &\\text{if } b \\\\\n   c &\\text{if } d\n\\end{cases}\n```\n\n```LaTeX\nx = \\begin{cases}\n   a &\\text{if } b \\\\\n   c &\\text{if } d\n\\end{cases}\n```\n\n### Environments 10\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\n\\begin{rcases}\n   a &\\text{if } b \\\\\n   c &\\text{if } d\n\\end{rcases}⇒…\n```\n\n```LaTeX\n\\begin{rcases}\n   a &\\text{if } b \\\\\n   c &\\text{if } d\n\\end{rcases}⇒…\n```\n\n### Environments 11\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\n\\begin{smallmatrix}\n   a & b \\\\\n   c & d\n\\end{smallmatrix}\n```\n\n<!--rehype:style=flex:1;-->\n\n```LaTeX\n\\begin{smallmatrix}\n   a & b \\\\\n   c & d\n\\end{smallmatrix}\n```\n\n### Environments 12\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\n\\sum_{\n\\begin{subarray}{l}\n   i\\in\\Lambda\\\\\n   0<j<n\n\\end{subarray}}\n```\n\n<!--rehype:style=flex:1;-->\n\n```LaTeX\n\\sum_{\n\\begin{subarray}{l}\n   i\\in\\Lambda\\\\\n   0<j<n\n\\end{subarray}}\n```\n\n### Environments 13\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\n\\begin{equation}\n\\begin{split}  a &=b+c\\\\\n      &=e+f\n\\end{split}\n\\end{equation}\n```\n\n<!--rehype:style=flex:1;-->\n\n```LaTeX\n\\begin{equation}\n\\begin{split}  a &=b+c\\\\\n      &=e+f\n\\end{split}\n\\end{equation}\n```\n\n### Environments 14\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\n\\begin{align}\n   a&=b+c \\\\\n   d+e&=f\n\\end{align}\n```\n\n<!--rehype:style=flex:1;-->\n\n```LaTeX\n\\begin{align}\n   a&=b+c \\\\\n   d+e&=f\n\\end{align}\n```\n\n### Environments 15\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\n\\begin{gather}\n   a=b \\\\\n   e=b+c\n\\end{gather}\n```\n\n<!--rehype:style=flex:1;-->\n\n```LaTeX\n\\begin{gather}\n   a=b \\\\\n   e=b+c\n\\end{gather}\n```\n\n### Environments 16\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\n\\begin{alignat}{2}\n   10&x+&3&y=2\\\\\n   3&x+&13&y=4\n\\end{alignat}\n```\n\n<!--rehype:style=flex:1;-->\n\n```LaTeX\n\\begin{alignat}{2}\n   10&x+&3&y=2\\\\\n   3&x+&13&y=4\n\\end{alignat}\n```\n\n### Environments 17\n\n<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->\n\n```KaTeX\n\\begin{CD}\n   A @>a>> B \\\\\n@VbVV @AAcA \\\\\n   C @= D\n\\end{CD}\n```\n\n<!--rehype:style=flex:1;-->\n\n```LaTeX\n\\begin{CD}\n   A @>a>> B \\\\\n@VbVV @AAcA \\\\\n   C @= D\n\\end{CD}\n```\n\n## Lists\n\n### Unordered List\n\n<!--rehype:style=flex:1;-->\n\n```LaTeX\n\\begin{itemize}\n   \\item item1\n   \\item item2\n   \\item item3\n\\end{itemize}\n```\n\n### Ordered List\n\n<!--rehype:style=flex:1;-->\n\n```LaTeX\n\\begin{enumerate}\n   \\item item1\n   \\item item2\n   \\item item3\n\\begin{enumerate}\n```\n\n## Style, Color, Size and Font\n\n### Color\n\n| :-                                    | :-                                         |\n| :------------------------------------ | :----------------------------------------- |\n| `KaTeX:\\color{blue} F=ma`             | <pur>`\\color{blue} F=ma`</pur>             |\n| `KaTeX:\\textcolor{blue}{F=ma}`        | <pur>`\\textcolor{blue}{F=ma}`</pur>        |\n| `KaTeX:\\textcolor{#228B22}{F=ma}`     | <pur>`\\textcolor{#228B22}{F=ma}`</pur>     |\n| `KaTeX:\\colorbox{aqua}{$F=ma$}`       | <pur>`\\colorbox{aqua}{$F=ma$}`</pur>       |\n| `KaTeX:\\fcolorbox{red}{aqua}{$F=ma$}` | <pur>`\\fcolorbox{red}{aqua}{$F=ma$}`</pur> |\n\n### Font {.col-span-2}\n\n| :-                | :-                     | :-                     | :-                          | :-                       | :-                          |\n| :---------------- | :--------------------- | :--------------------- | :-------------------------- | :----------------------- | :-------------------------- |\n| `KaTeX:\\Huge AB`  | <pur>`\\Huge AB`</pur>  | `KaTeX:\\normalsize AB` | <pur>`\\normalsize AB`</pur> | `KaTeX:\\normalsize AB`   | <pur>\\normalsize AB</pur>   |\n| `KaTeX:\\huge AB`  | <pur>`\\huge AB`</pur>  | `KaTeX:\\huge AB`       | <pur>`\\huge AB`</pur>       | `KaTeX:\\small AB`        | <pur>\\small AB</pur>        |\n| `KaTeX:\\LARGE AB` | <pur>`\\LARGE AB`</pur> | `KaTeX:\\LARGE AB`      | <pur>`\\LARGE AB`</pur>      | `KaTeX:\\footnotesize AB` | <pur>\\footnotesize AB</pur> |\n| `KaTeX:\\Large AB` | <pur>`\\Large AB`</pur> | `KaTeX:\\Large AB`      | <pur>`\\Large AB`</pur>      | `KaTeX:\\scriptsize AB`   | <pur>\\scriptsize AB</pur>   |\n| `KaTeX:\\large AB` | <pur>`\\large AB`</pur> | `KaTeX:\\large AB`      | <pur>`\\large AB`</pur>      | `KaTeX:\\tiny AB`         | <pur>\\tiny AB</pur>         |\n\n### Style {.col-span-3}\n\n| :-                                | :-                                    | :-                             | :-                                 |\n| :-------------------------------- | :------------------------------------ | :----------------------------- | :--------------------------------- |\n| `KaTeX:\\displaystyle\\sum_{i=1}^n` | <pur>\\displaystyle\\sum\\_{i=1}^n</pur> | `KaTeX:\\textstyle\\sum_{i=1}^n` | <pur>\\textstyle\\sum\\_{i=1}^n</pur> |\n| `KaTeX:\\scriptstyle x`            | <pur>\\scriptstyle x</pur>             | `KaTeX:\\scriptscriptstyle x`   | <pur>\\scriptscriptstyle x</pur>    |\n| `KaTeX:\\lim\\limits_x`             | <pur>\\lim\\limits_x</pur>              | `KaTeX:\\lim\\nolimits_x`        | <pur>\\lim\\nolimits_x</pur>         |\n| `KaTeX:\\verb!x^2!`                | <pur>\\verb!x^2!</pur>                 |\n\n## Also See\n\n- [LaTeX official website](https://www.latex-project.org/) _(latex-project.org)_\n- [KaTeX official website](https://katex.org/) _(katex.org)_\n- [symbols.pdf](https://www.cmor-faculty.rice.edu/~heinken/latex/symbols.pdf) _(cmor-faculty.rice.edu)_\n"
  },
  {
    "path": "source/_posts/lsof.md",
    "content": "---\ntitle: Lsof\ndate: 2021-02-05 16:12:47\nbackground: bg-blue-400\ntags:\n  - port\n  - processes\n  - utility\ncategories:\n  - Linux Command\nintro: |\n  This quick reference cheat sheet provides various for using lsof command.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Introduction\n\n**lsof** meaning `L`i`S`t `O`pen `F`iles is used to find out which files are open by which process\n\n```shell script\n$ lsof\n$ sudo lsof -u root\n```\n\n### Port-specific\n\n```shell script\n$ lsof -i :8080\n$ lsof -i :80 -i :22\n$ lsof -i TCP:22\n$ lsof -i TCP:1-1024\n$ lsof -i UDP\n$ lsof -i @192.168.1.5\n```\n\n### Process-specific\n\n```shell script\n$ lsof -c mysql\n$ lsof -c java\n$ lsof -c ssh\n$ lsof -c nginx\n$ lsof -c ssh -c httpd\n```\n\n### User-specific\n\n```shell script\n$ lsof -u www-data\n$ lsof -u www-data -u ubuntu\n$ lsof -i -u ^root # Except certain user\n```\n\n### Network-specific\n\n```shell script\n$ lsof -i 4   # IPv4 only\n$ lsof -i 6   # IPv6 only\n```\n\n### PID-specific\n\n```shell script\n$ lsof -p 1753\n$ lsof -p ^3  # Except certain pids\n```\n\n### Filename-specific\n\n```shell script\n$ lsof /var/log/messages\n$ lsof /etc/passwd\n```\n\n### Directory-specific\n\n```shell script\n$ lsof +D /var/log # Within a directory\n```\n\n### Kill\n\n```shell script\n$ kill -9 `lsof -t -u apache`\n$ kill -9 $(lsof -t -i :8080)\n```\n"
  },
  {
    "path": "source/_posts/lua.md",
    "content": "---\ntitle: Lua\ndate: 2025-09-01 10:07:20\nbackground: bg-[##00007f]\ntags:\n  - script\n  - interpret\ncategories:\n  - Programming\nintro: |\n  The [Lua](https://www.lua.org/) cheat sheet is a one-page reference sheet for the Lua 5.4 programming language.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### Introduction\n\n- [Lua](https://www.lua.org/) _(lua.org)_\n- [Lua Document](https://www.lua.org/docs.html) _(lua.org/docs.html)_\n- [Learn X in Y minutes](https://learnxinyminutes.com/docs/lua/) _(learnxinyminutes.com)_\n\n### Hello World\n\n```lua\n\nprint(\"Hello, World!\") -- Hello, World!\n\n-- You can omit parentheses if the argument is one string or table literal\nprint \"Hello, World!\"  -- Hello, World!\n\nprint [[multi-line\n Hello\n World]]\n\n\n```\n\nThe famous \"Hello World\" program in Lua\n\n### Variables\n\n```lua\n\nlocal age = 18 -- local variable\nboys, girls = 2, 3 -- global variables\n\n-- Now x = 1, y = 2, z = 3, and 4 is thrown away.\nx, y, z = 1, 2, 3, 4\n\n-- Undefined variables return nil.\n-- This is not an error:\nfoo = anUnknownVariable  -- Now foo = nil.\n\n-- Variables are global by default unless declared with local.\n\n```\n\nLua is a dynamically typed language and hence only the values will have types not the variables.\n\n### Data Types {.col-span-2 .row-span-2}\n\n| Value Type | Description                                    |\n| ---------- | ---------------------------------------------- |\n| `number`   | Represent (double-precision) numbers           |\n| `string`   | Represents text                                |\n| `nil`      | Differentiates between values with data or not |\n| `boolean`  | true or false value                            |\n| `function` | Represents a sub routine                       |\n| `userdata` | Represents arbitrary C data                    |\n| `thread`   | Represents independent threads of execution    |\n| `table`    | key-value pair, or array.                      |\n\nSee: [Data Type APIs](#data-type-apis)\n\n### IO\n\n```lua\n-- Writes data to the standard output or a file.\nio.write(\"Enter your name: \")\n-- Reads input from the user or a file. You can specify formats like \"*l\" (line), \"*n\" (number), or \"*a\" (all).\nname = io.read()\n\nio.write(\"Enter your age: \")\nage = io.read()\n```\n\n### Comments\n\n```lua\n-- This is a single line comments\n```\n\n```lua\n--[[\n Comments (multi-line) could also be written like this\n--]]\n```\n\n## Operators\n\n### Arithmetic\n\n```lua\n-- add\n  result = 10 + 30  -- => 40\n\n-- subtract\nresult = 40 - 10  -- => 30\n\n-- multiply\nresult = 50 * 5   -- => 250\n\n-- divide (float division)\nresult = 16 / 4   -- => 4.0\n\n-- divide (integer division, Lua 5.3+)\nresult = 16 // 4  -- => 4\n\n-- modulo\nresult = 25 % 2   -- => 1\n\n-- power\nresult = 5 ^ 3    -- => 125\n\n-- unary minus\na = 12\nresult = -a -- => -12\n```\n\n### Relational\n\n```lua\na = 10\nb = 20\n\n-- equals\nprint(a == b) -- false\n\n-- not equals\nprint(a ~= b) -- true\n\n-- greater than\nprint(a > b) -- false\n\n-- less than\nprint(a < b) -- true\n\n-- greater than or equals\nprint(a >= b) -- false\n\n-- less than or equals\nprint(a <= b) -- true\n```\n\n### Logical\n\n```lua\n-- and\nfalse and nil  --> false\n0 and 20       --> 20\n10 and 20      --> 20\n\n-- or\ntrue or false  --> true\n10 or 0        --> 10\n12 or 4        --> 12\n\n  -- not\nnot true       --> false\n\n```\n\nOnly nil and false are falsy; 0 and '' are true!\n\n## Conditionals\n\n### if-else {.col-span-3 .row-span-2}\n\n```lua\nnum = 15\nif num > 10 then\n  print(\"num is greater than 10\")\nelseif num < 10 then\n  print(\"num is smaller than 10\")\nelse\n  print(\"num is 10\")\nend\n\n-- making a ternary operator\n-- This is similar to the a?b:c operator in C/js:\nans = aBoolValue and 'yes' or 'no'  --> 'no'\n\n```\n\n## Loops\n\n### While loop\n\n```lua\ni = 1\nwhile i <= 5 do\n  print(i)\n  i = i + 1\nend\n```\n\n### For loop\n\n```lua\n-- Numeric for loop (start, end, step)\nfor i = 1, 5, 1 do\n  print(i)\nend\n\n-- Generic for loop for tables\nt = {10, 20, 30}\nfor k, v in ipairs(t) do\n  print(k, v) -- prints 1 10, 2 20, 3 30\nend\n```\n\n### Repeat-until loop\n\n```lua\ni = 1\nrepeat\n  print(i)\n  i = i + 1\nuntil i > 5\n```\n\n### Breaking out\n\n```lua\nwhile x do\n  if condition then\n    break\n  end\nend\n```\n\n### Continue\n\n```lua\n-- prints even numbers in [|1,10|]\nfor i=1,10 do\n   if i % 2 == 1 then\n    goto continue\n  end\n   print(i)\n   ::continue::\nend\n```\n\n## Functions\n\n### Creating fns\n\n```lua\nfunction myFunction()\n  return 1\nend\n\nfunction myFunctionWithArgs(a, b)\n  -- ...\nend\n\n-- function as arg\nfunction operate(a, b, func)\n    return func(a, b)\nend\n\n\n\n-- anonymous function\nfunction (parameters)\n    -- body of the function\nend\n\n\nlocal greet = function(name)\n    return \"Hello, \" .. name\nend\n\n\n-- Not exported in the module\nlocal function myPrivateFunction()\nend\n\n\n-- Splats\nfunction doAction(action, ...)\n  print(\"Doing '\"..action..\"' to\", ...)\nend\n\n```\n\n### Invoking fns {.col-span-2}\n\n```lua\nmyFunction()\n\nprint(greet(\"Lua\")) -- Output: Hello, Lua\n\n\n-- function as arg\nlocal result = operate(5, 3, function(x, y)\n    return x + y\nend)\n\nprint(result) -- Output: 8\n\n\ndoAction('write', \"Shirley\", \"Abed\")\n--> Doing 'write' to Shirley Abed\n```\n\nYou can omit parentheses if the argument is one string or table literal\n\n```lua\nprint \"Hello World\"     -->     print(\"Hello World\")\n\ndofile 'a.lua'          -->     dofile ('a.lua')\n\nprint [[a multi-line    -->     print([[a multi-line\n message]]                        message]])\n\nf{x=10, y=20}           -->     f({x=10, y=20})\n\ntype{}                  -->     type({})\n```\n\n## Data Type APIs\n\n### Global functions {.col-span-2 .row-span-2}\n\nAssert\n\n```lua\nlocal my_table = {}\nassert(my_table, \"my_table should exist!\") -- This will not fail\n\nlocal a = nil\n-- This will cause a runtime error with the message \"a is nil\"\nassert(a, \"a is nil\")\n```\n\nType\n\n```lua\nlocal my_var = 10\nprint(type(my_var)) -- \"number\"\n\nlocal my_str = \"hello\"\nprint(type(my_str)) -- \"string\"\n\nlocal my_func = function() end\nprint(type(my_func)) -- \"function\"\n```\n\nDofile & Loadfile\n\n```lua\n-- Using dofile\ndofile(\"my_file.lua\") -- Executes my_file.lua immediately\n\n-- Using loadfile\nlocal my_func = loadfile(\"my_file.lua\")\nif my_func then\n  -- my_file.lua is valid, now execute it\n  my_func()\nelse\n  print(\"Error loading file.\")\nend\n```\n\nPairs\n\n```lua\nlocal my_table = {10, \"hello\", 20, name = \"Lua\"}\n\nprint(\"Using pairs:\")\nfor key, value in pairs(my_table) do\n  print(key, value)\nend\n\nprint(\"Using ipairs:\")\nfor key, value in ipairs(my_table) do\n  print(key, value)\nend\n```\n\nTo number\n\n```lua\nlocal num1 = tonumber(\"34\")\nprint(num1, type(num1)) -- 34 number\n\nlocal num2 = tonumber(\"34.5\")\nprint(num2, type(num2)) -- 34.5 number\n\nlocal num3 = tonumber(\"abc\")\nprint(num3) -- nil (conversion failed)\n\nlocal hex_num = tonumber(\"8f\", 16)\nprint(hex_num) -- 143 (8 * 16 + 15)\n```\n\n### Strings\n\n```lua\ns = \"Hello\"\n```\n\nConcatenation\n\n```lua\ns .. \" there\" -- => Hello there\n```\n\nCommonly used methods\n\n```lua\ns:upper() -- => HELLO\ns:lower() -- => hello\ns:len()   -- => 5\ns:find(\"o\") -- => 5\ns:reverse() -- => olleH\n```\n\nSub\n\n```lua\nlocal s = \"programming\"\ns:sub(3, 7) -- (extracts substring) => \"ogram\"\n```\n\nGsub\n\n```lua\ns:gsub() --> (substitutes all matches)\n```\n\nChar\n\n```lua\ns = \"ha\"\ns:rep(3) -- // repeats 3 times -> \"hahaha\"\nlocal s_char = string.char(72, 101, 108, 108, 111)\nprint(s_char) -- \"Hello\"\n```\n\nFormat\n\n```lua\nlocal name = \"Alice\"\nlocal age = 30\nlocal formatted = string.format(\"My name is %s and I am %d years old.\", name, age)\nprint(formatted) -- \"My name is Alice and I am 30 years old.\"\n```\n\nOthers\n\n```lua\ns:match()\ns:gmatch()\ns:dump()\ns:byte()\n```\n\n### placeholder\n\n### Math {.col-span-2 .row-span-2}\n\n```lua\nmath.abs(-5) -- => 5\n-- Returns the absolute value of x.\n```\n\n---\n\n```lua\nmath.acos(1) -- => 0\n-- Returns the arc cosine of x in radians.\n```\n\n---\n\n```lua\nmath.asin(0) -- => 0\n-- Returns the arc sine of x in radians.\n```\n\n---\n\n```lua\nmath.atan(y, x)` -- => arctangent of y/x\n-- Returns the arctangent of `y/x` in radians, using the signs of both arguments to determine the correct quadrant.\n```\n\n---\n\n```lua\nmath.ceil(x)` -- => smallest integer greater than or equal to x\n-- Returns the smallest integer value not less than `x`.\n```\n\n---\n\n```lua\nmath.cos(x)` -- => cosine of x\n-- Returns the cosine of `x` (assumed to be in radians).\n```\n\n---\n\n```lua\nmath.deg(x)` -- => radians to degrees\n-- Returns the angle `x` (in radians) converted to degrees.\n```\n\n---\n\n```lua\nmath.exp(x)` -- => e^x\n-- Returns the value of $e^x$, where $e$ is the base of natural logarithms.\n```\n\n---\n\n```lua\nmath.floor(x)` -- => largest integer less than or equal to x\n-- Returns the largest integer value not greater than `x`.\n```\n\n---\n\n```lua\nmath.fmod(x, y)` -- => remainder of x divided by y\n-- Returns the remainder of `x` divided by `y`, with the same sign as `x`.\n```\n\n---\n\n```lua\nmath.log(x, base)` -- => logarithm of x\n-- Returns the logarithm of `x` in the given `base`. If `base` is not provided, it defaults to the natural logarithm.\n```\n\n---\n\n```lua\nmath.max(x, ...)` -- => largest argument\n-- Returns the largest among its arguments.\n```\n\n---\n\n```lua\nmath.min(x, ...)` -- => smallest argument\n-- Returns the smallest among its arguments.\n```\n\n---\n\n```lua\nmath.modf(x)` -- => integer and fractional parts\n-- Returns two numbers: the integer part of `x` and the fractional part.\n```\n\n---\n\n```lua\nmath.pow(x, y)` -- => x^y\n-- Returns `x` raised to the power of `y`.\n```\n\n---\n\n```lua\nmath.rad(x)` -- => degrees to radians\n-- Returns the angle `x` (in degrees) converted to radians.\n```\n\n---\n\n```lua\nmath.random(m, n)` -- => random number\n-- Returns a pseudo-random number. When called without arguments, returns a float in the range $[0, 1)$. With one argument `n`, returns an integer in the range $[1, n]$. With two arguments `m` and `n`, returns an integer in the range $[m, n]$.\n```\n\n---\n\n```lua\nmath.sin(x)` -- => sine of x\n-- Returns the sine of `x` (assumed to be in radians).\n```\n\n---\n\n```lua\nmath.sqrt(x)` -- => square root of x\n-- Returns the non-negative square root of `x`.\n```\n\n---\n\n```lua\nmath.tan(x)` -- => tangent of x\n-- Returns the tangent of `x` (assumed to be in radians).\n\n```\n\n### Table basics\n\n```lua\n-- Array-like table (one-indexed)\nlocal colors = {\"red\", \"green\", \"blue\"}\nprint(colors[1]) -- \"red\"\n\n-- Dictionary-like table\nlocal user = {name = \"Jane\", age = 25}\nprint(user.name) -- \"Jane\"\nprint(user[\"age\"]) -- 25\n\n-- Mixed table\nlocal mixed = {1, \"two\", key = \"value\"}\nprint(mixed[1]) -- 1\nprint(mixed.key) -- \"value\"\n\n-- Getting the length of an array-like table\nprint(#colors) -- 3\n```\n\n### Tables\n\n```lua\nlocal my_table = {10, 20}\n\n-- insert (appends 30 to the end)\ntable.insert(my_table, 30)\n\n-- insertion (inserts 2 in position 1)\ntable.insert(my_table, 1, 2)\n\n-- remove (remove item in position 3)\ntable.remove(my_table, 3)\n\n-- Default numerical sort\nlocal numbers = {5, 2, 8, 1}\ntable.sort(numbers) -- {1, 2, 5, 8}\n\n-- Custom sort for descending order\nlocal numbers_desc = {5, 2, 8, 1}\ntable.sort(numbers_desc, function(a, b)\n  return a > b\nend) -- {8, 5, 2, 1}\n\n-- concat\nlocal fruit = {\"apple\", \"banana\", \"cherry\"}\nlocal fruit_string = table.concat(fruit, \", \")\nprint(fruit_string) -- apple, banana, cherry\n```\n\n## Misc\n\n### Classes {.col-span-2 .row-span-2}\n\nClasses aren't built in; there are different ways to make them using tables and metatables.\n\n```lua\n\n```\n\nShort explanation; what we are trying to do is basically making a table that can hold data and functions\n\n```lua\n\nDog = {}\n\nfunction Dog:new()\n  newObj = {sound = 'woof'}\n  self.__index = self\n  return setmetatable(newObj, self)\nend\n\nfunction Dog:makeSound()\n  print('I say ' .. self.sound)\nend\n\nmrDog = Dog:new()\nmrDog:makeSound()  -- 'I say woof'\n\n```\n\nInheritance\n\n```lua\nLoudDog = Dog:new()\n\nfunction LoudDog:makeSound()\n  s = self.sound .. ' '\n  print(s .. s .. s)\nend\n\nseymour = LoudDog:new()\nseymour:makeSound()  -- 'woof woof woof'\n```\n\nAnother example\n\n```lua\nAccount = {}\n\nfunction Account:new(balance)\n  local t = setmetatable({}, { __index = Account })\n\n  -- Your constructor stuff\n  t.balance = (balance or 0)\n  return t\nend\n\nfunction Account:withdraw(amount)\n  print(\"Withdrawing \" .. amount .. \"...\")\n  self.balance = self.balance - amount\n  self:report()\nend\n\nfunction Account:report()\n  print(\"Your current balance is: \"..self.balance)\nend\n\na = Account:new(9000)\na:withdraw(200)    -- method call\n```\n\n### Meta-tables\n\nA metatable is simply a table with functions in it.\n\n```lua\nmt = {}\n\nmt.__tostring = function() return \"lol\" end\nmt.__add      = function(b) ... end       -- a + b\nmt.__mul      = function(b) ... end       -- a * b\nmt.__index    = function(k) ... end       -- Lookups (a[k] or a.k)\nmt.__newindex = function(k, v) ... end    -- Setters (a[k] = v)\n```\n\nMetatables allow you to override behavior of another table.\n\n```lua\n\nmytable = {}\nsetmetatable(mytable, mt)\n\nprint(myobject)\n```\n\n### Files\n\n```lua\nlocal file = io.open(\"test.txt\", \"w\")\nif file then\n  file:write(\"Hello from Lua!\")\n  io.close(file)\nend\n\nlocal file = io.open(\"test.txt\", \"r\")\nif file then\n  local content = file:read(\"*a\") -- read all content\n  print(content)\n  io.close(file)\nend\n```\n"
  },
  {
    "path": "source/_posts/markdown.md",
    "content": "---\ntitle: Markdown\ndate: 2020-12-14 18:28:43\nbackground: bg-[#6319bf]\ntags:\n  - md\n  - Markup\n  - text\n  - format\ncategories:\n  - Programming\nintro: This is a quick reference cheat sheet to the Markdown syntax.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Markdown Quick Reference\n\n### Headers (atx style)\n\n<!-- prettier-ignore -->\n```markdown\n# h1\n## h2\n### h3\n#### h4\n##### h5\n###### h6\n```\n\n### Headers (setext style)\n\n<!-- prettier-ignore -->\n```markdown\nHeader 1\n========\n\nHeader 2\n--------\n```\n\n### Blockquotes\n\n```markdown\n> This is  \n> a blockquote\n>\n> > Nested  \n> > Blockquote\n```\n\n### Unordered List {.row-span-2}\n\n<!-- prettier-ignore -->\n```markdown\n* Item 1\n* Item 2\n  * item 3a\n  * item 3b\n```\n\nor\n\n```markdown\n- Item 1\n- Item 2\n```\n\nor\n\n<!-- prettier-ignore -->\n```markdown\n_ Item 1\n+ Item 2\n```\n\nor\n\n```markdown\n- [ ] Checkbox off\n- [x] Checkbox on\n```\n\n### Ordered List\n\n```markdown\n1. Item 1\n2. Item 2  \n   a. Item 3a  \n   b. Item 3b\n```\n\n### Links\n\n```markdown\n[link](http://google.com)\n\n[link][google]  \n[google]: http://google.com\n\n<http://google.com>\n```\n\n### Emphasis\n\n<!-- prettier-ignore -->\n```markdown\n*italic*  \n_italic_\n\n**bold**  \n__bold__\n\n`inline code`  \n~~struck out~~\n```\n\n### Horizontal line\n\nHyphens\n\n<!-- prettier-ignore -->\n```markdown\n---\n```\n\nAsterisks\n\n<!-- prettier-ignore -->\n```markdown\n***\n```\n\nUnderscores\n\n<!-- prettier-ignore -->\n```markdown\n___\n```\n\n### Code\n\n````markdown\n```javascript\nconsole.log('This is a block code');\n```\n````\n\n<!-- prettier-ignore -->\n```markdown\n~~~css\n.button {\n  border: none;\n}\n~~~\n```\n\n```markdown\n    4 space indent makes a code block\n```\n\n### Escaped code\n\nEscaped code blocks can be done with more back ticks on the outside or a different symbol.\n\n<!-- prettier-ignore -->\n`````markdown\n````markdown\n```bash\necho hi\n```\n````\n\n~~~markdown\n```bash\necho hi\n```\n~~~\n\n`````\n\n#### Inline code\n\n```markdown\n`Inline code` has back-ticks around it\n```\n\n### Tables\n\n```markdown\n| Left column | Center column | Right column |\n| :---------- | :-----------: | -----------: |\n| Cell 1      |   Centered    |        $1600 |\n| Cell 2      |    Cell 3     |          $12 |\n```\n\nSimple style\n\n<!-- prettier-ignore -->\n```markdown\nLeft column | Center column | Right column\n:----------:|:-------------:|:-----------:\n   Cell 1   |   Centered    |    $1600\n   Cell 2   |    Cell 3     |     $12\n```\n\nA markdown table generator: [tableconvert.com](https://tableconvert.com/)\n\n### Images {.col-span-2}\n\n```markdown\n![GitHub Logo](/images/logo.png)\n\n![Alt Text](url)\n```\n\n#### Image with link\n\n```markdown\n[![GitHub Logo](/images/logo.png)](https://github.com/)\n\n[![Alt Text](image_url)](link_url)\n```\n\n#### Reference style\n\n```markdown\n![alt text][logo]\n\n[logo]: /images/logo.png 'Logo Title'\n```\n\n### Backslash escapes\n\n| Characters        | Escape                | Description           |\n| ----------------- | --------------------- | :-------------------- |\n| <code>\\\\</code>   | <code>\\\\\\\\</code>     | Backslash             |\n| <code>\\`</code>   | <code>\\\\\\`</code>     | Backtick              |\n| <code>\\*</code>   | <code>\\\\\\*</code>     | Asterisk              |\n| <code>\\_</code>   | <code>\\\\\\_</code>     | Underscore            |\n| <code>\\{\\}</code> | <code>\\\\\\{\\\\\\}</code> | Curly braces          |\n| <code>\\[\\]</code> | <code>\\\\\\[\\\\\\]</code> | Square brackets       |\n| <code>\\(\\)</code> | <code>\\\\\\(\\\\\\)</code> | Parentheses           |\n| <code>\\#</code>   | <code>\\\\\\#</code>     | Hash mark             |\n| <code>\\+</code>   | <code>\\\\\\+</code>     | Plus sign             |\n| <code>\\-</code>   | <code>\\\\\\-</code>     | Minus sign \\(hyphen\\) |\n| <code>\\.</code>   | <code>\\\\\\.</code>     | Dot                   |\n| <code>\\!</code>   | <code>\\\\\\!</code>     | Exclamation mark      |\n\n{.show-header}\n"
  },
  {
    "path": "source/_posts/matlab.md",
    "content": "---\ntitle: MATLAB\ndate: 2023-01-03 09:51:44\nbackground: bg-[#692316]\ntags:\ncategories:\n  - Programming\nintro: |\n  This quick reference cheat sheet provides an example introduction to using the [MATLAB](https://mathworks.cn/) scientific computing language to get started quickly\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Introduction\n\nMATLAB is short for `matrix laboratory`\n\n---\n\n- [MATLAB official website](https://www.mathworks.com)\n\n### Matrix and array operations {.row-span-3}\n\nMATLAB allows you to use a single arithmetic operator or function to manipulate all values in a matrix\n\n```matlab\na + 10\n```\n\nMATLAB will execute the above statement and return the following results:\n\n```\nans = 3×3\n    11    13    15\n    12    14    16\n    17    18    20\n```\n\n---\n\n```matlab\nsin(a)\n```\n\nMATLAB will execute the above statement and return the following results:\n\n```\nans = 3×3\n    0.8415    0.1411   -0.9589\n    0.9093   -0.7568   -0.2794\n    0.6570    0.9894   -0.5440\n```\n\nTo transpose a matrix, use single quotes (`'`)\n\n```matlab\na'\n```\n\n---\n\n```\nans = 3×3\n     1     2     7\n     3     4     8\n     5     6    10\n```\n\nPerform standard matrix multiplication using the `*` operator, which computes the inner product between rows and columns\n\n```matlab\np = a*inv(a)\n```\n\n---\n\n```\np = 3×3\n    1.0000         0         0\n         0    1.0000         0\n         0         0    1.0000\n```\n\n### concatenation {.row-span-2}\n\nConcatenation is the process of joining arrays to form larger arrays. In fact, the first array is formed by\nconcatenating its elements. Pairs of square brackets `[]` are concatenation operators.\n\n```matlab\nA = [a,a]\n```\n\n---\n\n```\nA = 3×6\n\n     1     3     5     1     3     5\n     2     4     6     2     4     6\n     7     8    10     7     8    10\n```\n\nConcatenating arrays next to each other using commas is called horizontal concatenation. Each array must have the same\nnumber of rows. Likewise, semicolons can be used for vertical concatenation if the arrays have the same number of\ncolumns.\n\n```matlab\nA = [a; a]\n```\n\n---\n\n```\nA = 6×3\n\n     1     3     5\n     2     4     6\n     7     8    10\n     1     3     5\n     2     4     6\n     7     8    10\n```\n\n### Matrices and arrays {.row-span-3}\n\nTo create an array with four elements per row, separate elements with commas (`,`) or spaces\n\n```matlab\na = [1 2 3 4]\n```\n\nMATLAB will execute the above statement and return the following results:\n\n```\na = 1×4\n     1     2     3     4\n```\n\n#### Create a matrix with multiple rows\n\n```matlab\na = [1 3 5; 2 4 6; 7 8 10]\n```\n\n---\n\n```\na = 3×3\n     1     3     5\n     2     4     6\n     7     8    10\n```\n\n#### 5×1 column vector of zeros\n\n```matlab\nz = zeros(5,1)\n```\n\n---\n\n```\nz = 5×1\n     0\n     0\n     0\n     0\n     0\n```\n\n### Complex number\n\nA complex number has a real part and an imaginary part, and the imaginary unit is the square root of -1.\n\n```matlab\nsqrt(-1)\n```\n\n---\n\n```\nans = 0.0000 + 1.0000i\n```\n\nTo represent the imaginary part of a complex number, use i or j.\n\n```matlab\nc = [3+4i, 4+3j; -i, 10j]\n```\n\n---\n\n```\nc = 2×2 complex\n\n   3.0000 + 4.0000i   4.0000 + 3.0000i\n   0.0000 - 1.0000i   0.0000 +10.0000i\n```\n\n## Basic knowledge\n\n### Input the command\n\n| -                                                                               | -                                                                         |\n| ------------------------------------------------------------------------------- | :------------------------------------------------------------------------ |\n| [ans](https://www.mathworks.com/help/matlab/ref/ans.html)                       | Most recently calculated answer                                           |\n| [clc](https://www.mathworks.com/help/matlab/ref/clc.html)                       | Clear the command line window                                             |\n| [diary](https://www.mathworks.com/help/matlab/ref/diary.html)                   | Record the text of the command line window into the log file              |\n| [format](https://www.mathworks.com/help/matlab/ref/format.html)                 | Set the output display format                                             |\n| [home](https://www.mathworks.com/help/matlab/ref/home.html)                     | Send cursor reset                                                         |\n| [iskeyword](https://www.mathworks.com/help/matlab/ref/iskeyword.html)           | Determine if the input is a <span class=\"trademark\">MATLAB</span> keyword |\n| [more](https://www.mathworks.com/help/matlab/ref/more.html)                     | Control paging output in the command line window                          |\n| [commandwindow](https://www.mathworks.com/help/matlab/ref/commandwindow.html)   | Select command window                                                     |\n| [commandhistory](https://www.mathworks.com/help/matlab/ref/commandhistory.html) | Open command history window                                               |\n\n#### Objects\n\n| -                                                                          | -                                                |\n| -------------------------------------------------------------------------- | :----------------------------------------------- |\n| [DisplayFormatOptions](https://www.mathworks.com/help/matlab/ref/ans.html) | Output display format in the command line window |\n\n### Matrices and Arrays {.row-span-5}\n\nCreate and combine arrays\n\n| -                                                                 | -                                                                 |\n| ----------------------------------------------------------------- | :---------------------------------------------------------------- |\n| [zeros](https://www.mathworks.com/help/matlab/ref/zeros.html)     | Create an array of all zeros                                      |\n| [ones](https://www.mathworks.com/help/matlab/ref/ones.html)       | Create an array of all 1s                                         |\n| [rand](https://www.mathworks.com/help/matlab/ref/rand.html)       | Uniformly distributed random numbers                              |\n| [true](https://www.mathworks.com/help/matlab/ref/true.html)       | Logical value 1 (true)                                            |\n| [false](https://www.mathworks.com/help/matlab/ref/false.html)     | logical 0 (false)                                                 |\n| [eye](https://www.mathworks.com/help/matlab/ref/eye.html)         | identity matrix                                                   |\n| [diag](https://www.mathworks.com/help/matlab/ref/diag.html)       | Create a diagonal matrix or get the diagonal elements of a matrix |\n| [blkdiag](https://www.mathworks.com/help/matlab/ref/blkdiag.html) | block diagonal matrix                                             |\n| [cat](https://www.mathworks.com/help/matlab/ref/double.cat.html)  | Concatenate arrays.                                               |\n| [horzcat](https://www.mathworks.com/help/matlab/ref/horzcat.html) | Concatenate arrays horizontally                                   |\n| [vertcat](https://www.mathworks.com/help/matlab/ref/vertcat.html) | Concatenate arrays vertically                                     |\n| [repelem](https://www.mathworks.com/help/matlab/ref/repelem.html) | Repeat array element copy                                         |\n| [repmat](https://www.mathworks.com/help/matlab/ref/repmat.html)   | Repeat array copy                                                 |\n\nCreate grid\n\n| -                                                                     | -                                       |\n| --------------------------------------------------------------------- | :-------------------------------------- |\n| [linspace](https://www.mathworks.com/help/matlab/ref/linspace.html)   | Generate linearly spaced vectors        |\n| [logspace](https://www.mathworks.com/help/matlab/ref/logspace.html)   | Generate logarithmic spaced vectors     |\n| [freqspace](https://www.mathworks.com/help/matlab/ref/freqspace.html) | frequency spacing of frequency response |\n| [meshgrid](https://www.mathworks.com/help/matlab/ref/meshgrid.html)   | 2D and 3D grids                         |\n| [ndgrid](https://www.mathworks.com/help/matlab/ref/ndgrid.html)       | Rectangular grid in N-dimensional space |\n\nDetermine size, shape and order\n\n| -                                                                           | -                                                          |\n| --------------------------------------------------------------------------- | :--------------------------------------------------------- |\n| [length](https://www.mathworks.com/help/matlab/ref/length.html)             | The length of the largest array dimension                  |\n| [size](https://www.mathworks.com/help/matlab/ref/size.html)                 | array size                                                 |\n| [ndims](https://www.mathworks.com/help/matlab/ref/double.ndims.html)        | Number of dimensions of the array                          |\n| [numel](https://www.mathworks.com/help/matlab/ref/double.numel.html)        | the number of array elements                               |\n| [isscalar](https://www.mathworks.com/help/matlab/ref/isscalar.html)         | Determine whether the input is a scalar                    |\n| [issorted](https://www.mathworks.com/help/matlab/ref/issorted.html)         | Determine if the array is sorted                           |\n| [issortedrows](https://www.mathworks.com/help/matlab/ref/issortedrows.html) | Determine whether the rows of a matrix or table are sorted |\n| [isvector](https://www.mathworks.com/help/matlab/ref/isvector.html)         | Determine whether the input is a vector                    |\n| [ismatrix](https://www.mathworks.com/help/matlab/ref/ismatrix.html)         | Determine whether the input is a matrix                    |\n| [isrow](https://www.mathworks.com/help/matlab/ref/isrow.html)               | Determine whether the input is a row vector                |\n| [iscolumn](https://www.mathworks.com/help/matlab/ref/iscolumn.html)         | Determine whether the input is a column vector             |\n| [isempty](https://www.mathworks.com/help/matlab/ref/isempty.html)           | Determine whether the array is empty                       |\n\nRefactor and rearrange\n\n| -                                                                                   | -                                        |\n| ----------------------------------------------------------------------------------- | :--------------------------------------- |\n| [sort](https://www.mathworks.com/help/matlab/ref/sort.html)                         | Sort array                               |\n| elements [sortrows](https://www.mathworks.com/help/matlab/ref/double.sortrows.html) | Sort matrix rows or table rows           |\n| [flip](https://www.mathworks.com/help/matlab/ref/flip.html)                         | Flip the order of elements               |\n| [fliplr](https://www.mathworks.com/help/matlab/ref/fliplr.html)                     | Flip the array from left to right        |\n| [flipud](https://www.mathworks.com/help/matlab/ref/flipud.html)                     | Flip the array from top to bottom        |\n| [rot90](https://www.mathworks.com/help/matlab/ref/rot90.html)                       | Rotate an array by 90 degrees            |\n| [transpose](https://www.mathworks.com/help/matlab/ref/transpose.html)               | Transpose a vector or matrix             |\n| [ctranspose](https://www.mathworks.com/help/matlab/ref/ctranspose.html)             | complex conjugate transpose              |\n| [permute](https://www.mathworks.com/help/matlab/ref/permute.html)                   | permute array dimension                  |\n| [ipermute](https://www.mathworks.com/help/matlab/ref/ipermute.html)                 | Inverse permutation of array dimensions. |\n| [circshift](https://www.mathworks.com/help/matlab/ref/circshift.html)               | Circular shift array                     |\n| [shiftdim](https://www.mathworks.com/help/matlab/ref/shiftdim.html)                 | shift array dimension                    |\n| [reshape](https://www.mathworks.com/help/matlab/ref/reshape.html)                   | Reshape array                            |\n| [squeeze](https://www.mathworks.com/help/matlab/ref/squeeze.html)                   | Remove dimensions of length 1            |\n\nindex\n\n| -                                                                 | -                                                                                    |\n| ----------------------------------------------------------------- | :----------------------------------------------------------------------------------- |\n| [colon](https://www.mathworks.com/help/matlab/ref/colon.html)     | vector creation, array subscript and <code class=\"literal\">for</code> loop iteration |\n| [end](https://www.mathworks.com/help/matlab/ref/end.html)         | Terminate a code block or indicate the maximum array index                           |\n| [ind2sub](https://www.mathworks.com/help/matlab/ref/ind2sub.html) | Convert linear index to subscript                                                    |\n| [sub2ind](https://www.mathworks.com/help/matlab/ref/sub2ind.html) | Convert subscript to linear index                                                    |\n\n### Value type {.row-span-2}\n\nCreate numeric variables\n\n| -                                                               | -                                |\n| --------------------------------------------------------------- | :------------------------------- |\n| [double](https://www.mathworks.com/help/matlab/ref/double.html) | double precision array           |\n| [single](https://www.mathworks.com/help/matlab/ref/single.html) | single precision array           |\n| [int8](https://www.mathworks.com/help/matlab/ref/int8.html)     | 8-bit signed integer array       |\n| [int16](https://www.mathworks.com/help/matlab/ref/int16.html)   | 16-bit signed integer array      |\n| [int32](https://www.mathworks.com/help/matlab/ref/int32.html)   | 32-bit signed integer array      |\n| [int64](https://www.mathworks.com/help/matlab/ref/int64.html)   | 64-bit signed integer array      |\n| [uint8](https://www.mathworks.com/help/matlab/ref/uint8.html)   | Array of 8-bit unsigned integers |\n| [uint16](https://www.mathworks.com/help/matlab/ref/uint16.html) | 16-bit unsigned integer array    |\n| [uint32](https://www.mathworks.com/help/matlab/ref/uint32.html) | 32-bit unsigned integer array    |\n| [uint64](https://www.mathworks.com/help/matlab/ref/uint64.html) | 64-bit unsigned integer array    |\n\nConvert between numeric types\n\n| -                                                                   | -                                                       |\n| ------------------------------------------------------------------- | :------------------------------------------------------ |\n| [cast](https://www.mathworks.com/help/matlab/ref/cast.html)         | Convert variables to different data types               |\n| [typecast](https://www.mathworks.com/help/matlab/ref/typecast.html) | Convert data types without changing the underlying data |\n\nQuery type and value\n\n| -                                                                      | -                                                     |\n| ---------------------------------------------------------------------- | :---------------------------------------------------- |\n| [allfinite](https://www.mathworks.com/help/matlab/ref/allfinite.html\") | Determine if all array elements are finite            |\n| [anynan](https://www.mathworks.com/help/matlab/ref/anynan.html\")       | Determine if any array element is NaN                 |\n| [isinteger](https://www.mathworks.com/help/matlab/ref/isinteger.html)  | Determine whether the input is an integer array       |\n| [isfloat](https://www.mathworks.com/help/matlab/ref/isfloat.html)      | Determine whether the input is a floating-point array |\n| [isnumeric](https://www.mathworks.com/help/matlab/ref/isnumeric.html)  | Determine whether the input is a numeric array        |\n| [isreal](https://www.mathworks.com/help/matlab/ref/isreal.html)        | Determine whether the array uses complex storage      |\n| [isfinite](https://www.mathworks.com/help/matlab/ref/isfinite.html)    | Determine which array elements are finite             |\n| [isinf](https://www.mathworks.com/help/matlab/ref/isinf.html)          | Determine which array elements are infinite           |\n| [isnan](https://www.mathworks.com/help/matlab/ref/isnan.html)          | Determine which array elements are NaN                |\n\nValue range\n\n| -                                                                   | -                                                                     |\n| ------------------------------------------------------------------- | :-------------------------------------------------------------------- |\n| [eps](https://www.mathworks.com/help/matlab/ref/eps.html)           | Floating point relative precision                                     |\n| [flintmax](https://www.mathworks.com/help/matlab/ref/flintmax.html) | The largest consecutive integer in floating point format              |\n| [Inf](https://www.mathworks.com/help/matlab/ref/inf.html)           | Create an array with all values `Inf`                                 |\n| [intmax](https://www.mathworks.com/help/matlab/ref/intmax.html)     | The maximum value of a specific integer type                          |\n| [intmin](https://www.mathworks.com/help/matlab/ref/intmin.html)     | The minimum value of a specific integer type                          |\n| [NaN](https://www.mathworks.com/help/matlab/ref/nan.html)           | Create an array where all values are <code class=\"literal\">NaN</code> |\n| [realmax](https://www.mathworks.com/help/matlab/ref/realmax.html)   | The largest positive floating point number                            |\n| [realmin](https://www.mathworks.com/help/matlab/ref/realmin.html)   | Minimum standard floating point number                                |\n\n### Loops and conditional statements\n\n| -                                                                                | -                                                                 |\n| -------------------------------------------------------------------------------- | :---------------------------------------------------------------- |\n| [if, elseif, else](https://www.mathworks.com/help/matlab/ref/if.html)            | Execute statement when condition is true                          |\n| [switch, case, otherwise](https://www.mathworks.com/help/matlab/ref/switch.html) | Execute one of multiple sets of statements                        |\n| [for](https://www.mathworks.com/help/matlab/ref/for.html)                        | A `for` loop used to repeat a specified number of times           |\n| [while](https://www.mathworks.com/help/matlab/ref/while.html)                    | A `while` loop that executes repeatedly while a condition is true |\n| [try, catch](https://www.mathworks.com/help/matlab/ref/try.html)                 | Execute the statement and catch the resulting error               |\n| [break](https://www.mathworks.com/help/matlab/ref/break.html)                    | Terminate execution of a for or while loop                        |\n| [return](https://www.mathworks.com/help/matlab/ref/return.html)                  | Return control to the calling script or function                  |\n| [continue](https://www.mathworks.com/help/matlab/ref/continue.html)              | Passes control to the next iteration of a `for` or `while` loop   |\n| [pause](https://www.mathworks.com/help/matlab/ref/pause.html)                    | Temporarily suspend the execution of `MATLAB`                     |\n| [parfor](https://www.mathworks.com/help/matlab/ref/parfor.html)                  | Parallel for loop                                                 |\n| [end](https://www.mathworks.com/help/matlab/ref/end.html)                        | Terminate a code block or indicate the maximum array index        |\n\n{.style-list}\n\n### Array of strings\n\n| -                                                                 | -                                                      |\n| ----------------------------------------------------------------- | :----------------------------------------------------- |\n| [string](https://www.mathworks.com/help/matlab/ref/string.html)   | string array                                           |\n| [strings](https://www.mathworks.com/help/matlab/ref/strings.html) | Create a string array that does not contain characters |\n| [join](https://www.mathworks.com/help/matlab/ref/join.html)       | Merge strings                                          |\n| [plus](https://www.mathworks.com/help/matlab/ref/plus.html)       | Add numbers, append strings                            |\n\n### Character array\n\n| -                                                                 | -                                            |\n| ----------------------------------------------------------------- | :------------------------------------------- |\n| [char](https://www.mathworks.com/help/matlab/ref/char.html)       | character array                              |\n| [cellstr](https://www.mathworks.com/help/matlab/ref/cellstr.html) | Convert to a cell array of character vectors |\n| [blanks](https://www.mathworks.com/help/matlab/ref/blanks.html)   | Create a blank character array               |\n| [newline](https://www.mathworks.com/help/matlab/ref/newline.html) | Create newline                               |\n\n### Character or string array\n\n| -                                                                 | -                                         |\n| ----------------------------------------------------------------- | :---------------------------------------- |\n| [compose](https://www.mathworks.com/help/matlab/ref/compose.html) | Format data into multiple strings         |\n| [sprintf](https://www.mathworks.com/help/matlab/ref/sprintf.html) | Format data as string or character vector |\n| [strcat](https://www.mathworks.com/help/matlab/ref/strcat.html)   | Concatenate strings horizontally          |\n| [append](https://www.mathworks.com/help/matlab/ref/append.html)   | Merge strings                             |\n\n### Char or string -convert input arguments\n\n| -                                                                                                               | -                                                                                   |\n| --------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------- |\n| [convertCharsToStrings](https://www.mathworks.com/help/matlab/ref/convertcharstostrings.html)                   | convert character array to string array, other arrays remain unchanged              |\n| [convertStringsToChars](https://www.mathworks.com/help/matlab/ref/convertstringstochars.html)                   | Convert string array to character array, other arrays remain unchanged              |\n| [convertContainedStringsToChars](https://www.mathworks.com/help/matlab/ref/convertcontainedstringstochars.html) | Convert an array of strings at any level of a cell array or structure {.style-list} |\n\n### CHAR or STRING -convert between numeric and string\n\n| -                                                                       | -                                   |\n| ----------------------------------------------------------------------- | :---------------------------------- |\n| [double](https://www.mathworks.com/help/matlab/ref/double.html)         | double precision array              |\n| [string](https://www.mathworks.com/help/matlab/ref/string.html)         | string array                        |\n| [str2double](https://www.mathworks.com/help/matlab/ref/str2double.html) | Convert a string to a double value  |\n| [num2str](https://www.mathworks.com/help/matlab/ref/num2str.html)       | Convert numbers to character arrays |\n\n### Character or string -determine type and attributes {.row-span-2}\n\nType of data\n\n| -                                                                               | -                                                                    |\n| ------------------------------------------------------------------------------- | :------------------------------------------------------------------- |\n| [ischar](https://www.mathworks.com/help/matlab/ref/ischar.html)                 | Determine whether the input is a character array                     |\n| [iscellstr](https://www.mathworks.com/help/matlab/ref/iscellstr.html)           | Determines if input is a cell array of character vectors             |\n| [isstring](https://www.mathworks.com/help/matlab/ref/isstring.html)             | Determine whether the input is an array of strings                   |\n| [isStringScalar](https://www.mathworks.com/help/matlab/ref/isstringscalar.html) | Determine whether the input is a string array containing one element |\n\nText attribute\n\n| -                                                                     | -                                                                               |\n| --------------------------------------------------------------------- | :------------------------------------------------------------------------------ |\n| [strlength](https://www.mathworks.com/help/matlab/ref/strlength.html) | string length                                                                   |\n| [isstrprop](https://www.mathworks.com/help/matlab/ref/isstrprop.html) | Determine which characters in the input string belong to the specified category |\n| [isletter](https://www.mathworks.com/help/matlab/ref/isletter.html)   | Determine which characters are letters                                          |\n| [isspace](https://www.mathworks.com/help/matlab/ref/isspace.html)     | Determine which characters are whitespace characters                            |\n\n### character or string -find and replace {.row-span-2}\n\nLook up\n\n| -                                                                       | -                                                        |\n| ----------------------------------------------------------------------- | :------------------------------------------------------- |\n| [contains](https://www.mathworks.com/help/matlab/ref/contains.html)     | Determine if there is a pattern in the string            |\n| [matches](https://www.mathworks.com/help/matlab/ref/matches.html)       | Determine if a pattern matches a string                  |\n| [count](https://www.mathworks.com/help/matlab/ref/count.html)           | Count the number of occurrences of a pattern in a string |\n| [endsWith](https://www.mathworks.com/help/matlab/ref/endswith.html)     | Determine if a string ends with a pattern                |\n| [startsWith](https://www.mathworks.com/help/matlab/ref/startswith.html) | Determine whether a string starts with a pattern         |\n| [strfind](https://www.mathworks.com/help/matlab/ref/strfind.html)       | Find a string in other strings                           |\n| [sscanf](https://www.mathworks.com/help/matlab/ref/sscanf.html)         | Read formatted data from a string                        |\n\nreplace\n\n| -                                                                               | -                                               |\n| ------------------------------------------------------------------------------- | :---------------------------------------------- |\n| [replace](https://www.mathworks.com/help/matlab/ref/replace.html)               | Find and replace one or more substrings         |\n| [replaceBetween](https://www.mathworks.com/help/matlab/ref/replacebetween.html) | Replace the substring between the start and end |\n| [strrep](https://www.mathworks.com/help/matlab/ref/strrep.html)                 | Find and replace substring                      |\n\n### String matching pattern -build pattern\n\n| -                                                                 | -                                       |\n| ----------------------------------------------------------------- | :-------------------------------------- |\n| [pattern](https://www.mathworks.com/help/matlab/ref/pattern.html) | pattern for searching and matching text |\n\n### String match pattern -character match pattern\n\n| -                                                                                           | -                                               |\n| ------------------------------------------------------------------------------------------- | :---------------------------------------------- |\n| [alphanumericsPattern](https://www.mathworks.com/help/matlab/ref/alphanumericspattern.html) | match alphanumeric characters                   |\n| [characterListPattern](https://www.mathworks.com/help/matlab/ref/characterlistpattern.html) | Match characters in the list                    |\n| [digitsPattern](https://www.mathworks.com/help/matlab/ref/digitspattern.html)               | Match digit characters                          |\n| [lettersPattern](https://www.mathworks.com/help/matlab/ref/letterspattern.html)             | match letter pattern                            |\n| [whitespacePattern](https://www.mathworks.com/help/matlab/ref/whitespacepattern.html)       | match whitespace characters                     |\n| [wildcardPattern](https://www.mathworks.com/help/matlab/ref/wildcardpattern.html)           | Match as few characters of any type as possible |\n\n### String matching pattern -pattern search rules\n\n| -                                                                                               | -                                                          |\n| ----------------------------------------------------------------------------------------------- | :--------------------------------------------------------- |\n| [optionalPattern](https://www.mathworks.com/help/matlab/ref/optionalpattern.html)               | Make pattern matching optional                             |\n| [possessivePattern](https://www.mathworks.com/help/matlab/ref/possessivepattern.html)           | Match pattern without backtracking                         |\n| [caseSensitivePattern](https://www.mathworks.com/help/matlab/ref/casesensitivepattern.html)     | Match patterns in a case-sensitive manner                  |\n| [caseInsensitivePattern](https://www.mathworks.com/help/matlab/ref/caseinsensitivepattern.html) | Match patterns in a case-insensitive manner                |\n| [asFewOfPattern](https://www.mathworks.com/help/matlab/ref/asfewofpattern.html)                 | The number of pattern matches should be as few as possible |\n| [asManyOfPattern](https://www.mathworks.com/help/matlab/ref/asmanyofpattern.html)               | Pattern matching as many times as possible                 |\n\n### String matching pattern -Boundary pattern {.row-span-2}\n\n| -                                                                                           | -                                                                         |\n| ------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------ |\n| [alphanumericBoundary](https://www.mathworks.com/help/matlab/ref/alphanumericboundary.html) | Matches the boundary between alphanumeric and non-alphanumeric characters |\n| [digitBoundary](https://www.mathworks.com/help/matlab/ref/digitboundary.html)               | Matches the boundary between digit characters and non-digit characters    |\n| [letterBoundary](https://www.mathworks.com/help/matlab/ref/letterboundary.html)             | Matches the boundary between alphabetic and non-alphabetic characters     |\n| [whitespaceBoundary](https://www.mathworks.com/help/matlab/ref/whitespaceboundary.html)     | Matches the boundary between whitespace and non-whitespace characters     |\n| [lineBoundary](https://www.mathworks.com/help/matlab/ref/lineboundary.html)                 | match the beginning or end of a line                                      |\n| [textBoundary](https://www.mathworks.com/help/matlab/ref/textboundary.html)                 | match the beginning or end of the text                                    |\n| [lookAheadBoundary](https://www.mathworks.com/help/matlab/ref/lookaheadboundary.html)       | match the boundary before the specified pattern                           |\n| [lookBehindBoundary](https://www.mathworks.com/help/matlab/ref/lookbehindboundary.html)     | Boundary after matching the specified pattern                             |\n\n{.style-list}\n\n### String matching pattern -custom pattern display\n\n| -                                                                             | -                                   |\n| ----------------------------------------------------------------------------- | :---------------------------------- |\n| [maskedPattern](https://www.mathworks.com/help/matlab/ref/maskedpattern.html) | pattern with specified display name |\n| [namedPattern](https://www.mathworks.com/help/matlab/ref/namedpattern.html)   | Specify a named pattern             |\n\n### String matching pattern -regular expression\n\n| -                                                                                 | -                                                     |\n| --------------------------------------------------------------------------------- | :---------------------------------------------------- |\n| [regexp](https://www.mathworks.com/help/matlab/ref/regexp.html)                   | match regular expression (case sensitive)             |\n| [regexpi](https://www.mathworks.com/help/matlab/ref/regexpi.html)                 | Match regular expressions (case insensitive)          |\n| [regexprep](https://www.mathworks.com/help/matlab/ref/regexprep.html)             | Replace text using regular expressions                |\n| [regexptranslate](https://www.mathworks.com/help/matlab/ref/regexptranslate.html) | Convert text to regular expressions                   |\n| [regexpPattern](https://www.mathworks.com/help/matlab/ref/regexppattern.html)     | Match the pattern of the specified regular expression |\n\n### String matching pattern -join and split\n\n| -                                                                               | -                                                                     |\n| ------------------------------------------------------------------------------- | :-------------------------------------------------------------------- |\n| [join](https://www.mathworks.com/help/matlab/ref/join.html)                     | Merge strings                                                         |\n| [plus](https://www.mathworks.com/help/matlab/ref/plus.html)                     | Add numbers, append strings                                           |\n| [split](https://www.mathworks.com/help/matlab/ref/split.html)                   | Split string at delimiter                                             |\n| [splitlines](https://www.mathworks.com/help/matlab/ref/splitlines.html)         | Split a string at newlines                                            |\n| [strjoin](https://www.mathworks.com/help/matlab/ref/strjoin.html)               | join the strings in the array                                         |\n| [strsplit](https://www.mathworks.com/help/matlab/ref/strsplit.html)             | Splits a string or character vector at the specified delimiter        |\n| [strtok](https://www.mathworks.com/help/matlab/ref/strtok.html)                 | Selected string part                                                  |\n| [extract](https://www.mathworks.com/help/matlab/ref/extract.html)               | Extract a substring from a string                                     |\n| [extractAfter](https://www.mathworks.com/help/matlab/ref/extractafter.html)     | Extract the substring after the specified position                    |\n| [extractBefore](https://www.mathworks.com/help/matlab/ref/extractbefore.html)   | Extract the substring before the specified position                   |\n| [extractBetween](https://www.mathworks.com/help/matlab/ref/extractbetween.html) | Extract the substring between the starting point and the ending point |\n\n### String editing {.row-span-2}\n\n| -                                                                               | -                                                                     |\n| ------------------------------------------------------------------------------- | :-------------------------------------------------------------------- |\n| [erase](https://www.mathworks.com/help/matlab/ref/erase.html)                   | Delete a substring in a string                                        |\n| [eraseBetween](https://www.mathworks.com/help/matlab/ref/erasebetween.html)     | Delete the substring between the start and end                        |\n| [extract](https://www.mathworks.com/help/matlab/ref/extract.html)               | Extract a substring from a string                                     |\n| [extractAfter](https://www.mathworks.com/help/matlab/ref/extractafter.html)     | Extract the substring after the specified position                    |\n| [extractBefore](https://www.mathworks.com/help/matlab/ref/extractbefore.html)   | Extract the substring before the specified position                   |\n| [extractBetween](https://www.mathworks.com/help/matlab/ref/extractbetween.html) | Extract the substring between the starting point and the ending point |\n| [insertAfter](https://www.mathworks.com/help/matlab/ref/insertafter.html)       | Insert a string after the specified substring                         |\n| [insertBefore](https://www.mathworks.com/help/matlab/ref/insertbefore.html)     | Insert a string before the specified substring                        |\n| [pad](https://www.mathworks.com/help/matlab/ref/pad.html)                       | Add leading or trailing characters to a string                        |\n| [strip](https://www.mathworks.com/help/matlab/ref/strip.html)                   | Remove leading and trailing characters in a string                    |\n| [lower](https://www.mathworks.com/help/matlab/ref/lower.html)                   | convert string to lowercase                                           |\n| [upper](https://www.mathworks.com/help/matlab/ref/upper.html)                   | convert string to uppercase                                           |\n| [reverse](https://www.mathworks.com/help/matlab/ref/reverse.html)               | Reverse the order of characters in a string                           |\n| [deblank](https://www.mathworks.com/help/matlab/ref/deblank.html)               | Remove trailing blanks at the end of a string                         |\n| [strtrim](https://www.mathworks.com/help/matlab/ref/strtrim.html)               | Remove leading and trailing blanks from a string                      |\n| [strjust](https://www.mathworks.com/help/matlab/ref/strjust.html)               | align string                                                          |\n\n### String comparison\n\n| -                                                                   | -                                                                                           |\n| ------------------------------------------------------------------- | :------------------------------------------------------------------------------------------ |\n| [matches](https://www.mathworks.com/help/matlab/ref/matches.html)   | Determine if a pattern matches a string                                                     |\n| [strcmp](https://www.mathworks.com/help/matlab/ref/strcmp.html)     | Compare strings                                                                             |\n| [strcmpi](https://www.mathworks.com/help/matlab/ref/strcmpi.html)   | Compare strings (case insensitive)                                                          |\n| [strncmp](https://www.mathworks.com/help/matlab/ref/strncmp.html)   | compares the first <code class=\"literal\">n</code> characters of a string (case sensitive)   |\n| [strncmpi](https://www.mathworks.com/help/matlab/ref/strncmpi.html) | Compare the first <code class=\"literal\">n</code> characters of a string (case insensitive ) |\n\n### Basic Arithmetic {.row-span-3}\n\n#### Addition\n\n- [+](https://www.mathworks.com/help/matlab/ref/plus.html) Add numbers, append strings\n- [sum](https://www.mathworks.com/help/matlab/ref/sum.html) sum of array elements\n- [cumsum](https://www.mathworks.com/help/matlab/ref/cumsum.html) cumulative sum\n- [movsum](https://www.mathworks.com/help/matlab/ref/movsum.html) moving sum\n\n{.cols-2 .marker-none}\n\n#### Subtraction\n\n- [-](https://www.mathworks.com/help/matlab/ref/minus.html) subtraction\n- [diff](https://www.mathworks.com/help/matlab/ref/diff.html) difference and approximate derivative\n\n{.cols-2 .marker-none}\n\n#### Multiplication\n\n| -                                                                       | -                                   |\n| ----------------------------------------------------------------------- | :---------------------------------- |\n| [.\\*](https://www.mathworks.com/help/matlab/ref/times.html)             | Multiplication                      |\n| [\\*](https://www.mathworks.com/help/matlab/ref/mtimes.html)             | Matrix multiplication               |\n| [prod](https://www.mathworks.com/help/matlab/ref/prod.html)             | product of array elements           |\n| [cumprod](https://www.mathworks.com/help/matlab/ref/cumprod.html)       | cumulative product                  |\n| [pagemtimes](https://www.mathworks.com/help/matlab/ref/pagemtimes.html) | Matrix multiplication by page       |\n| [tensorprod](https://www.mathworks.com/help/matlab/ref/tensorprod.html) | Tensor products between two tensors |\n\n#### Division\n\n| -                                                             | -                                                             |\n| ------------------------------------------------------------- | :------------------------------------------------------------ |\n| [./](https://www.mathworks.com/help/matlab/ref/rdivide.html)  | Array right division                                          |\n| [.\\\\](https://www.mathworks.com/help/matlab/ref/ldivide.html) | Array left division                                           |\n| [/](https://www.mathworks.com/help/matlab/ref/mrdivide.html)  | Solve the system of linear equations xA = B about x           |\n| [\\\\](https://www.mathworks.com/help/matlab/ref/mldivide.html) | Solve the system of linear equations Ax = B with respect to x |\n\n#### Power\n\n- [.^](https://www.mathworks.com/help/matlab/ref/power.html) Element-wise exponentiation\n- [^](https://www.mathworks.com/help/matlab/ref/mpower.html) matrix power\n\n{.cols-2 .marker-none}\n\n#### Transpose\n\n| -                                                                               | -                                   |\n| ------------------------------------------------------------------------------- | :---------------------------------- |\n| [.'](https://www.mathworks.com/help/matlab/ref/transpose.html)                  | Transpose a vector or matrix        |\n| ['](https://www.mathworks.com/help/matlab/ref/ctranspose.html)                  | complex conjugate transpose         |\n| [pagetranspose](https://www.mathworks.com/help/matlab/ref/pagetranspose.html)   | Transpose by page                   |\n| [pagectranspose](https://www.mathworks.com/help/matlab/ref/pagectranspose.html) | Complex conjugate transpose by page |\n\n#### Array notation\n\n- [uminus](https://www.mathworks.com/help/matlab/ref/uminus.html) unary subtraction\n- [uplus](https://www.mathworks.com/help/matlab/ref/uplus.html) unary addition\n\n{.cols-2 .marker-none}\n\n### Modular division and rounding\n\n| -                                                                 | -                                           |\n| ----------------------------------------------------------------- | :------------------------------------------ |\n| [mod](https://www.mathworks.com/help/matlab/ref/mod.html)         | Remainder after division (modulo operation) |\n| [rem](https://www.mathworks.com/help/matlab/ref/rem.html)         | Remainder after division                    |\n| [idivide](https://www.mathworks.com/help/matlab/ref/idivide.html) | Divisibility with rounding options          |\n| [ceil](https://www.mathworks.com/help/matlab/ref/ceil.html)       | round towards positive infinity             |\n| [fix](https://www.mathworks.com/help/matlab/ref/fix.html)         | round towards zero                          |\n| [floor](https://www.mathworks.com/help/matlab/ref/floor.html)     | round towards negative infinity             |\n| [round](https://www.mathworks.com/help/matlab/ref/round.html)     | round to the nearest decimal or integer     |\n\n### Custom Binary Functions\n\n| -                                                               | -                                                                             |\n| --------------------------------------------------------------- | :---------------------------------------------------------------------------- |\n| [bsxfun](https://www.mathworks.com/help/matlab/ref/bsxfun.html) | Apply element-wise operations on two arrays (with implicit expansion enabled) |\n\n### Relational operations\n\nvalue comparison\n\n| -                                                                   | -                                                |\n| ------------------------------------------------------------------- | :----------------------------------------------- |\n| [==](https://www.mathworks.com/help/matlab/ref/eq.html)             | Determine equality                               |\n| [>=](https://www.mathworks.com/help/matlab/ref/ge.html)             | Determine greater than or equal to               |\n| [>](https://www.mathworks.com/help/matlab/ref/gt.html)              | Determine greater than                           |\n| [<=](https://www.mathworks.com/help/matlab/ref/le.html)             | Determine less than or equal to                  |\n| [<](https://www.mathworks.com/help/matlab/ref/lt.html)              | Determine less than                              |\n| [~=](https://www.mathworks.com/help/matlab/ref/ne.html)             | Determine Inequality                             |\n| [isequal](https://www.mathworks.com/help/matlab/ref/isequal.html)   | Determine array equality                         |\n| [isequaln](https://www.mathworks.com/help/matlab/ref/isequaln.html) | Test array equality, treat `NaN` values as equal |\n\n### Logical (Boolean) operations\n\ntrue or false condition\n\n| -                                                                                                     | -                                                           |\n| ----------------------------------------------------------------------------------------------------- | :---------------------------------------------------------- |\n| [Short-circuit &&, \\|\\|](https://www.mathworks.com/help/matlab/ref/logicaloperatorsshortcircuit.html) | Logical operators with short-circuit function               |\n| [&](https://www.mathworks.com/help/matlab/ref/and.html)                                               | Computational logic `AND`                                   |\n| [~](https://www.mathworks.com/help/matlab/ref/not.html)                                               | Computational logic `NOT`                                   |\n| [\\|](https://www.mathworks.com/help/matlab/ref/or.html)                                               | Calculation logic `OR`                                      |\n| [xor](https://www.mathworks.com/help/matlab/ref/xor.html)                                             | Compute logical exclusive `OR`                              |\n| [all](https://www.mathworks.com/help/matlab/ref/all.html)                                             | Determine whether all array elements are non-zero or `true` |\n| [any](https://www.mathworks.com/help/matlab/ref/any.html)                                             | Determine if any array elements are non-zero                |\n| [false](https://www.mathworks.com/help/matlab/ref/false.html)                                         | logical `0` (false)                                         |\n| [find](https://www.mathworks.com/help/matlab/ref/find.html)                                           | Find the index and value of non-zero elements               |\n| [islogical](https://www.mathworks.com/help/matlab/ref/islogical.html)                                 | Determine whether the input is a logical array              |\n| [logical](https://www.mathworks.com/help/matlab/ref/logical.html)                                     | Convert numeric values to logical values                    |\n| [true](https://www.mathworks.com/help/matlab/ref/true.html)                                           | Logical value `1` (true)                                    |\n\n### Set operation\n\nunion, intersection, set relationship\n\n| -                                                                            | -                                                              |\n| ---------------------------------------------------------------------------- | :------------------------------------------------------------- |\n| [intersect](https://www.mathworks.com/help/matlab/ref/double.intersect.html) | Set the intersection of two arrays                             |\n| [ismember](https://www.mathworks.com/help/matlab/ref/double.ismember.html)   | Determine whether an array element is a set array member       |\n| [setdiff](https://www.mathworks.com/help/matlab/ref/double.setdiff.html)     | Set the difference between two arrays                          |\n| [setxor](https://www.mathworks.com/help/matlab/ref/double.setxor.html)       | Set XOR of two arrays                                          |\n| [union](https://www.mathworks.com/help/matlab/ref/double.union.html)         | Set the union of two arrays                                    |\n| [unique](https://www.mathworks.com/help/matlab/ref/double.unique.html)       | Unique value in an array                                       |\n| [ismembertol](https://www.mathworks.com/help/matlab/ref/ismembertol.html)    | set membership within tolerance                                |\n| [uniquetol](https://www.mathworks.com/help/matlab/ref/uniquetol.html)        | unique values within tolerance                                 |\n| [join](https://www.mathworks.com/help/matlab/ref/table.join.html)            | Merge two tables or timetables row by row using a key variable |\n| [innerjoin](https://www.mathworks.com/help/matlab/ref/innerjoin.html)        | Inner join between two tables or timetables                    |\n| [outerjoin](https://www.mathworks.com/help/matlab/ref/outerjoin.html)        | Outer join between two tables or timetables                    |\n\n### Bitwise operations\n\nset, offset, or compare specific bitfields\n\n| -                                                                     | -                                      |\n| --------------------------------------------------------------------- | :------------------------------------- |\n| [bitand](https://www.mathworks.com/help/matlab/ref/bitand.html)       | Bitwise `AND`                          |\n| [bitor](https://www.mathworks.com/help/matlab/ref/bitor.html)         | Bitwise `OR`                           |\n| [bitxor](https://www.mathworks.com/help/matlab/ref/bitxor.html)       | Bitwise `XOR`                          |\n| [bitcmp](https://www.mathworks.com/help/matlab/ref/bitcmp.html)       | Bitwise complement                     |\n| [bitget](https://www.mathworks.com/help/matlab/ref/bitget.html)       | Get the bit at the specified position  |\n| [bitset](https://www.mathworks.com/help/matlab/ref/bitset.html)       | Set the bit at the specified position  |\n| [bitshift](https://www.mathworks.com/help/matlab/ref/bitshift.html)   | Shift bits by specified number of bits |\n| [swapbytes](https://www.mathworks.com/help/matlab/ref/swapbytes.html) | swap byte order                        |\n\n## Data import and export\n\n### text file -read and write table or timetable {.row-span-2}\n\n#### Basic import and export\n\n| -                                                                               | -                                  |\n| ------------------------------------------------------------------------------- | :--------------------------------- |\n| [readtable](https://www.mathworks.com/help/matlab/ref/readtable.html)           | Create a table based on a file     |\n| [writetable](https://www.mathworks.com/help/matlab/ref/writetable.html)         | write table to file                |\n| [readtimetable](https://www.mathworks.com/help/matlab/ref/readtimetable.html)   | Create a timetable based on a file |\n| [writetimetable](https://www.mathworks.com/help/matlab/ref/writetimetable.html) | Write timetable to file            |\n\n#### Define import rules\n\n| -                                                                                                                      | -                                                           |\n| ---------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------- |\n| [detectImportOptions](https://www.mathworks.com/help/matlab/ref/detectimportoptions.html)                              | Generate import options based on file content               |\n| [delimitedTextImportOptions](https://www.mathworks.com/help/matlab/ref/matlab.io.text.delimitedtextimportoptions.html) | Import options object for delimited text                    |\n| [fixedWidthImportOptions](https://www.mathworks.com/help/matlab/ref/matlab.io.text.fixedwidthimportoptions.html)       | Import options object for fixed-width text files            |\n| [xmlImportOptions](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.xmlimportoptions.html)                      | Import options object for XML file                          |\n| [htmlImportOptions](https://www.mathworks.com/help/matlab/ref/matlab.io.html.htmlimportoptions.html)                   | Import options object for HTML files                        |\n| [wordDocumentImportOptions](https://www.mathworks.com/help/matlab/ref/matlab.io.word.worddocumentimportoptions.html)   | `Microsoft Word` file import options object                 |\n| [getvaropts](https://www.mathworks.com/help/matlab/ref/matlab.io.text.delimitedtextimportoptions.getvaropts.html)      | Get variable import options                                 |\n| [setvaropts](https://www.mathworks.com/help/matlab/ref/matlab.io.text.delimitedtextimportoptions.setvaropts.html)      | Set variable import options                                 |\n| [setvartype](https://www.mathworks.com/help/matlab/ref/matlab.io.text.delimitedtextimportoptions.setvartype.html)      | Set variable data type                                      |\n| [preview](https://www.mathworks.com/help/matlab/ref/matlab.io.text.delimitedtextimportoptions.preview.html)            | Preview eight lines of data in the file with import options |\n\n{.style-list}\n\n### Text files -read and write matrices and arrays\n\n| -                                                                         | -                                              |\n| ------------------------------------------------------------------------- | :--------------------------------------------- |\n| [readmatrix](https://www.mathworks.com/help/matlab/ref/readmatrix.html)   | Read a matrix from a file                      |\n| [writematrix](https://www.mathworks.com/help/matlab/ref/writematrix.html) | Write matrix to file                           |\n| [readcell](https://www.mathworks.com/help/matlab/ref/readcell.html)       | Read a cell array from a file                  |\n| [writecell](https://www.mathworks.com/help/matlab/ref/writecell.html)     | Write a cell array to a file                   |\n| [readvars](https://www.mathworks.com/help/matlab/ref/readvars.html)       | Read variables from a file                     |\n| [textscan](https://www.mathworks.com/help/matlab/ref/textscan.html)       | Read formatted data from a text file or string |\n| [type](https://www.mathworks.com/help/matlab/ref/type.html)               | Display file content                           |\n| [fileread](https://www.mathworks.com/help/matlab/ref/fileread.html)       | Read file content in text format               |\n| [readlines](https://www.mathworks.com/help/matlab/ref/readlines.html)     | Read lines of a file as an array of strings    |\n| [writelines](https://www.mathworks.com/help/matlab/ref/writelines.html)   | Write text to file                             |\n\n### Spreadsheet -Read and Write Table or Timetable {.row-span-2}\n\nBasic import and export\n\n| -                                                                               | -                                      |\n| ------------------------------------------------------------------------------- | :------------------------------------- |\n| [readtable](https://www.mathworks.com/help/matlab/ref/readtable.html)           | Create a table from a file             |\n| [writetable](https://www.mathworks.com/help/matlab/ref/writetable.html)         | write table to file                    |\n| [readtimetable](https://www.mathworks.com/help/matlab/ref/readtimetable.html)   | Create a timetable from a file         |\n| [writetimetable](https://www.mathworks.com/help/matlab/ref/writetimetable.html) | Write timetable to file                |\n| [sheetnames](https://www.mathworks.com/help/matlab/ref/sheetnames.html)         | Get sheetnames from a spreadsheet file |\n\n{.style-list}\n\nDefine import rules\n\n| -                                                                                                                         | -                                                        |\n| ------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------- |\n| [detectImportOptions](https://www.mathworks.com/help/matlab/ref/detectimportoptions.html)                                 | Generate import options based on file content            |\n| [spreadsheetImportOptions](https://www.mathworks.com/help/matlab/ref/matlab.io.spreadsheet.spreadsheetimportoptions.html) | Spreadsheet import options object                        |\n| [getvaropts](https://www.mathworks.com/help/matlab/ref/matlab.io.text.delimitedtextimportoptions.getvaropts.html)         | Get variable import options                              |\n| [setvaropts](https://www.mathworks.com/help/matlab/ref/matlab.io.text.delimitedtextimportoptions.setvaropts.html)         | Set variable import options                              |\n| [setvartype](https://www.mathworks.com/help/matlab/ref/matlab.io.text.delimitedtextimportoptions.setvartype.html)         | Set variable data type                                   |\n| [preview](https://www.mathworks.com/help/matlab/ref/matlab.io.text.delimitedtextimportoptions.preview.html)               | Preview eight rows of data in a file with import options |\n\n{.style-list}\n\n### Spreadsheet -Reading and writing matrices and arrays\n\n| -                                                                         | -                             |\n| ------------------------------------------------------------------------- | :---------------------------- |\n| [readmatrix](https://www.mathworks.com/help/matlab/ref/readmatrix.html)   | Read a matrix from a file     |\n| [writematrix](https://www.mathworks.com/help/matlab/ref/writematrix.html) | Write matrix to file          |\n| [readcell](https://www.mathworks.com/help/matlab/ref/readcell.html)       | Read a cell array from a file |\n| [writecell](https://www.mathworks.com/help/matlab/ref/writecell.html)     | Write a cell array to a file  |\n| [readvars](https://www.mathworks.com/help/matlab/ref/readvars.html)       | Read variables from a file    |\n| [importdata](https://www.mathworks.com/help/matlab/ref/importdata.html)   | Load data from a file         |\n\n### images\n\n| -                                                                 | -                                         |\n| ----------------------------------------------------------------- | :---------------------------------------- |\n| [imfinfo](https://www.mathworks.com/help/matlab/ref/imfinfo.html) | Information about graphics files          |\n| [imread](https://www.mathworks.com/help/matlab/ref/imread.html)   | Reads an image from a graphics file       |\n| [imwrite](https://www.mathworks.com/help/matlab/ref/imwrite.html) | Writes an image to a graphics file        |\n| [Tiff](https://www.mathworks.com/help/matlab/ref/tiff.html)       | MATLAB entry for LibTIFF library routines |\n\n### Read or write a NetCDF file {.row-span-2}\n\n| -                                                                             | -                                                              |\n| ----------------------------------------------------------------------------- | :------------------------------------------------------------- |\n| [nccreate](https://www.mathworks.com/help/matlab/ref/nccreate.html)           | Create variables in a NetCDF file                              |\n| [ncdisp](https://www.mathworks.com/help/matlab/ref/ncdisp.html)               | Displays NetCDF data source content in the command line window |\n| [ncinfo](https://www.mathworks.com/help/matlab/ref/ncinfo.html)               | Returns information about a NetCDF data source                 |\n| [ncread](https://www.mathworks.com/help/matlab/ref/ncread.html)               | Read variable data from a NetCDF data source                   |\n| [ncreadatt](https://www.mathworks.com/help/matlab/ref/ncreadatt.html)         | Read attribute values in a NetCDF data source                  |\n| [ncwrite](https://www.mathworks.com/help/matlab/ref/ncwrite.html)             | Write data to a NetCDF file                                    |\n| [ncwriteatt](https://www.mathworks.com/help/matlab/ref/ncwriteatt.html)       | Write attributes to a NetCDF file                              |\n| [ncwriteschema](https://www.mathworks.com/help/matlab/ref/ncwriteschema.html) | Adds a NetCDF schema definition to a NetCDF file               |\n\n### NetCDF library package -library functions\n\n| -                                                                                                 | -                                                            |\n| ------------------------------------------------------------------------------------------------- | :----------------------------------------------------------- |\n| [netcdf.getChunkCache](https://www.mathworks.com/help/matlab/ref/netcdf.getchunkcache.html)       | Retrieves the chunk cache settings for the NetCDF library    |\n| [netcdf.inqLibVers](https://www.mathworks.com/help/matlab/ref/netcdf.inqlibvers.html)             | Returns NetCDF library version information                   |\n| [netcdf.setChunkCache](https://www.mathworks.com/help/matlab/ref/netcdf.setchunkcache.html)       | Sets the default chunk cache settings for the NetCDF library |\n| [netcdf.setDefaultFormat](https://www.mathworks.com/help/matlab/ref/netcdf.setdefaultformat.html) | Change the default netCDF file format                        |\n\n{.style-list}\n\n### NetCDF library package -file operations {.row-span-2}\n\n| -                                                                                         | -                                                  |\n| ----------------------------------------------------------------------------------------- | :------------------------------------------------- |\n| [netcdf.abort](https://www.mathworks.com/help/matlab/ref/netcdf.abort.html)               | restores the most recent netCDF file definition    |\n| [netcdf.close](https://www.mathworks.com/help/matlab/ref/netcdf.close.html)               | Closes a netCDF file                               |\n| [netcdf.create](https://www.mathworks.com/help/matlab/ref/netcdf.create.html)             | Create a new NetCDF dataset                        |\n| [netcdf.endDef](https://www.mathworks.com/help/matlab/ref/netcdf.enddef.html)             | End netCDF file definition mode                    |\n| [netcdf.inq](https://www.mathworks.com/help/matlab/ref/netcdf.inq.html)                   | returns information about a netCDF file            |\n| [netcdf.inqFormat](https://www.mathworks.com/help/matlab/ref/netcdf.inqformat.html)       | Determines the format of a NetCDF file             |\n| [netcdf.inqGrps](https://www.mathworks.com/help/matlab/ref/netcdf.inqgrps.html)           | Retrieves an array of subgroup IDs                 |\n| [netcdf.inqUnlimDims](https://www.mathworks.com/help/matlab/ref/netcdf.inqunlimdims.html) | Retrieves a list of infinite dimensions in a group |\n| [netcdf.open](https://www.mathworks.com/help/matlab/ref/netcdf.open.html)                 | Open NetCDF data source                            |\n| [netcdf.reDef](https://www.mathworks.com/help/matlab/ref/netcdf.redef.html)               | puts an open netCDF file into definition mode      |\n| [netcdf.setFill](https://www.mathworks.com/help/matlab/ref/netcdf.setfill.html)           | Set netCDF fill mode                               |\n| [netcdf.sync](https://www.mathworks.com/help/matlab/ref/netcdf.sync.html)                 | Synchronize netCDF files to disk                   |\n\n### NetCDF Library Package -Dimensions\n\n| -                                                                                   | -                                          |\n| ----------------------------------------------------------------------------------- | :----------------------------------------- |\n| [netcdf.defdim](https://www.mathworks.com/help/matlab/ref/netcdf.defdim.html)       | Create netCDF dimensions                   |\n| [netcdf.inqDim](https://www.mathworks.com/help/matlab/ref/netcdf.inqdim.html)       | Returns netCDF dimension names and lengths |\n| [netcdf.inqDimID](https://www.mathworks.com/help/matlab/ref/netcdf.inqdimid.html)   | Returns the dimension ID                   |\n| [netcdf.renameDim](https://www.mathworks.com/help/matlab/ref/netcdf.renamedim.html) | Change netCDF dimension names              |\n\n### NetCDF library package -group\n\n| -                                                                                             | -                                                    |\n| --------------------------------------------------------------------------------------------- | :--------------------------------------------------- |\n| [netcdf.defGrp](https://www.mathworks.com/help/matlab/ref/netcdf.defgrp.html)                 | Create groups in a NetCDF file                       |\n| [netcdf.inqDimIDs](https://www.mathworks.com/help/matlab/ref/netcdf.inqdimids.html)           | Retrieves a list of dimension identifiers in a group |\n| [netcdf.inqGrpName](https://www.mathworks.com/help/matlab/ref/netcdf.inqgrpname.html)         | Retrieve group name                                  |\n| [netcdf.inqGrpNameFull](https://www.mathworks.com/help/matlab/ref/netcdf.inqgrpnamefull.html) | the full pathname of the group                       |\n| [netcdf.inqGrpParent](https://www.mathworks.com/help/matlab/ref/netcdf.inqgrpparent.html)     | Retrieves the ID of the parent group.                |\n| [netcdf.inqNcid](https://www.mathworks.com/help/matlab/ref/netcdf.inqncid.html)               | Returns the ID of a named group                      |\n| [netcdf.inqVarIDs](https://www.mathworks.com/help/matlab/ref/netcdf.inqvarids.html)           | IDs of all variables in the group                    |\n\n### NetCDF library package -variable {.row-span-3}\n\n| -                                                                                                 | -                                                         |\n| ------------------------------------------------------------------------------------------------- | :-------------------------------------------------------- |\n| [netcdf.defVarFill](https://www.mathworks.com/help/matlab/ref/netcdf.defvarfill.html)             | Defines the fill parameter for a NetCDF variable          |\n| [netcdf.defVar](https://www.mathworks.com/help/matlab/ref/netcdf.defvar.html)                     | Create a NetCDF variable                                  |\n| [netcdf.defVarChunking](https://www.mathworks.com/help/matlab/ref/netcdf.defvarchunking.html)     | Defines chunking behavior for NetCDF variables            |\n| [netcdf.defVarDeflate](https://www.mathworks.com/help/matlab/ref/netcdf.defvardeflate.html)       | Defines compression parameters for NetCDF variables       |\n| [netcdf.defVarFletcher32](https://www.mathworks.com/help/matlab/ref/netcdf.defvarfletcher32.html) | Defines validation parameters for NetCDF variables        |\n| [netcdf.getVar](https://www.mathworks.com/help/matlab/ref/netcdf.getvar.html)                     | Read data in a NetCDF variable                            |\n| [netcdf.inqVar](https://www.mathworks.com/help/matlab/ref/netcdf.inqvar.html)                     | Information about variables                               |\n| [netcdf.inqVarChunking](https://www.mathworks.com/help/matlab/ref/netcdf.inqvarchunking.html)     | Determines chunking settings for NetCDF variables         |\n| [netcdf.inqVarDeflate](https://www.mathworks.com/help/matlab/ref/netcdf.inqvardeflate.html)       | Determines compression settings for NetCDF variables      |\n| [netcdf.inqVarFill](https://www.mathworks.com/help/matlab/ref/netcdf.inqvarfill.html)             | Determines the fill parameter value for a NetCDF variable |\n| [netcdf.inqVarFletcher32](https://www.mathworks.com/help/matlab/ref/netcdf.inqvarfletcher32.html) | About Fletcher32 checksum settings for NetCDF variables   |\n| [netcdf.inqVarID](https://www.mathworks.com/help/matlab/ref/netcdf.inqvarid.html)                 | Returns the ID associated with the variable name          |\n| [netcdf.putVar](https://www.mathworks.com/help/matlab/ref/netcdf.putvar.html)                     | Writes data to a netCDF variable                          |\n| [netcdf.renameVar](https://www.mathworks.com/help/matlab/ref/netcdf.renamevar.html)               | Change netCDF variable name                               |\n\n{.style-list}\n\n### NetCDF library package -properties\n\n| -                                                                                     | -                                           |\n| ------------------------------------------------------------------------------------- | :------------------------------------------ |\n| [netcdf.copyAtt](https://www.mathworks.com/help/matlab/ref/netcdf.copyatt.html)       | Copy an attribute to a new location         |\n| [netcdf.delAtt](https://www.mathworks.com/help/matlab/ref/netcdf.delatt.html)         | Remove netCDF attribute                     |\n| [netcdf.getAtt](https://www.mathworks.com/help/matlab/ref/netcdf.getatt.html)         | Returns the NetCDF attribute                |\n| [netcdf.inqAtt](https://www.mathworks.com/help/matlab/ref/netcdf.inqatt.html)         | Returns information about netCDF attributes |\n| [netcdf.inqAttID](https://www.mathworks.com/help/matlab/ref/netcdf.inqattid.html)     | Returns the ID of a netCDF attribute        |\n| [netcdf.inqAttName](https://www.mathworks.com/help/matlab/ref/netcdf.inqattname.html) | Returns the netCDF attribute name           |\n| [netcdf.putAtt](https://www.mathworks.com/help/matlab/ref/netcdf.putatt.html)         | Write netCDF attributes                     |\n| [netcdf.renameAtt](https://www.mathworks.com/help/matlab/ref/netcdf.renameatt.html)   | Change Attribute Name                       |\n\n### NetCDF library package -user-defined types\n\n| :-                                                                                      | :-                                                       |\n| :-------------------------------------------------------------------------------------- | :------------------------------------------------------- |\n| [netcdf.defVlen](https://www.mathworks.com/help/matlab/ref/netcdf.defvlen.html)         | Define user-defined variable length array type (NC_VLEN) |\n| [netcdf.inqUserType](https://www.mathworks.com/help/matlab/ref/netcdf.inqusertype.html) | Return information about user-defined type               |\n| [netcdf.inqVlen](https://www.mathworks.com/help/matlab/ref/netcdf.inqvlen.html)         | Return information about user-defined `NC_VLEN` type     |\n\n{.style-list}\n\n### NetCDF library package -Utilities\n\n| -                                                                                                 | -                                                       |\n| ------------------------------------------------------------------------------------------------- | :------------------------------------------------------ |\n| [netcdf.getConstant](https://www.mathworks.com/help/matlab/ref/netcdf.getconstant.html)           | returns the value of the named constant                 |\n| [netcdf.getConstantNames](https://www.mathworks.com/help/matlab/ref/netcdf.getconstantnames.html) | returns a list of constants known to the netCDF library |\n\n{.style-list}\n\n### Read or write HDF5 files\n\n| -                                                                       | -                                 |\n| ----------------------------------------------------------------------- | :-------------------------------- |\n| [h5create](https://www.mathworks.com/help/matlab/ref/h5create.html)     | Create HDF5 dataset               |\n| [h5disp](https://www.mathworks.com/help/matlab/ref/h5disp.html)         | Display the content of HDF5 files |\n| [h5info](https://www.mathworks.com/help/matlab/ref/h5info.html)         | Information about HDF5 files      |\n| [h5read](https://www.mathworks.com/help/matlab/ref/h5read.html)         | Read data from HDF5 dataset       |\n| [h5readatt](https://www.mathworks.com/help/matlab/ref/h5readatt.html)   | Read attributes from HDF5 files   |\n| [h5write](https://www.mathworks.com/help/matlab/ref/h5write.html)       | Write HDF5 dataset                |\n| [h5writeatt](https://www.mathworks.com/help/matlab/ref/h5writeatt.html) | Write HDF5 attributes             |\n\n### HDF5 library package {.row-span-4}\n\n| -                                                                                           | -                                                                |\n| ------------------------------------------------------------------------------------------- | :--------------------------------------------------------------- |\n| [Library (H5)](https://www.mathworks.com/help/matlab/ref/libraryh5.html)                    | General-purpose functions for use with entire HDF5 library       |\n| [Attribute (H5A)](https://www.mathworks.com/help/matlab/ref/attributeh5a.html)              | Metadata associated with datasets or groups                      |\n| [Dataset (H5D)](https://www.mathworks.com/help/matlab/ref/dataseth5d.html)                  | Multidimensional arrays of data elements and supporting metadata |\n| [Dimension Scale (H5DS)](https://www.mathworks.com/help/matlab/ref/dimensionscaleh5ds.html) | Dimension scale associated with dataset dimensions               |\n| [Error (H5E)](https://www.mathworks.com/help/matlab/ref/errorh5e.html)                      | Error handling                                                   |\n| [File (H5F)](https://www.mathworks.com/help/matlab/ref/fileh5f.html)                        | HDF5 file access                                                 |\n| [Group (H5G)](https://www.mathworks.com/help/matlab/ref/grouph5g.html)                      | Organization of objects in file                                  |\n| [Identifier (H5I)](https://www.mathworks.com/help/matlab/ref/identifierh5i.html)            | HDF5 object identifiers                                          |\n| [Link (H5L)](https://www.mathworks.com/help/matlab/ref/linkh5l.html)                        | Links in HDF5 file                                               |\n| [MATLAB (H5ML)](https://www.mathworks.com/help/matlab/ref/matlabh5ml.html)                  | `MATLAB` utility functions not part of the HDF5 C library        |\n| [Object (H5O)](https://www.mathworks.com/help/matlab/ref/objecth5o.html)                    | Objects in file                                                  |\n| [Property (H5P)](https://www.mathworks.com/help/matlab/ref/propertyh5p.html)                | Object property lists                                            |\n| [Reference (H5R)](https://www.mathworks.com/help/matlab/ref/referenceh5r.html)              | HDF5 references                                                  |\n| [Dataspace (H5S)](https://www.mathworks.com/help/matlab/ref/dataspaceh5s.html)              | Dimensionality of dataset                                        |\n| [Datatype (H5T)](https://www.mathworks.com/help/matlab/ref/datatypeh5t.html)                | Datatype of elements in a dataset                                |\n\n{.style-list}\n\n### HDF4 Files -Advanced Functions\n\n| -                                                                 | -                                       |\n| ----------------------------------------------------------------- | :-------------------------------------- |\n| [hdfinfo](https://www.mathworks.com/help/matlab/ref/hdfinfo.html) | Information about HDF4 or HDF-EOS files |\n| [hdfread](https://www.mathworks.com/help/matlab/ref/hdfread.html) | Read data from HDF4 or HDF-EOS files    |\n| [imread](https://www.mathworks.com/help/matlab/ref/imread.html)   | Read an image from a graphics file      |\n| [imwrite](https://www.mathworks.com/help/matlab/ref/imwrite.html) | Write image to graphics file            |\n\n### Low-level functions -package {.row-span-3}\n\n| -                                                                                         | -                                                                            |\n| ----------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------- |\n| [matlab.io.hdf4.sd](https://www.mathworks.com/help/matlab/ref/matlab.io.hdf4.sd.html)     | Interact directly with the HDF4 multi-file scientific dataset (SD) interface |\n| [matlab.io.hdfeos.gd](https://www.mathworks.com/help/matlab/ref/matlab.io.hdfeos.gd.html) | Low-level access to HDF-EOS grid data                                        |\n| [matlab.io.hdfeos.sw](https://www.mathworks.com/help/matlab/ref/matlab.io.hdfeos.sw.html) | Low-level access to HDF-EOS segmented files                                  |\n\n#### Low Level Functions -Functions\n\n| -                                                                 | -                                                     |\n| ----------------------------------------------------------------- | :---------------------------------------------------- |\n| [hdfan](https://www.mathworks.com/help/matlab/ref/hdfan.html)     | The entry of HDF multi-file annotation (AN) interface |\n| [hdfhx](https://www.mathworks.com/help/matlab/ref/hdfhx.html)     | The entry of HDF external data (HX) interface         |\n| [hdfh](https://www.mathworks.com/help/matlab/ref/hdfh.html)       | The entry of HDF H interface                          |\n| [hdfhd](https://www.mathworks.com/help/matlab/ref/hdfhd.html)     | The entry of HDF HD interface                         |\n| [hdfhe](https://www.mathworks.com/help/matlab/ref/hdfhe.html)     | The entry of HDF HE interface                         |\n| [hdfml](https://www.mathworks.com/help/matlab/ref/hdfml.html)     | Utilities for use with `MATLAB` HDF entry functions   |\n| [hdfpt](https://www.mathworks.com/help/matlab/ref/hdfpt.html)     | Interface of HDF-EOS point object                     |\n| [hdfv](https://www.mathworks.com/help/matlab/ref/hdfv.html)       | The entry of HDF Vgroup (V) interface                 |\n| [hdfvf](https://www.mathworks.com/help/matlab/ref/hdfvf.html)     | The entry of VF function in HDF Vdata interface       |\n| [hdfvh](https://www.mathworks.com/help/matlab/ref/hdfvh.html)     | The entry of VH function in HDF Vdata interface       |\n| [hdfvs](https://www.mathworks.com/help/matlab/ref/hdfvs.html)     | The entry of VS function in HDF Vdata interface       |\n| [hdfdf24](https://www.mathworks.com/help/matlab/ref/hdfdf24.html) | HDF 24-bit raster image (DF24) interface entry        |\n| [hdfdfr8](https://www.mathworks.com/help/matlab/ref/hdfdfr8.html) | HDF 8-bit raster image (DFR8) interface entry         |\n\n### FITS file -function\n\n| -                                                                     | -                            |\n| --------------------------------------------------------------------- | :--------------------------- |\n| [fitsdisp](https://www.mathworks.com/help/matlab/ref/fitsdisp.html)   | Display FITS metadata        |\n| [fitsinfo](https://www.mathworks.com/help/matlab/ref/fitsinfo.html)   | Information about FITS files |\n| [fitsread](https://www.mathworks.com/help/matlab/ref/fitsread.html)   | Read data in FITS files      |\n| [fitswrite](https://www.mathworks.com/help/matlab/ref/fitswrite.html) | Write image to FITS file     |\n\n### FITS files -file access\n\n| -                                                                                          | -                         |\n| ------------------------------------------------------------------------------------------ | :------------------------ |\n| [createFile](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.createfile.html)     | Create FITS file          |\n| [openFile](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.openfile.html)         | Open FITS file            |\n| [openDiskFile](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.opendiskfile.html) | Open FITS file            |\n| [closeFile](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.closefile.html)       | Close FITS file           |\n| [deleteFile](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.deletefile.html)     | Delete FITS file          |\n| [fileName](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.filename.html)         | The name of the FITS file |\n| [fileMode](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.filemode.html)         | I/O mode for FITS files   |\n\n### FITS files -image processing\n\n| -                                                                                      | -                                           |\n| -------------------------------------------------------------------------------------- | :------------------------------------------ |\n| [createImg](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.createimg.html)   | Create FITS image                           |\n| [getImgSize](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.getimgsize.html) | image size                                  |\n| [getImgType](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.getimgtype.html) | The data type of the image                  |\n| [insertImg](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.insertimg.html)   | Insert a FITS image after the current image |\n| [readImg](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.readimg.html)       | read image data                             |\n| [setBscale](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.setbscale.html)   | Reset image scaling                         |\n| [writeImg](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.writeimg.html)     | write FITS image                            |\n\n### FITS file -keyword {.row-span-2}\n\n| -                                                                                                | -                                               |\n| ------------------------------------------------------------------------------------------------ | :---------------------------------------------- |\n| [readCard](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.readcard.html)               | Header record of keywords                       |\n| [readKey](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.readkey.html)                 | Keyword                                         |\n| [readKeyCmplx](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.readkeycmplx.html)       | A keyword in the form of a complex scalar value |\n| [readKeyDbl](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.readkeydbl.html)           | Keyword in the form of double precision value   |\n| [readKeyLongLong](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.readkeylonglong.html) | Keyword in the form of `int64`                  |\n| [readKeyLongStr](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.readkeylongstr.html)   | long string value                               |\n| [readKeyUnit](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.readkeyunit.html)         | The physical unit string in the key             |\n| [readRecord](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.readrecord.html)           | Header record specified by number               |\n| [writeComment](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.writecomment.html)       | Write or append COMMENT keyword to CHU          |\n| [writeDate](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.writedate.html)             | Write DATE keyword to CHU                       |\n| [writeKey](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.writekey.html)               | Update or add new keywords to the current HDU   |\n| [writeKeyUnit](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.writekeyunit.html)       | write physical unit string                      |\n| [writeHistory](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.writehistory.html)       | Write or append HISTORY keyword to CHU          |\n| [deleteKey](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.deletekey.html)             | Delete key by name                              |\n| [deleteRecord](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.deleterecord.html)       | Delete keywords by record number                |\n| [getHdrSpace](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.gethdrspace.html)         | The number of keywords in the header            |\n\n### FITS files -Header Data Unit (HDU) access\n\n| -                                                                                            | -                                                                  |\n| -------------------------------------------------------------------------------------------- | :----------------------------------------------------------------- |\n| [copyHDU](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.copyhdu.html)             | Copy current HDU from one file to another                          |\n| [getHDUnum](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.gethdunum.html)         | The number of the current HDU in the FITS file                     |\n| [getHDUtype](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.gethdutype.html)       | current HDU type                                                   |\n| [getNumHDUs](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.getnumhdus.html)       | Total number of HDUs in FITS file                                  |\n| [movAbsHDU](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.movabshdu.html)         | Move to Absolute HDU Numbering                                     |\n| [movNamHDU](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.movnamhdu.html)         | Move to the first HDU containing a specific type and keyword value |\n| [movRelHDU](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.movrelhdu.html)         | Move relative amount of HDU from current HDU                       |\n| [writeChecksum](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.writechecksum.html) | Calculate and write the checksum of the current HDU                |\n| [deleteHDU](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.deletehdu.html)         | Delete the current HDU in the FITS file                            |\n\n### FITS files -image compression\n\n| -                                                                                                      | -                                                     |\n| ------------------------------------------------------------------------------------------------------ | :---------------------------------------------------- |\n| [imgCompress](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.imgcompress.html)               | Compress HDU from one file to another                 |\n| [isCompressedImg](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.iscompressedimg.html)       | Determine whether the current image is compressed     |\n| [setCompressionType](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.setcompressiontype.html) | Set image compression type                            |\n| [setHCompScale](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.sethcompscale.html)           | Set the scaling parameters of the HCOMPRESS algorithm |\n| [setHCompSmooth](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.sethcompsmooth.html)         | Sets smoothing for images compressed with HCOMPRESS   |\n| [setTileDim](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.settiledim.html)                 | Set tile dimensions                                   |\n\n### FITS file -ASCII table and binary table {.row-span-3}\n\n| -                                                                                          | -                                                         |\n| ------------------------------------------------------------------------------------------ | :-------------------------------------------------------- |\n| [createTbl](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.createtbl.html)       | Create a new ASCII or binary table extension              |\n| [insertCol](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.insertcol.html)       | Insert a column into a table                              |\n| [insertRows](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.insertrows.html)     | Insert rows into the table                                |\n| [insertATbl](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.insertatbl.html)     | Insert an ASCII table after the current HDU               |\n| [insertBTbl](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.insertbtbl.html)     | Insert a binary table behind the current HDU              |\n| [deleteCol](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.deletecol.html)       | Delete a column from a table                              |\n| [deleteRows](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.deleterows.html)     | Delete rows from the table                                |\n| [getAColParms](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.getacolparms.html) | ASCII table information                                   |\n| [getBColParms](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.getbcolparms.html) | binary table information                                  |\n| [getColName](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.getcolname.html)     | table column name                                         |\n| [getColType](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.getcoltype.html)     | Data type, repeat value, width of scaled column           |\n| [getEqColType](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.geteqcoltype.html) | column data type, repeated value, width                   |\n| [getNumCols](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.getnumcols.html)     | The number of columns in the table                        |\n| [getNumRows](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.getnumrows.html)     | the number of rows in the table                           |\n| [readATblHdr](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.readatblhdr.html)   | Read the header information from the current ASCII table  |\n| [readBTblHdr](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.readbtblhdr.html)   | Read the header information from the current binary table |\n| [readCol](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.readcol.html)           | Reads rows of ASCII or binary table columns               |\n| [setTscale](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.settscale.html)       | reset image scaling                                       |\n| [writeCol](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.writecol.html)         | Write elements to an ASCII or binary table column         |\n\n### FITS files -Utilities\n\n| -                                                                                                  | -                                          |\n| -------------------------------------------------------------------------------------------------- | :----------------------------------------- |\n| [getConstantValue](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.getconstantvalue.html) | specify the constant value                 |\n| [getVersion](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.getversion.html)             | The revision number of the CFITSIO library |\n| [getOpenFiles](https://www.mathworks.com/help/matlab/ref/matlab.io.fits.getopenfiles.html)         | list of opened FITS files                  |\n\n### Stripe interleaved file\n\n| -                                                                               | -                                                  |\n| ------------------------------------------------------------------------------- | :------------------------------------------------- |\n| [multibandread](https://www.mathworks.com/help/matlab/ref/multibandread.html)   | Read a striped interleaved file from a binary file |\n| [multibandwrite](https://www.mathworks.com/help/matlab/ref/multibandwrite.html) | Write strip interleaved data to a file             |\n\n### Common Data Format (CDF)\n\n| -                                                                     | -                                                                      |\n| --------------------------------------------------------------------- | :--------------------------------------------------------------------- |\n| [cdfinfo](https://www.mathworks.com/help/matlab/ref/cdfinfo.html)     | Information on Common Data Format (CDF) files                          |\n| [cdfread](https://www.mathworks.com/help/matlab/ref/cdfread.html)     | Read data in Common Data Format (CDF) files                            |\n| [cdfepoch](https://www.mathworks.com/help/matlab/ref/cdfepoch.html)   | Converts a date literal or date sequence value to a date in CDF format |\n| [todatenum](https://www.mathworks.com/help/matlab/ref/todatenum.html) | Convert CDF epoch objects to `MATLAB` date serial values               |\n\n#### Bag\n\n| -                                                               | -                                   |\n| --------------------------------------------------------------- | :---------------------------------- |\n| [cdflib](https://www.mathworks.com/help/matlab/ref/cdflib.html) | Direct interaction with CDF library |\n\n### Read video data\n\n| -                                                                                           | -                                                              |\n| ------------------------------------------------------------------------------------------- | :------------------------------------------------------------- |\n| [VideoReader](https://www.mathworks.com/help/matlab/ref/videoreader.html)                   | Create an object to read a video file                          |\n| [read](https://www.mathworks.com/help/matlab/ref/videoreader.read.html)                     | Read one or more video frames                                  |\n| [readFrame](https://www.mathworks.com/help/matlab/ref/videoreader.readframe.html)           | Read the next video frame                                      |\n| [hasFrame](https://www.mathworks.com/help/matlab/ref/videoreader.hasframe.html)             | Determine whether there are video frames available for reading |\n| [getFileFormats](https://www.mathworks.com/help/matlab/ref/videoreader.getfileformats.html) | File formats supported by `VideoReader`                        |\n| [mmfileinfo](https://www.mathworks.com/help/matlab/ref/mmfileinfo.html)                     | Information about multimedia files                             |\n\n### Write video data\n\n| -                                                                                     | -                                                             |\n| ------------------------------------------------------------------------------------- | :------------------------------------------------------------ |\n| [VideoWriter](https://www.mathworks.com/help/matlab/ref/videowriter.html)             | Create an object to write a video file                        |\n| [open](https://www.mathworks.com/help/matlab/ref/videowriter.open.html)               | Open a file to write video data                               |\n| [writeVideo](https://www.mathworks.com/help/matlab/ref/videowriter.writevideo.html)   | Write video data to a file                                    |\n| [close](https://www.mathworks.com/help/matlab/ref/videowriter.close.html)             | close the file after writing video data                       |\n| [getProfiles](https://www.mathworks.com/help/matlab/ref/videowriter.getprofiles.html) | Description files and file formats supported by `VideoWriter` |\n\n### Read or write audio\n\n| -                                                                       | -                                            |\n| ----------------------------------------------------------------------- | :------------------------------------------- |\n| [audioread](https://www.mathworks.com/help/matlab/ref/audioread.html)   | Read audio files                             |\n| [audiowrite](https://www.mathworks.com/help/matlab/ref/audiowrite.html) | Write audio files                            |\n| [lin2mu](https://www.mathworks.com/help/matlab/ref/lin2mu.html)         | Convert linear audio signal to mu-law        |\n| [mu2lin](https://www.mathworks.com/help/matlab/ref/mu2lin.html)         | Convert mu-law audio signal to linear format |\n| [audioinfo](https://www.mathworks.com/help/matlab/ref/audioinfo.html)   | Information about audio files                |\n\n### Play audio\n\n| -                                                                                       | -                                                                           |\n| --------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------- |\n| [audioplayer](https://www.mathworks.com/help/matlab/ref/audioplayer.html)               | Object for playing audio                                                    |\n| [isplaying](https://www.mathworks.com/help/matlab/ref/audioplayer.isplaying.html)       | Determine whether playback is in progress                                   |\n| [pause](https://www.mathworks.com/help/matlab/ref/audioplayer.pause.html)               | Pause playback or recording                                                 |\n| [play](https://www.mathworks.com/help/matlab/ref/audioplayer.play.html)                 | Play audio from `audioplayer` object                                        |\n| [playblocking](https://www.mathworks.com/help/matlab/ref/audioplayer.playblocking.html) | Play audio in `audioplayer` object, keep control until playback is complete |\n| [resume](https://www.mathworks.com/help/matlab/ref/audioplayer.resume.html)             | Resume playback or recording from the paused state                          |\n| [stop](https://www.mathworks.com/help/matlab/ref/audioplayer.stop.html)                 | Stop playing or recording                                                   |\n\n### Record audio\n\n| -                                                                                             | -                                                                                     |\n| --------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------ |\n| [audiorecorder](https://www.mathworks.com/help/matlab/ref/audiorecorder.html)                 | object for recording audio                                                            |\n| [getaudiodata](https://www.mathworks.com/help/matlab/ref/audiorecorder.getaudiodata.html)     | Store the recorded audio signal in a numeric array                                    |\n| [getplayer](https://www.mathworks.com/help/matlab/ref/audiorecorder.getplayer.html)           | Create an associated `audioplayer` object                                             |\n| [isrecording](https://www.mathworks.com/help/matlab/ref/audiorecorder.isrecording.html)       | Determine if recording is in progress                                                 |\n| [record](https://www.mathworks.com/help/matlab/ref/audiorecorder.record.html)                 | Record audio into `audiorecorder` object                                              |\n| [recordblocking](https://www.mathworks.com/help/matlab/ref/audiorecorder.recordblocking.html) | Record audio into an `audiorecorder` object, keep control until recording is complete |\n\n### Play sound\n\n| -                                                                             | -                                           |\n| ----------------------------------------------------------------------------- | :------------------------------------------ |\n| [audiodevinfo](https://www.mathworks.com/help/matlab/ref/audiodevinfo.html)   | Information about audio devices             |\n| [audiodevreset](https://www.mathworks.com/help/matlab/ref/audiodevreset.html) | Refresh the list of available audio devices |\n| [sound](https://www.mathworks.com/help/matlab/ref/sound.html)                 | Convert signal data matrix to sound         |\n| [soundsc](https://www.mathworks.com/help/matlab/ref/soundsc.html)             | Scale data and play it as sound             |\n| [beep](https://www.mathworks.com/help/matlab/ref/beep.html)                   | generate operating system beep              |\n\n### Reading and writing XML documents\n\n| -                                                                                                                                         | -                                                           |\n| ----------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------- |\n| [matlab.io.xml.dom.DOMWriter](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.domwriter-class.html)                           | Write serialized XML documents Injector                     |\n| [matlab.io.xml.dom.EntityResolver](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.entityresolver-class.html)                 | Abstract base class of entity resolver                      |\n| [matlab.io.xml.dom.FileWriter](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.filewriter-class.html)                         | Writer for creating text files                              |\n| [matlab.io.xml.dom.Locator](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.locator-class.html)                               | The location of the element in the XML file                 |\n| [matlab.io.xml.dom.Parser](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.parser-class.html)                                 | XML markup parser                                           |\n| [matlab.io.xml.dom.ParserConfiguration](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.parserconfiguration-class.html)       | XML parser options                                          |\n| [matlab.io.xml.dom.ParseError](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.parseerror-class.html)                         | Specified XML tag parsing error                             |\n| [matlab.io.xml.dom.ParseErrorHandler](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.parseerrorhandler-class.html)           | Abstract base class for parse error handlers                |\n| [matlab.io.xml.dom.ParseErrorLocator](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.parseerrorlocator-class.html)           | Specifies location of parse error                           |\n| [matlab.io.xml.dom.ParseErrorSeverity](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.parseerrorseverity-class.html)         | Indicates the severity of XML tag parsing errors enum class |\n| [matlab.io.xml.dom.ResourceIdentifier](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.resourceidentifier-class.html)         | XML resource identifier                                     |\n| [matlab.io.xml.dom.ResourceIdentifierType](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.resourceidentifiertype-class.html) | XML resource identifier type                                |\n| [matlab.io.xml.dom.WriterConfiguration](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.writerconfiguration-class.html)       | XML DOM Writer Options                                      |\n\n{.style-list-arrow}\n\n### W3C DOM\n\n| -                                                                                                                                       | -                                    |\n| --------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------- |\n| [matlab.io.xml.dom.Attr](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.attr-class.html)                                   | Attributes of XML elements           |\n| [matlab.io.xml.dom.CDATASection](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.cdatasection-class.html)                   | CDATA section                        |\n| [matlab.io.xml.dom.Comment](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.comment-class.html)                             | Comments in XML documents            |\n| [matlab.io.xml.dom.Document](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.document-class.html)                           | XML document                         |\n| [matlab.io.xml.dom.DocumentFragment](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.documentfragment-class.html)           | document node group                  |\n| [matlab.io.xml.dom.DocumentType](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.documenttype-class.html)                   | document type                        |\n| [matlab.io.xml.dom.Element](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.element-class.html)                             | element of XML document              |\n| [matlab.io.xml.dom.Entity](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.entity-class.html)                               | Entity defined by document type      |\n| [matlab.io.xml.dom.NamedNodeMap](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.namednodemap-class.html)                   | A set of document nodes with names   |\n| [matlab.io.xml.dom.NodeList](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.nodelist-class.html)                           | document node list                   |\n| [matlab.io.xml.dom.Notation](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.notation-class.html)                           | Notation in document type definition |\n| [matlab.io.xml.dom.ProcessingInstruction](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.processinginstruction-class.html) | XML processing instruction           |\n| [matlab.io.xml.dom.Text](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.text-class.html)                                   | Text in an XML document              |\n| [matlab.io.xml.dom.TypeInfo](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.dom.typeinfo-class.html)                           | schema type information              |\n\n{.style-list-arrow}\n\n### XML Transformation\n\n| -                                                                                                                                                         | -                                             |\n| --------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------- |\n| [matlab.io.xml.transform.CompiledStylesheet](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.transform.compiledstylesheet-class.html)             | Compiled stylesheet                           |\n| [matlab.io.xml.transform.ResultDocument](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.transform.resultdocument-class.html)                     | Store the transformation result as a document |\n| [matlab.io.xml.transform.ResultString](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.transform.resultstring-class.html)                         | Store the transformation result as a string   |\n| [matlab.io.xml.transform.ResultFile](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.transform.resultfile-class.html)                             | Store the transformation result as a file     |\n| [matlab.io.xml.transform.SourceDocument](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.transform.sourcedocument-class.html)                     | XML source document for transformation        |\n| [matlab.io.xml.transform.SourceFile](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.transform.sourcefile-class.html)                             | XML source file for transformation            |\n| [matlab.io.xml.transform.SourceString](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.transform.sourcestring-class.html)                         | XML source string for transformation string   |\n| [matlab.io.xml.transform.StylesheetSourceDocument](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.transform.stylesheetsourcedocument-class.html) | Stylesheet source for transformation document |\n| [matlab.io.xml.transform.StylesheetSourceFile](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.transform.stylesheetsourcefile-class.html)         | Stylesheet source for transformation document |\n| [matlab.io.xml.transform.StylesheetSourceString](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.transform.stylesheetsourcestring-class.html)     | XSL source string for transformation string   |\n| [matlab.io.xml.transform.Tracer](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.transform.tracer-class.html)                                     | Trace execution of stylesheet                 |\n\n{.style-list-arrow}\n\n### XPath query\n\n| -                                                                                                                                     | -                                                     |\n| ------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------- |\n| [matlab.io.xml.xpath.CompiledExpression](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.xpath.compiledexpression-class.html) | Compiled XPath expression                             |\n| [matlab.io.xml.xpath.EvalResultType](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.xpath.evalresulttype-class.html)         | The result type of XPath expression calculation       |\n| [matlab.io.xml.xpath.Evaluator](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.xpath.evaluator-class.html)                   | XPath expression evaluator                            |\n| [matlab.io.xml.xpath.PrefixResolver](https://www.mathworks.com/help/matlab/ref/matlab.io.xml.xpath.prefixresolver-class.html)         | For namespace prefix resolver Abstract base class for |\n\n{.style-list-arrow}\n\n### JSON format\n\n| -                                                                       | -                                                        |\n| ----------------------------------------------------------------------- | :------------------------------------------------------- |\n| [jsondecode](https://www.mathworks.com/help/matlab/ref/jsondecode.html) | Decode text in JSON format                               |\n| [jsonencode](https://www.mathworks.com/help/matlab/ref/jsonencode.html) | Create JSON-formatted text from structured `MATLAB` data |\n\n### Workspace variables and MAT-file {.row-span-2}\n\n| -                                                                                           | -                                                                                 |\n| ------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------- |\n| [load](https://www.mathworks.com/help/matlab/ref/load.html)                                 | Load file variables into the workspace                                            |\n| [save](https://www.mathworks.com/help/matlab/ref/save.html)                                 | Save workspace variables to a file                                                |\n| [matfile](https://www.mathworks.com/help/matlab/ref/matlab.io.matfile.html)                 | Access and change variables in a MAT-file without loading the file into memory    |\n| [disp](https://www.mathworks.com/help/matlab/ref/disp.html)                                 | Display the value of the variable                                                 |\n| [formattedDisplayText](https://www.mathworks.com/help/matlab/ref/formatteddisplaytext.html) | Capture display output as a string                                                |\n| [who](https://www.mathworks.com/help/matlab/ref/who.html)                                   | List variables in the workspace                                                   |\n| [whos](https://www.mathworks.com/help/matlab/ref/whos.html)                                 | List variables in the workspace with their size and type                          |\n| [clear](https://www.mathworks.com/help/matlab/ref/clear.html)                               | Delete items from the workspace and release system memory                         |\n| [clearvars](https://www.mathworks.com/help/matlab/ref/clearvars.html)                       | Clear variables in memory                                                         |\n| [openvar](https://www.mathworks.com/help/matlab/ref/openvar.html)                           | Open a workspace variable in the variable editor or other graphical editing tools |\n| [Workspace Browser](https://www.mathworks.com/help/matlab/ref/workspace.html)               | Open the Workspace Browser to manage the workspace                                |\n\n### Low-level file I/O {.row-span-2}\n\n| -                                                                   | -                                                                    |\n| ------------------------------------------------------------------- | :------------------------------------------------------------------- |\n| [fclose](https://www.mathworks.com/help/matlab/ref/fclose.html)     | close one or all open files                                          |\n| [feof](https://www.mathworks.com/help/matlab/ref/feof.html)         | Detect the end of the file                                           |\n| [ferror](https://www.mathworks.com/help/matlab/ref/ferror.html)     | File I/O error message                                               |\n| [fgetl](https://www.mathworks.com/help/matlab/ref/fgetl.html)       | Read lines in a file and remove line breaks                          |\n| [fgets](https://www.mathworks.com/help/matlab/ref/fgets.html)       | Read lines in a file and keep newlines                               |\n| [fileread](https://www.mathworks.com/help/matlab/ref/fileread.html) | Read file content in text format                                     |\n| [fopen](https://www.mathworks.com/help/matlab/ref/fopen.html)       | Open a file or get information about opening a file                  |\n| [fprintf](https://www.mathworks.com/help/matlab/ref/fprintf.html)   | Write data to a text file                                            |\n| [fread](https://www.mathworks.com/help/matlab/ref/fread.html)       | Read data in binary files                                            |\n| [frewind](https://www.mathworks.com/help/matlab/ref/frewind.html)   | Move the file position indicator to the beginning of the opened file |\n| [fscanf](https://www.mathworks.com/help/matlab/ref/fscanf.html)     | Read the data in the text file                                       |\n| [fseek](https://www.mathworks.com/help/matlab/ref/fseek.html)       | Move to the specified position in the file                           |\n| [ftell](https://www.mathworks.com/help/matlab/ref/ftell.html)       | current location                                                     |\n| [fwrite](https://www.mathworks.com/help/matlab/ref/fwrite.html)     | Write data to a binary file                                          |\n\n### Serial and USB Communication -Connection and Configuration\n\n| -                                                                                                    | -                                                                                       |\n| ---------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------- |\n| [serialportlist](https://www.mathworks.com/help/matlab/ref/serialportlist.html)                      | List of serial ports connected to your system                                           |\n| [serialport](https://www.mathworks.com/help/matlab/ref/serialport.html)                              | Connect to a serial port                                                                |\n| [configureTerminator](https://www.mathworks.com/help/matlab/ref/serialport.configureterminator.html) | Set the terminator for ASCII string communication with the serial port                  |\n| [configureCallback](https://www.mathworks.com/help/matlab/ref/serialport.configurecallback.html)     | Set callback function and trigger conditions for communication with serial port devices |\n\n### Serial and USB communication -read and write\n\n| -                                                                                | -                                            |\n| -------------------------------------------------------------------------------- | :------------------------------------------- |\n| [read](https://www.mathworks.com/help/matlab/ref/serialport.read.html)           | Read data from the serial port               |\n| [readline](https://www.mathworks.com/help/matlab/ref/serialport.readline.html)   | Read ASCII string data line from serial port |\n| [write](https://www.mathworks.com/help/matlab/ref/serialport.write.html)         | write data to serial port                    |\n| [writeline](https://www.mathworks.com/help/matlab/ref/serialport.writeline.html) | Write ASCII data line to serial port         |\n\n### Serial and USB communication -control pins and memory\n\n| -                                                                                      | -                                   |\n| -------------------------------------------------------------------------------------- | :---------------------------------- |\n| [flush](https://www.mathworks.com/help/matlab/ref/serialport.flush.html)               | Clear the serial port device buffer |\n| [getpinstatus](https://www.mathworks.com/help/matlab/ref/serialport.getpinstatus.html) | Get the serial port status          |\n| [setRTS](https://www.mathworks.com/help/matlab/ref/serialport.setrts.html)             | Set the serial port RTS pin         |\n| [setDTR](https://www.mathworks.com/help/matlab/ref/serialport.setdtr.html)             | Set the serial DTR pin              |\n\n### TCP/IP communication -connection and configuration\n\n| -                                                                                                   | -                                                                                         |\n| --------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------- |\n| [tcpclient](https://www.mathworks.com/help/matlab/ref/tcpclient.html)                               | Create a TCP/IP client connection to a TCP/IP server                                      |\n| [echotcpip](https://www.mathworks.com/help/matlab/ref/echotcpip.html)                               | Start or stop the TCP/IP echo server                                                      |\n| [configureTerminator](https://www.mathworks.com/help/matlab/ref/tcpclient.configureterminator.html) | Set terminator for ASCII string communication with remote host via TCP/IP                 |\n| [configureCallback](https://www.mathworks.com/help/matlab/ref/tcpclient.configurecallback.html)     | Set callback function and trigger condition for communication with remote host via TCP/IP |\n\n{.style-list}\n\n### TCP/IP communication -read and write\n\n| -                                                                               | -                                                            |\n| ------------------------------------------------------------------------------- | :----------------------------------------------------------- |\n| [read](https://www.mathworks.com/help/matlab/ref/tcpclient.read.html)           | Read data on a remote host via TCP/IP                        |\n| [readline](https://www.mathworks.com/help/matlab/ref/tcpclient.readline.html)   | Read ASCII string data line from remote host via TCP/IP      |\n| [write](https://www.mathworks.com/help/matlab/ref/tcpclient.write.html)         | Write data to a remote host via TCP/IP                       |\n| [writeline](https://www.mathworks.com/help/matlab/ref/tcpclient.writeline.html) | Write ASCII data line to remote host via TCP/IP              |\n| [flush](https://www.mathworks.com/help/matlab/ref/tcpclient.flush.html)         | Flush buffers for communication with remote hosts via TCP/IP |\n\n{.style-list}\n\n### Bluetooth communication -connection and configuration\n\n| -                                                                                                   | -                                                                                     |\n| --------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------ |\n| [bluetoothlist](https://www.mathworks.com/help/matlab/ref/bluetoothlist.html)                       | Scan for nearby `Bluetooth` classic devices                                           |\n| [bluetooth](https://www.mathworks.com/help/matlab/ref/bluetooth.html)                               | Connect to `Bluetooth` classic device                                                 |\n| [configureTerminator](https://www.mathworks.com/help/matlab/ref/bluetooth.configureterminator.html) | Set terminator for ASCII string communication with `Bluetooth` device                 |\n| [configureCallback](https://www.mathworks.com/help/matlab/ref/bluetooth.configurecallback.html)     | Set callback function and trigger condition for communication with `Bluetooth` device |\n\n{.style-list}\n\n### Bluetooth communication -read and write {.row-span-2}\n\n| -                                                                               | -                                                   |\n| ------------------------------------------------------------------------------- | :-------------------------------------------------- |\n| [read](https://www.mathworks.com/help/matlab/ref/bluetooth.read.html)           | Read data from a `Bluetooth` device                 |\n| [readline](https://www.mathworks.com/help/matlab/ref/bluetooth.readline.html)   | Read ASCII string data line from `Bluetooth` device |\n| [write](https://www.mathworks.com/help/matlab/ref/bluetooth.write.html)         | write data to `Bluetooth` device                    |\n| [writeline](https://www.mathworks.com/help/matlab/ref/bluetooth.writeline.html) | Write ASCII data line to `Bluetooth` device         |\n| [flush](https://www.mathworks.com/help/matlab/ref/bluetooth.flush.html)         | Clear `Bluetooth` device buffer                     |\n\n{.style-list}\n\n### Bluetooth Low Energy Communication {.row-span-2}\n\n| -                                                                                                            | -                                                                                          |\n| ------------------------------------------------------------------------------------------------------------ | :----------------------------------------------------------------------------------------- |\n| [blelist](https://www.mathworks.com/help/matlab/ref/blelist.html)                                            | Scan for nearby low energy `Bluetooth` peripherals                                         |\n| [ble](https://www.mathworks.com/help/matlab/ref/ble.html)                                                    | Connect to low energy `Bluetooth` peripherals                                              |\n| [characteristic](https://www.mathworks.com/help/matlab/ref/matlabshared.blelib.characteristic.html)          | Access to characteristics of `Bluetooth` low energy peripherals                            |\n| [descriptor](https://www.mathworks.com/help/matlab/ref/matlabshared.blelib.descriptor.html)                  | Access descriptors on `Bluetooth` low energy peripherals                                   |\n| [read](https://www.mathworks.com/help/matlab/ref/matlabshared.blelib.characteristic.read.html)               | Read characteristic or descriptor data on a `Bluetooth` low energy peripheral device       |\n| [write](https://www.mathworks.com/help/matlab/ref/matlabshared.blelib.characteristic.write.html)             | Write data to a characteristic or descriptor of a `Bluetooth` low energy peripheral device |\n| [subscribe](https://www.mathworks.com/help/matlab/ref/matlabshared.blelib.characteristic.subscribe.html)     | Subscribe to characteristic notifications or instructions                                  |\n| [unsubscribe](https://www.mathworks.com/help/matlab/ref/matlabshared.blelib.characteristic.unsubscribe.html) | Unsubscribe characteristic notifications and instructions                                  |\n\n{.style-list}\n\n### Web Services\n\n| -                                                                       | -                                           |\n| ----------------------------------------------------------------------- | :------------------------------------------ |\n| [webread](https://www.mathworks.com/help/matlab/ref/webread.html)       | Read content from RESTful web services      |\n| [webwrite](https://www.mathworks.com/help/matlab/ref/webwrite.html)     | Write data to RESTful web service           |\n| [websave](https://www.mathworks.com/help/matlab/ref/websave.html)       | Save content in RESTful web service to file |\n| [weboptions](https://www.mathworks.com/help/matlab/ref/weboptions.html) | Specify parameters for RESTful web services |\n| [web](https://www.mathworks.com/help/matlab/ref/web.html)               | Open a webpage or file in a browser         |\n| [sendmail](https://www.mathworks.com/help/matlab/ref/sendmail.html)     | Send email to address list                  |\n\n### FTP file operations {.row-span-2}\n\n| -                                                                   | -                                                          |\n| ------------------------------------------------------------------- | :--------------------------------------------------------- |\n| [ftp](https://www.mathworks.com/help/matlab/ref/ftp.html)           | Connect to an FTP server to access its files               |\n| [sftp](https://www.mathworks.com/help/matlab/ref/sftp.html)         | Connection to SFTP server to access its files              |\n| [ascii](https://www.mathworks.com/help/matlab/ref/ftp.ascii.html)   | Set FTP transfer mode to ASCII                             |\n| [binary](https://www.mathworks.com/help/matlab/ref/ftp.binary.html) | Set FTP transfer mode to binary                            |\n| [cd](https://www.mathworks.com/help/matlab/ref/ftp.cd.html)         | Change or view the current folder on an SFTP or FTP server |\n| [close](https://www.mathworks.com/help/matlab/ref/ftp.close.html)   | Close the connection to the SFTP or FTP server             |\n| [delete](https://www.mathworks.com/help/matlab/ref/ftp.delete.html) | Delete files on SFTP or FTP server                         |\n| [dir](https://www.mathworks.com/help/matlab/ref/ftp.dir.html)       | List folder contents on SFTP or FTP server                 |\n| [mget](https://www.mathworks.com/help/matlab/ref/ftp.mget.html)     | Download files from SFTP or FTP server                     |\n| [mkdir](https://www.mathworks.com/help/matlab/ref/ftp.mkdir.html)   | Create a new folder on an SFTP or FTP server               |\n| [mput](https://www.mathworks.com/help/matlab/ref/ftp.mput.html)     | Upload files or folders to SFTP or FTP server              |\n| [rename](https://www.mathworks.com/help/matlab/ref/ftp.rename.html) | Rename a file on an SFTP or FTP server                     |\n| [rmdir](https://www.mathworks.com/help/matlab/ref/ftp.rmdir.html)   | Delete a folder on an SFTP or FTP server                   |\n\n### Internet of Things (IoT) Data\n\n| -                                                                                 | -                                        |\n| --------------------------------------------------------------------------------- | :--------------------------------------- |\n| [thingSpeakRead](https://www.mathworks.com/help/matlab/ref/thingspeakread.html)   | Read data stored in `ThingSpeak` channel |\n| [thingSpeakWrite](https://www.mathworks.com/help/matlab/ref/thingspeakwrite.html) | write data to `ThingSpeak` channel       |\n"
  },
  {
    "path": "source/_posts/matplotlib.md",
    "content": "---\ntitle: 'Matplotlib'\ndate: 06-06-2025\nbackground: bg-[#1a073e]\ntags:\n  - 'data visualization'\n  - 'matplotlib'\n  - 'plotting'\ncategories:\n  - 'Python'\nintro: |\n  [Matplotlib](https://matplotlib.org/) is a comprehensive library for creating static, animated, and interactive plots in Python.  \n  This cheat sheet provides a quick reference from basic to advanced usage, covering essential features for data science, machine learning, and scientific computing.\nplugins:\n  - copyCode\n---\n\n---\n\n## Getting Started {.cols-2}\n\n### Importing\n\n```python\nimport matplotlib.pyplot as plt  # Core plotting library\nimport numpy as np               # For numerical operations\n```\n\n### Basic Plot\n\n```python\nx = np.linspace(0, 10, 100)      # 100 points between 0 and 10\ny = np.sin(x)                    # Sine function values\nplt.plot(x, y)                   # Create a line plot\nplt.show()                       # Display the plot\n```\n\n---\n\n## Plot Types {.cols-2}\n\n### Line Plot\n\n```python\nplt.plot(x, y)                   # Line plot of y vs x\nplt.title(\"Sine Wave\")          # Set title\nplt.xlabel(\"x-axis\")            # Label x-axis\nplt.ylabel(\"y-axis\")            # Label y-axis\nplt.grid(True)                  # Show gridlines\nplt.show()\n```\n\n### Scatter Plot\n\n```python\nplt.scatter(x, y)               # Scatter plot\nplt.title(\"Scatter Plot\")\nplt.show()\n```\n\n### Bar Plot\n\n```python\ncategories = ['A', 'B', 'C']\nvalues = [10, 20, 15]\nplt.bar(categories, values)     # Vertical bar chart\nplt.title(\"Bar Chart\")\nplt.show()\n```\n\n### Horizontal Bar Plot\n\n```python\nplt.barh(categories, values)    # Horizontal bar chart\nplt.title(\"Horizontal Bar Chart\")\nplt.show()\n```\n\n### Histogram\n\n```python\ndata = np.random.randn(1000)    # Random normal distribution\nplt.hist(data, bins=30)         # Histogram with 30 bins\nplt.title(\"Histogram\")\nplt.show()\n```\n\n### Pie Chart\n\n```python\nsizes = [25, 35, 20, 20]\nlabels = ['A', 'B', 'C', 'D']\nplt.pie(sizes, labels=labels, autopct='%1.1f%%')  # Pie chart with % labels\nplt.title(\"Pie Chart\")\nplt.show()\n```\n\n---\n\n## Customization {.row-span-2}\n\n| Feature         | Code Example                                                                         | Description                                 |\n| --------------- | ------------------------------------------------------------------------------------ | ------------------------------------------- |\n| Title           | `plt.title(\"Title\")`                                                                 | Set the title of the plot                   |\n| X/Y Labels      | `plt.xlabel(\"X\")`, `plt.ylabel(\"Y\")`                                                 | Label the axes                              |\n| Grid            | `plt.grid(True)`                                                                     | Show grid                                   |\n| Legend          | `plt.legend([\"line1\"])`                                                              | Add legend                                  |\n| Line Style      | `plt.plot(x, y, linestyle='--')`                                                     | Dashed line                                 |\n| Color           | `plt.plot(x, y, color='green')`                                                      | Set line color                              |\n| Marker          | `plt.plot(x, y, marker='o')`                                                         | Show markers on points                      |\n| Axis Limits     | `plt.xlim(0, 10)`, `plt.ylim(-1, 1)`                                                 | Set axis range                              |\n| Tick Labels     | `plt.xticks([...])`, `plt.yticks([...])`                                             | Customize tick positions                    |\n| Text Annotation | `plt.text(5, 0, \"Midpoint\")`                                                         | Add text at a specific coordinate           |\n| Arrow           | `plt.annotate(\"Peak\", xy=(7, 1), xytext=(6, 1.5), arrowprops=dict(arrowstyle=\"->\"))` | Add annotation arrow                        |\n| Style Sheets    | `plt.style.use('ggplot')`                                                            | Use predefined styles like `seaborn`, `bmh` |\n\n---\n\n## Subplots & Layouts\n\n### Multiple Subplots\n\n```python\nfig, axs = plt.subplots(2, 2)        # Create 2x2 grid of subplots\naxs[0, 0].plot(x, y)                 # Top-left subplot\naxs[0, 1].scatter(x, y)              # Top-right subplot\naxs[1, 0].bar(categories, values)    # Bottom-left subplot\naxs[1, 1].hist(data)                 # Bottom-right subplot\nplt.tight_layout()                   # Adjust spacing to prevent overlap\nplt.show()\n```\n\n### Figure Size\n\n```python\nplt.figure(figsize=(10, 5))         # Set figure size (width, height in inches)\n```\n\n---\n\n## Advanced Visualizations {.cols-2}\n\n### Heatmap\n\n```python\ndata = np.random.rand(10, 10)       # Random 10x10 matrix\nplt.imshow(data, cmap='hot', interpolation='nearest')  # Display as image\nplt.colorbar()                      # Show color scale\nplt.title(\"Heatmap\")\nplt.show()\n```\n\n### Contour Plot\n\n```python\nX, Y = np.meshgrid(x, x)\nZ = np.sin(X) * np.cos(Y)\nplt.contour(X, Y, Z)                # Contour lines\nplt.title(\"Contour Plot\")\nplt.show()\n```\n\n### 3D Plot\n\n```python\nfrom mpl_toolkits.mplot3d import Axes3D\nfig = plt.figure()\nax = fig.add_subplot(111, projection='3d')  # 3D subplot\nax.plot3D(x, y, np.cos(x))                  # 3D line\nplt.title(\"3D Plot\")\nplt.show()\n```\n\n---\n\n## Working with Images\n\n```python\nimport matplotlib.image as mpimg\nimg = mpimg.imread('image.jpg')     # Load image\nplt.imshow(img)                     # Display image\nplt.axis('off')                     # Hide axes\nplt.title(\"Image Display\")\nplt.show()\n```\n\n---\n\n## For Machine Learning\n\n### Plotting Loss vs Epoch\n\n```python\nepochs = range(1, 11)\nloss = [0.9, 0.7, 0.5, 0.4, 0.3, 0.25, 0.2, 0.18, 0.15, 0.13]\nplt.plot(epochs, loss)\nplt.title(\"Training Loss\")\nplt.xlabel(\"Epoch\")\nplt.ylabel(\"Loss\")\nplt.show()\n```\n\n### Confusion Matrix (Heatmap)\n\n```python\nfrom sklearn.metrics import confusion_matrix\nimport seaborn as sns\n\ny_true = [0, 1, 2, 2, 0]\ny_pred = [0, 0, 2, 2, 1]\ncm = confusion_matrix(y_true, y_pred)    # Create confusion matrix\nsns.heatmap(cm, annot=True, fmt='d', cmap='Blues')  # Heatmap visualization\nplt.title(\"Confusion Matrix\")\nplt.show()\n```\n\n### ROC Curve\n\n```python\nfrom sklearn.metrics import roc_curve, auc\n\nfpr, tpr, _ = roc_curve([0, 0, 1, 1], [0.1, 0.4, 0.35, 0.8])  # Compute ROC\nroc_auc = auc(fpr, tpr)                 # Area under curve\nplt.plot(fpr, tpr, label=f'AUC = {roc_auc:.2f}')\nplt.plot([0, 1], [0, 1], 'k--')         # Diagonal line\nplt.xlabel(\"False Positive Rate\")\nplt.ylabel(\"True Positive Rate\")\nplt.title(\"ROC Curve\")\nplt.legend()\nplt.show()\n```\n\n---\n\n## Saving Plots\n\n```python\nplt.savefig(\"figure.png\", dpi=300, bbox_inches='tight')  # Save plot to file\n```\n\n---\n\n## Show & Clear\n\n```python\nplt.show()     # Show plot window\nplt.clf()      # Clear current figure (useful when plotting in loops)\nplt.close()    # Close figure window (useful in scripts or GUI apps)\n```\n\n---\n\n## More Useful Functions\n\n| Function                       | Use Case                        |\n| ------------------------------ | ------------------------------- |\n| `plt.fill_between(x, y1, y2)`  | Fill area between curves        |\n| `plt.axhline(y=value)`         | Draw horizontal line at y       |\n| `plt.axvline(x=value)`         | Draw vertical line at x         |\n| `plt.errorbar(x, y, yerr=...)` | Plot with error bars            |\n| `plt.twinx()`                  | Create secondary y-axis         |\n| `plt.subplots_adjust(...)`     | Manually adjust subplot spacing |\n| `plt.gca()`                    | Get current axes                |\n| `plt.gcf()`                    | Get current figure              |\n\n---\n"
  },
  {
    "path": "source/_posts/microsoft-teams.md",
    "content": "---\ntitle: Microsoft Teams\ndate: 2022-11-23 16:23:31.706764\nbackground: bg-[#4aa4ea]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 38 keyboard shortcuts found in Microsoft Teams\n---\n\n## Keyboard Shortcuts\n\n### General\n\n| Shortcut   | Action                  |\n| ---------- | ----------------------- |\n| `Ctrl` `.` | Show keyboard shortcuts |\n| `Ctrl` `E` | Go to search            |\n| `Ctrl` `/` | Show commands           |\n| `Ctrl` `G` | Goto                    |\n| `Ctrl` `N` | Start new chat          |\n| `Ctrl` `,` | Open settings           |\n| `F1`       | Open help               |\n| `Esc`      | Close                   |\n| `Ctrl` `=` | Zoom in                 |\n| `Ctrl` `-` | Zoom out                |\n| `Ctrl` `0` | Return to default zoom  |\n\n{.shortcuts}\n\n### Navigation\n\n| Shortcut              | Action                     |\n| --------------------- | -------------------------- |\n| `Ctrl` `1`            | Open activity              |\n| `Ctrl` `2`            | Open chat                  |\n| `Ctrl` `3`            | Open teams                 |\n| `Ctrl` `4`            | Open calendar              |\n| `Ctrl` `5`            | Open calls                 |\n| `Ctrl` `6`            | Open files                 |\n| `Alt` `Up`            | Go to previous list item   |\n| `Alt` `Down`          | Go to next list item       |\n| `Ctrl` `Shift` `Up`   | Move selected team up      |\n| `Ctrl` `Shift` `Down` | Move selected team down    |\n| `Ctrl` `Shift` `F6`   | Go to the previous section |\n| `Ctrl` `F6`           | Go to the next section     |\n\n{.shortcuts}\n\n### Messaging\n\n| Shortcut           | Action                            |\n| ------------------ | --------------------------------- |\n| `Alt` `Shift` `C`  | Go to compose box                 |\n| `Ctrl` `Shift` `X` | Expand compose box                |\n| `Ctrl` `Enter`     | Send, in the expanded compose box |\n| `Ctrl` `O`         | Attach a file                     |\n| `Shift` `Enter`    | Start a new line                  |\n| `Alt` `Shift` `R`  | Reply to thread                   |\n\n{.shortcuts}\n\n### Meetings and Calls\n\n| Shortcut               | Action                |\n| ---------------------- | --------------------- |\n| `Ctrl` `Shift` `A`     | Accept video call     |\n| `Ctrl` `Shift` `S`     | Accept audio call     |\n| `Ctrl` `Shift` `D`     | Decline call          |\n| `Ctrl` `Shift` `C`     | Start audio call      |\n| `Ctrl` `Shift` `U`     | Start video call      |\n| `Ctrl` `Shift` `M`     | Toggle mute           |\n| `Ctrl` `Shift` `O`     | Toggle video          |\n| `Ctrl` `Shift` `F`     | Toggle fullscreen     |\n| `Ctrl` `Shift` `Space` | Go to sharing toolbar |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Microsoft Teams](https://support.microsoft.com/en-us/office/keyboard-shortcuts-for-microsoft-teams-2e8e2a70-e8d8-4a19-949b-4c36dd5292d2)\n  _(support.microsoft.com)_\n"
  },
  {
    "path": "source/_posts/mime.md",
    "content": "---\ntitle: MIME types\ndate: 2020-04-03 17:28:43\ntags:\n  - media type\ncategories:\n  - Other\nintro: |\n  This cheat sheet lists some common MIME types for the Web. You can look in the [IANA/MIME Media Types registry](http://www.iana.org/assignments/media-types/index.html) which contains all registered MIME types.\n---\n\n## Getting Started {.cols-2}\n\n### Introduction\n\n- The MIME type registry associates particular filename extensions and filename pattern\n- MIME (Multipurpose Internet Mail Extensions) type aka media type\n- MIME types are defined and standardized in IETF's RFC 6838\n- Indicates the nature and format of a document, file, or assortment of bytes.\n- For file formats or format contents on the Internet\n\n  {.marker-round}\n\n### Multi-format of MIME types\n\n- [Markdown Table](https://tableconvert.com/html-to-markdown?data=https://cheatsheets.zip/mime#TableGenerator)\n- [Template](https://tableconvert.com/html-to-template?data=https://cheatsheets.zip/mime#TableGenerator)\n- [LaTeX Table](https://tableconvert.com/html-to-latex?data=https://cheatsheets.zip/mime#TableGenerator)\n- [CSV](https://tableconvert.com/html-to-csv?data=https://cheatsheets.zip/mime#TableGenerator)\n- [Excel](https://tableconvert.com/html-to-excel?data=https://cheatsheets.zip/mime#TableGenerator)\n- [JSON Array](https://tableconvert.com/html-to-json?data=https://cheatsheets.zip/mime#TableGenerator)\n- [HTML Table](https://tableconvert.com/html-to-html?data=https://cheatsheets.zip/mime#TableGenerator)\n- [Insert SQL](https://tableconvert.com/html-to-sql?data=https://cheatsheets.zip/mime#TableGenerator)\n- [YAML Sequence](https://tableconvert.com/html-to-yaml?data=https://cheatsheets.zip/mime#TableGenerator)\n- [XML](https://tableconvert.com/html-to-xml?data=https://cheatsheets.zip/mime#TableGenerator)\n- [ASCII](https://tableconvert.com/html-to-ascii?data=https://cheatsheets.zip/mime#TableGenerator)\n- [MediaWiki Table](https://tableconvert.com/html-to-mediawiki?data=https://cheatsheets.zip/mime#TableGenerator)\n- [AsciiDoc Table](https://tableconvert.com/html-to-asciidoc?data=https://cheatsheets.zip/mime#TableGenerator)\n- [Jira Table](https://tableconvert.com/html-to-jira?data=https://cheatsheets.zip/mime#TableGenerator)\n- [Textile Table](https://tableconvert.com/html-to-textile?data=https://cheatsheets.zip/mime#TableGenerator)\n- [reStructuredText](https://tableconvert.com/html-to-restructuredtext?data=https://cheatsheets.zip/mime#TableGenerator)\n- [PHP Array](https://tableconvert.com/html-to-php?data=https://cheatsheets.zip/mime#TableGenerator)\n- [Ruby Array](https://tableconvert.com/html-to-ruby?data=https://cheatsheets.zip/mime#TableGenerator)\n- [ASP Array](https://tableconvert.com/html-to-asp?data=https://cheatsheets.zip/mime#TableGenerator)\n- [ActionScript](https://tableconvert.com/html-to-actionscript?data=https://cheatsheets.zip/mime#TableGenerator)\n- [BBCode](https://tableconvert.com/html-to-bbcode?data=https://cheatsheets.zip/mime#TableGenerator)\n- [PDF](https://tableconvert.com/html-to-pdf?data=https://cheatsheets.zip/mime#TableGenerator)\n- [JPEG](https://tableconvert.com/html-to-jpeg?data=https://cheatsheets.zip/mime#TableGenerator)\n\n{.cols-4 .marker-none}\n\n## Lists of MIME types {.cols-1}\n\n### Common MIME (Media) types\n\n| Extension       | Kind of document                                 | MIME Type \\(Content Type\\)                                                                                                               |\n| --------------- | ------------------------------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------- |\n| \\.aac           | AAC audio                                        | audio/aac                                                                                                                                |\n| \\.abw           | AbiWord document                                 | application/x\\-abiword                                                                                                                   |\n| \\.arc           | Archive document \\(multiple files embedded\\)     | application/x\\-freearc                                                                                                                   |\n| \\.avi           | AVI: Audio Video Interleave                      | video/x\\-msvideo                                                                                                                         |\n| \\.azw           | Amazon Kindle eBook format                       | application/vnd\\.amazon\\.ebook                                                                                                           |\n| \\.bin           | Any kind of binary data                          | application/octet\\-stream                                                                                                                |\n| \\.bmp           | Windows OS/2 Bitmap Graphics                     | image/bmp                                                                                                                                |\n| \\.bz            | BZip archive                                     | application/x\\-bzip                                                                                                                      |\n| \\.bz2           | BZip2 archive                                    | application/x\\-bzip2                                                                                                                     |\n| \\.csh           | C\\-Shell script                                  | application/x\\-csh                                                                                                                       |\n| \\.css           | Cascading Style Sheets \\(CSS\\)                   | text/css                                                                                                                                 |\n| \\.csv           | Comma\\-separated values \\(CSV\\)                  | text/csv                                                                                                                                 |\n| \\.doc           | Microsoft Word                                   | application/msword                                                                                                                       |\n| \\.docx          | Microsoft Word \\(OpenXML\\)                       | application/vnd\\.openxmlformats\\-officedocument\\.wordprocessingml\\.document                                                              |\n| \\.eot           | MS Embedded OpenType fonts                       | application/vnd\\.ms\\-fontobject                                                                                                          |\n| \\.epub          | Electronic publication \\(EPUB\\)                  | application/epub\\+zip                                                                                                                    |\n| \\.gz            | GZip Compressed Archive                          | application/gzip                                                                                                                         |\n| \\.gif           | Graphics Interchange Format \\(GIF\\)              | image/gif                                                                                                                                |\n| \\.htm \\.html    | HyperText Markup Language \\(HTML\\)               | text/html                                                                                                                                |\n| \\.ico           | Icon format                                      | image/vnd\\.microsoft\\.icon                                                                                                               |\n| \\.ics           | iCalendar format                                 | text/calendar                                                                                                                            |\n| \\.jar           | Java Archive \\(JAR\\)                             | application/java\\-archive                                                                                                                |\n| \\.jpeg \\.jpg    | JPEG images                                      | image/jpeg                                                                                                                               |\n| \\.js            | JavaScript                                       | text/javascript                                                                                                                          |\n| \\.json          | JSON format                                      | application/json                                                                                                                         |\n| \\.jsonld        | JSON\\-LD format                                  | application/ld\\+json                                                                                                                     |\n| \\.mid \\.midi    | Musical Instrument Digital Interface \\(MIDI\\)    | audio/midi audio/x\\-midi                                                                                                                 |\n| \\.mjs           | JavaScript module                                | text/javascript                                                                                                                          |\n| \\.mp3           | MP3 audio                                        | audio/mpeg                                                                                                                               |\n| \\.mpeg          | MPEG Video                                       | video/mpeg                                                                                                                               |\n| \\.mpkg          | Apple Installer Package                          | application/vnd\\.apple\\.installer\\+xml                                                                                                   |\n| \\.odp           | OpenDocument presentation document               | application/vnd\\.oasis\\.opendocument\\.presentation                                                                                       |\n| \\.ods           | OpenDocument spreadsheet document                | application/vnd\\.oasis\\.opendocument\\.spreadsheet                                                                                        |\n| \\.odt           | OpenDocument text document                       | application/vnd\\.oasis\\.opendocument\\.text                                                                                               |\n| \\.oga           | OGG audio                                        | audio/ogg                                                                                                                                |\n| \\.ogv           | OGG video                                        | video/ogg                                                                                                                                |\n| \\.ogx           | OGG                                              | application/ogg                                                                                                                          |\n| \\.opus          | Opus audio                                       | audio/opus                                                                                                                               |\n| \\.otf           | OpenType font                                    | font/otf                                                                                                                                 |\n| \\.png           | Portable Network Graphics                        | image/png                                                                                                                                |\n| \\.pdf           | Adobe Portable Document Format \\(PDF\\)           | application/pdf                                                                                                                          |\n| \\.php           | Hypertext Preprocessor \\(Personal Home Page\\)    | application/php                                                                                                                          |\n| \\.ppt           | Microsoft PowerPoint                             | application/vnd\\.ms\\-powerpoint                                                                                                          |\n| \\.pptx          | Microsoft PowerPoint \\(OpenXML\\)                 | application/vnd\\.openxmlformats\\-officedocument\\.presentationml\\.presentation                                                            |\n| \\.rar           | RAR archive                                      | application/vnd\\.rar                                                                                                                     |\n| \\.rtf           | Rich Text Format \\(RTF\\)                         | application/rtf                                                                                                                          |\n| \\.sh            | Bourne shell script                              | application/x\\-sh                                                                                                                        |\n| \\.svg           | Scalable Vector Graphics \\(SVG\\)                 | image/svg\\+xml                                                                                                                           |\n| \\.swf           | Small web format \\(SWF\\) or Adobe Flash document | application/x\\-shockwave\\-flash                                                                                                          |\n| \\.tar           | Tape Archive \\(TAR\\)                             | application/x\\-tar                                                                                                                       |\n| \\.tif \\.tiff    | Tagged Image File Format \\(TIFF\\)                | image/tiff                                                                                                                               |\n| \\.ts            | MPEG transport stream                            | video/mp2t                                                                                                                               |\n| \\.ttf           | TrueType Font                                    | font/ttf                                                                                                                                 |\n| \\.txt           | Text, \\(generally ASCII or ISO 8859\\-n\\)         | text/plain                                                                                                                               |\n| \\.vsd           | Microsoft Visio                                  | application/vnd\\.visio                                                                                                                   |\n| \\.wav           | Waveform Audio Format                            | audio/wav                                                                                                                                |\n| \\.weba          | WEBM audio                                       | audio/webm                                                                                                                               |\n| \\.webm          | WEBM video                                       | video/webm                                                                                                                               |\n| \\.webp          | WEBP image                                       | image/webp                                                                                                                               |\n| \\.woff          | Web Open Font Format \\(WOFF\\)                    | font/woff                                                                                                                                |\n| \\.woff2         | Web Open Font Format \\(WOFF\\)                    | font/woff2                                                                                                                               |\n| \\.xhtml         | XHTML                                            | application/xhtml\\+xml                                                                                                                   |\n| \\.xls           | Microsoft Excel                                  | application/vnd\\.ms\\-excel                                                                                                               |\n| \\.xlsx          | Microsoft Excel \\(OpenXML\\)                      | application/vnd\\.openxmlformats\\-officedocument\\.spreadsheetml\\.sheet                                                                    |\n| \\.xml           | XML                                              | application/xml if not readable from casual users \\(RFC 3023, section 3\\) text/xml if readable from casual users \\(RFC 3023, section 3\\) |\n| \\.xul           | XUL                                              | application/vnd\\.mozilla\\.xul\\+xml                                                                                                       |\n| \\.zip           | ZIP archive                                      | application/zip                                                                                                                          |\n| \\.3gp           | 3GPP audio/video container                       | video/3gpp audio/3gpp if it doesn't contain video                                                                                        |\n| \\.3g2           | 3GPP2 audio/video container                      | video/3gpp2 audio/3gpp2 if it doesn't contain video                                                                                      |\n| \\.7z            | 7\\-zip archive                                   | application/x\\-7z\\-compressed                                                                                                            |\n| \\.markdown \\.md | Markdown File                                    | text/markdown                                                                                                                            |\n\n{.show-header}\n"
  },
  {
    "path": "source/_posts/minecraft-bedrock.md",
    "content": "---\ntitle: Minecraft Bedrock Edition\ndate: 2023-12-28 12:00:00\nicon: minecraft\nbackground: bg-[#3C3C3C]\ntags:\n  - minecraft\n  - bedrock\n  - pe\n  - commands\n  - cheats\n  - game\ncategories:\n  - Game\nintro: A comprehensive reference for Minecraft Bedrock Edition (1.20.x) commands.\n---\n\n## Target Selectors\n\n| Selector | Description |\n| :--- | :--- |\n| `@p` | Nearest player |\n| `@r` | Random player |\n| `@a` | All players |\n| `@e` | All entities (mobs, items, etc.) |\n| `@s` | The entity executing the command (Self) |\n| `@c` | The player's agent (Education Edition/Code Builder) |\n\n### Selector Arguments\n\n| Argument | Example | Description |\n| :--- | :--- | :--- |\n| `type` | `@e[type=creeper]` | Selects entities of a specific type |\n| `r` / `rm` | `@a[r=10]` | Selects within a max radius (`r`) or min radius (`rm`) |\n| `c` | `@e[c=1]` | Limits the count of targets (nearest first) |\n| `m` | `@a[m=creative]` | Selects players by gamemode |\n| `l` / `lm` | `@a[lm=30]` | Selects by level max (`l`) or min (`lm`) |\n| `name` | `@e[name=\"Bob\"]` | Selects entities with a specific name tag |\n\n## Core Commands\n\n### Teleport (/tp)\n\nTeleport entities to locations or other entities.\n\n```mcfunction\n# Teleport yourself to coordinates\n/tp @s 100 64 -200\n\n# Teleport yourself to another player\n/tp @s \"Player Name\"\n\n# Teleport relative to current position\n/tp @s ~ ~10 ~\n\n# Teleport with facing direction\n/tp @s ~ ~ ~ facing @p\n```\n\n### Game Mode (/gamemode)\n\nChanges the player's game mode.\n\n```mcfunction\n# Survival Mode (0)\n/gamemode s\n# or\n/gamemode survival\n\n# Creative Mode (1)\n/gamemode c\n# or\n/gamemode creative\n\n# Adventure Mode (2)\n/gamemode a\n# or\n/gamemode adventure\n\n# Spectator Mode (Experimental/New)\n/gamemode spectator\n```\n\n### Give Items (/give)\n\nGives items to players.\n\n```mcfunction\n# Give a diamond sword\n/give @s diamond_sword\n\n# Give 64 stone\n/give @s stone 64\n\n# Give item with data value (Legacy/Some items)\n# Syntax: /give <target> <item> [amount] [data] [components]\n/give @s wool 1 14 (Red Wool)\n\n# Give item with CanPlaceOn (Adventure mode)\n/give @s stone 1 0 {\"minecraft:can_place_on\":{\"blocks\":[\"grass\"]}}\n```\n\n### Experience (/xp)\n\nAdds or levels up experience.\n\n```mcfunction\n# Add 5 levels\n/xp 5L @s\n\n# Add 100 points\n/xp 100 @s\n```\n\n## World Management\n\n### Time (/time)\n\nSets the world time.\n\n```mcfunction\n# Set to day\n/time set day\n\n# Set to night\n/time set night\n\n# Set specific tick\n/time set 0\n```\n\n### Weather (/weather)\n\nChanges the weather.\n\n```mcfunction\n# Clear weather\n/weather clear\n\n# Rain\n/weather rain\n\n# Thunderstorm\n/weather thunder\n```\n\n### Gamerules (/gamerule)\n\nSets global world rules.\n\n| Rule | Description |\n| :--- | :--- |\n| `keepinventory` | Keep items on death (true/false) |\n| `dodaylightcycle` | Toggle sun movement (true/false) |\n| `domobspawning` | Toggle mob spawning (true/false) |\n| `mobgriefing` | Toggle mob destruction (true/false) |\n| `doweathercycle` | Toggle weather changes (true/false) |\n| `commandblockoutput` | Toggle command block chat (true/false) |\n| `showcoordinates` | Show coordinates on screen (true/false) |\n\n```mcfunction\n# Enable keep inventory\n/gamerule keepinventory true\n\n# Show coordinates\n/gamerule showcoordinates true\n```\n\n## Entity & Block Manipulation\n\n### Effect (/effect)\n\nManages status effects.\n\n```mcfunction\n# Give Speed II for 30 seconds\n/effect @s speed 30 2\n\n# Give Night Vision (hide particles)\n/effect @s night_vision 10000 0 true\n\n# Clear all effects\n/effect @s clear\n```\n\n### Fill (/fill)\n\nFills a volume with blocks.\n\n```mcfunction\n# Fill region with dirt\n/fill ~ ~ ~ ~5 ~5 ~5 dirt\n\n# Replace only air with water\n/fill ~-5 ~-5 ~-5 ~5 ~5 ~5 water 0 replace air\n\n# Fill using block states\n/fill ~ ~ ~ ~10 ~1 ~10 stone [\"stone_type\"=\"granite\"]\n```\n\n### Setblock (/setblock)\n\nChanges a specific block.\n\n```mcfunction\n# Place a redstone block\n/setblock ~ ~-1 ~ redstone_block\n\n# Destroy block and place air\n/setblock 100 64 100 air 0 destroy\n```\n\n### Enchant (/enchant)\n\nEnchants the held item.\n\n```mcfunction\n# Add Sharpness V\n/enchant @s sharpness 5\n\n# Add Unbreaking III\n/enchant @s unbreaking 3\n```\n\n## Utility Commands\n\n### Locate (/locate)\n\nFinds the nearest biome or structure.\n\n```mcfunction\n# Find nearest village\n/locate structure village\n\n# Find nearest ancient city\n/locate structure ancient_city\n```\n\n### Kill (/kill)\n\nRemoves entities.\n\n```mcfunction\n# Kill yourself\n/kill @s\n\n# Kill specific entity type\n/kill @e[type=zombie]\n```\n\n### Ticking Area (/tickingarea)\n\nKeeps chunks loaded even when no players are nearby.\n\n```mcfunction\n# Add a ticking area (radius 4 chunks)\n/tickingarea add circle ~ ~ ~ 4 MyArea\n\n# List all areas\n/tickingarea list\n\n# Remove an area\n/tickingarea remove MyArea\n```\n"
  },
  {
    "path": "source/_posts/minecraft-java.md",
    "content": "---\ntitle: Minecraft Java Edition\ndate: 2023-12-28 12:00:00\nicon: minecraft\nbackground: bg-[#5B8C5A]\ntags:\n  - minecraft\n  - java\n  - commands\n  - cheats\n  - game\ncategories:\n  - Game\nintro: A comprehensive reference for Minecraft Java Edition (1.20.x) commands.\n---\n\n## Target Selectors\n\n| Selector | Description |\n| :--- | :--- |\n| `@p` | Nearest player |\n| `@r` | Random player |\n| `@a` | All players |\n| `@e` | All entities (includes mobs, items, etc.) |\n| `@s` | The entity executing the command (Self) |\n\n### Selector Arguments\n\n| Argument | Example | Description |\n| :--- | :--- | :--- |\n| `type` | `@e[type=skeleton]` | Selects entities of a specific type |\n| `distance` | `@a[distance=..10]` | Selects within a radius (10 blocks) |\n| `limit` | `@e[limit=1]` | Limits the number of targets selected |\n| `sort` | `@a[sort=nearest]` | Sorts selection (nearest, furthest, random, arbitrary) |\n| `gamemode` | `@a[gamemode=creative]` | Selects players in a specific gamemode |\n| `level` | `@a[level=30..]` | Selects players with XP level 30 or higher |\n\n## Core Commands\n\n### Teleport (/tp)\n\nUsed to teleport entities to specific locations or other entities.\n\n```mcfunction\n# Teleport yourself to coordinates\n/tp @s 100 64 -200\n\n# Teleport yourself to another player\n/tp @s PlayerName\n\n# Teleport a specific player to you\n/tp PlayerName @s\n\n# Teleport relative to current position (~ is relative)\n/tp @s ~ ~10 ~  (Moves 10 blocks up)\n\n# Teleport with rotation (yaw pitch)\n/tp @s ~ ~ ~ 90 0 (Faces South)\n```\n\n### Game Mode (/gamemode)\n\nChanges the player's game mode.\n\n```mcfunction\n# Survival Mode\n/gamemode survival\n\n# Creative Mode\n/gamemode creative\n\n# Adventure Mode\n/gamemode adventure\n\n# Spectator Mode\n/gamemode spectator\n\n# Apply to other players\n/gamemode creative @a[distance=..20]\n```\n\n### Give Items (/give)\n\nGives items to players.\n\n```mcfunction\n# Give a diamond sword\n/give @s diamond_sword\n\n# Give 64 stone\n/give @s stone 64\n\n# Give item with NBT data (Unbreakable diamond pickaxe)\n/give @s diamond_pickaxe{Unbreakable:1b}\n```\n\n### Experience (/xp or /experience)\n\nAdds or removes experience points/levels.\n\n```mcfunction\n# Add 5 levels\n/xp add @s 5 levels\n\n# Add 100 points\n/xp add @s 100 points\n\n# Query current level\n/xp query @s levels\n```\n\n## World Management\n\n### Time (/time)\n\nSets or queries the world time.\n\n```mcfunction\n# Set to day (1000 ticks)\n/time set day\n\n# Set to night (13000 ticks)\n/time set night\n\n# Set to noon (6000 ticks)\n/time set noon\n\n# Set to midnight (18000 ticks)\n/time set midnight\n\n# Add time (skip forward)\n/time add 5000\n```\n\n### Weather (/weather)\n\nChanges the weather.\n\n```mcfunction\n# Clear weather\n/weather clear\n\n# Rain\n/weather rain\n\n# Thunderstorm\n/weather thunder\n\n# Set duration (in seconds)\n/weather clear 600\n```\n\n### Gamerules (/gamerule)\n\nSets various rules for the world.\n\n| Rule | Description |\n| :--- | :--- |\n| `keepInventory` | If true, players keep items on death |\n| `doDaylightCycle` | If false, time is frozen |\n| `doMobSpawning` | If false, mobs won't spawn naturally |\n| `mobGriefing` | If false, creepers/endermen won't destroy blocks |\n| `doWeatherCycle` | If false, weather never changes |\n| `commandBlockOutput` | If false, command blocks don't spam chat |\n\n```mcfunction\n# Enable keep inventory\n/gamerule keepInventory true\n\n# Disable phantom spawning\n/gamerule doInsomnia false\n```\n\n## Entity & Block Manipulation\n\n### Effect (/effect)\n\nManages status effects on entities.\n\n```mcfunction\n# Give Speed II for 30 seconds\n/effect give @s speed 30 1\n\n# Give Night Vision infinitely (hide particles)\n/effect give @s night_vision infinite 0 true\n\n# Clear all effects\n/effect clear @s\n```\n\n### Fill (/fill)\n\nFills a region with a specific block.\n\n```mcfunction\n# Fill a 10x10x10 cube with stone\n/fill ~ ~ ~ ~10 ~10 ~10 stone\n\n# Replace only water with air (drain)\n/fill ~-5 ~-5 ~-5 ~5 ~5 ~5 air replace water\n\n# Create a hollow box of glass\n/fill ~ ~ ~ ~5 ~5 ~5 glass outline\n```\n\n### Setblock (/setblock)\n\nChanges a single block.\n\n```mcfunction\n# Place a torch at current location\n/setblock ~ ~ ~ torch\n\n# Destroy the block (drop item) and place stone\n/setblock ~ ~-1 ~ stone destroy\n```\n\n### Enchant (/enchant)\n\nEnchants the item currently held.\n\n```mcfunction\n# Add Sharpness V\n/enchant @s sharpness 5\n\n# Add Fortune III\n/enchant @s fortune 3\n```\n\n## Utility Commands\n\n### Locate (/locate)\n\nFinds the nearest structure or biome.\n\n```mcfunction\n# Find nearest village\n/locate structure village\n\n# Find nearest cherry grove\n/locate biome cherry_grove\n```\n\n### Kill (/kill)\n\nRemoves entities.\n\n```mcfunction\n# Kill yourself\n/kill @s\n\n# Kill all slimes\n/kill @e[type=slime]\n\n# Kill all items on the ground (cleanup)\n/kill @e[type=item]\n```\n\n### Seed (/seed)\n\nDisplays the world seed.\n\n```mcfunction\n/seed\n```\n"
  },
  {
    "path": "source/_posts/missive.md",
    "content": "---\ntitle: Missive\ndate: 2022-11-23 16:23:31.695283\nbackground: bg-[#3665e5]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 83 keyboard shortcuts found in Missive\n---\n\n## Keyboard Shortcuts\n\n### Navigation\n\n| Shortcut      | Action         |\n| ------------- | -------------- |\n| `Down`        | Next item      |\n| `Up`          | Previous item  |\n| `Alt` `Up`    | First item     |\n| `Alt` `Down`  | Last item      |\n| `Right`       | Open item      |\n| `Left`        | Collapse item  |\n| `Tab`         | Next scope     |\n| `Shift` `Tab` | Previous scope |\n| `PgUp`        | Scroll up      |\n| `PgDn`        | Scroll down    |\n\n{.shortcuts}\n\n### Selection\n\n| Shortcut             | Action                          |\n| -------------------- | ------------------------------- |\n| `Shift` `Up`         | Select next conversation        |\n| `Shift` `Down`       | Select previous conversation    |\n| `Alt` `Shift` `Up`   | Select until first conversation |\n| `Alt` `Shift` `Down` | Select until last conversation  |\n| `Ctrl` `A`           | Select all conversations        |\n\n{.shortcuts}\n\n### Application\n\n| Shortcut           | Action                            |\n| ------------------ | --------------------------------- |\n| `Ctrl` `N`         | Compose new email                 |\n| `Ctrl` `Shift` `N` | Create new conversation           |\n| `Ctrl` `F`         | Search                            |\n| `Ctrl` `Shift` `C` | Focus comment box                 |\n| `Ctrl` `Shift` `X` | Focus task box                    |\n| `Space`            | Preview item                      |\n| `Ctrl` `Up`        | Edit previous comment             |\n| `Ctrl` `Shift` `Y` | Set a status                      |\n| `Ctrl` `.`         | Open conversation contextual menu |\n| `Ctrl` `G`         | Open more menu                    |\n| `Ctrl` `L`         | Open location                     |\n| `Ctrl` `,`         | Open preferences                  |\n| `Ctrl` `Shift` `,` | Open contacts                     |\n| `Ctrl` `Alt` `S`   | Toggle right sidebar              |\n| `Ctrl` `Alt` `N`   | Main right sidebar action         |\n| `Ctrl` `Alt` `R`   | Reload                            |\n\n{.shortcuts}\n\n### Actions {.row-span-2}\n\n| Shortcut               | Action                       |\n| ---------------------- | ---------------------------- |\n| `Back`                 | Archive or remove label      |\n| `Alt` `Back`           | Close                        |\n| `Cmd` `Back`           | Trash                        |\n| `Ctrl` `Shift` `L`     | Label as...                  |\n| `Ctrl` `Alt` `L`       | Move to...                   |\n| `Ctrl` `Shift` `K`     | Assign                       |\n| `Ctrl` `Shift` `J`     | Snooze                       |\n| `Ctrl` `Shift` `S`     | Toggle star                  |\n| `Ctrl` `Shift` `M`     | Toggle watch                 |\n| `Ctrl` `R`             | Reply all                    |\n| `Ctrl` `Shift` `R`     | Reply                        |\n| `Ctrl` `Shift` `F`     | Forward                      |\n| `Ctrl` `Shift` `D`     | Open or focus draft          |\n| `Ctrl` `P`             | Print                        |\n| `Ctrl` `O`             | Open in new window           |\n| `Ctrl` `Z`             | Undo last action             |\n| `Ctrl` `Shift` `Z`     | Redo last action             |\n| `Ctrl` `Shift` `I`     | Mark as read                 |\n| `Ctrl` `Shift` `U`     | Mark as unread               |\n| `Ctrl` `Shift` `=`     | Mark as important            |\n| `Ctrl` `-`             | Mark as not important        |\n| `Ctrl` `Shift` `Right` | Expand entire conversation   |\n| `Ctrl` `Shift` `Left`  | Collapse entire conversation |\n| `Ctrl` `Shift` `'`     | Toggle message quote         |\n| `Ctrl` `Shift` `P`     | Pin to sidebar               |\n| `Ctrl` `Shift` `G`     | Merge...                     |\n\n{.shortcuts}\n\n### Composer\n\n| Shortcut               | Action             |\n| ---------------------- | ------------------ |\n| `Ctrl` `Enter`         | Send               |\n| `Ctrl` `Shift` `Enter` | Send and archive   |\n| `Ctrl` `D`             | Discard draft      |\n| `Ctrl` `Shift` `C`     | Add CC recipients  |\n| `Ctrl` `Shift` `B`     | Add BCC recipients |\n| `Ctrl` `K`             | Insert a link      |\n| `Ctrl` `Shift` `O`     | Open responses     |\n\n{.shortcuts}\n\n### Formatting\n\n| Shortcut           | Action             |\n| ------------------ | ------------------ |\n| `Ctrl` `Shift` `-` | Decrease text size |\n| `Ctrl` `Shift` `=` | Increase text size |\n| `Ctrl` `B`         | Bold               |\n| `Ctrl` `I`         | Italic             |\n| `Ctrl` `U`         | Underline          |\n| `Ctrl` `Shift` `7` | Numbered list      |\n| `Ctrl` `Shift` `8` | Bulleted list      |\n| `Ctrl` `[`         | Decrease indent    |\n| `Ctrl` `]`         | Increase indent    |\n\n{.shortcuts}\n\n### Calendar\n\n| Shortcut   | Action       |\n| ---------- | ------------ |\n| `Ctrl` `N` | Create event |\n| `Ctrl` `R` | Refresh      |\n| `Enter`    | View day     |\n| `T`        | Today        |\n| `Ctrl` `L` | Go to date   |\n| `D`        | Day view     |\n| `W`        | Week view    |\n| `M`        | Month view   |\n| `A`        | Agenda view  |\n\n{.shortcuts}\n\n### Jumping\n\n| Shortcut     | Action            |\n| ------------ | ----------------- |\n| `Ctrl` `1-9` | Go to Mailbox 1-9 |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Missive Team Inbox](https://missiveapp.com/help/keyboard-shortcuts) _(missiveapp.com)_\n"
  },
  {
    "path": "source/_posts/mitmproxy.md",
    "content": "---\ntitle: Mitmproxy\ndate: 2020-12-22 20:10:08\nbackground: bg-[#d86138]\ntags:\n  - capture\n  - traffic\n  - network\n  - utility\ncategories:\n  - Toolkit\nintro: |\n  [mitmproxy](https://mitmproxy.org/) is a free and open source interactive HTTPS proxy. This is a quick reference cheat sheet to the mitmproxy.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Usage {.col-span-2}\n\n| Option | Example                                            | Description                               |\n| ------ | -------------------------------------------------- | ----------------------------------------- |\n| `-p`   | mitmproxy -p 8001                                  | Start proxy on port 8001                  |\n| `-m`   | mitmproxy -p 8001 -m reverse:http://127.0.0.1:4000 | Reverse proxy on port 8001 to port 4000   |\n| `-w`   | mitmproxy -p 8001 -w traffic.mitm                  | Stream flows to file as they arrive       |\n| `-r`   | mitmproxy -r traffic.mitm                          | Read flows from file                      |\n| `-C`   | mitmproxy -C traffic.mitm                          | Replay client requests from a saved file  |\n| `-S`   | mitmproxy -S traffic.mitm                          | Replay server responses from a saved file |\n| `-s`   | mitmproxy -s myScript.py                           | Execute a script                          |\n| `-h`   | mitmproxy -h                                       | mitmproxy quick help                      |\n\n### Movement\n\n```\n        k                 Ctrl b\n        ▲                   ▲▲\n        │                   ││\nh ◀ ─── + ─── ▶ l           ││ page\n        │                   ││\n        ▼                   ▼▼\n        j             Ctrl f / Space\n```\n\n---\n\n| -                    | -                     |\n| -------------------- | --------------------- |\n| `h`, `j`, `k` ,`l`   | Left, Down, Up, Right |\n| `Ctrl` `b`           | Page up               |\n| `Space` / `Ctrl` `f` | Page down             |\n| `g` / `G`            | Go to beginning / end |\n| `Arrows`             | Up, Down, Left, Right |\n\n{.shortcuts}\n\n### Copy to Clipboard\n\nCommand Syntax:\n\n```\n:export.clip format flow\n```\n\n---\n\nExample:\n\n| Description                    | Command Example                    |\n| ------------------------------ | ---------------------------------- |\n| 1. Copy as a curl command      | `:export.clip curl @focus`         |\n| 2. Copy as a httpie            | `:export.clip httpie @focus`       |\n| 2. Copy as a raw               | `:export.clip raw @focus`          |\n| 2. Copy as a raw HTTP request  | `:export.clip raw_request @focus`  |\n| 2. Copy as a raw HTTP response | `:export.clip raw_response @focus` |\n\n{.style-list}\n\nExport a flow to the system clipboard.\n\n### Save to File\n\nCommand Syntax:\n\n```\n:export.file format flow path\n```\n\n---\n\nExample:\n\n| Description                  | Command Example                                    |\n| ---------------------------- | -------------------------------------------------- |\n| 1. Export to /tmp/a.curl     | `:export.file curl @focus /tmp/a.curl`             |\n| 2. Export to /tmp/a.httpie   | `:export.file httpie @focus /tmp/a.httpie`         |\n| 2. Export to /tmp/a.raw      | `:export.file raw @focus  /tmp/a.raw`              |\n| 2. Export to /tmp/a.request  | `:export.file raw_request @focus /tmp/a.request`   |\n| 2. Export to /tmp/a.response | `:export.file raw_response @focus /tmp/a.response` |\n\n{.style-list}\n\nExport a flow to the system clipboard.\n\n### Common Keybindings\n\n| -       | -                |\n| ------- | ---------------- |\n| `q`     | Back / Exit      |\n| `z`     | Clear flow list  |\n| `:`     | Command prompt   |\n| `E`     | View event log   |\n| `O`     | View options     |\n| `r`     | Replay this flow |\n| `Tab`   | Next             |\n| `Enter` | Select           |\n\n{.shortcuts}\n\n### Global Keybindings\n\n| -              | -                         |\n| -------------- | ------------------------- |\n| `-`            | Cycle to next layout      |\n| `?`            | View help                 |\n| `B`            | Start an attached browser |\n| `C`            | View commands             |\n| `I`            | Toggle intercept          |\n| `K`            | View key bindings         |\n| `P`            | View flow details         |\n| `Q`            | Exit immediately          |\n| `W`            | Stream to file            |\n| `i`            | Set intercept             |\n| `Ctrl` `right` | Focus next layout pane    |\n| `Shift` `tab`  | Focus next layout pane    |\n\n{.shortcuts}\n\n### Flow (View)\n\n| -               | -                            |\n| --------------- | ---------------------------- |\n| `A`             | Resume all intercepted flows |\n| `D`             | Duplicate flow               |\n| `F`             | Set focus follow             |\n| `L`             | Load flows from file         |\n| `M`             | Toggle viewing marked flows  |\n| `S`             | Start server replay          |\n| `U`             | Un-set all marks             |\n| `V`             | Revert changes to this flow  |\n| `X`             | Kill this flow               |\n| `Z`             | Purge all flows not showing  |\n| `a`             | Resume this intercepted flow |\n| `b`             | Save response body to file   |\n| `d`             | Delete flow from view        |\n| `e`             | Export this flow to file     |\n| `f`             | Set view filter              |\n| `m`             | Toggle mark on this flow     |\n| `n`             | Create a new flow            |\n| `o`             | Set flow list order          |\n| `r`             | Replay this flow             |\n| `v`             | Reverse flow list order      |\n| `w`             | Save listed flows to file    |\n| <code>\\|</code> | Run a script on this flow    |\n| `Ctrl` `l`      | Send cuts to clipboard       |\n\n{.shortcuts}\n\n## Mitmproxy Filter\n\n### Filter\n\n| -   | -                                     |\n| --- | ------------------------------------- |\n| `f` | Set view filter _(on flow view page)_ |\n\n{.shortcuts}\n\n---\n\n- [RegEX cheatsheet](/regex) _(cheatsheets.zip)_\n\nThe regex are Python-style, it can be specified as quoted strings\n\n### Operators\n\n| -       | -         |\n| ------- | --------- | --- |\n| `!`     | unary not |\n| `&`     | and       |\n| `       | `         | or  |\n| `(...)` | grouping  |\n\n### Expressions {.row-span-2}\n\n| -              | -                                                          |\n| -------------- | ---------------------------------------------------------- |\n| `~a`           | Match asset in response: CSS, Javascript, Flash, images.   |\n| `~b` `regex`   | Body                                                       |\n| `~bq` `regex`  | Request body                                               |\n| `~bs` `regex`  | Response body                                              |\n| `~c` `int`     | HTTP response code                                         |\n| `~d` `regex`   | Domain                                                     |\n| `~dst` `regex` | Match destination address                                  |\n| `~e`           | Match error                                                |\n| `~h` `regex`   | Header                                                     |\n| `~hq` `regex`  | Request header                                             |\n| `~hs` `regex`  | Response header                                            |\n| `~http`        | Match HTTP flows                                           |\n| `~m` `regex`   | Method                                                     |\n| `~marked`      | Match marked flows                                         |\n| `~q`           | Match request with no response                             |\n| `~s`           | Match response                                             |\n| `~src` `regex` | Match source address                                       |\n| `~t` `regex`   | Content-type header                                        |\n| `~tcp`         | Match TCP flows                                            |\n| `~tq` `regex`  | Request Content-Type header                                |\n| `~ts` `regex`  | Response Content-Type header                               |\n| `~u` `regex`   | URL                                                        |\n| `~websocket`   | Match WebSocket flows (and HTTP-WebSocket handshake flows) |\n\n### Flow selectors\n\nExpressions\n\n| -           | -                          |\n| ----------- | -------------------------- |\n| `@all     ` | All flows                  |\n| `@focus   ` | The currently focused flow |\n| `@shown   ` | All flows currently shown  |\n| `@hidden  ` | All flows currently hidden |\n| `@marked  ` | All marked flows           |\n| `@unmarked` | All unmarked flows         |\n\nmitmproxy has a set of convenient flow selectors that operate on the current view\n\n### Examples\n\nURL containing \"google.com\"\n\n```\ngoogle\\.com\n```\n\nRequests whose body contains the string \"test\"\n\n```\n~q ~b test\n```\n\nAnything but requests with a text/html content type:\n\n```\n!(~q & ~t \"text/html\")\n```\n\nReplace entire GET string in a request (quotes required to make it work):\n\n```\n\":~q ~m GET:.*:/replacement.html\"\n```\n\n## Mitmproxy Scripts {.cols-2}\n\n### Custom response\n\n```python\nfrom mitmproxy import http\n\n\ndef request(flow: http.HTTPFlow) -> None:\n    if flow.request.pretty_url == \"http://example.com/path\":\n        flow.response = http.HTTPResponse.make(\n            200,  # (optional) status code\n            b\"Hello World\",  # (optional) content\n            {\"Content-Type\": \"text/html\"}  # (optional) headers\n        )\n```\n\nSend a reply from the proxy without sending any data to the remote server\n\n### Add header\n\n```python\nclass AddHeader:\n    def __init__(self):\n        self.num = 0\n\n    def response(self, flow):\n        self.num = self.num + 1\n        flow.response.headers[\"count\"] = str(self.num)\n\n\naddons = [\n    AddHeader()\n]\n```\n\nAdd an HTTP header to each response\n\n## Also see\n\n- [mitmproxy addons](https://github.com/mitmproxy/mitmproxy/tree/master/examples/addons) _(github.com)_\n- [mitmproxy docs](https://docs.mitmproxy.org/) _(mitmproxy.org)_\n"
  },
  {
    "path": "source/_posts/monday.md",
    "content": "---\ntitle: Monday.com\ndate: 2022-11-23 16:23:31.694181\nbackground: bg-[#f7ce46]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 24 keyboard shortcuts found on Monday.com\n---\n\n## Keyboard Shortcuts\n\n### System\n\n| Shortcut   | Action                                    |\n| ---------- | ----------------------------------------- |\n| `Ctrl` `B` | Bolt Switch (quick switch between boards) |\n| `Esc`      | Close Item Page                           |\n| `Esc`      | Close Dialogs                             |\n| `Esc`      | Close Search                              |\n\n{.shortcuts}\n\n### Board I\n\n| Shortcut      | Action                   |\n| ------------- | ------------------------ |\n| `Down`        | Navigate Down            |\n| `Up`          | Navigate Up              |\n| `Left`        | Navigate Left            |\n| `Right`       | Navigate Right           |\n| `Tab`         | Navigate to Next Cell    |\n| `Shift` `Tab` | Navigate to Previous Tab |\n| `Enter`       | Edit Cell Content        |\n| `Backspace`   | Clear Cell Content       |\n| `Space`       | Open Column View         |\n\n{.shortcuts}\n\n### Board II\n\n| Shortcut           | Action                     |\n| ------------------ | -------------------------- |\n| `Ctrl` `F`         | Search Board               |\n| `Ctrl` `C`         | Copy Cell Content          |\n| `Ctrl` `V`         | Paste Cell Content         |\n| `Ctrl` `X`         | Cut Cell Content           |\n| `Ctrl` `Enter`     | Select Item                |\n| `Shift` `Enter`    | Select Range of Items      |\n| `Ctrl` `Shift` `G` | Create New Group           |\n| `Ctrl` `Shift` `C` | Create New Column          |\n| `Ctrl` `L`         | Open Activity Log          |\n| `Ctrl` `(click)`   | Sort Another Column        |\n| `Ctrl` `G`         | Collapse/Expand All Groups |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Monday.com](https://support.monday.com/hc/en-us/articles/115005339905-The-Spreadsheet-capabilities-shortcuts-)\n  _(support.monday.com)_\n"
  },
  {
    "path": "source/_posts/mongodb.md",
    "content": "---\ntitle: MongoDB\ndate: 2023-04-05\nbackground: bg-gradient-to-r from-green-900 via-green-600 to-green-400 hover:from-green-900 hover:via-green-700 hover:to-green-500\ntags:\n  - NoSQL\n  - DB\ncategories:\n  - Database\nintro:\n  The MongoDB cheat sheet provides you with the most commonly used MongoDB commands and queries for your reference. the\n  cheatsheet is from mongodb developers website\nplugins:\n  - tooltip\n  - copyCode\n---\n\n## Getting Started {.cols-2}\n\n### Connect MongoDB Shell\n\n```mongosh\nmongo # connects to mongodb://127.0.0.1:27017 by default\n```\n\n```mongosh\nmongo --host <host> --port <port> -u <user> -p <pwd> # omit the password if you want a prompt\n```\n\n```mongosh\nmongo \"mongodb://192.168.1.1:27017\"\n```\n\n```mongosh\nmongo \"mongodb+srv://cluster-name.abcde.mongodb.net/<dbname>\" --username <username> # MongoDB Atlas\n```\n\n### Helpers\n\nShow dbs :\n\n```mongosh\ndb // prints the current database\n```\n\nSwitch database :\n\n```mongosh\nuse <database_name>\n```\n\nShow collections :\n\n```mongosh\nshow collections\n```\n\nRun JavaScript file :\n\n```mongosh\nload(\"myScript.js\")\n```\n\n---\n\n## Crud\n\n### Create\n\n```mongosh\ndb.coll.insertOne({name: \"Max\"})\ndb.coll.insertMany([{name: \"Max\"}, {name:\"Alex\"}]) // ordered bulk insert\ndb.coll.insertMany([{name: \"Max\"}, {name:\"Alex\"}], {ordered: false}) // unordered bulk insert\ndb.coll.insertOne({date: ISODate()})\ndb.coll.insertMany({name: \"Max\"}, {\"writeConcern\": {\"w\": \"majority\", \"wtimeout\": 5000}})\n```\n\n### Delete\n\n```mongosh\ndb.coll.deleteOne({name: \"Max\"})\ndb.coll.deleteMany( $and: [{name: \"Max\"}, {justOne: true}]) //delete all entries which contain both values\ndb.coll.deleteMany( $or: [{name: \"Max\"}, {justOne: true}])  //delete all entries which contain any of the specified values\ndb.coll.deleteMany({}) // WARNING! Deletes all the docs but not the collection itself and its index definitions\ndb.coll.deleteMany({name: \"Max\"}, {\"writeConcern\": {\"w\": \"majority\", \"wtimeout\": 5000}})\ndb.coll.findOneAndDelete({\"name\": \"Max\"})\n```\n\n### Update\n\n```mongosh\ndb.coll.updateMany({\"_id\": 1}, {$set: {\"year\": 2016}}) // WARNING! Replaces the entire document where \"_id\" = 1\ndb.coll.updateOne({\"_id\": 1}, {$set: {\"year\": 2016, name: \"Max\"}})\ndb.coll.updateOne({\"_id\": 1}, {$unset: {\"year\": 1}})\ndb.coll.updateOne({\"_id\": 1}, {$rename: {\"year\": \"date\"} })\ndb.coll.updateOne({\"_id\": 1}, {$inc: {\"year\": 5}})\ndb.coll.updateOne({\"_id\": 1}, {$mul: {price: 2}})\ndb.coll.updateOne({\"_id\": 1}, {$min: {\"imdb\": 5}})\ndb.coll.updateOne({\"_id\": 1}, {$max: {\"imdb\": 8}})\ndb.coll.updateMany({\"_id\": {$lt: 10}}, {$set: {\"lastModified\": ISODate()}})\n```\n\n### Array {.row-span-2}\n\n```mongosh\ndb.coll.updateOne({\"_id\": 1}, {$push :{\"array\": 1}})\ndb.coll.updateOne({\"_id\": 1}, {$pull :{\"array\": 1}})\ndb.coll.updateOne({\"_id\": 1}, {$addToSet :{\"array\": 2}})\ndb.coll.updateOne({\"_id\": 1}, {$pop: {\"array\": 1}})  // last element\ndb.coll.updateOne({\"_id\": 1}, {$pop: {\"array\": -1}}) // first element\ndb.coll.updateOne({\"_id\": 1}, {$pullAll: {\"array\" :[3, 4, 5]}})\ndb.coll.updateOne({\"_id\": 1}, {$push: {scores: {$each: [90, 92, 85]}}})\ndb.coll.updateOne({\"_id\": 1, \"grades\": 80}, {$set: {\"grades.$\": 82}})\ndb.coll.updateMany({}, {$inc: {\"grades.$[]\": 10}})\ndb.coll.updateMany({}, {$set: {\"grades.$[element]\": 100}}, {arrayFilters: [{\"element\": {$gte: 100}}]})\n```\n\n### Update many {.row-span-1}\n\n```mongosh\ndb.coll.updateMany({\"year\": 1999}, {$set: {\"decade\": \"90's\"}})\n```\n\n### FindOneAndUpdate {.row-span-1}\n\n```mongosh\ndb.coll.findOneAndUpdate({\"name\": \"Max\"}, {$inc: {\"points\": 5}}, {returnNewDocument: true})\n```\n\n### Upsert {.row-span-1}\n\n```mongosh\ndb.coll.updateOne({\"_id\": 1}, {$set: {item: \"apple\"}, $setOnInsert: {defaultQty: 100}}, {upsert: true})\n```\n\n### Replace {.row-span-1}\n\n```mongosh\ndb.coll.replaceOne({\"name\": \"Max\"}, {\"firstname\": \"Maxime\", \"surname\": \"Beugnet\"})\n```\n\n### Write concern {.row-span-1}\n\n```mongosh\ndb.coll.updateMany({}, {$set: {\"x\": 1}}, {\"writeConcern\": {\"w\": \"majority\", \"wtimeout\": 5000}})\n```\n\n### Find {.row-span-2}\n\n```mongosh\ndb.coll.findOne() // returns a single document\ndb.coll.find()    // returns a cursor - show 20 results - \"it\" to display more\ndb.coll.find().pretty()\ndb.coll.find({name: \"Max\", age: 32}) // implicit logical \"AND\".\ndb.coll.find({date: ISODate(\"2020-09-25T13:57:17.180Z\")})\ndb.coll.find({name: \"Max\", age: 32}).explain(\"executionStats\") // or \"queryPlanner\" or \"allPlansExecution\"\ndb.coll.distinct(\"name\")\n```\n\n### Count\n\n```mongosh\ndb.coll.estimatedDocumentCount()  // estimation based on collection metadata\ndb.coll.countDocuments({age: 32}) // alias for an aggregation pipeline - accurate count\n```\n\n### Comparison\n\n```mongosh\ndb.coll.find({\"year\": {$gt: 1970}})\ndb.coll.find({\"year\": {$gte: 1970}})\ndb.coll.find({\"year\": {$lt: 1970}})\ndb.coll.find({\"year\": {$lte: 1970}})\ndb.coll.find({\"year\": {$ne: 1970}})\ndb.coll.find({\"year\": {$in: [1958, 1959]}})\ndb.coll.find({\"year\": {$nin: [1958, 1959]}})\n```\n\n### Logical\n\n```mongosh\ndb.coll.find({name:{$not: {$eq: \"Max\"}}})\ndb.coll.find({$or: [{\"year\" : 1958}, {\"year\" : 1959}]})\ndb.coll.find({$nor: [{price: 1.99}, {sale: true}]})\ndb.coll.find({\n$and: [\n    {$or: [{qty: {$lt :10}}, {qty :{$gt: 50}}]},\n{$or: [{sale: true}, {price: {$lt: 5 }}]}\n]\n})\n```\n\n### Element\n\n```mongosh\ndb.coll.find({name: {$exists: true}})\ndb.coll.find({\"zipCode\": {$type: 2 }})\ndb.coll.find({\"zipCode\": {$type: \"string\"}})\n```\n\n### Aggregation Pipeline\n\n```mongosh\ndb.coll.aggregate([\n{$match: {status: \"A\"}},\n{$group: {_id: \"$cust_id\", total: {$sum: \"$amount\"}}},\n{$sort: {total: -1}}\n])\n```\n\n### Text search with a \"text\" index\n\n```mongosh\ndb.coll.find({$text: {$search: \"cake\"}}, {score: {$meta: \"textScore\"}}).sort({score: {$meta: \"textScore\"}})\n```\n\n### Regex\n\n```mongosh\ndb.coll.find({name: /^Max/}) // regex: starts by letter \"M\"\ndb.coll.find({name: /^Max$/i}) // regex case insensitive\n```\n\n### Array\n\n```mongosh\ndb.coll.find({tags: {$all: [\"Realm\", \"Charts\"]}})\ndb.coll.find({field: {$size: 2}}) // impossible to index - prefer storing the size of the array & update it\ndb.coll.find({results: {$elemMatch: {product: \"xyz\", score: {$gte: 8}}}})\n```\n\n### Projections\n\n```mongosh\ndb.coll.find({\"x\": 1}, {\"actors\": 1}) // actors + \\_id\ndb.coll.find({\"x\": 1}, {\"actors\": 1, \"\\_id\": 0}) // actors\ndb.coll.find({\"x\": 1}, {\"actors\": 0, \"summary\": 0}) // all but \"actors\" and \"summary\"\n```\n\n### Sort, skip, limit\n\n```mongosh\ndb.coll.find({}).sort({\"year\": 1, \"rating\": -1}).skip(10).limit(3)\n```\n\n### Read Concern\n\n```mongosh\ndb.coll.find().readConcern(\"majority\")\n```\n\n## Databases and Collections {.cols-2}\n\n### Drop {.row-span-1}\n\n```mongosh\ndb.coll.drop()    // removes the collection and its index definitions\ndb.dropDatabase() // double check that you are *NOT* on the PROD cluster... :-)\n```\n\n### Create Collection {.row-span-2}\n\n```mongosh\ndb.createCollection(\"contacts\", {\n   validator: {$jsonSchema: {\n      bsonType: \"object\",\n      required: [\"phone\"],\n      properties: {\n         phone: {\n            bsonType: \"string\",\n            description: \"must be a string and is required\"\n         },\n         email: {\n            bsonType: \"string\",\n            pattern: \"@mongodb\\.com$\",\n            description: \"must be a string and match the regular expression pattern\"\n         },\n         status: {\n            enum: [ \"Unknown\", \"Incomplete\" ],\n            description: \"can only be one of the enum values\"\n         }\n      }\n   }}\n})\n```\n\n### Other Collection Functions {.row-span-1}\n\n```mongosh\ndb.coll.stats()\ndb.coll.storageSize()\ndb.coll.totalIndexSize()\ndb.coll.totalSize()\ndb.coll.validate({full: true})\ndb.coll.renameCollection(\"new_coll\", true) // 2nd parameter to drop the target collection if exists\n```\n\n## Indexes {.cols-2}\n\n### Basics\n\n#### List\n\n```mongosh\ndb.coll.getIndexes()\ndb.coll.getIndexKeys()\n```\n\n#### Drop Indexes\n\n```mongosh\ndb.coll.dropIndex(\"name_1\")\n```\n\n#### Hide/Unhide Indexes\n\n```mongosh\ndb.coll.hideIndex(\"name_1\")\ndb.coll.unhideIndex(\"name_1\")\n```\n\n### Create Indexes\n\n```mongosh\n// Index Types\ndb.coll.createIndex({\"name\": 1})                // single field index\ndb.coll.createIndex({\"name\": 1, \"date\": 1})     // compound index\ndb.coll.createIndex({foo: \"text\", bar: \"text\"}) // text index\ndb.coll.createIndex({\"$**\": \"text\"})            // wildcard text index\ndb.coll.createIndex({\"userMetadata.$**\": 1})    // wildcard index\ndb.coll.createIndex({\"loc\": \"2d\"})              // 2d index\ndb.coll.createIndex({\"loc\": \"2dsphere\"})        // 2dsphere index\ndb.coll.createIndex({\"_id\": \"hashed\"})          // hashed index\n\n// Index Options\ndb.coll.createIndex({\"lastModifiedDate\": 1}, {expireAfterSeconds: 3600})      // TTL index\ndb.coll.createIndex({\"name\": 1}, {unique: true})\ndb.coll.createIndex({\"name\": 1}, {partialFilterExpression: {age: {$gt: 18}}}) // partial index\ndb.coll.createIndex({\"name\": 1}, {collation: {locale: 'en', strength: 1}})    // case insensitive index with strength = 1 or 2\ndb.coll.createIndex({\"name\": 1 }, {sparse: true})\n```\n\n## Others {.cols-2}\n\n### Handy commands {.row-span-3}\n\n```mongosh\nuse admin\ndb.createUser({\"user\": \"root\", \"pwd\": passwordPrompt(), \"roles\": [\"root\"]})\ndb.dropUser(\"root\")\ndb.auth( \"user\", passwordPrompt() )\n\nuse test\ndb.getSiblingDB(\"dbname\")\ndb.currentOp()\ndb.killOp(123) // opid\n\ndb.fsyncLock()\ndb.fsyncUnlock()\n\ndb.getCollectionNames()\ndb.getCollectionInfos()\ndb.printCollectionStats()\ndb.stats()\n\ndb.getReplicationInfo()\ndb.printReplicationInfo()\ndb.isMaster()\ndb.hostInfo()\ndb.printShardingStatus()\ndb.shutdownServer()\ndb.serverStatus()\n\ndb.setSlaveOk()\ndb.getSlaveOk()\n\ndb.getProfilingLevel()\ndb.getProfilingStatus()\ndb.setProfilingLevel(1, 200) // 0 == OFF, 1 == ON with slowms, 2 == ON\n\ndb.enableFreeMonitoring()\ndb.disableFreeMonitoring()\ndb.getFreeMonitoringStatus()\n\ndb.createView(\"viewName\", \"sourceColl\", [{$project:{department: 1}}])\n```\n\n### Replica Set {.row-span-2}\n\n```mongosh\nrs.status()\nrs.initiate({\"_id\": \"replicaTest\",\n  members: [\n    { _id: 0, host: \"127.0.0.1:27017\" },\n    { _id: 1, host: \"127.0.0.1:27018\" },\n    { _id: 2, host: \"127.0.0.1:27019\", arbiterOnly:true }]\n})\nrs.add(\"mongodbd1.example.net:27017\")\nrs.addArb(\"mongodbd2.example.net:27017\")\nrs.remove(\"mongodbd1.example.net:27017\")\nrs.conf()\nrs.isMaster()\nrs.printReplicationInfo()\nrs.printSlaveReplicationInfo()\nrs.reconfig(<valid_conf>)\nrs.slaveOk()\nrs.stepDown(20, 5) // (stepDownSecs, secondaryCatchUpPeriodSecs)\n```\n\n### Sharded Cluster {.row-span-2}\n\n```mongosh\nsh.status()\nsh.addShard(\"rs1/mongodbd1.example.net:27017\")\nsh.shardCollection(\"mydb.coll\", {zipcode: 1})\n\nsh.moveChunk(\"mydb.coll\", { zipcode: \"53187\" }, \"shard0019\")\nsh.splitAt(\"mydb.coll\", {x: 70})\nsh.splitFind(\"mydb.coll\", {x: 70})\nsh.disableAutoSplit()\nsh.enableAutoSplit()\n\nsh.startBalancer()\nsh.stopBalancer()\nsh.disableBalancing(\"mydb.coll\")\nsh.enableBalancing(\"mydb.coll\")\nsh.getBalancerState()\nsh.setBalancerState(true/false)\nsh.isBalancerRunning()\n\nsh.addTagRange(\"mydb.coll\", {state: \"NY\", zip: MinKey }, { state: \"NY\", zip: MaxKey }, \"NY\")\nsh.removeTagRange(\"mydb.coll\", {state: \"NY\", zip: MinKey }, { state: \"NY\", zip: MaxKey }, \"NY\")\nsh.addShardTag(\"shard0000\", \"NYC\")\nsh.removeShardTag(\"shard0000\", \"NYC\")\n\nsh.addShardToZone(\"shard0000\", \"JFK\")\nsh.removeShardFromZone(\"shard0000\", \"NYC\")\nsh.removeRangeFromZone(\"mydb.coll\", {a: 1, b: 1}, {a: 10, b: 10})\n```\n\n### Change Streams {.row-span-1}\n\n```mongosh\nwatchCursor = db.coll.watch( [ { $match : {\"operationType\" : \"insert\" } } ] )\n\nwhile (!watchCursor.isExhausted()){\n   if (watchCursor.hasNext()){\n      print(tojson(watchCursor.next()));\n   }\n}\n```\n"
  },
  {
    "path": "source/_posts/mysql.md",
    "content": "---\ntitle: MySQL\ndate: 2020-12-16 18:28:43\nbackground: bg-[#2a6387]\ntags:\n  - RDBMS\n  - DB\ncategories:\n  - Database\nintro: The SQL cheat sheet provides you with the most commonly used SQL statements for your reference.\nplugins:\n  - tooltip\n  - copyCode\n---\n\n## Getting Started {.cols-2}\n\n### Connect MySQL\n\n```\nmysql -u <user> -p\n\nmysql [db_name]\n\nmysql -h <host> -P <port> -u <user> -p [db_name]\n\nmysql -h <host> -u <user> -p [db_name]\n```\n\n### Commons {.row-span-2}\n\n#### Database\n\n| -                        | -               |\n| ------------------------ | --------------- |\n| `CREATE DATABASE` db `;` | Create database |\n| `SHOW DATABASES;`        | List databases  |\n| `USE` db`;`              | Switch to db    |\n| `CONNECT` db `;`         | Switch to db    |\n| `DROP DATABASE` db`;`    | Delete db       |\n\n#### Table\n\n| -                        | -                          |\n| ------------------------ | -------------------------- |\n| `SHOW TABLES;`           | List tables for current db |\n| `SHOW FIELDS FROM` t`;`  | List fields for a table    |\n| `DESC` t`;`              | Show table structure       |\n| `SHOW CREATE TABLE `t`;` | Show create table sql      |\n| `TRUNCATE TABLE `t`;`    | Remove all data in a table |\n| `DROP TABLE `t`;`        | Delete table               |\n\n#### Process\n\n| -                   | -              |\n| ------------------- | -------------- |\n| `show processlist;` | List processes |\n| `kill` pid`;`       | kill process   |\n\n#### Other\n\n| -              | -                  |\n| -------------- | ------------------ |\n| `exit` or `\\q` | Exit MySQL session |\n\n### Backups\n\nCreate a backup\n\n```sql\nmysqldump -u user -p db_name > db.sql\n```\n\nExport db without schema\n\n```{.wrap}\nmysqldump -u user -p db_name --no-data=true --add-drop-table=false > db.sql\n```\n\nRestore a backup\n\n```\nmysql -u user -p db_name < db.sql\n```\n\n## MySQL Examples\n\n### Managing tables\n\nCreate a new table with three columns\n\n```sql\nCREATE TABLE t (\n     id    INT,\n     name  VARCHAR DEFAULT NOT NULL,\n     price INT DEFAULT 0\n     PRIMARY KEY(id)\n);\n```\n\nDelete the table from the database\n\n```sql\nDROP TABLE t ;\n```\n\nAdd a new column to the table\n\n```sql\nALTER TABLE t ADD column;\n```\n\nDrop column c from the table\n\n```sql\nALTER TABLE t DROP COLUMN c ;\n```\n\nAdd a constraint\n\n```sql\nALTER TABLE t ADD constraint;\n```\n\nDrop a constraint\n\n```sql\nALTER TABLE t DROP constraint;\n```\n\nRename a table from t1 to t2\n\n```sql\nALTER TABLE t1 RENAME TO t2;\n```\n\nRename column c1 to c2\n\n```sql\nALTER TABLE t1 RENAME c1 TO c2 ;\n```\n\nRemove all data in a table\n\n```sql\nTRUNCATE TABLE t;\n```\n\n### Querying data from a table\n\nQuery data in columns c1, c2 from a table\n\n```sql\nSELECT c1, c2 FROM t\n```\n\nQuery all rows and columns from a table\n\n```sql\nSELECT * FROM t\n```\n\nQuery data and filter rows with a condition\n\n```sql\nSELECT c1, c2 FROM t\nWHERE condition\n```\n\nQuery distinct rows from a table\n\n```sql\nSELECT DISTINCT c1 FROM t\nWHERE condition\n```\n\nSort the result set in ascending or descending order\n\n```sql\nSELECT c1, c2 FROM t\nORDER BY c1 ASC [DESC]\n```\n\nSkip offset of rows and return the next n rows\n\n```sql\nSELECT c1, c2 FROM t\nORDER BY c1\nLIMIT n OFFSET offset\n```\n\nGroup rows using an aggregate function\n\n```sql\nSELECT c1, aggregate(c2)\nFROM t\nGROUP BY c1\n```\n\nFilter groups using HAVING clause\n\n```sql\nSELECT c1, aggregate(c2)\nFROM t\nGROUP BY c1\nHAVING condition\n```\n\n### Querying from multiple tables {.row-span-2}\n\nInner join t1 and t2\n\n```sql\nSELECT c1, c2\nFROM t1\nINNER JOIN t2 ON condition\n```\n\nLeft join t1 and t1\n\n```sql\nSELECT c1, c2\nFROM t1\nLEFT JOIN t2 ON condition\n```\n\nRight join t1 and t2\n\n```sql\nSELECT c1, c2\nFROM t1\nRIGHT JOIN t2 ON condition\n```\n\nPerform full outer join\n\n```sql\nSELECT c1, c2\nFROM t1\nFULL OUTER JOIN t2 ON condition\n```\n\nProduce a Cartesian product of rows in tables\n\n```sql\nSELECT c1, c2\nFROM t1\nCROSS JOIN t2\n```\n\nAnother way to perform cross join\n\n```sql\nSELECT c1, c2\nFROM t1, t2\n```\n\nJoin t1 to itself using INNER JOIN clause\n\n```sql\nSELECT c1, c2\nFROM t1 A\nINNER JOIN t1 B ON condition\n```\n\nUsing SQL Operators Combine rows from two queries\n\n```sql\nSELECT c1, c2 FROM t1\nUNION [ALL]\nSELECT c1, c2 FROM t2\n```\n\nReturn the intersection of two queries\n\n```sql\nSELECT c1, c2 FROM t1\nINTERSECT\nSELECT c1, c2 FROM t2\n```\n\nSubtract a result set from another result set\n\n```sql\nSELECT c1, c2 FROM t1\nMINUS\nSELECT c1, c2 FROM t2\n```\n\nQuery rows using pattern matching %, \\_\n\n```sql\nSELECT c1, c2 FROM t1\nWHERE c1 [NOT] LIKE pattern\n```\n\nQuery rows in a list\n\n```sql\nSELECT c1, c2 FROM t\nWHERE c1 [NOT] IN value_list\n```\n\nQuery rows between two values\n\n```sql\nSELECT c1, c2 FROM t\nWHERE  c1 BETWEEN low AND high\n```\n\nCheck if values in a table is NULL or not\n\n```sql\nSELECT c1, c2 FROM t\nWHERE  c1 IS [NOT] NULL\n```\n\n### Using SQL constraints\n\nSet c1 and c2 as a primary key\n\n```sql\nCREATE TABLE t(\n    c1 INT, c2 INT, c3 VARCHAR,\n    PRIMARY KEY (c1,c2)\n);\n```\n\nSet c2 column as a foreign key\n\n```sql\nCREATE TABLE t1(\n    c1 INT PRIMARY KEY,\n    c2 INT,\n    FOREIGN KEY (c2) REFERENCES t2(c2)\n);\n```\n\nMake the values in c1 and c2 unique\n\n```sql\nCREATE TABLE t(\n    c1 INT, c1 INT,\n    UNIQUE(c2,c3)\n);\n```\n\nEnsure c1 > 0 and values in c1 >= c2\n\n```sql\nCREATE TABLE t(\n  c1 INT, c2 INT,\n  CHECK(c1> 0 AND c1 >= c2)\n);\n```\n\nSet values in c2 column not NULL\n\n```sql\nCREATE TABLE t(\n     c1 INT PRIMARY KEY,\n     c2 VARCHAR NOT NULL\n);\n```\n\n### Modifying Data\n\nInsert one row into a table\n\n```sql\nINSERT INTO t(column_list)\nVALUES(value_list);\n```\n\nInsert multiple rows into a table\n\n```sql\nINSERT INTO t(column_list)\nVALUES (value_list),\n       (value_list), …;\n```\n\nInsert rows from t2 into t1\n\n```sql\nINSERT INTO t1(column_list)\nSELECT column_list\nFROM t2;\n```\n\nUpdate new value in the column c1 for all rows\n\n```sql\nUPDATE t\nSET c1 = new_value;\n```\n\nUpdate values in the column c1, c2 that match the condition\n\n```sql\nUPDATE t\nSET c1 = new_value,\n        c2 = new_value\nWHERE condition;\n```\n\nDelete all data in a table\n\n```sql\nDELETE FROM t;\n```\n\nDelete subset of rows in a table\n\n```sql\nDELETE FROM t\nWHERE condition;\n```\n\n### Managing Views\n\nCreate a new view that consists of c1 and c2\n\n```sql\nCREATE VIEW v(c1,c2)\nAS\nSELECT c1, c2\nFROM t;\n```\n\nCreate a new view with check option\n\n```sql\nCREATE VIEW v(c1,c2)\nAS\nSELECT c1, c2\nFROM t;\nWITH [CASCADED | LOCAL] CHECK OPTION;\n```\n\nCreate a recursive view\n\n```sql\nCREATE RECURSIVE VIEW v\nAS\nselect-statement -- anchor part\nUNION [ALL]\nselect-statement; -- recursive part\n```\n\nCreate a temporary view\n\n```sql\nCREATE TEMPORARY VIEW v\nAS\nSELECT c1, c2\nFROM t;\n```\n\nDelete a view\n\n```sql\nDROP VIEW view_name;\n```\n\n### Managing triggers\n\nCreate or modify a trigger\n\n```sql\nCREATE OR MODIFY TRIGGER trigger_name\nWHEN EVENT\nON table_name TRIGGER_TYPE\nEXECUTE stored_procedure;\n```\n\n#### WHEN\n\n| -        | -                              |\n| -------- | ------------------------------ |\n| `BEFORE` | invoke before the event occurs |\n| `AFTER`  | invoke after the event occurs  |\n\n#### EVENT\n\n| -        | -                 |\n| -------- | ----------------- |\n| `INSERT` | invoke for INSERT |\n| `UPDATE` | invoke for UPDATE |\n| `DELETE` | invoke for DELETE |\n\n#### TRIGGER_TYPE\n\n| -                    | -   |\n| -------------------- | --- |\n| `FOR EACH ROW`       |     |\n| `FOR EACH STATEMENT` |     |\n\n### Managing indexes\n\nCreate an index on c1 and c2 of the t table\n\n```sql\nCREATE INDEX idx_name\nON t(c1,c2);\n```\n\nCreate a unique index on c3, c4 of the t table\n\n```sql\nCREATE UNIQUE INDEX idx_name\nON t(c3,c4)\n```\n\nDrop an index\n\n```sql\nDROP INDEX idx_name ON t;\n```\n\n## MySQL Data Types\n\n### Strings\n\n| -            | -                           |\n| ------------ | --------------------------- |\n| `CHAR`       | String (0 - 255)            |\n| `VARCHAR`    | String (0 - 255)            |\n| `TINYTEXT`   | String (0 - 255)            |\n| `TEXT`       | String (0 - 65535)          |\n| `BLOB`       | String (0 - 65535)          |\n| `MEDIUMTEXT` | String (0 - 16777215)       |\n| `MEDIUMBLOB` | String (0 - 16777215)       |\n| `LONGTEXT`   | String (0 - 429496­7295)    |\n| `LONGBLOB`   | String (0 - 429496­7295)    |\n| `ENUM`       | One of preset options       |\n| `SET`        | Selection of preset options |\n\n### Date & time\n\n| Data Type   | Format              |\n| ----------- | ------------------- |\n| `DATE     ` | yyyy-MM-dd          |\n| `TIME     ` | hh:mm:ss            |\n| `DATETIME ` | yyyy-MM-dd hh:mm:ss |\n| `TIMESTAMP` | yyyy-MM-dd hh:mm:ss |\n| `YEAR     ` | yyyy                |\n\n### Numeric\n\n| -             | -                                                             |\n| ------------- | ------------------------------------------------------------- |\n| `TINYINT x`   | Integer (-128 to 127)                                         |\n| `SMALLINT x`  | Integer (-32768 to 32767)                                     |\n| `MEDIUMINT x` | Integer (-8388608 to 8388607)                                 |\n| `INT x`       | Integer (-2147­483648 to 214748­3647)                         |\n| `BIGINT x`    | Integer (-9223­372­036­854­775808 to 922337­203­685­477­5807) |\n| `FLOAT`       | Decimal (precise to 23 digits)                                |\n| `DOUBLE`      | Decimal (24 to 53 digits)                                     |\n| `DECIMAL`     | \"­DOU­BLE­\" stored as string                                  |\n\n## MySQL Functions & Operators\n\n### Strings {.row-span-2}\n\n<!-- prettier-ignore -->\n- [ASCII()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_ascii){data-tooltip=\"Return numeric value of left-most character\"}\n- [BIN()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_bin){data-tooltip=\"Return a string containing binary representation of a number\"}\n- [BIT_LENGTH()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_bit-length){data-tooltip=\"Return length of argument in bits\"}\n- [CHAR()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char){data-tooltip=\"Return the character for each integer passed\"}\n- [CHARACTER_LENGTH()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_character-length){data-tooltip=\"Synonym for CHAR_LENGTH()\"}\n- [CHAR_LENGTH()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char-length){data-tooltip=\"Return number of characters in argument\"}\n- [CONCAT()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_concat){data-tooltip=\"Return concatenated string\"}\n- [CONCAT_WS()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_concat-ws){data-tooltip=\"Return concatenate with separator\"}\n- [ELT()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_elt){data-tooltip=\"Return string at index number\"}\n- [EXPORT_SET()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_export-set){data-tooltip=\"Return a string such that for every bit set in the value bits, you get an on string and for every unset bit, you get an off string\"}\n- [FIELD()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_field){data-tooltip=\"Index (position) of first argument in subsequent arguments\"}\n- [FIND_IN_SET()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_find-in-set){data-tooltip=\"Index (position) of first argument within second argument\"}\n- [FORMAT()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_format){data-tooltip=\"Return a number formatted to specified number of decimal places\"}\n- [FROM_BASE64()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_from-base64){data-tooltip=\"Decode base64 encoded string and return result\"}\n- [HEX()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_hex){data-tooltip=\"Hexadecimal representation of decimal or string value\"}\n- [INSERT()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_insert){data-tooltip=\"Insert substring at specified position up to specified number of characters\"}\n- [INSTR()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_instr){data-tooltip=\"Return the index of the first occurrence of substring\"}\n- [LCASE()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_lcase){data-tooltip=\"Synonym for LOWER()\"}\n- [LEFT()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_left){data-tooltip=\"Return the leftmost number of characters as specified\"}\n- [LENGTH()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_length){data-tooltip=\"Return the length of a string in bytes\"}\n- [LIKE](https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html#operator_like){data-tooltip=\"Simple pattern matching\"}\n- [LOAD_FILE()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_load-file){data-tooltip=\"Load the named file\"}\n- [LOCATE()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_locate){data-tooltip=\"Return the position of the first occurrence of substring\"}\n- [LOWER()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_lower){data-tooltip=\"Return the argument in lowercase\"}\n- [LPAD()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_lpad){data-tooltip=\"Return the string argument, left-padded with the specified string\"}\n- [LTRIM()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_ltrim){data-tooltip=\"Remove leading spaces\"}\n- [MAKE_SET()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_make-set){data-tooltip=\"Return a set of comma-separated strings that have the corresponding bit in bits set\"}\n- [MATCH](https://dev.mysql.com/doc/refman/8.0/en/fulltext-search.html#function_match){data-tooltip=\"Perform full-text search\"}\n- [MID()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_mid){data-tooltip=\"Return a substring starting from the specified position\"}\n- [NOT LIKE](https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html#operator_not-like){data-tooltip=\"Negation of simple pattern matching\"}\n- [NOT REGEXP](https://dev.mysql.com/doc/refman/8.0/en/regexp.html#operator_not-regexp){data-tooltip=\"Negation of REGEXP\"}\n- [OCT()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_oct){data-tooltip=\"Return a string containing octal representation of a number\"}\n- [OCTET_LENGTH()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_octet-length){data-tooltip=\"Synonym for LENGTH()\"}\n- [ORD()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_ord){data-tooltip=\"Return character code for leftmost character of the argument\"}\n- [POSITION()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_position){data-tooltip=\"Synonym for LOCATE()\"}\n- [QUOTE()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_quote){data-tooltip=\"Escape the argument for use in an SQL statement\"}\n- [REGEXP](https://dev.mysql.com/doc/refman/8.0/en/regexp.html#operator_regexp){data-tooltip=\"Whether string matches regular expression\"}\n- [REGEXP_INSTR()](https://dev.mysql.com/doc/refman/8.0/en/regexp.html#function_regexp-instr){data-tooltip=\"Starting index of substring matching regular expression\"}\n- [REGEXP_LIKE()](https://dev.mysql.com/doc/refman/8.0/en/regexp.html#function_regexp-like){data-tooltip=\"Whether string matches regular expression\"}\n- [REGEXP_REPLACE()](https://dev.mysql.com/doc/refman/8.0/en/regexp.html#function_regexp-replace){data-tooltip=\"Replace substrings matching regular expression\"}\n- [REGEXP_SUBSTR()](https://dev.mysql.com/doc/refman/8.0/en/regexp.html#function_regexp-substr){data-tooltip=\"Return substring matching regular expression\"}\n- [REPEAT()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_repeat){data-tooltip=\"Repeat a string the specified number of times\"}\n- [REPLACE()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_replace){data-tooltip=\"Replace occurrences of a specified string\"}\n- [REVERSE()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_reverse){data-tooltip=\"Reverse the characters in a string\"}\n- [RIGHT()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_right){data-tooltip=\"Return the specified rightmost number of characters\"}\n- [RLIKE](https://dev.mysql.com/doc/refman/8.0/en/regexp.html#operator_regexp){data-tooltip=\"Whether string matches regular expression\"}\n- [RPAD()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_rpad){data-tooltip=\"Append string the specified number of times\"}\n- [RTRIM()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_rtrim){data-tooltip=\"Remove trailing spaces\"}\n- [SOUNDEX()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_soundex){data-tooltip=\"Return a soundex string\"}\n- [SOUNDS LIKE](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#operator_sounds-like){data-tooltip=\"Compare sounds\"}\n- [SPACE()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_space){data-tooltip=\"Return a string of the specified number of spaces\"}\n- [STRCMP()](https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html#function_strcmp){data-tooltip=\"Compare two strings\"}\n- [SUBSTR()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_substr){data-tooltip=\"Return the substring as specified\"}\n- [SUBSTRING()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_substring){data-tooltip=\"Return the substring as specified\"}\n- [SUBSTRING_INDEX()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_substring-index){data-tooltip=\"Return a substring from a string before the specified number of occurrences of the delimiter\"}\n- [TO_BASE64()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_to-base64){data-tooltip=\"Return the argument converted to a base-64 string\"}\n- [TRIM()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_trim){data-tooltip=\"Remove leading and trailing spaces\"}\n- [UCASE()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_ucase){data-tooltip=\"Synonym for UPPER()\"}\n- [UNHEX()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_unhex){data-tooltip=\"Return a string containing hex representation of a number\"}\n- [UPPER()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_upper){data-tooltip=\"Convert to uppercase\"}\n- [WEIGHT_STRING()](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_weight-string){data-tooltip=\"Return the weight string for a string\"}\n\n{.cols-2 .marker-none}\n\n### Date and Time {.row-span-2}\n\n<!-- prettier-ignore -->\n- [ADDDATE()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_adddate){data-tooltip=\"Add time values (intervals) to a date value\"}\n- [ADDTIME()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_addtime){data-tooltip=\"Add time\"}\n- [CONVERT_TZ()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_convert-tz){data-tooltip=\"Convert from one time zone to another\"}\n- [CURDATE()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_curdate){data-tooltip=\"Return the current date\"}\n- [CURRENT_DATE()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_current-date){data-tooltip=\"Synonyms for CURDATE()\"}\n- [CURRENT_TIME()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_current-time){data-tooltip=\"Synonyms for CURTIME()\"}\n- [CURRENT_TIMESTAMP()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_current-timestamp){data-tooltip=\"Synonyms for NOW()\"}\n- [CURTIME()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_curtime){data-tooltip=\"Return the current time\"}\n- [DATE()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date){data-tooltip=\"Extract the date part of a date or datetime expression\"}\n- [DATE_ADD()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-add){data-tooltip=\"Add time values (intervals) to a date value\"}\n- [DATE_FORMAT()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-format){data-tooltip=\"Format date as specified\"}\n- [DATE_SUB()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-sub){data-tooltip=\"Subtract a time value (interval) from a date\"}\n- [DATEDIFF()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_datediff){data-tooltip=\"Subtract two dates\"}\n- [DAY()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_day){data-tooltip=\"Synonym for DAYOFMONTH()\"}\n- [DAYNAME()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_dayname){data-tooltip=\"Return the name of the weekday\"}\n- [DAYOFMONTH()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_dayofmonth){data-tooltip=\"Return the day of the month (0-31)\"}\n- [DAYOFWEEK()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_dayofweek){data-tooltip=\"Return the weekday index of the argument\"}\n- [DAYOFYEAR()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_dayofyear){data-tooltip=\"Return the day of the year (1-366)\"}\n- [EXTRACT()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_extract){data-tooltip=\"Extract part of a date\"}\n- [FROM_DAYS()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_from-days){data-tooltip=\"Convert a day number to a date\"}\n- [FROM_UNIXTIME()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_from-unixtime){data-tooltip=\"Format Unix timestamp as a date\"}\n- [GET_FORMAT()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_get-format){data-tooltip=\"Return a date format string\"}\n- [HOUR()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_hour){data-tooltip=\"Extract the hour\"}\n- [LAST_DAY](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_last-day){data-tooltip=\"Return the last day of the month for the argument\"}\n- [LOCALTIME()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_localtime){data-tooltip=\"Synonym for NOW()\"}\n- [LOCALTIMESTAMP()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_localtimestamp){data-tooltip=\"Synonym for NOW()\"}\n- [MAKEDATE()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_makedate){data-tooltip=\"Create a date from the year and day of year\"}\n- [MAKETIME()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_maketime){data-tooltip=\"Create time from hour, minute, second\"}\n- [MICROSECOND()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_microsecond){data-tooltip=\"Return the microseconds from argument\"}\n- [MINUTE()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_minute){data-tooltip=\"Return the minute from the argument\"}\n- [MONTH()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_month){data-tooltip=\"Return the month from the date passed\"}\n- [MONTHNAME()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_monthname){data-tooltip=\"Return the name of the month\"}\n- [NOW()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_now){data-tooltip=\"Return the current date and time\"}\n- [PERIOD_ADD()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_period-add){data-tooltip=\"Add a period to a year-month\"}\n- [PERIOD_DIFF()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_period-diff){data-tooltip=\"Return the number of months between periods\"}\n- [QUARTER()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_quarter){data-tooltip=\"Return the quarter from a date argument\"}\n- [SEC_TO_TIME()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_sec-to-time){data-tooltip=\"Converts seconds to 'hh:mm:ss' format\"}\n- [SECOND()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_second){data-tooltip=\"Return the second (0-59)\"}\n- [STR_TO_DATE()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_str-to-date){data-tooltip=\"Convert a string to a date\"}\n- [SUBDATE()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_subdate){data-tooltip=\"Synonym for DATE_SUB() when invoked with three arguments\"}\n- [SUBTIME()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_subtime){data-tooltip=\"Subtract times\"}\n- [SYSDATE()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_sysdate){data-tooltip=\"Return the time at which the function executes\"}\n- [TIME()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_time){data-tooltip=\"Extract the time portion of the expression passed\"}\n- [TIME_FORMAT()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_time-format){data-tooltip=\"Format as time\"}\n- [TIME_TO_SEC()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_time-to-sec){data-tooltip=\"Return the argument converted to seconds\"}\n- [TIMEDIFF()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_timediff){data-tooltip=\"Subtract time\"}\n- [TIMESTAMP()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_timestamp){data-tooltip=\"With a single argument, this function returns the date or datetime expression; with two arguments, the sum of the arguments\"}\n- [TIMESTAMPADD()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_timestampadd){data-tooltip=\"Add an interval to a datetime expression\"}\n- [TIMESTAMPDIFF()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_timestampdiff){data-tooltip=\"Subtract an interval from a datetime expression\"}\n- [TO_DAYS()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_to-days){data-tooltip=\"Return the date argument converted to days\"}\n- [TO_SECONDS()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_to-seconds){data-tooltip=\"Return the date or datetime argument converted to seconds since Year 0\"}\n- [UNIX_TIMESTAMP()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_unix-timestamp){data-tooltip=\"Return a Unix timestamp\"}\n- [UTC_DATE()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_utc-date){data-tooltip=\"Return the current UTC date\"}\n- [UTC_TIME()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_utc-time){data-tooltip=\"Return the current UTC time\"}\n- [UTC_TIMESTAMP()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_utc-timestamp){data-tooltip=\"Return the current UTC date and time\"}\n- [WEEK()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_week){data-tooltip=\"Return the week number\"}\n- [WEEKDAY()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_weekday){data-tooltip=\"Return the weekday index\"}\n- [WEEKOFYEAR()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_weekofyear){data-tooltip=\"Return the calendar week of the date (1-53)\"}\n- [YEAR()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_year){data-tooltip=\"Return the year\"}\n- [YEARWEEK()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_yearweek){data-tooltip=\"Return the year and week\"}\n- [GET_FORMAT()](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_get-format){data-tooltip=\"'%m.%d.%Y'\"}\n\n{.cols-2 .marker-none}\n\n### Numeric\n\n<!-- prettier-ignore -->\n- [%, MOD](https://dev.mysql.com/doc/refman/8.0/en/arithmetic-functions.html#operator_mod){data-tooltip=\"Modulo operator\"}\n- [*](https://dev.mysql.com/doc/refman/8.0/en/arithmetic-functions.html#operator_times){data-tooltip=\"Multiplication operator\"}\n- [+](https://dev.mysql.com/doc/refman/8.0/en/arithmetic-functions.html#operator_plus){data-tooltip=\"Addition operator\"}\n- [-](https://dev.mysql.com/doc/refman/8.0/en/arithmetic-functions.html#operator_minus){data-tooltip=\"Minus operator\"}\n- [-](https://dev.mysql.com/doc/refman/8.0/en/arithmetic-functions.html#operator_unary-minus){data-tooltip=\"Change the sign of the argument\"}\n- [/](https://dev.mysql.com/doc/refman/8.0/en/arithmetic-functions.html#operator_divide){data-tooltip=\"Division operator\"}\n- [ABS()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_abs){data-tooltip=\"Return the absolute value\"}\n- [ACOS()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_acos){data-tooltip=\"Return the arc cosine\"}\n- [ASIN()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_asin){data-tooltip=\"Return the arc sine\"}\n- [ATAN()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_atan){data-tooltip=\"Return the arc tangent\"}\n- [ATAN2(), ATAN()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_atan2){data-tooltip=\"Return the arc tangent of the two arguments\"}\n- [CEIL()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_ceil){data-tooltip=\"Return the smallest integer value not less than the argument\"}\n- [CEILING()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_ceiling){data-tooltip=\"Return the smallest integer value not less than the argument\"}\n- [CONV()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_conv){data-tooltip=\"Convert numbers between different number bases\"}\n- [COS()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_cos){data-tooltip=\"Return the cosine\"}\n- [COT()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_cot){data-tooltip=\"Return the cotangent\"}\n- [CRC32()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_crc32){data-tooltip=\"Compute a cyclic redundancy check value\"}\n- [DEGREES()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_degrees){data-tooltip=\"Convert radians to degrees\"}\n- [DIV](https://dev.mysql.com/doc/refman/8.0/en/arithmetic-functions.html#operator_div){data-tooltip=\"Integer division\"}\n- [EXP()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_exp){data-tooltip=\"Raise to the power of\"}\n- [FLOOR()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_floor){data-tooltip=\"Return the largest integer value not greater than the argument\"}\n- [LN()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_ln){data-tooltip=\"Return the natural logarithm of the argument\"}\n- [LOG()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_log){data-tooltip=\"Return the natural logarithm of the first argument\"}\n- [LOG10()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_log10){data-tooltip=\"Return the base-10 logarithm of the argument\"}\n- [LOG2()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_log2){data-tooltip=\"Return the base-2 logarithm of the argument\"}\n- [MOD()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_mod){data-tooltip=\"Return the remainder\"}\n- [PI()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_pi){data-tooltip=\"Return the value of pi\"}\n- [POW()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_pow){data-tooltip=\"Return the argument raised to the specified power\"}\n- [POWER()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_power){data-tooltip=\"Return the argument raised to the specified power\"}\n- [RADIANS()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_radians){data-tooltip=\"Return argument converted to radians\"}\n- [RAND()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_rand){data-tooltip=\"Return a random floating-point value\"}\n- [ROUND()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_round){data-tooltip=\"Round the argument\"}\n- [SIGN()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_sign){data-tooltip=\"Return the sign of the argument\"}\n- [SIN()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_sin){data-tooltip=\"Return the sine of the argument\"}\n- [SQRT()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_sqrt){data-tooltip=\"Return the square root of the argument\"}\n- [TAN()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_tan){data-tooltip=\"Return the tangent of the argument\"}\n- [TRUNCATE()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_truncate){data-tooltip=\"Truncate to specified number of decimal places\"}\n\n{.cols-2 .marker-none}\n\n### Aggregate\n\n<!-- prettier-ignore -->\n- [AVG()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_avg){data-tooltip=\"Return the average value of the argument\"}\n- [BIT_AND()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_bit-and){data-tooltip=\"Return bitwise AND\"}\n- [BIT_OR()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_bit-or){data-tooltip=\"Return bitwise OR\"}\n- [BIT_XOR()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_bit-xor){data-tooltip=\"Return bitwise XOR\"}\n- [COUNT()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_count){data-tooltip=\"Return a count of the number of rows returned\"}\n- [COUNT(DISTINCT)](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_count-distinct){data-tooltip=\"Return the count of a number of different values\"}\n- [GROUP_CONCAT()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_group-concat){data-tooltip=\"Return a concatenated string\"}\n- [JSON_ARRAYAGG()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_json-arrayagg){data-tooltip=\"Return result set as a single JSON array\"}\n- [JSON_OBJECTAGG()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_json-objectagg){data-tooltip=\"Return result set as a single JSON object\"}\n- [MAX()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_max){data-tooltip=\"Return the maximum value\"}\n- [MIN()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_min){data-tooltip=\"Return the minimum value\"}\n- [STD()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_std){data-tooltip=\"Return the population standard deviation\"}\n- [STDDEV()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_stddev){data-tooltip=\"Return the population standard deviation\"}\n- [STDDEV_POP()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_stddev-pop){data-tooltip=\"Return the population standard deviation\"}\n- [STDDEV_SAMP()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_stddev-samp){data-tooltip=\"Return the sample standard deviation\"}\n- [SUM()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_sum){data-tooltip=\"Return the sum\"}\n- [VAR_POP()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_var-pop){data-tooltip=\"Return the population standard variance\"}\n- [VAR_SAMP()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_var-samp){data-tooltip=\"Return the sample variance\"}\n- [VARIANCE()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_variance){data-tooltip=\"Return the population standard variance\"}\n\n{.cols-2 .marker-none}\n\n### JSON {.row-span-4}\n\n<!-- prettier-ignore -->\n- [->](https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#operator_json-column-path){data-tooltip=\"Return value from JSON column after evaluating path; equivalent to JSON_EXTRACT().\"}\n- [->>](https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#operator_json-inline-path){data-tooltip=\"Return value from JSON column after evaluating path and unquoting the result; equivalent to JSON_UNQUOTE(JSON_EXTRACT()).\"}\n- [JSON_ARRAY()](https://dev.mysql.com/doc/refman/8.0/en/json-creation-functions.html#function_json-array){data-tooltip=\"Create JSON array\"}\n- [JSON_ARRAY_APPEND()](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-array-append){data-tooltip=\"Append data to JSON document\"}\n- [JSON_ARRAY_INSERT()](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-array-insert){data-tooltip=\"Insert into JSON array\"}\n- [JSON_CONTAINS()](https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#function_json-contains){data-tooltip=\"Whether JSON document contains specific object at path\"}\n- [JSON_CONTAINS_PATH()](https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#function_json-contains-path){data-tooltip=\"Whether JSON document contains any data at path\"}\n- [JSON_DEPTH()](https://dev.mysql.com/doc/refman/8.0/en/json-attribute-functions.html#function_json-depth){data-tooltip=\"Maximum depth of JSON document\"}\n- [JSON_EXTRACT()](https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#function_json-extract){data-tooltip=\"Return data from JSON document\"}\n- [JSON_INSERT()](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-insert){data-tooltip=\"Insert data into JSON document\"}\n- [JSON_KEYS()](https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#function_json-keys){data-tooltip=\"Array of keys from JSON document\"}\n- [JSON_LENGTH()](https://dev.mysql.com/doc/refman/8.0/en/json-attribute-functions.html#function_json-length){data-tooltip=\"Number of elements in JSON document\"}\n- [JSON_MERGE() (deprecated)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-merge){data-tooltip=\"Merge JSON documents, preserving duplicate keys. Deprecated synonym for JSON_MERGE_PRESERVE()\"}\n- [JSON_MERGE_PATCH()](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-merge-patch){data-tooltip=\"Merge JSON documents, replacing values of duplicate keys\"}\n- [JSON_MERGE_PRESERVE()](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-merge-preserve){data-tooltip=\"Merge JSON documents, preserving duplicate keys\"}\n- [JSON_OBJECT()](https://dev.mysql.com/doc/refman/8.0/en/json-creation-functions.html#function_json-object){data-tooltip=\"Create JSON object\"}\n- [JSON_OVERLAPS() (introduced 8.0.17)](https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#function_json-overlaps){data-tooltip=\"Compares two JSON documents, returns TRUE (1) if these have any key-value pairs or array elements in common, otherwise FALSE (0)\"}\n- [JSON_PRETTY()](https://dev.mysql.com/doc/refman/8.0/en/json-utility-functions.html#function_json-pretty){data-tooltip=\"Print a JSON document in human-readable format\"}\n- [JSON_QUOTE()](https://dev.mysql.com/doc/refman/8.0/en/json-creation-functions.html#function_json-quote){data-tooltip=\"Quote JSON document\"}\n- [JSON_REMOVE()](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-remove){data-tooltip=\"Remove data from JSON document\"}\n- [JSON_REPLACE()](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-replace){data-tooltip=\"Replace values in JSON document\"}\n- [JSON_SCHEMA_VALID() (introduced 8.0.17)](https://dev.mysql.com/doc/refman/8.0/en/json-validation-functions.html#function_json-schema-valid){data-tooltip=\"Validate JSON document against JSON schema; returns TRUE/1 if document validates against schema, or FALSE/0 if it does not\"}\n- [JSON_SCHEMA_VALIDATION_REPORT() (introduced 8.0.17)](https://dev.mysql.com/doc/refman/8.0/en/json-validation-functions.html#function_json-schema-validation-report){data-tooltip=\"Validate JSON document against JSON schema; returns report in JSON format on outcome on validation including success or failure and reasons for failure\"}\n- [JSON_SEARCH()](https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#function_json-search){data-tooltip=\"Path to value within JSON document\"}\n- [JSON_SET()](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-set){data-tooltip=\"Insert data into JSON document\"}\n- [JSON_STORAGE_FREE()](https://dev.mysql.com/doc/refman/8.0/en/json-utility-functions.html#function_json-storage-free){data-tooltip=\"Freed space within binary representation of JSON column value following partial update\"}\n- [JSON_STORAGE_SIZE()](https://dev.mysql.com/doc/refman/8.0/en/json-utility-functions.html#function_json-storage-size){data-tooltip=\"Space used for storage of binary representation of a JSON document\"}\n- [JSON_TABLE()](https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html#function_json-table){data-tooltip=\"Return data from a JSON expression as a relational table\"}\n- [JSON_TYPE()](https://dev.mysql.com/doc/refman/8.0/en/json-attribute-functions.html#function_json-type){data-tooltip=\"Type of JSON value\"}\n- [JSON_UNQUOTE()](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-unquote){data-tooltip=\"Unquote JSON value\"}\n- [JSON_VALID()](https://dev.mysql.com/doc/refman/8.0/en/json-attribute-functions.html#function_json-valid){data-tooltip=\"Whether JSON value is valid\"}\n- [JSON_VALUE() (introduced 8.0.21)](https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#function_json-value){data-tooltip=\"Extract value from JSON document at location pointed to by path provided; return this value as VARCHAR(512) or specified type\"}\n- [MEMBER OF() (introduced 8.0.17)](https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#operator_member-of){data-tooltip=\"Returns true (1) if first operand matches any element of JSON array passed as second operand, otherwise returns false (0)\"}\n\n{.cols-1 .marker-none}\n\n### Cast\n\n<!-- prettier-ignore -->\n- [BINARY](https://dev.mysql.com/doc/refman/8.0/en/cast-functions.html#operator_binary){data-tooltip=\"Cast a string to a binary string\"}\n- [CAST()](https://dev.mysql.com/doc/refman/8.0/en/cast-functions.html#function_cast){data-tooltip=\"Cast a value as a certain type\"}\n- [CONVERT()](https://dev.mysql.com/doc/refman/8.0/en/cast-functions.html#function_convert){data-tooltip=\"Cast a value as a certain type\"}\n\n{.cols-2 .marker-none}\n\n### Flow Control\n\n<!-- prettier-ignore -->\n- [CASE](https://dev.mysql.com/doc/refman/8.0/en/flow-control-functions.html#operator_case){data-tooltip=\"Case operator\"}\n- [IF()](https://dev.mysql.com/doc/refman/8.0/en/flow-control-functions.html#function_if){data-tooltip=\"If/else construct\"}\n- [IFNULL()](https://dev.mysql.com/doc/refman/8.0/en/flow-control-functions.html#function_ifnull){data-tooltip=\"Null if/else construct\"}\n- [NULLIF()](https://dev.mysql.com/doc/refman/8.0/en/flow-control-functions.html#function_nullif){data-tooltip=\"Return NULL if expr1 = expr2\"}\n\n{.cols-2 .marker-none}\n\n### Information\n\n<!-- prettier-ignore -->\n- [BENCHMARK()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_benchmark){data-tooltip=\"Repeatedly execute an expression\"}\n- [CHARSET()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_charset){data-tooltip=\"Return the character set of the argument\"}\n- [COERCIBILITY()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_coercibility){data-tooltip=\"Return the collation coercibility value of the string argument\"}\n- [COLLATION()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_collation){data-tooltip=\"Return the collation of the string argument\"}\n- [CONNECTION_ID()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_connection-id){data-tooltip=\"Return the connection ID (thread ID) for the connection\"}\n- [CURRENT_ROLE()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_current-role){data-tooltip=\"Return the current active roles\"}\n- [CURRENT_USER()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_current-user){data-tooltip=\"The authenticated user name and host name\"}\n- [DATABASE()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_database){data-tooltip=\"Return the default (current) database name\"}\n- [FOUND_ROWS()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_found-rows){data-tooltip=\"For a SELECT with a LIMIT clause, the number of rows that would be returned were there no LIMIT clause\"}\n- [ICU_VERSION()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_icu-version){data-tooltip=\"ICU library version\"}\n- [LAST_INSERT_ID()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_last-insert-id){data-tooltip=\"Value of the AUTOINCREMENT column for the last INSERT\"}\n- [ROLES_GRAPHML()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_roles-graphml){data-tooltip=\"Return a GraphML document representing memory role subgraphs\"}\n- [ROW_COUNT()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_row-count){data-tooltip=\"The number of rows updated\"}\n- [SCHEMA()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_schema){data-tooltip=\"Synonym for DATABASE()\"}\n- [SESSION_USER()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_session-user){data-tooltip=\"Synonym for USER()\"}\n- [SYSTEM_USER()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_system-user){data-tooltip=\"Synonym for USER()\"}\n- [USER()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_user){data-tooltip=\"The user name and host name provided by the client\"}\n- [VERSION()](https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_version){data-tooltip=\"Return a string that indicates the MySQL server version\"}\n\n{.cols-2 .marker-none}\n\n### Encryption and Compression\n\n<!-- prettier-ignore -->\n- [AES_DECRYPT()](https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_aes-decrypt){data-tooltip=\"Decrypt using AES\"}\n- [AES_ENCRYPT()](https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_aes-encrypt){data-tooltip=\"Encrypt using AES\"}\n- [COMPRESS()](https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_compress){data-tooltip=\"Return result as a binary string\"}\n- [MD5()](https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_md5){data-tooltip=\"Calculate MD5 checksum\"}\n- [RANDOM_BYTES()](https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_random-bytes){data-tooltip=\"Return a random byte vector\"}\n- [SHA1(), SHA()](https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_sha1){data-tooltip=\"Calculate an SHA-1 160-bit checksum\"}\n- [SHA2()](https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_sha2){data-tooltip=\"Calculate an SHA-2 checksum\"}\n- [STATEMENT_DIGEST()](https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_statement-digest){data-tooltip=\"Compute statement digest hash value\"}\n- [STATEMENT_DIGEST_TEXT()](https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_statement-digest-text){data-tooltip=\"Compute normalized statement digest\"}\n- [UNCOMPRESS()](https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_uncompress){data-tooltip=\"Uncompress a string compressed\"}\n- [UNCOMPRESSED_LENGTH()](https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_uncompressed-length){data-tooltip=\"Return the length of a string before compression\"}\n- [VALIDATE_PASSWORD_STRENGTH()](https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_validate-password-strength){data-tooltip=\"Determine strength of password\"}\n\n{.cols-1 .marker-none}\n\n### Locking\n\n<!-- prettier-ignore -->\n- [GET_LOCK()](https://dev.mysql.com/doc/refman/8.0/en/locking-functions.html#function_get-lock){data-tooltip=\"Get a named lock\"}\n- [IS_FREE_LOCK()](https://dev.mysql.com/doc/refman/8.0/en/locking-functions.html#function_is-free-lock){data-tooltip=\"Whether the named lock is free\"}\n- [IS_USED_LOCK()](https://dev.mysql.com/doc/refman/8.0/en/locking-functions.html#function_is-used-lock){data-tooltip=\"Whether the named lock is in use; return connection identifier if true\"}\n- [RELEASE_ALL_LOCKS()](https://dev.mysql.com/doc/refman/8.0/en/locking-functions.html#function_release-all-locks){data-tooltip=\"Release all current named locks\"}\n- [RELEASE_LOCK()](https://dev.mysql.com/doc/refman/8.0/en/locking-functions.html#function_release-lock){data-tooltip=\"Release the named lock\"}\n\n{.cols-1 .marker-none}\n\n### Bit\n\n<!-- prettier-ignore -->\n- [&](https://dev.mysql.com/doc/refman/8.0/en/bit-functions.html#operator_bitwise-and){data-tooltip=\"Bitwise AND\"}\n- [>>](https://dev.mysql.com/doc/refman/8.0/en/bit-functions.html#operator_right-shift){data-tooltip=\"Right shift\"}\n- [<<](https://dev.mysql.com/doc/refman/8.0/en/bit-functions.html#operator_left-shift){data-tooltip=\"Left shift\"}\n- [^](https://dev.mysql.com/doc/refman/8.0/en/bit-functions.html#operator_bitwise-xor){data-tooltip=\"Bitwise XOR\"}\n- [BIT_COUNT()](https://dev.mysql.com/doc/refman/8.0/en/bit-functions.html#function_bit-count){data-tooltip=\"Return the number of bits that are set\"}\n- [|](https://dev.mysql.com/doc/refman/8.0/en/bit-functions.html#operator_bitwise-or){data-tooltip=\"Bitwise OR\"}\n- [~](https://dev.mysql.com/doc/refman/8.0/en/bit-functions.html#operator_bitwise-invert){data-tooltip=\"Bitwise inversion\"}\n\n{.cols-2 .marker-none}\n\n### Miscellaneous\n\n<!-- prettier-ignore -->\n- [ANY_VALUE()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_any-value){data-tooltip=\"Suppress ONLY_FULL_GROUP_BY value rejection\"}\n- [BIN_TO_UUID()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_bin-to-uuid){data-tooltip=\"Convert binary UUID to string\"}\n- [DEFAULT()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_default){data-tooltip=\"Return the default value for a table column\"}\n- [GROUPING()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_grouping){data-tooltip=\"Distinguish super-aggregate ROLLUP rows from regular rows\"}\n- [INET_ATON()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_inet-aton){data-tooltip=\"Return the numeric value of an IP address\"}\n- [INET_NTOA()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_inet-ntoa){data-tooltip=\"Return the IP address from a numeric value\"}\n- [INET6_ATON()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_inet6-aton){data-tooltip=\"Return the numeric value of an IPv6 address\"}\n- [INET6_NTOA()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_inet6-ntoa){data-tooltip=\"Return the IPv6 address from a numeric value\"}\n- [IS_IPV4()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_is-ipv4){data-tooltip=\"Whether argument is an IPv4 address\"}\n- [IS_IPV4_COMPAT()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_is-ipv4-compat){data-tooltip=\"Whether argument is an IPv4-compatible address\"}\n- [IS_IPV4_MAPPED()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_is-ipv4-mapped){data-tooltip=\"Whether argument is an IPv4-mapped address\"}\n- [IS_IPV6()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_is-ipv6){data-tooltip=\"Whether argument is an IPv6 address\"}\n- [IS_UUID()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_is-uuid){data-tooltip=\"Whether argument is a valid UUID\"}\n- [MASTER_POS_WAIT()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_master-pos-wait){data-tooltip=\"Block until the replica has read and applied all updates up to the specified position\"}\n- [NAME_CONST()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_name-const){data-tooltip=\"Cause the column to have the given name\"}\n- [SLEEP()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_sleep){data-tooltip=\"Sleep for a number of seconds\"}\n- [UUID()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_uuid){data-tooltip=\"Return a Universal Unique Identifier (UUID)\"}\n- [UUID_SHORT()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_uuid-short){data-tooltip=\"Return an integer-valued universal identifier\"}\n- [UUID_TO_BIN()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_uuid-to-bin){data-tooltip=\"Convert string UUID to binary\"}\n- [VALUES()](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_values){data-tooltip=\"Define the values to be used during an INSERT\"}\n\n{.cols-2 .marker-none}\n\n## Also see {.cols-1}\n\n- [Regex in MySQL](/regex#regex-in-mysql) _(cheatsheets.zip)_\n"
  },
  {
    "path": "source/_posts/nc.md",
    "content": "---\ntitle: Netcat\ndate: 2020-11-25 18:28:43\nbackground: bg-blue-600\ntags:\n  - ncat\n  - nc\n  - utility\n  - network\n  - traffic\ncategories:\n  - Linux Command\nintro: This cheat sheet provides various for using Netcat on both Linux and Unix.\nplugins:\n  - copyCode\n---\n\n## Getting Started {.cols-5}\n\n### Usage {.col-span-2}\n\nConnect to a host located anywhere\n\n```shell script\n$ nc [options] [host] [port]\n```\n\nListen for incoming connections\n\n```shell script\n$ nc -lp port [host] [port]\n```\n\n### Option examples {.col-span-3 .row-span-2}\n\n| Option | Description                | Example                                  |\n| ------ | -------------------------- | ---------------------------------------- |\n| `-h`   | nc -h                      | Help                                     |\n| `-z`   | nc -z 192.168.1.9 1-100    | Port scan for a host or IP address       |\n| `-v`   | nc -zv 192.168.1.9 1-100   | Provide verbose output                   |\n| `-n`   | nc -zn 192.168.1.9 1-100   | Fast scan by disabling DNS resolution    |\n| `-l`   | nc -lp 8000                | TCP Listen mode _(for inbound connects)_ |\n| `-w`   | nc -w 180 192.168.1.9 8000 | Define timeout value                     |\n| `-k`   | nc -kl 8000                | Continue listening after disconnection   |\n| `-u`   | nc -u 192.168.1.9 8000     | Use UDP instead of TCP                   |\n| `-q`   | nc -q 1 192.168.1.9 8000   | Client stay up after EOF                 |\n| `-4`   | nc -4 -l 8000              | IPv4 only                                |\n| `-6`   | nc -6 -l 8000              | IPv6 only                                |\n\n### Chat client-server {.col-span-2}\n\nServer (192.168.1.9)\n\n```shell script\n$ nc -lv 8000\n```\n\nClient\n\n```shell script\n$ nc 192.168.1.9 8000\n```\n\n## Netcat Examples\n\n### Banner grabbing\n\n```shell script\n$ nc website.com 80\nGET index.html HTTP/1.1\nHEAD / HTTP/1.1\n```\n\nor\n\n```shell script\necho \"\" | nc -zv -wl 192.168.1.1 801-805\n```\n\n### Port scanning\n\nScan ports between 21 to 25\n\n```shell script\n$ nc -zvn 192.168.1.1 21-25\n```\n\nScan ports 22, 3306 and 8080\n\n```shell script\n$ nc -zvn 192.168.1.1 22 3306 8080\n```\n\n### Proxy and port forwarding\n\n```shell script\n$ nc -lp 8001 -c \"nc 127.0.0.1 8000\"\n```\n\nor\n\n```shell script\n$ nc -l 8001 | nc 127.0.0.1 8000\n```\n\nCreate a tunnel from one local port to another\n\n### Download file\n\nServer (192.168.1.9)\n\n```shell script\n$ nc -lv 8000 < file.txt\n```\n\nClient\n\n```shell script\n$ nc -nv 192.168.1.9 8000 > file.txt\n```\n\nSuppose you want to transfer a file “file.txt” from server A to client B.\n\n### Upload file\n\nServer (192.168.1.9)\n\n```shell script\n$ nc -lv 8000 > file.txt\n```\n\nClient\n\n```shell script\n$ nc 192.168.1.9 8000 < file.txt\n```\n\nSuppose you want to transfer a file “file.txt” from client B to server A:\n\n### Directory transfer\n\nServer (192.168.1.9)\n\n```shell script\n$ tar -cvf – dir_name | nc -l 8000\n```\n\nClient\n\n```shell script\n$ nc -n 192.168.1.9 8000 | tar -xvf -\n```\n\nSuppose you want to transfer a directory over the network from A to B.\n\n### Encrypt transfer {.col-span-2}\n\nServer (192.168.1.9)\n\n```shell script\n$ openssl enc -des3 -in file.txt -pass pass:password | nc -l 8000\n```\n\nClient\n\n```shell script\n$ nc 192.168.1.9 8000 | openssl enc -des3 -d -pass pass:password -out file.txt\n```\n\nEncrypt data before transfering over the network\n\n### Clones\n\nServer (192.168.1.9)\n\n```shell script\n$ dd if=/dev/sda | nc -l 8000\n```\n\nClient\n\n```shell script\n$ nc -n 192.168.1.9 8000 | dd of=/dev/sda\n```\n\nCloning a linux PC is very simple. Suppose your system disk is /dev/sda\n\n### Video streaming\n\nServer (192.168.1.9)\n\n```shell script\n$ cat video.avi | nc -l 8000\n```\n\nClient\n\n```shell script {.wrap}\n$ nc 192.168.1.9 8000 | mplayer -vo x11 -cache 3000 -\n```\n\nStreaming video with netcat\n\n### Remote shell\n\nServer (192.168.1.9)\n\n```shell script\n$ nc -lv 8000 -e /bin/bash\n```\n\nClient\n\n```shell script\n$ nc 192.168.1.9 8000\n```\n\nWe have used remote Shell using the telnet and ssh but what if they are not installed and we do not have the permission\nto install them, then we can create remote shell using netcat also.\n\n### Reverse shell\n\nServer (192.168.1.9)\n\n```shell script\n$ nc -lv 8000\n```\n\nClient\n\n```shell script\n$ nc 192.168.1.9 8000 -v -e /bin/bash\n```\n\nReverse shells are often used to bypass the firewall restrictions like blocked inbound connections\n"
  },
  {
    "path": "source/_posts/neo4j.md",
    "content": "---\ntitle: Neo4j\ndate: 2021-08-23 12:34:56\nbackground: bg-[#3b85ef]\ntags:\n  - DB\n  - GraphDB\ncategories:\n  - Database\nintro: |\n  A Neo4j cheat sheet with getting started resources and information on how to query the database with Cypher.\nplugins:\n  - copyCode\n---\n\n## Getting Started {.cols-2}\n\n### Getting Started with Neo4j\n\nNeo4j is a Graph Database consisting of nodes connected together by relationships. You might consider using a Graph\ndatabase if you have a highly connected dataset or have queries with many joins.\n\n- [Download Neo4j Desktop](https://neo4j.com/download) _download Neo4j desktop or server editions_\n- [Neo4j Sandbox](https://sandbox.neo4j.com) _pick a data set - no installation required_\n- [Neo4j Aura](https://neo4j.com/aura) _free Neo4j instance in the cloud_\n- [Neo4j GraphAcademy](https://neo4j.com/graphacademy) _free, self-paced, hands-on online training_\n- [GraphGists](https://neo4j.com/graphgists) _use ase and industry specific example graphs_\n\n### Graph Database Concepts\n\n|                       |                                                                                                                                                                                                                                          |\n| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **Nodes**             | Nodes are commonly used to represent _entities_ or _things_ in your data. For example, a **Person** or **Movie**                                                                                                                         |\n| **Relationships**     | Relationships are used to connect two nodes together and organise the data into structure. For example, a Person **acted in** a movie. A relationship has a _type_ and _direction_, although the direction can be ignored at query time. |\n| **Labels**            | Labels are used to group nodes into categories. For example, a person may have `Person` and `Actor` labels.                                                                                                                              |\n| **Relationship Type** | Each relationship has a type. Relationships allow you to explore smaller sections of a graph.                                                                                                                                            |\n| **Properties**        | Both nodes and relationships can have properties set against them. Properties are [name-value pairs](https://neo4j.com/docs/cypher-manual/4.3/syntax/values/#cypher-values).                                                             |\n\n## Neo4j Syntax\n\n### Read query structure\n\n```\n[USE]\n[MATCH WHERE]\n[OPTIONAL MATCH WHERE]\n[WITH [ORDER BY] [SKIP] [LIMIT]]\nRETURN [ORDER BY] [SKIP] [LIMIT]\n```\n\n### Write-only query structure\n\n```\n[USE]\n(CREATE | MERGE)*\n[SET|DELETE|REMOVE|FOREACH]*\n[RETURN [ORDER BY] [SKIP] [LIMIT]]\n```\n\n### Read-write query structure\n\n```\n[USE]\n[MATCH WHERE]\n[OPTIONAL MATCH WHERE]\n[WITH [ORDER BY] [SKIP] [LIMIT]]\n(CREATE | MERGE)*\n[SET|DELETE|REMOVE|FOREACH]*\n[RETURN [ORDER BY] [SKIP] [LIMIT]]\n```\n\n## Neo4j Reading Data\n\n### MATCH\n\n```\nMATCH (n:Person)-[:KNOWS]->(m:Person)\nWHERE n.name = 'Alice'\n```\n\nNode patterns can contain labels and properties.\n\n```\nMATCH (n)-->(m)\n```\n\nAny pattern can be used in MATCH.\n\n```\nMATCH (n {name: 'Alice'})-->(m)\n```\n\nPatterns with node properties.\n\n```\nMATCH p = (n)-->(m)\n```\n\nAssign a path to p.\n\n```\nOPTIONAL MATCH (n)-[r]->(m)\n```\n\nOptional pattern: nulls will be used for missing parts.\n\n### WHERE\n\n```\nWHERE n.property <> $value\n```\n\nUse a predicate to filter. Note that WHERE is always part of a MATCH, OPTIONAL MATCH or WITH clause. Putting it after a\ndifferent clause in a query will alter what it does.\n\n```\nWHERE EXISTS {\n  MATCH (n)-->(m) WHERE n.age = m.age\n}\n```\n\nUse an existential subquery to filter.\n\n### RETURN\n\n```\nRETURN *\n```\n\nReturn the value of all variables.\n\n```\nRETURN n AS columnName\n```\n\nUse alias for result column name.\n\n```\nRETURN DISTINCT n\n```\n\nReturn unique rows.\n\n```\nORDER BY n.property\n```\n\nSort the result.\n\n```\nORDER BY n.property DESC\n```\n\nSort the result in descending order.\n\n```\nSKIP $skipNumber\n```\n\nSkip a number of results.\n\n```\nLIMIT $limitNumber\n```\n\nLimit the number of results.\n\n```\nSKIP $skipNumber LIMIT $limitNumber\n```\n\nSkip results at the top and limit the number of results.\n\n```\nRETURN count(*)\n```\n\nThe number of matching rows. See Aggregating functions for more.\n\n### WITH\n\n```\nMATCH (user)-[:FRIEND]-(friend)\nWHERE user.name = $name\nWITH user, count(friend) AS friends\nWHERE friends > 10\nRETURN user\n```\n\nThe WITH syntax is similar to RETURN. It separates query parts explicitly, allowing you to declare which variables to\ncarry over to the next part.\n\n```\nMATCH (user)-[:FRIEND]-(friend)\nWITH user, count(friend) AS friends\nORDER BY friends DESC\n  SKIP 1\n  LIMIT 3\nRETURN user\n```\n\nORDER BY, SKIP, and LIMIT can also be used with WITH.\n\n### UNION\n\n```\nMATCH (a)-[:KNOWS]->(b)\nRETURN b.name\nUNION\nMATCH (a)-[:LOVES]->(b)\nRETURN b.name\n```\n\nReturns the distinct union of all query results. Result column types and names have to match.\n\n```\nMATCH (a)-[:KNOWS]->(b)\nRETURN b.name\nUNION ALL\nMATCH (a)-[:LOVES]->(b)\nRETURN b.name\n```\n\nReturns the union of all query results, including duplicated rows.\n\n## Neo4j Writing Data\n\n### CREATE\n\n```\nCREATE (n {name: $value})\n```\n\nCreate a node with the given properties.\n\n```\nCREATE (n $map)\n```\n\nCreate a node with the given properties.\n\n```\nUNWIND $listOfMaps AS properties\nCREATE (n) SET n = properties\n```\n\nCreate nodes with the given properties.\n\n```\nCREATE (n)-[r:KNOWS]->(m)\n```\n\nCreate a relationship with the given type and direction; bind a variable to it.\n\n```\nCREATE (n)-[:LOVES {since: $value}]->(m)\n```\n\nCreate a relationship with the given type, direction, and properties.\n\n### SET\n\n```\nSET n.property1 = $value1,\n    n.property2 = $value2\n```\n\nUpdate or create a property.\n\n```\nSET n = $map\n```\n\nSet all properties. This will remove any existing properties.\n\n```\nSET n += $map\n```\n\nAdd and update properties, while keeping existing ones.\n\n```\nSET n:Person\n```\n\nAdds a label Person to a node.\n\n### MERGE\n\n```\nMERGE (n:Person {name: $value})\n  ON CREATE SET n.created = timestamp()\n  ON MATCH SET\n    n.counter = coalesce(n.counter, 0) + 1,\n    n.accessTime = timestamp()\n```\n\nMatch a pattern or create it if it does not exist. Use ON CREATE and ON MATCH for conditional updates.\n\n```\nMATCH (a:Person {name: $value1}),\n      (b:Person {name: $value2})\nMERGE (a)-[r:LOVES]->(b)\n```\n\nMERGE finds or creates a relationship between the nodes.\n\n```\nMATCH (a:Person {name: $value1})\nMERGE\n  (a)-[r:KNOWS]->(b:Person {name: $value3})\n```\n\nMERGE finds or creates paths attached to the node.\n\n### DELETE\n\n```\nDELETE n, r\n```\n\nDelete a node and a relationship.\n\n```\nDETACH DELETE n\n```\n\nDelete a node and all relationships connected to it.\n\n```\nMATCH (n)\nDETACH DELETE n\n```\n\nDelete all nodes and relationships from the database.\n\n### REMOVE\n\n```\nREMOVE n:Person\n```\n\nRemove a label from n.\n\n```\nREMOVE n.property\n```\n\nRemove a property.\n\n### FOREACH\n\n```\nFOREACH (r IN relationships(path) |\n  SET r.marked = true)\n```\n\nExecute a mutating operation for each relationship in a path.\n\n```\nFOREACH (value IN coll |\n CREATE (:Person {name: value}))\n```\n\nExecute a mutating operation for each element in a list.\n\n### CALL subquery\n\n```\nCALL {\n  MATCH (p:Person)-[:FRIEND_OF]->(other:Person) RETURN p, other\n  UNION\n  MATCH (p:Child)-[:CHILD_OF]->(other:Parent) RETURN p, other\n}\n```\n\nThis calls a subquery with two union parts. The result of the subquery can afterwards be post-processed.\n\n### CALL procedure\n\n```\nCALL db.labels() YIELD label\n```\n\nThis shows a standalone call to the built-in procedure db.labels to list all labels used in the database. Note that\nrequired procedure arguments are given explicitly in brackets after the procedure name.\n\n```\nCALL db.labels() YIELD *\n```\n\nStandalone calls may use YIELD \\* to return all columns.\n\n```\nCALL java.stored.procedureWithArgs\n```\n\nStandalone calls may omit YIELD and also provide arguments implicitly via statement parameters, e.g. a standalone call\nrequiring one argument input may be run by passing the parameter map {input: 'foo'}.\n\n```\nCALL db.labels() YIELD label\nRETURN count(label) AS count\n```\n\nCalls the built-in procedure db.labels inside a larger query to count all labels used in the database. Calls inside a\nlarger query always requires passing arguments and naming results explicitly with YIELD.\n\n### Import\n\n```\nLOAD CSV FROM\n'https://neo4j.com/docs/cypher-refcard/4.3/csv/artists.csv' AS line\nCREATE (:Artist {name: line[1], year: toInteger(line[2])})\n```\n\nLoad data from a CSV file and create nodes.\n\n```\nLOAD CSV WITH HEADERS FROM\n'https://neo4j.com/docs/cypher-refcard/4.3/csv/artists-with-headers.csv' AS line\nCREATE (:Artist {name: line.Name, year: toInteger(line.Year)})\n```\n\nLoad CSV data which has headers.\n\n```\nUSING PERIODIC COMMIT 500\nLOAD CSV WITH HEADERS FROM\n'https://neo4j.com/docs/cypher-refcard/4.3/csv/artists-with-headers.csv' AS line\nCREATE (:Artist {name: line.Name, year: toInteger(line.Year)})\n```\n\nCommit the current transaction after every 500 rows when importing large amounts of data.\n\n```\nLOAD CSV FROM\n'https://neo4j.com/docs/cypher-refcard/4.3/csv/artists-fieldterminator.csv'\nAS line FIELDTERMINATOR ';'\nCREATE (:Artist {name: line[1], year: toInteger(line[2])})\n```\n\nUse a different field terminator, not the default which is a comma (with no whitespace around it).\n\n```\nLOAD CSV FROM\n'https://neo4j.com/docs/cypher-refcard/4.3/csv/artists.csv' AS line\nRETURN DISTINCT file()\n```\n\nReturns the absolute path of the file that LOAD CSV is processing, returns null if called outside of LOAD CSV context.\n\n```\nLOAD CSV FROM\n'https://neo4j.com/docs/cypher-refcard/4.3/csv/artists.csv' AS line\nRETURN linenumber()\n```\n\nReturns the line number that LOAD CSV is currently processing, returns null if called outside of LOAD CSV context.\n\n### Operators\n\n|                        |                                           |\n| ---------------------- | ----------------------------------------- |\n| **General**            | DISTINCT, ., []                           |\n| **Mathematical**       | +, -, \\*, /, %, ^                         |\n| **Comparison**         | =, <>, <, >, <=, >=, IS NULL, IS NOT NULL |\n| **Boolean**            | AND, OR, XOR, NOT                         |\n| **String**             | +                                         |\n| **List**               | +, IN, [x], [x .. y]                      |\n| **Regular Expression** | =~                                        |\n| **String matching**    | STARTS WITH, ENDS WITH, CONTAINS          |\n\n### null\n\n- `null` is used to represent missing/undefined values.\n\n- `null` is not equal to `null`. Not knowing two values does not imply that they are the same value. So the expression\n  `null = null` yields `null` and not `true`. To check if an expression is `null`, use `IS NULL`.\n- Arithmetic expressions, comparisons and function calls (except `coalesce`) will return `null` if any argument is\n  `null`.\n- An attempt to access a missing element in a list or a property that doesn’t exist yields `null`.\n- In `OPTIONAL MATCH` clauses, `nulls` will be used for missing parts of the pattern.\n\n### Patterns\n\n```\n(n:Person)\n```\n\nNode with Person label.\n\n```\n(n:Person:Swedish)\n```\n\nNode with both Person and Swedish labels.\n\n```\n(n:Person {name: $value})\n```\n\nNode with the declared properties.\n\n```\n()-[r {name: $value}]-()\n```\n\nMatches relationships with the declared properties.\n\n```\n(n)-->(m)\n```\n\nRelationship from n to m.\n\n```\n(n)--(m)\n```\n\nRelationship in any direction between n and m.\n\n```\n(n:Person)-->(m)\n```\n\nNode n labeled Person with relationship to m.\n\n```\n(m)<-[:KNOWS]-(n)\n```\n\nRelationship of type KNOWS from n to m.\n\n```\n(n)-[:KNOWS|:LOVES]->(m)\n```\n\nRelationship of type KNOWS or of type LOVES from n to m.\n\n```\n(n)-[r]->(m)\n```\n\nBind the relationship to variable r.\n\n```\n(n)-[*1..5]->(m)\n```\n\nVariable length path of between 1 and 5 relationships from n to m.\n\n```\n(n)-[*]->(m)\n```\n\nVariable length path of any number of relationships from n to m. (See Performance section.)\n\n```\n(n)-[:KNOWS]->(m {property: $value})\n```\n\nA relationship of type KNOWS from a node n to a node m with the declared property.\n\n```\nshortestPath((n1:Person)-[*..6]-(n2:Person))\n```\n\nFind a single shortest path.\n\n```\nallShortestPaths((n1:Person)-[*..6]->(n2:Person))\n```\n\nFind all shortest paths.\n\n```\nsize((n)-->()-->())\n```\n\nCount the paths matching the pattern.\n\n### USE\n\n```\nUSE myDatabase\n```\n\nSelect myDatabase to execute query, or query part, against.\n\n```\nUSE neo4j\nMATCH (n:Person)-[:KNOWS]->(m:Person)\nWHERE n.name = 'Alice'\n```\n\nMATCH query executed against neo4j database.\n\n### SHOW FUNCTIONS and PROCEDURES\n\n```\nSHOW FUNCTIONS\n```\n\nListing all available functions.\n\n```\nSHOW PROCEDURES EXECUTABLE YIELD name\n```\n\nList all procedures that can be executed by the current user and return only the name of the procedures.\n\n### Labels\n\n```\nCREATE (n:Person {name: $value})\n```\n\nCreate a node with label and property.\n\n```\nMERGE (n:Person {name: $value})\n```\n\nMatches or creates unique node(s) with the label and property.\n\n```\nSET n:Spouse:Parent:Employee\n```\n\nAdd label(s) to a node.\n\n```\nMATCH (n:Person)\n```\n\nMatches nodes labeled Person.\n\n```\nMATCH (n:Person)\nWHERE n.name = $value\n```\n\nMatches nodes labeled Person with the given name.\n\n```\nWHERE (n:Person)\n```\n\nChecks the existence of the label on the node.\n\n```\nlabels(n)\n```\n\nLabels of the node.\n\n```\nREMOVE n:Person\n```\n\nRemove the label from the node.\n\n### Lists\n\n```\n['a', 'b', 'c'] AS list\n```\n\nLiteral lists are declared in square brackets.\n\n```\nsize($list) AS len, $list[0] AS value\n```\n\nLists can be passed in as parameters.\n\n```\nrange($firstNum, $lastNum, $step) AS list\n```\n\nrange() creates a list of numbers (step is optional), other functions returning lists are: labels(), nodes(),\nrelationships().\n\n```\nMATCH p = (a)-[:KNOWS*]->()\nRETURN relationships(p) AS r\n```\n\nThe list of relationships comprising a variable length path can be returned using named paths and relationships().\n\n```\nRETURN matchedNode.list[0] AS value,\n       size(matchedNode.list) AS len\n```\n\nProperties can be lists of strings, numbers or booleans.\n\n```\nlist[$idx] AS value,\nlist[$startIdx..$endIdx] AS slice\n```\n\nList elements can be accessed with idx subscripts in square brackets. Invalid indexes return null. Slices can be\nretrieved with intervals from start_idx to end_idx, each of which can be omitted or negative. Out of range elements are\nignored.\n\n```\nUNWIND $names AS name\nMATCH (n {name: name})\nRETURN avg(n.age)\n```\n\nWith UNWIND, any list can be transformed back into individual rows. The example matches all names from a list of names.\n\n```\nMATCH (a)\nRETURN [(a)-->(b) WHERE b.name = 'Bob' | b.age]\n```\n\nPattern comprehensions may be used to do a custom projection from a match directly into a list.\n\n```\nMATCH (person)\nRETURN person { .name, .age}\n```\n\nMap projections may be easily constructed from nodes, relationships and other map values.\n\n### Maps\n\n```\n{name: 'Alice', age: 38,\n address: {city: 'London', residential: true}}\n```\n\nLiteral maps are declared in curly braces much like property maps. Lists are supported.\n\n```\nWITH {person: {name: 'Anne', age: 25}} AS p\nRETURN p.person.name\n```\n\nAccess the property of a nested map.\n\n```\nMERGE (p:Person {name: $map.name})\n  ON CREATE SET p = $map\n```\n\nMaps can be passed in as parameters and used either as a map or by accessing keys.\n\n```\nMATCH (matchedNode:Person)\nRETURN matchedNode\n```\n\nNodes and relationships are returned as maps of their data.\n\n```\nmap.name, map.age, map.children[0]\n```\n\nMap entries can be accessed by their keys. Invalid keys result in an error.\n\n### Predicates\n\n```\nn.property <> $value\n```\n\nUse comparison operators.\n\n```\ntoString(n.property) = $value\n```\n\nUse functions.\n\n```\nn.number >= 1 AND n.number <= 10\n```\n\nUse boolean operators to combine predicates.\n\n```\n1 <= n.number <= 10\n```\n\nUse chained operators to combine predicates.\n\n```\nn:Person\n```\n\nCheck for node labels.\n\n```\nvariable IS NOT NULL\n```\n\nCheck if something is not null, e.g. that a property exists.\n\n```\nn.property IS NULL OR n.property = $value\n```\n\nEither the property does not exist or the predicate is true.\n\n```\nn.property = $value\n```\n\nNon-existing property returns null, which is not equal to anything.\n\n```\nn[\"property\"] = $value\n```\n\nProperties may also be accessed using a dynamically computed property name.\n\n```\nn.property STARTS WITH 'Tim' OR\nn.property ENDS WITH 'n' OR\nn.property CONTAINS 'goodie'\n```\n\nString matching.\n\n```\nn.property =~ 'Tim.*'\n```\n\nString regular expression matching.\n\n```\n(n)-[:KNOWS]->(m)\n```\n\nEnsure the pattern has at least one match.\n\n```\nNOT (n)-[:KNOWS]->(m)\n```\n\nExclude matches to (n)-[:KNOWS]->(m) from the result.\n\n```\nn.property IN [$value1, $value2]\n```\n\nCheck if an element exists in a list.\n\n### List predicates\n\n```\nall(x IN coll WHERE x.property IS NOT NULL)\n```\n\nReturns true if the predicate is true for all elements in the list.\n\n```\nany(x IN coll WHERE x.property IS NOT NULL)\n```\n\nReturns true if the predicate is true for at least one element in the list.\n\n```\nnone(x IN coll WHERE x.property IS NOT NULL)\n```\n\nReturns true if the predicate is false for all elements in the list.\n\n```\nsingle(x IN coll WHERE x.property IS NOT NULL)\n```\n\nReturns true if the predicate is true for exactly one element in the list.\n\n### CASE\n\n```\nCASE n.eyes\n WHEN 'blue' THEN 1\n WHEN 'brown' THEN 2\n ELSE 3\nEND\n```\n\nReturn THEN value from the matching WHEN value. The ELSE value is optional, and substituted for null if missing.\n\n```\nCASE\n WHEN n.eyes = 'blue' THEN 1\n WHEN n.age < 40 THEN 2\n ELSE 3\nEND\n```\n\nReturn THEN value from the first WHEN predicate evaluating to true. Predicates are evaluated in order.\n\n### List expressions\n\n```\nsize($list)\n```\n\nNumber of elements in the list.\n\n```\nreverse($list)\n```\n\nReverse the order of the elements in the list.\n\n```\nhead($list), last($list), tail($list)\n```\n\nhead() returns the first, last() the last element of the list. tail() returns all but the first element. All return null\nfor an empty list.\n\n```\n[x IN list | x.prop]\n```\n\nA list of the value of the expression for each element in the original list.\n\n```\n[x IN list WHERE x.prop <> $value]\n```\n\nA filtered list of the elements where the predicate is true.\n\n```\n[x IN list WHERE x.prop <> $value | x.prop]\n```\n\nA list comprehension that filters a list and extracts the value of the expression for each element in that list.\n\n```\nreduce(s = \"\", x IN list | s + x.prop)\n```\n\nEvaluate expression for each element in the list, accumulate the results.\n\n### Functions\n\n```\ncoalesce(n.property, $defaultValue)\n```\n\nThe first non-null expression.\n\n```\ntimestamp()\n```\n\nMilliseconds since midnight, January 1, 1970 UTC.\n\n```\nid(nodeOrRelationship)\n```\n\nThe internal id of the relationship or node.\n\n```\ntoInteger($expr)\n```\n\nConverts the given input into an integer if possible; otherwise it returns null.\n\n```\ntoFloat($expr)\n```\n\nConverts the given input into a floating point number if possible; otherwise it returns null.\n\n```\ntoBoolean($expr)\n```\n\nConverts the given input into a boolean if possible; otherwise it returns null.\n\n```\nkeys($expr)\n```\n\nReturns a list of string representations for the property names of a node, relationship, or map.\n\n```\nproperties($expr)\n```\n\nReturns a map containing all the properties of a node or relationship.\n\n### Path functions\n\n```\nlength(path)\n```\n\nThe number of relationships in the path.\n\n```\nnodes(path)\n```\n\nThe nodes in the path as a list.\n\n```\nrelationships(path)\n```\n\nThe relationships in the path as a list.\n\n```\n[x IN nodes(path) | x.prop]\n```\n\nExtract properties from the nodes in a path.\n\n### Spatial functions\n\n```\npoint({x: $x, y: $y})\n```\n\nReturns a point in a 2D cartesian coordinate system.\n\n```\npoint({latitude: $y, longitude: $x})\n```\n\nReturns a point in a 2D geographic coordinate system, with coordinates specified in decimal degrees.\n\n```\npoint({x: $x, y: $y, z: $z})\n```\n\nReturns a point in a 3D cartesian coordinate system.\n\n```\npoint({latitude: $y, longitude: $x, height: $z})\n```\n\nReturns a point in a 3D geographic coordinate system, with latitude and longitude in decimal degrees, and height in\nmeters.\n\n```\ndistance(point({x: $x1, y: $y1}), point({x: $x2, y: $y2}))\n```\n\nReturns a floating point number representing the linear distance between two points. The returned units will be the same\nas those of the point coordinates, and it will work for both 2D and 3D cartesian points.\n\n```\ndistance(point({latitude: $y1, longitude: $x1}), point({latitude: $y2, longitude: $x2}))\n```\n\nReturns the geodesic distance between two points in meters. It can be used for 3D geographic points as well.\n\n## Neo4j Functions\n\n### Temporal functions\n\n```\ndate(\"2018-04-05\")\n```\n\nReturns a date parsed from a string.\n\n```\nlocaltime(\"12:45:30.25\")\n```\n\nReturns a time with no time zone.\n\n```\ntime(\"12:45:30.25+01:00\")\n```\n\nReturns a time in a specified time zone.\n\n```\nlocaldatetime(\"2018-04-05T12:34:00\")\n```\n\nReturns a datetime with no time zone.\n\n```\ndatetime(\"2018-04-05T12:34:00[Europe/Berlin]\")\n```\n\nReturns a datetime in the specified time zone.\n\n```\ndatetime({epochMillis: 3360000})\n```\n\nTransforms 3360000 as a UNIX Epoch time into a normal datetime.\n\n```\ndate({year: $year, month: $month, day: $day})\n```\n\nAll of the temporal functions can also be called with a map of named components. This example returns a date from year,\nmonth and day components. Each function supports a different set of possible components.\n\n```\ndatetime({date: $date, time: $time})\n```\n\nTemporal types can be created by combining other types. This example creates a datetime from a date and a time.\n\n```\ndate({date: $datetime, day: 5})\n```\n\nTemporal types can be created by selecting from more complex types, as well as overriding individual components. This\nexample creates a date by selecting from a datetime, as well as overriding the day component.\n\n```\nWITH date(\"2018-04-05\") AS d\nRETURN d.year, d.month, d.day, d.week, d.dayOfWeek\n```\n\nAccessors allow extracting components of temporal types.\n\n### Duration functions\n\n```\nduration(\"P1Y2M10DT12H45M30.25S\")\n```\n\nReturns a duration of 1 year, 2 months, 10 days, 12 hours, 45 minutes and 30.25 seconds.\n\n```\nduration.between($date1,$date2)\n```\n\nReturns a duration between two temporal instances.\n\n```\nWITH duration(\"P1Y2M10DT12H45M\") AS d\nRETURN d.years, d.months, d.days, d.hours, d.minutes\n```\n\nReturns 1 year, 14 months, 10 days, 12 hours and 765 minutes.\n\n```\nWITH duration(\"P1Y2M10DT12H45M\") AS d\nRETURN d.years, d.monthsOfYear, d.days, d.hours, d.minutesOfHour\n```\n\nReturns 1 year, 2 months, 10 days, 12 hours and 45 minutes.\n\n```\ndate(\"2015-01-01\") + duration(\"P1Y1M1D\")\n```\n\nReturns a date of 2016-02-02. It is also possible to subtract durations from temporal instances.\n\n```\nduration(\"PT30S\") * 10\n```\n\nReturns a duration of 5 minutes. It is also possible to divide a duration by a number.\n\n### Mathematical functions\n\n```\nabs($expr)\n```\n\nThe absolute value.\n\n```\nrand()\n```\n\nReturns a random number in the range from 0 (inclusive) to 1 (exclusive), [0,1). Returns a new value for each call. Also\nuseful for selecting a subset or random ordering.\n\n```\nround($expr)\n```\n\nRound to the nearest integer; ceil() and floor() find the next integer up or down.\n\n```\nsqrt($expr)\n```\n\nThe square root.\n\n```\nsign($expr)\n```\n\n0 if zero, -1 if negative, 1 if positive.\n\n```\nsin($expr)\n```\n\nTrigonometric functions also include cos(), tan(), cot(), asin(), acos(), atan(), atan2(), and haversin(). All arguments\nfor the trigonometric functions should be in radians, if not otherwise specified.\n\n```\ndegrees($expr), radians($expr), pi()\n```\n\nConverts radians into degrees; use radians() for the reverse, and pi() for π.\n\n```\nlog10($expr), log($expr), exp($expr), e()\n```\n\nLogarithm base 10, natural logarithm, e to the power of the parameter, and the value of e.\n\n### String functions\n\n```\ntoString($expression)\n```\n\nString representation of the expression.\n\n```\nreplace($original, $search, $replacement)\n```\n\nReplace all occurrences of search with replacement. All arguments must be expressions.\n\n```\nsubstring($original, $begin, $subLength)\n```\n\nGet part of a string. The subLength argument is optional.\n\n```\nleft($original, $subLength),\n  right($original, $subLength)\n```\n\nThe first part of a string. The last part of the string.\n\n```\ntrim($original), lTrim($original),\n  rTrim($original)\n```\n\nTrim all whitespace, or on the left or right side.\n\n```\ntoUpper($original), toLower($original)\n```\n\nUPPERCASE and lowercase.\n\n```\nsplit($original, $delimiter)\n```\n\nSplit a string into a list of strings.\n\n```\nreverse($original)\n```\n\nReverse a string.\n\n```\nsize($string)\n```\n\nCalculate the number of characters in the string.\n\n### Relationship functions\n\n```\ntype(a_relationship)\n```\n\nString representation of the relationship type.\n\n```\nstartNode(a_relationship)\n```\n\nStart node of the relationship.\n\n```\nendNode(a_relationship)\n```\n\nEnd node of the relationship.\n\n```\nid(a_relationship)\n```\n\nThe internal id of the relationship.\n\n### Aggregating functions\n\n```\ncount(*)\n```\n\nThe number of matching rows.\n\n```\ncount(variable)\n```\n\nThe number of non-null values.\n\n```\ncount(DISTINCT variable)\n```\n\nAll aggregating functions also take the DISTINCT operator, which removes duplicates from the values.\n\n```\ncollect(n.property)\n```\n\nList from the values, ignores null.\n\n```\nsum(n.property)\n```\n\nSum numerical values. Similar functions are avg(), min(), max().\n\n```\npercentileDisc(n.property, $percentile)\n```\n\nDiscrete percentile. Continuous percentile is percentileCont(). The percentile argument is from 0.0 to 1.0.\n\n```\nstDev(n.property)\n```\n\nStandard deviation for a sample of a population. For an entire population use stDevP().\n\n## Neo4j Schema Operations\n\n### INDEX\n\n```\nCREATE INDEX FOR (p:Person) ON (p.name)\n```\n\nCreate an index on nodes with label Person and property name.\n\n```\nCREATE INDEX index_name FOR ()-[k:KNOWS]-() ON (k.since)\n```\n\nCreate an index on relationships with type KNOWS and property since with the name index_name.\n\n```\nCREATE INDEX FOR (p:Person) ON (p.surname)\nOPTIONS {indexProvider: 'native-btree-1.0', indexConfig: {`spatial.cartesian.min`: [-100.0, -100.0], `spatial.cartesian.max`: [100.0, 100.0]}}\n```\n\nCreate an index on nodes with label Person and property surname with the index provider native-btree-1.0 and given\nspatial.cartesian settings. The other index settings will have their default values.\n\n```\nCREATE INDEX FOR (p:Person) ON (p.name, p.age)\n```\n\nCreate a composite index on nodes with label Person and the properties name and age, throws an error if the index\nalready exist.\n\n```\nCREATE INDEX IF NOT EXISTS FOR (p:Person) ON (p.name, p.age)\n```\n\nCreate a composite index on nodes with label Person and the properties name and age if it does not already exist, does\nnothing if it did exist.\n\n```\nCREATE LOOKUP INDEX lookup_index_name FOR (n) ON EACH labels(n)\n```\n\nCreate a token lookup index with the name lookup_index_name on nodes with any label .\n\n```\nCREATE LOOKUP INDEX FOR ()-[r]-() ON EACH type(r)\n```\n\nCreate a token lookup index on relationships with any relationship type.\n\n```\nCREATE FULLTEXT INDEX node_fulltext_index_name FOR (n:Friend) ON EACH [n.name]\nOPTIONS {indexConfig: {`fulltext.analyzer`: 'swedish'}}\n```\n\nCreate a fulltext index on nodes with the name node_fulltext_index_name and analyzer swedish. Fulltext indexes on nodes\ncan only be used by from the procedure db.index.fulltext.queryNodes. The other index settings will have their default\nvalues.\n\n```\nCREATE FULLTEXT INDEX rel_fulltext_index_name FOR ()-[r:HAS_PET|BROUGHT_PET]-() ON EACH [r.since, r.price]\n```\n\nCreate a fulltext index on relationships with the name rel_fulltext_index_name. Fulltext indexes on relationships can\nonly be used by from the procedure db.index.fulltext.queryRelationships.\n\n```\nSHOW INDEXES\n```\n\nList all indexes.\n\n```\nMATCH (n:Person) WHERE n.name = $value\n```\n\nAn index can be automatically used for the equality comparison. Note that for example toLower(n.name) = $value will not\nuse an index.\n\n```\nMATCH (n:Person)\nWHERE n.name IN [$value]\n```\n\nAn index can automatically be used for the IN list checks.\n\n```\nMATCH (n:Person)\nWHERE n.name = $value and n.age = $value2\n```\n\nA composite index can be automatically used for equality comparison of both properties. Note that there needs to be\npredicates on all properties of the composite index for it to be used.\n\n```\nMATCH (n:Person)\nUSING INDEX n:Person(name)\nWHERE n.name = $value\n```\n\nIndex usage can be enforced when Cypher uses a suboptimal index, or more than one index should be used.\n\n```\nDROP INDEX index_name\n```\n\nDrop the index named index_name, throws an error if the index does not exist.\n\n```\nDROP INDEX index_name IF EXISTS\n```\n\nDrop the index named index_name if it exists, does nothing if it does not exist.\n\n### CONSTRAINT\n\n```\nCREATE CONSTRAINT ON (p:Person)\n       ASSERT p.name IS UNIQUE\n```\n\nCreate a unique property constraint on the label Person and property name. If any other node with that label is updated\nor created with a name that already exists, the write operation will fail. This constraint will create an accompanying\nindex.\n\n```\nCREATE CONSTRAINT uniqueness ON (p:Person)\n       ASSERT p.age IS UNIQUE\n```\n\nCreate a unique property constraint on the label Person and property age with the name uniqueness. If any other node\nwith that label is updated or created with a age that already exists, the write operation will fail. This constraint\nwill create an accompanying index.\n\n```\nCREATE CONSTRAINT ON (p:Person)\n       ASSERT p.surname IS UNIQUE\n       OPTIONS {indexProvider: 'native-btree-1.0'}\n```\n\nCreate a unique property constraint on the label Person and property surname with the index provider native-btree-1.0\nfor the accompanying index.\n\n```\nCREATE CONSTRAINT ON (p:Person)\n       ASSERT p.name IS NOT NULL\n```\n\n(★) Create a node property existence constraint on the label Person and property name, throws an error if the constraint\nalready exists. If a node with that label is created without a name, or if the name property is removed from an existing\nnode with the Person label, the write operation will fail.\n\n```\nCREATE CONSTRAINT node_exists IF NOT EXISTS ON (p:Person)\n       ASSERT p.name IS NOT NULL\n```\n\n(★) If a node property existence constraint on the label Person and property name or any constraint with the name\nnode_exists already exist then nothing happens. If no such constraint exists, then it will be created.\n\n```\nCREATE CONSTRAINT ON ()-[l:LIKED]-()\n       ASSERT l.when IS NOT NULL\n```\n\n(★) Create a relationship property existence constraint on the type LIKED and property when. If a relationship with that\ntype is created without a when, or if the when property is removed from an existing relationship with the LIKED type,\nthe write operation will fail.\n\n```\nCREATE CONSTRAINT relationship_exists ON ()-[l:LIKED]-()\n       ASSERT l.since IS NOT NULL\n```\n\n(★) Create a relationship property existence constraint on the type LIKED and property since with the name\nrelationship_exists. If a relationship with that type is created without a since, or if the since property is removed\nfrom an existing relationship with the LIKED type, the write operation will fail.\n\n```\nSHOW UNIQUE CONSTRAINTS YIELD *\n```\n\nList all unique constraints.\n\n```\nCREATE CONSTRAINT ON (p:Person)\n      ASSERT (p.firstname, p.surname) IS NODE KEY\n```\n\n(★) Create a node key constraint on the label Person and properties firstname and surname. If a node with that label is\ncreated without both firstname and surname or if the combination of the two is not unique, or if the firstname and/or\nsurname labels on an existing node with the Person label is modified to violate these constraints, the write operation\nwill fail.\n\n```\nCREATE CONSTRAINT node_key ON (p:Person)\n      ASSERT (p.name, p.surname) IS NODE KEY\n```\n\n(★) Create a node key constraint on the label Person and properties name and surname with the name node_key. If a node\nwith that label is created without both name and surname or if the combination of the two is not unique, or if the name\nand/or surname labels on an existing node with the Person label is modified to violate these constraints, the write\noperation will fail.\n\n```\nCREATE CONSTRAINT node_key_with_config ON (p:Person)\n      ASSERT (p.name, p.age) IS NODE KEY\n      OPTIONS {indexConfig: {`spatial.wgs-84.min`: [-100.0, -100.0], `spatial.wgs-84.max`: [100.0, 100.0]}}\n```\n\n(★) Create a node key constraint on the label Person and properties name and age with the name node_key_with_config and\ngiven spatial.wgs-84 settings for the accompanying index. The other index settings will have their default values.\n\n```\nDROP CONSTRAINT uniqueness\n```\n\nDrop the constraint with the name uniqueness, throws an error if the constraint does not exist.\n\n```\nDROP CONSTRAINT uniqueness IF EXISTS\n```\n\nDrop the constraint with the name uniqueness if it exists, does nothing if it does not exist.\n\n### Performance\n\n- Use parameters instead of literals when possible. This allows Cypher to re-use your queries instead of having to parse\n  and build new execution plans.\n- Always set an upper limit for your variable length patterns. It’s possible to have a query go wild and touch all nodes\n  in a graph by mistake.\n- Return only the data you need. Avoid returning whole nodes and relationships — instead, pick the data you need and\n  return only that.\n- Use `PROFILE` / `EXPLAIN` to analyze the performance of your queries. See\n  [Query Tuning](https://neo4j.com/docs/cypher-manual/4.3/query-tuning) for more information on these and other topics,\n  such as planner hints.\n\n## Neo4j Multidatabase\n\n### Database management\n\n```\nCREATE OR REPLACE DATABASE myDatabase\n```\n\n(★) Create a database named myDatabase. If a database with that name exists, then the existing database is deleted and a\nnew one created.\n\n```\nSTOP DATABASE myDatabase\n```\n\n(★) Stop the database myDatabase.\n\n```\nSTART DATABASE myDatabase\n```\n\n(★) Start the database myDatabase.\n\n```\nSHOW DATABASES\n```\n\nList all databases in the system and information about them.\n\n```\nSHOW DATABASES\nYIELD name, currentStatus\nWHERE name CONTAINS 'my' AND currentStatus = 'online'\n```\n\nList information about databases, filtered by name and online status and further refined by conditions on these.\n\n```\nSHOW DATABASE myDatabase\n```\n\nList information about the database myDatabase.\n\n```\nSHOW DEFAULT DATABASE\n```\n\nList information about the default database.\n\n```\nSHOW HOME DATABASE\n```\n\nList information about the current users home database.\n\n```\nDROP DATABASE myDatabase IF EXISTS\n```\n\n(★) Delete the database myDatabase, if it exists.\n\n## Neo4j Security\n\n### User management\n\n```\nCREATE USER alice SET PASSWORD $password\n```\n\nCreate a new user and a password. This password must be changed on the first login.\n\n```\nALTER USER alice SET PASSWORD $password CHANGE NOT REQUIRED\n```\n\nSet a new password for a user. This user will not be required to change this password on the next login.\n\n```\nALTER USER alice IF EXISTS SET PASSWORD CHANGE REQUIRED\n```\n\nIf the specified user exists, force this user to change their password on the next login.\n\n```\nALTER USER alice SET STATUS SUSPENDED\n```\n\n(★) Change the user status to suspended. Use SET STATUS ACTIVE to reactivate the user.\n\n```\nALTER USER alice SET HOME DATABASE otherDb\n```\n\n(★) Change the home database of user to otherDb. Use REMOVE HOME DATABASE to unset the home database for the user and\nfallback to the default database.\n\n```\nALTER CURRENT USER SET PASSWORD FROM $old TO $new\n```\n\nChange the password of the logged-in user. The user will not be required to change this password on the next login.\n\n```\nSHOW CURRENT USER\n```\n\nList the currently logged-in user, their status, roles and whether they need to change their password. (★) Status and\nroles are Enterprise Edition only.\n\n```\nSHOW USERS\n```\n\nList all users in the system, their status, roles and if they need to change their password. (★) Status and roles are\nEnterprise Edition only.\n\n```\nSHOW USERS\nYIELD user, suspended\nWHERE suspended = true\n```\n\nList users in the system, filtered by their name and status and further refined by whether they are suspended. (★)\nStatus is Enterprise Edition only.\n\n```\nRENAME USER alice TO alice_delete\n```\n\nRename the user alice to alice_delete.\n\n```\nDROP USER alice_delete\n```\n\nDelete the user.\n\n### (★) Role management\n\n```\nCREATE ROLE my_role\n```\n\nCreate a role.\n\n```\nCREATE ROLE my_second_role IF NOT EXISTS AS COPY OF my_role\n```\n\nCreate a role named my_second_role, unless it already exists, as a copy of the existing my_role.\n\n```\nRENAME ROLE my_second_role TO my_other_role\n```\n\nRename a role named my_second_role to my_other_role.\n\n```\nGRANT ROLE my_role, my_other_role TO alice\n```\n\nAssign roles to a user.\n\n```\nREVOKE ROLE my_other_role FROM alice\n```\n\nRemove a specified role from a user.\n\n```\nSHOW ROLES\n```\n\nList all roles in the system.\n\n```\nSHOW ROLES\nYIELD role\nWHERE role CONTAINS 'my'\n```\n\nList roles, filtered by the name of the role and further refined by whether the name contains 'my'.\n\n```\nSHOW POPULATED ROLES WITH USERS\n```\n\nList all roles that are assigned to at least one user in the system, and the users assigned to those roles.\n\n```\nDROP ROLE my_role\n```\n\nDelete a role.\n\n### (★) Graph read privileges\n\n```\nGRANT TRAVERSE ON GRAPH * NODES * TO my_role\n```\n\nGrant traverse privilege on all nodes and all graphs to a role.\n\n```\nDENY READ {prop} ON GRAPH foo RELATIONSHIP Type TO my_role\n```\n\nDeny read privilege on a specified property, on all relationships with a specified type in a specified graph, to a role.\n\n```\nGRANT MATCH {*} ON HOME GRAPH ELEMENTS Label TO my_role\n```\n\nGrant read privilege on all properties and traverse privilege in the home graph, to a role. Here, both privileges apply\nto all nodes and relationships with a specified label/type in the graph.\n\n### (★) Graph write privileges\n\n```\nGRANT CREATE ON GRAPH * NODES Label TO my_role\n```\n\nGrant create privilege on all nodes with a specified label in all graphs to a role.\n\n```\nDENY DELETE ON GRAPH neo4j TO my_role\n```\n\nDeny delete privilege on all nodes and relationships in a specified graph to a role.\n\n```\nREVOKE SET LABEL Label ON GRAPH * FROM my_role\n```\n\nRevoke set label privilege for the specified label on all graphs to a role.\n\n```\nGRANT REMOVE LABEL * ON GRAPH foo TO my_role\n```\n\nGrant remove label privilege for all labels on a specified graph to a role.\n\n```\nDENY SET PROPERTY {prop} ON GRAPH foo RELATIONSHIPS Type TO my_role\n```\n\nDeny set property privilege on a specified property, on all relationships with a specified type in a specified graph, to\na role.\n\n```\nGRANT MERGE {*} ON GRAPH * NODES Label TO my_role\n```\n\nGrant merge privilege on all properties, on all nodes with a specified label in all graphs, to a role.\n\n```\nREVOKE WRITE ON GRAPH * FROM my_role\n```\n\nRevoke write privilege on all graphs from a role.\n\n```\nDENY ALL GRAPH PRIVILEGES ON GRAPH foo TO my_role\n```\n\nDeny all graph privileges privilege on a specified graph to a role.\n\n### (★) SHOW PRIVILEGES\n\n```\nSHOW PRIVILEGES AS COMMANDS\n```\n\nList all privileges in the system as Cypher commands.\n\n```\nSHOW PRIVILEGES\n```\n\nList all privileges in the system, and the roles that they are assigned to.\n\n```\nSHOW PRIVILEGES\nYIELD role, action, access\nWHERE role = 'my_role'\n```\n\nList information about privileges, filtered by role, action and access and further refined by the name of the role.\n\n```\nSHOW ROLE my_role PRIVILEGES AS COMMANDS\n```\n\nList all privileges assigned to a role as Cypher commands.\n\n```\nSHOW ROLE my_role, my_second_role PRIVILEGES AS COMMANDS\n```\n\nList all privileges assigned to each of the multiple roles as Cypher commands.\n\n```\nSHOW USER alice PRIVILEGES AS COMMANDS\n```\n\nList all privileges of a user, and the role that they are assigned to as Cypher commands.\n\n```\nSHOW USER PRIVILEGES AS COMMANDS\n```\n\nList all privileges of the currently logged in user, and the role that they are assigned to as Cypher commands.\n\n### (★) Database privileges\n\n```\nGRANT ACCESS ON DATABASE * TO my_role\n```\n\nGrant privilege to access and run queries against all databases to a role.\n\n```\nGRANT START ON DATABASE * TO my_role\n```\n\nGrant privilege to start all databases to a role.\n\n```\nGRANT STOP ON DATABASE * TO my_role\n```\n\nGrant privilege to stop all databases to a role.\n\n```\nGRANT CREATE INDEX ON DATABASE foo TO my_role\n```\n\nGrant privilege to create indexes on a specified database to a role.\n\n```\nGRANT DROP INDEX ON DATABASE foo TO my_role\n```\n\nGrant privilege to drop indexes on a specified database to a role.\n\n```\nGRANT SHOW INDEX ON DATABASE * TO my_role\n```\n\nGrant privilege to show indexes on all databases to a role.\n\n```\nDENY INDEX MANAGEMENT ON DATABASE bar TO my_role\n```\n\nDeny privilege to create and drop indexes on a specified database to a role.\n\n```\nGRANT CREATE CONSTRAINT ON DATABASE * TO my_role\n```\n\nGrant privilege to create constraints on all databases to a role.\n\n```\nDENY DROP CONSTRAINT ON DATABASE * TO my_role\n```\n\nDeny privilege to drop constraints on all databases to a role.\n\n```\nDENY SHOW CONSTRAINT ON DATABASE foo TO my_role\n```\n\nDeny privilege to show constraints on a specified database to a role.\n\n```\nREVOKE CONSTRAINT ON DATABASE * FROM my_role\n```\n\nRevoke granted and denied privileges to create and drop constraints on all databases from a role.\n\n```\nGRANT CREATE NEW LABELS ON DATABASE * TO my_role\n```\n\nGrant privilege to create new labels on all databases to a role.\n\n```\nDENY CREATE NEW TYPES ON DATABASE foo TO my_role\n```\n\nDeny privilege to create new relationship types on a specified database to a role.\n\n```\nREVOKE GRANT CREATE NEW PROPERTY NAMES ON DATABASE bar FROM my_role\n```\n\nRevoke the grant privilege to create new property names on a specified database from a role.\n\n```\nGRANT NAME MANAGEMENT ON HOME DATABASE TO my_role\n```\n\nGrant privilege to create labels, relationship types, and property names on the home database to a role.\n\n```\nGRANT ALL ON DATABASE baz TO my_role\n```\n\nGrant privilege to access, create and drop indexes and constraints, create new labels, types and property names on a\nspecified database to a role.\n\n```\nGRANT SHOW TRANSACTION (*) ON DATABASE foo TO my_role\n```\n\nGrant privilege to list transactions and queries from all users on a specified database to a role.\n\n```\nDENY TERMINATE TRANSACTION (user1, user2) ON DATABASES * TO my_role\n```\n\nDeny privilege to kill transactions and queries from user1 and user2 on all databases to a role.\n\n```\nREVOKE GRANT TRANSACTION MANAGEMENT ON HOME DATABASE FROM my_role\n```\n\nRevoke the granted privilege to list and kill transactions and queries from all users on the home database from a role.\n\n### (★) Role management privileges\n\n```\nGRANT CREATE ROLE ON DBMS TO my_role\n```\n\nGrant the privilege to create roles to a role.\n\n```\nGRANT RENAME ROLE ON DBMS TO my_role\n```\n\nGrant the privilege to rename roles to a role.\n\n```\nGRANT DROP ROLE ON DBMS TO my_role\n```\n\nGrant the privilege to delete roles to a role.\n\n```\nDENY ASSIGN ROLE ON DBMS TO my_role\n```\n\nDeny the privilege to assign roles to users to a role.\n\n```\nDENY REMOVE ROLE ON DBMS TO my_role\n```\n\nDeny the privilege to remove roles from users to a role.\n\n```\nREVOKE DENY SHOW ROLE ON DBMS FROM my_role\n```\n\nRevoke the denied privilege to show roles from a role.\n\n```\nGRANT ROLE MANAGEMENT ON DBMS TO my_role\n```\n\nGrant all privileges to manage roles to a role.\n\n### (★) User management privileges\n\n```\nGRANT CREATE USER ON DBMS TO my_role\n```\n\nGrant the privilege to create users to a role.\n\n```\nGRANT RENAME USER ON DBMS TO my_role\n```\n\nGrant the privilege to rename users to a role.\n\n```\nDENY ALTER USER ON DBMS TO my_role\n```\n\nDeny the privilege to alter users to a role.\n\n```\nREVOKE SET PASSWORDS ON DBMS FROM my_role\n```\n\nRevoke the granted and denied privileges to alter users' passwords from a role.\n\n```\nREVOKE GRANT SET USER STATUS ON DBMS FROM my_role\n```\n\nRevoke the granted privilege to alter the account status of users from a role.\n\n```\nGRANT SET USER HOME DATABASE ON DBMS TO my_role\n```\n\nGrant the privilege alter the home database of users to a role.\n\n```\nGRANT DROP USER ON DBMS TO my_role\n```\n\nGrant the privilege to delete users to a role.\n\n```\nREVOKE DENY SHOW USER ON DBMS FROM my_role\n```\n\nRevoke the denied privilege to show users from a role.\n\n```\nGRANT USER MANAGEMENT ON DBMS TO my_role\n```\n\nGrant all privileges to manage users to a role.\n\n### (★) Database management privileges\n\n```\nGRANT CREATE DATABASE ON DBMS TO my_role\n```\n\nGrant the privilege to create databases to a role.\n\n```\nREVOKE DENY DROP DATABASE ON DBMS FROM my_role\n```\n\nRevoke the denied privilege to delete databases from a role.\n\n```\nDENY DATABASE MANAGEMENT ON DBMS TO my_role\n```\n\nDeny all privileges to manage database to a role.\n\n### (★) Privilege management privileges\n\n```\nGRANT SHOW PRIVILEGE ON DBMS TO my_role\n```\n\nGrant the privilege to show privileges to a role.\n\n```\nDENY ASSIGN PRIVILEGE ON DBMS TO my_role\n```\n\nDeny the privilege to assign privileges to roles to a role.\n\n```\nREVOKE GRANT REMOVE PRIVILEGE ON DBMS FROM my_role\n```\n\nRevoke the granted privilege to remove privileges from roles from a role.\n\n```\nREVOKE PRIVILEGE MANAGEMENT ON DBMS FROM my_role\n```\n\nRevoke all granted and denied privileges for manage privileges from a role.\n\n### (★) DBMS privileges\n\n```\nGRANT ALL ON DBMS TO my_role\n```\n\nGrant privilege to perform all role management, user management, database management and privilege management to a role.\n\n## ★ Note\n\n(★) Functionality available in Neo4j Enterprise Edition.\n"
  },
  {
    "path": "source/_posts/netstat.md",
    "content": "---\ntitle: Netstat\ndate: 2021-01-27 11:44:21\nbackground: bg-slate-700\ntags:\n  - network\n  - utility\n  - port\ncategories:\n  - Linux Command\nintro: |\n  This quick reference cheat sheet provides various for using netstat command.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Statistics\n\nAll connections on port 80\n\n```shell script\n$ netstat -anp | grep :80\n```\n\nNetstat Help\n\n```shell script\n$ netstat -h\n```\n\n### Listening\n\n| Option           | Example              |\n| ---------------- | -------------------- |\n| `netstat -ltunp` | All Listening ports  |\n| `netstat -ltn`   | Listening TCP ports  |\n| `netstat -lun`   | Listening UDP ports  |\n| `netstat -lx`    | Listening Unix ports |\n\n### Connections\n\n| Option        | Example             |\n| ------------- | ------------------- |\n| `netstat -a`  | All connections     |\n| `netstat -at` | All TCP connections |\n| `netstat -au` | All UDP connections |\n\n### Statistics\n\n| Option        | Example                |\n| ------------- | ---------------------- |\n| `netstat -s`  | Display statistics     |\n| `netstat -st` | Display TCP statistics |\n| `netstat -su` | Display UDP statistics |\n\n### Networks\n\n| Option        | Example                               |\n| ------------- | ------------------------------------- |\n| `netstat -i`  | Show network interfaces               |\n| `netstat -ie` | Show network interfaces extended info |\n\n### Routing\n\n| Option        | Example                                 |\n| ------------- | --------------------------------------- |\n| `netstat -r`  | Show routing table                      |\n| `netstat -rn` | Show routing table, don't resolve hosts |\n"
  },
  {
    "path": "source/_posts/networkports.md",
    "content": "---\r\ntitle: NetworkPorts\r\ndate: 2025-06-19 15:00:00\r\nbackground: bg-[#71d1f9]\r\ntags:\r\n  - Network\r\ncategories:\r\n  - Other\r\nintro: |\r\n  A network ports cheat sheet with non-exhaustive list of ports used according to their field of application.\r\nplugins:\r\n---\r\n\r\n\r\n## Networking and Infrastructure\r\n\r\n### Web Ports \r\n\r\n| **Port**     | **Nom**          | **Description**             |\r\n|:-------------| :--------------- |:----------------------------|\r\n| `80`         | HTTP             | HyperText Transfer Protocol |\r\n| `443`        | HTTPS            | HTTP Secure                 |\r\n| `8080`       | HTTP-Alt         | Alternative HTTP Port       |\r\n| `8443`       | HTTPS-Alt        | Alternative HTTPS Port      |\r\n| `8000`       | HTTP-Proxy       | For proxy server HTTP       |\r\n| `8008`       | HTTP-Backup      | Backup port for HTTP        |\r\n| `8888`       | HTTP-Alternative | Alternative port for HTTP   |\r\n\r\n### Network and Infrastructure Service Ports\r\n\r\n| **Port** | **Nom**   | **Description**                     |\r\n|:---------| :-------- |:------------------------------------|\r\n| `53`     | DNS       | Domain Name System                  |\r\n| `67`/`68`| DHCP      | Dynamic Host Configuration Protocol |\r\n| `123`    | NTP       | Network Time Protocol               |\r\n| `161`    | SNMP      | Simple Network Management Protocol  |\r\n| `162`    | SNMP-Trap | SNMP Trap Messages                  |\r\n| `514`    | Syslog    | Logging system                      |\r\n| `69`     | TFTP      | Trivial File Transfer Protocol      |\r\n\r\n### Virtualization and Containerization Service Ports\r\n\r\n| **Port**  | **Nom**       | **Description**                 |\r\n|:----------| :------------ |:--------------------------------|\r\n| `2375`    | Docker        | Docker without  TLS             |\r\n| `2376`    | Docker        | Docker with TLS                 |\r\n| `6443`    | Kubernetes    | Kubernetes API Server           |\r\n| `8443`    | Kubernetes    | Alternative Kubernetes API port |\r\n| `9100`    | Node Exporter | Prometheus Node Exporter        |\r\n| `9090`    | Prometheus    | Prometheus Monitoring           |\r\n| `5672`    | RabbitMQ      | Message Broker RabbitMQ         |\r\n\r\n### Monitoring and Management Service Ports {.col-span-2}\r\n\r\n| **Port** | **Nom**    | **Description**                           |\r\n|:---------| :--------- |:------------------------------------------|\r\n| `631`    | IPP        | Internet Printing Protocol                |\r\n| `873`    | rsync      | Remote Sync                               |\r\n| `8086`   | InfluxDB   | Time Series Database InfluxDB             |\r\n| `9093`   | Prometheus | Prometheus Alertmanager Alert Management  |\r\n\r\n\r\n\r\n## Data Management\r\n\r\n### Data Base Ports {.col-span-2}\r\n\r\n| **Port**  | **Nom**              | **Description**                       |\r\n|:----------| :------------------- |:--------------------------------------|\r\n| `1433`    | Microsoft SQL Server | Microsoft SQL Database Server         |\r\n| `3306`    | MySQL                | MySQL Database Management System      |\r\n| `5432`    | PostgreSQL           | PostgreSQL Database Management System |\r\n| `1521`    | Oracle               | Oracle Database Management System     |\r\n| `27017`   | MongoDB              | MongoDB NoSQL Database                |\r\n| `11211`   | Memcached            | Memcached Memory Caching System       |\r\n| `6379`    | Redis                | Redis In-Memory Database              |\r\n\r\n\r\n\r\n\r\n## Communication Services\r\n\r\n### Remote Ports\r\n\r\n| **Port** | **Nom** | **Description**                    |\r\n|:---------| :------ |:-----------------------------------|\r\n| `22`     | SSH     | Secure Shell                       |\r\n| `23`     | Telnet  | Unsecure remote terminal protocol  |\r\n| `3389`   | RDP     | Remote Desktop Protocol            |\r\n| `5900`   | VNC     | Virtual Network Computing          |\r\n| `69`     | TFTP    | Trivial File Transfer Protocol     |\r\n| `179`    | BGP     | Border Gateway Protocol            |\r\n| `113`    | Ident   | Ident Protocol                     |\r\n\r\n### Messagerie Service Ports\r\n\r\n| **Port** | **Nom**         | **Description**                  |\r\n|:---------| :-------------- |:---------------------------------|\r\n| `25`     | SMTP            | Simple Mail Transfer Protocol    |\r\n| `465`    | SMTPS           | SMTP Secure                      |\r\n| `587`    | SMTP-Submission | Port for email submission        |\r\n| `110`    | POP3            | Post Office Protocol v3          |\r\n| `995`    | POP3S           | POP3 Secure                      |\r\n| `143`    | IMAP            | Internet Message Access Protocol |\r\n| `993`    | IMAPS           | IMAP Secure                      |\r\n\r\n\r\n### Instant Messaging and VoIP Service Ports\r\n\r\n| **Port** | **Nom**     | **Description**                            |\r\n|:---------| :---------- |:-------------------------------------------|\r\n| `5060`   | SIP         | Session Initiation Protocol                |\r\n| `5061`   | SIP-Secure  | SIP over TLS                               |\r\n| `1720`   | H.323       | Communication protocol for VoIP            |\r\n| `3478`   | STUN        | Session Traversal Utilities for NAT        |\r\n| `1234`   | Skype       | Communication VoIP via Skype               |\r\n| `5222`   | XMPP        | Extensible Messaging and Presence Protocol |\r\n| `5223`   | XMPP-Secure | XMPP over SSL                              |\r\n\r\n\r\n### Voice and Video Service Ports {.col-span-2}\r\n\r\n| **Port**        | **Nom**    | **Description**                                         |\r\n|:----------------| :--------- |:--------------------------------------------------------|\r\n| `5060`          | SIP        | Session Initiation Protocol pour VoIP                   |\r\n| `5061`          | SIP Secure | SIP sur TLS                                             |\r\n| `16384`-`32767` | RTP        | Real-time Transport Protocol pour streaming audio/vidéo |\r\n| `3478`          | STUN       | Session Traversal Utilities for NAT                     |\r\n| `5004`          | RTP        | Real-time Transport Protocol for media                  |\r\n| `5222`          | XMPP       | Extensible messaging protocol for instant messaging     |\r\n| `9000`          | WebRTC     | Protocols for real-time communication via browser       |\r\n\r\n\r\n### P2P Download and Sharing Service Ports\r\n\r\n| **Port**      | **Nom**    | **Description**                        |\r\n|:--------------| :--------- |:---------------------------------------|\r\n| `6881`-`6889` | BitTorrent | Ports used by BitTorrent clients       |\r\n| `51413`       | BitTorrent | Default port for BitTorrent            |\r\n| `6969`        | BitTorrent | Default port for BitTorrent trackers   |\r\n| `1194`        | OpenVPN    | Also used for VPNs and some P2P        |\r\n| `4661`        | uTorrent   | Port used by uTorrent client           |\r\n| `37152`       | Steam      | Used by Steam platform for downloads   |\r\n\r\n\r\n\r\n\r\n## Security Services\r\n\r\n### Security Ports {.col-span-2}\r\n\r\n| **Port** | **Nom**     | **Description**                            |\r\n|:---------| :---------- | :----------------------------------------- |\r\n| `1194`   | OpenVPN     | Virtual Private Network                    |\r\n| `1701`   | L2TP        | Layer 2 Tunneling Protocol                 |\r\n| `1723`   | PPTP        | Point-to-Point Tunneling Protocol          |\r\n| `4500`   | IPsec-NAT-T | IPsec NAT Traversal                        |\r\n| `500`    | IKE         | Internet Key Exchange                      |\r\n| `1812`   | RADIUS      | Remote Authentication Dial-In User Service |\r\n| `3306`   | MySQL SSL   | MySQL avec chiffrement SSL                 |\r\n\r\n\r\n### Cryptography and Security Service Ports\r\n\r\n| **Port** | **Nom**   | **Description**                        |\r\n|:---------| :-------- |:---------------------------------------|\r\n| `443`    | HTTPS     | HTTP Secure avec SSL/TLS               |\r\n| `993`    | IMAPS     | IMAP sécurisé avec SSL/TLS             |\r\n| `995`    | POP3S     | POP3 sécurisé avec SSL/TLS             |\r\n| `636`    | LDAPS     | LDAP sécurisé avec SSL/TLS             |\r\n| `8443`   | HTTPS-Alt | Alternative port for HTTPS             |\r\n| `8888`   | SSL Proxy | Secure proxy using SSL/TLS             |\r\n| `563`    | SNEWS     | Secure Network News Transfer Protocol  |\r\n\r\n\r\n## System and Application Services\r\n\r\n### File Service Ports {.col-span-2}\r\n\r\n| **Port** | **Nom**     | **Description**                         |\r\n|:---------| :---------- |:----------------------------------------|\r\n| `20`     | FTP-DATA    | FTP data transfer                       |\r\n| `21`     | FTP         | File Transfer Protocol                  |\r\n| `22`     | SFTP        | Secure File Transfer Protocol (via SSH) |\r\n| `445`    | SMB         | Server Message Block (Windows Shares)   |\r\n| `139`    | NetBIOS-SSN | NetBIOS Session Service                 |\r\n| `2049`   | NFS         | Network File System                     |\r\n| `548`    | AFP         | Apple Filing Protocol                   |\r\n\r\n\r\n### Miscellaneous System and App Ports\r\n\r\n| **Port**    | **Nom** | **Description**                               |\r\n|:------------| :------ |:----------------------------------------------|\r\n| `137`-`139` | NetBIOS | NetBIOS services for naming and file sharing  |\r\n| `1900`      | UPnP    | Universal Plug and Play                       |\r\n| `24800`     | Vuze    | Client BitTorrent Vuze                        |\r\n| `32400`     | Plex    | Serveur multimédia Plex                       |\r\n\r\n\r\n## Miscellaneous Services\r\n\r\n\r\n### Gaming Service Ports {.col-span-2}\r\n\r\n| **Port**  | **Nom**       | **Description**                  |\r\n|:----------| :------------ |:---------------------------------|\r\n| `27015`   | Steam         | Steam gaming platform            |\r\n| `7777`    | Unreal Engine | Game servers using Unreal Engine |\r\n| `27020`   | Source Engine | Game servers using Source Engine |\r\n| `28910`   | Various Games | Various multiplayer games        |\r\n| `27000`   | Various Games | Additional multiplayer games     |\r\n\r\n\r\n### Miscellaneous Service Ports\r\n\r\n| **Port**  | **Nom** | **Description**                                           |\r\n|:----------| :------ | :-------------------------------------------------------- |\r\n| `500`     | ISAKMP  | Internet Security Association and Key Management Protocol |\r\n| `520`     | RIP     | Routing Information Protocol                              |\r\n| `1900`    | UPnP    | Universal Plug and Play                                   |\r\n| `3659`    | RADIUS  | Remote Authentication Dial-In User Service                |\r\n\r\n\r\n\r\n\r\n\r\n"
  },
  {
    "path": "source/_posts/nginx.md",
    "content": "---\ntitle: Nginx\ndate: 2025-09-15 21:17:50\nbackground: bg-slate-600\ntags:\ncategories:\n  - Linux Command\nintro: nginx quick reference cheat sheet\nplugins:\n  - copyCode\n---\n## Getting Started {.cols-3}\n\n### Install & Service\n\n- **Ubuntu/Debian**\n  ```shell script\n  $ sudo apt update && sudo apt install -y nginx\n  ```\n- **RHEL/CentOS**\n  ```shell script\n  $ sudo yum install -y epel-release nginx && sudo systemctl enable --now nginx\n  ```\n- **Service**\n  ```shell script\n  $ sudo systemctl status nginx\n  $ sudo systemctl reload nginx\n  $ sudo systemctl restart nginx\n  $ sudo nginx -t   # test config\n  $ nginx -V        # built modules\n  ```\n\n### Key Paths\n\n- `/etc/nginx/nginx.conf` _(main config)_\n- `/etc/nginx/conf.d/*.conf` _(drop‑ins)_\n- `/etc/nginx/sites-available/` + `sites-enabled/` _(Debian style)_\n- `/var/www/html` _(default docroot)_\n- `logs`: `/var/log/nginx/access.log`, `/var/log/nginx/error.log`\n\n### Minimal HTTP Server\n\n```nginx\n# /etc/nginx/conf.d/example.conf\nserver {\n  listen 80;\n  server_name example.com;\n  root /var/www/example/public;\n\n  location / {\n    try_files $uri $uri/ =404;\n  }\n}\n```\n\n## Config Structure {.cols-3}\n\n### Core Blocks\n\n- `main` (global)\n- `events` (worker connections)\n- `http` → `server` → `location`\n- `stream` (TCP/UDP)\n- `upstream` (load balancers)\n\n```nginx\nuser  www-data;\nworker_processes auto;\n\nevents { worker_connections 1024; }\n\nhttp {\n  include       mime.types;\n  default_type  application/octet-stream;\n  sendfile      on;\n  keepalive_timeout 65;\n\n  # servers / includes go here...\n}\n```\n\n### Context & Order\n\n- **`location` match order**:\n  1. Exact `=`\n  2. `^~` (no regex if matched)\n  3. Regex `~` / `~*` (first match)\n  4. Prefix (longest path)\n- `try_files` evaluates in order then falls back.\n\n```nginx\nlocation = /healthz { return 204; }\nlocation ^~ /static/ { expires 7d; }\nlocation ~* \\.(png|jpg|css|js)$ { expires 7d; }\nlocation / { try_files $uri $uri/ /index.html; }\n```\n\n### Common Includes\n\n```nginx\nhttp {\n  include /etc/nginx/conf.d/*.conf;\n  include /etc/nginx/snippets/*.conf; # Ubuntu/Debian\n}\n```\n\n## Virtual Hosts & Redirects {.cols-3}\n\n### Basic Server Block\n\n```nginx\nserver {\n  listen 80;\n  server_name example.com www.example.com;\n  root /var/www/example/public;\n  index index.html index.htm;\n}\n```\n\n### Redirect HTTP→HTTPS\n\n```nginx\nserver {\n  listen 80;\n  server_name example.com www.example.com;\n  return 301 https://example.com$request_uri;\n}\n```\n\n### Canonical Host\n\n```nginx\n# Force non-www\nserver {\n  listen 80;\n  server_name www.example.com;\n  return 301 $scheme://example.com$request_uri;\n}\n```\n\n## TLS/SSL {.cols-3}\n\n### Basic TLS Server\n\n```nginx\nserver {\n  listen 443 ssl http2;\n  server_name example.com;\n\n  ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;\n  ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;\n\n  ssl_protocols TLSv1.2 TLSv1.3;\n  ssl_prefer_server_ciphers off;\n\n  root /var/www/example/public;\n}\n```\n\n### HSTS & Security Headers\n\n```nginx\nadd_header Strict-Transport-Security \"max-age=31536000; includeSubDomains; preload\" always;\nadd_header X-Content-Type-Options \"nosniff\" always;\nadd_header X-Frame-Options \"SAMEORIGIN\" always;\nadd_header Referrer-Policy \"no-referrer-when-downgrade\" always;\nadd_header Permissions-Policy \"geolocation=(), microphone=(), camera=()\" always;\n```\n\n### Let’s Encrypt (Certbot)\n\n```shell script\n$ sudo apt install -y certbot python3-certbot-nginx\n$ sudo certbot --nginx -d example.com -d www.example.com\n$ sudo systemctl list-timers | grep certbot   # auto-renew\n```\n\n## Reverse Proxy {.cols-3}\n\n### Basic Proxy\n\n```nginx\nupstream app {\n  server 127.0.0.1:3000;\n  # server unix:/run/app.sock; # alternative\n}\n\nserver {\n  listen 80;\n  server_name api.example.com;\n\n  location / {\n    proxy_set_header Host $host;\n    proxy_set_header X-Real-IP $remote_addr;\n    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n    proxy_set_header X-Forwarded-Proto $scheme;\n    proxy_pass http://app;\n  }\n}\n```\n\n### WebSockets / HTTP Upgrade\n\n```nginx\nlocation /socket.io/ {\n  proxy_http_version 1.1;\n  proxy_set_header Upgrade $http_upgrade;\n  proxy_set_header Connection \"upgrade\";\n  proxy_pass http://app;\n}\n```\n\n### Timeouts & Buffers\n\n```nginx\nproxy_connect_timeout 5s;\nproxy_send_timeout    60s;\nproxy_read_timeout    60s;\nproxy_buffering       on;\nproxy_buffers 16 16k;\nproxy_busy_buffers_size 24k;\n```\n\n## Static, Compression, Caching {.cols-3}\n\n### Static Files\n\n```nginx\nlocation /assets/ {\n  alias /var/www/example/assets/;\n  access_log off;\n  expires 7d;\n  add_header Cache-Control \"public, max-age=604800, immutable\";\n}\n```\n\n### Gzip\n\n```nginx\ngzip on;\ngzip_types text/plain text/css application/javascript application/json image/svg+xml;\ngzip_min_length 1024;\ngzip_comp_level 5;\n```\n\n### (Optional) Brotli (if compiled)\n\n```nginx\nbrotli on;\nbrotli_comp_level 5;\nbrotli_types text/plain text/css application/javascript application/json image/svg+xml;\n```\n\n## Caching & Microcaching {.cols-3}\n\n### Proxy Cache Zone\n\n```nginx\nproxy_cache_path /var/cache/nginx levels=1:2 keys_zone=micro:10m max_size=1g inactive=10m use_temp_path=off;\nmap $request_method $no_cache { default 0; POST 1; PUT 1; PATCH 1; DELETE 1; }\n```\n\n### Use the Cache\n\n```nginx\nlocation /api/ {\n  proxy_cache micro;\n  proxy_cache_bypass $no_cache;\n  proxy_no_cache $no_cache;\n  proxy_cache_valid 200 301 302 10s;\n  proxy_cache_valid any 1s;\n  add_header X-Cache-Status $upstream_cache_status;\n  proxy_pass http://app;\n}\n```\n\n### Conditional Bypass\n\n```nginx\n# Skip cache when logged in (example cookie)\nmap $http_cookie $logged_in {\n  default 0;\n  ~*\"(session|auth|logged_in)\" 1;\n}\nproxy_cache_bypass $logged_in;\nproxy_no_cache $logged_in;\n```\n\n## PHP‑FPM / FastCGI {.cols-3}\n\n### Basic PHP Handler\n\n```nginx\nlocation ~ \\.php$ {\n  include fastcgi_params;\n  fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;\n  fastcgi_param DOCUMENT_ROOT $realpath_root;\n  fastcgi_pass unix:/run/php/php8.2-fpm.sock;\n  fastcgi_buffers 16 16k;\n  fastcgi_read_timeout 60s;\n}\n```\n\n### try_files Front Controller\n\n```nginx\nlocation / {\n  try_files $uri $uri/ /index.php?$args;\n}\n```\n\n### Security Tips\n\n```nginx\nlocation ~* \\.(?:ini|log|sh|sql|bak)$ { deny all; }\nlocation ~ /\\.(?!well-known) { deny all; }\n```\n\n## Rewrites & Routing {.cols-3}\n\n### try_files\n\n```nginx\nlocation / {\n  try_files $uri $uri/ /index.html;\n}\n```\n\n### Regex Rewrites\n\n```nginx\n# Remove trailing slash (except root)\nif ($request_uri ~* \"^(.+)/+$\") { return 301 $1; }\n\n# Legacy path to new path\nrewrite ^/old/(.*)$ /new/$1 permanent;\n```\n\n### SPA / History API\n\n```nginx\nlocation / {\n  try_files $uri /index.html;\n}\n```\n\n## Rate Limiting & DoS Mitigation {.cols-3}\n\n### Request Rate\n\n```nginx\n# 10 req/s with burst 20 per IP\nlimit_req_zone $binary_remote_addr zone=reqs:10m rate=10r/s;\n\nserver {\n  location /api/ {\n    limit_req zone=reqs burst=20 nodelay;\n  }\n}\n```\n\n### Concurrent Connections\n\n```nginx\nlimit_conn_zone $binary_remote_addr zone=conns:10m;\nserver {\n  location /download/ {\n    limit_conn conns 10;\n  }\n}\n```\n\n### Body Size & Timeouts\n\n```nginx\nclient_max_body_size 25m;\nclient_body_timeout 30s;\nkeepalive_timeout 65s;\n```\n\n## Security Headers & Access {.cols-3}\n\n### Basic Hardening\n\n```nginx\nserver_tokens off;\nadd_header X-Content-Type-Options \"nosniff\" always;\nadd_header X-Frame-Options \"SAMEORIGIN\" always;\nadd_header Referrer-Policy \"no-referrer-when-downgrade\" always;\n```\n\n### Allow/Deny\n\n```nginx\nlocation /admin/ {\n  allow 192.168.0.0/16;\n  deny all;\n}\n```\n\n### CORS (Example)\n\n```nginx\nlocation /api/ {\n  add_header Access-Control-Allow-Origin \"https://app.example.com\" always;\n  add_header Access-Control-Allow-Credentials \"true\" always;\n  if ($request_method = OPTIONS) {\n    add_header Access-Control-Allow-Methods \"GET, POST, OPTIONS\";\n    add_header Access-Control-Allow-Headers \"Authorization, Content-Type\";\n    return 204;\n  }\n  proxy_pass http://app;\n}\n```\n\n## Logging & Debug {.cols-3}\n\n### Formats\n\n```nginx\nlog_format main '$remote_addr - $remote_user [$time_local] \"$request\" '\n                '$status $body_bytes_sent \"$http_referer\" '\n                '\"$http_user_agent\" \"$http_x_forwarded_for\" '\n                '$request_time $upstream_response_time';\n\naccess_log /var/log/nginx/access.log main;\nerror_log  /var/log/nginx/error.log warn;\n```\n\n### Per‑Location Logging\n\n```nginx\nlocation /healthz { access_log off; }\n```\n\n### Debugging\n\n```shell script\n$ sudo nginx -t\n$ sudo nginx -s reload\n$ tail -f /var/log/nginx/error.log\n```\n\n## Upstreams & LB {.cols-3}\n\n### Strategies\n\n| Directive     | Meaning                 |\n| ------------- | ----------------------- |\n| (default)     | round‑robin             |\n| `least_conn`  | least connections       |\n| `ip_hash`     | sticky by client IP     |\n| `hash key`    | hash by custom key      |\n\n{.show-header}\n\n### Example Upstream\n\n```nginx\nupstream api_backends {\n  least_conn;\n  server 10.0.0.11:8080 max_fails=3 fail_timeout=30s;\n  server 10.0.0.12:8080 max_fails=3 fail_timeout=30s;\n  # server backup.example:8080 backup;\n}\n```\n\n### Health & Failover\n\n```nginx\nproxy_next_upstream error timeout http_502 http_503 http_504;\nproxy_next_upstream_tries 3;\n```\n\n## Useful Variables {.cols-3}\n\n### Request & Client\n\n| Variable               | Description                  |\n| --------------------- | ---------------------------- |\n| `$host`               | Host header / server name    |\n| `$server_name`        | Chosen server_name           |\n| `$remote_addr`        | Client IP                    |\n| `$http_user_agent`    | User‑Agent                   |\n| `$request_method`     | GET/POST/...                 |\n\n{.show-header .bold-first}\n\n### Paths & Files\n\n| Variable                 | Description            |\n| ----------------------- | ---------------------- |\n| `$document_root`        | Current root           |\n| `$realpath_root`        | Symlink‑resolved root  |\n| `$request_uri`          | Path + query           |\n| `$uri`                  | Normalized URI         |\n| `$args`                 | Raw query string       |\n\n{.show-header .bold-first}\n\n### Upstream\n\n| Variable                    | Description        |\n| -------------------------- | ------------------ |\n| `$upstream_addr`           | Upstream server(s) |\n| `$upstream_status`         | Upstream status    |\n| `$upstream_response_time`  | Time from upstream |\n\n{.show-header .bold-first}\n\n## Stream (TCP/UDP) {.cols-3}\n\n### TCP Proxy\n\n```nginx\nstream {\n  upstream db {\n    server 10.0.0.10:5432;\n    server 10.0.0.11:5432;\n  }\n  server {\n    listen 5432;\n    proxy_pass db;\n  }\n}\n```\n\n### UDP Proxy\n\n```nginx\nstream {\n  server {\n    listen 53 udp;\n    proxy_responses 1;\n    proxy_timeout 2s;\n    proxy_pass 1.1.1.1:53;\n  }\n}\n```\n\n### Access Control\n\n```nginx\nstream {\n  server {\n    listen 6379;\n    allow 10.0.0.0/8;\n    deny all;\n    proxy_pass 127.0.0.1:6379;\n  }\n}\n```\n\n## Snippets {.cols-3}\n\n### Security Snippet\n\n```nginx\n# /etc/nginx/snippets/security.conf\nserver_tokens off;\nadd_header X-Content-Type-Options \"nosniff\" always;\nadd_header X-Frame-Options \"SAMEORIGIN\" always;\nadd_header Referrer-Policy \"no-referrer-when-downgrade\" always;\n```\n\n### PHP Snippet\n\n```nginx\n# /etc/nginx/snippets/fastcgi-php.conf\nlocation ~ \\.php$ {\n  include fastcgi_params;\n  fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;\n  fastcgi_param DOCUMENT_ROOT $realpath_root;\n  fastcgi_pass unix:/run/php/php8.2-fpm.sock;\n}\n```\n\n### Proxy Headers Snippet\n\n```nginx\n# /etc/nginx/snippets/proxy-headers.conf\nproxy_set_header Host $host;\nproxy_set_header X-Real-IP $remote_addr;\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\nproxy_set_header X-Forwarded-Proto $scheme;\n```\n\n"
  },
  {
    "path": "source/_posts/nim.md",
    "content": "---\ntitle: Nim\ndate: 2025-11-23 1:04:20\nbackground: bg-[#eed547]\ntags:\ncategories:\n  - Programming\nintro: |\n  The Nim quick reference cheat sheet that aims at providing help on writing basic syntax and methods.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### helloworld.nim {.row-span-2}\n\n```nim\necho \"Hello World!\"\n\n# This is a comment\necho \"What's your name? \"\nvar name: string = readLine(stdin)\n# readLine(stdin) asks you to type in a string.\n\necho \"Hi, \", name, \"!\"\n```\n\nCompile `helloworld.nim` with `nim compile`\n\n```bash\n$ nim compile helloworld.nim\n```\n\nRun the compiled binary `helloworld` (or `helloworld.exe` if you're on Windows)\n\n```\n./helloworld\nHello, World!\nWhat's your name?\nHi, <name>!\n```\n\nThere is also a possibility\nto both compile and run the\nprogram with just one command.\nWe need to type:\n`$ nim c -r helloworld.nim`\n\n#### Common compile commands (terminal)\n\n```sh\nnim c -r main.nim          # debug build, run after compile\nnim c -d:release main.nim  # optimized release build\nnim c --mm:arc main.nim    # ARC memory management (Nim 2 default)\n```\n\n### Useful Resources {.col-span-2}\n\n- [Nim](https://www.nim-lang.org/) _(nim-lang.org)_\n- [The Nim Manual](https://nim-lang.org/docs/manual.html) _(../docs/manual.html)_\n- [Nim Basics](https://narimiran.github.io/nim-basics/) _(narimiran.github.io)_\n- [Learn X in Y minutes](https://learnxinyminutes.com/docs/nim/) _(learnxinyminutes.com)_\n\n### Variables {.row-span-1}\n\n```nim\n# 'var' declares mutable variables.\n\nvar number: int = 100 # Single line declaration\n\n# A 'var' block can declare multiple variables at once.\n\nvar\n  letter: char = 'n'\n  lang = \"N\" & \"im\"\n  length = len(lang)\n  counter: int = 7\n  boat: float\n  truth = true\n```\n\n### Immutable Variables (let)\n\n```nim\n# 'let' declares immutable variables.\nlet\n  salute: string = \"Hello!\"\n  x: int = 10\n  y = x + 5\n\nlet z = 20\nz = 500   # Error: 'z' is immutable\n```\n\n### Comments\n\n```nim\n# This is a comment\n\n#[\n  This is a multiline comment.\n  In Nim, multiline comments can be nested, beginning with #[\n  ... and ending with ]#\n]#\n```\n\n### Constants {.row-span-1}\n\n```nim\nconst\n  debug = true\n  compileBadCode = false\n\n# Constants are declared at compile time and cannot be changed.\n```\n\n### \"For\" Loops\n\n```nim\nfor item in (1 ..< 6):\n  if item == 3: break\n  echo item\n\necho \"All done!\"\n```\n\nSee: [Loops](#loops)\n\n### If Statements\n\n```nim\nimport std/strutils\nlet number = parseInt(readLine(stdin))\n\nif number <= 5:\n  echo \"Small sized number.\"\nelif number > 5 and number <= 25:\n  echo \"Medium sized number.\"\nelse:\n  echo \"Big number.\"\n```\n\nSee: [Flow Control](#flow-control)\n\n### Procedures / Functions\n\n```nim\nproc myFunction() =\n  echo \"Hello, this is my function\"\n\nmyFunction()\n\n# prints \"Hello, this is my function\"\n```\n\nSee: [Procedures](#procedures)\n\n### Formatted Strings\n\n```nim\nimport std/strformat\n\nlet\n  a = \"Hello there.\"\n  b = \"How's it going?\"\n  c = \"These are variables.\"\n\necho fmt\"{a} {b} {c}\" # \"Hello there. How's it going? These are variables.\"\n```\n\nSee: [Imports](#imports-and-modules)\n\n## Data Types\n\n### Integers\n\n```nim\nlet\n  a = 11\n  b = 4\n\necho \"a + b = \", a + b # 15\necho \"a - b = \", a - b # 7\necho \"a * b = \", a * b # 44\necho \"a / b = \", a / b # 2.75\necho \"a div b = \", a div b # 2\necho \"a mod b = \", a mod b # 3\n```\n\n### Floats\n\n```nim\nlet\n  c = 6.75\n  d = 2.25\n\necho \"c + d = \", c + d # 9.0\necho \"c - d = \", c - d # 4.5\necho \"c * d = \", c * d # 15.1875\necho \"c / d = \", c / d # 3.0\n```\n\n### Strings {.row-span-3}\n\n```nim\nlet\n  m = \"word\"\n  n = \"A sentence with punctuation.\"\n  o = \"\"\n  p = \"32\"\n  q = \"!\"\n\necho m\n# prints \"word\"\necho p, \" is a string.\"\n# prints \"32 is a string.\"\n```\n\n#### String Concatenation\n\n```nim\nvar\n  p = \"abc\"\n  q = \"xy\"\n  r = 'z'\n\np.add(\"def\")   # modifies p\nq.add(r)       # chars can be added to strings\n\necho p         # \"abcdef\"\necho q         # \"xyz\"\n\n# `&` creates a new string:\necho p & q     # \"abcdefxyz\"\n```\n\n#### Special Escape Sequences\n\n```nim\necho \"line1\\nline2\"     # newline\necho \"col1\\tcol2\"       # tab\necho \"A\\\\B\\\\C\"          # backslash\n\n# Raw strings ignore escapes:\necho r\"line1\\nline2\"\n```\n\nSee also: [Escape Sequences](https://nim-lang.org/docs/manual.html#lexical-analysis-string-literals)\n\n### Characters\n\n```nim\nlet\n  h = 'z'\n  i = '+'\n  j = '2'\n  k = '35'   # error: too many characters\n  l = 'xy'   # error: too many characters\n```\n\n### Booleans\n\n```nim\nlet x = true\nlet y = false\n\n# Boolean literals are lowercase.\n```\n\n### Type Conversion {.col-span-2}\n\n```nim\n\nlet e = 5\nlet f = 23.987\n\n# Converting between ints and floats:\necho float(e)    # 5.0\necho int(f)      # 23\n\n# Mixed operations require explicit conversion:\necho float(e) + f    # 28.987\necho e + int(f)      # 28\n```\n\n## Compound Types\n\n### Arrays\n\n```nim\ntype IntArray = array[0..3, int]\n\nlet a: IntArray = [10, 20, 30, 40]\n\necho a[0]      # 10\necho a.len     # 4\n```\n\n### Sequences\n\n```nim\nvar s: seq[int] = @[1, 2, 3]\ns.add(4)\n\necho s         # @[1, 2, 3, 4]\necho s.len     # 4\n```\n\n### Objects\n\n```nim\ntype Person = object\n  name: string\n  age: int\n\nlet p = Person(name: \"Ana\", age: 20)\necho p.name\n```\n\n### Tuples\n\n```nim\nvar person = (name: \"Sophie\", age: 18)\n\necho person.name # Sophie\necho person.age  # 18\n\n# swapping values:\nvar (x, y) = (1, 2)\n(x, y) = (y, x)\necho x, \" \", y     # 2 1\n```\n\n### Sets\n\n```nim\ntype CharSet = set[char]\n\nlet letters: CharSet = {'a'..'z'}\n\necho 'a' in letters    # true\necho 'Z' in letters    # false\n```\n\n### Reference Objects\n\n```nim\ntype Node = ref object\n  value: int\n  next: Node     # linked list style\n\nvar n = Node(value: 10)\necho n.value\n```\n\nNeeded for Object Oriented Programming within Nim.\n\n### Slicing Sequences and Strings {.col-span-2}\n\n```nim\nlet xs = @[10, 20, 30, 40]\n\necho xs[1..2]    # @[20, 30]\necho xs[^2..^1]  # @[30, 40]\n```\n\n---\n\n```nim\nlet s = \"abcdef\"\n\necho s[0..2]     # \"abc\"\necho s[3..^1]    # \"def\" (^1 = last char)\necho s[1..<4]    # \"bcd\"\n```\n\n### Tables/Dictionaries\n\n```nim\nimport std/tables\n\nvar ages = initTable[string, int]()\nages[\"Ana\"] = 20\nages[\"Sophie\"] = 18\n\necho ages[\"Ana\"]                 # 20\necho ages.getOrDefault(\"X\", -1)  # -1\n\nfor name, age in ages:\n  echo name, \": \", age\n```\n\n## Operators\n\n### Arithmetic Operators {.row-span-1}\n\n```nim\nvar\n  a = 10\n  b = 3\n\necho a + b      # 13\necho a - b      # 7\necho a * b      # 30\necho a / b      # 3.333333\necho a div b    # 3\necho a mod b    # 1\necho a ^ b      # 1000\n```\n\n---\n\n| Operator | Name           | Example   |\n| -------- | -------------- | --------- |\n| `+`      | Add            | `x + y`   |\n| `-`      | Subtract       | `x - y`   |\n| `*`      | Multiply       | `x * y`   |\n| `/`      | Float Divide   | `x / y`   |\n| `div`    | Integer Divide | `x div y` |\n| `mod`    | Modulo         | `x mod y` |\n| `^`      | Power          | `x ^ y`   |\n\n{.show-header}\n\n### Assignment\n\nThese only work on mutable (`var`) variables, not on `let` or `const`.\n\n```nim\nvar value = 1990\necho value # 1990\n\nvalue = 2\necho value # 2\n```\n\n---\n\n| Operator | Description  | Example |\n| -------- | ------------ | ------- |\n| `=`      | Assign value | `x = y` |\n\n{.show-header}\n\n#### Update operations\n\n| Syntax   | Expands to  | Meaning          |\n| -------- | ----------- | ---------------- |\n| `x += y` | `x = x + y` | add, assign      |\n| `x -= y` | `x = x - y` | subtract, assign |\n| `x *= y` | `x = x * y` | multiply, assign |\n\n{.show-header}\n\nOther variants like `/=` or `mod=` are not available,  \nso just write them out explicitly, e.g. `x = x / y`.\n\n### Comparison Operators {.row-span-2}\n\n```nim\nlet\n  x = 5\n  y = 3\n\necho x > y\n# prints \"true\" because 5 is greater than 3\n```\n\n---\n\n| Symbol | Meaning                  | Example        |\n| ------ | ------------------------ | -------------- |\n| `==`   | equals                   | `if x == y`... |\n| `!=`   | not equal to             | `if x != y`... |\n| `>`    | greater than             | `if x > y`...  |\n| `<`    | less than                | `if x < y`...  |\n| `>=`   | greater than or equal to | `if x >= y`... |\n| `<=`   | less than or equal to    | `if x <= y`... |\n\n{.show-header}\n\nComparison operators are used to compare two values.\n\n#### Lexicographical Comparison\n\nThey also work on `char` and `string` values via lexicographic order.\n\n```nim\necho \"apple\" < \"banana\"  # true\necho \"axyz\" < \"axyb\"     # true\necho \"ooooo\" > \"o\"       # true\necho \"abc\" < \"ab\"        # false\n\necho 'a' < 'd'           # true\necho 'a' < 'Z'           # false\n```\n\n### Logical Operators {.row-span-2} {.col-span-2}\n\n| Operator | Example                | Meaning                  |\n| -------- | ---------------------- | ------------------------ |\n| `and`    | `if a > 0 and a < 10:` | From 1 to 9              |\n| `or`     | `if x == 0 or y == 0:` | Either one of them is 0  |\n| `not`    | `if not isValid:`      | If `isValid` is not true |\n| `xor`    | `if flagA xor flagB:`  | Only one of them is true |\n\n{.show-header}\n\nLogical operators work on `bool`.\n\n#### Extra Bitwise Operators\n\n| Operator | Example   | Result (with a = 60, b = 13) |\n| -------- | --------- | ---------------------------- |\n| `and`    | `a and b` | `12`                         |\n| `or`     | `a or b`  | `61`                         |\n| `xor`    | `a xor b` | `49`                         |\n| `not`    | `not a`   | `-61`                        |\n| `shl`    | `a shl 2` | `240`                        |\n| `shr`    | `a shr 2` | `15`                         |\n\n{.show-header}\n\nThese work on integers bit-by-bit; use them for flags, masks, low-level code, etc.\n\n## Flow Control\n\n### Match Case {.row-span-3}\n\n```nim\nlet x = 5\ncase x:\nof 0, 1:\n  echo \"small\"\nof 2, 3, 4:\n  echo \"medium\"\nelse:\n  echo \"large\"\n```\n\n---\n\n`case of` can look for ranges too.\n\n```nim\nlet age = 17\n\ncase age:\nof 0..12:\n  echo \"child\"\nof 13..19:\n  echo \"teen\"\nelse:\n  echo \"adult\"\n```\n\n---\n\n...and `strings` and `chars`, too\n\n```nim\nlet cmd = \"quit\"\n\ncase cmd:\nof \"help\":\n  echo \"show help\"\nof \"quit\", \"exit\":\n  echo \"bye!\"\nelse:\n  echo \"unknown command\"\n```\n\n---\n\n```nim\nlet ch = 'g'\ncase ch:\nof {'a', 'e', 'i', 'o', 'u'}:\n  echo \"vowel\"\nelse:\n  echo \"consonant or symbol\"\n```\n\n### Basic If-Else {.col-span-2}\n\n```nim\nlet num = 5\n\nif num > 10:\n  echo \"num is bigger than 10\"\nelif num < 10:\n  echo \"num is smaller than 10\"\nelse:\n  echo \"num is exactly 10\"\n```\n\n### One Liners {.col-span-2}\n\n```nim\nlet\n  a = 330\n  b = 200\n\nlet r = if a > b: a else: b\n\necho r # 330\n```\n\n### Compile-Time Conditions {.col-span-2}\n\n```nim\nwhen defined(linux):\n  echo \"Compiled on Linux\"\nelif defined(windows):\n  echo \"Compiled on Windows\"\nelse:\n  echo \"Unknown OS\"\n```\n\n## Loops\n\n### For Loops {.row-span-2}\n\n```nim\nfor i in 1..5:\n  echo i\n# 1 2 3 4 5\n```\n\n---\n\n```nim\nfor i in 0..<3:\n  echo i\n# 0 1 2\n```\n\n---\n\n```nim\n# i = index, v = value in sequence\nfor i, v in @[10, 20, 30]:\n  echo i, \": \", v\n# 0: 10\n# 1: 20\n# 2: 30\n```\n\n**Keep in mind**: \\\n1..5 = Inclusive (1 2 3 4 5) \\\n1..<5 = Exclusive (1 2 3 4)\n\n### While Loops\n\n```nim\nvar counter = 0\n\nwhile counter <= 10:\n  counter = counter + 1\n  echo counter # prints 1..10\n```\n\n### Infinite Loops\n\n```nim\nwhile true:\n  echo \"ay! \"\n```\n\n---\n\n```nim\nwhile 1 > 0:\n  echo \"echo... \"\n```\n\n### Break Statements\n\n```nim\nvar query = \"\"\nwhile true:\n  echo \"Do you want out?\"\n  query = readLine(stdin)\n  if query == \"yes\":\n    echo \"Well then.\"\n    break\n  else:\n    echo \"I'll ask again.\"\n\n```\n\n### Continue Statements\n\n```nim\nfor i in 1..5:\n  if i mod 2 == 0: continue\n  echo i\n# prints only odd numbers: 1 3 5\n```\n\n## Procedures\n\n### Simple Procedure\n\n```nim\nproc salute() =\n  echo \"Hello!\"\n\nsalute() # prints \"Hello!\"\n```\n\n### Procedures with Parameters\n\n```nim\nproc addition(a: int, b: int): int =\n  a + b\n\necho addition(20, 30) # returns 50\n```\n\n### Using result {.row-span-2}\n\n```nim\nproc double(x: int): int =\n  result = x * 2\n\necho double(5) # returns 10\n```\n\n---\n\nUseful when building results step-by-step:\n\n```nim\nproc sumAll(xs: seq[int]): int =\n  for n in xs:\n    result += n\n\necho sumAll(@[1,1,1,1,1]) # returns 5\n```\n\n### Default Parameters {.col-span-2}\n\n```nim\nproc welcome(name = \"stranger\") =\n  echo \"Hi, \", name\n\nwelcome(\"Sophie\") # prints \"Hi, Sophie\"\nwelcome()         # uses default, prints \"Hi, stranger\"\n```\n\n### Procedures returning multiple values\n\n```nim\nproc divmod(a, b: int): (int, int) =\n  (a div b, a mod b)\n\nlet (q, r) = divmod(10, 3)\necho q, \" \", r   # 3 1\n```\n\n### Anonymous Procedures (Lambdas)\n\n```nim\nlet square = proc(x: int): int = x * x\necho square(5) # 25\n```\n\n### Procedures within Procedures {.row-span-2}\n\n```nim\nproc outer() =\n  var count = 0\n\n  proc inner() =\n    inc(count)\n    echo count\n\n  inner()\n  inner()\n\nouter()   # prints 1 then 2\n```\n\n### Overloading\n\n```nim\nproc show(x: int) = echo \"int: \", x\nproc show(x: string) = echo \"string: \", x\n\nshow(10)\nshow(\"hi\")\n```\n\n### Discardable Procedure Returns\n\n```nim\nproc doSomething(): int {.discardable.} =\n  123\n\ndoSomething()      # allowed now\n```\n\n## Object-Oriented Programming\n\n### Ref Objects and Inheritance {.row-span-2}\n\n```nim\ntype\n  Animal = ref object of RootObj\n    name: string\n\n  Dog = ref object of Animal\n    breed: string\n\nmethod speak(a: Animal) {.base.} =\n  echo a.name, \" makes a sound.\"\n\nmethod speak(d: Dog) =\n  echo d.name, \" barks!\"\n\nvar\n  a: Animal = Animal(name: \"Creature\")\n  d: Animal = Dog(name: \"Fido\", breed: \"Mutt\")  # Dog upcasted to Animal\n\nspeak(a)  # Creature makes a sound.\nspeak(d)  # Fido barks!\n```\n\nUse `ref object of RootObj` + `method` when you need runtime polymorphism.\n\n### Procs as Methods\n\n```nim\ntype\n  Counter = ref object\n    value: int\n\nproc inc(c: var Counter) =\n  inc c.value\n\nvar c = Counter(value: 0)\ninc(c)\necho c.value  # 1\n```\n\n### Constructor Procs\n\n```nim\ntype\n  Dog = ref object\n    name: string\n    age: int\n\nproc newDog(name: string; age: int): Dog =\n  Dog(name: name, age: age)\n\nlet d = newDog(\"Fido\", 3)\necho d.name, \" is \", d.age, \" years old\"\n```\n\n### Type tests and Downcasting {.col-span-2}\n\n```nim\ntype\n  Animal = ref object of RootObj\n    name: string\n\n  Dog = ref object of Animal\n    breed: string\n\nproc newDog(name, breed: string): Dog =\n  Dog(name: name, breed: breed)\n\nvar a: Animal = newDog(\"Fido\", \"mutt\")\n\nif a of Dog:                       # runtime type check\n  let d = Dog(a)                   # downcast\n  echo d.name, \" is a \", d.breed\n\n```\n\n`x of Type` checks the dynamic type; `Type(x)` downcasts (unsafe if you lie).\n\n## Imports and Modules\n\n### Basic Imports\n\n```nim\nimport std/math\n\necho sqrt(9.0) # 3.0\n```\n\nSee also: [Standard Library](https://nim-lang.org/docs/lib.html)\n\n### Importing Multiple Modules\n\n```nim\nimport std/[strutils, sequtils]\n\necho \"hi\".toUpperAscii()    # \"HI\"\necho @[1,2,3].mapIt(it * 2) # @[2, 4, 6]\n```\n\n### Importing Specific Modules\n\n```nim\nfrom std/strutils import toLowerAscii\n\necho toLowerAscii(\"ABC\")  # \"abc\"\n```\n\n### Renaming Modules\n\n```nim\nimport std/random as rng\n\nrng.randomize()\n\necho rng.rand(1..10) # anywhere from 1 to 10\n```\n\n_Don't forget to use randomize() if you're using the std/random library, or else you won't have randomness._\n\n### Creating Modules {.col-span-2}\n\n```nim\n# utils.nim\nproc greet*(name: string) =\n  echo \"Hello, \", name\n```\n\n(The asterisk means \"export this procedure from the module\".)\n\n---\n\n```nim\n# main.nim\nimport utils\n\ngreet(\"John\") # prints \"Hello, John\"\n```\n\n### `when isMainModule`\n\n```nim\nproc run() =\n  echo \"Running...\"\n\nwhen isMainModule:\n  run()  # Only runs when this file is the program entry point\n```\n\n_Code inside when isMainModule: is skipped when the file is imported._\n\n### Re-exporting {.col-span-2}\n\n```nim\n# utils.nim\nimport std/strutils\nexport strutils    # re-export everything from strutils\n```\n\n---\n\nNow main.nim can use toUpperAscii directly, through utils.\n\n```nim\n# main.nim\nimport utils\n\necho \"hi\".toUpperAscii()\n```\n\n### Prelude Module {.col-span-3}\n\n```nim\nimport std/prelude\ninclude std/prelude\n  # same as:\n  # import std/[os, strutils, times, parseutils, hashes, tables, sets, sequtils, parseopt, strformat]\nlet x = 1\nassert \"foo $# $#\" % [$x, \"bar\"] == \"foo 1 bar\"\nassert toSeq(1..3) == @[1, 2, 3]\nwhen not defined(js) or defined(nodejs):\n  assert getCurrentDir().len > 0\n  assert ($now()).startsWith \"20\"\n```\n\n## Error Handling\n\n### Try - Except - Finally {.row-span-2}\n\n```nim\nimport std/strutils\n\ntry:\n  let x = parseInt(\"42a\")         # invalid integer\n  echo x\nexcept ValueError as e:\n  echo \"Value error: \", e.msg     # catch conversion error\nexcept IOError:\n  echo \"I/O error!\"\nfinally:\n  echo \"This always runs\"\n```\n\n### Raising Exceptions\n\n```nim\ntype\n  MyError* = object of Exception\n\nproc loadData(name: string) =\n  if name == \"\":\n    raise newException(MyError, \"No name provided\")\n  # ... else proceed\n\nloadData(\"\")  # raises MyError\n```\n\n### `defer` for Cleanup\n\n```nim\nproc processFile(path: string) =\n  var f = open(path, fmRead)\n  defer:\n    close(f)\n  # work with f …\n```\n\n### Try as Exception\n\n```nim\nimport std/strutils\n\nlet result = try: parseInt(\"bad\")\n             except ValueError: -1\n\necho result  # prints -1\n```\n\n### Exception Tracking with raises\n\n```nim\nproc riskyOperation() {.raises: [IOError].} =\n  # this proc may raise IOError\n  raise newException(IOError, \"fail\")\n\n# A proc with {.raises: []} must not raise any catchable exception.\n```\n\n## Enums\n\n### Basic Usage\n\n```nim\ntype\n  Direction = enum\n    north, east, south, west\n\nvar d = north\n\nif d == north:\n  echo \"Going up!\"\n```\n\n### Enums and `case`\n\n```nim\n# with the same Direction enum:\n\nvar d = north\n\ncase d:\n  of north: echo \"N\"\n  of south: echo \"S\"\n  of east:  echo \"E\"\n  of west:  echo \"W\"\n```\n\n### Enum as an Ordinal\n\n```nim\n# with the same Direction enum:\necho ord(north)   # 0\necho succ(north)  # east\necho pred(south)  # east\n```\n\n## Iterators\n\n### Basic Iterator {.row-span-2}\n\n```nim\niterator countUp(a, b: int): int =\n  var i = a\n  while i <= b:\n    yield i      # `yield` produces a value for the `for` loop\n    inc i\n\nfor n in countUp(1, 5):\n  echo n\n# 1 2 3 4 5\n```\n\n### Common Built-In Iterators\n\n```nim\nfor i in countup(1, 3):\n  echo i               # 1 2 3\n\nfor i in countdown(3, 1):\n  echo i               # 3 2 1\n```\n\n### Defining your own Iterator {.row-span-2}\n\n```nim\niterator evensUpTo(n: int): int =\n  var x = 0\n  while x <= n:\n    yield x\n    x += 2\n\nfor e in evensUpTo(10):\n  echo e        # 0 2 4 6 8 10\n```\n\n## Files & IO\n\n### Check Paths and Existence {.row-span-2}\n\n```nim\nimport std/os\n\nif fileExists(\"data.txt\"):\n  echo \"File exists!\"\n\nif dirExists(\"configs\"):\n  echo \"Directory exists!\"\n\necho getCurrentDir()\necho absolutePath(\"data.txt\")\n```\n\n### Read / Write Whole File {.row-span-1}\n\n```nim\n# Write whole file\nwriteFile(\"out.txt\", \"Hello Nim!\\n\")\n\n# Read whole file\nlet text = readFile(\"out.txt\")\necho text\n```\n\n### Manual Open/Close with `defer` {.row-span-2}\n\n```nim\nimport std/syncio\n\nproc writeLog() =\n  var f = open(\"log.txt\", fmWrite)\n  defer: f.close()\n  f.writeLine(\"entry 1\")\n  f.writeLine(\"entry 2\")\n\nwhen isMainModule:\n  writeLog()\n```\n\n### Read a File Line-By-Line\n\n```nim\nfor line in lines(\"data.txt\"):\n  echo line\n```\n\n## Generics\n\n### Generic Types and Procedures {.col-span-3}\n\n```nim\ntype\n  Box[T] = object\n    value: T\n\nproc wrap[T](x: T): Box[T] =\n  Box[T](value: x)\n\nlet a = wrap(10)        # Box[int]\nlet b = wrap(\"hello\")   # Box[string]\n\necho a.value            # 10\necho b.value            # hello\n```\n\n## Templates and Macros\n\n### Templates\n\n```nim\n# Template = macro-like, expanded at compile time\ntemplate times2(x: untyped): untyped = (x) * 2\necho times2(21)  # 42\n```\n\n### Macros {.row-span-2} {.col-span-2}\n\n```nim\nimport std/macros\n\nmacro dbg(expr: untyped): untyped =\n  # prints both the expression and its value\n  result = quote do:\n    echo astToStr(`expr`), \" = \", `expr`\n\nlet x = 10\ndbg(x * 2)\n# prints: x * 2 = 20\n```\n"
  },
  {
    "path": "source/_posts/nix.md",
    "content": "---\ntitle: Nix\ndate: 2025-08-24 23:33:40\nbackground: bg-[#304673]\ntags:\ncategories:\n  - Programming\nintro: |\n  The Nix quick reference cheat sheet that aims at providing help on writing basic nix code.\nplugins:\n  - copyCode\n---\n\n## Types & Syntax\n\n### String\n\n```nix\nlet\n  x = \"single-line string\";\n  y = ''\n    multi-line string\n  '';\nin\n```\n\n### Integer\n\n```nix\nlet\n  x = -123;\n  y - 123;\nin\n```\n\n### Float\n\n```nix\nlet\n  x = -0.32;\n  y = 0.45;\nin\n```\n\n### Boolean\n\n```nix\nlet\n  x = true;\n  y = false;\nin\n```\n\n### Null\n\n```nix\nlet\n  x = null;\nin\n```\n\n### Path\n\n```nix\nlet\n  x = /absolute/path;\n  y = ./relative/path;\nin\n```\n\n### Attribute Set\n\n```nix\nlet\n  x = {\n    a = 1;\n    b = 2;\n  };\n  y = { c = 3; };\nin\n```\n\nsee [Attribute Sets](#attribute-sets)\n\n### List\n\n```nix\nlet\n  x = [ 1 2.0 ];\n  y = [\n    1\n    \"this is a string\"\n    23.0\n    null\n  ];\nin\n```\n\n### Comment\n\n#### ↓ single-line comment\n\n```nix\n# your comment\n```\n\n#### ↓ multi-line comment\n\n```nix\n/*\n  your comment\n*/\n```\n\n## Scoping\n\n### Define Local Variable\n\n```nix\nlet\n  x = 1;\n  y = 2;\nin\n  x + y # -> returns 3\n```\n\n### Add Variables Into Scope\n\n```nix\nlet\n  x = 1;\nin\n  { inherit x; }\n```\n\n#### ↓ desugars to\n\n```nix\nlet\n  x = 1;\nin\n  { x = x; }\n```\n\n### Add Attributes Into Scope\n\n```nix\nlet\n  x = { y = 1; };\nin\n  { inherit (x) y; }\n```\n\n#### ↓ desugars to\n\n```nix\nlet\n  x = { y = 1; };\nin\n  { y = x.y; }\n```\n\n### Add All Attributes Into Scope\n\n```nix\nlet\n  x = { y = 1; z = 2;  };\nin\n  with x;\n  y + z # -> returns 3\n```\n\n## Conditionals\n\n### Define Conditionals\n\n```nix\nif x > 0\nthen 1\nelse -1\n```\n\n## Attribute Sets\n\n### Define Attribute Sets\n\n```nix\nlet\n  x = {\n    a = 1;\n    b = 2;\n  };\n  y = { c = 3; };\nin\n```\n\n### Update Attribute Sets\n\n```nix\n{ x = 1; } // { y = 2; } # -> returns { x = 1; y = 2; }\n{ x = 1; } // { x = 2; } # -> returns { x = 2; }\n```\n\n### Check For Attribute\n\n```nix\nlet\n  x = { y = 1; };\nin\n  x ? y # -> returns true\n```\n\n### Reference Attirbute Keys\n\n```nix\nlet\n  x = { y = 1; };\nin\n  x.y # -> returns 1\n```\n\n#### ↓ optional\n\n```nix\nlet\n  x = { y = 1; };\nin\n  x.z or 2 # -> returns 2\n```\n\n## Concatenation & Interpolation\n\n### Concatenate Lists\n\n```nix\n[ 1 2 ] ++ [ 3 4 ] # -> returns [ 1 2 3 4 ]\n```\n\n### Concatenate Paths & Strings\n\n```nix\n/bin + /sh # -> returns /bin/sh\n/bin + \"/sh\" # -> returns /bin/sh\n\"/bin\" + \"/sh\" # -> returns \"/bin/sh\"\n```\n\n### Interpolate Strings\n\n```nix\nlet\n  x = \"bar\";\nin\n  \"foo ${x} baz\" # -> returns \"foo bar baz\"\n```\n\n## Functions\n\n### Simple Function\n\n```nix\nlet\n  f = x: x + 1;\nin\n  f 1 # -> returns 2\n```\n\n### Multiple Arguments\n\n```nix\nlet\n  f = x: y: [ x  y ];\nin\n  f 1 2 # -> returns [ 1 2 ]\n```\n\n### Named Arguments\n\n```nix\nlet\n  f = {x, y}: x + y;\nin\n  f { x=1; y=2; } # -> returns 3\n```\n\n#### ↓ ignoring arguments\n\n```nix\nlet\n  f = {x, y, ... }: x + y;\nin\n  f { x=1; y=2; z=3; } # -> returns 3\n```\n\n#### ↓ default values\n\n```nix\nlet\n  f = {x, y ? 2 }: x + y;\nin\n  f { x=1; } # -> returns 3\n```\n\n#### ↓ bind to variable\n\n```nix\nlet\n  f = {x, y}@args: args.x + args.y;\nin\n  f { x=1; y=2; } # -> returns 3\n```\n\n## Sources\n\n- [NixOS/marketing](https://github.com/nixos/marketing) _(github.com)_\n"
  },
  {
    "path": "source/_posts/nmap.md",
    "content": "---\r\ntitle: Nmap\r\ndate: 2025-06-17 08:30:00\r\nbackground: bg-[#2a0d45]\r\ntags:\r\n  - network\r\n  - scan\r\n  - port\r\ncategories:\r\n  - Linux Command\r\nintro: \r\n  The [Nmap](https://nmap.org/) cheat sheet is a one-page reference sheet for the famous Network Mapper tool.\r\nplugins:\r\n  - copyCode\r\n  \r\n---\r\n\r\n## Getting Started\r\n\r\n\r\n### Basic Usage : \r\n\r\n```bash\r\n# set your target in etc/hosts\r\n\r\n# fast scan of all port of your target\r\nnmap -p- -T5 target \r\n\r\n# fast scan on port 80 with os detection  \r\nnamp -p, 80 -T5 -O target \r\n```\r\n\r\n\r\n### Basic Options : {.col-span-2}\r\n\r\n| Options                  | Purpose                                   |\r\n|:-------------------------|:------------------------------------------|\r\n| `-p-`                    | all ports                                 |\r\n| `-p1-1023`               | scan ports 1 to 1023                      |\r\n| `-F`                     | 100 most common ports                     |\r\n| `-r`                     | scan ports in consecutive order           |\r\n| `-T<0-5>`                | -T0 being the slowest and T5 the fastest  |\r\n| `--max-rate 50`          | rate <= 50 packets/sec                    |\r\n| `--min-rate 15`          | rate >= 15 packets/sec                    |\r\n| `--min-parallelism 100`  | at least 100 probes in parallel           |\r\n\r\n## Nmap Intermediate Options\r\n\r\n### Service Detections : {.col-span-2}\r\n\r\n| Option                       | Meaning                                  |\r\n|:-----------------------------|:-----------------------------------------|\r\n| `--traceroute`               | run traceroute to target                 |\r\n| `--script=SCRIPTS`           | Nmap scripts to run                      |\r\n| `-sC` or `--script=default`  | run default scripts                      |\r\n| `-O`                         | OS detection                             |\r\n| `-sV`                        | Service version detection                |\r\n| `-A`                         | equivalent to `-sV -O -sC --traceroute`  |\r\n\r\n\r\n### Timing  {.col-span-3}\r\n\r\n| Option                                                              | Meaning                                                                                            |\r\n|:--------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------|\r\n| `-T<0-5>`                                                           | Timing template – paranoid (0), sneaky (1), polite (2), normal (3), aggressive (4), and insane (5) |\r\n| `--min-parallelism <numprobes>` and `--max-parallelism <numprobes>` | Minimum and maximum number of parallel probes                                                      |\r\n| `--min-rate <number>` and `--max-rate <number>`                     | Minimum and maximum rate (packets/second)                                                          |\r\n| `--host-timeout`                                                    | Maximum amount of time to wait for a target host                                                   |\r\n\r\n## Formating answers\r\n\r\n### Details & Report {.col-span-2}\r\n\r\n| Option            | Purpose                                |\r\n|:------------------|:---------------------------------------|\r\n| `--reason`        | explains how Nmap made its conclusion  |\r\n| `-v`              | verbose                                |\r\n| `-vv`             | very verbose                           |\r\n| `-d`              | debugging                              |\r\n| `-dd`             | more details for debugging             |\r\n| `-oN <filename>`  | Normal output                          |\r\n| `-oX <filename>`  | XML output                             |\r\n| `-oG <filename>`  | `grep`-able output                     |\r\n| `-oA <basename>`  | Output in all major formats            |\r\n\r\n## Advanced Technic\r\n\r\n### Advanced Scan {.col-span-3}\r\n\r\n| Options    | Protocol | Main Function     | Typical Use Case                               |\r\n|------------|:---------|:------------------|:-----------------------------------------------|\r\n| `-PR -sn`  | **ARP**  | Scan              | Discovering devices on the local network (LAN) |\r\n| `-PE -sn`  | **ICMP** | Echo Scan         | Checking if hosts are reachable (pinging)      |\r\n| `-PP -sn`  | **ICMP** | Timestamp Scan    | Gathering device time info (less common)       |\r\n| `-PM -sn`  | **ICMP** | Address Mask Scan | Determining subnet mask info from hosts        |\r\n| `-PS -sn`  | **TCP**  | SYN Ping Scan     | Detecting open TCP ports and live hosts        |\r\n| `-PA -sn ` | **TCP**  | ACK Ping Scan     | Identifying firewall rules and open ports      |\r\n| `-PU -sn`  | **ICMP** | Ping Scan         | Finding hosts with open UDP services           |\r\n\r\n\r\n##  Investigation Exemple \r\n\r\n### Verbose Os Quick port scan {.col-span-3}\r\n\r\n```bash\r\nnmap -sV -O -p- -T5 target \r\n \r\nStarting Nmap 7.94SVN ( https://nmap.org ) at 2024-11-02 15:17 CET\r\n\r\nNmap scan report for target (10.10.158.161)\r\nHost is up (0.021s latency).\r\nNot shown: 65532 closed tcp ports (reset)\r\n\r\nPORT     STATE SERVICE VERSION\r\n22/tcp   open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.8 (Ubuntu Linux; protocol 2.0)\r\n8009/tcp open  ajp13   Apache Jserv (Protocol v1.3)\r\n8080/tcp open  http    Apache Tomcat 8.5.5\r\n\r\nAggressive OS guesses: Linux 3.10 - 3.13 (95%), Linux 5.4 (95%), ASUS RT-N56U WAP (Linux 3.4) (95%),\r\nLinux 3.16 (95%), Linux 3.1 (93%), Linux 3.2 (93%), AXIS 210A or 211 Network Camera (Linux 2.6.17) (93%), \r\nSony Android TV (Android 5.0) (93%), Android 5.0 - 6.0.1 (Linux 3.4) (93%), Android 5.1 (93%)\r\nNo exact OS matches for host (test conditions non-ideal).\r\nNetwork Distance: 2 hops\r\nService Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel\r\n\r\nOS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .\r\nNmap done: 1 IP address (1 host up) scanned in 39.94 seconds\r\n\r\n\r\n# you can then use `nmap -A -p 22, 8009, 8080 target` on discovered ports\r\n```\r\nDo not use this tool without consent. For educational purposes, this example is coming from a Try Hack Me [machine](https://tryhackme.com/room/bsidesgtthompson).\r\n\r\n\r\n\r\n## Also See\r\n\r\n- [Nmap](https://nmap.org/)"
  },
  {
    "path": "source/_posts/notion.md",
    "content": "---\ntitle: Notion Shortcuts\ndate: 2025-04-24 12:51:00 # You might want to adjust this date\nbackground: bg-gradient-to-l from-gray-400 to-gray-600 hover:from-blue-500 hover:to-purple-500 # Notion-like gradient, adjust as desired\ntags:\n  - notion\n  - keyboard\n  - shortcuts\n  - productivity\n  - reference\ncategories:\n  - Productivity\n  - Software\nintro:\n  A comprehensive quick reference guide for Notion keyboard shortcuts on Desktop and Web, designed to boost your\n  productivity.\nplugins:\n  - copyCode\n---\n\n# Notion Keyboard Shortcuts {.cols-3}\n\n## Most Popular / Essential {.col-span-3}\n\n### Create & Navigate\n\n| Action                       | Mac Shortcut             | Windows/Linux Shortcut |\n| :--------------------------- | :----------------------- | :--------------------- |\n| Create a new page            | `Cmd` `N`                | `Ctrl` `N`             |\n| Open new Notion window       | `Cmd` `Shift` `N`        | `Ctrl` `Shift` `N`     |\n| Quick Find (Search)          | `Cmd` `P`                | `Ctrl` `P`             |\n| Go back in page history      | `Cmd` `[`                | `Ctrl` `[`             |\n| Go forward in page history   | `Cmd` `]`                | `Ctrl` `]`             |\n| Go to parent page            | `Cmd` `Shift` `U`        | `Ctrl` `Shift` `U`     |\n| Open Page Link in New Tab    | `Cmd` `Click`            | `Ctrl` `Click`         |\n| Open Page Link in New Window | `Option` `Shift` `Click` | `Alt` `Shift` `Click`  |\n\n{.show-header .shortcuts}\n\n### View & Mode\n\n| Action                   | Mac Shortcut             | Windows/Linux Shortcut    |\n| :----------------------- | :----------------------- | :------------------------ |\n| Toggle Dark/Light Mode   | `Cmd` `Shift` `L`        | `Ctrl` `Shift` `L`        |\n| Lock/Unlock current page | `Cmd` `Shift` `L` (Hold) | `Ctrl` `Shift` `L` (Hold) |\n| Zoom In                  | `Cmd` `+`                | `Ctrl` `+`                |\n| Zoom Out                 | `Cmd` `-`                | `Ctrl` `-`                |\n| Reset Zoom               | `Cmd` `0`                | `Ctrl` `0`                |\n\n{.show-header .shortcuts}\n\n---\n\n# Markdown Style Formatting {.cols-1}\n\n### On New Lines\n\nType the following at the beginning of an empty line, then press `Space`:\n\n- `*`, `-`, or `+` : Bulleted list\n- `[]` : To-do checkbox (Note: just the characters, no `Cmd`/`Ctrl`)\n- `1.` : Numbered list\n- `#` : H1 heading\n- `##` : H2 heading\n- `###` : H3 heading\n- `>` : Toggle list\n- `\"` : Quote block\n- `---` : Divider (three hyphens)\n- ` ` : Code block (three backticks)\n\n### Inline\n\n- Wrap text with `**` or `__` for **Bold**.\n- Wrap text with `*` or `_` for _Italics_.\n- Wrap text with `~` for ~~Strikethrough~~.\n- Wrap text with `` ` `` for `inline code`.\n\n---\n\n# Text Formatting & Editing {.cols-2}\n\n### Basic Formatting\n\nSelect text first, then use the shortcut: | Action | Mac Shortcut | Windows/Linux Shortcut | |\n:------------------------- | :------------------------ | :----------------------- | | Bold | `Cmd` `B` | `Ctrl` `B` | |\nItalic | `Cmd` `I` | `Ctrl` `I` | | Underline | `Cmd` `U` | `Ctrl` `U` | | Strikethrough | `Cmd` `Shift` `S` | `Ctrl`\n`Shift` `S` | | Inline Code | `Cmd` `E` | `Ctrl` `E` | | Create Link | `Cmd` `K` | `Ctrl` `K` | | Change Color /\nHighlight | `Cmd` `Shift` `H` | `Ctrl` `Shift` `H` | | Clear Formatting | `Cmd` `\\` | `Ctrl` `\\` | {.show-header\n.shortcuts}\n\n### Block Type Conversion\n\nSelect the block(s) first, then use the shortcut: | Action | Mac Shortcut | Windows/Linux Shortcut | |\n:------------------------- | :------------------------ | :----------------------- | | Turn into Text block | `Cmd`\n`Option` `0` | `Ctrl` `Alt` `0` | | Turn into H1 Heading | `Cmd` `Option` `1` | `Ctrl` `Alt` `1` | | Turn into H2\nHeading | `Cmd` `Option` `2` | `Ctrl` `Alt` `2` | | Turn into H3 Heading | `Cmd` `Option` `3` | `Ctrl` `Alt` `3` | |\nTurn into To-do list | `Cmd` `Option` `4` | `Ctrl` `Alt` `4` | | Turn into Bulleted list | `Cmd` `Option` `5` | `Ctrl`\n`Alt` `5` | | Turn into Numbered list | `Cmd` `Option` `6` | `Ctrl` `Alt` `6` | | Turn into Toggle list | `Cmd` `Option`\n`7` | `Ctrl` `Alt` `7` | | Turn into Code block | `Cmd` `Option` `8` | `Ctrl` `Alt` `8` | | Turn into Page | `Cmd`\n`Option` `9` | `Ctrl` `Alt` `9` | | Turn into Callout | `Cmd` `Option` `C` | `Ctrl` `Alt` `C` | {.show-header\n.shortcuts}\n\n### Editing\n\n| Action                     | Mac Shortcut    | Windows/Linux Shortcut |\n| :------------------------- | :-------------- | :--------------------- |\n| New Line within same block | `Shift` `Enter` | `Shift` `Enter`        |\n\n{.show-header .shortcuts}\n\n---\n\n# Creating & Modifying Blocks {.cols-2}\n\n### Creation & Selection\n\n| Action                                     | Mac Shortcut        | Windows/Linux Shortcut |\n| :----------------------------------------- | :------------------ | :--------------------- |\n| Create new text block below                | `Enter`             | `Enter`                |\n| Open the `/` command menu                  | `/`                 | `/`                    |\n| Select current block                       | `Esc`               | `Esc`                  |\n| Select parent block                        | `Shift` `Esc`       | `Shift` `Esc`          |\n| Select block above/below                   | `Up` / `Down`       | `Up` / `Down`          |\n| Select multiple blocks                     | `Shift` `Up`/`Down` | `Shift` `Up`/`Down`    |\n| Select all blocks                          | `Cmd` `A`           | `Ctrl` `A`             |\n| Edit selected block (or text within block) | `Enter`             | `Enter`                |\n\n{.show-header .shortcuts}\n\n### Moving & Structuring\n\n| Action                                  | Mac Shortcut               | Windows/Linux Shortcut     |\n| :-------------------------------------- | :------------------------- | :------------------------- |\n| Duplicate selected block(s)             | `Cmd` `D`                  | `Ctrl` `D`                 |\n| Move selected block(s) up/down          | `Cmd` `Shift` `Up`/`Down`  | `Ctrl` `Shift` `Up`/`Down` |\n| Indent block (nest)                     | `Tab`                      | `Tab`                      |\n| Un-indent block                         | `Shift` `Tab`              | `Shift` `Tab`              |\n| Expand/Collapse toggle list             | `Cmd` `Option` `T`         | `Ctrl` `Alt` `T`           |\n| Expand/Collapse all toggles             | `Cmd` `Option` `Shift` `T` | `Ctrl` `Alt` `Shift` `T`   |\n| Open page from selected link/page block | `Cmd` `Enter`              | `Ctrl` `Enter`             |\n| Delete selected block(s)                | `Delete` or `Backspace`    | `Delete` or `Backspace`    |\n| Turn block into a page                  | `Cmd` `Option` `9`         | `Ctrl` `Alt` `9`           |\n| Move block(s) to another page           | `Cmd` `Option` `Shift` `M` | `Ctrl` `Alt` `Shift` `M`   |\n\n{.show-header .shortcuts}\n\n---\n\n# Comments & Mentions {.cols-2}\n\n### Comments\n\n| Action                   | Mac Shortcut      | Windows/Linux Shortcut |\n| :----------------------- | :---------------- | :--------------------- |\n| Add comment to selection | `Cmd` `Shift` `M` | `Ctrl` `Shift` `M`     |\n\n{.show-header .shortcuts}\n\n### Mentions & Links (Type in block)\n\n- `@` + person's name: Mention a person\n- `@` + page title: Mention/link a page\n- `[[` + page title: Link another page\n- `+` + page title: Link another page (alternative)\n- `@` + date (e.g., `@today`, `@next tuesday`, `@1/15`): Add a date mention\n- `@remind` + date + time (optional): Set a reminder\n\n### Emoji\n\n| Action                | Mac Shortcut           | Windows/Linux Shortcut |\n| :-------------------- | :--------------------- | :--------------------- |\n| Emoji Picker (System) | `Cmd` `Ctrl` `Space`   | `Win` `.` or `Win` `;` |\n| Emoji Picker (Notion) | `:` + emoji name + `:` | `:` + emoji name + `:` |\n\n{.show-header .shortcuts}\n\n---\n\n# Database Shortcuts {.cols-2}\n\n### Navigation & Selection\n\n| Action                     | Mac Shortcut          | Windows/Linux Shortcut |\n| :------------------------- | :-------------------- | :--------------------- |\n| Select row above/below     | `Shift` `Up`/`Down`   | `Shift` `Up`/`Down`    |\n| Open selected page(s)      | `Cmd` `Enter`         | `Ctrl` `Enter`         |\n| Edit property              | `Enter`               | `Enter`                |\n| Move to cell above/below   | `Shift` `Enter`       | `Shift` `Enter`        |\n| Move to cell left/right    | `Tab` / `Shift` `Tab` | `Tab` / `Shift` `Tab`  |\n| Select column              | `Cmd` `Shift` `K`     | `Ctrl` `Shift` `K`     |\n| Select multiple cards/rows | `Shift` `Click`       | `Shift` `Click`        |\n\n{.show-header .shortcuts}\n\n### Other\n\n| Action                     | Mac Shortcut      | Windows/Linux Shortcut |\n| :------------------------- | :---------------- | :--------------------- |\n| Quick Find within Database | `Cmd` `Shift` `P` | `Ctrl` `Shift` `P`     |\n\n{.show-header .shortcuts}\n\n---\n\n## Also see\n\n- [Official Notion Keyboard Shortcuts](https://www.notion.so/help/keyboard-shortcuts) _(notion.so)_\n"
  },
  {
    "path": "source/_posts/npm.md",
    "content": "---\ntitle: npm\ndate: 2020-12-24 17:12:25\nbackground: bg-[#ebd94e]\ntags:\n  - js\n  - web\n  - node\n  - npm\ncategories:\n  - Programming\nintro: |\n  A NPM (node package manager) cheat sheet with the most important concepts, and commands to install, update, and manage your node packages.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started with npm\n\n### Introduction\n\nnpm (Node Package Manager) is the default package manager for Node.js. It allows you to install, update, and manage packages (libraries or modules) for your Node.js applications.\n\n### Installing and checking npm version\n\nInstall Node.js from [nodejs.org](https://nodejs.org/), which includes npm. After installation, you can check the installed version of npm using the following command:\n\n```bash\nnpm --version\n# or\nnpm -v\n```\n\n### Initializing a new project\n\n```bash\nnpm init # Interactive setup\n# or\nnpm init -y # Creates a package.json with default values\n```\n\n## Installing packages\n\n### Install dependencies from package.json\n\n```bash\nnpm install\n# or\nnpm i\n```\n\n### Install a specific package\n\n```bash\nnpm install <package-name>              # Install and add to dependencies\nnpm install <package-name> --save-dev   # Add to devDependencies\nnpm install <package-name> -D           # Shorthand for --save-dev\nnpm install <package-name> -g           # Install globally\nnpm install <package-name>@<version>    # Install specific version\nnpm install <package-name>@latest       # Install latest version\n```\n\n### Uninstall a package\n\n```bash\nnpm uninstall <package-name>          # Uninstall package\nnpm uninstall <package-name> -g       # Uninstall globally\nnpm rm <package-name>                 # Shorthand for uninstall\n```\n\n## Viewing, searching and exploring packages\n\n### Viewing packages\n\n```bash\nnpm view <package-name>               # View package details\nnpm view <package-name> versions      # View all versions of a package\nnpm view <package-name> version       # View the latest version of a package\nnpm view <package-name> description   # View the description of a package\n```\n\n### Searching for packages\n\n```bash\nnpm search <search-term>              # Search for packages with similar terms\n```\n\n### Exploring packages\n\n```bash\nnpm docs <package-name>                # Open package documentation in the browser\nnpm home <package-name>                # Open package homepage in the browser\nnpm repo <package-name>                # Open package repository in the browser\n```\n\n## Managing packages\n\n### Updating packages\n\n```bash\nnpm outdated                           # Check for outdated packages\nnpm update <package-name>              # Update a specific package\nnpm update                             # Update all packages\n```\n\n### Listing installed packages\n\n```bash\nnpm list                              # List installed packages in the current project\nnpm list -g                           # List globally installed packages\nnpm list --depth=0                    # List top-level installed packages only\n```\n\n### Running scripts\n\n```bash\nnpm run <script-name>                 # Run a script defined in package.json\nnpm start                             # Run the 'start' script\nnpm test                              # Run the 'test' script\nnpm build                             # Run the 'build' script\n```\n\n### Cache management\n\n```bash\nnpm cache verify                      # Verify the integrity of the npm cache\nnpm cache clean                       # Clear the npm cache\nnpm cache clean --force               # Force clear the npm cache\n```\n\n### Configuring npm\n\n```bash\nnpm config list                       # List all npm configuration settings\nnpm config set <key> <value>          # Set a configuration value\nnpm config get <key>                  # Get the value of a configuration key\nnpm config delete <key>               # Delete a configuration key\n```\n\n### Auditing and security\n\n```bash\nnpm audit                             # Audit dependencies for vulnerabilities\nnpm audit fix                         # Fix vulnerabilities in dependencies\nnpm audit fix --force                 # Force fix vulnerabilities, may update major versions\n```\n\n## Publishing packages\n\n```bash\nnpm login                             # Log in to your npm account (npmjs.com)\nnpm publish                           # Publish a package to the npm registry\nnpm version <new-version>             # Bump the version of your package (e.g., patch, minor, major)\nnpm unpublish <package-name>          # Unpublish a package (within 72 hours of publishing)\n```\n\n## Other useful commands\n\n```bash\nnpm help                              # Get general help on npm\nnpm help <command>                    # Get help on a specific npm command\nnpm ci                                # Install dependencies from package-lock.json (clean install)\nnpm prune                             # Remove extraneous packages\nnpm dedupe                           # Reduce duplication in the node_modules folder\n```\n"
  },
  {
    "path": "source/_posts/numpy.md",
    "content": "---\ntitle: Numpy\ndate: 2020-12-14 18:28:43\nbackground: bg-[#4f6fc3]\ntags:\n  - scientific\n  - computing\ncategories:\n  - Python\nintro: |\n  [NumPy](https://numpy.org/) is the fundamental package for scientific computing with Python. This cheat sheet is a quick reference for NumPy beginners.\nplugins:\n  - copyCode\n---\n\n## Getting Started {.cols-2}\n\n### Introduction\n\nYou’ll also need to import numpy to get started:\n\n```python\nimport numpy as np\n```\n\n### Importing/exporting\n\n| -                                          | -                     |\n| ------------------------------------------ | --------------------- |\n| `np.loadtxt('file.txt')`                   | From a text file      |\n| `np.genfromtxt('file.csv',delimiter=',')`  | From a CSV file       |\n| `np.savetxt('file.txt',arr,delimiter=' ')` | Writes to a text file |\n| `np.savetxt('file.csv',arr,delimiter=',')` | Writes to a CSV file  |\n\n### Creating Arrays {.row-span-2}\n\n| -                                 | -                                                                 |\n| --------------------------------- | ----------------------------------------------------------------- |\n| `np.array([1,2,3])`               | One dimensional array                                             |\n| `np.array([(1,2,3),(4,5,6)])`     | Two dimensional array                                             |\n| `np.zeros(3)`                     | 1D array of length 3 all values 0                                 |\n| `np.ones((3,4))`                  | 3x4 array with all values 1                                       |\n| `np.eye(5)`                       | 5x5 array of 0 with 1 on diagonal (Identity matrix)               |\n| `np.linspace(0,100,6)`            | Array of 6 evenly divided values from 0 to 100                    |\n| `np.arange(0,10,3)`               | Array of values from 0 to less than 10 with step 3 (eg [0,3,6,9]) |\n| `np.full((2,3),8)`                | 2x3 array with all values 8                                       |\n| `np.random.rand(4,5)`             | 4x5 array of random floats between 0–1                            |\n| `np.random.rand(6,7)*100`         | 6x7 array of random floats between 0–100                          |\n| `np.random.randint(5,size=(2,3))` | 2x3 array with random ints between 0–4                            |\n\n### Inspecting Properties\n\n| -                   | -                                        |\n| ------------------- | ---------------------------------------- |\n| `arr.size`          | Returns number of elements in arr        |\n| `arr.shape`         | Returns dimensions of arr (rows,columns) |\n| `arr.dtype`         | Returns type of elements in arr          |\n| `arr.astype(dtype)` | Convert arr elements to type dtype       |\n| `arr.tolist()`      | Convert arr to a Python list             |\n| `np.info(np.eye)`   | View documentation for np.eye            |\n\n### Copying/sorting/reshaping\n\n| -                     | -                                                       |\n| --------------------- | ------------------------------------------------------- |\n| `np.copy(arr)`        | Copies arr to new memory                                |\n| `arr.view(dtype)`     | Creates view of arr elements with type dtype            |\n| `arr.sort()`          | Sorts arr                                               |\n| `arr.sort(axis=0)`    | Sorts specific axis of arr                              |\n| `two_d_arr.flatten()` | Flattens 2D array two_d_arr to 1D                       |\n| `arr.T`               | Transposes arr (rows become columns and vice versa)     |\n| `arr.reshape(3,4)`    | Reshapes arr to 3 rows, 4 columns without changing data |\n| `arr.resize((5,6))`   | Changes arr shape to 5x6 and fills new values with 0    |\n\n### Adding/removing Elements\n\n| -                         | -                                      |\n| ------------------------- | -------------------------------------- |\n| `np.append(arr,values)`   | Appends values to end of arr           |\n| `np.insert(arr,2,values)` | Inserts values into arr before index 2 |\n| `np.delete(arr,3,axis=0)` | Deletes row on index 3 of arr          |\n| `np.delete(arr,4,axis=1)` | Deletes column on index 4 of arr       |\n\n### Combining/splitting\n\n| -                                    | -                                        |\n| ------------------------------------ | ---------------------------------------- |\n| `np.concatenate((arr1,arr2),axis=0)` | Adds arr2 as rows to the end of arr1     |\n| `np.concatenate((arr1,arr2),axis=1)` | Adds arr2 as columns to end of arr1      |\n| `np.split(arr,3)`                    | Splits arr into 3 sub-arrays             |\n| `np.hsplit(arr,5)`                   | Splits arr horizontally on the 5th index |\n\n### Indexing/slicing/subsetting\n\n| -                     | -                                                                         |\n| --------------------- | ------------------------------------------------------------------------- |\n| `arr[5]`              | Returns the element at index 5                                            |\n| `arr[2,5]`            | Returns the 2D array element on index [2][5]                              |\n| `arr[1]=4`            | Assigns array element on index 1 the value 4                              |\n| `arr[1,3]=10`         | Assigns array element on index [1][3] the value 10                        |\n| `arr[0:3]`            | Returns the elements at indices 0,1,2 (On a 2D array: returns rows 0,1,2) |\n| `arr[0:3,4]`          | Returns the elements on rows 0,1,2 at column 4                            |\n| `arr[:2]`             | Returns the elements at indices 0,1 (On a 2D array: returns rows 0,1)     |\n| `arr[:,1]`            | Returns the elements at index 1 on all rows                               |\n| `arr<5`               | Returns an array with boolean values                                      |\n| `(arr1<3) & (arr2>5)` | Returns an array with boolean values                                      |\n| `~arr`                | Inverts a boolean array                                                   |\n| `arr[arr<5]`          | Returns array elements smaller than 5                                     |\n\n### Vector Math\n\n| -                           | -                                                           |\n| --------------------------- | ----------------------------------------------------------- |\n| `np.add(arr1,arr2)`         | Elementwise add arr2 to arr1                                |\n| `np.subtract(arr1,arr2)`    | Elementwise subtract arr2 from arr1                         |\n| `np.multiply(arr1,arr2)`    | Elementwise multiply arr1 by arr2                           |\n| `np.divide(arr1,arr2)`      | Elementwise divide arr1 by arr2                             |\n| `np.power(arr1,arr2)`       | Elementwise raise arr1 raised to the power of arr2          |\n| `np.array_equal(arr1,arr2)` | Returns True if the arrays have the same elements and shape |\n| `np.sqrt(arr)`              | Square root of each element in the array                    |\n| `np.sin(arr)`               | Sine of each element in the array                           |\n| `np.log(arr)`               | Natural log of each element in the array                    |\n| `np.abs(arr)`               | Absolute value of each element in the array                 |\n| `np.ceil(arr)`              | Rounds up to the nearest int                                |\n| `np.floor(arr)`             | Rounds down to the nearest int                              |\n| `np.round(arr)`             | Rounds to the nearest int                                   |\n\n### Scalar Math\n\n| -                    | -                                                                    |\n| -------------------- | -------------------------------------------------------------------- |\n| `np.add(arr,1)`      | Add 1 to each array element                                          |\n| `np.subtract(arr,2)` | Subtract 2 from each array element                                   |\n| `np.multiply(arr,3)` | Multiply each array element by 3                                     |\n| `np.divide(arr,4)`   | Divide each array element by 4 (returns np.nan for division by zero) |\n| `np.power(arr,5)`    | Raise each array element to the 5th power                            |\n\n### Statistics\n\n| -                     | -                                               |\n| --------------------- | ----------------------------------------------- |\n| `np.mean(arr,axis=0)` | Returns mean along specific axis                |\n| `arr.sum()`           | Returns sum of arr                              |\n| `arr.min()`           | Returns minimum value of arr                    |\n| `arr.max(axis=0)`     | Returns maximum value of specific axis          |\n| `np.var(arr)`         | Returns the variance of array                   |\n| `np.std(arr,axis=1)`  | Returns the standard deviation of specific axis |\n| `arr.corrcoef()`      | Returns correlation coefficient of array        |\n"
  },
  {
    "path": "source/_posts/obsidian.md",
    "content": "---\ntitle: Obsidian\ndate: 2022-11-23 16:23:31.700412\nbackground: bg-[#463793]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 17 keyboard shortcuts found in the Obsidian knowledge base app.\n---\n\n## Keyboard Shortcuts {.cols-2}\n\n### Default Shortcuts\n\n| Shortcut             | Action                      |\n| -------------------- | --------------------------- |\n| `Ctrl` `S`           | Save a file in the editor   |\n| `Ctrl` `N`           | Create a new note           |\n| `Ctrl` `P`           | Open the command palette    |\n| `Ctrl` `O`           | Open the quick switcher     |\n| `Ctrl` `Shift` `F`   | Search in all files         |\n| `Ctrl` `G`           | Open the graph view         |\n| `Ctrl` `Alt` `Left`  | Navigate backwards          |\n| `Ctrl` `Alt` `Right` | Navigate forwards           |\n| `Ctrl` `F`           | Search the current file     |\n| `Ctrl` `E`           | Toggle edit or preview mode |\n| `Ctrl` `,`           | Open settings               |\n\n{.shortcuts}\n\n### Editing\n\n| Shortcut      | Action                          |\n| ------------- | ------------------------------- |\n| `Ctrl` `B`    | Bold selected text              |\n| `Ctrl` `I`    | Italic selected text            |\n| `Ctrl` `K`    | Insert an external link         |\n| `Ctrl` `]`    | Indent                          |\n| `Ctrl` `[`    | Unindent                        |\n| `Alt` `Enter` | Jump into the selected backlink |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Obsidian](https://help.obsidian.md/How+to/Keyboard+shortcuts) _(help.obsidian.md)_\n"
  },
  {
    "path": "source/_posts/ocaml.md",
    "content": "---\ntitle: OCaml\ndate: 2024-08-14 21:12:00\nbackground: bg-[#ec670f]\ntags:\n  - scientific\n  - functional\ncategories:\n  - Programming\nintro: |\n  The [OCaml](https://www.ocaml.org/) cheat sheet is a one-page reference sheet for the OCaml programming language.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### hello.ml\n\n```ml\nlet () =\n  let message = \"Hello, World!\" in\n  Printf.printf \"%s\\n\" message\n```\n\n#### Compile and Run\n\n```bash\n$ ocamlc -o hello.byte hello.ml\n$ ./hello.byte\n```\n\n#### Build and Run with Dune\n\n```bash\n$ dune build hello.exe\n$ _build/default/hello.exe\n\n# you can also just run\n$ dune exec ./hello.exe\n```\n\nSee the [dune](https://dune.build/) documentation for more info.\n\n### Imports\n\nInstall modules with opam\n\n```bash\n$ opam install hex\n```\n\n#### Global Open\n\n```ml\nopen Hex\n```\n\n#### Local Open\n\n```ml\nHex.of_string \"hex string\"\n\nlet open Hex in\n  of_string \"to hex\"\n```\n\n### Comments\n\n#### Line & Block Comments\n\n```ml\n(* A single line comment *)\n\n(* A multi-line comment\n* where we want to explain\n* something complex *)\n\n(* Outer comment\n   (* Nested comment *)\n   End of outer comment *)\n```\n\n#### Documentation Comments\n\n```ml\nval sum : int -> int -> int\n(** [sum x y] returns the sum\n of two integers [x] and [y] *)\n```\n\n## Data Types\n\n### Predefined Types\n\n#### Unit\n\nNote: `#` Indicates execution at the toplevel followed by the output\n\n```ml\n# ();; (* equivalent to void in C *)\n- : unit = ()\n```\n\n#### Basic Types\n\n```ml\n# 5 ;; (* integer *)\n- : int = 5\n\n# 3.14 ;;  (* float *)\n- : float = 3.14\n\n# true ;; (* bool *)\n- : bool = true\n\n# false ;;\n- : bool = false\n\n# 'a' ;; (* char *)\n- : char = 'a'\n\n# \"a string\" ;; (* string *)\n- : string = \"a string\"\n\n# String.to_bytes \"hello\" ;; (* bytes *)\n- : bytes = Bytes.of_string \"hello\"\n\n# (3, 5);; (* tuple *)\n- : int * int = (3, 5)\n\n# ref 0;; (* reference *)\n- : int ref = {contents = 0}\n```\n\n#### Options & Results\n\n```ml\n# Some 42;;\n- : int option = Some 42\n\n# Ok 42;;\n- : (int, 'a) result = Ok 42\n\n# Error \"404\";;\n- : ('a, int) result = Error 404\n```\n\n### Arrays & Lists\n\n#### Arrays\n\n```ml\n# [|0; 1; 2; 3|];; (* create an array *)\n- : int array = [|0; 1; 2; 3|]\n\n# [|'u'; 's'; 'c'|].(1);; (* array access *)\n- char = 's'\n```\n\nArrays are mutable\n\n```ml\nlet scores = [|97; 85; 99|];;\n- : int array = [|97; 85; 99|]\n\n# scores.(2) <- 89;; (* update an element *)\n- unit = ()\n\n# scores;;\n- : int array = [|97; 85; 89|]\n```\n\n#### Lists\n\n```ml\n# [1; 2; 3];;\n- : int list = [1; 2; 3;]\n\n# [\"a\"; \"str\"; \"lst\"];;\n- : string list = [\"a\"; \"str\"; \"lst\"]\n```\n\nLists are immutable\n\n```ml\n# let lst = [1; 2; 3];;\n- : int list = [1; 2; 3]\n\n# let new_lst =  0 :: lst;; (* prepend to a new list *)\n- : int list = [0; 1; 2; 3]\n\n# new_lst @ [4;5;6];; (* combine two lists *)\n- : int list = [0; 1; 2; 3; 4; 5; 6]\n```\n\n### User-Defined Types\n\n#### Records\n\nBundle related data\n\n```ml\ntype person = {\n  name: string;\n  age: int\n}\n\n# let zeno = {name = \"Zeno\"; age = 30};;\nval zeno : person = {name = \"Zeno\"; age = 30}\n```\n\n#### Variants\n\nSeveral different, but related types\n\n```ml\ntype shape =\n  | Circle of float\n  | Rectangle of float * float\n\n# let my_shape = Circle 5.0;;\n- : shape = Circle 5.\n```\n\n#### Aliases\n\nProvide meaningful name to complex or commonly used types\n\n```ml\ntype point = float * float\n\n# let origin: point = (0.0, 0.0);;\nval origin : point = (0., 0.)\n```\n\n## Functions\n\n### Functions\n\n#### Single parameter\n\n```ml\nlet add_one x =\n  let result = x + 1 in\n  result\n\n# add_one 1;;\n- : int = 2\n```\n\n#### Multiple parameters\n\n```ml\nlet sum x y =\n  let result = x + y in\n  result\n\n# sum 1 2;;\n- : int = 3\n```\n\n#### Tuple parameter\n\n```ml\nlet str_concat (x, y) =\n  x ^ \" \" ^ y\n\n# str_concat (\"Hello\", \"OCaml\") ;;\n- : string = \"Hello Ocaml\"\n```\n\n### Recursive Functions\n\n#### rec keyword\n\nAll recusive functions use the rec keyword\n\n```ml\nlet rec factorial n =\n  if n < 1 then 1 else n * factorial (n - 1)\n```\n\nThe above can cause stackoverflow.\n\n#### Tail Recursion\n\nMakes use of a helper function and the acc argument.\n\n```ml\nlet rec factorial_helper n acc =\n  if n = 0 then acc\n  else factorial_helper (n - 1) (n * acc)\n```\n\nNotice the last call is the recursive function.\n\n```ml\nlet factorial n = factorial_helper n 1\n```\n\n### Chaining\n\n#### Application Operator\n\nRead from right to left, the first operation is `sum 2 3`\n\n```ml\n(* find log(2 + 3) *)\n# log @@ float_of_int @@ sum 2 3 ;;\n- : float = 1.609...\n```\n\n#### Pipeline\n\n```ml\n(* find log((x + y)!) *)\n# sum 2 3\n  |> factorial\n  |> float_of_int\n  |> log ;;\n- : float = 4.787...\n```\n\n`|>` takes the output of the function and passes it as input to the next function in the pipeline\n\n## Control Flow\n\n### If Statements\n\n#### If Statement\n\n```ml\nlet is_pos x =\n  if x > 0 then \"positive\" else \"negative\"\n```\n\n#### If else if\n\n```ml\nlet f x =\n  if x > 3 then \"gt 3\"\n  else if x < 3 then \"lt 3\"\n  else \"eq 3\"\n```\n\n#### Pattern Matching\n\n```ml\nlet is_pos x =\n  match x > 0 with\n  | true  -> \"positive\"\n  | false -> \"negative\"\n```\n\n### Loops\n\n#### For loop\n\n```ml\nfor i = 1 to 5 do\n  print_int i\ndone\n```\n\n#### While loop\n\nNotice the `ref` is needed to have the while condition eventually become false.\n\n```ml\nlet i = ref 0 in\n  while !i < 5 do\n    print_int !i;\n    i := !i + 1\n  done\n```\n\n### Operators\n\n#### Comparison Operators\n\n```ml\n=         (* equal to *)\n<>        (* not equal to *)\n>         (* greater than *)\n<         (* less than *)\n>=        (* greater than or eq to *)\n<=        (* less than or eq to *)\n```\n\n#### Arithmatic Operators\n\n```ml\n(* int operator   float operator *)\n+                 +.  (* addition *)\n-                 -.  (* subtraction *)\n*                 *.  (* multiplication *)\n/                 /.  (* division *)\n                  **  (* power *)\n```\n\n## Useful Tools\n\n### List\n\n#### Searching & Filtering\n\n```ml\n# let lst = [1; 2; 3];;\nval lst : int list = [1; 2; 3]\n\n# List.filter (fun x -> x mod 2 = 0) lst;;\n- : int list = [2]\n\n# List.find (fun x -> x = 4) lst;;\nException: Not_found\n\n# List.sort compare [2; 1; 3];;\n- : int list = [1; 2; 3]\n```\n\n#### Applying Transformations\n\n```ml\n(* Loop over list and apply fun f *)\nList.iter f lst\n\n(* map a function to each elem *)\n(* Ex. double each element x in lst *)\nList.map (fun x -> x + x) lst\n\n(* Apply an operator between elements *)\n(* Ex. 1 + 2 + 3 *)\nList.fold_left (+) 0 lst\n```\n\n### Associaton Lists\n\n#### Definition and Access\n\n```ml\nlet scores =\n  [(\"math\", 91); (\"phil\", 89); (\"stats\", 94)]\n\n# List.assoc \"stats\" scores;;\n- : int = 94\n\n# List.mem_assoc \"math\" scores;;\n- : bool = true\n```\n\n#### Split and Combine\n\n```ml\n# List.split scores;;\n- : string list * int list = ([\"math\"; \"phil\"; \"stats\"], [91; 89; 94])\n\n# List.combine [1;2;3] [4; 5; 6];;\n- : (int * int) list = [(1, 4); (2, 5); (3, 6)]\n```\n\nAssociation lists are similar to dictionaries or hashmaps\n\n### Hash Tables\n\nHash Tables are mutable.\n\n#### Initialize & Add Data\n\n```ml\n\n# let my_htable = Hashtbl.create 3;;\nval my_htable : ('_weak1, '_weak2) Hashtbl.t = <abstr>\n\n# Hashtbl.add my_htable \"A\" \"John\";\n  Hashtbl.add my_htable \"A\" \"Jane\";\n  Hashtbl.add my_htable \"B\" \"Max\";;\n```\n\n#### Find Data\n\n```ml\n# Hashtbl.find my_htable \"A\";;\n- : string = \"Jane\"\n\n(* find all *)\n# Hashtbl.find_all my_htable \"A\";;\n- : string list = [\"Jane\"; \"John\"]\n```\n\n### Maps\n\nMaps are immutable key-value association tables.\n\n#### Initialization & Add Data\n\n```ml\n(* the Map.Make functor creates the custom map module *)\n# module StringMap = Map.Make(String);;\n\nlet books =\n  StringMap.empty\n  |> StringMap.add \"Dune\" (\"Herbet\", 1965)\n  |> StringMap.add \"Neuromancer\" (\"Gibson\", 1984)\n```\n\n#### Finding Entries\n\n```ml\n(* find_opt returns assoc val wrapped in an option else None *)\n# StringMap.find_opt \"Dune\" books;;\n- : (string * int) option = Some (\"Herbet\", 1965)\n\n(* find returns the association else Not_Found *)\n# StringMap.find \"Dune\" books;;\n- : string * int = (\"Herbet\", 1965)\n```\n\n#### Adding & Removing Entries\n\nCreates a new map since maps are immutable\n\n```ml\nlet more_books = books\n  |> StringMap.add \"Foundation\" (\"Isaac Asimov\", 1951)\n\nlet less_books =\n  |> StringMap.remove \"Dune\"\n```\n\nFiltering\n\n```ml\nlet eighties_books =\n    StringMap.filter\n      (fun _ (_, year) -> year > 1980 & number < 1990) books\n```\n\n#### Printing Data\n\n```ml\nlet print_books map =\n  StringMap.iter (fun title (author, year) ->\n    Printf.printf \"Title: %s, Author: %s, Year: %d\\n\" title author year\n  ) map\n\n# let () = print_books eighties_books;;\nTitle: Neuromancer, Author: Gibson, Year: 1984\n```\n"
  },
  {
    "path": "source/_posts/openssl.md",
    "content": "---\ntitle: OpenSSL\ndate: 2020-11-25 18:28:43\nicon: icon-style\nbackground: bg-indigo-600\ntags:\ncategories:\n  - Linux Command\nintro: |\n  This is a reference of commands to use to interact with electronic certificates\nplugins:\n  - copyCode\n---\n\n## Private Key {.cols-2}\n\n### Print out the private key details\n\n```bash\nopenssl rsa -check -text -in privateKey.key\n```\n\n### Print out the hashes of the private key\n\n```bash\nopenssl rsa -noout -modulus -in privateKey.key | openssl md5\nopenssl rsa -noout -modulus -in privateKey.key | openssl sha1\nopenssl rsa -noout -modulus -in privateKey.key | openssl sha256\nopenssl rsa -noout -modulus -in privateKey.key | openssl sha512\n```\n\n### Change password\n\n```bash\nopenssl rsa -aes256 -in privateKey.key -out newPrivateKey.key\n```\n\n### List available elliptic curves\n\n```bash\nopenssl ecparam -list_curves\n```\n\n### Create elliptic curve private key with a specific curve\n\n```bash\nopenssl ecparam -name secp521r1 -genkey -noout -out privateKey.key\n```\n\n## Certificate {.cols-2}\n\n### Print out the hashes of the certificate\n\n```bash\nopenssl x509 -noout -modulus -in certificate.crt | openssl md5\nopenssl x509 -noout -modulus -in certificate.crt | openssl sha1\nopenssl x509 -noout -modulus -in certificate.crt | openssl sha256\nopenssl x509 -noout -modulus -in certificate.crt | openssl sha512\n```\n\nOr, alternatively:\n\n```bash\nopenssl x509 -noout -fingerprint -in certificate.crt\nopenssl x509 -noout -fingerprint -sha256 -in certificate.crt\n```\n\n### Print out the content of the certificates\n\n```bash\nopenssl x509 -in certificate.crt -noout -text|more\n```\n\n### Print out specific fields of the certificates\n\n```bash\nopenssl x509 -noout -subject certificate.crt\nopenssl x509 -noout -issuer certificate.crt\nopenssl x509 -noout -dates certificate.crt\n```\n\n### Inspect server certificates\n\n```bash\necho | openssl s_client -servername www.openssl.org -connect \\\nwww.openssl.org:443 2>/dev/null | openssl x509 -noout -text|more\necho | openssl s_client -servername imap.arcor.de -connect \\\nimap.arcor.de:993 2>/dev/null | openssl x509 -noout -text|more\n```\n\n### Verify certificates\n\n**OK**\n\n```bash\nopenssl verify -verbose -x509_strict -CAfile \\\nissuer.crt Test\\ Haeschen\\ 1.crt\n```\n\nResult:\n\n```bash\nTest Haeschen 1.crt: OK\n```\n\n**Corrupted**\n([for example](https://security.stackexchange.com/questions/60804/creating-an-x-509-certificate-with-an-invalid-signature))\n\n```bash\nopenssl verify -verbose -x509_strict -CAfile \\\nissuer.crt Test\\ Haeschen\\ 1_corrupted.crt\n```\n\nResult:\n\n```bash\nC = DE, ST = Thueringen, L = Rudolstadt, O = Damaschkestr. 11, OU = Arbeitszimmer, CN = Test Haeschen 1\nerror 7 at 0 depth lookup: certificate signature failure\nerror Test Haeschen 1_corrupted.crt: verification failed\n40270500477F0000:error:0200008A:rsa routines:RSA_padding_check_PKCS1_type_1:invalid padding:../crypto/rsa/rsa_pk1.c:75:\n40270500477F0000:error:02000072:rsa routines:rsa_ossl_public_decrypt:padding check failed:../crypto/rsa/rsa_ossl.c:598:\n40270500477F0000:error:1C880004:Provider routines:rsa_verify:RSA lib:../providers/implementations/signature/rsa_sig.c:774:\n40270500477F0000:error:06880006:asn1 encoding routines:ASN1_item_verify_ctx:EVP lib:../crypto/asn1/a_verify.c:217:\n```\n\n## S/Mime {.cols-2}\n\n### create signature\n\n```bash\nopenssl smime -sign -in msg.txt -text -out msg.p7s \\\n-signer certificate.crt -inkey privateKey.key\n```\n\n### Verify signature\n\n```bash\nopenssl smime -verify -in msg.p7s -CAfile chain.pem\n```\n\n## CRL {.cols-2}\n\n### Print out the contents of the CRL\n\n```bash\nopenssl crl -inform DER -noout -text  -in crl/cacrl.der\nopenssl crl -inform PEM -noout -text  -in crl/cacrl.pem\n```\n\n## PKCS#12 {.cols-2}\n\n### Display contents\n\n```bash\nopenssl pkcs12 -info -in  digitalIdentity.p12\n```\n\n### Create from certificate and private key\n\n```bash\nopenssl pkcs12 -export -in certificate.cert \\\n-inkey privateKey.key -out digitalIdentity.p12\n```\n\n### Extract private key\n\n```bash\nopenssl pkcs12 -in digitalIdentity.p12 -out privateKey.key\n```\n\n### Convert to PEM\n\n```bash\nopenssl pkcs12 -in digitalIdentity.p12 -out digitalIdentity.pem\n```\n\n## TSA {.cols-2}\n\n### Display query\n\n```bash\nopenssl ts -query -in query.tsq -text\n```\n\n### Display reply\n\n```bash\nopenssl ts -reply -in reply.tsr -text\n```\n\n### Verify reply\n\n```bash\nopenssl ts -verify -in reply.tsr -data data.dat -CAfile chain.pem\n```\n\n### Extract token from reply\n\n```bash\nopenssl ts -reply -in reply.tsr -token_out -out token.tk\n```\n\n### Extract certificates from token\n\n```bash\nopenssl pkcs7 -inform DER -in token.tk -print_certs -noout -text\n```\n\n## CSR {.cols-2}\n\n### Create from existing key\n\n```bash\nopenssl req -new -key privateKey.key -out my.csr\n```\n\nThis can of course be a RSA key or one based on an elliptic curve. Available curves can be listed using\n\n```bash\nopenssl ecparam -list_curves\n```\n\nAfterwards you chose one of the curves and create a private key like so:\n\n```bash\nopenssl ecparam -name secp521r1 -genkey -noout \\\n-out privateKey.key\n```\n\n### Display\n\n```bash\nopenssl req -in my.csr -noout -text\n```\n\n## HTTPS {.cols-2}\n\n### Dump Certificates PEM encoded\n\n```bash\nopenssl s_client -showcerts -connect www.example.com:443\n```\n\n## STARTTLS {.cols-2}\n\n### Dump Certificates PEM encoded\n\n```bash\nopenssl s_client -showcerts -starttls imap \\\n-connect mail.domain.com:139\n```\n\n## S/MIME verification {.cols-2}\n\n### Possible outcomes\n\nMessage was tampered with (return code 4):\n\n```bash\nVerification failure\n140485684135232:error:2E09A09E:CMS routines:CMS_SignerInfo_verify_content:verification failure:../crypto/cms/cms_sd.c:847:\n140485684135232:error:2E09D06D:CMS routines:CMS_verify:content verify error:../crypto/cms/cms_smime.c:393:\n```\n\nMessage signature not trusted (return code 4):\n\n```bash\nVerification failure\n140146111432000:error:2E099064:CMS routines:cms_signerinfo_verify_cert:certificate verify error:../crypto/cms/cms_smime.c:252:Verify error:unable to get local issuer certificate\n```\n\nMessage not signed (return code 2):\n\n```bash\nError reading S/MIME message\n140701208487232:error:0D0D40CD:asn1 encoding routines:SMIME_read_ASN1:invalid mime type:../crypto/asn1/asn_mime.c:469:type: multipart/alternative\n```\n\nValidation successful (return code 0):\n\n```bash\nVerification successful\n```\n\n### Verify the validity of an email message\n\n```bash\nopenssl cms -verify -in some_email_message.eml\n```\n\n### Verify the validity of an email message explicitly specifying trust\n\n```bash\nopenssl cms -verify -in some_email_message \\\n-CAfile trust_anchor-crt\n```\n\n### Signed and encrypted messages need to be decrypted first:\n\nNote: the P12 file holding the digital identity must be pem-encoded! (see above)\n\n```bash\nopenssl cms -decrypt -out decrypted_email_message \\\n-inkey p12.pem -in some_encrypted_email_message\n```\n\n## Raw {.cols-2}\n\n### See the raw structure of an ASN.1 file (only for DER encoded files)\n\n```bash\nopenssl asn1parse -in mysterious_file.pem\n```\n\n### With a bit more detail\n\n```bash\nopenssl asn1parse -dump -strictpem -in mysterious_file.pem\n```\n\n## Some resources with useful OpenSSL commands\n\n- [OpenSSL command cheatsheet](https://www.freecodecamp.org/news/openssl-command-cheatsheet-b441be1e8c4a/)\n- [21 OpenSSL Examples to Help You in Real-World](https://geekflare.com/openssl-commands-certificates/)\n- [The Most Common OpenSSL Commands](https://www.sslshopper.com/article-most-common-openssl-commands.html)\n- [OpenSSL Quick Reference Guide](https://www.digicert.com/ssl-support/openssl-quick-reference-guide.htm)\n- [openssl_commands.md](https://gist.github.com/webtobesocial/5313b0d7abc25e06c2d78f8b767d4bc3)\n- [OpenSSL Essentials: Working with SSL Certificates, Private Keys and CSRs](https://www.digitalocean.com/community/tutorials/openssl-essentials-working-with-ssl-certificates-private-keys-and-csrs)\n- [OpenSSL tips and tricks](https://commandlinefanatic.com/cgi-bin/showarticle.cgi?article=art030)\n- [Checking A Remote Certificate Chain With OpenSSL ](https://langui.sh/2009/03/14/checking-a-remote-certificate-chain-with-openssl/)\n- [OpenSSL: how to extract certificates and token status from RFC3161 timestamping reply?](https://stackoverflow.com/questions/66044640/openssl-how-to-extract-certificates-and-token-status-from-rfc3161-timestamping)\n- [Steps to generate CSR for SAN certificate with openssl](https://www.golinuxcloud.com/openssl-subject-alternative-name/)\n- [Howto add a Subject Alternative Name extension into a Certificate Signing Request](https://support.microfocus.com/kb/doc.php?id=3522065)\n"
  },
  {
    "path": "source/_posts/origami.md",
    "content": "---\ntitle: Origami Studio\ndate: 2022-11-23 16:23:31.695481\nbackground: bg-[#4a8eee]\nlabel: Mac\ntags:\n  -\n  - mac\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 71 keyboard shortcuts found in Origami Studio. This application is MacOS-only.\n---\n\n## Keyboard Shortcuts\n\n### General\n\n| Shortcut      | Action        |\n| ------------- | ------------- |\n| `Opt` `Enter` | Insert patch  |\n| `Cmd` `Enter` | Insert layer  |\n| `Cmd` `/`     | Documentation |\n\n{.shortcuts}\n\n### Patches {.row-span-3}\n\n| Shortcut    | Action               |\n| ----------- | -------------------- |\n| `I`         | Interaction          |\n| `S`         | Switch               |\n| `A`         | Pop animation        |\n| `C`         | Classic animation    |\n| `T`         | Transition           |\n| `K`         | Keyboard             |\n| `D`         | Delay                |\n| `Shift` `I` | Option switch        |\n| `O`         | Option picker        |\n| `X`         | Splitter             |\n| `W`         | Wireless broadcaster |\n| `Shift` `W` | Wireless receiver    |\n| `U`         | Pulse                |\n| `+`         | Add                  |\n| `-`         | Minus                |\n| `*`         | Multiply             |\n| `/`         | Divide               |\n| `%`         | Modulus or remainder |\n| `Shift` `A` | AND logic            |\n| `Shift` `O` | OR logic             |\n| `Shift` `N` | NOT logic            |\n| `E`         | Equals               |\n| `>`         | Greater than         |\n| `<`         | Less than            |\n| `Shift` `R` | Progress             |\n| `R`         | Reverse progress     |\n\n{.shortcuts}\n\n### Organizing Patches\n\n| Shortcut                | Action                               |\n| ----------------------- | ------------------------------------ |\n| `Shift` `Enter`         | Rename patch                         |\n| `Cmd` `[`               | Align patches left                   |\n| `Cmd` `]`               | Align patches right                  |\n| `Cmd` `Shift` `[`       | Align patches top                    |\n| `Cmd` `Shift` `]`       | Align patches bottom                 |\n| `Opt` `Ctrl` `C`        | Insert comment around patches        |\n| `Cmd` `Ctrl` `G`        | Create patch component               |\n| `Opt` `P`               | Publish input or output port         |\n| `Opt` `Down`            | Enter patch component                |\n| `Opt` `Up`              | Exit patch component                 |\n| `Cmd` `Shift` `I`       | Patch info                           |\n| `Cmd` `Opt` `L`         | Add patch component to user library  |\n| `Cmd` `Opt` `Shift` `L` | Add patch component to other library |\n\n{.shortcuts}\n\n### Layers {.row-span-2}\n\n| Shortcut                   | Action                     |\n| -------------------------- | -------------------------- |\n| `Shift` `Enter`            | Rename layer               |\n| `Cmd` `Shift` `H`          | Hide or show layer         |\n| `Cmd` `Shift` `L`          | Lock or unlock layer       |\n| `Cmd` `Opt` `Up`           | Bring forward              |\n| `Cmd` `Opt` `Down`         | Send backwards             |\n| `Cmd` `Opt` `Shift` `Up`   | Bring to front             |\n| `Cmd` `Opt` `Shift` `Down` | Send to back               |\n| `Cmd` `Opt` `M`            | Mask layer                 |\n| `Cmd` `Opt` `Shift` `M`    | Add to mask                |\n| `Cmd` `G`                  | Group layers               |\n| `Cmd` `Shift` `G`          | Ungroup layers             |\n| `Cmd` `Ctrl` `G`           | Create layer component     |\n| `Opt` `Down`               | Enter component            |\n| `Opt` `Up`                 | Exit component             |\n| `Cmd` `Shift` `I`          | Layer info                 |\n| `Cmd` `Opt` `L`            | Add layer to user library  |\n| `Cmd` `Opt` `Shift` `L`    | Add layer to other library |\n\n{.shortcuts}\n\n### Viewer\n\n| Shortcut          | Action            |\n| ----------------- | ----------------- |\n| `Cmd` `R`         | Restart prototype |\n| `Opt` `D`         | Toggle device     |\n| `Opt` `H`         | Toggle hand       |\n| `Cmd` `Opt` `F`   | Mini viewer       |\n| `Cmd` `Shift` `F` | Fullscreen viewer |\n| `Cmd` `Opt` `0`   | 1:1 viewer        |\n\n{.shortcuts}\n\n### Number Inputs\n\n| Shortcut       | Action                 |\n| -------------- | ---------------------- |\n| `Up`           | Increase number by one |\n| `Down`         | Decrease number by one |\n| `Shift` `Up`   | Increase number by 10  |\n| `Shift` `Down` | Decrease number by 10  |\n| `Opt` `Up`     | Increase number by 0.1 |\n| `Opt` `Down`   | Decrease number by 0.1 |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Origami Studio](https://origami.design/documentation/workflow/KeyboardShortcuts.html)\n  _(origami.design)_\n"
  },
  {
    "path": "source/_posts/outlook.md",
    "content": "---\ntitle: Microsoft Outlook\ndate: 2022-11-23 16:23:31.698084\nbackground: bg-[#3a7cd1]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 210 keyboard shortcuts found in Microsoft Outlook\n---\n\n## Keyboard Shortcuts\n\n### Frequently used\n\n| Shortcut           | Action             |\n| ------------------ | ------------------ |\n| `Esc`              | Close              |\n| `Alt` `H`          | Go to Home tab     |\n| `Ctrl` `Shift` `M` | New message        |\n| `Alt` `S`          | Send               |\n| `Alt` `N`          | Insert file        |\n| `Ctrl` `Shift` `K` | New task           |\n| `Delete`           | Delete             |\n| `Ctrl` `E`         | Search             |\n| `Ctrl` `R`         | Reply              |\n| `Ctrl` `F`         | Forward            |\n| `Ctrl` `Shift` `R` | Reply all          |\n| `Ctrl` `C`         | Copy               |\n| `Alt` `S`          | Send/Receive       |\n| `Ctrl` `2`         | Go to calendar     |\n| `Ctrl` `Shift` `A` | Create appointment |\n| `Alt` `H` `M, V`   | Move to folder     |\n| `Alt` `J` `A`      | Attachment Save As |\n\n{.shortcuts}\n\n### Basic navigation\n\n| Shortcut             | Action                                                      |\n| -------------------- | ----------------------------------------------------------- |\n| `Ctrl` `1`           | Switch to Mail view                                         |\n| `Ctrl` `2`           | Switch to Calendar view                                     |\n| `Ctrl` `3`           | Switch to Contacts view                                     |\n| `Ctrl` `4`           | Switch to Tasks view                                        |\n| `Ctrl` `5`           | Switch to Notes                                             |\n| `Ctrl` `6`           | Switch to Folders list in the Folder pane                   |\n| `Ctrl` `7`           | Switch to Shortcuts                                         |\n| `Ctrl` `.`           | Switch to next open message                                 |\n| `Ctrl` `,`           | Switch to previous open message                             |\n| `Ctrl` `Shift` `Tab` | Move between Folder/Outlook/Reading/To-Do                   |\n| `Ctrl` `Tab`         | Move around message header lines in the Folder pane         |\n| `Arrows`             | Move around within the Folder pane                          |\n| `Ctrl` `Y`           | Go to a different folder                                    |\n| `Ctrl` `E`           | Go to the Search box                                        |\n| `Alt` `Up`           | In the Reading pane, go to the previous message             |\n| `Space`              | In the Reading pane, page down through text                 |\n| `Shift` `Space`      | In the Reading pane, page up through text                   |\n| `Left/Right`         | Collapse or expand a group in the email message list        |\n| `Alt` `B/Left`       | Go back to previous view in the main Outlook window         |\n| `Alt` `Right`        | Go forward to next view in the main Outlook window          |\n| `Ctrl` `Shift` `W`   | Select the InfoBar and, if available, show menu of commands |\n\n{.shortcuts}\n\n### Search\n\n| Shortcut           | Action                                                      |\n| ------------------ | ----------------------------------------------------------- |\n| `Ctrl` `E`         | Find a message or other item                                |\n| `Esc`              | Clear the search results                                    |\n| `Ctrl` `Alt` `A`   | Expand the search to include all items in module you are in |\n| `Ctrl` `Shift` `F` | Use Advanced Find                                           |\n| `Ctrl` `Shift` `P` | Create a Search folder                                      |\n| `F4`               | Search for text within an open item                         |\n| `Ctrl` `H`         | Find and replace text/symbols in Reading pane               |\n| `Ctrl` `Alt` `K`   | Expand search to include items from the current folder      |\n| `Ctrl` `Alt` `Z`   | Expand search to include subfolders                         |\n\n{.shortcuts}\n\n### Create an item or file\n\n| Shortcut           | Action                              |\n| ------------------ | ----------------------------------- |\n| `Ctrl` `Shift` `A` | Create an appointment               |\n| `Ctrl` `Shift` `C` | Create a contact                    |\n| `Ctrl` `Shift` `L` | Create a contact group              |\n| `Ctrl` `Shift` `X` | Create a fax                        |\n| `Ctrl` `Shift` `E` | Create a folder                     |\n| `Ctrl` `Shift` `Q` | Create a meeting request            |\n| `Ctrl` `Shift` `M` | Create a message                    |\n| `Ctrl` `Shift` `N` | Create a note                       |\n| `Ctrl` `Shift` `H` | Create an Office document           |\n| `Ctrl` `Shift` `S` | Post to the selected folder         |\n| `Ctrl` `T`         | Post a reply in the selected folder |\n| `Ctrl` `Shift` `P` | Create a Search folder              |\n| `Ctrl` `Shift` `K` | Create a task                       |\n\n{.shortcuts}\n\n### Commands in most views\n\n| Shortcut           | Action                                                |\n| ------------------ | ----------------------------------------------------- |\n| `Ctrl` `S`         | Save (except in Tasks view)                           |\n| `Alt` `S`          | Save and close (except in Mail view)                  |\n| `F12`              | Save as (only in Mail view)                           |\n| `Ctrl` `Z`         | Undo                                                  |\n| `Ctrl` `D`         | Delete an item                                        |\n| `Ctrl` `P`         | Print                                                 |\n| `Ctrl` `Shift` `Y` | Copy an item                                          |\n| `Ctrl` `Shift` `V` | Move an item                                          |\n| `Ctrl` `K`         | Check names                                           |\n| `F7`               | Check spelling                                        |\n| `Ctrl` `Shift` `G` | Flag for follow-up                                    |\n| `Ctrl` `F`         | Forward                                               |\n| `Alt` `S`          | Send or post or invite all                            |\n| `F2`               | Enable editing in a field, all views except Mail/Icon |\n| `Ctrl` `L`         | Left align text                                       |\n| `Ctrl` `E`         | Center text                                           |\n| `Ctrl` `R`         | Right align text                                      |\n\n{.shortcuts}\n\n### Mail {.row-span-2}\n\n| Shortcut           | Action                                    |\n| ------------------ | ----------------------------------------- |\n| `Ctrl` `Shift` `I` | Switch to Inbox                           |\n| `Ctrl` `Shift` `O` | Switch to Outbox                          |\n| `Ctrl` `K`         | Check names                               |\n| `Alt` `S`          | Send                                      |\n| `Ctrl` `R`         | Reply to a message                        |\n| `Ctrl` `Shift` `R` | Replay All to a message                   |\n| `Ctrl` `Alt` `R`   | Reply with meeting request                |\n| `Ctrl` `F`         | Forward a message                         |\n| `Ctrl` `Alt` `J`   | Mark a message as not junk                |\n| `Ctrl` `Shift` `I` | Display blocked external content          |\n| `Ctrl` `Shift` `S` | Post to a folder                          |\n| `Ctrl` `Shift` `N` | Apply Normal style                        |\n| `Ctrl` `M`         | Check for new messages                    |\n| `Up`               | Go to the previous message                |\n| `Down`             | Go to next message                        |\n| `Ctrl` `N`         | Create a message (in Mail view)           |\n| `Ctrl` `Shift` `M` | Create a message (from any Outlook view)  |\n| `Ctrl` `O`         | Open a received message                   |\n| `Ctrl` `Shift` `D` | Delete and ignore a conversation          |\n| `Ctrl` `Shift` `B` | Open the Address Book                     |\n| `Insert`           | Add a Quick flag to an unopened message   |\n| `Ctrl` `Shift` `G` | Display the Flag for follow up dialog box |\n| `Ctrl` `Q`         | Mark as read                              |\n| `Ctrl` `U`         | Mark as unread                            |\n| `Ctrl` `Shift` `W` | Open the MailTip in the selected message  |\n| `F4`               | Find or replace                           |\n| `Shift` `F4`       | Find next                                 |\n| `Ctrl` `Enter`     | Send                                      |\n| `Ctrl` `P`         | Print                                     |\n| `Ctrl` `F`         | Forward                                   |\n| `Ctrl` `Alt` `F`   | Forward as attachment                     |\n| `Alt` `Enter`      | Show the properties for the selected item |\n| `Ctrl` `Alt` `M`   | Mark for download                         |\n| `Ctrl` `Alt` `U`   | Check Mark for download status            |\n| `Ctrl` `B`         | Display Send/Receive progress             |\n\n{.shortcuts}\n\n### Calendar\n\n| Shortcut           | Action                                               |\n| ------------------ | ---------------------------------------------------- |\n| `Ctrl` `N`         | Create an appointment                                |\n| `Ctrl` `Shift` `A` | Create an appointment (any Outlook view)             |\n| `Ctrl` `Shift` `Q` | Create a meeting request                             |\n| `Alt` `1-0`        | Show 1-10 days in the calendar                       |\n| `Ctrl` `G`         | Go to a date                                         |\n| `Alt` `=`          | Switch to Month view                                 |\n| `Ctrl` `Right`     | Go to the next day                                   |\n| `Alt` `Down`       | Go to the next week                                  |\n| `Alt` `PgDown`     | Go to the next month                                 |\n| `Ctrl` `Left`      | Go to the previous day                               |\n| `Alt` `Up`         | Go to the previous week                              |\n| `Alt` `PgUp`       | Go to the previous month                             |\n| `Alt` `Home`       | Go to the start of the week                          |\n| `Alt` `End`        | Go to the end of the week                            |\n| `Alt` `-`          | Switch to Full Week view                             |\n| `Ctrl` `Alt` `2`   | Switch to Work Week view                             |\n| `Ctrl` `,`         | Go to previous appointment                           |\n| `Ctrl` `.`         | Go to next appointment                               |\n| `Ctrl` `G`         | Set up recurrence for an open appointment or meeting |\n\n{.shortcuts}\n\n### People\n\n| Shortcut            | Action                                                             |\n| ------------------- | ------------------------------------------------------------------ |\n| `Ctrl` `Shift` `D`  | Dial a new call                                                    |\n| `F3`                | Find a contact or other item                                       |\n| `F11`               | Enter a name in the Search Address Books box                       |\n| `Shift` `(letter)`  | In Table or List view of contacts, go to first contact with letter |\n| `Ctrl` `A`          | Select all contacts                                                |\n| `Ctrl` `F`          | Create a message with selected contact as subject                  |\n| `Ctrl` `N`          | Create a contact (when in Contacts)                                |\n| `Ctrl` `Shift` `C`  | Create a contact (any Outlook view)                                |\n| `Ctrl` `O`          | Open a contact form for the selected contact                       |\n| `Ctrl` `Shift` `L`  | Create a contact group                                             |\n| `Ctrl` `P`          | Print                                                              |\n| `F5`                | Update a list of contact group members                             |\n| `Ctrl` `Y`          | Go to a different folder                                           |\n| `Ctrl` `Shift` `B`  | Open the Address Book                                              |\n| `Ctrl` `Shift` `F`  | Use Advanced Find                                                  |\n| `Ctrl` `Shift` `.`  | In an open contact, open the next contact listed                   |\n| `F11`               | Find a contact                                                     |\n| `Esc`               | Close a contact                                                    |\n| `Ctrl` `Shift` `X`  | Send a fax to the selected contact                                 |\n| `Alt` `D`           | Open the Check Address dialog box                                  |\n| `Alt` `Shift` `1-3` | In contact form, display Email 1-3                                 |\n\n{.shortcuts}\n\n### Tasks {.row-span-3}\n\n| Shortcut                 | Action                            |\n| ------------------------ | --------------------------------- |\n| `Ctrl` `C`               | Accept a task request             |\n| `Ctrl` `D`               | Decline a task request            |\n| `Ctrl` `E`               | Find a task or other item         |\n| `Ctrl` `Y`               | Open the Go to Folder dialog box  |\n| `Ctrl` `N`               | Create a task when in Tasks view  |\n| `Ctrl` `Shift` `K`       | Create a task (any Outlook view)  |\n| `Ctrl` `O`               | Open selected item                |\n| `Ctrl` `P`               | Print selected item               |\n| `Ctrl` `A`               | Select all items                  |\n| `Ctrl` `D`               | Delete selected item              |\n| `Ctrl` `F`               | Forward a task as an attachment   |\n| `Ctrl` `Shift` `Alt` `U` | Create a task request             |\n| `Tab`                    | Switch between Folder/Tasks/To-Do |\n| `Ctrl` `Z`               | Undo last action                  |\n| `Insert`                 | Flag an item or mark complete     |\n\n{.shortcuts}\n\n### Format text {.row-span-4}\n\n| Shortcut           | Action                           |\n| ------------------ | -------------------------------- |\n| `Alt` `O`          | Display the Format menu          |\n| `Ctrl` `Shift` `P` | Display the Font dialog box      |\n| `Shift` `F3`       | Switch case (with text selected) |\n| `Ctrl` `Shift` `K` | Format letters as small capitals |\n| `Ctrl` `B`         | Make letters bold                |\n| `Ctrl` `Shift` `L` | Add bullets                      |\n| `Ctrl` `I`         | Make letters italic              |\n| `Ctrl` `T`         | Increase indent                  |\n| `Ctrl` `Shift` `T` | Decrease indent                  |\n| `Ctrl` `L`         | Left align                       |\n| `Ctrl` `E`         | Center                           |\n| `Ctrl` `U`         | Underline                        |\n| `Ctrl` `]`         | Increase font size               |\n| `Ctrl` `[`         | Decrease font size               |\n| `Ctrl` `X`         | Cut                              |\n| `Ctrl` `C`         | Copy                             |\n| `Ctrl` `V`         | Paste                            |\n| `Ctrl` `Shift` `Z` | Clear formatting                 |\n| `Ctrl` `Shift` `H` | Delete the next word             |\n| `Ctrl` `Shift` `J` | Justify text                     |\n| `Ctrl` `Shift` `S` | Apply styles                     |\n| `Ctrl` `T`         | Create a hanging indent          |\n| `Ctrl` `K`         | Insert a hyperlink               |\n| `Ctrl` `L`         | Left align a paragraph           |\n| `Ctrl` `R`         | Right align a paragraph          |\n| `Ctrl` `Shift` `T` | Reduce a hanging indent          |\n| `Ctrl` `Q`         | Remove paragraph formatting      |\n\n{.shortcuts}\n\n### Add web information to items\n\n| Shortcut   | Action                                            |\n| ---------- | ------------------------------------------------- |\n| `Ctrl` `K` | Insert or edit a hyperlink in the body of an item |\n\n{.shortcuts}\n\n### Printing\n\n| Shortcut        | Action                                         |\n| --------------- | ---------------------------------------------- |\n| `Alt` `F, P`    | Open the Print tab in Backstage view           |\n| `Alt` `F, P, F` | Print an item from an open window              |\n| `Alt` `S`       | Open the Page Setup dialog box from Print view |\n| `Alt` `F, P, I` | Select a printer from Print view               |\n| `Alt` `F, P, R` | Open the Print Options dialog box              |\n\n{.shortcuts}\n\n### Send/Receive\n\n| Shortcut         | Action                                      |\n| ---------------- | ------------------------------------------- |\n| `F9`             | Start a send/receive for all defined groups |\n| `Shift` `F9`     | Start a send/receive for the current folder |\n| `Ctrl` `M`       | Start a send/receive                        |\n| `Ctrl` `Alt` `S` | Define Send/Receive groups                  |\n\n{.shortcuts}\n\n### Visual Basic Editor\n\n| Shortcut    | Action                   |\n| ----------- | ------------------------ |\n| `Alt` `F11` | Open Visual Basic Editor |\n\n{.shortcuts}\n\n### Macros\n\n| Shortcut   | Action     |\n| ---------- | ---------- |\n| `Alt` `F8` | Play macro |\n\n{.shortcuts}\n\n### Forms\n\n| Shortcut                 | Action                  |\n| ------------------------ | ----------------------- |\n| `Ctrl` `N`               | Create an InfoPath form |\n| `Ctrl` `Shift` `Alt` `T` | Close an InfoPath form  |\n\n{.shortcuts}\n\n### Flags\n\n| Shortcut           | Action                                 |\n| ------------------ | -------------------------------------- |\n| `Ctrl` `Shift` `G` | Open the Flag for Follow Up dialog box |\n\n{.shortcuts}\n\n### Color categories\n\n| Shortcut  | Action                                                                 |\n| --------- | ---------------------------------------------------------------------- |\n| `Alt` `D` | Delete the selected category from the list in the Color categories box |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Microsoft Outlook](https://support.office.com/en-us/article/keyboard-shortcuts-for-outlook-3cdeb221-7ae5-4c1d-8c1d-9e63216c1efd)\n  _(support.office.com)_\n"
  },
  {
    "path": "source/_posts/pandas.md",
    "content": "---\ntitle: Pandas\ndate: 2024-07-04\nbackground: bg-[#110750]\ntags:\n  - data analysis\n  - data manipulation\ncategories:\n  - Python\nintro: |\n  [Pandas](https://pandas.pydata.org/) is a powerful data analysis and manipulation library for Python. This cheat sheet is a quick reference for Pandas beginners.\nplugins:\n  - copyCode\n---\n\n## Getting Started {.cols-2}\n\n### Introduction\n\nYou’ll need to import pandas to get started:\n\n```python\nimport pandas as pd\n```\n\n### Creating DataFrames\n\n| -                                                         | -                           |\n| --------------------------------------------------------- | --------------------------- |\n| `pd.DataFrame(data={'col1': [1, 2], 'col2': [3, 4]})`     | From a dictionary           |\n| `pd.DataFrame(data=[{'a': 1, 'b': 2}, {'a': 3, 'b': 4}])` | From a list of dictionaries |\n| `pd.read_csv('file.csv')`                                 | From a CSV file             |\n| `pd.read_excel('file.xlsx')`                              | From an Excel file          |\n\n### Inspecting Data {.row-span-2}\n\n| -               | -                          |\n| --------------- | -------------------------- |\n| `df.head()`     | First 5 rows               |\n| `df.tail()`     | Last 5 rows                |\n| `df.shape`      | Number of rows and columns |\n| `df.info()`     | Info on DataFrame          |\n| `df.describe()` | Summary statistics         |\n| `df.columns`    | Column names               |\n| `df.index`      | Index                      |\n| `df.dtypes`     | Data types of columns      |\n\n### Selecting Data\n\n| -                      | -                              |\n| ---------------------- | ------------------------------ |\n| `df['col1']`           | Select column                  |\n| `df[['col1', 'col2']]` | Select multiple columns        |\n| `df.loc[0]`            | Select row by index            |\n| `df.loc[:, 'col1']`    | Select all rows for 'col1'     |\n| `df.iloc[0]`           | Select row by position         |\n| `df.iloc[0, 1]`        | Select specific value          |\n| `df[df['col1'] > 2]`   | Select rows based on condition |\n\n### Data Cleaning\n\n| -                                             | -                                    |\n| --------------------------------------------- | ------------------------------------ |\n| `df.dropna()`                                 | Drop rows with any missing values    |\n| `df.dropna(axis=1)`                           | Drop columns with any missing values |\n| `df.fillna(0)`                                | Replace missing values with 0        |\n| `df.drop_duplicates()`                        | Drop duplicate rows                  |\n| `df.rename(columns={'old_name': 'new_name'})` | Rename columns                       |\n| `df.astype('int')`                            | Change data type                     |\n\n### Adding/Removing Data {.row-span-2}\n\n| -                                      | -                               |\n| -------------------------------------- | ------------------------------- |\n| `df['col3'] = df['col1'] + df['col2']` | Add new column                  |\n| `df.drop('col1', axis=1)`              | Drop column                     |\n| `df.append(new_row)`                   | Add new row                     |\n| `df.insert(2, 'new_col', new_data)`    | Insert new column at position 2 |\n\n### Combining Data\n\n| -                                                     | -                       |\n| ----------------------------------------------------- | ----------------------- |\n| `pd.concat([df1, df2])`                               | Concatenate rows        |\n| `pd.concat([df1, df2], axis=1)`                       | Concatenate columns     |\n| `pd.merge(df1, df2, on='key')`                        | Merge DataFrames on key |\n| `pd.merge(df1, df2, left_on='key1', right_on='key2')` | Merge on different keys |\n| `df1.join(df2, lsuffix='_left', rsuffix='_right')`    | Join DataFrames         |\n\n### Aggregating Data\n\n| -                                      | -                         |\n| -------------------------------------- | ------------------------- |\n| `df['col1'].sum()`                     | Sum of values in column   |\n| `df['col1'].mean()`                    | Mean of values in column  |\n| `df['col1'].count()`                   | Count of values in column |\n| `df['col1'].min()`                     | Minimum value in column   |\n| `df['col1'].max()`                     | Maximum value in column   |\n| `df['col1'].std()`                     | Standard deviation        |\n| `df['col1'].var()`                     | Variance                  |\n| `df.groupby('col1').sum()`             | Group by and sum          |\n| `df.groupby('col1').mean()`            | Group by and mean         |\n| `df.groupby(['col1', 'col2']).count()` | Group by multiple columns |\n\n### Applying Functions {.row-span-2}\n\n| -                                    | -                                    |\n| ------------------------------------ | ------------------------------------ |\n| `df.apply(np.sqrt)`                  | Apply function to all values         |\n| `df['col1'].apply(lambda x: x ** 2)` | Apply function to column             |\n| `df.applymap(str)`                   | Apply function to DataFrame elements |\n| `df['col1'].map({'a': 1, 'b': 2})`   | Map values                           |\n| `df['col1'].replace('a', 1)`         | Replace values                       |\n\n### Handling Dates\n\n| -                                         | -                   |\n| ----------------------------------------- | ------------------- |\n| `df['date'] = pd.to_datetime(df['date'])` | Convert to datetime |\n| `df['year'] = df['date'].dt.year`         | Extract year        |\n| `df['month'] = df['date'].dt.month`       | Extract month       |\n| `df['day'] = df['date'].dt.day`           | Extract day         |\n| `df.set_index('date', inplace=True)`      | Set date as index   |\n\n### Input/Output\n\n| -                                              | -                                    |\n| ---------------------------------------------- | ------------------------------------ |\n| `df.to_csv('file.csv')`                        | Save DataFrame to CSV                |\n| `df = pd.read_csv('file.csv')`                 | Load DataFrame from CSV              |\n| `df.to_excel('file.xlsx')`                     | Save DataFrame to Excel              |\n| `df = pd.read_excel('file.xlsx')`              | Load DataFrame from Excel            |\n| `from sqlalchemy import create_engine`         | Import SQLAlchemy for SQL operations |\n| `engine = create_engine('sqlite:///:memory:')` | Create SQL engine                    |\n| `df.to_sql('table_name', engine)`              | Save to SQL table                    |\n| `df = pd.read_sql('table_name', engine)`       | Load from SQL table                  |\n"
  },
  {
    "path": "source/_posts/pandoc.md",
    "content": "---\ntitle: Pandoc\ndate: 2023-03-21 13:26:00\nbackground: bg-red-400\ntags:\n  - convert\n  - document\n  - utility\ncategories:\n  - Linux Command\nintro: |\n  [Pandoc](https://pandoc.org) is a document converter, this pandoc cheat sheet contains pandoc commands and some common pandoc tricks.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Pandoc Usage\n\nSyntax\n\n```shell script\n$ pandoc -s [source file] -o [output file]\n```\n\n## Pandoc examples\n\n### LaTeX to MS Word {.col-span-2}\n\nSimple .tex to .docx\n\n```shell script\n$ pandoc -s file.tex -o file.docx\n```\n\n.tex to .docx with default citations\n\n```shell script\n$ pandoc -s file.tex --citeproc --bibliography=bib_library.bib -o file.docx\n```\n\n.tex to .docx with specific citations\n\n```shell script\n$ pandoc -s file.tex --citeproc --bibliography=bib_library.bib --csl=apa.csl -o file.docx\n```\n\nGet `.csl` file from [here](https://github.com/citation-style-language/styles)\n\n.tex to .docx with cross references\n\n```shell script\n$ pandoc -s file.tex --filter pandoc-crossref -o file.docx\n```\n\nGet the filter `pandoc-crossref` from [here](https://github.com/lierdakil/pandoc-crossref/releases)\n\n## Also see {.cols-1}\n\n- [pandoc examples](https://pandoc.org/demos.html)\n"
  },
  {
    "path": "source/_posts/perl.md",
    "content": "---\ntitle: Perl\ndate: 2024-05-22 9:03:44\nbackground: bg-[#31719d]\ntags:\ncategories:\n  - Programming\nintro: |\n  The perl quick reference cheat sheet that aims at providing help on writing basic syntax and methods.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### Unix and Linux Installation\n\n- Open a Web browser and go to https://www.perl.org/get.html.\n\n- Follow the link to download zipped source code available for Unix/Linux.\n\n- Download perl-5.x.y.tar.gz file and issue the following commands at $ prompt.\n\n```shell\n$tar -xzf perl-5.x.y.tar.gz\n$cd perl-5.x.y\n$./Configure -de\n$make\n$make test\n$make install\n```\n\n### Windows Installation\n\n- Follow the link for the Strawberry Perl installation on Windows http://strawberryperl.com\n\n- Download either 32bit or 64bit version of installation.\n\n- Run the downloaded file by double-clicking it in Windows Explorer. This brings up the Perl install wizard, which is\n  really easy to use. Just accept the default settings, wait until the installation is finished, and you're ready to\n  roll!\n\n### Macintosh Installation\n\n- Open a Web browser and go to https://www.perl.org/get.html.\n\n- Follow the link to download zipped source code available for Mac OS X.\n\n- Download perl-5.x.y.tar.gz file and issue the following commands at $ prompt\n\n```shell\n$tar -xzf perl-5.x.y.tar.gz\n$cd perl-5.x.y\n$./Configure -de\n$make\n$make test\n$make install\n```\n\n### Running Perl\n\n```shell\n# Unix/Linux\n$perl  -e <perl code>\n# Windows/DOS\nC:>perl -e <perl code>\n```\n\n### Available command line options\n\n|    Option     |                         Description |\n| :-----------: | ----------------------------------: |\n| -d[:debugger] |         Runs program under debugger |\n|  -Idirectory  |   Specifies @INC/#include directory |\n|      -T       |           Enables tainting warnings |\n|      -U       |            Allows unsafe operations |\n|      -w       |        Enables many useful warnings |\n|      -W       |                Enables all warnings |\n|      -X       |               Disables all warnings |\n|  -e program   | Runs Perl script sent in as program |\n|     file      |  Runs Perl script from a given file |\n\n### Script from the Command-line\n\n```shell\n# Unix/Linux\n$perl  script.pl\n# Windows/DOS\nC:>perl script.pl\n```\n\n### First Perl Program\n\n```shell\n$perl -e 'print \"Hello World\\n\"'\n\n# #!/usr/bin/perl\n\n# This will print \"Hello, World\"\nprint \"Hello, world\\n\";\n$chmod 0755 hello.pl\n$./hello.pl\n\n```\n\n### Comments in Perl\n\n```perl\n# This is a comment in perl\n=begin comment\nThis is all part of multiline comment.\nYou can use as many lines as you like\nThese comments will be ignored by the\ncompiler until the next =cut is encountered.\n=cut\n\n```\n\n### Whitespaces in Perl\n\n```perl\n#!/usr/bin/perl\n\n# This would print with a line break in the middle\nprint \"Hello\n          world\\n\";\n#output\n#Hello\n#         world\n\n```\n\n### Single and Double Quotes in Perl\n\n```perl\n#!/usr/bin/perl\n\nprint \"Hello, world\\n\";\nprint 'Hello, world\\n';\n\n#Hello, world\n#Hello, world\\n$\n```\n\n## Datatypes\n\n### Creating Variables\n\n```perl\n$age = 25;             # An integer assignment\n$name = \"John Paul\";   # A string\n$salary = 1445.50;     # A floating point\n```\n\n### Scalar Variables\n\n```perl\n#!/usr/bin/perl\n\n$age = 25;             # An integer assignment\n$name = \"John Paul\";   # A string\n$salary = 1445.50;     # A floating point\n\nprint \"Age = $age\\n\";\nprint \"Name = $name\\n\";\nprint \"Salary = $salary\\n\";\n```\n\n### Array Variables\n\n```perl\n#!/usr/bin/perl\n\n@ages = (25, 30, 40);\n@names = (\"John Paul\", \"Lisa\", \"Kumar\");\n\nprint \"\\$ages[0] = $ages[0]\\n\";\nprint \"\\$ages[1] = $ages[1]\\n\";\nprint \"\\$ages[2] = $ages[2]\\n\";\nprint \"\\$names[0] = $names[0]\\n\";\nprint \"\\$names[1] = $names[1]\\n\";\nprint \"\\$names[2] = $names[2]\\n\";\n```\n\n### Hash Variables\n\n```perl\n#!/usr/bin/perl\n\n%data = ('John Paul', 45, 'Lisa', 30, 'Kumar', 40);\n\nprint \"\\$data{'John Paul'} = $data{'John Paul'}\\n\";\nprint \"\\$data{'Lisa'} = $data{'Lisa'}\\n\";\nprint \"\\$data{'Kumar'} = $data{'Kumar'}\\n\";\n```\n\n### Variable Context\n\n```perl\n#!/usr/bin/perl\n\n@names = ('John Paul', 'Lisa', 'Kumar');\n\n@copy = @names;\n$size = @names;\n\nprint \"Given names are : @copy\\n\";\nprint \"Number of names are : $size\\n\";\n```\n\n### Numeric Scalars\n\n```perl\n#!/usr/bin/perl\n\n$integer = 200;\n$negative = -300;\n$floating = 200.340;\n$bigfloat = -1.2E-23;\n\n# 377 octal, same as 255 decimal\n$octal = 0377;\n\n# FF hex, also 255 decimal\n$hexa = 0xff;\n\nprint \"integer = $integer\\n\";\nprint \"negative = $negative\\n\";\nprint \"floating = $floating\\n\";\nprint \"bigfloat = $bigfloat\\n\";\nprint \"octal = $octal\\n\";\nprint \"hexa = $hexa\\n\";\n```\n\n### String Scalars\n\n```perl\n#!/usr/bin/perl\n\n$var = \"This is string scalar!\";\n$quote = 'I m inside single quote - $var';\n$double = \"This is inside single quote - $var\";\n\n$escape = \"This example of escape -\\tHello, World!\";\n\nprint \"var = $var\\n\";\nprint \"quote = $quote\\n\";\nprint \"double = $double\\n\";\nprint \"escape = $escape\\n\";\n```\n\n### Scalar Operations\n\n```perl\n#!/usr/bin/perl\n\n$str = \"hello\" . \"world\";       # Concatenates strings.\n$num = 5 + 10;                  # adds two numbers.\n$mul = 4 * 5;                   # multiplies two numbers.\n$mix = $str . $num;             # concatenates string and number.\n\nprint \"str = $str\\n\";\nprint \"num = $num\\n\";\nprint \"mul = $mul\\n\";\nprint \"mix = $mix\\n\";\n```\n\n### Multiline Strings\n\n```perl\n#!/usr/bin/perl\n\n$string = 'This is\na multiline\nstring';\n\nprint \"$string\\n\";\n\n##########################\nprint <<EOF;\nThis is\na multiline\nstring\nEOF\n```\n\n### V-Strings\n\n```perl\n#!/usr/bin/perl\n\n$smile  = v9786;\n$foo    = v102.111.111;\n$martin = v77.97.114.116.105.110;\n\nprint \"smile = $smile\\n\";\nprint \"foo = $foo\\n\";\nprint \"martin = $martin\\n\";\n```\n\n### Special Literals\n\n```perl\n#!/usr/bin/perl\n\nprint \"File name \". __FILE__ . \"\\n\";\nprint \"Line Number \" . __LINE__ .\"\\n\";\nprint \"Package \" . __PACKAGE__ .\"\\n\";\n\n# they can not be interpolated\nprint \"__FILE__ __LINE__ __PACKAGE__\\n\";\n```\n\n### Sequential Number Arrays\n\n```perl\n#!/usr/bin/perl\n\n@var_10 = (1..10);\n@var_20 = (10..20);\n@var_abc = (a..z);\n\nprint \"@var_10\\n\";   # Prints number from 1 to 10\nprint \"@var_20\\n\";   # Prints number from 10 to 20\nprint \"@var_abc\\n\";  # Prints number from a to z\n```\n\n### Array Size\n\n```perl\n#!/usr/bin/perl\n\n@array = (1,2,3);\n$array[50] = 4;\n\n$size = @array;\n$max_index = $#array;\n\nprint \"Size:  $size\\n\";\nprint \"Max Index: $max_index\\n\";\n```\n\n## Array oparationns\n\n### Adding and Removing Elements in Array\n\n| types                |                                                  Description                                                  |\n| :------------------- | :-----------------------------------------------------------------------------------------------------------: |\n| push @ARRAY, LIST    |                           Pushes the values of the list onto the end of the array.                            |\n| pop @ARRAY           |                               Pops off and returns the last value of the array.                               |\n| shift @ARRAY         | Shifts the first value of the array off and returns it, shortening the array by 1 and moving everything down. |\n| unshift @ARRAY, LIST |         Prepends list to the front of the array, and returns the number of elements in the new array.         |\n\n### Array oparations\n\n```perl\n#!/usr/bin/perl\n\n# create a simple array\n\n@coins = (\"Quarter\",\"Dime\",\"Nickel\");\nprint \"1. \\@coins = @coins\\n\";\n\n# add one element at the end of the array\n\npush(@coins, \"Penny\");\nprint \"2. \\@coins = @coins\\n\";\n\n# add one element at the beginning of the array\n\nunshift(@coins, \"Dollar\");\nprint \"3. \\@coins = @coins\\n\";\n\n# remove one element from the last of the array.\n\npop(@coins);\nprint \"4. \\@coins = @coins\\n\";\n\n# remove one element from the beginning of the array.\n\nshift(@coins);\nprint \"5. \\@coins = @coins\\n\";\n\n```\n\n### Slicing Array Elements\n\n```perl\n#!/usr/bin/perl\n\n@days = qw/Mon Tue Wed Thu Fri Sat Sun/;\n\n@weekdays = @days[3,4,5];\n\nprint \"@weekdays\\n\";\n```\n\n### Replacing Array Elements\n\n```perl\n#!/usr/bin/perl\n\n@nums = (1..20);\nprint \"Before - @nums\\n\";\n\nsplice(@nums, 5, 5, 21..25);\nprint \"After - @nums\\n\";\n```\n\n### Transform Strings to Arrays\n\n```perl\n#!/usr/bin/perl\n\n# define Strings\n\n$var_string = \"Rain-Drops-On-Roses-And-Whiskers-On-Kittens\";\n$var_names = \"Larry,David,Roger,Ken,Michael,Tom\";\n\n# transform above strings into arrays.\n\n@string = split('-', $var_string);\n@names = split(',', $var_names);\n\nprint \"$string[3]\\n\";  # This will print Roses\nprint \"$names[4]\\n\"; # This will print Michael\n```\n\n### Transform Arrays to Strings\n\n```perl\n#!/usr/bin/perl\n\n# define Strings\n$var_string = \"Rain-Drops-On-Roses-And-Whiskers-On-Kittens\";\n$var_names = \"Larry,David,Roger,Ken,Michael,Tom\";\n\n# transform above strings into arrays.\n@string = split('-', $var_string);\n@names  = split(',', $var_names);\n\n$string1 = join( '-', @string );\n$string2 = join( ',', @names );\n\nprint \"$string1\\n\";\nprint \"$string2\\n\";\n```\n\n### Sorting Arrays\n\n```perl\n#!/usr/bin/perl\n\n# define an array\n@foods = qw(pizza steak chicken burgers);\nprint \"Before: @foods\\n\";\n\n# sort this array\n@foods = sort(@foods);\nprint \"After: @foods\\n\";\n```\n\n### The $[ Special Variable\n\n```perl\n#!/usr/bin/perl\n\n# define an array\n@foods = qw(pizza steak chicken burgers);\nprint \"Foods: @foods\\n\";\n\n# Let's reset first index of all the arrays.\n$[ = 1;\n\nprint \"Food at \\@foods[1]: $foods[1]\\n\";\nprint \"Food at \\@foods[2]: $foods[2]\\n\";\n```\n\n### Merging Arrays\n\n```perl\n#!/usr/bin/perl\n\n@odd = (1,3,5);\n@even = (2, 4, 6);\n\n@numbers = (@odd, @even);\n\nprint \"numbers = @numbers\\n\";\n```\n\n### Selecting Elements from Lists\n\n```perl\n#!/usr/bin/perl\n\n@list = (5,4,3,2,1)[1..3];\n\nprint \"Value of list = @list\\n\";\n```\n\n### Accessing Hash Elements\n\n```perl\n#!/usr/bin/perl\n\n%data = ('John Paul' => 45, 'Lisa' => 30, 'Kumar' => 40);\n\nprint \"$data{'John Paul'}\\n\";\nprint \"$data{'Lisa'}\\n\";\nprint \"$data{'Kumar'}\\n\";\n```\n\n### Extracting Slices\n\n```perl\n#!/uer/bin/perl\n\n\n%data = (-JohnPaul => 45, -Lisa => 30, -Kumar => 40);\n\n@array = @data{-JohnPaul, -Lisa};\n\nprint \"Array : @array\\n\";\n```\n\n### Extracting Keys and Values\n\n```perl\n#!/usr/bin/perl\n\n%data = ('John Paul' => 45, 'Lisa' => 30, 'Kumar' => 40);\n\n@names = keys %data;\n\nprint \"$names[0]\\n\";\nprint \"$names[1]\\n\";\nprint \"$names[2]\\n\";\n```\n\n### Getting Hash Size\n\n```perl\n#!/usr/bin/perl\n\n%data = ('John Paul' => 45, 'Lisa' => 30, 'Kumar' => 40);\n\n@keys = keys %data;\n$size = @keys;\nprint \"1 - Hash size:  is $size\\n\";\n\n@values = values %data;\n$size = @values;\nprint \"2 - Hash size:  is $size\\n\";\n```\n\n### Add and Remove Elements in Hashes\n\n```perl\n#!/usr/bin/perl\n\n%data = ('John Paul' => 45, 'Lisa' => 30, 'Kumar' => 40);\n@keys = keys %data;\n$size = @keys;\nprint \"1 - Hash size:  is $size\\n\";\n\n# adding an element to the hash;\n$data{'Ali'} = 55;\n@keys = keys %data;\n$size = @keys;\nprint \"2 - Hash size:  is $size\\n\";\n\n# delete the same element from the hash;\ndelete $data{'Ali'};\n@keys = keys %data;\n$size = @keys;\nprint \"3 - Hash size:  is $size\\n\";\n```\n\n## Control Flow\n\n### if-else\n\n```perl\n#!/usr/bin/perl\n\n# Perl program to illustrate\n# Decision-Making statements\n\n$a = 10;\n$b = 15;\n\n# if condition to check\n# for even number\nif($a % 2 == 0 )\n{\n\tprintf \"Even Number\";\n}\n\n# if-else condition to check\n# for even number or odd number\nif($b % 2 == 0 )\n{\n\tprintf \"\\nEven Number\";\n}\nelse\n{\n\tprintf \"\\nOdd Number\";\n}\n```\n\n### The ? : Operator\n\n```perl\n#!/usr/local/bin/perl\n\n$name = \"Ali\";\n$age = 10;\n\n$status = ($age > 60 )? \"A senior citizen\" : \"Not a senior citizen\";\n\nprint \"$name is  - $status\\n\";\n```\n\n### for loop\n\n```perl\n#!/usr/bin/perl\n\n# Perl program to illustrate\n# the use of for Loop\n\n# for loop\nprint(\"For Loop:\\n\");\nfor ($count = 1 ; $count <= 3 ; $count++)\n{\n\tprint \"GeeksForGeeks\\n\"\n}\n```\n\n### foreach loop\n\n```perl\n#!/usr/bin/perl\n\n# Perl program to illustrate\n# the use of foreach Loop\n\n# Array\n@data = ('GEEKS', 4, 'GEEKS');\n\n# foreach loop\nprint(\"For-each Loop:\\n\");\nforeach $word (@data)\n{\n\tprint (\"$word \");\n}\n\n```\n\n### while and do-while\n\n```perl\n#!/usr/bin/perl\n\n# Perl program to illustrate\n# the use of foreach Loop\n\n# while loop\n$count = 3;\n\nprint(\"While Loop:\\n\");\nwhile ($count >= 0)\n{\n\t$count = $count - 1;\n\tprint \"GeeksForGeeks\\n\";\n}\n\nprint(\"\\ndo...while Loop:\\n\");\n$a = 10;\n\n# do..While loop\ndo {\n\n\tprint \"$a \";\n\t$a = $a - 1;\n} while ($a > 0);\n\n```\n\n## Object Oriented Programming\n\n### Class and object\n\n```perl\n#!/usr/bin/perl\n\n# Perl Program for creation of a\n# Class and its object\nuse strict;\nuse warnings;\n\npackage student;\n\n# constructor\nsub student_data\n{\n\n\t# shift will take package name 'student'\n\t# and assign it to variable 'class'\n\tmy $class_name = shift;\n\tmy $self = {\n\t\t\t\t'StudentFirstName' => shift,\n\t\t\t\t'StudentLastName' => shift\n\t\t\t};\n\t# Using bless function\n\tbless $self, $class_name;\n\n\t# returning object from constructor\n\treturn $self;\n}\n\n# Object creating and constructor calling\nmy $Data = student_data student(\"Geeks\", \"forGeeks\");\n\n# Printing the data\nprint \"$Data->{'StudentFirstName'}\\n\";\nprint \"$Data->{'StudentLastName'}\\n\";\n\n```\n\n### Subroutines\n\n```perl\n#!/usr/bin/perl\n\n# Perl Program to demonstrate the\n# subroutine declaration and calling\n\n# defining subroutine\nsub ask_user\n{\n\tprint \"Hello Geeks!\\n\";\n}\n\n# calling subroutine\n# you can also use\n# &ask_user();\nask_user();\n```\n\n### Modules and Packages\n\n```perl\n#!/usr/bin/perl\n\n# Using the Package 'Calculator'\nuse Calculator;\n\nprint \"Enter two numbers to multiply\";\n\n# Defining values to the variables\n$a = 5;\n$b = 10;\n\n# Subroutine call\nCalculator::multiplication($a, $b);\n\nprint \"\\nEnter two numbers to divide\";\n\n# Defining values to the variables\n$a = 45;\n$b = 5;\n\n# Subroutine call\nCalculator::division($a, $b);\n```\n\n### References\n\n```perl\n# Perl program to illustrate the\n# Referencing and Dereferencing\n# of an Array\n\n# defining an array\n@array = ('1', '2', '3');\n\n# making an reference to an array variable\n$reference_array = \\@array;\n\n# Dereferencing\n# printing the value stored\n# at $reference_array by prefixing\n# @ as it is a array reference\nprint @$reference_array;\n```\n\n### Regular Expression\n\n```perl\n# Perl program to demonstrate\n# the m// and =~ operators\n\n# Actual String\n$a = \"GEEKSFORGEEKS\";\n\n# Prints match found if\n# its found in $a\nif ($a =~ m[GEEKS])\n{\n\tprint \"Match Found\\n\";\n}\n\n# Prints match not found\n# if its not found in $a\nelse\n{\n\tprint \"Match Not Found\\n\";\n}\n```\n\n### File Handling\n\n```perl\n# Opening the file\nopen(fh, \"GFG2.txt\") or die \"File '$filename' can't be opened\";\n\n# Reading First line from the file\n$firstline = <fh>;\nprint \"$firstline\\n\";\n```\n\n### File Test Operators\n\n```perl\n#!/usr/bin/perl\n\n# Using predefined modules\nuse warnings;\nuse strict;\n\n# Providing path of file to a variable\nmy $filename = 'C:\\Users\\GeeksForGeeks\\GFG.txt';\n\n# Checking for the file existence\nif(-e $filename)\n{\n\n\t# If File exists\n\tprint(\"File $filename exists\\n\");\n}\n\nelse\n{\n\n\t# If File doesn't exists\n\tprint(\"File $filename does not exists\\n\");\n}\n```\n\n### Working with Excel Files\n\n```perl\n#!/usr/bin/perl\nuse Excel::Writer::XLSX;\n\nmy $Excelbook = Excel::Writer::XLSX->new( 'GFG_Sample.xlsx' );\nmy $Excelsheet = $Excelbook->add_worksheet();\n\n$Excelsheet->write( \"A1\", \"Hello!\" );\n$Excelsheet->write( \"A2\", \"GeeksForGeeks\" );\n$Excelsheet->write( \"B1\", \"Next_Column\" );\n\n$Excelbook->close;\n```\n\n### Reading from an Excel File:\n\n```perl\nuse 5.016;\nuse Spreadsheet::Read qw(ReadData);\nmy $book_data = ReadData (‘new_excel.xlsx');\nsay 'A2: ' . $book_data->[1]{A2};\n\n```\n\n### Error Handling\n\n```perl\nif(open(DATA, $file)) {\n   ...\n} else {\n   die \"Error: Couldn't open the file - $!\"\n}\n#example\nopen(DATA, $file) || die \"Error: Couldn't open the file $!\";\n## example\nunless(chdir(\"/etc\")) {\n   die \"Error: Can't change directory - $!\";\n}\n##example\nprint(exists($hash{value}) ? 'There' : 'Missing',\"\\n\");\n\n```\n\n### The warn Function\n\n```perl\nchdir('/etc') or warn \"Can't change directory\";\n\n\n```\n\n### The die function\n\n```perl\nchdir('/etc') or die \"Can't change directory\";\n\n```\n\n### Errors within Modules\n\n```perl\npackage T;\n\nrequire Exporter;\n@ISA = qw/Exporter/;\n@EXPORT = qw/function/;\nuse Carp;\n\nsub function {\n   warn \"Error in module!\";\n}\n1;\n#use T;\n#function();\n# all below code call the funtion\n\n```\n\n### The carp Function\n\n```perl\npackage T;\n\nrequire Exporter;\n@ISA = qw/Exporter/;\n@EXPORT = qw/function/;\nuse Carp;\n\nsub function {\n   carp \"Error in module!\";\n}\n1;\n\n```\n\n### The cluck Function\n\n```perl\npackage T;\n\nrequire Exporter;\n@ISA = qw/Exporter/;\n@EXPORT = qw/function/;\nuse Carp qw(cluck);\n\nsub function {\n   cluck \"Error in module!\";\n}\n1;\n\n```\n\n### The croak Function\n\n```perl\npackage T;\n\nrequire Exporter;\n@ISA = qw/Exporter/;\n@EXPORT = qw/function/;\nuse Carp;\n\nsub function {\n   croak \"Error in module!\";\n}\n1;\n\n```\n\n### The confess Function\n\n```perl\npackage T;\n\nrequire Exporter;\n@ISA = qw/Exporter/;\n@EXPORT = qw/function/;\nuse Carp;\n\nsub function {\n   confess \"Error in module!\";\n}\n1;\n```\n\n## Date and Time\n\n### Current Date and Time\n\n```perl\n#!/usr/local/bin/perl\n\n@months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );\n@days = qw(Sun Mon Tue Wed Thu Fri Sat Sun);\n\n($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();\nprint \"$mday $months[$mon] $days[$wday]\\n\";\n#or\n#!/usr/local/bin/perl\n\n$datestring = localtime();\nprint \"Local date and time $datestring\\n\";\n```\n\n### GMT Time\n\n```perl\n#!/usr/local/bin/perl\n\n$datestring = gmtime();\nprint \"GMT date and time $datestring\\n\";\n```\n\n### Format Date and Time\n\n```perl\n#!/usr/local/bin/perl\n\n($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();\n\nprintf(\"Time Format - HH:MM:SS\\n\");\nprintf(\"%02d:%02d:%02d\", $hour, $min, $sec);\n```\n\n### Epoch time\n\n```perl\n#!/usr/local/bin/perl\n\n$epoc = time();\n\nprint \"Number of seconds since Jan 1, 1970 - $epoc\\n\";\n#or\n#!/usr/local/bin/perl\n\n$datestring = localtime();\nprint \"Current date and time $datestring\\n\";\n\n$epoc = time();\n$epoc = $epoc - 24 * 60 * 60;   # one day before of current date.\n\n$datestring = localtime($epoc);\nprint \"Yesterday's date and time $datestring\\n\";\n```\n\n### POSIX Function strftime()\n\n| Specifier | Replaced by                                                                                                    |         Example          |\n| :-------- | :------------------------------------------------------------------------------------------------------------- | :----------------------: |\n| %a        | Abbreviated weekday name                                                                                       |           Thu            |\n| %A        | Full weekday name                                                                                              |         Thursday         |\n| %b        | Abbreviated month name                                                                                         |           Aug            |\n| %B        | Full month name                                                                                                |          August          |\n| %c        | Date and time representation                                                                                   | Thu Aug 23 14:55:02 2001 |\n| %C        | Year divided by 100 and truncated to integer (00-99)                                                           |            20            |\n| %d        | Day of the month, zero-padded (01-31)                                                                          |            23            |\n| %D        | Short MM/DD/YY date, equivalent to %m/%d/%y                                                                    |         08/23/01         |\n| %e        | Day of the month, space-padded ( 1-31)                                                                         |            23            |\n| %F        | Short YYYY-MM-DD date, equivalent to %Y-%m-%d                                                                  |        2001-08-23        |\n| %g        | Week-based year, last two digits (00-99)                                                                       |            01            |\n| %G        | Week-based year                                                                                                |           2001           |\n| %h        | Abbreviated month name (same as %b)                                                                            |           Aug            |\n| %H        | Hour in 24h format (00-23)                                                                                     |            14            |\n| %I        | Hour in 12h format (01-12)                                                                                     |            02            |\n| %j        | Day of the year (001-366)                                                                                      |           235            |\n| %m        | Month as a decimal number (01-12)                                                                              |            08            |\n| %M        | Minute (00-59)                                                                                                 |            55            |\n| %n        | New-line character ('\\n')                                                                                      |\n| %p        | AM or PM designation                                                                                           |            PM            |\n| %r        | 12-hour clock time                                                                                             |       02:55:02 pm        |\n| %R        | 24-hour HH:MM time, equivalent to %H:%M                                                                        |          14:55           |\n| %S        | Second (00-61)                                                                                                 |            02            |\n| %t        | Horizontal-tab character ('\\t')                                                                                |\n| %T        | ISO 8601 time format (HH:MM:SS), equivalent to %H:%M:%S                                                        |          14:55           |\n| %u        | ISO 8601 weekday as number with Monday as 1 (1-7)                                                              |            4             |\n| %U        | Week number with the first Sunday as the first day of week one (00-53)                                         |            33            |\n| %V        | ISO 8601 week number (00-53)                                                                                   |            34            |\n| %w        | Weekday as a decimal number with Sunday as 0 (0-6)                                                             |            4             |\n| %W        | Week number with the first Monday as the first day of week one (00-53)                                         |            34            |\n| %x        | Date representation                                                                                            |         08/23/01         |\n| %X        | Time representation                                                                                            |         14:55:02         |\n| %y        | Year, last two digits (00-99)                                                                                  |            01            |\n| %Y        | Year                                                                                                           |           2001           |\n| %z        | ISO 8601 offset from UTC in timezone (1 minute = 1, 1 hour = 100)If timezone cannot be termined, no characters |           +100           |\n| %Z        | Timezone name or abbreviation If timezone cannot be termined, no characters                                    |           CDT            |\n| %%        | A % sign                                                                                                       |            %             |\n\n```perl\n#!/usr/local/bin/perl\nuse POSIX qw(strftime);\n\n$datestring = strftime \"%a %b %e %H:%M:%S %Y\", localtime;\nprintf(\"date and time - $datestring\\n\");\n\n# or for GMT formatted appropriately for your locale:\n$datestring = strftime \"%a %b %e %H:%M:%S %Y\", gmtime;\nprintf(\"date and time - $datestring\\n\");\n```\n"
  },
  {
    "path": "source/_posts/php.md",
    "content": "---\ntitle: PHP\ndate: 2021-01-04 15:23:28\nbackground: bg-[#7477a9]\ntags:\n  - web\ncategories:\n  - Programming\nintro: |\n  This [PHP](https://www.php.net/manual/en/) cheat sheet provides a reference for quickly looking up the correct syntax for the code you use most frequently.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### hello.php\n\n```php\n<?php // begin with a PHP open tag.\n\necho \"Hello World\\n\";\nprint(\"Hello cheatsheets.zip\");\n\n?>\n```\n\nPHP run command\n\n```shell script\n$ php hello.php\n```\n\n### Variables\n\n```php\n$boolean1 = true;\n$boolean2 = True;\n\n$int = 12;\n$float = 3.1415926;\nunset($float);  // Delete variable\n\n$str1 = \"How are you?\";\n$str2 = 'Fine, thanks';\n```\n\nSee: [Types](#php-types)\n\n### Strings\n\n```php\n$url = \"cheatsheets.zip\";\necho \"I'm learning PHP at $url\";\n\n// Concatenate strings\necho \"I'm learning PHP at \" . $url;\n\n$hello = \"Hello, \";\n$hello .= \"World!\";\necho $hello;   # => Hello, World!\n```\n\nSee: [Strings](#php-strings)\n\n### Arrays\n\n```php\n$num = [1, 3, 5, 7, 9];\n$num[5] = 11;\nunset($num[2]);    // Delete variable\nprint_r($num);     # => 1 3 7 9 11\necho count($num);  # => 5\n```\n\nSee: [Arrays](#php-arrays)\n\n### Operators\n\n```php\n$x = 1;\n$y = 2;\n\n$sum = $x + $y;\necho $sum;   # => 3\n```\n\nSee: [Operators](#php-operators)\n\n### Include {.row-span-3}\n\n#### vars.php\n\n```php\n<?php // begin with a PHP open tag.\n$fruit = 'apple';\necho \"I was imported\";\nreturn 'Anything you like.';\n?>\n```\n\n#### test.php\n\n```php\n<?php\ninclude 'vars.php';\necho $fruit . \"\\n\";   # => apple\n\n/* Same as include,\ncause an error if cannot be included*/\nrequire 'vars.php';\n\n// Also works\ninclude('vars.php');\nrequire('vars.php');\n\n// Include through HTTP\ninclude 'http://x.com/file.php';\n\n// Include and the return statement\n$result = include 'vars.php';\necho $result;  # => Anything you like.\n?>\n```\n\n### Functions\n\n```php\nfunction add($num1, $num2 = 1) {\n    return $num1 + $num2;\n}\necho add(10);    # => 11\necho add(10, 5); # => 15\n```\n\nSee: [Functions](#php-functions)\n\n### Comments\n\n```php\n# This is a one line shell-style comment\n\n// This is a one line c++ style comment\n\n/* This is a multi line comment\n   yet another line of comment */\n```\n\n### Constants\n\n```php\nconst MY_CONST = \"hello\";\n\necho MY_CONST;   # => hello\n\n# => MY_CONST is: hello\necho 'MY_CONST is: ' . MY_CONST;\n```\n\n### Classes\n\n```php\nclass Student {\n    public function __construct($name) {\n        $this->name = $name;\n    }\n}\n$alex = new Student(\"Alex\");\n```\n\nSee: [Classes](#php-classes)\n\n## PHP Types\n\n### Boolean {.row-span-2}\n\n```php\n$boolean1 = true;\n$boolean2 = TRUE;\n$boolean3 = false;\n$boolean4 = FALSE;\n\n$boolean5 = (boolean) 1;   # => true\n$boolean6 = (boolean) 0;   # => false\n```\n\nBoolean are case-insensitive\n\n### Integer {.row-span-2}\n\n```php\n$int1 = 28;    # => 28\n$int2 = -32;   # => -32\n$int3 = 012;   # => 10 (octal)\n$int4 = 0x0F;  # => 15 (hex)\n$int5 = 0b101; # => 5  (binary)\n\n# => 2000100000 (decimal, PHP 7.4.0)\n$int6 = 2_000_100_000;\n```\n\nSee also: [Integers](https://www.php.net/manual/en/language.types.integer.php)\n\n### Strings\n\n```php\necho 'this is a simple string';\n```\n\nSee: [Strings](#php-strings)\n\n### Arrays\n\n```php\n$arr = array(\"hello\", \"world\", \"!\");\n```\n\nSee: [Arrays](#php-arrays)\n\n### Float (Double)\n\n```php\n$float1 = 1.234;\n$float2 = 1.2e7;\n$float3 = 7E-10;\n\n$float4 = 1_234.567;  // as of PHP 7.4.0\nvar_dump($float4);    // float(1234.567)\n\n$float5 = 1 + \"10.5\";   # => 11.5\n$float6 = 1 + \"-1.3e3\"; # => -1299\n```\n\n### Null\n\n```php\n$a = null;\n$b = 'Hello php!';\necho $a ?? 'a is unset'; # => a is unset\necho $b ?? 'b is unset'; # => Hello php\n\n$a = array();\n$a == null    # => true\n$a === null   # => false\nis_null($a)   # => false\n```\n\n### Iterables\n\n```php\nfunction bar(): iterable {\n    return [1, 2, 3];\n}\nfunction gen(): iterable {\n    yield 1;\n    yield 2;\n    yield 3;\n}\nforeach (bar() as $value) {\n    echo $value;   # => 123\n}\n```\n\n## PHP Strings\n\n### String\n\n```php\n# => '$String'\n$sgl_quotes = '$String';\n\n# => 'This is a $String.'\n$dbl_quotes = \"This is a $sgl_quotes.\";\n\n# => a \t tab character.\n$escaped   = \"a \\t tab character.\";\n\n# => a slash and a t: \\t\n$unescaped = 'a slash and a t: \\t';\n```\n\n### Multi-line\n\n```php\n$str = \"foo\";\n\n// Uninterpolated multi-liners\n$nowdoc = <<<'END'\nMulti line string\n$str\nEND;\n\n// Will do string interpolation\n$heredoc = <<<END\nMulti line\n$str\nEND;\n```\n\n### Manipulation\n\n```php\n$s = \"Hello Phper\";\necho strlen($s);       # => 11\n\necho substr($s, 0, 3); # => Hel\necho substr($s, 1);    # => ello Phper\necho substr($s, -4, 3);# => hpe\n\necho strtoupper($s);   # => HELLO PHPER\necho strtolower($s);   # => hello phper\n\necho strpos($s, \"l\");      # => 2\nvar_dump(strpos($s, \"L\")); # => false\n```\n\nSee: [String Functions](https://www.php.net/manual/en/ref.strings.php)\n\n## PHP Arrays\n\n### Defining {.row-span-2}\n\n```php\n$a1 = [\"hello\", \"world\", \"!\"]\n$a2 = array(\"hello\", \"world\", \"!\");\n$a3 = explode(\",\", \"apple,pear,peach\");\n```\n\n#### Mixed int and string keys\n\n```php\n$array = array(\n    \"foo\" => \"bar\",\n    \"bar\" => \"foo\",\n    100   => -100,\n    -100  => 100,\n);\nvar_dump($array);\n```\n\n#### Short array syntax\n\n```php\n$array = [\n    \"foo\" => \"bar\",\n    \"bar\" => \"foo\",\n];\n```\n\n### Multi array\n\n```php\n$multiArray = [\n    [1, 2, 3],\n    [4, 5, 6],\n    [7, 8, 9],\n];\n\nprint_r($multiArray[0][0]) # => 1\nprint_r($multiArray[0][1]) # => 2\nprint_r($multiArray[0][2]) # => 3\n```\n\n### Multi type {.row-span-2}\n\n```php\n$array = array(\n    \"foo\" => \"bar\",\n    42    => 24,\n    \"multi\" => array(\n         \"dim\" => array(\n             \"a\" => \"foo\"\n         )\n    )\n);\n\n# => string(3) \"bar\"\nvar_dump($array[\"foo\"]);\n\n# => int(24)\nvar_dump($array[42]);\n\n# =>  string(3) \"foo\"\nvar_dump($array[\"multi\"][\"dim\"][\"a\"]);\n```\n\n### manipulation\n\n```php\n$arr = array(5 => 1, 12 => 2);\n$arr[] = 56;      // Append\n$arr[\"x\"] = 42;   // Add with key\nsort($arr);       // Sort\nunset($arr[5]);   // Remove\nunset($arr);      // Remove all\n```\n\nSee: [Array Functions](https://www.php.net/manual/en/ref.array.php)\n\n### Indexing iteration\n\n```php\n$array = array('a', 'b', 'c');\n$count = count($array);\n\nfor ($i = 0; $i < $count; $i++) {\n    echo \"i:{$i}, v:{$array[$i]}\\n\";\n}\n```\n\n### Value iteration\n\n```php\n$colors = array('red', 'blue', 'green');\n\nforeach ($colors as $color) {\n    echo \"Do you like $color?\\n\";\n}\n```\n\n### Key iteration\n\n```php\n$arr = [\"foo\" => \"bar\", \"bar\" => \"foo\"];\n\nforeach ( $arr as $key => $value )\n{\n  \techo \"key: \" . $key . \"\\n\";\n    echo \"val: {$arr[$key]}\\n\";\n}\n```\n\n### Concatenate arrays\n\n```php\n$a = [1, 2];\n$b = [3, 4];\n\n// PHP 7.4 later\n# => [1, 2, 3, 4]\n$result = [...$a, ...$b];\n```\n\n### Into functions\n\n```php\n$array = [1, 2];\n\nfunction foo(int $a, int $b) {\n\techo $a; # => 1\n  \techo $b; # => 2\n}\nfoo(...$array);\n```\n\n### Splat Operator\n\n```php\nfunction foo($first, ...$other) {\n\tvar_dump($first); # => a\n  \tvar_dump($other); # => ['b', 'c']\n}\nfoo('a', 'b', 'c' /*, ...*/ );\n// or\nfunction foo($first, string ...$other){}\n```\n\n## PHP Operators {.cols-4}\n\n### Arithmetic\n\n| -    | -              |\n| ---- | -------------- |\n| `+`  | Addition       |\n| `-`  | Subtraction    |\n| `*`  | Multiplication |\n| `/`  | Division       |\n| `%`  | Modulo         |\n| `**` | Exponentiation |\n\n### Assignment\n\n| -        | -                   |\n| -------- | ------------------- |\n| `a += b` | Same as `a = a + b` |\n| `a -= b` | Same as `a = a – b` |\n| `a *= b` | Same as `a = a * b` |\n| `a /= b` | Same as `a = a / b` |\n| `a %= b` | Same as `a = a % b` |\n\n### Comparison {.row-span-2}\n\n| -     | -                            |\n| ----- | ---------------------------- |\n| `==`  | Equal                        |\n| `===` | Identical                    |\n| `!=`  | Not equal                    |\n| `<>`  | Not equal                    |\n| `!==` | Not identical                |\n| `<`   | Less than                    |\n| `>`   | Greater than                 |\n| `<=`  | Less than or equal           |\n| `>=`  | Greater than or equal        |\n| `<=>` | Less than/equal/greater than |\n\n### Logical\n\n| -     | -            |\n| ----- | ------------ | --- | --- |\n| `and` | And          |\n| `or`  | Or           |\n| `xor` | Exclusive or |\n| `!`   | Not          |\n| `&&`  | And          |\n| `     |              | `   | Or  |\n\n### Arithmetic {.col-span-2}\n\n```php\n// Arithmetic\n$sum        = 1 + 1; // 2\n$difference = 2 - 1; // 1\n$product    = 2 * 2; // 4\n$quotient   = 2 / 1; // 2\n\n// Shorthand arithmetic\n$num = 0;\n$num += 1;       // Increment $num by 1\necho $num++;     // Prints 1 (increments after evaluation)\necho ++$num;     // Prints 3 (increments before evaluation)\n$num /= $float;  // Divide and assign the quotient to $num\n```\n\n### Bitwise\n\n| -    | -                  |\n| ---- | ------------------ | ----------------- |\n| `&`  | And                |\n| `    | `                  | Or (inclusive or) |\n| `^`  | Xor (exclusive or) |\n| `~`  | Not                |\n| `<<` | Shift left         |\n| `>>` | Shift right        |\n\n## PHP Conditionals\n\n### If elseif else\n\n```php\n$a = 10;\n$b = 20;\n\nif ($a > $b) {\n    echo \"a is bigger than b\";\n} elseif ($a == $b) {\n    echo \"a is equal to b\";\n} else {\n    echo \"a is smaller than b\";\n}\n```\n\n### Switch\n\n```php\n$x = 0;\nswitch ($x) {\n    case '0':\n        print \"it's zero\";\n        break;\n    case 'two':\n    case 'three':\n        // do something\n        break;\n    default:\n        // do something\n}\n```\n\n### Ternary operator\n\n```php\n# => Does\nprint (false ? 'Not' : 'Does');\n\n$x = false;\n# => Does\nprint($x ?: 'Does');\n\n$a = null;\n$b = 'Does print';\n# => a is unset\necho $a ?? 'a is unset';\n# => print\necho $b ?? 'b is unset';\n```\n\n### Match\n\n```php\n$statusCode = 500;\n$message = match($statusCode) {\n  200, 300 => null,\n  400 => 'not found',\n  500 => 'server error',\n  default => 'known status code',\n};\necho $message; # => server error\n```\n\nSee: [Match](https://www.php.net/manual/en/control-structures.match.php)\n\n### Match expressions\n\n```php\n$age = 23;\n\n$result = match (true) {\n    $age >= 65 => 'senior',\n    $age >= 25 => 'adult',\n    $age >= 18 => 'young adult',\n    default => 'kid',\n};\n\necho $result; # => young adult\n```\n\n## PHP Loops\n\n### while\n\n```php\n$i = 1;\n# => 12345\nwhile ($i <= 5) {\n    echo $i++;\n}\n```\n\n### do while\n\n```php\n$i = 1;\n# => 12345\ndo {\n    echo $i++;\n} while ($i <= 5);\n```\n\n### for i\n\n```php\n# => 12345\nfor ($i = 1; $i <= 5; $i++) {\n    echo $i;\n}\n```\n\n### break\n\n```php\n# => 123\nfor ($i = 1; $i <= 5; $i++) {\n    if ($i === 4) {\n        break;\n    }\n    echo $i;\n}\n```\n\n### continue\n\n```php\n# => 1235\nfor ($i = 1; $i <= 5; $i++) {\n    if ($i === 4) {\n        continue;\n    }\n    echo $i;\n}\n```\n\n### foreach\n\n```php\n$a = ['foo' => 1, 'bar' => 2];\n# => 12\nforeach ($a as $k) {\n    echo $k;\n}\n```\n\nSee: [Array iteration](#php-value-iteration)\n\n## PHP Functions\n\n### Returning values\n\n```php\nfunction square($x)\n{\n    return $x * $x;\n}\n\necho square(4);  # => 16\n```\n\n### Return types\n\n```php\n// Basic return type declaration\nfunction sum($a, $b): float {/*...*/}\nfunction get_item(): string {/*...*/}\n\nclass C {}\n// Returning an object\nfunction getC(): C { return new C; }\n```\n\n### Nullable return types\n\n```php\n// Available in PHP 7.1\nfunction nullOrString(int $v) : ?string\n{\n    return $v % 2 ? \"odd\" : null;\n}\necho nullOrString(3);       # => odd\nvar_dump(nullOrString(4));  # => NULL\n```\n\nSee: [Nullable types](https://www.php.net/manual/en/migration71.new-features.php)\n\n### Void functions\n\n```php\n// Available in PHP 7.1\nfunction voidFunction(): void\n{\n\techo 'Hello';\n\treturn;\n}\n\nvoidFunction();  # => Hello\n```\n\n### Variable functions\n\n```php\nfunction bar($arg = '')\n{\n    echo \"In bar(); arg: '$arg'.\\n\";\n}\n\n$func = 'bar';\n$func('test'); # => In bar(); arg: test\n```\n\n### Anonymous functions\n\n```php\n$greet = function($name)\n{\n    printf(\"Hello %s\\r\\n\", $name);\n};\n\n$greet('World'); # => Hello World\n$greet('PHP');   # => Hello PHP\n```\n\n### Recursive functions\n\n```php\nfunction recursion($x)\n{\n    if ($x < 5) {\n        echo \"$x\";\n        recursion($x + 1);\n    }\n}\nrecursion(1);  # => 1234\n```\n\n### Default parameters\n\n```php\nfunction coffee($type = \"cappuccino\")\n{\n    return \"Making a cup of $type.\\n\";\n}\n# => Making a cup of cappuccino.\necho coffee();\n# => Making a cup of .\necho coffee(null);\n# => Making a cup of espresso.\necho coffee(\"espresso\");\n```\n\n### Arrow Functions\n\n```php\n$y = 1;\n\n$fn1 = fn($x) => $x + $y;\n\n// equivalent to using $y by value:\n$fn2 = function ($x) use ($y) {\n    return $x + $y;\n};\necho $fn1(5);   # => 6\necho $fn2(5);   # => 6\n```\n\n## PHP Classes\n\n### Constructor\n\n```php\nclass Student {\n    public function __construct($name) {\n        $this->name = $name;\n    }\n  \tpublic function print() {\n        echo \"Name: \" . $this->name;\n    }\n}\n$alex = new Student(\"Alex\");\n$alex->print();    # => Name: Alex\n```\n\n### Inheritance\n\n```php\nclass ExtendClass extends SimpleClass\n{\n    // Redefine the parent method\n    function displayVar()\n    {\n        echo \"Extending class\\n\";\n        parent::displayVar();\n    }\n}\n\n$extended = new ExtendClass();\n$extended->displayVar();\n```\n\n### Classes variables {.row-span-2}\n\n```php\nclass MyClass\n{\n    const MY_CONST       = 'value';\n    static $staticVar    = 'static';\n\n    // Visibility\n    public static $var1  = 'pubs';\n\n    // Class only\n    private static $var2 = 'pris';\n\n    // The class and subclasses\n    protected static $var3 = 'pros';\n\n    // The class and subclasses\n    protected $var6      = 'pro';\n\n    // The class only\n    private $var7        = 'pri';\n}\n```\n\nAccess statically\n\n```php\necho MyClass::MY_CONST;   # => value\necho MyClass::$staticVar; # => static\n```\n\n### Magic Methods\n\n```php\nclass MyClass\n{\n    // Object is treated as a String\n    public function __toString()\n    {\n        return $property;\n    }\n    // opposite to __construct()\n    public function __destruct()\n    {\n        print \"Destroying\";\n    }\n}\n```\n\n### Interface\n\n```php\ninterface Foo\n{\n    public function doSomething();\n}\ninterface Bar\n{\n    public function doSomethingElse();\n}\nclass Cls implements Foo, Bar\n{\n    public function doSomething() {}\n    public function doSomethingElse() {}\n}\n```\n\n## PHP Trait \n\n### Trait declaration & Use case {.col-span-3}\n```php\n// Declare Trait allows reuse of code\n// across multiple classes for common characteristics or use cases\n\n<?php\ntrait Logger {\n    public function log($message) {\n    \t$date = new DateTime();\n        echo \"| \".  $date->format('Y-m-d H:i:s') . \" | \" . $message;\n    }\n}\n\n// Use case : \n// Call trait with \"use <trait name> in Class\"\n\nclass User {\n    use Logger; \n\n    public function createUser() {\n        // User creation logic\n        $this->log(\"User created.\");\n    }\n}\n\nclass Product {\n    use Logger;\n\n    public function createProduct() {\n        // Product creation logic\n        $this->log(\"Product created.\");\n    }\n}\n\n$user = new User();\n$user->createUser(); // Output ex: | 2025-06-18 14:06:09 | User created.\n\n$product = new Product();\n$product->createProduct(); // Output ex: | 2025-06-18 14:06:09 | Product created.\n```\n\n## PHP Enums (PHP 8.1)\n\n### Enum Declaration & Use case {.col-span-3}\n\n```php\n<?php\n// enum is a data type that allows you to define a set of named constants,\n// representing a fixed group of related values\n\nenum Status {\n    case Pending;\n    case Approved;\n    case Rejected;\n}\n\n// Use case\n\nfunction getStatusMessage(Status $status): string {\n    return match($status) {\n        Status::Pending => \"Waiting for approval.\",\n        Status::Approved => \"Your request has been approved.\",\n        Status::Rejected => \"Your request has been rejected.\",\n    };\n}\n\n$currentStatus = Status::Approved;\necho getStatusMessage($currentStatus); // Output : Your request has been approved.\n```\n\n## PHP Date & Time Handling \n\n### Current date and time\n```php\n// DateTime in PHP handles both date and time\n\n<?php\n$now = new DateTime();\necho $now->format('Y-m-d H:i:s.u'); \n\n// Output ex: 2024-04-27 14:35:22.123456\n```\n\n\n### Creating specific date/time objects\n```php\n<?php\n// Create a date object\n$d = new DateTime('2024-04-27');\necho $d->format('Y-m-d'); \n\n// Output : 2024-04-27\n\n// Create a time object \n$t = new DateTime('15:30:45');\necho $t->format('H:i:s'); \n\n// Output : 15:30:45\n\n// Create a datetime object\n$dt = new DateTime('2024-04-27 15:30:45');\necho $dt->format('Y-m-d H:i:s'); \n\n// Output :  2024-04-27 15:30:45\n```\n\n### Converting between date formats\n```php\n<?php\n// Convert a string to a DateTime object\n$date_str = \"2024-04-27 14:00\";\n$dt_obj = new DateTime($date_str);\necho $dt_obj->format('Y-m-d H:i:s'); \n\n// Output : 2024-04-27 14:00:0027\n\n// Convert a DateTime object to a string\n$formatted_str = $dt_obj->format('d/m/Y H:i');\necho $formatted_str;\n \n// Output :  27/04/2024 14:00\n```\n### Timestamps and Unix time {.col-span-2}\n```php\n<?php\n// Get current timestamp\n$timestamp = time();\necho $timestamp; \n\n// Output ex:  1750253583\n\n// Convert timestamp back to DateTime\n$dt_from_timestamp = (new DateTime())->setTimestamp($timestamp);\necho $dt_from_timestamp->format('Y-m-d H:i:s');\n\n// Output ex : 2025-06-18 13:33:03\n```\n\n\n### Date difference and timedelta {.col-span-1}\n```php\n<?php\n$date1 = new DateTime('2024-04-27');\n$date2 = new DateTime('2024-05-01');\n\n$interval = $date1->diff($date2);\necho $interval->days; \n\n// Output : 4\n\n// Using DateInterval for date arithmetic\n$new_date = clone $date1;\n$new_date->add(new DateInterval('P10D'));\necho $new_date->format('Y-m-d'); \n\n// Output : 2024-05-07\n```\n\n## Miscellaneous\n\n### Basic error handling\n\n```php\ntry {\n    // Do something\n} catch (Exception $e) {\n    // Handle exception\n} finally {\n    echo \"Always print!\";\n}\n```\n\n### Exception in PHP 8.0 {.col-span-2}\n\n```php {.wrap}\n$nullableValue = null;\n\ntry {\n\t$value = $nullableValue ?? throw new InvalidArgumentException();\n} catch (InvalidArgumentException) { // Variable is optional\n    // Handle my exception\n    echo \"print me!\";\n}\n```\n\n### Custom exception {.row-span-2}\n\n```php\nclass MyException extends Exception {\n    // do something\n}\n```\n\nUsage\n\n```php\ntry {\n    $condition = true;\n    if ($condition) {\n        throw new MyException('bala');\n    }\n} catch (MyException $e) {\n    // Handle my exception\n}\n```\n\n### Nullsafe Operator {.row-span-2}\n\n```php\n// As of PHP 8.0.0, this line:\n$result = $repo?->getUser(5)?->name;\n\n// Equivalent to the following code:\nif (is_null($repo)) {\n    $result = null;\n} else {\n    $user = $repository->getUser(5);\n    if (is_null($user)) {\n        $result = null;\n    } else {\n        $result = $user->name;\n    }\n}\n```\n\nSee also: [Nullsafe Operator](https://wiki.php.net/rfc/nullsafe_operator)\n\n### Regular expressions\n\n```php\n$str = \"Visit cheatsheets.zip\";\necho preg_match(\"/ch/i\", $str); # => 1\n```\n\nSee: [Regex in PHP](/regex#regex-in-php)\n\n### fopen() mode\n\n| -    | -                        |\n| ---- | ------------------------ |\n| `r`  | Read                     |\n| `r+` | Read and write, prepend  |\n| `w`  | Write, truncate          |\n| `w+` | Read and write, truncate |\n| `a`  | Write, append            |\n| `a+` | Read and write, append   |\n\n### Super Global Variables {.col-span-2}\n\n| Variable     | Description                                                  |\n|--------------|:-------------------------------------------------------------|\n| `$_SERVER`   | Holds information about headers, paths, and script locations |\n| `$_GET`      | Contains data sent via URL parameters (query string)         |\n| `$_POST`     | Contains data sent via HTTP POST method                      |\n| `$_FILES`    | Contains information about uploaded files                    |\n| `$_COOKIE`   | Contains cookie data                                         |\n| `$_SESSION`  | Stores session variables                                     |\n| `$_REQUEST`  | Contains data from `$_GET`, `$_POST`, and `$_COOKIE`         |\n| `$_ENV`      | Contains environment variables                               |\n| `$GLOBALS`   | References all global variables available in the script      |\n\n{.left-text}\n\nSuper Global Variables are built-in variables always available in all scopes.\n\n\n### Runtime defined Constants\n\n```php\ndefine(\"CURRENT_DATE\", date('Y-m-d'));\n\n// One possible representation\necho CURRENT_DATE;   # => 2021-01-05\n\n# => CURRENT_DATE is: 2021-01-05\necho 'CURRENT_DATE is: ' . CURRENT_DATE;\n```\n\n## Also see\n\n- [PHP Docs](https://www.php.net/manual/en/index.php)\n- [Learn X in Y minutes](https://learnxinyminutes.com/docs/php/)\n"
  },
  {
    "path": "source/_posts/phpstorm.md",
    "content": "---\ntitle: PhpStorm\ndate: 2022-11-23 16:23:31.703719\nbackground: bg-gradient-to-r from-[#be4fe9] to-[#715bef] hover:from-indigo-400 hover:to-blue-500\nlabel:\ntags:\n  - jetbrains\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 96 keyboard shortcuts found in JetBrains PhpStorm\n---\n\n## Keyboard Shortcuts\n\n### Editing {.row-span-4}\n\n| Shortcut                   | Action                                            |\n| -------------------------- | ------------------------------------------------- |\n| `Ctrl` `Space`             | Basic code completion                             |\n| `Alt` `Enter`              | Show intention actions and quick-fixes            |\n| `Ctrl` `P`                 | Parameter info (within method call arguments)     |\n| `Ctrl` `Q`                 | Quick documentation lookup                        |\n| `Ctrl` `(mouse over code)` | Brief Info                                        |\n| `Alt` `Insert`             | Generate code... (Getters, Setters, Constructors) |\n| `Ctrl` `O`                 | Override methods                                  |\n| `Ctrl` `I`                 | Implement methods                                 |\n| `Ctrl` `Alt` `T`           | Surround with...(if..else, try..catch, for, etc.) |\n| `Ctrl` `/`                 | Comment/uncomment with line comment               |\n| `Ctrl` `Shift` `/`         | Comment/uncomment with block comment              |\n| `Ctrl` `W`                 | Select successively increasing code blocks        |\n| `Ctrl` `Shift` `W`         | Decrease current selection to previous state      |\n| `Ctrl` `Alt` `L`           | Reformat code                                     |\n| `Ctrl` `Alt` `I`           | Auto-indent line(s)                               |\n| `Ctrl` `D`                 | Duplicate current line or selected block          |\n| `Ctrl` `Y`                 | Delete line at caret                              |\n| `Ctrl` `Shift` `J`         | Smart line join (HTML and JavaScript only)        |\n| `Ctrl` `Enter`             | Smart line split (HTML and JavaScript only)       |\n| `Shift` `Enter`            | Start a new line                                  |\n| `Ctrl` `Shift` `U`         | Toggle case for word at caret or selected block   |\n| `Ctrl` `Shift` `[`         | Select till code block start                      |\n| `Ctrl` `Shift` `]`         | Select till code block end                        |\n| `Ctrl` `Delete`            | Delete to word end                                |\n| `Ctrl` `Backspace`         | Delete to word start                              |\n| `Ctrl` `+/-`               | Expand/collapse code block                        |\n| `Ctrl` `F4`                | Close active editor tab                           |\n| `Ctrl` `Shift` `V`         | Paste from history                                |\n\n{.shortcuts}\n\n### Debugging\n\n| Shortcut            | Action              |\n| ------------------- | ------------------- |\n| `F8`                | Step over           |\n| `F7`                | Step into           |\n| `Shift` `F8`        | Step out            |\n| `Alt` `F8`          | Evaluate expression |\n| `F9`                | Resume program      |\n| `Ctrl` `F8`         | Toggle breakpoint   |\n| `Ctrl` `Shift` `F8` | View breakpoints    |\n\n{.shortcuts}\n\n### Running\n\n| Shortcut             | Action                                |\n| -------------------- | ------------------------------------- |\n| `Shift` `F10`        | Run                                   |\n| `Shift` `F9`         | Debug                                 |\n| `Ctrl` `Shift` `F10` | Run context configuration from editor |\n| `Ctrl` `Shift` `X`   | Run command line                      |\n\n{.shortcuts}\n\n### Search/Replace\n\n| Shortcut             | Action               |\n| -------------------- | -------------------- |\n| `Ctrl` `F/R`         | Find/Replace         |\n| `F3`                 | Find next            |\n| `Shift` `F3`         | Find previous        |\n| `Ctrl` `Shift` `F/R` | Find/Replace in path |\n\n{.shortcuts}\n\n### Usage Search\n\n| Shortcut            | Action                   |\n| ------------------- | ------------------------ |\n| `Alt` `F7`          | Find usages              |\n| `Ctrl` `F7`         | Find usages in file      |\n| `Ctrl` `Shift` `F7` | Highlight usages in file |\n| `Ctrl` `Alt` `F7`   | Show usages              |\n\n{.shortcuts}\n\n### Navigation {.row-span-2}\n\n| Shortcut                   | Action                                    |\n| -------------------------- | ----------------------------------------- |\n| `Ctrl` `N`                 | Go to class                               |\n| `Ctrl` `Shift` `N`         | Go to file                                |\n| `Ctrl` `Shift` `Alt` `N`   | Go to symbol                              |\n| `Ctrl` `G`                 | Go to line                                |\n| `Alt` `Left/Right`         | Go to next/previous editor tab            |\n| `Esc`                      | Go to editor (from tool window)           |\n| `Ctrl` `E`                 | Recent files popup                        |\n| `Ctrl` `Alt` `Left/Right`  | Navigate back/forward                     |\n| `Ctrl` `Shift` `Backspace` | Navigate to last edit location            |\n| `Alt` `F1`                 | Select current file or symbol in any view |\n| `Ctrl` `B`                 | Go to declaration                         |\n| `Ctrl` `Alt` `B`           | Go to implementation(s)                   |\n| `Ctrl` `Shift` `I`         | Open quick definition lookup              |\n| `Ctrl` `Shift` `B`         | Go to type declaration                    |\n| `Ctrl` `U`                 | Go to super-method/super-class            |\n| `Alt` `Up/Down`            | Go to previous/next method                |\n| `Ctrl` `]/[`               | Move to code block end/start              |\n| `F2`                       | Next highlighted error                    |\n| `Shift` `F2`               | Previous highlighted error                |\n| `F4`                       | Edit/view source                          |\n\n{.shortcuts}\n\n### Refactoring\n\n| Shortcut                 | Action                                           |\n| ------------------------ | ------------------------------------------------ |\n| `F5/F6`                  | Copy/Move                                        |\n| `Alt` `Delete`           | Safe delete                                      |\n| `Shift` `F6`             | Rename                                           |\n| `Ctrl` `Alt` `N`         | Inline variable                                  |\n| `Ctrl` `Alt` `M/V/F/C`   | Extract Method/Variable/Field/Constant           |\n| `Ctrl` `Alt` `Shift` `T` | Refactor This (shows all available refactorings) |\n\n{.shortcuts}\n\n### VCS/Local History\n\n| Shortcut              | Action                  |\n| --------------------- | ----------------------- |\n| `Alt` <code>\\`</code> | VCS quick popup         |\n| `Ctrl` `K`            | Commit project to VCS   |\n| `Ctrl` `T`            | Update project from VCS |\n| `Alt` `Shift` `C`     | View recent changes     |\n\n{.shortcuts}\n\n### General\n\n| Shortcut             | Action                                    |\n| -------------------- | ----------------------------------------- |\n| `Shift x2`           | Search everywhere                         |\n| `Ctrl` `Shift` `A`   | Find Action                               |\n| `Alt` `1-9`          | Open corresponding tool window            |\n| `Ctrl` `Alt` `F11`   | Toggle full screen mode                   |\n| `Ctrl` `Shift` `F12` | Toggle maximizing editor                  |\n| `Alt` `Shift` `F`    | Add to Favorites                          |\n| `Alt` `Shift` `I`    | Inspect current file with current profile |\n| `Ctrl` `Alt` `S`     | Open Settings dialog                      |\n| `Ctrl` `Tab`         | Switch between tabs and tool window       |\n\n{.shortcuts}\n\n### Live Templates/Snippets\n\n| Shortcut   | Action                                         |\n| ---------- | ---------------------------------------------- |\n| `Ctrl` `J` | Insert Live Template                           |\n| `eco`      | 'echo' statement                               |\n| `fore`     | foreach(iterable_expr as $value) {...}         |\n| `forek`    | foreach(iterable_expr as $key => $value) {...} |\n| `inc/inco` | 'include'/'include_once' statement             |\n| `prif`     | private function                               |\n| `prof`     | protected function                             |\n| `pubf`     | public function                                |\n| `rqr/rqro` | 'require'/'require_once' statement             |\n\n{.shortcuts}\n\n### Misc\n\n| Shortcut           | Action      |\n| ------------------ | ----------- |\n| `Ctrl` `Shift` `A` | Find Action |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for PhpStorm](https://resources.jetbrains.com/storage/products/phpstorm/docs/PhpStorm_ReferenceCard.pdf)\n  _(resources.jetbrains.com)_\n"
  },
  {
    "path": "source/_posts/pm2.md",
    "content": "---\ntitle: PM2\ndate: 2022-11-25 18:10:00\nbackground: bg-[#230769]\ntags:\n  - process\ncategories:\n  - Linux Command\nintro: |\n  [PM2] is a daemon process manager that will help you manage and keep your application online. Getting started with PM2 is straightforward, it is offered as a simple and intuitive CLI.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Install\n\nThe latest PM2 version is installable with NPM or Yarn\n\n```shell script\n$ npm install pm2@latest -g\n```\n\nOR\n\n```shell script\n$ yarn global add pm2\n```\n\n### Start an app\n\nThe simplest way to start, daemonize and monitor your application is by using this command line\n\n```shell script\n$ pm2 start app.js\n```\n\nOr start any other application easily\n\n```shell script\n$ pm2 start bashscript.sh\n$ pm2 start python-app.py --watch\n$ pm2 start binary-file -- --port 1520\n```\n\n### Some options you can pass to the CLI {.row-span-3}\n\nSpecify an app name\n\n```shell script\n--name <app_name>\n```\n\nWatch and Restart app when files change\n\n```shell script\n--watch\n```\n\nSet memory threshold for app reload\n\n```shell script\n--max-memory-restart <200MB>\n```\n\nSpecify log file\n\n```shell script\n--log <log_path>\n```\n\nPass extra arguments to the script\n\n```shell script\n-- arg1 arg2 arg3\n```\n\nDelay between automatic restarts\n\n```shell script\n--restart-delay <delay in ms>\n```\n\nPrefix logs with time\n\n```shell script\n--time\n```\n\nDo not auto restart app\n\n```shell script\n--no-autorestart\n```\n\nSpecify cron for forced restart\n\n```shell script\n--cron <cron_pattern>\n```\n\nAttach to application log\n\n```shell script\n--no-daemon\n```\n\n### Managing processes\n\nManaging application state is simple here are the commands\n\n```shell script\n$ pm2 restart app_name\n$ pm2 reload app_name\n$ pm2 stop app_name\n$ pm2 delete app_name\n```\n\n#### Instead of app_name you can pass\n\n- `all` to act on all processes\n- `id` to act on a specific process id\n\n### Check status, logs, metrics {.row-span-2}\n\nNow that you have started this application, you can check its status, logs, metrics and even get the online dashboard\nwith [pm2.io](https://pm2.io/).\n\nList the status of all application managed by PM2\n\n```shell script\n$ pm2 [list|ls|status]\n```\n\nTo display logs in realtime\n\n```shell script\n$ pm2 logs\n```\n\nTo dig in older logs\n\n```shell script\n$ pm2 logs --lines 200\n```\n\nHere is a realtime dashboard that fits directly into your terminal\n\n```shell script\n$ pm2 monit\n```\n\nWeb based dashboard, cross servers with diagnostic system\n\n```shell script\n$ pm2 plus\n```\n\n### Cluster mode\n\nFor Node.js applications, PM2 includes an automatic load balancer that will share all HTTP[s]/Websocket/TCP/UDP\nconnections between each spawned processes.\n\nTo start an application in Cluster mode\n\n```shell script\n$ pm2 start app.js -i max\n```\n\nRead more about cluster mode [here](https://pm2.keymetrics.io/docs/usage/quick-start/).\n\n### Ecosystem File {.row-span-2}\n\nYou can also create a configuration file, called Ecosystem File, to manage multiple applications. To generate an\nEcosystem file\n\n```shell script\n$ pm2 ecosystem\n```\n\nThis will generate an ecosystem.config.js file\n\n```\nmodule.exports = {\n  apps : [{\n    name: \"app\",\n    script: \"./app.js\",\n    env: {\n      NODE_ENV: \"development\",\n    },\n    env_production: {\n      NODE_ENV: \"production\",\n    }\n  }, {\n     name: 'worker',\n     script: 'worker.js'\n  }]\n}\n```\n\nAnd start it easily\n\n```shell script\n$ pm2 start ecosystem.config.js\n```\n\nRead more about application declaration [here](https://pm2.keymetrics.io/docs/usage/application-declaration/)\n\n### Setup startup script\n\nRestarting PM2 with the processes you manage on server boot/reboot is critical. To solve this, just run this command to\ngenerate an active startup script\n\n```shell script\n$ pm2 save\n```\n\nRead more about startup script generator [here](https://pm2.keymetrics.io/docs/usage/startup/)\n\n### Restart application on changes\n\nIt’s pretty easy with the `--watch` option\n\n```\n$ cd /path/to/my/app\n$ pm2 start env.js --watch --ignore-watch=\"node_modules\"\n```\n\nThis will watch & restart the app on any file change from the current directory + all subfolders and it will ignore any\nchanges in the node_modules folder `--ignore-watch=\"node_modules\"`.\n\nYou can then use `pm2 logs` to check for restarted app logs.\n\n---\n\n### CheatSheet {.row-span-2 .col-span-2}\n\nHere are some commands that are worth knowing. Just try them with a sample application or with your current web\napplication on your development machine\n\nFork mode\n\n```shell script\n$ pm2 start app.js --name my-api # Name process\n```\n\nCluster mode\n\n```shell script\n$ pm2 start app.js -i 0        # Will start maximum processes with LB depending on available CPUs\n$ pm2 start app.js -i max      # Same as above, but deprecated.\n$ pm2 scale app +3             # Scales `app` up by 3 workers\n$ pm2 scale app 2              # Scales `app` up or down to 2 workers total\n```\n\nListing\n\n```shell script\n$ pm2 list               # Display all processes status\n$ pm2 jlist              # Print process list in raw JSON\n$ pm2 prettylist         # Print process list in beautified JSON\n\n$ pm2 describe 0         # Display all information about a specific process\n\n$ pm2 monit              # Monitor all processes\n```\n\nLogs\n\n```shell script\n$ pm2 logs [--raw]       # Display all processes logs in streaming\n$ pm2 flush              # Empty all log files\n$ pm2 reloadLogs         # Reload all logs\n```\n\nActions\n\n```shell script\n$ pm2 stop all           # Stop all processes\n$ pm2 restart all        # Restart all processes\n\n$ pm2 reload all         # Will 0s downtime reload (for NETWORKED apps)\n\n$ pm2 stop 0             # Stop specific process id\n$ pm2 restart 0          # Restart specific process id\n\n$ pm2 delete 0           # Will remove process from pm2 list\n$ pm2 delete all         # Will remove all processes from pm2 list\n```\n\nMisc\n\n```shell script\n$ pm2 reset <process>    # Reset meta data (restarted time...)\n$ pm2 updatePM2          # Update in memory pm2\n$ pm2 ping               # Ensure pm2 daemon has been launched\n$ pm2 sendSignal SIGUSR2 my-app # Send system signal to script\n$ pm2 start app.js --no-daemon\n$ pm2 start app.js --no-vizion\n$ pm2 start app.js --no-autorestart\n```\n\n### Updating PM2\n\nWe made it simple, there is no breaking change between releases and the procedure is straightforward\n\n```shell script\n$ npm install pm2@latest -g\n```\n\nThen update the in-memory PM2\n\n```shell script\n$ pm2 update\n```\n\n## Also see\n\n- [QUICK START](https://pm2.keymetrics.io/docs/usage/quick-start/) _(pm2.keymetrics.io)_\n"
  },
  {
    "path": "source/_posts/pocket.md",
    "content": "---\ntitle: Pocket\ndate: 2022-11-23 16:23:31.702053\nbackground: bg-[#d54d57]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 36 keyboard shortcuts found on Pocket for Web\n---\n\n## Keyboard Shortcuts\n\n### Viewing Your List\n\n| Shortcut | Action                |\n| -------- | --------------------- |\n| `G` `L`  | Go to My List         |\n| `G` `A`  | Go to Archive         |\n| `G` `F`  | Go to Favorites       |\n| `G` `R`  | Go to Articles        |\n| `G` `H`  | Go to Highlights      |\n| `G` `V`  | Go to Videos          |\n| `G` `T`  | Go to All Tags        |\n| `G` `S`  | Go to Search          |\n| `G` `B`  | Bulk Edit             |\n| `G` `U`  | Save a URL            |\n| `S` `N`  | Sort by Newest        |\n| `S` `O`  | Sort by Oldest        |\n| `V` `L`  | List View             |\n| `V` `G`  | Grid View             |\n| `V` `D`  | Detail View           |\n| `C` `L`  | Change to Light Theme |\n| `C` `D`  | Change to Dark Theme  |\n| `C` `S`  | Change to Sepia Theme |\n| `?`      | Open Help Overlay     |\n\n{.shortcuts}\n\n### Item Actions\n\n| Shortcut | Action                         |\n| -------- | ------------------------------ |\n| `O`      | Open the original in a new tab |\n| `A`      | Archive the selected item      |\n| `F`      | Favorite the selected item     |\n| `T`      | Tag the selected item          |\n| `D`      | Delete the selected item       |\n| `X`      | Select item in bulk edit       |\n| `J`      | Select the next item           |\n| `K`      | Select the previous item       |\n\n{.shortcuts}\n\n### Article View\n\n| Shortcut   | Action                                   |\n| ---------- | ---------------------------------------- |\n| `Ctrl` `=` | Increase the font size                   |\n| `Ctrl` `-` | Decrease the font size                   |\n| `B`        | Toggle full screen mode                  |\n| `D`        | Edit tags                                |\n| `T`        | Archive the item                         |\n| `F`        | Favorite the item                        |\n| `O`        | View the original                        |\n| `Alt` `=`  | Increase the column width (premium only) |\n| `Alt` `-`  | Decrease the column width (premium only) |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Pocket](https://help.getpocket.com/article/994-keyboard-shortcuts-in-pocket-for-web)\n  _(help.getpocket.com)_\n"
  },
  {
    "path": "source/_posts/postgres.md",
    "content": "---\ntitle: PostgreSQL\nbackground: bg-[#3d6488]\ntags:\n  - DB\n  - RDBMS\ncategories:\n  - Database\ndate: 2021-01-11 14:19:24\nintro: |\n  The [PostgreSQL](https://www.postgresql.org/docs/current/) cheat sheet provides you with the common PostgreSQL commands and statements.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Getting started\n\nSwitch and connect\n\n```shell script\n$ sudo -u postgres psql\n```\n\nList all databases\n\n```shell script\npostgres=# \\l\n```\n\nConnect to the database named postgres\n\n```shell script\npostgres=# \\c postgres\n```\n\nDisconnect\n\n```shell script\npostgres=# \\q\npostgres=# \\!\n```\n\n### psql commands {.col-span-2}\n\n| Option              | Example                                      | Description                    |\n| ------------------- | -------------------------------------------- | :----------------------------- |\n| `[-d] <database>`   | psql -d mydb                                 | Connecting to database         |\n| `-U`                | psql -U john mydb                            | Connecting as a specific user  |\n| `-h` `-p`           | psql -h localhost -p 5432 mydb               | Connecting to a host/port      |\n| `-U` `-h` `-p` `-d` | psql -U admin -h 192.168.1.5 -p 2506 -d mydb | Connect remote PostgreSQL      |\n| `-W`                | psql -W mydb                                 | Force password                 |\n| `-c`                | psql -c '\\c postgres' -c '\\dt'               | Execute a SQL query or command |\n| `-H`                | psql -c \"\\l+\" -H postgres > database.html    | Generate HTML report           |\n| `-l`                | psql -l                                      | List all databases             |\n| `-f`                | psql mydb -f file.sql                        | Execute commands from a file   |\n| `-V`                | psql -V                                      | Print the psql version         |\n\n{.show-header}\n\n### Getting help\n\n| -           | -                              |\n| ----------- | :----------------------------- |\n| `\\h`        | Help on syntax of SQL commands |\n| `\\h` DELETE | DELETE SQL statement syntax    |\n| `\\?`        | List of PostgreSQL command     |\n\nRun in PostgreSQL console\n\n## PostgreSQL Working\n\n### Recon\n\nShow version\n\n```\nSHOW SERVER_VERSION;\n```\n\nShow system status\n\n```sql {.wrap}\n\\conninfo\n```\n\nShow environmental variables\n\n```sql {.wrap}\nSHOW ALL;\n```\n\nList users\n\n```sql {.wrap}\nSELECT rolname FROM pg_roles;\n```\n\nShow current user\n\n```sql {.wrap}\nSELECT current_user;\n```\n\nShow current user's permissions\n\n```\n\\du\n```\n\nShow current database\n\n```sql {.wrap}\nSELECT current_database();\n```\n\nShow all tables in database\n\n```sql {.wrap}\n\\dt\n```\n\nList functions\n\n```sql {.wrap}\n\\df <schema>\n```\n\n### Databases\n\nList databases\n\n```sql {.wrap}\n\\l\n```\n\nConnect to database\n\n```sql {.wrap}\n\\c <database_name>\n```\n\nShow current database\n\n```sql {.wrap}\nSELECT current_database();\n```\n\n[Create database](http://www.postgresql.org/docs/current/static/sql-createdatabase.html)\n\n```sql {.wrap}\nCREATE DATABASE <database_name> WITH OWNER <username>;\n```\n\n[Drop database](http://www.postgresql.org/docs/current/static/sql-dropdatabase.html)\n\n```sql {.wrap}\nDROP DATABASE IF EXISTS <database_name>;\n```\n\n[Rename database](http://www.postgresql.org/docs/current/static/sql-alterdatabase.html)\n\n```sql {.wrap}\nALTER DATABASE <old_name> RENAME TO <new_name>;\n```\n\n### Tables\n\nList tables, in current db\n\n```sql {.wrap}\n\\dt\n\nSELECT table_schema,table_name FROM information_schema.tables ORDER BY table_schema,table_name;\n```\n\nList tables, globally\n\n```sql {.wrap}\n\\dt *.*.\n\nSELECT * FROM pg_catalog.pg_tables\n```\n\nList table schema\n\n```sql {.wrap}\n\\d <table_name>\n\\d+ <table_name>\n\nSELECT column_name, data_type, character_maximum_length\nFROM INFORMATION_SCHEMA.COLUMNS\nWHERE table_name = '<table_name>';\n```\n\n[Create table](http://www.postgresql.org/docs/current/static/sql-createtable.html)\n\n```sql {.wrap}\nCREATE TABLE <table_name>(\n  <column_name> <column_type>,\n  <column_name> <column_type>\n);\n```\n\nCreate table, with an auto-incrementing primary key\n\n```sql {.wrap}\nCREATE TABLE <table_name> (\n  <column_name> SERIAL PRIMARY KEY\n);\n```\n\n[Delete table](http://www.postgresql.org/docs/current/static/sql-droptable.html)\n\n```sql {.wrap}\nDROP TABLE IF EXISTS <table_name> CASCADE;\n```\n\n### Permissions\n\nBecome the postgres user, if you have permission errors\n\n```shell\nsudo su - postgres\npsql\n```\n\n[Grant](http://www.postgresql.org/docs/current/static/sql-grant.html) all permissions on database\n\n```sql {.wrap}\nGRANT ALL PRIVILEGES ON DATABASE <db_name> TO <user_name>;\n```\n\nGrant connection permissions on database\n\n```sql {.wrap}\nGRANT CONNECT ON DATABASE <db_name> TO <user_name>;\n```\n\nGrant permissions on schema\n\n```sql {.wrap}\nGRANT USAGE ON SCHEMA public TO <user_name>;\n```\n\nGrant permissions to functions\n\n```sql {.wrap}\nGRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO <user_name>;\n```\n\nGrant permissions to select, update, insert, delete, on a all tables\n\n```sql {.wrap}\nGRANT SELECT, UPDATE, INSERT ON ALL TABLES IN SCHEMA public TO <user_name>;\n```\n\nGrant permissions, on a table\n\n```sql {.wrap}\nGRANT SELECT, UPDATE, INSERT ON <table_name> TO <user_name>;\n```\n\nGrant permissions, to select, on a table\n\n```sql {.wrap}\nGRANT SELECT ON ALL TABLES IN SCHEMA public TO <user_name>;\n```\n\n### Columns\n\n[Add column](http://www.postgresql.org/docs/current/static/sql-altertable.html)\n\n```sql {.wrap}\nALTER TABLE <table_name> IF EXISTS\nADD <column_name> <data_type> [<constraints>];\n```\n\nUpdate column\n\n```sql {.wrap}\nALTER TABLE <table_name> IF EXISTS\nALTER <column_name> TYPE <data_type> [<constraints>];\n```\n\nDelete column\n\n```sql {.wrap}\nALTER TABLE <table_name> IF EXISTS\nDROP <column_name>;\n```\n\nUpdate column to be an auto-incrementing primary key\n\n```sql {.wrap}\nALTER TABLE <table_name>\nADD COLUMN <column_name> SERIAL PRIMARY KEY;\n```\n\nInsert into a table, with an auto-incrementing primary key\n\n```sql {.wrap}\nINSERT INTO <table_name>\nVALUES (DEFAULT, <value1>);\n\n\nINSERT INTO <table_name> (<column1_name>,<column2_name>)\nVALUES ( <value1>,<value2> );\n```\n\n### Data\n\n[Select](http://www.postgresql.org/docs/current/static/sql-select.html) all data\n\n```sql {.wrap}\nSELECT * FROM <table_name>;\n```\n\nRead one row of data\n\n```sql {.wrap}\nSELECT * FROM <table_name> LIMIT 1;\n```\n\nSearch for data\n\n```sql {.wrap}\nSELECT * FROM <table_name> WHERE <column_name> = <value>;\n```\n\n[Insert](http://www.postgresql.org/docs/current/static/sql-insert.html) data\n\n```sql {.wrap}\nINSERT INTO <table_name> VALUES( <value_1>, <value_2> );\n```\n\n[Update](http://www.postgresql.org/docs/current/static/sql-update.html) data\n\n```sql {.wrap}\nUPDATE <table_name>\nSET <column_1> = <value_1>, <column_2> = <value_2>\nWHERE <column_1> = <value>;\n```\n\n[Delete](http://www.postgresql.org/docs/current/static/sql-delete.html) all data\n\n```sql {.wrap}\nDELETE FROM <table_name>;\n```\n\nDelete specific data\n\n```sql {.wrap}\nDELETE FROM <table_name>\nWHERE <column_name> = <value>;\n```\n\n### Users\n\nList roles\n\n```sql {.wrap}\nSELECT rolname FROM pg_roles;\n```\n\n[Create user](http://www.postgresql.org/docs/current/static/sql-createuser.html)\n\n```sql {.wrap}\nCREATE USER <user_name> WITH PASSWORD '<password>';\n```\n\n[Drop user](http://www.postgresql.org/docs/current/static/sql-dropuser.html)\n\n```sql {.wrap}\nDROP USER IF EXISTS <user_name>;\n```\n\n[Alter](http://www.postgresql.org/docs/current/static/sql-alterrole.html) user password\n\n```sql {.wrap}\nALTER ROLE <user_name> WITH PASSWORD '<password>';\n```\n\n### Schema\n\nList schemas\n\n```sql {.wrap}\n\\dn\n\nSELECT schema_name FROM information_schema.schemata;\n\nSELECT nspname FROM pg_catalog.pg_namespace;\n```\n\n[Create schema](http://www.postgresql.org/docs/current/static/sql-createschema.html)\n\n```sql {.wrap}\nCREATE SCHEMA IF NOT EXISTS <schema_name>;\n```\n\n[Drop schema](http://www.postgresql.org/docs/current/static/sql-dropschema.html)\n\n```sql {.wrap}\nDROP SCHEMA IF EXISTS <schema_name> CASCADE;\n```\n\n### Dates\n\nShow [current date](https://www.postgresql.org/docs/15/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT) YYYY-MM-DD\n\n```sql {.wrap}\nSELECT current_date;\n```\n\nCalculate\n[age](<https://www.postgresql.org/docs/15/functions-datetime.html#:~:text=age%20(%20timestamp%2C%20timestamp%20)%20%E2%86%92%20interval>)\nbetween two dates\n\n```sql {.wrap}\nSELECT age(timestamp, timestamp);\n```\n\nShow [current time](https://www.postgresql.org/docs/15/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT) with time\nzone\n\n```sql {.wrap}\nSELECT current_time;\n```\n\n[Make](<https://www.postgresql.org/docs/15/functions-datetime.html#:~:text=make_date%20(%20year%20int%2C%20month%20int%2C%20day%20int%20)%20%E2%86%92%20date>)\ndates using integers\n\n```sql {.wrap}\nSELECT make_date(2021,03,25);\n```\n\n## PostgreSQL Commands\n\n### Tables\n\n| -                | -                               |\n| ---------------- | :------------------------------ |\n| `\\d <table>`     | Describe table                  |\n| `\\d+ <table>`    | Describe table with details     |\n| `\\dt`            | List tables from current schema |\n| `\\dt *.*`        | List tables from all schemas    |\n| `\\dt <schema>.*` | List tables for a schema        |\n| `\\dp`            | List table access privileges    |\n| `\\det[+]`        | List foreign tables             |\n\n### Query buffer\n\n| -            | -                                  |\n| ------------ | :--------------------------------- |\n| `\\e [FILE]`  | Edit the query buffer (or file)    |\n| `\\ef [FUNC]` | Edit function definition           |\n| `\\p`         | Show the contents                  |\n| `\\r`         | Reset (clear) the query buffer     |\n| `\\s [FILE]`  | Display history or save it to file |\n| `\\w FILE`    | Write query buffer to file         |\n\n### Informational {.row-span-4}\n\n| -               | -                               |\n| --------------- | :------------------------------ |\n| `\\l[+]`         | List all databases              |\n| `\\dn[S+]`       | List schemas                    |\n| `\\di[S+]`       | List indexes                    |\n| `\\du[+]`        | List roles                      |\n| `\\ds[S+]`       | List sequences                  |\n| `\\df[antw][S+]` | List functions                  |\n| `\\deu[+]`       | List user mappings              |\n| `\\dv[S+]`       | List views                      |\n| `\\dl`           | List large objects              |\n| `\\dT[S+]`       | List data types                 |\n| `\\da[S]`        | List aggregates                 |\n| `\\db[+]`        | List tablespaces                |\n| `\\dc[S+]`       | List conversions                |\n| `\\dC[+]`        | List casts                      |\n| `\\ddp`          | List default privileges         |\n| `\\dd[S]`        | Show object descriptions        |\n| `\\dD[S+]`       | List domains                    |\n| `\\des[+]`       | List foreign servers            |\n| `\\dew[+]`       | List foreign-data wrappers      |\n| `\\dF[+]`        | List text search configurations |\n| `\\dFd[+]`       | List text search dictionaries   |\n| `\\dFp[+]`       | List text search parsers        |\n| `\\dFt[+]`       | List text search templates      |\n| `\\dL[S+]`       | List procedural languages       |\n| `\\do[S]`        | List operators                  |\n| `\\dO[S+]`       | List collations                 |\n| `\\drds`         | List per-database role settings |\n| `\\dx[+]`        | List extensions                 |\n\n`S`: show system objects, `+`: additional detail\n\n### Connection\n\n| -                      | -                           |\n| ---------------------- | :-------------------------- |\n| `\\c [DBNAME]`          | Connect to new database     |\n| `\\encoding [ENCODING]` | Show or set client encoding |\n| `\\password [USER]`     | Change the password         |\n| `\\conninfo`            | Display information         |\n\n### Formatting\n\n| -                         | -                                          |\n| ------------------------- | :----------------------------------------- |\n| `\\a`                      | Toggle between unaligned and aligned       |\n| `\\C [STRING]`             | Set table title, or unset if none          |\n| `\\f [STRING]`             | Show or set field separator for unaligned  |\n| `\\H`                      | Toggle HTML output mode                    |\n| <code>\\t [on\\|off]</code> | Show only rows                             |\n| `\\T [STRING]`             | Set or unset HTML \\<table\\> tag attributes |\n| <code>\\x [on\\|off]</code> | Toggle expanded output                     |\n\n### Input/Output\n\n| -                 | -                                                              |\n| ----------------- | :------------------------------------------------------------- |\n| `\\copy ...`       | Import/export table<br> _See also:_ [copy](#import-export-csv) |\n| `\\echo [STRING]`  | Print string                                                   |\n| `\\i FILE`         | Execute file                                                   |\n| `\\o [FILE]`       | Export all results to file                                     |\n| `\\qecho [STRING]` | String to output stream                                        |\n\n### Variables\n\n| -                     | -                                             |\n| --------------------- | :-------------------------------------------- |\n| `\\prompt [TEXT] NAME` | Set variable                                  |\n| `\\set [NAME [VALUE]]` | Set variable _(or list all if no parameters)_ |\n| `\\unset NAME`         | Delete variable                               |\n\n### Misc\n\n| -                              | -                    |\n| ------------------------------ | :------------------- |\n| `\\cd [DIR]`                    | Change the directory |\n| <code>\\timing [on\\|off]</code> | Toggle timing        |\n| `\\! [COMMAND]`                 | Execute in shell     |\n| `\\! ls -l`                     | List all in shell    |\n\n### Large Objects\n\n- `\\lo_export LOBOID FILE`\n- `\\lo_import FILE [COMMENT]`\n- `\\lo_list`\n- `\\lo_unlink LOBOID`\n\n{.marker-none}\n\n## Miscellaneous\n\n### Backup\n\nUse pg_dumpall to backup all databases\n\n```shell script\n$ pg_dumpall -U postgres > all.sql\n```\n\nUse pg_dump to backup a database\n\n```shell script\n$ pg_dump -d mydb -f mydb_backup.sql\n```\n\n| -    | -                                              |\n| ---- | :--------------------------------------------- |\n| `-a` | Dump only the data, not the schema             |\n| `-s` | Dump only the schema, no data                  |\n| `-c` | Drop database before recreating                |\n| `-C` | Create database before restoring               |\n| `-t` | Dump the named table(s) only                   |\n| `-F` | Format (`c`: custom, `d`: directory, `t`: tar) |\n\nUse `pg_dump -?` to get the full list of options\n\n### Restore\n\nRestore a database with psql\n\n```shell script\n$ psql -U user mydb < mydb_backup.sql\n```\n\nRestore a database with pg_restore\n\n```shell script\n$ pg_restore -d mydb mydb_backup.sql -c\n```\n\n| -    | -                                                                            |\n| ---- | :--------------------------------------------------------------------------- |\n| `-U` | Specify a database user                                                      |\n| `-c` | Drop database before recreating                                              |\n| `-C` | Create database before restoring                                             |\n| `-e` | Exit if an error has encountered                                             |\n| `-F` | Format (`c`: custom, `d`: directory, `t`: tar, `p`: plain text sql(default)) |\n\n{.marker-none}\n\nUse `pg_restore -?` to get the full list of options\n\n### Remote access\n\nGet location of postgresql.conf\n\n```shell script\n$ psql -U postgres -c 'SHOW config_file'\n```\n\nAppend to postgresql.conf\n\n```shell script\nlisten_addresses = '*'\n```\n\nAppend to pg_hba.conf (Same location as postgresql.conf)\n\n```shell script\nhost  all  all  0.0.0.0/0  md5\nhost  all  all  ::/0       md5\n```\n\nRestart PostgreSQL server\n\n```shell script\n$ sudo systemctl restart postgresql\n```\n\n### Import/Export CSV\n\nExport table into CSV file\n\n```shell script\n\\copy table TO '<path>' CSV\n\\copy table(col1,col1) TO '<path>' CSV\n\\copy (SELECT...) TO '<path>' CSV\n```\n\nImport CSV file into table\n\n```shell script\n\\copy table FROM '<path>' CSV\n\\copy table(col1,col1) FROM '<path>' CSV\n```\n\nSee also: [Copy](https://www.postgresql.org/docs/current/sql-copy.html)\n\n## Also see\n\n- [Posgres-cheatsheet](https://gist.github.com/apolloclark/ea5466d5929e63043dcf#posgres-cheatsheet) _(gist.github.com)_\n"
  },
  {
    "path": "source/_posts/postman.md",
    "content": "---\ntitle: Postman\ndate: 2022-11-23 16:23:31.703572\nbackground: bg-[#cf5e3c]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 23 keyboard shortcuts found in Postman\n---\n\n## Keyboard Shortcuts\n\n### Navigational Shortcuts\n\n| Shortcut           | Action                           |\n| ------------------ | -------------------------------- |\n| `Ctrl` `Alt` `1`   | Focus Sidebar                    |\n| `Ctrl` `Alt` `2`   | Focus Builder                    |\n| `Ctrl` `#`         | Focus on #th tab                 |\n| `Ctrl` `Shift` `/` | Switch between tabs              |\n| `Down`             | Move to next item                |\n| `Up`               | Move to previous item            |\n| `Right`            | Expand collection/folder         |\n| `Left`             | Collapse collection/folder       |\n| `Shift` `Down`     | Select current AND next item     |\n| `Shift` `Up`       | Select current AND previous item |\n| `Ctrl` `F`         | Search sidebar                   |\n| `Enter`            | Open request in a tab            |\n\n{.shortcuts}\n\n### Manipulation Shortcuts\n\n| Shortcut   | Action      |\n| ---------- | ----------- |\n| `Ctrl` `C` | Copy        |\n| `Ctrl` `V` | Paste       |\n| `Delete`   | Delete      |\n| `Ctrl` `D` | Duplicate   |\n| `Ctrl` `E` | Edit/Rename |\n\n{.shortcuts}\n\n### Global Shortcuts\n\n| Shortcut           | Action         |\n| ------------------ | -------------- |\n| `Ctrl` `S`         | Save           |\n| `Ctrl` `Shift` `S` | Save As        |\n| `Ctrl` `Enter`     | Send Request   |\n| `Ctrl` `\\`         | Toggle Sidebar |\n| `Ctrl` `L`         | Jump to URL    |\n| `Ctrl` `Alt` `C`   | Open Console   |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Postman](https://learning.getpostman.com/docs/postman/launching_postman/keyboard_shortcuts/)\n  _(learning.getpostman.com)_\n"
  },
  {
    "path": "source/_posts/powershell.md",
    "content": "---\ntitle: PowerShell\ndate: 2020-11-25 18:28:43\nbackground: bg-[#397fe4]\ntags:\n  - script\n  - windows\ncategories:\n  - Programming\n  - Operating System\nintro: This is a quick reference cheat sheet to getting started with PowerShell scripting.\nplugins:\n  - copyCode\n---\n\n## Basic Commands\n\n### Helper Commands\n\n**_Powershell follows Verb-Noun format for their commands._**\n\nSome common Verbs:\n\n| Verb    | Description                                       |\n| ------- | ------------------------------------------------- |\n| Get     | Used to retrieve information.                     |\n| Set     | Used to configure or change settings.             |\n| New     | Used to create new instances of objects.          |\n| Remove  | Used to delete or remove items.                   |\n| Invoke  | Used to execute a specific action or operation.   |\n| Start   | Used to initiate a process or operation.          |\n| Stop    | Used to halt or terminate a process or operation. |\n| Enable  | Used to activate or enable a feature.             |\n| Disable | Used to deactivate or disable a feature.          |\n| Test    | Used to perform tests or checks.                  |\n| Update  | Used to update or refresh data or configurations. |\n\nLists available modules\n\n```powershell\nGet-Module --ListAvailable\n```\n\nLists available cmdlets and functions.\n\n```powershell\nGet-Command -Module ActiveDirectory\n```\n\nRetrieves help\n\n```powershell\nGet-Help <cmd>\nGet-Help <cmd> -Examples\nGet-Help -Name Get-Process -Parameter Id\n```\n\nLists aliases and their corresponding cmdlet names.\n\n```powershell\nGet-Alias | Select-Object Name, Definition\n```\n\n**Get-Member:** Displays the properties and methods of objects.\n\n```powershell\nGet-Process | Get-Member\n```\n\n### Object Manipulation {.col-span-2}\n\n**Select-Object:** Selects specific properties from objects or customizes their display.\n\n```powershell\nGet-Process | Select-Object Name, CPU\n```\n\n**Where-Object:** Filters objects based on specified conditions.\n\n```powershell\nGet-Service | Where-Object { $PSItem.Status -eq 'Running' }\n#OR\nGet-Service | ? { $_.Status -eq 'Running' }\n```\n\n**Measure-Object:** Calculates statistics, like sum, average, and count, for object properties.\n\n```powershell\nGet-Process | Measure-Object -Property WorkingSet -Sum\n```\n\n**ForEach-Object:** Performs an operation on each object in a collection. (BEAWARE: Below command will prefix of\nfiles/folder in the current dir)\n\n```powershell\nGet-ChildItem | ForEach-Object { Rename-Item $_ -NewName \"Prefix_$_\" }\n```\n\n**Sort-Object:** Sorts objects by specified properties.\n\n```powershell\nGet-ChildItem | Sort-Object Length -Descending\n```\n\n**Format-Table:** Formats output as a table with specified columns.\n\n```powershell\nGet-Service | Format-Table -AutoSize  # ft alias\n```\n\n**Format-List:** Formats output as a list of properties and values.\n\n```powershell\nGet-Process | Format-List -Property Name, CPU  # fl alias\n```\n\n### FileSystem {.col-span-2}\n\n```powershell\nNew-Item -path file.txt -type 'file' -value 'contents'\nNew-Item -path file.txt -type 'dir'\nCopy-Item <src> -destination <dest>\nMove-Item -path  <src> -destination <dest>\nRemove-Item <file>\nTest-Path <path>\nRename-Item -path <path> -newname <newname>\n\n# using .NET Base Class Library\n[System.IO.File]::WriteAllText('test.txt', '')\n[System.IO.File]::Delete('test.txt')\n\nGet-Content -Path \"test.txt\"\nGet-Process | Out-File -FilePath \"processes.txt\"# Output to file\nGet-Process | Export-Csv -Path \"processes.csv\"  # Output to csv\n$data = Import-Csv -Path \"data.csv\"             # Import from csv\n```\n\n## System Management\n\n### Windows Management Instrumentation {.col-span-2}\n\n```powershell\n# Retrieve BIOS information\nGet-CimInstance -ClassName Win32_BIOS\n# Retrieve information about locally connected physical disk devices\nGet-CimInstance -ClassName Win32_DiskDrive\n# Retrieve information about install physical memory (RAM)\nGet-CimInstance -ClassName Win32_PhysicalMemory\n# Retrieve information about installed network adapters (physical + virtual)\nGet-CimInstance -ClassName Win32_NetworkAdapter\n# Retrieve information about installed graphics / video card (GPU)\nGet-CimInstance -ClassName Win32_VideoController\n\n# List all the classNames\nGet-CimClass | Select-Object -ExpandProperty CimClassName\n# Explore the various WMI classes available in the root\\cimv2 namespace\nGet-CimClass -Namespace root\\cimv2\n# Explore the child WMI namespaces underneath the root\\cimv2 namespace\nGet-CimInstance -Namespace root -ClassName __NAMESPACE\n\n\n```\n\n### Network Management\n\n```powershell\n# Test network connectivity to a remote host\nTest-Connection -ComputerName google.com\n\n# Retrieve network adapter information\nGet-NetAdapter\n\n# Retrieve IP address information\nGet-NetIPAddress\n\n# Retrieve routing table information\nGet-NetRoute\n\n# Test if a port is open on a remote host\nTest-NetConnection google.com -Port 80\n\n```\n\n### User & Group Management {.col-span-2}\n\n```powershell\n# Retrieve local user account information\nGet-LocalUser\n\n# Create a new local user account\nNew-LocalUser -Name NewUser -Password (ConvertTo-SecureString \"Password123\" -AsPlainText -Force)\n\n# Remove a local user account\nRemove-LocalUser -Name UserToRemove\n\n# Retrieve local group information\nGet-LocalGroup\n\n# Add a member to a local group\nAdd-LocalGroupMember -Group Administrators -Member UserToAdd\n```\n\n### Security & Permissions\n\n```powershell\n# Retrieve access control lists for file/dir\nGet-Acl C:\\Path\\To\\File.txt\n\n# Set access control lists for a file/dir\nSet-Acl -Path C:\\Path\\To\\File.txt -AclObject $aclObject\n```\n\n### Registry Management {.col-span-2}\n\n```powershell\n# Retrieve registry key values\nGet-ItemProperty -Path \"HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*\" | Select DisplayName, DisplayVersion\n\n# Set registry key values\nSet-ItemProperty -Path \"HKLM:\\Software\\MyApp\" -Name \"SettingName\" -Value \"NewValue\"\n\n# Create a new registry key value\nNew-ItemProperty -Path \"HKCU:\\Software\\MyApp\" -Name \"NewSetting\" -Value \"NewValue\" -PropertyType String\n\n# Remove a registry key value\nRemove-ItemProperty -Path \"HKCU:\\Software\\MyApp\" -Name \"SettingToRemove\"\n\n# Check if a registry key exists\nTest-Path \"HKLM:\\Software\\MyApp\"\n```\n\n## Scripting\n\n### Variables {.col-span-2}\n\nInitializing a variable with/without a specified type:\n\n```powershell\n$var = 0\n[int] $var = 'Trevor'         # (throws an exception)\n[string] $var = 'Trevor'      # (doesn't throw an exception)\n$var.GetType()\n\n# Multiple Assigning\n$a,$b,$c = 'a','b','c'\n\n# Create an array\n$arrayvar = @('va1','va2')\n\n# Create dict\n$dict = @{k1 = 'test'; k2 = 'best'}\n```\n\nVariable Commands\n\n```powershell\nNew-Variable -Name FirstName -Value Trevor\nNew-Variable FirstName -Value Trevor -Option <ReadOnly/Constant>\n\nGet-Variable\nGet-Variable | ? { $PSItem.Options -contains 'constant' }\nGet-Variable | ? { $PSItem.Options -contains 'readonly' }\n\nRemove-Variable -Name firstname\n# Removes ReadOnly var\nRemove-Variable -Name firstname -Force\n```\n\nVariable types int32, int64, string, bool\n\n### Operators\n\n```powershell\n# operators\n# (a <op> b)\n\n= , += / -= , ++ / --\n-eq / -ne , -lt / -gt , -le / -ge\n\n$FirstName = 'Trevor'\n$FirstName -like 'T*'\n$true; $false #bool true/false\n\n# ternary operator\n$FoodToEat = $BaconIsYummy ? 'bacon' : 'beets'\n\n# -notin or -in\n'Celery' -in @('Bacon', 'Sausage', 'Steak')\n\n# output: True\n5 -is [int32]\n\n# regex match, array can be use\n'Trevor' -match '^T\\w*'\n\n# Find multiple matches.\n$regex = [regex]'(\\w*)'\n$regex.Matches('this is test').Value\n\n```\n\n### Structure\n\n#### I/O operation\n\n```powershell\n\"This displays a string\"\n\nWrite-Host \"color\" -ForegroundColor Red\n\n$age = Read-host \"Enter age\"\n\n$pwd = Read-host \"password\" -asSecureString\n\nClear-Host\n```\n\n#### Flow Controls\n\n```powershell\nIF(<#Condition#>){\n<#Commands#>}ELSEIF(){}ELSE{}\n\nSwitch($var){\n\t\"val1\"{<#Commands#>; break}\n    \"val2\"{<#Commands#>; break}\n}\n\nFor($ct=0;$ct -le 3;$ct++){}\n\nForEach($var in $arr){}\n\nwhile($var -ne 0){}\n\nDo{}While()\n\n```\n\n### Function / Modules {.row-span-2}\n\n#### Example 1\n\n```powershell\nfunction funcname{\n\n    [CmdletBinding()]\n\tparam(\n\t\t[Parameter(Mandatory)]\n\t\t[String]$user\n\t)\n\tWrite-Host \"welcome \" $user\n    return \"value\"\n}\n$var = funcname -user pcb\n```\n\n#### Example 2\n\n```powershell\nfunction Get-EvenNumbers {\n    [CmdletBinding()]\n    param (\n        [Parameter(ValueFromPipeline = $true)]\n        [int] $Number\n    )\n    begin {<#command#>}\n    process {\n        if ($Number % 2 -eq 0) {\n            Write-Output $Number\n        }\n    }\n    end {<#command#>}\n}\n1..10 | Get-EvenNumbers\n\n```\n\n#### Modules\n\n```powershell\n# PowerShell looks module in the path\n$env:PSModulePath\n\n# lists all modules installed on system\nGet-Module -ListAvailable\n# modules imported into current session\nGet-Module\n\nImport-Module <moduleName>\nRemove-Module <moduleName>\n\nFind-Module -Tag cloud\nFind-Module -Name ps*\n\n# Create an in-memory PowerShell module\nNew-Module -Name trevor -ScriptBlock {\n  function Add($a,$b) { $a + $b } }\n\n\n```\n\n### Tips\n\n- In most of the languages, escape character is backslash **\\\\** whereas in PowerShell it is backtick **`**\n\n```powershell\n\n```\n\n## Also see {.cols-1}\n\n- [Microsoft PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/samples/sample-scripts-for-administration?view=powershell-7.3)\n  _(learn.microsoft.com)_\n"
  },
  {
    "path": "source/_posts/principle.md",
    "content": "---\ntitle: Principle\ndate: 2022-11-23 16:23:31.698567\nbackground: bg-[#b245c6]\nlabel: Mac\ntags:\n  -\n  - mac\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 30 keyboard shortcuts found in Principle. This application is MacOS-only.\n---\n\n## Keyboard Shortcuts\n\n### Layers {.row-span-2}\n\n| Shortcut          | Action                   |\n| ----------------- | ------------------------ |\n| `R`               | Add rectangle            |\n| `Opt` `R`         | Add rectangle as a child |\n| `T`               | Add text                 |\n| `Opt` `T`         | Add text as a child      |\n| `A`               | Add artboard             |\n| `Cmd` `G`         | Group                    |\n| `Cmd` `Shift` `G` | Ungroup                  |\n| `Cmd` `]`         | Bring forward            |\n| `Cmd` `Shift` `]` | Bring to front           |\n| `Cmd` `[`         | Send backward            |\n| `Cmd` `Shift` `[` | Send to back             |\n\n{.shortcuts}\n\n### Editing\n\n| Shortcut           | Action       |\n| ------------------ | ------------ |\n| `(arrows)`         | Nudge        |\n| `Shift` `(arrows)` | Large nudge  |\n| `Cmd` `D`          | Duplicate    |\n| `Cmd` `R`          | Rename layer |\n\n{.shortcuts}\n\n### Canvas Navigation\n\n| Shortcut         | Action              |\n| ---------------- | ------------------- |\n| `Space` `(drag)` | Pan                 |\n| `Cmd` `=`        | Zoom in             |\n| `Cmd` `-`        | Zoom out            |\n| `Cmd` `1`        | Zoom all            |\n| `Cmd` `2`        | Zoom selection      |\n| `Cmd` `3`        | Center selection    |\n| `Cmd` `0`        | Zoom to actual size |\n\n{.shortcuts}\n\n### Selection\n\n| Shortcut      | Action                  |\n| ------------- | ----------------------- |\n| `Esc`         | Select parent           |\n| `Enter`       | Select child            |\n| `Tab`         | Select next sibling     |\n| `Shift` `Tab` | Select previous sibling |\n| `Cmd` `A`     | Select all siblings     |\n\n{.shortcuts}\n\n### Preview\n\n| Shortcut         | Action                               |\n| ---------------- | ------------------------------------ |\n| `W`              | Rewind prototype                     |\n| `Ctrl` `V`       | Start recording video                |\n| `Ctrl` `Opt` `V` | Start recording video without cursor |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Principle](https://principleformac.com/docs.html#shortcuts) _(principleformac.com)_\n"
  },
  {
    "path": "source/_posts/proto-io.md",
    "content": "---\ntitle: Proto.io\ndate: 2022-11-23 16:23:31.694775\nbackground: bg-[#5697a9]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 48 keyboard shortcuts found in Proto.io\n---\n\n## Keyboard Shortcuts\n\n### Main\n\n| Shortcut           | Action                  |\n| ------------------ | ----------------------- |\n| `Ctrl` `F`         | Find                    |\n| `Ctrl` `K`         | Show keyboard shortcuts |\n| `Ctrl` `S`         | Save                    |\n| `Esc`              | Close modal windows     |\n| `Shift` `P`        | Preview                 |\n| `Ctrl` `Shift` `S` | Save and Preview        |\n\n{.shortcuts}\n\n### History\n\n| Shortcut           | Action                |\n| ------------------ | --------------------- |\n| `Ctrl` `Z`         | Undo                  |\n| `Ctrl` `Shift` `Z` | Redo                  |\n| `Ctrl` `[`         | Go to previous canvas |\n| `Ctrl` `]`         | Go to next canvas     |\n\n{.shortcuts}\n\n### Edit\n\n| Shortcut    | Action     |\n| ----------- | ---------- |\n| `Ctrl` `A`  | Select all |\n| `Ctrl` `X`  | Cut        |\n| `Ctrl` `C`  | Copy       |\n| `Ctrl` `V`  | Paste      |\n| `Ctrl` `D`  | Duplicate  |\n| `Backspace` | Delete     |\n\n{.shortcuts}\n\n### Grid\n\n| Shortcut   | Action                                |\n| ---------- | ------------------------------------- |\n| `Ctrl` `'` | Toggle grid                           |\n| `Ctrl` `\\` | Toggle grid system                    |\n| `Ctrl` `;` | Toggle custom guides                  |\n| `Ctrl` `L` | Toggle smart guides                   |\n| `Alt`      | Toggle snap to grid on drag or resize |\n\n{.shortcuts}\n\n### View\n\n| Shortcut       | Action                                                                       |\n| -------------- | ---------------------------------------------------------------------------- |\n| `Ctrl` `+`     | Zoom in                                                                      |\n| `Ctrl` `-`     | Zoom out                                                                     |\n| `Ctrl` `0`     | Zoom to 100%                                                                 |\n| `Ctrl` `1`     | Fit to screen                                                                |\n| `Ctrl` `2`     | Zoom to selected layers, or fit all layers if none selected                  |\n| `Ctrl` `3`     | Center selected layer(s) in the canvas, or center on screen if none selected |\n| `Ctrl` `Right` | Toggle right pane                                                            |\n| `Ctrl` `Left`  | Toggle left pane                                                             |\n| `Space`        | Pan canvas while keydown                                                     |\n\n{.shortcuts}\n\n### Item\n\n| Shortcut              | Action                                    |\n| --------------------- | ----------------------------------------- |\n| `Ctrl` `Up`           | Bring to front                            |\n| `Ctrl` `Down`         | Send to back                              |\n| `Ctrl` `Shift` `Up`   | Bring forward                             |\n| `Ctrl` `Shift` `Down` | Send backwards                            |\n| `(arrows)`            | Move item                                 |\n| `Shift` `(arrows)`    | Snap item                                 |\n| `Shift`               | Lock drag direction (hold while dragging) |\n| `R`                   | Insert rectangle                          |\n| `O`                   | Insert oval                               |\n| `L`                   | Insert line                               |\n| `T`                   | Insert text                               |\n| `I`                   | Insert interaction area                   |\n| `Enter`               | Enter selected container                  |\n\n{.shortcuts}\n\n### Group\n\n| Shortcut           | Action           |\n| ------------------ | ---------------- |\n| `Ctrl` `G`         | Group selected   |\n| `Ctrl` `Shift` `G` | Ungroup selected |\n\n{.shortcuts}\n\n### States Preview\n\n| Shortcut | Action                         |\n| -------- | ------------------------------ |\n| `Space`  | Play or pause state transition |\n| `.`      | Forward state transition       |\n| `,`      | Rewind state transition        |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Proto.io](https://support.proto.io/hc/en-us/articles/115001423511-Keyboard-shortcuts)\n  _(support.proto.io)_\n"
  },
  {
    "path": "source/_posts/putty.md",
    "content": "---\ntitle: PuTTy\ndate: 2022-11-23 16:23:31.701654\nbackground: bg-[#0403ed]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 32 keyboard shortcuts found on the PuTTy app\n---\n\n## Keyboard Shortcuts\n\n### General Shortcuts\n\n| Shortcut               | Action                                               |\n| ---------------------- | ---------------------------------------------------- |\n| `Ctrl` `(right click)` | Open context menu                                    |\n| `Ctrl` `A`             | Jump to the start of the line                        |\n| `Ctrl` `B`             | Move back a character                                |\n| `Ctrl` `C`             | Terminal the command                                 |\n| `Ctrl` `D`             | Delete from under the cursor                         |\n| `Ctrl` `E`             | Jump to the end of the line                          |\n| `Ctrl` `F`             | Move forward a character                             |\n| `Ctrl` `K`             | Delete to end-of-line                                |\n| `Ctrl` `L`             | Clear the screen                                     |\n| `Ctrl` `R`             | Search the history backwards                         |\n| `Ctrl` `Shift` `R`     | Search the history backwards with multi occurrence   |\n| `Ctrl` `U`             | Delete backward from cursor                          |\n| `Ctrl` `X` `X`         | Move between end-of-line and current cursor position |\n| `Ctrl` `X` `@`         | Show possible hostname completions                   |\n| `Ctrl` `Z`             | Suspend or stop the command                          |\n| `Alt` `Left`           | Move to the first line in the history                |\n| `Alt` `Right`          | Move to the last line in the history                 |\n| `Alt` `?`              | Show current completion list                         |\n| `Alt` `*`              | Insert all possible completions                      |\n| `Alt` `/`              | Attempt to complete filename                         |\n| `Alt` `.`              | Yank last argument to previous command               |\n| `Alt` `B`              | Move backward                                        |\n| `Alt` `C`              | Capitalize the word                                  |\n| `Alt` `D`              | Delete word                                          |\n| `Alt` `F`              | Move forward                                         |\n| `Alt` `L`              | Make word lowercase                                  |\n| `Alt` `N`              | Search the history forwards non-incremental          |\n| `Alt` `P`              | Search the history backwards non-incremental         |\n| `Alt` `R`              | Recall command                                       |\n| `Alt` `T`              | Move words around                                    |\n| `Alt` `U`              | Make word uppercase                                  |\n| `Alt` `Backspace`      | Delete backwards from the cursor                     |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for PuTTy](http://rizwanansari.net/putty-shell-keyboard-shortcuts/) _(rizwanansari.net)_\n"
  },
  {
    "path": "source/_posts/python.md",
    "content": "---\ntitle: Python\ndate: 2020-12-23 18:41:20\nbackground: bg-[#436b97]\ntags:\n  - script\n  - interpret\ncategories:\n  - Programming\nintro: |\n  The [Python](https://www.python.org/) cheat sheet is a one-page reference sheet for the Python 3 programming language.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### Introduction\n\n- [Python](https://www.python.org/) _(python.org)_\n- [Python Document](https://docs.python.org/3/index.html) _(docs.python.org)_\n- [Learn X in Y minutes](https://learnxinyminutes.com/docs/python/) _(learnxinyminutes.com)_\n- [Regex in python](/regex#regex-in-python) _(cheatsheets.zip)_\n\n### Hello World\n\n```python\n>>> print(\"Hello, World!\")\nHello, World!\n```\n\nThe famous \"Hello World\" program in Python\n\n### Variables\n\n```python\nage = 18      # age is of type int\nname = \"John\" # name is now of type str\nprint(name)\n```\n\nPython can't declare a variable without assignment.\n\n### Data Types {.row-span-2}\n\n|                                    |          |\n| ---------------------------------- | -------- |\n| `str`                              | Text     |\n| `int`, `float`, `complex`          | Numeric  |\n| `list`, `tuple`, `range`           | Sequence |\n| `dict`                             | Mapping  |\n| `set`, `frozenset`                 | Set      |\n| `bool`                             | Boolean  |\n| `bytes`, `bytearray`, `memoryview` | Binary   |\n\nSee: [Data Types](#python-built-in-data-types)\n\n### Slicing String\n\n```python\n>>> msg = \"Hello, World!\"\n>>> print(msg[2:5])\nllo\n```\n\nSee: [Strings](#python-strings)\n\n### Lists\n\n```python\nmylist = []\nmylist.append(1)\nmylist.append(2)\nfor item in mylist:\n    print(item) # prints out 1,2\n```\n\nSee: [Lists](#python-lists)\n\n### If Else\n\n```python\nnum = 200\nif num > 0:\n    print(\"num is greater than 0\")\nelse:\n    print(\"num is not greater than 0\")\n```\n\nSee: [Flow control](#python-flow-control)\n\n### Loops\n\n```python\nfor item in range(6):\n    if item == 3: break\n    print(item)\nelse:\n    print(\"Finally finished!\")\n```\n\nSee: [Loops](#python-loops)\n\n### Functions\n\n```python\n>>> def my_function():\n...     print(\"Hello from a function\")\n...\n>>> my_function()\nHello from a function\n```\n\nSee: [Functions](#python-functions)\n\n### File Handling {.col-span-2}\n\n```python\nwith open(\"myfile.txt\", \"r\", encoding='utf8') as file:\n    for line in file:\n        print(line)\n```\n\nSee: [File Handling](#python-file-handling)\n\n### Arithmetic\n\n```python\nresult = 10 + 30 # => 40\nresult = 40 - 10 # => 30\nresult = 50 * 5  # => 250\nresult = 16 / 4  # => 4.0 (Float Division)\nresult = 16 // 4 # => 4 (Integer Division)\nresult = 25 % 2  # => 1\nresult = 5 ** 3  # => 125\n```\n\nThe `/` means quotient of x and y, and the `//` means floored quotient of x and y, also see\n[StackOverflow](https://stackoverflow.com/a/183870/13192320)\n\n### Plus-Equals\n\n```python\ncounter = 0\ncounter += 10           # => 10\ncounter = 0\ncounter = counter + 10  # => 10\n\nmessage = \"Part 1.\"\n\n# => Part 1.Part 2.\nmessage += \"Part 2.\"\n```\n\n### f-Strings (Python 3.6+)\n\n```python\n>>> website = 'cheatsheets.zip'\n>>> f\"Hello, {website}\"\n\"Hello, cheatsheets.zip\"\n\n>>> num = 10\n>>> f'{num} + 10 = {num + 10}'\n'10 + 10 = 20'\n```\n\nSee: [Python F-Strings](#python-f-strings-since-python-3-6)\n\n## Python Built-in Data Types\n\n### Strings\n\n```python\nhello = \"Hello World\"\nhello = 'Hello World'\n\nmulti_string = \"\"\"Multiline Strings\nLorem ipsum dolor sit amet,\nconsectetur adipiscing elit \"\"\"\n```\n\nSee: [Strings](#python-strings)\n\n### Numbers\n\n```python\nx = 1    # int\ny = 2.8  # float\nz = 1j   # complex\n\n>>> print(type(x))\n<class 'int'>\n```\n\n### Booleans\n\n```python\nmy_bool = True\nmy_bool = False\n\nbool(0)     # => False\nbool(1)     # => True\n```\n\n### Lists\n\n```python\nlist1 = [\"apple\", \"banana\", \"cherry\"]\nlist2 = [True, False, False]\nlist3 = [1, 5, 7, 9, 3]\nlist4 = list((1, 5, 7, 9, 3))\n```\n\nSee: [Lists](#python-lists)\n\n### Tuple\n\n```python\nmy_tuple = (1, 2, 3)\nmy_tuple = tuple((1, 2, 3))\n\ntupla = (1, 2, 3, 'python')\n\nprint(tupla[0])       # Output: 1\nprint(tupla.count(1)) # Count occurrences\nprint(tupla.index(2)) # Find index\n\ntupla1 = (1, 2, 3)\ntupla2 = ('a', 'b')\n\nlen(tuple) → Returns the number of elements.\nin → Checks if an element exists in the tuple.\nConcatenation (+) → Combines two tuples.\nRepetition (*) → Repeats a tuple.\nSlicing (tuple[start:end]) → Extracts a subtuple.\n\nprint(len(tupla1))       # Output: 3\nprint(2 in tupla1)       # Output: True\nprint(tupla1 + tupla2)   # Output: (1, 2, 3, 'a', 'b')\nprint(tupla1[1:])        # Output: (2, 3)\n\n# unpacking\na, b, c, d = tupla   # Each value goes into a variable\n\n```\n\nSimilar to List but immutable\n\n### Set\n\n```python\nset1 = {\"a\", \"b\", \"c\"}\nset2 = set((\"a\", \"b\", \"c\"))\n```\n\nSet of unique items/objects\n\n### Dictionary\n\n```python {.wrap}\n>>> empty_dict = {}\n>>> a = {\"one\": 1, \"two\": 2, \"three\": 3}\n>>> a[\"one\"]\n1\n>>> a.keys()\ndict_keys(['one', 'two', 'three'])\n>>> a.values()\ndict_values([1, 2, 3])\n>>> a.update({\"four\": 4})\n>>> a.keys()\ndict_keys(['one', 'two', 'three', 'four'])\n>>> a['four']\n4\n```\n\nKey: Value pair, JSON like object\n\n### Casting\n\n#### Integers\n\n```python\nx = int(1)   # x will be 1\ny = int(2.8) # y will be 2\nz = int(\"3\") # z will be 3\n```\n\n#### Floats\n\n```python\nx = float(1)     # x will be 1.0\ny = float(2.8)   # y will be 2.8\nz = float(\"3\")   # z will be 3.0\nw = float(\"4.2\") # w will be 4.2\n```\n\n#### Strings\n\n```python\nx = str(\"s1\") # x will be 's1'\ny = str(2)    # y will be '2'\nz = str(3.0)  # z will be '3.0'\n```\n\n## Python Advanced Data Types\n\n### Heaps {.col-span-2 .row-span-3}\n\n```python\nimport heapq\n\nmyList = [9, 5, 4, 1, 3, 2]\nheapq.heapify(myList) # turn myList into a Min Heap\nprint(myList)    # => [1, 3, 2, 5, 9, 4]\nprint(myList[0]) # first value is always the smallest in the heap\n\nheapq.heappush(myList, 10) # insert 10\nx = heapq.heappop(myList)  # pop and return smallest item\nprint(x)                   # => 1\n```\n\n#### Negate all values to use Min Heap as Max Heap\n\n```python\nmyList = [9, 5, 4, 1, 3, 2]\nmyList = [-val for val in myList] # multiply by -1 to negate\nheapq.heapify(myList)\n\nx = heapq.heappop(myList)\nprint(-x) # => 9 (making sure to multiply by -1 again)\n```\n\nHeaps are binary trees for which every parent node has a value less than or equal to any of its children. Useful for\naccessing min/max value quickly. Time complexity: O(n) for heapify, O(log n) push and pop. See:\n[Heapq](https://docs.python.org/3/library/heapq.html)\n\n### Stacks and Queues {.row-span-3}\n\n```python\nfrom collections import deque\n\nq = deque()          # empty\nq = deque([1, 2, 3]) # with values\n\nq.append(4)     # append to right side\nq.appendleft(0) # append to left side\nprint(q)    # => deque([0, 1, 2, 3, 4])\n\nx = q.pop() # remove & return from right\ny = q.popleft() # remove & return from left\nprint(x)    # => 4\nprint(y)    # => 0\nprint(q)    # => deque([1, 2, 3])\n\nq.rotate(1) # rotate 1 step to the right\nprint(q)    # => deque([3, 1, 2])\n```\n\nDeque is a double-ended queue with O(1) time for append/pop operations from both sides. Used as stacks and queues. See:\n[Deque](https://docs.python.org/3/library/collections.html#collections.deque)\n\n## Python Strings\n\n### Array-like\n\n```python\n>>> hello = \"Hello, World\"\n>>> print(hello[1])\ne\n>>> print(hello[-1])\nd\n```\n\nGet the character at position 1 or last\n\n### Looping\n\n```python\n>>> for char in \"foo\":\n...     print(char)\nf\no\no\n```\n\nLoop through the letters in the word \"foo\"\n\n### Slicing string {.row-span-4}\n\n```java\n ┌───┬───┬───┬───┬───┬───┬───┐\n | m | y | b | a | c | o | n |\n └───┴───┴───┴───┴───┴───┴───┘\n 0   1   2   3   4   5   6   7\n-7  -6  -5  -4  -3  -2  -1\n```\n\n---\n\n```python\n>>> s = 'mybacon'\n>>> s[2:5]\n'bac'\n>>> s[0:2]\n'my'\n```\n\n```python\n>>> s = 'mybacon'\n>>> s[:2]\n'my'\n>>> s[2:]\n'bacon'\n>>> s[:2] + s[2:]\n'mybacon'\n>>> s[:]\n'mybacon'\n```\n\n```python\n>>> s = 'mybacon'\n>>> s[-5:-1]\n'baco'\n>>> s[2:6]\n'baco'\n```\n\n#### With a stride\n\n```python\n>>> s = '12345' * 5\n>>> s\n'1234512345123451234512345'\n>>> s[::5]\n'11111'\n>>> s[4::5]\n'55555'\n>>> s[::-5]\n'55555'\n>>> s[::-1]\n'5432154321543215432154321'\n```\n\n### String Length\n\n```python\n>>> hello = \"Hello, World!\"\n>>> print(len(hello))\n13\n```\n\nThe len() function returns the length of a string\n\n### Multiple copies\n\n```python\n>>> s = '===+'\n>>> n = 8\n>>> s * n\n'===+===+===+===+===+===+===+===+'\n```\n\n### Check String\n\n```python\n>>> s = 'spam'\n>>> s in 'I saw spamalot!'\nTrue\n>>> s not in 'I saw The Holy Grail!'\nTrue\n\n```\n\n### Concatenates\n\n```python\n>>> s = 'spam'\n>>> t = 'egg'\n>>> s + t\n'spamegg'\n>>> 'spam' 'egg'\n'spamegg'\n```\n\n### Formatting {.col-span-2}\n\n```python\nname = \"John\"\nprint(\"Hello, %s!\" % name)\n```\n\n```python\nname = \"John\"\nage = 23\nprint(\"%s is %d years old.\" % (name, age))\n```\n\n#### format() Method\n\n```python\ntxt1 = \"My name is {fname}, I'm {age}\".format(fname=\"John\", age=36)\ntxt2 = \"My name is {0}, I'm {1}\".format(\"John\", 36)\ntxt3 = \"My name is {}, I'm {}\".format(\"John\", 36)\n```\n\n### Input\n\n```python\n>>> name = input(\"Enter your name: \")\nEnter your name: Tom\n>>> name\n'Tom'\n```\n\nGet input data from console\n\n### Join\n\n```python\n>>> \"#\".join([\"John\", \"Peter\", \"Vicky\"])\n'John#Peter#Vicky'\n```\n\n### Endswith\n\n```python\n>>> \"Hello, world!\".endswith(\"!\")\nTrue\n```\n\n## Python F-Strings (Since Python 3.6+)\n\n### f-Strings usage\n\n```python\n>>> website = 'cheatsheets.zip'\n>>> f\"Hello, {website}\"\n\"Hello, cheatsheets.zip\"\n\n>>> num = 10\n>>> f'{num} + 10 = {num + 10}'\n'10 + 10 = 20'\n\n>>> f\"\"\"He said {\"I'm John\"}\"\"\"\n\"He said I'm John\"\n\n>>> f'5 {\"{stars}\"}'\n'5 {stars}'\n>>> f'{{5}} {\"stars\"}'\n'{5} stars'\n\n>>> name = 'Eric'\n>>> age = 27\n>>> f\"\"\"Hello!\n...     I'm {name}.\n...     I'm {age}.\"\"\"\n\"Hello!\\n    I'm Eric.\\n    I'm 27.\"\n```\n\nit is available since Python 3.6, also see:\n[Formatted string literals](https://docs.python.org/3/reference/lexical_analysis.html#f-strings)\n\n### f-Strings Fill Align\n\n```python\n>>> f'{\"text\":10}'     # [width]\n'text      '\n>>> f'{\"test\":*>10}'   # fill left\n'******test'\n>>> f'{\"test\":*<10}'   # fill right\n'test******'\n>>> f'{\"test\":*^10}'   # fill center\n'***test***'\n>>> f'{12345:0>10}'    # fill with numbers\n'0000012345'\n```\n\n### f-Strings Type\n\n```python\n>>> f'{10:b}'        # binary type\n'1010'\n>>> f'{10:o}'        # octal type\n'12'\n>>> f'{200:x}'       # hexadecimal type\n'c8'\n>>> f'{200:X}'\n'C8'\n>>> f'{345600000000:e}' # scientific notation\n'3.456000e+11'\n>>> f'{65:c}'       # character type\n'A'\n>>> f'{10:#b}'      # [type] with notation (base)\n'0b1010'\n>>> f'{10:#o}'\n'0o12'\n>>> f'{10:#x}'\n'0xa'\n```\n\n### F-Strings Others\n\n```python\n>>> f'{-12345:0=10}'  # negative numbers\n'-000012345'\n>>> f'{12345:010}'    # [0] shortcut (no align)\n'0000012345'\n>>> f'{-12345:010}'\n'-000012345'\n>>> import math       # [.precision]\n>>> math.pi\n3.141592653589793\n>>> f'{math.pi:.2f}'\n'3.14'\n>>> f'{1000000:,.2f}' # [grouping_option]\n'1,000,000.00'\n>>> f'{1000000:_.2f}'\n'1_000_000.00'\n>>> f'{0.25:0%}'      # percentage\n'25.000000%'\n>>> f'{0.25:.0%}'\n'25%'\n```\n\n### F-Strings Sign\n\n```python\n>>> f'{12345:+}'      # [sign] (+/-)\n'+12345'\n>>> f'{-12345:+}'\n'-12345'\n>>> f'{-12345:+10}'\n'    -12345'\n>>> f'{-12345:+010}'\n'-000012345'\n```\n\n## Python Lists\n\n### Defining\n\n```python\n>>> li1 = []\n>>> li1\n[]\n>>> li2 = [4, 5, 6]\n>>> li2\n[4, 5, 6]\n>>> li3 = list((1, 2, 3))\n>>> li3\n[1, 2, 3]\n>>> li4 = list(range(1, 11))\n>>> li4\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n```\n\n### Generate {.col-span-2}\n\n```python\n>>> list(filter(lambda x : x % 2 == 1, range(1, 20)))\n[1, 3, 5, 7, 9, 11, 13, 15, 17, 19]\n\n>>> [x ** 2 for x in range (1, 11) if  x % 2 == 1]\n[1, 9, 25, 49, 81]\n\n>>> [x for x in [3, 4, 5, 6, 7] if x > 5]\n[6, 7]\n\n>>> list(filter(lambda x: x > 5, [3, 4, 5, 6, 7]))\n[6, 7]\n```\n\n### Append\n\n```python\n>>> li = []\n>>> li.append(1)\n>>> li\n[1]\n>>> li.append(2)\n>>> li\n[1, 2]\n>>> li.append(4)\n>>> li\n[1, 2, 4]\n>>> li.append(3)\n>>> li\n[1, 2, 4, 3]\n```\n\n### List Slicing {.col-span-2 .row-span-3}\n\nSyntax of list slicing:\n\n```python\na_list[start:end]\na_list[start:end:step]\n```\n\n#### Slicing\n\n```python\n>>> a = ['spam', 'egg', 'bacon', 'tomato', 'ham', 'lobster']\n>>> a[2:5]\n['bacon', 'tomato', 'ham']\n>>> a[-5:-2]\n['egg', 'bacon', 'tomato']\n>>> a[1:4]\n['egg', 'bacon', 'tomato']\n```\n\n#### Omitting index\n\n```python\n>>> a[:4]\n['spam', 'egg', 'bacon', 'tomato']\n>>> a[0:4]\n['spam', 'egg', 'bacon', 'tomato']\n>>> a[2:]\n['bacon', 'tomato', 'ham', 'lobster']\n>>> a[2:len(a)]\n['bacon', 'tomato', 'ham', 'lobster']\n>>> a\n['spam', 'egg', 'bacon', 'tomato', 'ham', 'lobster']\n>>> a[:]\n['spam', 'egg', 'bacon', 'tomato', 'ham', 'lobster']\n```\n\n#### With a stride\n\n```python\n['spam', 'egg', 'bacon', 'tomato', 'ham', 'lobster']\n>>> a[0:6:2]\n['spam', 'bacon', 'ham']\n>>> a[1:6:2]\n['egg', 'tomato', 'lobster']\n>>> a[6:0:-2]\n['lobster', 'tomato', 'egg']\n>>> a\n['spam', 'egg', 'bacon', 'tomato', 'ham', 'lobster']\n>>> a[::-1]\n['lobster', 'ham', 'tomato', 'bacon', 'egg', 'spam']\n```\n\n### Remove\n\n```python\n>>> li = ['bread', 'butter', 'milk']\n>>> li.pop()\n'milk'\n>>> li\n['bread', 'butter']\n>>> del li[0]\n>>> li\n['butter']\n```\n\n### Access\n\n```python\n>>> li = ['a', 'b', 'c', 'd']\n>>> li[0]\n'a'\n>>> li[-1]\n'd'\n>>> li[4]\nTraceback (most recent call last):\n  File \"<stdin>\", line 1, in <module>\nIndexError: list index out of range\n```\n\n### Concatenating {.row-span-2}\n\n```python\n>>> odd = [1, 3, 5]\n>>> odd.extend([9, 11, 13])\n>>> odd\n[1, 3, 5, 9, 11, 13]\n>>> odd = [1, 3, 5]\n>>> odd + [9, 11, 13]\n[1, 3, 5, 9, 11, 13]\n```\n\n### Sort & Reverse {.row-span-2}\n\n```python\n>>> li = [3, 1, 3, 2, 5]\n>>> li.sort()\n>>> li\n[1, 2, 3, 3, 5]\n>>> li.reverse()\n>>> li\n[5, 3, 3, 2, 1]\n```\n\n### Count\n\n```python\n>>> li = [3, 1, 3, 2, 5]\n>>> li.count(3)\n2\n```\n\n### Repeating\n\n```python\n>>> li = [\"re\"] * 3\n>>> li\n['re', 're', 're']\n```\n\n## Python Flow control\n\n### Basic\n\n```python\nnum = 5\nif num > 10:\n    print(\"num is totally bigger than 10.\")\nelif num < 10:\n    print(\"num is smaller than 10.\")\nelse:\n    print(\"num is indeed 10.\")\n```\n\n### One line (ternary operator)\n\n```python\n>>> a = 330\n>>> b = 200\n>>> r = \"a\" if a > b else \"b\"\n>>> print(r)\na\n```\n\n### else if\n\n```python\nvalue = True\nif not value:\n    print(\"Value is False\")\nelif value is None:\n    print(\"Value is None\")\nelse:\n    print(\"Value is True\")\n```\n\n### match case\n\n```python\nx = 1\nmatch x:\n  case 0:\n    print(\"zero\")\n  case 1:\n    print(\"one\")\n  case _:\n    print(\"multiple\")\n```\n\n## Python Loops\n\n### Basic\n\n```python\nprimes = [2, 3, 5, 7]\nfor prime in primes:\n    print(prime)\n```\n\nPrints: 2 3 5 7\n\n### With index\n\n```python\nanimals = [\"dog\", \"cat\", \"mouse\"]\n# enumerate() adds counter to an iterable\nfor i, value in enumerate(animals):\n    print(i, value)\n```\n\nPrints: 0 dog 1 cat 2 mouse\n\n### While\n\n```python\nx = 0\nwhile x < 4:\n    print(x)\n    x += 1  # Shorthand for x = x + 1\n```\n\nPrints: 0 1 2 3\n\n### Break\n\n```python\nx = 0\nfor index in range(10):\n    x = index * 10\n    if index == 5:\n    \tbreak\n    print(x)\n```\n\nPrints: 0 10 20 30 40\n\n### Continue\n\n```python\nfor index in range(3, 8):\n    x = index * 10\n    if index == 5:\n    \tcontinue\n    print(x)\n```\n\nPrints: 30 40 60 70\n\n### Range\n\n```python\nfor i in range(4):\n    print(i) # Prints: 0 1 2 3\n\nfor i in range(4, 8):\n    print(i) # Prints: 4 5 6 7\n\nfor i in range(4, 10, 2):\n    print(i) # Prints: 4 6 8\n```\n\n### With zip()\n\n```python\nwords = ['Mon', 'Tue', 'Wed']\nnums = [1, 2, 3]\n# Use zip to pack into a tuple list\nfor w, n in zip(words, nums):\n    print('%d:%s, ' %(n, w))\n```\n\nPrints: 1:Mon, 2:Tue, 3:Wed,\n\n### for/else\n\n```python\nnums = [60, 70, 30, 110, 90]\nfor n in nums:\n    if n > 100:\n        print(\"%d is bigger than 100\" %n)\n        break\nelse:\n    print(\"Not found!\")\n```\n\nAlso see: [Python Tips](https://book.pythontips.com/en/latest/for_-_else.html)\n\n### Over Dictionary\n\n```python\njohndict = {\n  \"firstname\": \"John\",\n  \"lastname\": \"Doe\",\n  \"age\": 30\n  }\n\nx = johndict.items()\nprint(x)\n\n# Output: dict_items([('firstname', 'John'),\n#                     ('lastname', 'Doe'),\n#                     ('age', 30)])\n\nfor key, value in johndict.items():\n\tprint(f\"{key} : : {value}\")\n\n# Output: firstname : : John\n# Output: lastname : : Doe\n# Output: age : : 30\n```\n\n## Python Comprehensions\n\n### Comprehension List {.col-span-2}\n\n```python\nlanguages = [\"html\", \"go\", \"rust\", \"javascript\", \"python\"]\n\nnewlist = [x for x in languages if \"l\" not in x]\n# add language for language in languages if \"l\" not in language\n\nprint(newlist) #Output : [ 'go', 'rust', 'javascript', 'python']\n\n# List comprehension avoid this :\noldlist = []\nfor x in languages:\n    if  \"l\" not in x:\n        oldlist.append(x)\nprint(oldlist) #Output :  [ 'go', 'rust', 'javascript', 'python']\n\n\n```\n\n### Comprehension Dictionary {.col-span-2}\n\n```python\nlanguages = [\"html\", \"go\", \"rust\", \"javascript\", \"python\"]\n\nlanguage_dict = {lang: ('l' not in lang) for lang in languages}\n# Key is the language & bool is Value (no offense for html..)\n\nprint(language_dict)\n# Output: {'html': False, 'go': True, 'rust': True,\n#          'javascript': True, 'python': True}\n\n\n# Dictionary comprehension avoid this :\n\nlanguage_dict2 = {}\n\nfor e in languages:\n    if \"l\" not in e:\n        language_dict2[e] = True\n    else:\n        language_dict2[e] = False\n\nprint(language_dict2)\n# Output: {'html': False, 'go': True, 'rust': True,\n#          'javascript': True, 'python': True}\n```\n\n## Python Functions\n\n### Basic\n\n```python\ndef hello_world():\n    print('Hello, World!')\n```\n\n### Return\n\n```python\ndef add(x, y):\n    print(\"x is %s, y is %s\" %(x, y))\n    return x + y\n\nadd(5, 6)    # => 11\n```\n\n### Positional arguments\n\n```python\ndef varargs(*args):\n    return args\n\nvarargs(1, 2, 3)  # => (1, 2, 3)\n```\n\nType of \"args\" is tuple.\n\n### Keyword arguments\n\n```python\ndef keyword_args(**kwargs):\n    return kwargs\n\n# => {\"big\": \"foot\", \"loch\": \"ness\"}\nkeyword_args(big=\"foot\", loch=\"ness\")\n```\n\nType of \"kwargs\" is dict.\n\n### Returning multiple\n\n```python\ndef swap(x, y):\n    return y, x\n\nx = 1\ny = 2\nx, y = swap(x, y)  # => x = 2, y = 1\n```\n\n### Default Value\n\n```python\ndef add(x, y=10):\n    return x + y\n\nadd(5)      # => 15\nadd(5, 20)  # => 25\n```\n\n### Anonymous functions\n\n```python\n# => True\n(lambda x: x > 2)(3)\n\n# => 5\n(lambda x, y: x ** 2 + y ** 2)(2, 1)\n```\n\n### @decorator {.col-span-2}\n\n```python\n# Modify or extend behavior of function or class method,\n# without changing their actual code.\n\n# Define decorator that will wrap function or method\ndef handle_errors(func):\n    def wrapper(*args, **kwargs):\n        try:\n            return func(*args, **kwargs)\n        except Exception as e:\n            return print(f\"Error :  {e}\")\n    return wrapper\n\n# Decorate function or method\n@handle_errors\ndef divide(a, b):\n    return a / b\n\ndivide(10, 0) # Output : Error : division by zero\n```\n\n## Python Modules\n\n### Import modules\n\n```python\nimport math\nprint(math.sqrt(16))  # => 4.0\n```\n\n### From a module\n\n```python\nfrom math import ceil, floor\nprint(ceil(3.7))   # => 4.0\nprint(floor(3.7))  # => 3.0\n```\n\n### Import all\n\n```python\nfrom math import *\n```\n\n### Shorten module\n\n```python\nimport math as m\n\n# => True\nmath.sqrt(16) == m.sqrt(16)\n```\n\n### Functions and attributes\n\n```python\nimport math\ndir(math)\n```\n\n## Python File Handling\n\n### Read file\n\n#### Line by line\n\n```python\nwith open(\"myfile.txt\") as file:\n    for line in file:\n        print(line)\n```\n\n#### With line number\n\n```python\nfile = open('myfile.txt', 'r')\nfor i, line in enumerate(file, start=1):\n    print(\"Number %s: %s\" % (i, line))\n```\n\n### String\n\n#### Write a string\n\n```python\ncontents = {\"aa\": 12, \"bb\": 21}\nwith open(\"myfile1.txt\", \"w+\") as file:\n    file.write(str(contents))\n```\n\n#### Read a string\n\n```python\nwith open('myfile1.txt', \"r+\") as file:\n    contents = file.read()\nprint(contents)\n```\n\n### Object\n\n#### Write an object\n\n```python\ncontents = {\"aa\": 12, \"bb\": 21}\nwith open(\"myfile2.txt\", \"w+\") as file:\n    file.write(json.dumps(contents))\n```\n\n#### Read an object\n\n```python\nwith open('myfile2.txt', \"r+\") as file:\n    contents = json.load(file)\nprint(contents)\n```\n\n### Delete a File\n\n```python\nimport os\nos.remove(\"myfile.txt\")\n```\n\n### Check and Delete\n\n```python\nimport os\nif os.path.exists(\"myfile.txt\"):\n    os.remove(\"myfile.txt\")\nelse:\n    print(\"The file does not exist\")\n```\n\n### Delete Folder\n\n```python\nimport os\nos.rmdir(\"myfolder\")\n```\n\n## Python Classes & Inheritance\n\n### Defining\n\n```python\nclass MyNewClass:\n    pass\n\n# Class Instantiation\nmy = MyNewClass()\n```\n\n### Constructors\n\n```python\nclass Animal:\n    def __init__(self, voice):\n        self.voice = voice\n\ncat = Animal('Meow')\nprint(cat.voice)    # => Meow\n\ndog = Animal('Woof')\nprint(dog.voice)    # => Woof\n```\n\n### Method\n\n```python\nclass Dog:\n\n    # Method of the class\n    def bark(self):\n        print(\"Ham-Ham\")\n\ncharlie = Dog()\ncharlie.bark()   # => \"Ham-Ham\"\n```\n\n### Class Variables {.row-span-2}\n\n```python\nclass MyClass:\n    class_variable = \"A class variable!\"\n\n# => A class variable!\nprint(MyClass.class_variable)\n\nx = MyClass()\n\n# => A class variable!\nprint(x.class_variable)\n```\n\n### Super() Function {.row-span-2}\n\n```python\nclass ParentClass:\n    def print_test(self):\n        print(\"Parent Method\")\n\nclass ChildClass(ParentClass):\n    def print_test(self):\n        print(\"Child Method\")\n        # Calls the parent's print_test()\n        super().print_test()\n```\n\n---\n\n```python\n>>> child_instance = ChildClass()\n>>> child_instance.print_test()\nChild Method\nParent Method\n```\n\n### repr() method\n\n```python\nclass Employee:\n    def __init__(self, name):\n        self.name = name\n\n    def __repr__(self):\n        return self.name\n\njohn = Employee('John')\nprint(john)  # => John\n```\n\n### User-defined exceptions\n\n```python\nclass CustomError(Exception):\n    pass\n```\n\n### Polymorphism\n\n```python\nclass ParentClass:\n    def print_self(self):\n        print('A')\n\nclass ChildClass(ParentClass):\n    def print_self(self):\n        print('B')\n\nobj_A = ParentClass()\nobj_B = ChildClass()\n\nobj_A.print_self() # => A\nobj_B.print_self() # => B\n```\n\n### Overriding\n\n```python\nclass ParentClass:\n    def print_self(self):\n        print(\"Parent\")\n\nclass ChildClass(ParentClass):\n    def print_self(self):\n        print(\"Child\")\n\nchild_instance = ChildClass()\nchild_instance.print_self() # => Child\n```\n\n### Inheritance\n\n```python\nclass Animal:\n    def __init__(self, name, legs):\n        self.name = name\n        self.legs = legs\n\nclass Dog(Animal):\n    def sound(self):\n        print(\"Woof!\")\n\nYoki = Dog(\"Yoki\", 4)\nprint(Yoki.name) # => YOKI\nprint(Yoki.legs) # => 4\nYoki.sound()     # => Woof!\n```\n\n### @staticmethod {.col-span-2}\n\n```python\nclass MyClass:\n    @staticmethod\n    def greet(name):\n        return f\"Hello, {name}!\"\n\n# No instantiation nedded\n\n# Call via class\nprint(MyClass.greet(\"Alice\"))  # => Hello, Alice!\n\n# Can still call via instance\nobj = MyClass()\nprint(obj.greet(\"Bob\"))        # => Hello, Bob!\n```\n\n## Python Type Hints (Since Python 3.5)\n\n### Variable & Parameter\n\n```python\nstring: str = \"ha\"\ntimes: int = 3\n\n\n# wrong hit, but run correctly\nresult: str = 1 + 2\nprint(result)  # => 3\n\n\ndef say(name: str, start: str = \"Hi\"):\n    return start + \", \" + name\n\nprint(say(\"Python\"))  # => Hi, Python\n```\n\n### Built-in date type\n\n```python\nfrom typing import Dict, Tuple, List\n\nbill: Dict[str, float] = {\n    \"apple\": 3.14,\n    \"watermelon\": 15.92,\n    \"pineapple\": 6.53,\n}\ncompleted: Tuple[str] = (\"DONE\",)\nsucceeded: Tuple[int, str] = (1, \"SUCCESS\")\nstatuses: Tuple[str, ...] = (\n    \"DONE\", \"SUCCESS\", \"FAILED\", \"ERROR\",\n)\ncodes: List[int] = (0, 1, -1, -2)\n```\n\n### Built-in date type (3.10+)\n\n```python\nbill: dict[str, float] = {\n    \"apple\": 3.14,\n    \"watermelon\": 15.92,\n    \"pineapple\": 6.53,\n}\ncompleted: tuple[str] = (\"DONE\",)\nsucceeded: tuple[int, str] = (1, \"SUCCESS\")\nstatuses: tuple[str, ...] = (\n    \"DONE\", \"SUCCESS\", \"FAILED\", \"ERROR\",\n)\ncodes: list[int] = (0, 1, -1, -2)\n```\n\n### Positional argument\n\n```python\ndef calc_summary(*args: int):\n    return sum(args)\n\nprint(calc_summary(3, 1, 4))  # => 8\n```\n\nIndicate all arguments' type is int.\n\n### Returned\n\n```python\ndef say_hello(name) -> str:\n    return \"Hello, \" + name\n\nvar = \"Python\"\nprint(say_hello(var))  # => Hello, Python\n```\n\n### Union returned\n\n```python\nfrom typing import Union\n\ndef resp200(meaningful) -> Union[int, str]:\n    return \"OK\" if meaningful else 200\n```\n\nMeans returned value type may be int or str.\n\n### Keyword argument\n\n```python\ndef calc_summary(**kwargs: int):\n    return sum(kwargs.values())\n\nprint(calc_summary(a=1, b=2))  # => 3\n```\n\nIndicate all parameters' value type is int.\n\n### Multiple returns\n\n```python\ndef resp200() -> (int, str):\n    return 200, \"OK\"\n\nreturns = resp200()\nprint(returns)  # => (200, 'OK')\nprint(type(returns))  # tuple\n```\n\n### Union returned (3.10+)\n\n```python\ndef resp200(meaningful) -> int | str:\n    return \"OK\" if meaningful else 200\n```\n\nSince Python 3.10\n\n### Property\n\n```python\nclass Employee:\n    name: str\n    age: int\n\n    def __init__(self, name, age):\n        self.name = name\n        self.age = age\n        self.graduated: bool = False\n```\n\n### Self instance\n\n```python\nclass Employee:\n    name: str\n\n    def set_name(self, name) -> \"Employee\":\n        self.name = name\n        return self\n\n    def copy(self) -> 'Employee':\n        return type(self)(self.name)\n```\n\n### Self instance (3.11+)\n\n```python\nfrom typing import Self\n\nclass Employee:\n    name: str\n    age: int\n\n    def set_name(self: Self, name) -> Self:\n        self.name = name\n        return self\n```\n\n### Type & Generic {.col-span-2}\n\n```python\nfrom typing import TypeVar, Type\n\nT = TypeVar(\"T\")\n\n# \"mapper\" is a type, like int, str, MyClass and so on.\n# \"default\" is an instance of type T, such as 314, \"string\", MyClass() and so on.\n# returned is an instance of type T too.\ndef converter(raw, mapper: Type[T], default: T) -> T:\n    try:\n        return mapper(raw)\n    except:\n        return default\n\nraw: str = input(\"Enter an integer: \")\nresult: int = converter(raw, mapper=int, default=0)\n```\n\n### Function {.col-span-2}\n\n```python\nfrom typing import TypeVar, Callable, Any\n\nT = TypeVar(\"T\")\n\ndef converter(raw, mapper: Callable[[Any], T], default: T) -> T:\n    try:\n        return mapper(raw)\n    except:\n        return default\n\n# Callable[[Any], ReturnType] means a function declare like:\n# def func(arg: Any) -> ReturnType:\n#     pass\n\n# Callable[[str, int], ReturnType] means a function declare like:\n# def func(string: str, times: int) -> ReturnType:\n#     pass\n\n# Callable[..., ReturnType] means a function declare like:\n# def func(*args, **kwargs) -> ReturnType:\n#     pass\n\ndef is_success(value) -> bool:\n    return value in (0, \"OK\", True, \"success\")\n\nresp = dict(code=0, message=\"OK\", data=[])\nsuccessed: bool = converter(resp[\"message\"], mapper=is_success, default=False)\n```\n\n## Python Operators\n\n### Walrus {.col-span-2}\n\n```python\nvalues = [1, \"text\", True, \"\", 2]\ni = 0\n\n# It assigns a value to a variable and compares it in a boolean expression\nwhile (data := values[i]):\n\n    print(data, end=\",\")\n    i = i + 1\n\n# Expected result: 1, \"text\", True\n```\n\n## Date & Time Handling\n\n### Current date and time\n\n```python\nimport datetime\n\nnow = datetime.datetime.now()\nprint(now)  # e.g., 2024-04-27 14:35:22.123456\n```\n\n### Creating specific date/time objects\n\n```python\nimport datetime\n\n# Create a date object\nd = datetime.date(2024, 4, 27)\nprint(d)  # 2024-04-27\n\n# Create a time object\nt = datetime.time(15, 30, 45)\nprint(t)  # 15:30:45\n\n# Create a datetime object\ndt = datetime.datetime(2024, 4, 27, 15, 30, 45)\nprint(dt)  # 2024-04-27 15:30:45\n```\n\n### Converting between date formats\n\n```python\nimport datetime\n\n# Convert a string to a datetime object\ndate_str = \"2024-04-27 14:00\"\ndt_obj = datetime.datetime.strptime(date_str, \"%Y-%m-%d %H:%M\")\nprint(dt_obj)  # 2024-04-27 14:00:00\n\n# Convert a datetime object to a string\nformatted_str = dt_obj.strftime(\"%d/%m/%Y %H:%M\")\nprint(formatted_str)  # 27/04/2024 14:00\n```\n\n### Timestamps and Unix time\n\n```python\nimport datetime\n\n# Get current timestamp\ntimestamp = datetime.datetime.now().timestamp()\nprint(timestamp)  # e.g., 1714188922.123456\n\n# Convert timestamp back to datetime\ndt_from_timestamp = datetime.datetime.fromtimestamp(timestamp)\nprint(dt_from_timestamp)\n```\n\n### Date difference and timedelta {.col-span-2}\n\n```python\nimport datetime\n\ndate1 = datetime.date(2024, 4, 27)\ndate2 = datetime.date(2024, 5, 1)\n\ndelta = date2 - date1\nprint(delta.days)  # 4\n\n# Using timedelta for date arithmetic\nnew_date = date1 + datetime.timedelta(days=10)\nprint(new_date)  # 2024-05-07\n```\n\n## Miscellaneous\n\n### Comments\n\n```python\n# This is a single line comments.\n```\n\n```python\n\"\"\" Multiline strings can be written\n    using three \"s, and are often used\n    as documentation.\n\"\"\"\n```\n\n```python\n''' Multiline strings can be written\n    using three 's, and are often used\n    as documentation.\n'''\n```\n\n### Generators\n\n```python\ndef double_numbers(iterable):\n    for i in iterable:\n        yield i + i\n```\n\nGenerators help you make lazy code.\n\n### Generator to list\n\n```python\nvalues = (-x for x in [1,2,3,4,5])\ngen_to_list = list(values)\n\n# => [-1, -2, -3, -4, -5]\nprint(gen_to_list)\n```\n\n### Handle exceptions {.col-span-3}\n\n```python\ntry:\n    # Use \"raise\" to raise an error\n    raise IndexError(\"This is an index error\")\nexcept IndexError as e:\n    pass                 # Pass is just a no-op. Usually you would do recovery here.\nexcept (TypeError, NameError):\n    pass                 # Multiple exceptions can be handled together, if required.\nelse:                    # Optional clause to the try/except block. Must follow all except blocks\n    print(\"All good!\")   # Runs only if the code in try raises no exceptions\nfinally:                 # Execute under all circumstances\n    print(\"We can clean up resources here\")\n```\n\n### Dispatcher Pattern {.col-span-3}\n\n```python\n# Dispatcher allows dynamic selection and execution of functions based on user input or other runtime conditions\n\ndef add(x, y):\n    return x + y\n\ndef subtract(x, y):\n    return x - y\n\ndef multiply(x, y):\n    return x * y\n\ndef divide(x, y):\n    if y == 0:\n        return 'Error: Division by zero'\n    return x / y\n\n# Dispatcher dictionary: maps operation names to their corresponding functions\noperations = {\n    'add': add,\n    'subtract': subtract,\n    'multiply': multiply,\n    'divide': divide\n}\n\n# Function to dispatch operation based on operation name\n# Common use cases include executing different functions dynamically, such as in calculators, command interpreters, or event handling\ndef dispatcher(operation_name, x, y):\n    func = operations.get(operation_name)\n    if func:\n        return func(x, y)\n    else:\n        return f\"Unknown operation: {operation_name}\"\n\n# Usage examples\nprint(dispatcher('add', 5, 3))        # Output: 8\nprint(dispatcher('multiply', 4, 2))   # Output: 8\nprint(dispatcher('divide', 10, 0))    # Output: Error: Division by zero\nprint(dispatcher('mod', 10, 3))       # Output: Unknown operation: mod\n```\n"
  },
  {
    "path": "source/_posts/pytorch.md",
    "content": "---\ntitle: PyTorch\ndate: 2023-04-12\nbackground: bg-[#ee4c2c]\ntags:\n  - AI\n  - Python\ncategories:\n  - Other\nintro: This is a quick reference list of cheat sheets for PyTorch. See also [PyTorch website](https://pytorch.org/)\n---\n\n## Imports { .cols-1 }\n\n### General\n\n```\nimport torch                                        # root package\nfrom torch.utils.data import Dataset, DataLoader    # dataset representation and loading\n```\n\n### Neural Network API\n\n```\nimport torch.autograd as autograd         # computation graph\nfrom torch import Tensor                  # tensor node in the computation graph\nimport torch.nn as nn                     # neural networks\nimport torch.nn.functional as F           # layers, activations and more\nimport torch.optim as optim               # optimizers e.g. gradient descent, ADAM, etc.\nfrom torch.jit import script, trace       # hybrid frontend decorator and tracing jit\n```\n\n### Torchscript and JIT\n\n```\ntorch.jit.trace()         # takes your module or function and an example\n                          # data input, and traces the computational steps\n                          # that the data encounters as it progresses through the model\n\n@script                   # decorator used to indicate data-dependent\n                          # control flow within the code being traced\n```\n\n### ONNX\n\n```\ntorch.onnx.export(model, dummy data, xxxx.proto)       # exports an ONNX formatted\n                                                       # model using a trained model, dummy\n                                                       # data and the desired file name\n\nmodel = onnx.load(\"alexnet.proto\")                     # load an ONNX model\nonnx.checker.check_model(model)                        # check that the model\n                                                       # IR is well formed\n\nonnx.helper.printable_graph(model.graph)               # print a human readable\n                                                       # representation of the graph\n```\n\n### Vision\n\n```\nfrom torchvision import datasets, models, transforms     # vision datasets,\n                                                         # architectures &\n                                                         # transforms\n\nimport torchvision.transforms as transforms              # composable transforms\n```\n\n### Distributed Training\n\n```\nimport torch.distributed as dist             # distributed communication\nfrom torch.multiprocessing import Process    # memory sharing processes\n```\n\n## Tensors { .cols-1 }\n\n### Creation\n\n```\nx = torch.randn(*size)              # tensor with independent N(0,1) entries\nx = torch.[ones|zeros](*size)       # tensor with all 1's [or 0's]\nx = torch.tensor(L)                 # create tensor from [nested] list or ndarray L\ny = x.clone()                       # clone of x\nwith torch.no_grad():               # code wrap that stops autograd from tracking tensor history\nrequires_grad=True                  # arg, when set to True, tracks computation\n                                    # history for future derivative calculations\n```\n\n### Dimensionality\n\n```\nx.size()                                  # return tuple-like object of dimensions\nx = torch.cat(tensor_seq, dim=0)          # concatenates tensors along dim\ny = x.view(a,b,...)                       # reshapes x into size (a,b,...)\ny = x.view(-1,a)                          # reshapes x into size (b,a) for some b\ny = x.transpose(a,b)                      # swaps dimensions a and b\ny = x.permute(*dims)                      # permutes dimensions\ny = x.unsqueeze(dim)                      # tensor with added axis\ny = x.unsqueeze(dim=2)                    # (a,b,c) tensor -> (a,b,1,c) tensor\ny = x.squeeze()                           # removes all dimensions of size 1 (a,1,b,1) -> (a,b)\ny = x.squeeze(dim=1)                      # removes specified dimension of size 1 (a,1,b,1) -> (a,b,1)\n```\n\n### Algebra\n\n```\nret = A.mm(B)       # matrix multiplication\nret = A.mv(x)       # matrix-vector multiplication\nx = x.t()           # matrix transpose\n```\n\n### GPU Usage\n\n```\ntorch.cuda.is_available                                     # check for cuda\nx = x.cuda()                                                # move x's data from\n                                                            # CPU to GPU and return new object\n\nx = x.cpu()                                                 # move x's data from GPU to CPU\n                                                            # and return new object\n\nif not args.disable_cuda and torch.cuda.is_available():     # device agnostic code\n    args.device = torch.device('cuda')                      # and modularity\nelse:                                                       #\n    args.device = torch.device('cpu')                       #\n\nnet.to(device)                                              # recursively convert their\n                                                            # parameters and buffers to\n                                                            # device specific tensors\n\nx = x.to(device)                                            # copy your tensors to a device\n                                                            # (gpu, cpu)\n```\n\n### Deep Learning\n\n```\nnn.Linear(m,n)                                # fully connected layer from\n                                              # m to n units\n\nnn.ConvXd(m,n,s)                              # X dimensional conv layer from\n                                              # m to n channels where X⍷{1,2,3}\n                                              # and the kernel size is s\n\nnn.MaxPoolXd(s)                               # X dimension pooling layer\n                                              # (notation as above)\n\nnn.BatchNormXd                                # batch norm layer\nnn.RNN/LSTM/GRU                               # recurrent layers\nnn.Dropout(p=0.5, inplace=False)              # dropout layer for any dimensional input\nnn.Dropout2d(p=0.5, inplace=False)            # 2-dimensional channel-wise dropout\nnn.Embedding(num_embeddings, embedding_dim)   # (tensor-wise) mapping from\n                                              # indices to embedding vectors\n```\n\n### Loss Functions\n\n```\nnn.X                                  # where X is L1Loss, MSELoss, CrossEntropyLoss\n                                      # CTCLoss, NLLLoss, PoissonNLLLoss,\n                                      # KLDivLoss, BCELoss, BCEWithLogitsLoss,\n                                      # MarginRankingLoss, HingeEmbeddingLoss,\n                                      # MultiLabelMarginLoss, SmoothL1Loss,\n                                      # SoftMarginLoss, MultiLabelSoftMarginLoss,\n                                      # CosineEmbeddingLoss, MultiMarginLoss,\n                                      # or TripletMarginLoss\n```\n\n### Activation Functions\n\n```\nnn.X                                  # where X is ReLU, ReLU6, ELU, SELU, PReLU, LeakyReLU,\n                                      # RReLu, CELU, GELU, Threshold, Hardshrink, HardTanh,\n                                      # Sigmoid, LogSigmoid, Softplus, SoftShrink,\n                                      # Softsign, Tanh, TanhShrink, Softmin, Softmax,\n                                      # Softmax2d, LogSoftmax or AdaptiveSoftmaxWithLoss\n```\n\n### Optimizers\n\n```\nopt = optim.x(model.parameters(), ...)      # create optimizer\nopt.step()                                  # update weights\noptim.X                                     # where X is SGD, Adadelta, Adagrad, Adam,\n                                            # AdamW, SparseAdam, Adamax, ASGD,\n                                            # LBFGS, RMSprop or Rprop\n```\n\n### Learning rate scheduling\n\n```\nscheduler = optim.X(optimizer,...)      # create lr scheduler\nscheduler.step()                        # update lr after optimizer updates weights\noptim.lr_scheduler.X                    # where X is LambdaLR, MultiplicativeLR,\n                                        # StepLR, MultiStepLR, ExponentialLR,\n                                        # CosineAnnealingLR, ReduceLROnPlateau, CyclicLR,\n                                        # OneCycleLR, CosineAnnealingWarmRestarts,\n```\n\n## Data Utilities { .cols-1 }\n\n### Datasets\n\n```\nDataset                    # abstract class representing dataset\nTensorDataset              # labelled dataset in the form of tensors\nConcat Dataset             # concatenation of Datasets\n```\n\n### Dataloaders and DataSamplers\n\n```\nDataLoader(dataset, batch_size=1, ...)      # loads data batches agnostic\n                                            # of structure of individual data points\n\nsampler.Sampler(dataset,...)                # abstract class dealing with\n                                            # ways to sample from dataset\n\nsampler.XSampler where ...                  # Sequential, Random, SubsetRandom,\n                                            # WeightedRandom, Batch, Distributed\n```\n"
  },
  {
    "path": "source/_posts/quickref.md",
    "content": "---\ntitle: CheatSheets\ndate: 2020-11-25 18:28:43\nbackground: bg-gradient-to-l from-green-400 to-blue-500 hover:from-pink-500 hover:to-yellow-500\ntags:\n  - guide\n  - reference\ncategories:\n  - Other\nintro: This is the magic syntax variant manual that you can use on CheatSheets.zip, It's a good practice for contributors.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Develop Setup\n\n- Clone Repository [View on Github](https://github.com/Fechin/reference.git)\n  ```shell script {.wrap}\n  $ git clone https://github.com/Fechin/reference.git\n  ```\n- Install Dependencies in the project directory\n  ```shell script\n  $ npm install\n  ```\n- Start a Dev Server [http://localhost:4000](http://localhost:4000)\n  ```shell script\n  $ npm run dev\n  ```\n- Create or modify `source/_posts/{name}.md`\n- Send us pull request and chill {.marker-timeline}\n\nIt's a good practice to refer to the source code of the\n[CheatSheets reference](https://github.com/Fechin/reference/blob/main/source/_posts/quickref.md).\n\n### Directory Structure\n\n```yaml\n.\n├── source\n│   ├── _posts   # Cheatsheet source files\n│   │   ├── awk.md\n│   │   ├── vim.md # => cheatsheets.zip/vim\n│   │   ├── php.md\n│   │   ├── css.md # => cheatsheets.zip/css\n│   │   ├── ...\n│   └── widget   # Widget files\n│       └── chmod.html\n├── public       # Distribution files\n├── _config.yml\n├── gulpfile.js\n├── package.json\n├── postcss.config.js\n├── tailwind.config.js\n└── themes\n    └── coo      # Theme files\n```\n\n### Cheatsheet Structure {.row-span-2}\n\n```yaml\n.\n├── Section 1   # Header\n│   ├── Card 1\n│   ├── Card 2\n│   ├── Card 3\n│   ├── ...\n├── Section 2\n│   ├── Card 1\n│   │   ├── Paragraph\n│   │   ├── Code\n│   │   ├── <hr/> (aka \"---\")\n│   │   ├── List\n│   │   │   ├── Paragraph\n│   │   │   └── Code\n│   │   └── Table\n│   │       ├── Paragraph\n│   │       └── Code\n│   ├── Card 2\n│   ├── Card 3\n│   └── ...\n├── Section 3\n├── Section 4\n└── ...\n```\n\n---\n\n- One cheatsheet contains multiple sections\n- One section contains multiple cards\n- One card can contain Code, Table, List and Paragraph\n- One list can contain Code and Paragraph\n- One table can contain Code and Paragraph\n\n### Syntax Variants\n\n- [Section Variants](#section-variants)\n- [Card Variants](#card-variants)\n- [Table Variants](#table-variants)\n- [List Variants](#list-variants)\n- [Code Variants](#code-variants)\n- [Paragraph Variants](#paragraph-variants)\n- [Cards Example](#cards-example)\n\nAll the magic variants supported by CheatSheets.zip\n\n### Create source/\\_posts/demo.md\n\n```markdown\n## Getting Started\n\n### List Card {.col-span-2}\n\n- Share quick reference\n- Cheatsheet for developers ... {.style-timeline}\n\n### Table Card\n\n| id  | name    |\n| --- | ------- |\n| 1   | Roberta |\n\n{.show-header}\n```\n\n## Section Variants\n\n### Section Overview {.secondary}\n\n| -           | -                               |\n| ----------- | ------------------------------- |\n| `{.cols-1}` | one-column layout               |\n| `{.cols-2}` | two-column layout               |\n| `{.cols-3}` | three-column layout _(default)_ |\n| ...         |                                 |\n| `{.cols-6}` | six-column layout               |\n\n---\n\n- Section contains multiple cards\n- Use {.cols-`n`} to specify section as a `n`-column layout\n- Click the preview button below to focus on the section\n\n[Preview](/quickref#section-variants) {.link-arrow}\n\n### .cols-1\n\n```text\n# One Column Example {.cols-1}\n╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮\n┆  1                                  ┆\n╰┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╯\n╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮\n┆  2                                  ┆\n╰┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╯\n```\n\n#### ↓ Source Code\n\n```markdown\n## One Column Example {.cols-1}\n\n### 1\n\n### 2\n```\n\n[Preview](resolutions#lists-of-resolutions) {.link-arrow}\n\n### .cols-2\n\n```text\n# Two Columns Example\n╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮\n┆  1              ┆ ┆  2              ┆\n╰┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╯\n╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮\n┆  3              ┆\n╰┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╯\n```\n\n#### ↓ Source Code\n\n```markdown\n## Two Columns Example {.cols-2}\n\n### 1\n\n### 2\n\n### 3\n```\n\n[Preview](resolutions#getting-started) {.link-arrow}\n\n### .cols-3 (default)\n\n```text\n# Default\n╭┈┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈┈╮\n┆  1       ┆ ┆  2       ┆ ┆  3       ┆\n╰┈┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈┈╯\n╭┈┈┈┈┈┈┈┈┈┈╮\n┆  4       ┆\n╰┈┈┈┈┈┈┈┈┈┈╯\n```\n\n#### ↓ Source Code\n\n```markdown\n## Default\n\n### 1\n\n### 2\n\n### 3\n\n### 4\n```\n\n## Card Variants\n\n### Card Overview {.secondary}\n\n#### Specifies the number of columns the card spans\n\n| -               | -                      |\n| --------------- | ---------------------- |\n| `{.col-span-2}` | [Example](#col-span-2) |\n| `{.col-span-3}` |                        |\n| ...             |                        |\n| `.col-span-6}`  |                        |\n\n#### Specifies the number of rows the card spans {.text-left}\n\n| -               | -                      |\n| --------------- | ---------------------- |\n| `{.row-span-2}` | [Example](#row-span-2) |\n| `{.row-span-3}` |                        |\n| ...             |                        |\n| `{.row-span-6}` |                        |\n\n#### Emphasize card (aka `H3` Section)\n\n| -              | -                                         |\n| -------------- | ----------------------------------------- |\n| `{.primary}`   | Red titles, [Example](#primary-card)      |\n| `{.secondary}` | Yellow titles, [Example](#secondary-card) |\n\nA complete example: [Cards Example](#cards-example)\n\n### .col-span-2 {.row-span-2}\n\n#### The fifth card spans two columns\n\n```text\n╭┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮\n┆  1      ┆ ┆  2      ┆ ┆  3      ┆\n╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯\n╭┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮\n┆  4      ┆ ┆  5                  ┆\n╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╯\n```\n\n---\n\n```markdown\n### 1\n\n### 2\n\n### 3\n\n### 4\n\n### 5 {.col-span-2}\n```\n\n#### The second card spans two columns\n\n```text\n╭┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮\n┆  1      ┆ ┆  2                  ┆\n╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╯\n╭┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮\n┆  3      ┆ ┆  4      ┆ ┆  5      ┆\n╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯\n```\n\n---\n\n```markdown\n### 1\n\n### 2 {.col-span-2}\n\n### 3\n\n### 4\n\n### 5\n```\n\n#### The fourth card spans two columns\n\n```text\n╭┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮\n┆  1      ┆ ┆  2      ┆ ┆  3      ┆\n╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯\n╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮\n┆  4                  ┆ ┆  5      ┆\n╰┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯\n```\n\n---\n\n```markdown\n### 1\n\n### 2\n\n### 3\n\n### 4 {.col-span-2}\n\n### 5\n```\n\n### .row-span-2 {.row-span-2}\n\n#### The first card spans two rows\n\n```text\n╭┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮\n┆ 1      ┆ ┆ 2       ┆ ┆ 3       ┆\n┆        ┆ ╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯\n┆        ┆ ╭┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮\n┆        ┆ ┆ 4       ┆ ┆ 5       ┆\n╰┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯\n```\n\n---\n\n```markdown\n### 1 {.row-span-2}\n\n### 2\n\n### 3\n\n### 4\n\n### 5\n```\n\n#### The second card spans two rows\n\n```text\n╭┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮\n┆ 1       ┆ ┆ 2      ┆ ┆ 3       ┆\n╰┈┈┈┈┈┈┈┈┈╯ ┆        ┆ ╰┈┈┈┈┈┈┈┈┈╯\n╭┈┈┈┈┈┈┈┈┈╮ ┆        ┆ ╭┈┈┈┈┈┈┈┈┈╮\n┆ 4       ┆ ┆        ┆ ┆ 5       ┆\n╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯\n```\n\n---\n\n```markdown\n### 1\n\n### 2 {.row-span-2}\n\n### 3\n\n### 4\n\n### 5\n```\n\n#### The third card spans two rows\n\n```text\n╭┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈╮\n┆ 1       ┆ ┆ 2       ┆ ┆ 3      ┆\n╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯ ┆        ┆\n╭┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮ ┆        ┆\n┆ 4       ┆ ┆ 5       ┆ ┆        ┆\n╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈╯\n```\n\n---\n\n```markdown\n### 1\n\n### 2\n\n### 3 {.row-span-2}\n\n### 4\n\n### 5\n```\n\n### .col-span-2 .row-span-2\n\n```text\n╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮\n┆ 1                   ┆ ┆ 2       ┆\n┆                     ┆ ╰┈┈┈┈┈┈┈┈┈╯\n┆                     ┆ ╭┈┈┈┈┈┈┈┈┈╮\n┆                     ┆ ┆ 3       ┆\n╰┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯\n╭┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮\n┆ 4       ┆ ┆ 5       ┆ ┆ 6       ┆\n╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯\n```\n\n#### ↓ Source Code\n\n```markdown\n### 1 {.col-span-2 .row-span-2}\n\n### 2\n\n### 3\n\n### 4\n\n### 5\n```\n\nSpans rows and columns at the same time\n\n## Table Variants\n\n### Table Overview {.secondary}\n\n| -                | -                            |\n| ---------------- | ---------------------------- |\n| `{.show-header}` | Show the header of the table |\n| `{.shortcuts}`   | Render shortcut key style    |\n| `{.bold-first}`  | Bold first column            |\n| `{.plus-first}`  | Plus first column            |\n| `{.show-header}` | Show headers                 |\n| `{.left-text}`   | Align the last column left   |\n| `{.no-wrap}`     | Don't wrap text              |\n\n### Basic table\n\n| Pattern  | Description            |\n| -------- | ---------------------- |\n| `[abc]`  | Match a, b or c        |\n| `[^abc]` | Match except a, b or c |\n| `[a-z]`  | Match a to z           |\n\n#### ↓ Source Code\n\n```markdown\n| Pattern  | Description            |\n| -------- | ---------------------- |\n| `[abc]`  | Match a, b or c        |\n| `[^abc]` | Match except a, b or c |\n| `[a-z]`  | Match a to z           |\n```\n\n### .shortcuts\n\n| -          | -        |\n| ---------- | -------- |\n| `Ctrl` `N` | New File |\n| `Ctrl` `S` | Save     |\n\n{.shortcuts}\n\n#### ↓ Source Code\n\n```markdown\n| -          | -        |\n| ---------- | -------- |\n| `Ctrl` `N` | New File |\n| `Ctrl` `S` | Save     |\n\n{.shortcuts}\n```\n\n### .show-header\n\n| Pattern  | Description            |\n| -------- | ---------------------- |\n| `[abc]`  | Match a, b or c        |\n| `[^abc]` | Match except a, b or c |\n| `[a-z]`  | Match a to z           |\n\n{.show-header}\n\n#### ↓ Source Code\n\n```markdown\n| Pattern  | Description            |\n| -------- | ---------------------- |\n| `[abc]`  | Match a, b or c        |\n| `[^abc]` | Match except a, b or c |\n| `[a-z]`  | Match a to z           |\n\n{.show-header}\n```\n\n### .left-text\n\n| Pattern  | Description            |\n| -------- | ---------------------- |\n| `[abc]`  | Match a, b or c        |\n| `[^abc]` | Match except a, b or c |\n| `[a-z]`  | Match a to z           |\n\n{.left-text}\n\n#### ↓ Source Code\n\n```markdown\n| Pattern  | Description            |\n| -------- | ---------------------- |\n| `[abc]`  | Match a, b or c        |\n| `[^abc]` | Match except a, b or c |\n| `[a-z]`  | Match a to z           |\n\n{.left-text}\n```\n\n### .bold-first\n\n| Pattern  | Description            |\n| -------- | ---------------------- |\n| `[abc]`  | Match a, b or c        |\n| `[^abc]` | Match except a, b or c |\n| `[a-z]`  | Match a to z           |\n\n{.bold-first}\n\n#### ↓ Source Code\n\n```markdown\n| Pattern  | Description            |\n| -------- | ---------------------- |\n| `[abc]`  | Match a, b or c        |\n| `[^abc]` | Match except a, b or c |\n| `[a-z]`  | Match a to z           |\n\n{.bold-first}\n```\n\n## List Variants\n\n### List Overview {.secondary}\n\nList columns\n\n| -           | -                      |\n| ----------- | ---------------------- |\n| `{.cols-1}` | one column _(default)_ |\n| `{.cols-2}` | two columns            |\n| ...         |                        |\n| `{.cols-6}` |                        |\n\nList markers\n\n| -                    | -                          |\n| -------------------- | -------------------------- |\n| `{.marker-none}`     | Marker is not set          |\n| `{.marker-timeline}` | Marker style like timeline |\n| `{.marker-round}`    | Round marker               |\n\n### One Column (Default)\n\n- Share quick reference.\n- cheat sheet for developers.\n- Contributed by open source angels.\n- Manage your code snippets.\n\n#### ↓ Source Code\n\n```markdown\n- Share quick reference.\n- cheat sheet for developers.\n- Contributed by open source angels.\n- Manage your code snippets.\n```\n\n### .cols-3\n\n- Share\n- Quick\n- Reference\n- And\n- Cheat Sheet\n- For\n- Developers\n\n{.cols-3}\n\n#### ↓ Source Code\n\n```markdown\n- Share\n- Quick\n- Reference\n- And\n- Cheat Sheet\n- For\n- Developers\n\n{.cols-3}\n```\n\n### .marker-timeline {.row-span-2}\n\n- **Renamed** to `new_name`\n  ```shell script\n  $ git branch -m <new_name>\n  ```\n- **Push** and reset\n  ```shell script\n  $ git push origin -u <new_name>\n  ```\n- **Delete** remote branch `shell script     $ git push origin --delete <old>     `\n\n{.marker-timeline}\n\n#### ↓ Source Code\n\n````markdown\n- **Renamed** to `new_name`\n  ```shell script\n  $ git branch -m <new_name>\n  ```\n- **Push** and reset\n  ```shell script\n  $ git push origin -u <new_name>\n  ```\n- **Delete** remote branch `shell script     $ git push origin --delete <old>     `\n\n{.marker-timeline}\n````\n\n### .marker-none\n\n- Share\n- Quick\n- Reference\n- And\n- Cheat Sheet\n\n{.cols-2 .marker-none}\n\n#### ↓ Source Code\n\n```markdown\n- Share\n- Quick\n- Reference\n- And\n- Cheat Sheet\n\n{.cols-2 .marker-none}\n```\n\n### .marker-round\n\n- Share\n- Quick\n- Reference\n\n{.marker-round}\n\n#### ↓ Source Code\n\n```markdown\n- Share\n- Quick\n- Reference\n\n{.marker-round}\n```\n\n## Code Variants\n\n### Basic code\n\n```js\ncheatsheets.zip.is(() => {\n  awesome.site();\n});\n```\n\n```js\nhere.is.some.more();\n```\n\n#### ↓ Source Code\n\n`````markdown\n````js\ncheatsheets.zip.is(() => {\n  awesome.site()\n})\n\\```\n\n```js\nhere.is.some.more()\n\\```\n````\n`````\n\nCode blocks can be placed one after the other.\n\n### Code with headings\n\n#### index.js\n\n```js\ncheatsheets.zip.is(() => {\n  awesome.site();\n});\n```\n\n#### other.js\n\n```js\nhere.is.some.more();\n```\n\n#### ↓ Source Code\n\n````markdown\n#### index.js\n\n```js\ncheatsheets.zip.is(() => {\n  awesome.site();\n});\n```\n\n#### other.js\n\n```js\nhere.is.some.more();\n```\n````\n\nCode blocks can have headings.\n\n### Line wrapping\n\n```js {.wrap}\n<script>(function(d,s){if(window.Promise&&[].includes&&Object.assign&&window.Map)return;var js,sc=d.getElementsByTagName(s)[0];js=d.createElement(s);js.src='https://cdn.polyfill.io/v2/polyfill.min.js';sc.parentNode.insertBefore(js, sc);}(document,'script'))</script>\n```\n\n#### ↓ Source Code\n\n````markdown {.wrap}\n```js {.wrap}\n<script>(function(d,s){if(window.Promise&&[].includes&&Object.assign&&window.Map)return;var js,sc=d.getElementsByTagName(s)[0];js=d.createElement(s);js.src='https://cdn.polyfill.io/v2/polyfill.min.js';sc.parentNode.insertBefore(js, sc);}(document,'script'))</script>\n```\n````\n\nAdd `{.wrap}` to wrap long lines.\n\n### Long lines (default)\n\n```js\nfunction createNode(nodeName: string, options: { key: string }) {\n  return true\n}\n```\n\nLong lines will have scrollbars.\n\n## Paragraph Variants\n\n### Header paragraphs\n\nThe text that appears in the header\n\n#### ↓ Source Code\n\n```markdown {.wrap}\n### Basic paragraphs\n\nThe text that appears in the header\n```\n\n### Middle paragraphs {.row-span-2}\n\n- This is a list\n\nThis paragraph will appear in the middle\n\n```js\ncheatsheets.is(() => {\n  awesome.site();\n});\n```\n\n#### ↓ Source Code\n\n````markdown\n### Middle paragraphs\n\n- This is a list\n\nThis paragraph will appear in the middle\n\n```js\ncheatsheets.is(() => {\n  awesome.site();\n});\n```\n````\n\n### Footer paragraphs {.row-span-2}\n\n```js\ncheatsheets.is(() => {\n  awesome.site();\n});\n```\n\n#### ↓ Source Code\n\n````markdown\n```js\ncheatsheets.is(() => {\n  awesome.site();\n});\n```\n\nThis paragraph will appear in the footer\n````\n\nThis paragraph will appear in the footer\n\n### Crosslink\n\nAdd `{.link-arrow}` to make big loud external links:\n\n```js\n[Home](/) {.link-arrow}\n```\n\n[Home](/) {.link-arrow}\n\n## Cards Example\n\n### row-span-2 {.row-span-2}\n\n```\n1\n```\n\n### col-span-2 {.col-span-2}\n\n```\n2\n```\n\n### Primary Card {.primary}\n\n```\n3\n```\n\nAdd `{.primary}` to make the title red.\n\n### Secondary Card {.secondary}\n\n```\n4\n```\n\nAdd `{.secondary}` to make the title yellow.\n\n### col-span-3 {.col-span-3}\n\n```\n5\n```\n"
  },
  {
    "path": "source/_posts/quip.md",
    "content": "---\ntitle: Quip.com\ndate: 2022-11-23 16:23:31.697261\nbackground: bg-[#e4795b]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 52 keyboard shortcuts found in Quip\n---\n\n## Keyboard Shortcuts\n\n### Anywhere\n\n| Shortcut                  | Action                                                      |\n| ------------------------- | ----------------------------------------------------------- |\n| <code>\\`</code>           | Toggle styles between different types of headings and lists |\n| `Tab`                     | Indent a list item                                          |\n| `Shift` `Tab`             | De-indent a list item                                       |\n| `Shift` `Enter`           | Add a single space between lines                            |\n| `Esc`                     | Stop editing                                                |\n| `Ctrl` `/`                | List all keyboard shortcuts                                 |\n| `Ctrl` `Alt` `Shift` `N`  | Create a new ...                                            |\n| `Ctrl` `Alt` `N`          | Create a new document                                       |\n| `Ctrl` `Alt` `M`          | Create a new message                                        |\n| `Ctrl` `Shift` `D`        | Go to the desktop                                           |\n| `Ctrl` `Alt` `O`          | Search for a document, folder, or conversation              |\n| `Ctrl` `Alt` `Left/Right` | Move between tabs in the desktop app                        |\n\n{.shortcuts}\n\n### Style Shortcuts\n\n| Shortcut           | Action                                   |\n| ------------------ | ---------------------------------------- |\n| `Ctrl` `B`         | Bold the selected text                   |\n| `Ctrl` `I`         | Italicize the selected text              |\n| `Ctrl` `U`         | Underline the selected text              |\n| `Ctrl` `Shift` `X` | Strikethrough the selected text          |\n| `Ctrl` `Shift` `K` | Monospace (code style) the selected text |\n| `Ctrl` `Alt` `0`   | Paragraph (normal text style)            |\n| `Ctrl` `Alt` `1`   | Large heading style                      |\n| `Ctrl` `Alt` `2`   | Medium heading style                     |\n| `Ctrl` `Alt` `3`   | Small heading style                      |\n| `Ctrl` `Shift` `L` | Bulleted list style                      |\n| `Ctrl` `Alt` `K`   | Code block style                         |\n\n{.shortcuts}\n\n### Editing Shortcuts\n\n| Shortcut            | Action                         |\n| ------------------- | ------------------------------ |\n| `Ctrl` `Alt` `Up`   | Move a list item up one line   |\n| `Ctrl` `Alt` `Down` | Move a list item down one line |\n| `Ctrl` `Enter`      | Check a list item              |\n| `Ctrl` `Z`          | Undo                           |\n| `Ctrl` `Shift` `Z`  | Redo                           |\n| `Ctrl` `X`          | Cut                            |\n| `Ctrl` `C`          | Copy                           |\n| `Ctrl` `V`          | Paste                          |\n| `Ctrl` `P`          | Print document                 |\n| `Ctrl` `K`          | Insert link                    |\n| `Ctrl` `N`          | Next line                      |\n| `Ctrl` `P`          | Previous line                  |\n| `Ctrl` `Alt` `C`    | Hide or show conversation      |\n| `Ctrl` `Shift` `C`  | Add a comment                  |\n| `Ctrl` `Alt` `S`    | Finish edit session            |\n| `Ctrl` `Shift` `A`  | Create an anchor link          |\n\n{.shortcuts}\n\n### Spreadsheets\n\n| Shortcut                  | Action                                                       |\n| ------------------------- | ------------------------------------------------------------ |\n| `Ctrl` `(arrows)`         | Move to the edge of dat or the next non-empty cell           |\n| `Ctrl` `Shift` `(arrows)` | Expand select to the edge of data or the next non-empty cell |\n| `Shift` `Space`           | Select row                                                   |\n| `Ctrl` `Space`            | Select column                                                |\n| `Ctrl` `Enter`            | Fill selection with entered text                             |\n| `Ctrl` `D`                | Fill down in selection                                       |\n| `Ctrl` `R`                | Fill right in selection                                      |\n| `Ctrl` `Backspace`        | Scroll focused cell into view                                |\n| `Ctrl` `I`                | Insert above or in front of selected rows or columns         |\n| `Ctrl` `-`                | Remove selected rows or columns                              |\n| `Ctrl` `;`                | Insert current time                                          |\n| `Ctrl` `:`                | Insert today's date                                          |\n| `Alt` `Enter`             | Hard return within a cell                                    |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Quip](https://www.quipsupport.com/hc/en-us/articles/210436306-What-are-Quip-s-keyboard-shortcuts-)\n  _(www.quipsupport.com)_\n"
  },
  {
    "path": "source/_posts/react-test-library.md",
    "content": "---\ntitle: 'React Testing Library Cheat Sheet'\ndate: 2022-09-09 00:00:00\nbackground: bg-blue-500\ntags:\n  - react\n  - testing\n  - javascript\n  - cheatsheet\n\ncategories:\n  - Testing\n\nintro: |\n  When it comes to testing React apps manually, we can either choose to render individual component trees in a simplified test environment or run the complete app in a realistic browser environment (end-to-end testing). But for automated tests, React Testing Library (RTL) is recommended for its user-centric approach and maintainability.\nplugins:\n  - copyCode\n---\n\n## Introduction\n\nReact Testing Library is built on top of DOM Testing Library to test React components by querying and interacting with real DOM nodes, avoiding reliance on implementation details.\n\n## Basic level\n\n### 1. Purpose & Solution\n\nRTL addresses maintainability by focusing on user-visible behavior:\n\n- Tests run in actual DOM nodes.\n- Queries mirror user interactions.\n- `data-testid` as an escape hatch when needed.\n- Encourages accessibility.\n\n### 2. A basic component render test\n\n**Component (App.js):**\n\n```js\nconst title = 'Hello, World!';\n\nfunction App() {\n  return <div>{title}</div>;\n}\n\nexport default App;\n```\n\n**Test (App.test.js):**\n\n```js\nimport { render } from '@testing-library/react';\nimport App from './App';\n\ndescribe('App', () => {\n  test('renders App component', () => {\n    render(<App />);\n  });\n});\n```\n\nAdd debug to inspect output:\n\n```js\nimport { render, screen } from '@testing-library/react';\nimport App from './App';\n\ndescribe('App', () => {\n  test('renders App component', () => {\n    render(<App />);\n    screen.debug();\n  });\n});\n```\n\nOutput in console:\n\n```html\n<body>\n  <div>\n    <div>Hello, World!</div>\n  </div>\n</body>\n```\n\n### 3. Why use RTL vs Enzyme?\n\n1. Tests based on user interactions, not internal APIs.\n2. Improves maintainability after refactors.\n3. Intuitive syntax (`getByText`, `getByAltText`, etc.).\n\n### 4. Queries in RTL\n\n```js\nimport { render, screen } from '@testing-library/react';\n\ntest('should show login form', () => {\n  render(<Login />);\n  const input = screen.getByLabelText('Username');\n  // events & assertions\n});\n```\n\n**Single element queries:**\n\n- `getBy*`: throws if none found\n- `queryBy*`: returns null if none\n- `findBy*`: async Promise\n\n**Multiple elements queries:**\n\n- `getAllBy*`: throws if none\n- `queryAllBy*`: returns \\[] if none\n- `findAllBy*`: async Promise array\n\n### 5. Component tree testing level\n\n- Test at user interaction level, not per individual child component unless needed.\n\n## Intermediate level\n\n### 1. Jest vs RTL\n\n- **Jest**: Test runner & assertion library (`describe`, `test`, `expect`).\n- **RTL**: DOM utilities for React; works within Jest (or other runners).\n\n### 2. Mocking with MSW\n\n```js\n// fetch.test.jsx\nimport React from 'react';\nimport { rest } from 'msw';\nimport { setupServer } from 'msw/node';\nimport { render, fireEvent, waitFor, screen } from '@testing-library/react';\nimport '@testing-library/jest-dom';\nimport Fetch from '../fetch';\n\nconst server = setupServer(\n  rest.get('/greeting', (req, res, ctx) =>\n    res(ctx.json({ greeting: 'hello there' }))\n  )\n);\n\nbeforeAll(() => server.listen());\nafterEach(() => server.resetHandlers());\nafterAll(() => server.close());\n\ntest('loads and displays greeting', async () => {\n  render(<Fetch url=\"/greeting\" />);\n  fireEvent.click(screen.getByText('Load Greeting'));\n  await waitFor(() => screen.getByRole('heading'));\n  expect(screen.getByRole('heading')).toHaveTextContent('hello there');\n  expect(screen.getByRole('button')).toBeDisabled();\n});\n\ntest('handles server error', async () => {\n  server.use(rest.get('/greeting', (req, res, ctx) => res(ctx.status(500))));\n  render(<Fetch url=\"/greeting\" />);\n  fireEvent.click(screen.getByText('Load Greeting'));\n  await waitFor(() => screen.getByRole('alert'));\n  expect(screen.getByRole('alert')).toHaveTextContent('Oops, failed to fetch!');\n  expect(screen.getByRole('button')).not.toBeDisabled();\n});\n```\n\n### 3. `render` options\n\n```js\nimport { render } from '@testing-library/react';\nimport '@testing-library/jest-dom';\n\ntest('renders a message', () => {\n  const table = document.createElement('table');\n  const { container } = render(<TableBody {...props} />, {\n    container: document.body.appendChild(table),\n    baseElement: document.body,\n    hydrate: true,\n    legacyRoot: true,\n    queries: {\n      /* custom queries */\n    }\n  });\n  expect(container).toBeInTheDocument();\n});\n```\n\n### 4. `renderHook` usage\n\n```js\nimport { renderHook } from '@testing-library/react';\n\ntest('returns logged in user', () => {\n  const { result, rerender } = renderHook(\n    ({ name } = {}) => useLoggedInUser(name),\n    { initialProps: { name: 'Alice' } }\n  );\n  expect(result.current).toEqual({ name: 'Alice' });\n  rerender({ name: 'Bob' });\n  expect(result.current).toEqual({ name: 'Bob' });\n});\n```\n\n## Advanced Level\n\n### 1. Adding custom queries\n\n```js\nconst dom = require('@testing-library/dom');\nconst { queryHelpers, buildQueries } = require('@testing-library/react');\n\n// Override testId attribute\nexport const queryByTestId = queryHelpers.queryByAttribute.bind(\n  null,\n  'data-test-id'\n);\nexport const queryAllByTestId = queryHelpers.queryAllByAttribute.bind(\n  null,\n  'data-test-id'\n);\nexport function getAllByTestId(container, id, ...rest) {\n  const els = queryAllByTestId(container, id, ...rest);\n  if (!els.length)\n    throw queryHelpers.getElementError(\n      `No element with [data-test-id=\"${id}\"]`,\n      container\n    );\n  return els;\n}\nexport function getByTestId(container, id, ...rest) {\n  const els = getAllByTestId(container, id, ...rest);\n  if (els.length > 1)\n    throw queryHelpers.getElementError(\n      `Multiple elements with [data-test-id=\"${id}\"]`,\n      container\n    );\n  return els[0];\n}\n```\n\nOr using `buildQueries`:\n\n```js\nconst queryAllByDataCy = (...args) =>\n  queryHelpers.queryAllByAttribute('data-cy', ...args);\nconst [\n  queryByDataCy,\n  getAllByDataCy,\n  getByDataCy,\n  findAllByDataCy,\n  findByDataCy\n] = buildQueries(\n  queryAllByDataCy,\n  (c, v) => `Found multiple elements with data-cy=\"${v}\"`,\n  (c, v) => `Unable to find element with data-cy=\"${v}\"`\n);\n```\n\n### 2. Skipping auto cleanup\n\n- Via CLI: `cross-env RTL_SKIP_AUTO_CLEANUP=true jest`\n- Or add to Jest `setupFiles`: `import '@testing-library/react/dont-cleanup-after-each';`\n\n### 3. Migrating from Enzyme\n\n1. Install RTL & jest-dom.\n2. Replace `shallow`/`mount` with `render` + `screen`.\n3. Migrate tests incrementally.\n\n### 4. Querying within elements\n\n```js\nimport { render, within } from '@testing-library/react';\n\nconst { getByText } = render(<MyComponent />);\nconst section = getByText('messages');\nconst hello = within(section).getByText('hello');\n```\n\n### 5. Integration testing\n\n```js\nimport { render, cleanup, waitFor } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport nock from 'nock';\nimport App from '../App';\n\nconst REPOS = [{ name: 'repo1', description: '...' }];\n\nbeforeAll(() =>\n  nock('https://api.github.com')\n    .persist()\n    .get('/users/alice/repos')\n    .reply(200, REPOS)\n);\nafterEach(cleanup);\n\ntest('user sees public repos', async () => {\n  render(<App />);\n  userEvent.type(screen.getByPlaceholderText('Enter username'), 'alice');\n  userEvent.click(screen.getByRole('button', { name: /submit/i }));\n  await waitFor(() =>\n    REPOS.forEach((r) => expect(screen.getByText(r.name)).toBeInTheDocument())\n  );\n  expect(screen.queryByText('Loading...')).toBeNull();\n});\n```\n\n## Conclusion\n\nThis comprehensive cheat sheet covers basic to advanced RTL usage—rendering, querying, mocking, custom queries, and integration tests—to help you write robust, maintainable tests.\n"
  },
  {
    "path": "source/_posts/react.md",
    "content": "---\ntitle: React\ndate: 2023-11-17 10:12:25\nbackground: bg-[#1289D8]\ntags:\n  - react\n  - web\ncategories:\n  - Programming\nintro: |\n  A React cheat sheet with the most important concepts, functions, methods, and more. A complete quick reference for beginners.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### JSX\n\nJSX is a syntax extension for JavaScript that lets you write HTML-like markup inside a JavaScript file.\n\n```javascript\nlet element = <h1>Hello, world!</h1>;\n\nlet emptyHeading = <h1 />;\n```\n\n### JSX Expressions\n\n```javascript\nlet name = 'Josh Perez';\nlet element = <h1>Hello, {name}</h1>;\n\nfunction fullName(firstName, lastName) {\n  return firstName + ' ' + lastName;\n}\nlet element = <h1>Hello, {fullName('Julie', 'Johnson')}</h1>;\n```\n\n### JSX Attributes\n\n```javascript\nconst element = <img src={user.avatarUrl} />;\nconst element = <button className=\"btn\">Click me</button>;\n```\n\n### JSX Functions\n\n```javascript\nname() {\n  return \"Julie\";\n}\n\nreturn (\n  <h1>\n    Hi {name()}!\n  </h1>\n)\n```\n\n### JSX Conditional Rendering {.col-span-2}\n\n```javascript\nimport React from 'react';\nfunction Weather(props) {\n  if (props.temperature >= 20) {\n    return (\n      <p>\n        It is {props.temperature}°C (Warm) in {props.city}\n      </p>\n    );\n  } else {\n    return (\n      <p>\n        It is {props.temperature}°C in {props.city}\n      </p>\n    );\n  }\n}\n\nexport default () => <Weather city=\"New York\" temperature={24} />;\n```\n\nNote: A component must always return something.\n\n## Components\n\n### Functional Component\n\n```javascript\nimport React from 'react';\n\nexport default function UserProfile() {\n  return (\n    <div className=\"UserProfile\">\n      <div>Hello</div>\n      <div>World</div>\n    </div>\n  );\n}\n```\n\nNote: Every component needs one root element\n\n### Embed an internal Component\n\n```javascript\nimport React from 'react';\nimport UserAvatar from './UserAvatar';\n\nexport default function UserProfile() {\n  return (\n    <div className=\"UserProfile\">\n      <UserAvatar />\n      <UserAvatar />\n    </div>\n  );\n}\n```\n\nNote: Assuming UserAvatar is declared in UserAvatar.js\n\n### Embed an external Component\n\n```javascript\nimport React from 'react';\nimport ComponentName from 'component-name';\n\nexport default function UserProfile() {\n  return (\n    <div className=\"UserProfile\">\n      <ComponentName />\n    </div>\n  );\n}\n```\n\nNote: External components are found on npmjs.com and need to be imported first.\n\n### Advanced Functional Components\n\n```javascript\nimport React from 'react';\n\nfunction Hello(props) {\n  function fullName() {\n    return `${props.firstName} ${props.lastName}`;\n  }\n  return <p>{fullName()}</p>;\n}\n\nexport default () => <Hello firstName=\"Matt\" lastName=\"Delac\" />;\n```\n\n## Properties {.cols-2}\n\n### Passing Properties to a Component\n\n<!-- prettier-ignore -->\n```javascript\n<Student\n  firstName=\"Julie\"\n  lastName=\"Johnson\"\n  age={23}\n  pro={true}\n/>\n```\n\n### Assigning the Properties from a Component\n\n```javascript\nimport React from 'react';\n\nexport default function Student(props) {\n  return (\n    <h1>\n      {props.firstName} {props.lastName} is {props.age}.\n    </h1>\n  );\n}\n```\n\n## States {.cols-1}\n\n### React State\n\n```javascript\nimport React, { useState } from 'react';\n\nexport default function Hello(props) {\n  let [name, setName] = useState('Julie');\n  function updateName() {\n    let newName = prompt('What is your name?');\n    setName(newName);\n  }\n\n  return (\n    <div>\n      <h1>{name}</h1>\n      <button onClick={updateName}>Update name</button>\n    </div>\n  );\n}\n```\n\n## Events {.cols-1}\n\n### Event Listener\n\n```javascript\nimport React from 'react';\n\nexport default function Hello() {\n  function handleClick(event) {\n    event.preventDefault();\n    alert('Hello World');\n  }\n\n  return (\n    <a href=\"/\" onClick={handleClick}>\n      Say Hi\n    </a>\n  );\n}\n```\n\nNote: The most common event listeners are onClick for links/buttons and onSubmit for forms.\n\n## Loops {.cols-2}\n\n### Looping through an Array\n\n```javascript\nlet elements = ['one', 'two', 'three'];\n\nreturn (\n  <ul>\n    {elements.map(function (value, index) {\n      return <li key={index}>{value}</li>;\n    })}\n  </ul>\n);\n```\n\nNote: Each list item inside a map loop needs a key attribute with a unique value which is generally the index.\n\n### Looping through an Array of Objects\n\n```javascript\nlet elements = [\n  {\n    name: 'one',\n    value: 1\n  },\n  {\n    name: 'two',\n    value: 2\n  },\n  {\n    name: 'three',\n    value: 3\n  }\n];\nreturn (\n  <ul>\n    {elements.map(function (element, index) {\n      return (\n        <li key={index}>\n          The value for {element.name} is {element.value}\n        </li>\n      );\n    })}\n  </ul>\n);\n```\n\nNote: Each list item inside a map loop needs a key attribute with a unique value which is generally the index.\n\n## Forms {.cols-1}\n\n### React Forms\n\n```javascript\nimport React, { useState } from 'react';\n\nexport default function LoginForm() {\n  let [username, setUsername] = useState('');\n  let [password, setPassword] = useState('');\n\n  function handleSubmit(event) {\n    event.preventDefault();\n    alert(`Loging in with ${username} and ${password}`);\n  }\n\n  function updateUsername(event) {\n    setUsername(event.target.value);\n  }\n\n  function updatePassword(event) {\n    setPassword(event.target.value);\n  }\n\n  return (\n    <form onSubmit={handleSubmit}>\n      <input type=\"text\" placeholder=\"Username\" onChange={updateUsername} />\n      <input type=\"password\" placeholder=\"Password\" onChange={updatePassword} />\n      <input type=\"submit\" value=\"Login\" />\n    </form>\n  );\n}\n```\n\n## CSS {.cols-1}\n\n### CSS in a React Component\n\n```javascript\nimport React from 'react';\nimport './Student.css';\n\nexport default function Student() {\n  return <div className=\"Student\">Julie Johnson</div>;\n}\n```\n\nNote: You'll then have to crate a css file called Student.css\n\n## AJAX {.cols-1}\n\n### AJAX Request with Axios\n\n```javascript\nimport React from 'react';\nimport axios from 'axios';\n\nexport default function Weather(props) {\n  function handleResponse(response) {\n    console.log(response);\n  }\n\n  if (notifications) {\n    return <p>notifications</p>;\n  } else {\n    let url = `https://notifications.com`;\n    axios.get(url).then(handleResponse);\n    return <p>Loading notifications..</p>;\n  }\n}\n```\n\nNote: Make sure to import Axios first to your project.\n\n## Hooks {.cols-2}\n\n### useState Hook\n\n```javascript\nimport React, { useState } from 'react';\n\nfunction Counter() {\n  const [count, setCount] = useState(0);\n\n  return (\n    <div>\n      <p>Count: {count}</p>\n      <button onClick={() => setCount(count + 1)}>Increment</button>\n    </div>\n  );\n}\n\nexport default Counter;\n```\n\nNote: The useState Hook is a built-in React Hook that allows functional components to manage local state. It provides a\nway to declare state variables and update them within a functional component. Example code illustrating how to use it\n\n### Multiple State Variable Declaration\n\n```javascript\nimport React, { useState } from 'react';\n\nfunction Counter() {\n  const [count, setCount] = useState(0);\n  const [name, setName] = useState('');\n  const [isCompleted, setIsCompleted] = useState(false);\n\n  const handleIncrement = () => {\n    setCount(count + 1);\n  };\n\n  const handleNameChange = (event) => {\n    setName(event.target.value);\n  };\n\n  const toggleCompletion = () => {\n    setIsCompleted(!isCompleted);\n  };\n\n  return (\n    <div>\n      <p>Count: {count}</p>\n      <button onClick={handleIncrement}>Increment</button>\n\n      <input\n        type=\"text\"\n        value={name}\n        onChange={handleNameChange}\n        placeholder=\"Enter your name\"\n      />\n\n      <label>\n        <input\n          type=\"checkbox\"\n          checked={isCompleted}\n          onChange={toggleCompletion}\n        />\n        Completed\n      </label>\n    </div>\n  );\n}\n\nexport default Counter;\n```\n\nNote: You can declare multiple state variables using the useState Hook by calling it multiple times in a functional\ncomponent. Each call to useState manages a separate piece of state.\n\n### Input State Management\n\n```javascript\nimport { useState } from 'react';\n\nfunction FormExample() {\n  const [formData, setFormData] = useState({\n    name: '',\n    email: '',\n    message: ''\n  });\n\n  const handleChange = (event) => {\n    const { name, value } = event.target;\n    setFormData((prevFormData) => ({ ...prevFormData, [name]: value }));\n  };\n\n  const handleSubmit = (event) => {\n    event.preventDefault();\n    alert(\n      `Name: ${formData.name}, Email: ${formData.email}, Message: ${formData.message}`\n    );\n  };\n\n  return (\n    <form onSubmit={handleSubmit}>\n      <label htmlFor=\"name\">Name:</label>\n      <input\n        type=\"text\"\n        id=\"name\"\n        name=\"name\"\n        value={formData.name}\n        onChange={handleChange}\n      />\n\n      <label htmlFor=\"email\">Email:</label>\n      <input\n        type=\"email\"\n        id=\"email\"\n        name=\"email\"\n        value={formData.email}\n        onChange={handleChange}\n      />\n\n      <label htmlFor=\"message\">Message:</label>\n      <textarea\n        id=\"message\"\n        name=\"message\"\n        value={formData.message}\n        onChange={handleChange}\n      />\n\n      <button type=\"submit\">Submit</button>\n    </form>\n  );\n}\n\nexport default FormExample;\n```\n\n### useEffect Hook\n\n```javascript\nimport React, { useState, useEffect } from 'react';\n\nfunction Timer() {\n  const [seconds, setSeconds] = useState(0);\n\n  useEffect(() => {\n    const interval = setInterval(() => {\n      setSeconds((prevSeconds) => prevSeconds + 1);\n    }, 1000);\n\n    return () => clearInterval(interval);\n  }, []);\n\n  return <div>Seconds: {seconds}</div>;\n}\n\nexport default Timer;\n```\n\nNote: The useEffect Hook in React is used for performing side effects in functional components. It allows you to execute\ncode based on component lifecycle events like mounting, updating, and unmounting.\n\n### Fetch API using useEffect\n\n```javascript\nimport React, { useState, useEffect } from 'react';\nimport axios from 'axios';\n\nfunction UserList() {\n  const [users, setUsers] = useState([]);\n\n  useEffect(() => {\n    axios\n      .get('https://jsonplaceholder.typicode.com/users')\n      .then((response) => {\n        setUsers(response.data);\n      })\n      .catch((error) => {\n        console.error('Error fetching users:', error);\n      });\n  }, []);\n\n  return (\n    <div>\n      <h2>User List</h2>\n      <ul>\n        {users.map((user) => (\n          <li key={user.id}>{user.name}</li>\n        ))}\n      </ul>\n    </div>\n  );\n}\n\nexport default UserList;\n```\n\nNote: Make sure to import Axios first to your project.\n\n### Custom Hook creation useLocalStorage\n\n```javascript\nimport { useState, useEffect } from 'react';\n\nfunction useLocalStorage(key, initialValue) {\n  const [value, setValue] = useState(() => {\n    const storedValue = localStorage.getItem(key);\n    return storedValue !== null ? JSON.parse(storedValue) : initialValue;\n  });\n\n  useEffect(() => {\n    localStorage.setItem(key, JSON.stringify(value));\n  }, [key, value]);\n\n  return [value, setValue];\n}\n\nexport default useLocalStorage;\n```\n\nNote: Custom Hooks are reusable functions in React that contain logic shared across multiple components. They allow you\nto extract stateful logic from components into standalone functions.\n\n### Creating Refs in Class Components\n\n```javascript\nimport React, { Component } from 'react';\n\nclass MyComponent extends Component {\n  constructor(props) {\n    super(props);\n    this.myRef = React.createRef();\n  }\n\n  componentDidMount() {\n    console.log(this.myRef.current); // Access the DOM element\n  }\n\n  render() {\n    return <div ref={this.myRef}>Hello, world!</div>;\n  }\n}\n\nexport default MyComponent;\n```\n\n### Using Refs in Functional Components\n\n```javascript\nimport React, { useRef, useEffect } from 'react';\n\nfunction MyComponent() {\n  const myRef = useRef(null);\n\n  useEffect(() => {\n    console.log(myRef.current); // Access the DOM element\n  }, []);\n\n  return <div ref={myRef}>Hello, world!</div>;\n}\n\nexport default MyComponent;\n```\n\n### Callback Refs\n\n```javascript\nimport React, { Component } from 'react';\n\nclass MyComponent extends Component {\n  constructor(props) {\n    super(props);\n    this.myRef = null;\n    this.setRef = (element) => {\n      this.myRef = element;\n    };\n  }\n\n  componentDidMount() {\n    console.log(this.myRef); // Access the DOM element\n  }\n\n  render() {\n    return <div ref={this.setRef}>Hello, world!</div>;\n  }\n}\n\nexport default MyComponent;\n```\n\n### Forwarding Refs\n\n```javascript\nCopy code\nimport React from \"react\";\n\nconst FancyButton = React.forwardRef((props, ref) => (\n  <button ref={ref} className=\"FancyButton\">\n    {props.children}\n  </button>\n));\n\n// Usage\nconst ref = React.createRef();\n<FancyButton ref={ref}>Click me!</FancyButton>;\n```\n\n### Accessing DOM Elements with Refs\n\n```javascript\nimport React, { useRef, useEffect } from 'react';\n\nfunction FocusInput() {\n  const inputRef = useRef(null);\n\n  useEffect(() => {\n    // Focus the input element when the component mounts\n    inputRef.current.focus();\n  }, []);\n\n  return <input ref={inputRef} type=\"text\" />;\n}\n\nexport default FocusInput;\n```\n\nNote: Refs are often used to access and interact with DOM elements directly. Here's an example where we focus an input\nelement using a ref.\n\n### Managing Focus with Refs\n\n```javascript\nimport React, { useRef } from 'react';\n\nfunction Form() {\n  const firstInputRef = useRef(null);\n  const secondInputRef = useRef(null);\n\n  const handleKeyDown = (e) => {\n    if (e.key === 'Enter') {\n      secondInputRef.current.focus();\n    }\n  };\n\n  return (\n    <div>\n      <input ref={firstInputRef} type=\"text\" onKeyDown={handleKeyDown} />\n      <input ref={secondInputRef} type=\"text\" />\n    </div>\n  );\n}\n\nexport default Form;\n```\n\nNote: You can also manage focus between multiple elements using refs.\n"
  },
  {
    "path": "source/_posts/reddit.md",
    "content": "---\ntitle: Reddit\ndate: 2022-11-23 16:23:31.705575\nbackground: bg-[#eb5528]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 17 keyboard shortcuts found on Reddit.com\n---\n\n## Keyboard Shortcuts\n\n### Navigation\n\n| Shortcut    | Action                    |\n| ----------- | ------------------------- |\n| `Shift` `?` | Show shortcuts            |\n| `J`         | Next post or comment      |\n| `K`         | Previous post or comment  |\n| `N`         | Next post in lightbox     |\n| `P`         | Previous post in lightbox |\n| `Enter`     | Open post                 |\n| `X`         | Open or close expando     |\n| `L`         | Go to post link           |\n\n{.shortcuts}\n\n### Action\n\n| Shortcut       | Action                     |\n| -------------- | -------------------------- |\n| `A`            | Upvote                     |\n| `Z`            | Downvote                   |\n| `C`            | New post                   |\n| `R`            | Reply to comments          |\n| `Ctrl` `Enter` | Submit comment or post     |\n| `S`            | Save                       |\n| `H`            | Hide                       |\n| `Q`            | Open navigation            |\n| `Enter`        | Collapse or expand comment |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Reddit](https://i.imgur.com/7644kEy.png) _(i.imgur.com)_\n"
  },
  {
    "path": "source/_posts/redis.md",
    "content": "---\ntitle: Redis\nbackground: bg-[#c13b2c]\ntags:\n  - cache\ncategories:\n  - Database\ndate: 2020-12-26 19:33:15\nintro: |\n  This is a [redis](https://redis.io/) quick reference cheat sheet that lists examples of redis commands\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Getting started\n\nStart Redis\n\n```shell script\n$ redis-server\n```\n\nConnect to redis (Redis CLI client)\n\n```shell script\n$ redis-cli\n```\n\nConnect to redis (telnet)\n\n```shell script\n$ telnet 127.0.0.1 6379\n```\n\n### Hello World\n\n#### Ping\n\n```shell script\nredis> PING\nPONG\n```\n\n#### Hello World\n\n```shell script\nredis> SET mykey \"Hello world\"\nOK\nredis> GET mykey\n\"Hello world\"\n```\n\n### Basic Data types\n\n- [Strings](#redis-string-command)\n- [Lists](#redis-list-command)\n- [Hashes](#redis-hash-command)\n- [Sets](#redis-set-command)\n- [Sorted Sets](#redis-sorted-set-command)\n\nRedis supports 5 basic data types\n\n## Redis String command{.cols-3}\n\n### APPEND\n\n```{.wrap}\nAPPEND key value\n```\n\n#### Example\n\n```shell script\nredis> EXISTS mykey\n(integer) 0\nredis> APPEND mykey \"Hello\"\n(integer) 5\nredis> APPEND mykey \" World\"\n(integer) 11\nredis> GET mykey\n\"Hello World\"\n```\n\nAppend a value to a key\n\n### BITCOUNT\n\n```{.wrap}\nBITCOUNT key [start end]\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"foobar\"\n\"OK\"\nredis> BITCOUNT mykey\n(integer) 26\nredis> BITCOUNT mykey 0 0\n(integer) 4\nredis> BITCOUNT mykey 1 1\n(integer) 6\n```\n\nCount set bits in a string\n\n### BITFIELD\n\n```{.wrap}\nBITFIELD key [GET type offset] [SET type offset value] [INCRBY type offset increment] [OVERFLOW WRAP|SAT|FAIL]\n```\n\n#### Example\n\n```shell script\nredis> BITFIELD mykey INCRBY i5 100 1 GET u4 0\n1) (integer) 1\n2) (integer) 0\n```\n\nPerform arbitrary bitfield integer operations on strings\n\n### BITOP\n\n```{.wrap}\nBITOP operation destkey key [key ...]\n```\n\n#### Example\n\n```shell script\nredis> SET key1 \"foobar\"\n\"OK\"\nredis> SET key2 \"abcdef\"\n\"OK\"\nredis> BITOP AND dest key1 key2\n(integer) 6\nredis> GET dest\n\"`bc`ab\"\n```\n\nPerform bitwise operations between strings\n\n### BITPOS\n\n```{.wrap}\nBITPOS key bit [start] [end]\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"\\xff\\xf0\\x00\"\n\"OK\"\nredis> BITPOS mykey 0\n(integer) 12\nredis> SET mykey \"\\x00\\xff\\xf0\"\n\"OK\"\nredis> BITPOS mykey 1 0\n(integer) 8\nredis> BITPOS mykey 1 2\n(integer) 16\nredis> set mykey \"\\x00\\x00\\x00\"\n\"OK\"\nredis> BITPOS mykey 1\n(integer) -1\n```\n\nFind first bit set or clear in a string\n\n### DECR\n\n```{.wrap}\nDECR key\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"10\"\n\"OK\"\nredis> DECR mykey\n(integer) 9\nredis> SET mykey \"234293482390480948029348230948\"\n\"OK\"\nredis> DECR mykey\nERR ERR value is not an integer or out of range\n```\n\nDecrement the integer value of a key by one\n\n### DECRBY\n\n```{.wrap}\nDECRBY key decrement\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"10\"\n\"OK\"\nredis> DECRBY mykey 3\n(integer) 7\n```\n\nDecrement the integer value of a key by the given number\n\n### GET\n\n```{.wrap}\nGET key\n```\n\n#### Example\n\n```shell script\nredis> GET nonexisting\n(nil)\nredis> SET mykey \"Hello\"\n\"OK\"\nredis> GET mykey\n\"Hello\"\n```\n\nGet the value of a key\n\n### GETBIT\n\n```{.wrap}\nGETBIT key offset\n```\n\n#### Example\n\n```shell script\nredis> SETBIT mykey 7 1\n(integer) 0\nredis> GETBIT mykey 0\n(integer) 0\nredis> GETBIT mykey 7\n(integer) 1\nredis> GETBIT mykey 100\n(integer) 0\n```\n\nReturns the bit value at offset in the string value stored at key\n\n### GETRANGE\n\n```{.wrap}\nGETRANGE key start end\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"This is a string\"\n\"OK\"\nredis> GETRANGE mykey 0 3\n\"This\"\nredis> GETRANGE mykey -3 -1\n\"ing\"\nredis> GETRANGE mykey 0 -1\n\"This is a string\"\nredis> GETRANGE mykey 10 100\n\"string\"\n```\n\nGet a substring of the string stored at a key\n\n### GETSET\n\n```{.wrap}\nGETSET key value\n```\n\n#### Example\n\n```shell script\nredis> INCR mycounter\n(integer) 1\nredis> GETSET mycounter \"0\"\n\"1\"\nredis> GET mycounter\n\"0\"\n```\n\nSet the string value of a key and return its old value\n\n### INCR\n\n```{.wrap}\nINCR key\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"10\"\n\"OK\"\nredis> INCR mykey\n(integer) 11\nredis> GET mykey\n\"11\"\n```\n\nIncrement the integer value of a key by one\n\n### MSETNX\n\n```{.wrap}\nMSETNX key value [key value ...]\n```\n\n#### Example\n\n```shell script\nredis> MSETNX key1 \"Hello\" key2 \"there\"\n(integer) 1\nredis> MSETNX key2 \"new\" key3 \"world\"\n(integer) 0\nredis> MGET key1 key2 key3\n1) \"Hello\"\n2) \"there\"\n3) (nil)\n```\n\nSet multiple keys to multiple values, only if none of the keys exist\n\n### INCRBYFLOAT\n\n```{.wrap}\nINCRBYFLOAT key increment\n```\n\n#### Example\n\n```shell script\nredis> SET mykey 10.50\n\"OK\"\nredis> INCRBYFLOAT mykey 0.1\n\"10.6\"\nredis> INCRBYFLOAT mykey -5\n\"5.6\"\nredis> SET mykey 5.0e3\n\"OK\"\nredis> INCRBYFLOAT mykey 2.0e2\n\"5200\"\n```\n\nIncrement the float value of a key by the given amount\n\n### MGET\n\n```{.wrap}\nMGET key [key ...]\n```\n\n#### Example\n\n```shell script\nredis> SET key1 \"Hello\"\n\"OK\"\nredis> SET key2 \"World\"\n\"OK\"\nredis> MGET key1 key2 nonexisting\n1) \"Hello\"\n2) \"World\"\n3) (nil)\n```\n\nGet the values of all the given keys\n\n### MSET\n\n```{.wrap}\nMSET key value [key value ...]\n```\n\n#### Example\n\n```shell script\nredis> MSET key1 \"Hello\" key2 \"World\"\n\"OK\"\nredis> GET key1\n\"Hello\"\nredis> GET key2\n\"World\"\n```\n\nSet multiple keys to multiple values\n\n### INCRBY\n\n```{.wrap}\nINCRBY key increment\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"10\"\n\"OK\"\nredis> INCRBY mykey 5\n(integer) 15\n```\n\nIncrement the integer value of a key by the given amount\n\n### PSETEX\n\n```{.wrap}\nPSETEX key milliseconds value\n```\n\n#### Example\n\n```shell script\nredis> PSETEX mykey 1000 \"Hello\"\n\"OK\"\nredis> PTTL mykey\n(integer) 1000\nredis> GET mykey\n\"Hello\"\n```\n\nSet the value and expiration in milliseconds of a key\n\n### SET\n\n```{.wrap}\nSET key value [EX seconds|PX milliseconds|KEEPTTL] [NX|XX] [GET]\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"Hello\"\n\"OK\"\nredis> GET mykey\n\"Hello\"\nredis> SET anotherkey \"will expire in a minute\" EX 60\n\"OK\"\n```\n\nSet the string value of a key\n\n### SETBIT\n\n```{.wrap}\nSETBIT key offset value\n```\n\n#### Example\n\n```shell script\nredis> SETBIT mykey 7 1\n(integer) 0\nredis> SETBIT mykey 7 0\n(integer) 1\nredis> GET mykey\n\"\\u0000\"\n```\n\nSets or clears the bit at offset in the string value stored at key\n\n### SETEX\n\n```{.wrap}\nSETEX key seconds value\n```\n\n#### Example\n\n```shell script\nredis> SETEX mykey 10 \"Hello\"\n\"OK\"\nredis> TTL mykey\n(integer) 10\nredis> GET mykey\n\"Hello\"\n```\n\nSet the value and expiration of a key\n\n### SETNX\n\n```{.wrap}\nSETNX key value\n```\n\n#### Example\n\n```shell script\nredis> SETNX mykey \"Hello\"\n(integer) 1\nredis> SETNX mykey \"World\"\n(integer) 0\nredis> GET mykey\n\"Hello\"\n```\n\nSet the value of a key, only if the key does not exist\n\n### SETRANGE\n\n```{.wrap}\nSETRANGE key offset value\n```\n\n#### Example\n\n```shell script\nredis> SET key1 \"Hello World\"\n\"OK\"\nredis> SETRANGE key1 6 \"Redis\"\n(integer) 11\nredis> GET key1\n\"Hello Redis\"\n```\n\nOverwrite part of a string at key starting at the specified offset\n\n### STRLEN\n\n```{.wrap}\nSTRLEN key\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"Hello world\"\n\"OK\"\nredis> STRLEN mykey\n(integer) 11\nredis> STRLEN nonexisting\n(integer) 0\n```\n\nGet the length of the value stored in a key\n\n### STRALGO\n\n```{.wrap}\nSTRALGO LCS algo-specific-argument [algo-specific-argument ...]\n```\n\n#### Example\n\n```shell script\nredis> STRALGO LCS KEYS key1 key2 IDX\n1) \"matches\"\n2) 1) 1) 1) (integer) 4\n         2) (integer) 7\n      2) 1) (integer) 5\n         2) (integer) 8\n   2) 1) 1) (integer) 2\n         2) (integer) 3\n      2) 1) (integer) 0\n         2) (integer) 1\n3) \"len\"\n4) (integer) 6\n```\n\nRun algorithms (currently LCS) against strings\n\n## Redis Set command\n\n### SADD\n\n```{.wrap}\nSADD key member [member ...]\n```\n\n#### Example\n\n```shell script\nredis> SADD myset \"Hello\"\n(integer) 1\nredis> SADD myset \"World\"\n(integer) 1\nredis> SADD myset \"World\"\n(integer) 0\nredis> SMEMBERS myset\n1) \"Hello\"\n2) \"World\"\n```\n\nAdd one or more members to a set\n\n### SCARD\n\n```{.wrap}\nSCARD key\n```\n\n#### Example\n\n```shell script\nredis> SADD myset \"Hello\"\n(integer) 1\nredis> SADD myset \"World\"\n(integer) 1\nredis> SCARD myset\n(integer) 2\n```\n\nGet the number of members in a set\n\n### SDIFF\n\n```{.wrap}\nSDIFF key [key ...]\n```\n\n#### Example\n\n```shell script\nredis> SADD key1 \"a\"\n(integer) 1\nredis> SADD key1 \"b\"\n(integer) 1\nredis> SADD key1 \"c\"\n(integer) 1\nredis> SADD key2 \"c\"\n(integer) 1\nredis> SADD key2 \"d\"\n(integer) 1\nredis> SADD key2 \"e\"\n(integer) 1\nredis> SDIFF key1 key2\n1) \"a\"\n2) \"b\"\n```\n\nSubtract multiple sets\n\n### SDIFFSTORE\n\n```{.wrap}\nSDIFFSTORE destination key [key ...]\n```\n\n#### Example\n\n```shell script\nredis> SADD key1 \"a\"\n(integer) 1\nredis> SADD key1 \"b\"\n(integer) 1\nredis> SADD key1 \"c\"\n(integer) 1\nredis> SADD key2 \"c\"\n(integer) 1\nredis> SADD key2 \"d\"\n(integer) 1\nredis> SADD key2 \"e\"\n(integer) 1\nredis> SDIFFSTORE key key1 key2\n(integer) 2\nredis> SMEMBERS key\n1) \"a\"\n2) \"b\"\n```\n\nSubtract multiple sets and store the resulting set in a key\n\n### SINTER\n\n```{.wrap}\nSINTER key [key ...]\n```\n\n#### Example\n\n```shell script\nredis> SADD key1 \"a\"\n(integer) 1\nredis> SADD key1 \"b\"\n(integer) 1\nredis> SADD key1 \"c\"\n(integer) 1\nredis> SADD key2 \"c\"\n(integer) 1\nredis> SADD key2 \"d\"\n(integer) 1\nredis> SADD key2 \"e\"\n(integer) 1\nredis> SINTER key1 key2\n1) \"c\"\n```\n\nIntersect multiple sets\n\n### SINTERSTORE\n\n```{.wrap}\nSINTERSTORE destination key [key ...]\n```\n\n#### Example\n\n```shell script\nredis> SADD key1 \"a\"\n(integer) 1\nredis> SADD key1 \"b\"\n(integer) 1\nredis> SADD key1 \"c\"\n(integer) 1\nredis> SADD key2 \"c\"\n(integer) 1\nredis> SADD key2 \"d\"\n(integer) 1\nredis> SADD key2 \"e\"\n(integer) 1\nredis> SINTERSTORE key key1 key2\n(integer) 1\nredis> SMEMBERS key\n1) \"c\"\n```\n\nIntersect multiple sets and store the resulting set in a key\n\n### SISMEMBER\n\n```{.wrap}\nSISMEMBER key member\n```\n\n#### Example\n\n```shell script\nredis> SADD myset \"one\"\n(integer) 1\nredis> SISMEMBER myset \"one\"\n(integer) 1\nredis> SISMEMBER myset \"two\"\n(integer) 0\n```\n\nDetermine if a given value is a member of a set\n\n### SMISMEMBER\n\n```{.wrap}\nSMISMEMBER key member [member ...]\n```\n\n#### Example\n\n```shell script\nredis> SADD myset \"one\"\n(integer) 1\nredis> SADD myset \"one\"\n(integer) 0\nredis> SMISMEMBER myset \"one\" \"notamember\"\n1) (integer) 1\n2) (integer) 0\n```\n\nReturns the membership associated with the given elements for a set\n\n### SMEMBERS\n\n```{.wrap}\nSMEMBERS key\n```\n\n#### Example\n\n```shell script\nredis> SADD myset \"Hello\"\n(integer) 1\nredis> SADD myset \"World\"\n(integer) 1\nredis> SMEMBERS myset\n1) \"Hello\"\n2) \"World\"\n```\n\nGet all the members in a set\n\n### SMOVE\n\n```{.wrap}\nSMOVE source destination member\n```\n\n#### Example\n\n```shell script\nredis> SADD myset \"one\"\n(integer) 1\nredis> SADD myset \"two\"\n(integer) 1\nredis> SADD myotherset \"three\"\n(integer) 1\nredis> SMOVE myset myotherset \"two\"\n(integer) 1\nredis> SMEMBERS myset\n1) \"one\"\nredis> SMEMBERS myotherset\n1) \"two\"\n2) \"three\"\n```\n\nMove a member from one set to another\n\n### SPOP\n\n```{.wrap}\nSPOP key [count]\n```\n\n#### Example\n\n```shell script\nredis> SADD myset \"one\"\n(integer) 1\nredis> SADD myset \"two\"\n(integer) 1\nredis> SADD myset \"three\"\n(integer) 1\nredis> SPOP myset\n\"two\"\nredis> SMEMBERS myset\n1) \"one\"\n2) \"three\"\nredis> SADD myset \"four\"\n(integer) 1\nredis> SADD myset \"five\"\n(integer) 1\nredis> SPOP myset 3\n1) \"four\"\n2) \"five\"\n3) \"three\"\nredis> SMEMBERS myset\n1) \"one\"\n```\n\nRemove and return one or multiple random members from a set\n\n### SRANDMEMBER\n\n```{.wrap}\nSRANDMEMBER key [count]\n```\n\n#### Example\n\n```shell script\nredis> SADD myset one two three\n(integer) 3\nredis> SRANDMEMBER myset\n\"three\"\nredis> SRANDMEMBER myset 2\n1) \"two\"\n2) \"three\"\nredis> SRANDMEMBER myset -5\n1) \"one\"\n2) \"two\"\n3) \"three\"\n4) \"three\"\n5) \"one\"\n```\n\nGet one or multiple random members from a set\n\n### SREM\n\n```{.wrap}\nSREM key member [member ...]\n```\n\n#### Example\n\n```shell script\nredis> SADD myset \"one\"\n(integer) 1\nredis> SADD myset \"two\"\n(integer) 1\nredis> SADD myset \"three\"\n(integer) 1\nredis> SREM myset \"one\"\n(integer) 1\nredis> SREM myset \"four\"\n(integer) 0\nredis> SMEMBERS myset\n1) \"two\"\n2) \"three\"\n```\n\nRemove one or more members from a set\n\n### SUNION\n\n```{.wrap}\nSUNION key [key ...]\n```\n\n#### Example\n\n```shell script\nredis> SADD key1 \"a\"\n(integer) 1\nredis> SADD key1 \"b\"\n(integer) 1\nredis> SADD key1 \"c\"\n(integer) 1\nredis> SADD key2 \"c\"\n(integer) 1\nredis> SADD key2 \"d\"\n(integer) 1\nredis> SADD key2 \"e\"\n(integer) 1\nredis> SUNION key1 key2\n1) \"a\"\n2) \"c\"\n3) \"e\"\n4) \"b\"\n5) \"d\"\n```\n\nAdd multiple sets\n\n### SUNIONSTORE\n\n```{.wrap}\nSUNIONSTORE destination key [key ...]\n```\n\n#### Example\n\n```shell script\nredis> SADD key1 \"a\"\n(integer) 1\nredis> SADD key1 \"b\"\n(integer) 1\nredis> SADD key1 \"c\"\n(integer) 1\nredis> SADD key2 \"c\"\n(integer) 1\nredis> SADD key2 \"d\"\n(integer) 1\nredis> SADD key2 \"e\"\n(integer) 1\nredis> SUNIONSTORE key key1 key2\n(integer) 5\nredis> SMEMBERS key\n1) \"a\"\n2) \"c\"\n3) \"e\"\n4) \"b\"\n5) \"d\"\n```\n\nAdd multiple sets and store the resulting set in a key\n\n## Redis List command\n\n### Misc\n\n| -                                                   | -                                                                                                  |\n| --------------------------------------------------- | -------------------------------------------------------------------------------------------------- |\n| [BRPOPLPUSH ](https://redis.io/commands/brpoplpush) | Pop an element from a list, push it to another list and return it; or block until one is available |\n| [BLMOVE ](https://redis.io/commands/blmove)         | Pop an element from a list, push it to another list and return it; or block until one is available |\n\n### BLPOP\n\n```{.wrap}\nBLPOP key [key ...] timeout\n```\n\n#### Example\n\n```shell script\nredis> DEL list1 list2\n(integer) 0\nredis> RPUSH list1 a b c\n(integer) 3\nredis> BLPOP list1 list2 0\n1) \"list1\"\n2) \"a\"\n```\n\nRemove and get the first element in a list, or block until one is available |\n\n### BRPOP\n\n```{.wrap}\nBRPOP key [key ...] timeout\n```\n\n#### Example\n\n```shell script\nredis> DEL list1 list2\n(integer) 0\nredis> RPUSH list1 a b c\n(integer) 3\nredis> BRPOP list1 list2 0\n1) \"list1\"\n2) \"c\"\n```\n\nRemove and get the last element in a list, or block until one is available |\n\n### LINDEX\n\n```{.wrap}\nLINDEX key index\n```\n\n#### Example\n\n```shell script\nredis> LPUSH mylist \"World\"\n(integer) 1\nredis> LPUSH mylist \"Hello\"\n(integer) 2\nredis> LINDEX mylist 0\n\"Hello\"\nredis> LINDEX mylist -1\n\"World\"\nredis> LINDEX mylist 3\n(nil)\n```\n\nGet an element from a list by its index\n\n### LINSERT\n\n```{.wrap}\nLINSERT key BEFORE|AFTER pivot element\n```\n\n#### Example\n\n```shell script\nredis> RPUSH mylist \"Hello\"\n(integer) 1\nredis> RPUSH mylist \"World\"\n(integer) 2\nredis> LINSERT mylist BEFORE \"World\" \"There\"\n(integer) 3\nredis> LRANGE mylist 0 -1\n1) \"Hello\"\n2) \"There\"\n3) \"World\"\n```\n\nInsert an element before or after another element in a list\n\n### LLEN\n\n```{.wrap}\nLLEN key\n```\n\n#### Example\n\n```shell script\nredis> LPUSH mylist \"World\"\n(integer) 1\nredis> LPUSH mylist \"Hello\"\n(integer) 2\nredis> LLEN mylist\n(integer) 2\n```\n\nGet the length of a list\n\n### LPOP\n\n```{.wrap}\nLPOP key [count]\n```\n\n#### Example\n\n```shell script\nredis> RPUSH mylist \"one\"\n(integer) 1\nredis> RPUSH mylist \"two\"\n(integer) 2\nredis> RPUSH mylist \"three\"\n(integer) 3\nredis> LPOP mylist\n\"one\"\nredis> LRANGE mylist 0 -1\n1) \"two\"\n2) \"three\"\n```\n\nRemove and get the first elements in a list\n\n### LPOS\n\n```{.wrap}\nLPOS key element [RANK rank] [COUNT num-matches] [MAXLEN len]\n```\n\n#### Example\n\n```shell script\nredis> RPUSH mylist a b c d 1 2 3 4 3 3 3\n(integer) 11\nredis> LPOS mylist 3\n(integer) 6\nredis> LPOS mylist 3 COUNT 0 RANK 2\n1) (integer) 8\n2) (integer) 9\n3) (integer) 10\n```\n\nReturn the index of matching elements on a list\n\n### LPUSH\n\n```{.wrap}\nLPUSH key element [element ...]\n```\n\n#### Example\n\n```shell script\nredis> LPUSH mylist \"world\"\n(integer) 1\nredis> LPUSH mylist \"hello\"\n(integer) 2\nredis> LRANGE mylist 0 -1\n1) \"hello\"\n2) \"world\"\n```\n\nPrepend one or multiple elements to a list\n\n### LPUSHX\n\n```{.wrap}\nLPUSHX key element [element ...]\n```\n\n#### Example\n\n```shell script\nredis> LPUSH mylist \"World\"\n(integer) 1\nredis> LPUSHX mylist \"Hello\"\n(integer) 2\nredis> LPUSHX myotherlist \"Hello\"\n(integer) 0\nredis> LRANGE mylist 0 -1\n1) \"Hello\"\n2) \"World\"\nredis> LRANGE myotherlist 0 -1\n(empty list or set)\n```\n\nPrepend an element to a list, only if the list exists\n\n### LRANGE\n\n```{.wrap}\nLRANGE key start stop\n```\n\n#### Example\n\n```shell script\nredis> RPUSH mylist \"one\"\n(integer) 1\nredis> RPUSH mylist \"two\"\n(integer) 2\nredis> RPUSH mylist \"three\"\n(integer) 3\nredis> LRANGE mylist 0 0\n1) \"one\"\nredis> LRANGE mylist -3 2\n1) \"one\"\n2) \"two\"\n3) \"three\"\nredis> LRANGE mylist -100 100\n1) \"one\"\n2) \"two\"\n3) \"three\"\nredis> LRANGE mylist 5 10\n(empty list or set)\n```\n\nGet a range of elements from a list\n\n### LREM\n\n```{.wrap}\nLREM key count element\n```\n\n#### Example\n\n```shell script\nredis> RPUSH mylist \"hello\"\n(integer) 1\nredis> RPUSH mylist \"hello\"\n(integer) 2\nredis> RPUSH mylist \"foo\"\n(integer) 3\nredis> RPUSH mylist \"hello\"\n(integer) 4\nredis> LREM mylist -2 \"hello\"\n(integer) 2\nredis> LRANGE mylist 0 -1\n1) \"hello\"\n2) \"foo\"\n```\n\nRemove elements from a list\n\n### LSET\n\n```{.wrap}\nLSET key index element\n```\n\n#### Example\n\n```shell script\nredis> RPUSH mylist \"one\"\n(integer) 1\nredis> RPUSH mylist \"two\"\n(integer) 2\nredis> RPUSH mylist \"three\"\n(integer) 3\nredis> LSET mylist 0 \"four\"\n\"OK\"\nredis> LSET mylist -2 \"five\"\n\"OK\"\nredis> LRANGE mylist 0 -1\n1) \"four\"\n2) \"five\"\n3) \"three\"\n```\n\nSet the value of an element in a list by its index\n\n### LTRIM\n\n```{.wrap}\nLTRIM key start stop\n```\n\n#### Example\n\n```shell script\nredis> RPUSH mylist \"one\"\n(integer) 1\nredis> RPUSH mylist \"two\"\n(integer) 2\nredis> RPUSH mylist \"three\"\n(integer) 3\nredis> LTRIM mylist 1 -1\n\"OK\"\nredis> LRANGE mylist 0 -1\n1) \"two\"\n2) \"three\"\n```\n\nTrim a list to the specified range\n\n### RPOP\n\n```{.wrap}\nRPOP key [count]\n```\n\n#### Example\n\n```shell script\nredis> RPUSH mylist \"one\"\n(integer) 1\nredis> RPUSH mylist \"two\"\n(integer) 2\nredis> RPUSH mylist \"three\"\n(integer) 3\nredis> RPOP mylist\n\"three\"\nredis> LRANGE mylist 0 -1\n1) \"one\"\n2) \"two\"\n```\n\nRemove and get the last elements in a list\n\n### RPOPLPUSH\n\n```{.wrap}\nRPOPLPUSH source destination\n```\n\n#### Example\n\n```shell script\nredis> RPUSH mylist \"one\"\n(integer) 1\nredis> RPUSH mylist \"two\"\n(integer) 2\nredis> RPUSH mylist \"three\"\n(integer) 3\nredis> RPOPLPUSH mylist myotherlist\n\"three\"\nredis> LRANGE mylist 0 -1\n1) \"one\"\n2) \"two\"\nredis> LRANGE myotherlist 0 -1\n1) \"three\"\n```\n\nRemove the last element in a list, prepend it to another list and return it\n\n### LMOVE\n\n```{.wrap}\nLMOVE source destination LEFT|RIGHT LEFT|RIGHT\n```\n\n#### Example\n\n```shell script\nredis> RPUSH mylist \"one\"\n(integer) 1\nredis> RPUSH mylist \"two\"\n(integer) 2\nredis> RPUSH mylist \"three\"\n(integer) 3\nredis> LMOVE mylist myotherlist RIGHT LEFT\n\"three\"\nredis> LMOVE mylist myotherlist LEFT RIGHT\n\"one\"\nredis> LRANGE mylist 0 -1\n1) \"two\"\nredis> LRANGE myotherlist 0 -1\n1) \"three\"\n2) \"one\"\n```\n\nPop an element from a list, push it to another list and return it\n\n### RPUSH\n\n```{.wrap}\nRPUSH key element [element ...]\n```\n\n#### Example\n\n```shell script\nredis> RPUSH mylist \"hello\"\n(integer) 1\nredis> RPUSH mylist \"world\"\n(integer) 2\nredis> LRANGE mylist 0 -1\n1) \"hello\"\n2) \"world\"\n```\n\nAppend one or multiple elements to a list\n\n### RPUSHX\n\n```{.wrap}\nRPUSHX key element [element ...]\n```\n\n#### Example\n\n```shell script\nredis> RPUSH mylist \"Hello\"\n(integer) 1\nredis> RPUSHX mylist \"World\"\n(integer) 2\nredis> RPUSHX myotherlist \"World\"\n(integer) 0\nredis> LRANGE mylist 0 -1\n1) \"Hello\"\n2) \"World\"\nredis> LRANGE myotherlist 0 -1\n(empty list or set)\n```\n\nAppend an element to a list, only if the list exists\n\n## Redis Hash command\n\n### HDEL\n\n```{.wrap}\nHDEL key field [field ...]\n```\n\n#### Example\n\n```shell script\nredis> HSET myhash field1 \"foo\"\n(integer) 1\nredis> HDEL myhash field1\n(integer) 1\nredis> HDEL myhash field2\n(integer) 0\n```\n\nDelete one or more hash fields\n\n### HEXISTS\n\n```{.wrap}\nHEXISTS key field\n```\n\n#### Example\n\n```shell script\nredis> HSET myhash field1 \"foo\"\n(integer) 1\nredis> HEXISTS myhash field1\n(integer) 1\nredis> HEXISTS myhash field2\n(integer) 0\n```\n\nDetermine if a hash field exists\n\n### HGET\n\n```{.wrap}\nHGET key field\n```\n\n#### Example\n\n```shell script\nredis> HSET myhash field1 \"foo\"\n(integer) 1\nredis> HGET myhash field1\n\"foo\"\nredis> HGET myhash field2\n(nil)\n```\n\nGet the value of a hash field\n\n### HGETALL\n\n```{.wrap}\nHGETALL key\n```\n\n#### Example\n\n```shell script\nredis> HSET myhash field1 \"Hello\"\n(integer) 1\nredis> HSET myhash field2 \"World\"\n(integer) 1\nredis> HGETALL myhash\n1) \"field1\"\n2) \"Hello\"\n3) \"field2\"\n4) \"World\"\n```\n\nGet all the fields and values in a hash\n\n### HINCRBY\n\n```{.wrap}\nHINCRBY key field increment\n```\n\n#### Example\n\n```shell script\nredis> HSET myhash field 5\n(integer) 1\nredis> HINCRBY myhash field 1\n(integer) 6\nredis> HINCRBY myhash field -1\n(integer) 5\nredis> HINCRBY myhash field -10\n(integer) -5\n```\n\nIncrement the integer value of a hash field by the given number\n\n### HINCRBYFLOAT\n\n```{.wrap}\nHINCRBYFLOAT key field increment\n```\n\n#### Example\n\n```shell script\nredis> HSET mykey field 10.50\n(integer) 1\nredis> HINCRBYFLOAT mykey field 0.1\n\"10.6\"\nredis> HINCRBYFLOAT mykey field -5\n\"5.6\"\nredis> HSET mykey field 5.0e3\n(integer) 0\nredis> HINCRBYFLOAT mykey field 2.0e2\n\"5200\"\n```\n\nIncrement the float value of a hash field by the given amount\n\n### HKEYS\n\n```{.wrap}\nHKEYS key\n```\n\n#### Example\n\n```shell script\nredis> HSET myhash field1 \"Hello\"\n(integer) 1\nredis> HSET myhash field2 \"World\"\n(integer) 1\nredis> HKEYS myhash\n1) \"field1\"\n2) \"field2\"\n```\n\nGet all the fields in a hash\n\n### HLEN\n\n```{.wrap}\nHLEN key\n```\n\n#### Example\n\n```shell script\nredis> HSET myhash field1 \"Hello\"\n(integer) 1\nredis> HSET myhash field2 \"World\"\n(integer) 1\nredis> HLEN myhash\n(integer) 2\n```\n\nGet the number of fields in a hash\n\n### HMGET\n\n```{.wrap}\nHMGET key field [field ...]\n```\n\n#### Example\n\n```shell script\nredis> HSET myhash field1 \"Hello\"\n(integer) 1\nredis> HSET myhash field2 \"World\"\n(integer) 1\nredis> HMGET myhash field1 field2 nofield\n1) \"Hello\"\n2) \"World\"\n3) (nil)\n```\n\nGet the values of all the given hash fields\n\n### HMSET\n\n```{.wrap}\nHMSET key field value [field value ...]\n```\n\n#### Example\n\n```shell script\nredis> HMSET myhash field1 \"Hello\" field2 \"World\"\n\"OK\"\nredis> HGET myhash field1\n\"Hello\"\nredis> HGET myhash field2\n\"World\"\n```\n\nSet multiple hash fields to multiple values\n\n### HSET\n\n```{.wrap}\nHSET key field value [field value ...]\n```\n\n#### Example\n\n```shell script\nredis> HSET myhash field1 \"Hello\"\n(integer) 1\nredis> HGET myhash field1\n\"Hello\"\n```\n\nSet the string value of a hash field\n\n### HSETNX\n\n```{.wrap}\nHSETNX key field value\n```\n\n#### Example\n\n```shell script\nredis> HSETNX myhash field \"Hello\"\n(integer) 1\nredis> HSETNX myhash field \"World\"\n(integer) 0\nredis> HGET myhash field\n\"Hello\"\n```\n\nSet the value of a hash field, only if the field does not exist\n\n### HSTRLEN\n\n```{.wrap}\nHSTRLEN key field\n```\n\n#### Example\n\n```shell script\nredis> HMSET myhash f1 HelloWorld f2 99 f3 -256\n\"OK\"\nredis> HSTRLEN myhash f1\n(integer) 10\nredis> HSTRLEN myhash f2\n(integer) 2\nredis> HSTRLEN myhash f3\n(integer) 4\n```\n\nGet the length of the value of a hash field\n\n### HVALS\n\n```{.wrap}\nHVALS key\n```\n\n#### Example\n\n```shell script\nredis> HSET myhash field1 \"Hello\"\n(integer) 1\nredis> HSET myhash field2 \"World\"\n(integer) 1\nredis> HVALS myhash\n1) \"Hello\"\n2) \"World\"\n```\n\nGet all the values in a hash\n\n## Redis Sorted set command\n\n### BZPOPMIN\n\n```{.wrap}\nBZPOPMIN key [key ...] timeout\n```\n\n#### Example\n\n```shell script\nredis> DEL zset1 zset2\n(integer) 0\nredis> ZADD zset1 0 a 1 b 2 c\n(integer) 3\nredis> BZPOPMIN zset1 zset2 0\n1) \"zset1\"\n2) \"a\"\n3) \"0\"\n```\n\nRemove and return the member with the lowest score from one or more sorted sets, or block until one is available\n\n### BZPOPMAX\n\n```{.wrap}\nBZPOPMAX key [key ...] timeout\n```\n\n#### Example\n\n```shell script\nredis> DEL zset1 zset2\n(integer) 0\nredis> ZADD zset1 0 a 1 b 2 c\n(integer) 3\nredis> BZPOPMAX zset1 zset2 0\n1) \"zset1\"\n2) \"c\"\n3) \"2\"\n```\n\nRemove and return the member with the highest score from one or more sorted sets, or block until one is available\n\n### ZADD {.row-span-2}\n\n```{.wrap}\nZADD key [NX|XX] [GT|LT] [CH] [INCR] score member [score member ...]\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZADD myzset 1 \"uno\"\n(integer) 1\nredis> ZADD myzset 2 \"two\" 3 \"three\"\n(integer) 2\nredis> ZRANGE myzset 0 -1 WITHSCORES\n1) \"one\"\n2) \"1\"\n3) \"uno\"\n4) \"1\"\n5) \"two\"\n6) \"2\"\n7) \"three\"\n8) \"3\"\n```\n\nAdd one or more members to a sorted set, or update its score if it already exists\n\n### ZCARD\n\n```{.wrap}\nZCARD key\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZADD myzset 2 \"two\"\n(integer) 1\nredis> ZCARD myzset\n(integer) 2\n```\n\nGet the number of members in a sorted set\n\n### ZSCORE\n\n```{.wrap}\nZSCORE key member\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZSCORE myzset \"one\"\n\"1\"\n```\n\nGet the score associated with the given member in a sorted set\n\n### ZCOUNT\n\n```{.wrap}\nZCOUNT key min max\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZADD myzset 2 \"two\"\n(integer) 1\nredis> ZADD myzset 3 \"three\"\n(integer) 1\nredis> ZCOUNT myzset -inf +inf\n(integer) 3\nredis> ZCOUNT myzset (1 3\n(integer) 2\n```\n\nCount the members in a sorted set with scores within the given values\n\n### ZDIFF\n\n```{.wrap}\nZDIFF numkeys key [key ...] [WITHSCORES]\n```\n\n#### Example\n\n```shell script\nredis> ZADD zset1 1 \"one\"\n(integer) 1\nredis> ZADD zset1 2 \"two\"\n(integer) 1\nredis> ZADD zset1 3 \"three\"\n(integer) 1\nredis> ZADD zset2 1 \"one\"\n(integer) 1\nredis> ZADD zset2 2 \"two\"\n(integer) 1\nredis> ZDIFF 2 zset1 zset2\n1) \"three\"\nredis> ZDIFF 2 zset1 zset2 WITHSCORES\n1) \"three\"\n2) \"3\"\n```\n\nSubtract multiple sorted sets\n\n### ZDIFFSTORE\n\n```{.wrap}\nZDIFFSTORE destination numkeys key [key ...]\n```\n\n#### Example\n\n```shell script\nredis> ZADD zset1 1 \"one\"\n(integer) 1\nredis> ZADD zset1 2 \"two\"\n(integer) 1\nredis> ZADD zset1 3 \"three\"\n(integer) 1\nredis> ZADD zset2 1 \"one\"\n(integer) 1\nredis> ZADD zset2 2 \"two\"\n(integer) 1\nredis> ZDIFFSTORE out 2 zset1 zset2\n(integer) 1\nredis> ZRANGE out 0 -1 WITHSCORES\n1) \"three\"\n2) \"3\"\n```\n\nSubtract multiple sorted sets and store the resulting sorted set in a new key\n\n### ZINCRBY\n\n```{.wrap}\nZINCRBY key increment member\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZADD myzset 2 \"two\"\n(integer) 1\nredis> ZINCRBY myzset 2 \"one\"\n\"3\"\nredis> ZRANGE myzset 0 -1 WITHSCORES\n1) \"two\"\n2) \"2\"\n3) \"one\"\n4) \"3\"\n```\n\nIncrement the score of a member in a sorted set\n\n### ZINTER\n\n```{.wrap}\nZINTER numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX] [WITHSCORES]\n```\n\n#### Example\n\n```shell script\nredis> ZADD zset1 1 \"one\"\n(integer) 1\nredis> ZADD zset1 2 \"two\"\n(integer) 1\nredis> ZADD zset2 1 \"one\"\n(integer) 1\nredis> ZADD zset2 2 \"two\"\n(integer) 1\nredis> ZADD zset2 3 \"three\"\n(integer) 1\nredis> ZINTER 2 zset1 zset2\n1) \"one\"\n2) \"two\"\nredis> ZINTER 2 zset1 zset2 WITHSCORES\n1) \"one\"\n2) \"2\"\n3) \"two\"\n4) \"4\"\n```\n\nIntersect multiple sorted sets\n\n### ZINTERSTORE\n\n```{.wrap}\nZINTERSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX]\n```\n\n#### Example\n\n```shell script\nredis> ZADD zset1 1 \"one\"\n(integer) 1\nredis> ZADD zset1 2 \"two\"\n(integer) 1\nredis> ZADD zset2 1 \"one\"\n(integer) 1\nredis> ZADD zset2 2 \"two\"\n(integer) 1\nredis> ZADD zset2 3 \"three\"\n(integer) 1\nredis> ZINTERSTORE out 2 zset1 zset2 WEIGHTS 2 3\n(integer) 2\nredis> ZRANGE out 0 -1 WITHSCORES\n1) \"one\"\n2) \"5\"\n3) \"two\"\n4) \"10\"\n```\n\nIntersect multiple sorted sets and store the resulting sorted set in a new key\n\n### ZLEXCOUNT\n\n```{.wrap}\nZLEXCOUNT key min max\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 0 a 0 b 0 c 0 d 0 e\n(integer) 5\nredis> ZADD myzset 0 f 0 g\n(integer) 2\nredis> ZLEXCOUNT myzset - +\n(integer) 7\nredis> ZLEXCOUNT myzset [b [f\n(integer) 5\n```\n\nCount the number of members in a sorted set between a given lexicographical range\n\n### ZPOPMAX\n\n```{.wrap}\nZPOPMAX key [count]\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZADD myzset 2 \"two\"\n(integer) 1\nredis> ZADD myzset 3 \"three\"\n(integer) 1\nredis> ZPOPMAX myzset\n1) \"three\"\n2) \"3\"\n```\n\nRemove and return members with the highest scores in a sorted set\n\n### ZPOPMIN\n\n```{.wrap}\nZPOPMIN key [count]\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZADD myzset 2 \"two\"\n(integer) 1\nredis> ZADD myzset 3 \"three\"\n(integer) 1\nredis> ZPOPMIN myzset\n1) \"one\"\n2) \"1\"\n```\n\nRemove and return members with the lowest scores in a sorted set\n\n### ZRANGE\n\n```{.wrap}\nZRANGE key start stop [WITHSCORES]\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZADD myzset 2 \"two\"\n(integer) 1\nredis> ZADD myzset 3 \"three\"\n(integer) 1\nredis> ZRANGE myzset 0 -1\n1) \"one\"\n2) \"two\"\n3) \"three\"\nredis> ZRANGE myzset 2 3\n1) \"three\"\nredis> ZRANGE myzset -2 -1\n1) \"two\"\n2) \"three\"\n```\n\nReturn a range of members in a sorted set, by index\n\n### ZRANGEBYLEX\n\n```{.wrap}\nZRANGEBYLEX key min max [LIMIT offset count]\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 0 a 0 b 0 c 0 d 0 e 0 f 0 g\n(integer) 7\nredis> ZRANGEBYLEX myzset - [c\n1) \"a\"\n2) \"b\"\n3) \"c\"\nredis> ZRANGEBYLEX myzset - (c\n1) \"a\"\n2) \"b\"\nredis> ZRANGEBYLEX myzset [aaa (g\n1) \"b\"\n2) \"c\"\n3) \"d\"\n4) \"e\"\n5) \"f\"\n```\n\nReturn a range of members in a sorted set, by lexicographical range\n\n### ZREVRANGEBYLEX\n\n```{.wrap}\nZREVRANGEBYLEX key max min [LIMIT offset count]\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 0 a 0 b 0 c 0 d 0 e 0 f 0 g\n(integer) 7\nredis> ZREVRANGEBYLEX myzset [c -\n1) \"c\"\n2) \"b\"\n3) \"a\"\nredis> ZREVRANGEBYLEX myzset (c -\n1) \"b\"\n2) \"a\"\nredis> ZREVRANGEBYLEX myzset (g [aaa\n1) \"f\"\n2) \"e\"\n3) \"d\"\n4) \"c\"\n5) \"b\"\n```\n\nReturn a range of members in a sorted set, by lexicographical range, ordered from higher to lower strings.\n\n### ZRANGEBYSCORE\n\n```{.wrap}\nZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZADD myzset 2 \"two\"\n(integer) 1\nredis> ZADD myzset 3 \"three\"\n(integer) 1\nredis> ZRANGEBYSCORE myzset -inf +inf\n1) \"one\"\n2) \"two\"\n3) \"three\"\nredis> ZRANGEBYSCORE myzset 1 2\n1) \"one\"\n2) \"two\"\nredis> ZRANGEBYSCORE myzset (1 2\n1) \"two\"\nredis> ZRANGEBYSCORE myzset (1 (2\n(empty list or set)\n```\n\nReturn a range of members in a sorted set, by score\n\n### ZRANK\n\n```{.wrap}\nZRANK key member\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZADD myzset 2 \"two\"\n(integer) 1\nredis> ZADD myzset 3 \"three\"\n(integer) 1\nredis> ZRANK myzset \"three\"\n(integer) 2\nredis> ZRANK myzset \"four\"\n(nil)\n```\n\nDetermine the index of a member in a sorted set\n\n### ZREM\n\n```{.wrap}\nZREM key member [member ...]\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZADD myzset 2 \"two\"\n(integer) 1\nredis> ZADD myzset 3 \"three\"\n(integer) 1\nredis> ZREM myzset \"two\"\n(integer) 1\nredis> ZRANGE myzset 0 -1 WITHSCORES\n1) \"one\"\n2) \"1\"\n3) \"three\"\n4) \"3\"\n```\n\nRemove one or more members from a sorted set\n\n### ZREMRANGEBYLEX\n\n```{.wrap}\nZREMRANGEBYLEX key min max\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 0 aaaa 0 b 0 c 0 d 0 e\n(integer) 5\nredis> ZADD myzset 0 foo 0 zap 0 zip 0 ALPHA 0 alpha\n(integer) 5\nredis> ZRANGE myzset 0 -1\n1) \"ALPHA\"\n 2) \"aaaa\"\n 3) \"alpha\"\n 4) \"b\"\n 5) \"c\"\n 6) \"d\"\n 7) \"e\"\n 8) \"foo\"\n 9) \"zap\"\n10) \"zip\"\nredis> ZREMRANGEBYLEX myzset [alpha [omega\n(integer) 6\nredis> ZRANGE myzset 0 -1\n1) \"ALPHA\"\n2) \"aaaa\"\n3) \"zap\"\n4) \"zip\"\n```\n\nRemove all members in a sorted set between the given lexicographical range\n\n### ZREMRANGEBYRANK\n\n```{.wrap}\nZREMRANGEBYRANK key start stop\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZADD myzset 2 \"two\"\n(integer) 1\nredis> ZADD myzset 3 \"three\"\n(integer) 1\nredis> ZREMRANGEBYRANK myzset 0 1\n(integer) 2\nredis> ZRANGE myzset 0 -1 WITHSCORES\n1) \"three\"\n2) \"3\"\n```\n\nRemove all members in a sorted set within the given indexes\n\n### ZREMRANGEBYSCORE\n\n```{.wrap}\nZREMRANGEBYSCORE key min max\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZADD myzset 2 \"two\"\n(integer) 1\nredis> ZADD myzset 3 \"three\"\n(integer) 1\nredis> ZREMRANGEBYSCORE myzset -inf (2\n(integer) 1\nredis> ZRANGE myzset 0 -1 WITHSCORES\n1) \"two\"\n2) \"2\"\n3) \"three\"\n4) \"3\"\n```\n\nRemove all members in a sorted set within the given scores\n\n### ZREVRANGE\n\n```{.wrap}\nZREVRANGE key start stop [WITHSCORES]\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZADD myzset 2 \"two\"\n(integer) 1\nredis> ZADD myzset 3 \"three\"\n(integer) 1\nredis> ZREVRANGE myzset 0 -1\n1) \"three\"\n2) \"two\"\n3) \"one\"\nredis> ZREVRANGE myzset 2 3\n1) \"one\"\nredis> ZREVRANGE myzset -2 -1\n1) \"two\"\n2) \"one\"\n```\n\nReturn a range of members in a sorted set, by index, with scores ordered from high to low\n\n### ZREVRANGEBYSCORE\n\n```{.wrap}\nZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count]\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZADD myzset 2 \"two\"\n(integer) 1\nredis> ZADD myzset 3 \"three\"\n(integer) 1\nredis> ZREVRANGEBYSCORE myzset +inf -inf\n1) \"three\"\n2) \"two\"\n3) \"one\"\nredis> ZREVRANGEBYSCORE myzset 2 1\n1) \"two\"\n2) \"one\"\nredis> ZREVRANGEBYSCORE myzset 2 (1\n1) \"two\"\nredis> ZREVRANGEBYSCORE myzset (2 (1\n(empty list or set)\n```\n\nReturn a range of members in a sorted set, by score, with scores ordered from high to low\n\n### ZREVRANK\n\n```{.wrap}\nZREVRANK key member\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZADD myzset 2 \"two\"\n(integer) 1\nredis> ZADD myzset 3 \"three\"\n(integer) 1\nredis> ZREVRANK myzset \"one\"\n(integer) 2\nredis> ZREVRANK myzset \"four\"\n(nil)\n```\n\nDetermine the index of a member in a sorted set, with scores ordered from high to low\n\n### ZUNION\n\n```{.wrap}\nZUNION numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX] [WITHSCORES]\n```\n\n#### Example\n\n```shell script\nredis> ZADD zset1 1 \"one\"\n(integer) 1\nredis> ZADD zset1 2 \"two\"\n(integer) 1\nredis> ZADD zset2 1 \"one\"\n(integer) 1\nredis> ZADD zset2 2 \"two\"\n(integer) 1\nredis> ZADD zset2 3 \"three\"\n(integer) 1\nredis> ZUNION 2 zset1 zset2\n1) \"one\"\n2) \"three\"\n3) \"two\"\nredis> ZUNION 2 zset1 zset2 WITHSCORES\n1) \"one\"\n2) \"2\"\n3) \"three\"\n4) \"3\"\n5) \"two\"\n6) \"4\"\n```\n\nAdd multiple sorted sets\n\n### ZMSCORE\n\n```{.wrap}\nZMSCORE key member [member ...]\n```\n\n#### Example\n\n```shell script\nredis> ZADD myzset 1 \"one\"\n(integer) 1\nredis> ZADD myzset 2 \"two\"\n(integer) 1\nredis> ZMSCORE myzset \"one\" \"two\" \"nofield\"\n1) \"1\"\n2) \"2\"\n3) (nil)\n```\n\nGet the score associated with the given members in a sorted set\n\n### ZUNIONSTORE\n\n```{.wrap}\nZUNIONSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX]\n```\n\n#### Example\n\n```shell script\nredis> ZADD zset1 1 \"one\"\n(integer) 1\nredis> ZADD zset1 2 \"two\"\n(integer) 1\nredis> ZADD zset2 1 \"one\"\n(integer) 1\nredis> ZADD zset2 2 \"two\"\n(integer) 1\nredis> ZADD zset2 3 \"three\"\n(integer) 1\nredis> ZUNIONSTORE out 2 zset1 zset2 WEIGHTS 2 3\n(integer) 3\nredis> ZRANGE out 0 -1 WITHSCORES\n1) \"one\"\n2) \"5\"\n3) \"three\"\n4) \"9\"\n5) \"two\"\n6) \"10\"\n```\n\nAdd multiple sorted sets and store the resulting sorted set in a new key\n\n## Redis Geo command{.cols-2}\n\n### GEOADD\n\n```{.wrap}\nGEOADD key longitude latitude member [longitude latitude member ...]\n```\n\n#### Example\n\n```shell script\nredis> GEOADD Sicily 13.361389 38.115556 \"Palermo\" 15.087269 37.502669 \"Catania\"\n(integer) 2\nredis> GEODIST Sicily Palermo Catania\n\"166274.1516\"\nredis> GEORADIUS Sicily 15 37 100 km\n1) \"Catania\"\nredis> GEORADIUS Sicily 15 37 200 km\n1) \"Palermo\"\n2) \"Catania\"\n```\n\nAdd one or more geospatial items in the geospatial index represented using a sorted set\n\n### GEOHASH\n\n```{.wrap}\nGEOHASH key member [member ...]\n```\n\n#### Example\n\n```shell script\nredis> GEOADD Sicily 13.361389 38.115556 \"Palermo\" 15.087269 37.502669 \"Catania\"\n(integer) 2\nredis> GEOHASH Sicily Palermo Catania\n1) \"sqc8b49rny0\"\n2) \"sqdtr74hyu0\"\n```\n\nReturns members of a geospatial index as standard geohash strings\n\n### GEOPOS\n\n```{.wrap}\nGEOPOS key member [member ...]\n```\n\n#### Example\n\n```shell script\nredis> GEOADD Sicily 13.361389 38.115556 \"Palermo\" 15.087269 37.502669 \"Catania\"\n(integer) 2\nredis> GEOPOS Sicily Palermo Catania NonExisting\n1) 1) \"13.36138933897018433\"\n   2) \"38.11555639549629859\"\n2) 1) \"15.08726745843887329\"\n   2) \"37.50266842333162032\"\n3) (nil)\n```\n\nReturns longitude and latitude of members of a geospatial index\n\n### GEODIST\n\n```{.wrap}\nGEODIST key member1 member2 [m|km|ft|mi]\n```\n\n#### Example\n\n```shell script\nredis> GEOADD Sicily 13.361389 38.115556 \"Palermo\" 15.087269 37.502669 \"Catania\"\n(integer) 2\nredis> GEODIST Sicily Palermo Catania\n\"166274.1516\"\nredis> GEODIST Sicily Palermo Catania km\n\"166.2742\"\nredis> GEODIST Sicily Palermo Catania mi\n\"103.3182\"\nredis> GEODIST Sicily Foo Bar\n(nil)\n```\n\nReturns the distance between two members of a geospatial index\n\n### GEORADIUS\n\n```{.wrap}\nGEORADIUS key longitude latitude radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count] [ASC|DESC] [STORE key] [STOREDIST key]\n```\n\n#### Example\n\n```shell script\nredis> GEOADD Sicily 13.361389 38.115556 \"Palermo\" 15.087269 37.502669 \"Catania\"\n(integer) 2\nredis> GEORADIUS Sicily 15 37 200 km WITHDIST\n1) 1) \"Palermo\"\n   2) \"190.4424\"\n2) 1) \"Catania\"\n   2) \"56.4413\"\nredis> GEORADIUS Sicily 15 37 200 km WITHCOORD\n1) 1) \"Palermo\"\n   2) 1) \"13.36138933897018433\"\n      2) \"38.11555639549629859\"\n2) 1) \"Catania\"\n   2) 1) \"15.08726745843887329\"\n      2) \"37.50266842333162032\"\nredis> GEORADIUS Sicily 15 37 200 km WITHDIST WITHCOORD\n1) 1) \"Palermo\"\n   2) \"190.4424\"\n   3) 1) \"13.36138933897018433\"\n      2) \"38.11555639549629859\"\n2) 1) \"Catania\"\n   2) \"56.4413\"\n   3) 1) \"15.08726745843887329\"\n      2) \"37.50266842333162032\"\n```\n\nQuery a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point\n\n### GEORADIUSBYMEMBER\n\n```{.wrap}\nGEORADIUSBYMEMBER key member radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count] [ASC|DESC] [STORE key] [STOREDIST key]\n```\n\n#### Example\n\n```shell script\nredis> GEOADD Sicily 13.583333 37.316667 \"Agrigento\"\n(integer) 1\nredis> GEOADD Sicily 13.361389 38.115556 \"Palermo\" 15.087269 37.502669 \"Catania\"\n(integer) 2\nredis> GEORADIUSBYMEMBER Sicily Agrigento 100 km\n1) \"Agrigento\"\n2) \"Palermo\"\n```\n\nQuery a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member\n\n### GEOSEARCH\n\n```{.wrap}\nGEOSEARCH key [FROMMEMBER member] [FROMLONLAT longitude latitude] [BYRADIUS radius m|km|ft|mi] [BYBOX width height m|km|ft|mi] [ASC|DESC] [COUNT count] [WITHCOORD] [WITHDIST] [WITHHASH]\n```\n\n#### Example\n\n```shell script\nredis> GEOADD Sicily 13.361389 38.115556 \"Palermo\" 15.087269 37.502669 \"Catania\"\n(integer) 2\nredis> GEOADD Sicily 12.758489 38.788135 \"edge1\"   17.241510 38.788135 \"edge2\"\n(integer) 2\nredis> GEOSEARCH Sicily FROMLONLAT 15 37 BYRADIUS 200 km ASC\n1) \"Catania\"\n2) \"Palermo\"\nredis> GEOSEARCH Sicily FROMLONLAT 15 37 BYBOX 400 400 km ASC\n1) \"Catania\"\n2) \"Palermo\"\n3) \"edge2\"\n4) \"edge1\"\n```\n\nQuery a sorted set representing a geospatial index to fetch members inside an area of a box or a circle.\n\n### Misc\n\n| -                                                           | -                                                                                                                                             |\n| ----------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |\n| [GEOSEARCHSTORE ](https://redis.io/commands/geosearchstore) | Query a sorted set representing a geospatial index to fetch members inside an area of a box or a circle, and store the result in another key. |\n\n## Redis Hyperloglog command{.cols-3}\n\n### PFADD\n\n```{.wrap}\nPFADD key element [element ...]\n```\n\n#### Example\n\n```shell script\nredis> PFADD hll a b c d e f g\n(integer) 1\nredis> PFCOUNT hll\n(integer) 7\n```\n\nAdds the specified elements to the specified HyperLogLog.\n\n### PFCOUNT\n\n```{.wrap}\nPFCOUNT key [key ...]\n```\n\n#### Example\n\n```shell script\nredis> PFADD hll foo bar zap\n(integer) 1\nredis> PFADD hll zap zap zap\n(integer) 0\nredis> PFADD hll foo bar\n(integer) 0\nredis> PFCOUNT hll\n(integer) 3\nredis> PFADD some-other-hll 1 2 3\n(integer) 1\nredis> PFCOUNT hll some-other-hll\n(integer) 6\n```\n\nReturn the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).\n\n### PFMERGE\n\n```{.wrap}\nPFMERGE destkey sourcekey [sourcekey ...]\n```\n\n#### Example\n\n```shell script\nredis> PFADD hll1 foo bar zap a\n(integer) 1\nredis> PFADD hll2 a b c foo\n(integer) 1\nredis> PFMERGE hll3 hll1 hll2\n\"OK\"\nredis> PFCOUNT hll3\n(integer) 6\n```\n\nMerge N different HyperLogLogs into a single one.\n\n## Redis Server command{.cols-3}\n\n### COMMAND\n\n```{.wrap}\nCOMMAND\n```\n\n#### Example\n\n```shell script\nredis> COMMAND\n1) 1) \"georadius_ro\"\n     2) (integer) -6\n     3) 1) \"readonly\"\n        2) \"movablekeys\"\n     4) (integer) 1\n     5) (integer) 1\n     6) (integer) 1\n     7) 1) \"@read\"\n        2) \"@geo\"\n        3) \"@slow\"\n  2) 1) \"zpopmin\"\n     2) (integer) -2\n     3) 1) \"write\"\n        2) \"fast\"\n  ........\n```\n\nGet array of Redis command details\n\n### Misc {.col-span-2 .row-span-4}\n\n| -                                                                    | -                                                                                                                                |\n| -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |\n| [ACL LOAD](https://redis.io/commands/acl-load)                       | Reload the ACLs from the configured ACL file                                                                                     |\n| [ACL SAVE](https://redis.io/commands/acl-save)                       | Save the current ACL rules in the configured ACL file                                                                            |\n| [ACL LIST](https://redis.io/commands/acl-list)                       | List the current ACL rules in ACL config file format                                                                             |\n| [ACL USERS](https://redis.io/commands/acl-users)                     | List the username of all the configured ACL rules                                                                                |\n| [ACL GETUSER ](https://redis.io/commands/acl-getuser)                | Get the rules for a specific ACL user                                                                                            |\n| [ACL SETUSER ](https://redis.io/commands/acl-setuser)                | Modify or create the rules for a specific ACL user                                                                               |\n| [ACL DELUSER ](https://redis.io/commands/acl-deluser)                | Remove the specified ACL users and the associated rules                                                                          |\n| [ACL CAT ](https://redis.io/commands/acl-cat)                        | List the ACL categories or the commands inside a category                                                                        |\n| [ACL GENPASS ](https://redis.io/commands/acl-genpass)                | Generate a pseudorandom secure password to use for ACL users                                                                     |\n| [ACL WHOAMI](https://redis.io/commands/acl-whoami)                   | Return the name of the user associated to the current connection                                                                 |\n| [ACL LOG ](https://redis.io/commands/acl-log)                        | List latest events denied because of ACLs in place                                                                               |\n| [ACL HELP](https://redis.io/commands/acl-help)                       | Show helpful text about the different subcommands                                                                                |\n| [BGREWRITEAOF](https://redis.io/commands/bgrewriteaof)               | Asynchronously rewrite the append-only file                                                                                      |\n| [BGSAVE ](https://redis.io/commands/bgsave)                          | Asynchronously save the dataset to disk                                                                                          |\n| [CONFIG GET ](https://redis.io/commands/config-get)                  | Get the value of a configuration parameter                                                                                       |\n| [CONFIG REWRITE](https://redis.io/commands/config-rewrite)           | Rewrite the configuration file with the in memory configuration                                                                  |\n| [CONFIG SET ](https://redis.io/commands/config-set)                  | Set a configuration parameter to the given value                                                                                 |\n| [CONFIG RESETSTAT](https://redis.io/commands/config-resetstat)       | Reset the stats returned by INFO                                                                                                 |\n| [DBSIZE](https://redis.io/commands/dbsize)                           | Return the number of keys in the selected database                                                                               |\n| [DEBUG OBJECT ](https://redis.io/commands/debug-object)              | Get debugging information about a key                                                                                            |\n| [DEBUG SEGFAULT](https://redis.io/commands/debug-segfault)           | Make the server crash                                                                                                            |\n| [FLUSHALL ](https://redis.io/commands/flushall)                      | Remove all keys from all databases                                                                                               |\n| [FLUSHDB ](https://redis.io/commands/flushdb)                        | Remove all keys from the current database                                                                                        |\n| [LOLWUT ](https://redis.io/commands/lolwut)                          | Display some computer art and the Redis version                                                                                  |\n| [LASTSAVE](https://redis.io/commands/lastsave)                       | Get the UNIX time stamp of the last successful save to disk                                                                      |\n| [MEMORY DOCTOR](https://redis.io/commands/memory-doctor)             | Outputs memory problems report                                                                                                   |\n| [MEMORY HELP](https://redis.io/commands/memory-help)                 | Show helpful text about the different subcommands                                                                                |\n| [MEMORY MALLOC-STATS](https://redis.io/commands/memory-malloc-stats) | Show allocator internal stats                                                                                                    |\n| [MEMORY PURGE](https://redis.io/commands/memory-purge)               | Ask the allocator to release memory                                                                                              |\n| [MEMORY STATS](https://redis.io/commands/memory-stats)               | Show memory usage details                                                                                                        |\n| [MEMORY USAGE ](https://redis.io/commands/memory-usage)              | Estimate the memory usage of a key                                                                                               |\n| [MODULE LIST](https://redis.io/commands/module-list)                 | List all modules loaded by the server                                                                                            |\n| [MODULE LOAD ](https://redis.io/commands/module-load)                | Load a module                                                                                                                    |\n| [MODULE UNLOAD ](https://redis.io/commands/module-unload)            | Unload a module                                                                                                                  |\n| [MONITOR](https://redis.io/commands/monitor)                         | Listen for all requests received by the server in real time                                                                      |\n| [SAVE](https://redis.io/commands/save)                               | Synchronously save the dataset to disk                                                                                           |\n| [SHUTDOWN ](https://redis.io/commands/shutdown)                      | Synchronously save the dataset to disk and then shut down the server                                                             |\n| [SLAVEOF ](https://redis.io/commands/slaveof)                        | Make the server a replica of another instance, or promote it as master. Deprecated starting with Redis 5. Use REPLICAOF instead. |\n| [REPLICAOF ](https://redis.io/commands/replicaof)                    | Make the server a replica of another instance, or promote it as master.                                                          |\n| [SLOWLOG ](https://redis.io/commands/slowlog)                        | Manages the Redis slow queries log                                                                                               |\n| [SWAPDB ](https://redis.io/commands/swapdb)                          | Swaps two Redis databases                                                                                                        |\n| [SYNC](https://redis.io/commands/sync)                               | Internal command used for replication                                                                                            |\n| [PSYNC ](https://redis.io/commands/psync)                            | Internal command used for replication                                                                                            |\n| [LATENCY DOCTOR](https://redis.io/commands/latency-doctor)           | Return a human readable latency analysis report.                                                                                 |\n| [LATENCY GRAPH ](https://redis.io/commands/latency-graph)            | Return a latency graph for the event.                                                                                            |\n| [LATENCY HISTORY ](https://redis.io/commands/latency-history)        | Return timestamp-latency samples for the event.                                                                                  |\n| [LATENCY LATEST](https://redis.io/commands/latency-latest)           | Return the latest latency samples for all events.                                                                                |\n| [LATENCY RESET ](https://redis.io/commands/latency-reset)            | Reset latency data for one or more events.                                                                                       |\n| [LATENCY HELP](https://redis.io/commands/latency-help)               | Show helpful text about the different subcommands.                                                                               |\n\n### COMMAND COUNT\n\n```{.wrap}\nCOMMAND COUNT\n```\n\n#### Example\n\n```shell script\nredis> COMMAND COUNT\n(integer) 217\n```\n\nGet total number of Redis commands\n\n### COMMAND GETKEYS\n\n```{.wrap}\nCOMMAND GETKEYS\n```\n\n#### Example\n\n```shell script\nredis> COMMAND GETKEYS MSET a b c d e f\n1) \"a\"\n2) \"c\"\n3) \"e\"\nredis> COMMAND GETKEYS EVAL \"not consulted\" 3 key1 key2 key3 arg1 arg2 arg3 argN\n1) \"key1\"\n2) \"key2\"\n3) \"key3\"\nredis> COMMAND GETKEYS SORT mylist ALPHA STORE outlist\n1) \"mylist\"\n2) \"outlist\"\n```\n\nExtract keys given a full Redis command\n\n### COMMAND INFO\n\n```{.wrap}\nCOMMAND INFO command-name [command-name ...]\n```\n\n#### Example\n\n```shell script\nredis> COMMAND INFO get set eval\n1) 1) \"get\"\n   2) (integer) 2\n   3) 1) \"readonly\"\n      2) \"fast\"\n   4) (integer) 1\n   5) (integer) 1\n   6) (integer) 1\n   7) 1) \"@read\"\n      2) \"@string\"\n      3) \"@fast\"\n2) 1) \"set\"\n   2) (integer) -3\n   3) 1) \"write\"\n      2) \"denyoom\"\n   4) (integer) 1\n   5) (integer) 1\n   6) (integer) 1\n   7) 1) \"@write\"\n      2) \"@string\"\n      3) \"@slow\"\n3) 1) \"eval\"\n   2) (integer) -3\n   3) 1) \"noscript\"\n      2) \"movablekeys\"\n   4) (integer) 0\n   5) (integer) 0\n   6) (integer) 0\n   7) 1) \"@slow\"\n      2) \"@scripting\"\n```\n\nGet array of specific Redis command details\n\n### INFO\n\n```{.wrap}\nINFO [section]\n```\n\n#### Example\n\n```shell script\nredis> INFO\n# Server\nredis_version:6.1.240\nredis_git_sha1:00000000\nredis_git_dirty:0\nredis_build_id:a26db646ea64a07c\nredis_mode:standalone\nos:Linux 5.4.0-1017-aws x86_64\n......\n```\n\nGet information and statistics about the server\n\n### ROLE\n\n```{.wrap}\nROLE\n```\n\n#### Example\n\n```shell script\nredis> ROLE\n1) \"master\"\n2) (integer) 0\n3) (empty list or set)\n```\n\nReturn the role of the instance in the context of replication\n\n### TIME\n\n```{.wrap}\nTIME\n```\n\n#### Example\n\n```shell script\nredis> TIME\n1) \"1609040690\"\n2) \"558952\"\nredis> TIME\n1) \"1609040690\"\n2) \"559206\"\n```\n\nReturn the current server time\n\n## Redis Generic command{.cols-3}\n\n### Misc\n\n| -                                             | -                                                                                                            |\n| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |\n| [COPY ](https://redis.io/commands/copy)       | Copy a key                                                                                                   |\n| [MIGRATE ](https://redis.io/commands/migrate) | Atomically transfer a key from a Redis instance to another one.                                              |\n| [MOVE ](https://redis.io/commands/move)       | Move a key to another database                                                                               |\n| [OBJECT ](https://redis.io/commands/object)   | Inspect the internals of Redis objects                                                                       |\n| [RESTORE ](https://redis.io/commands/restore) | Create a key using the provided serialized value, previously obtained using DUMP.                            |\n| [SORT ](https://redis.io/commands/sort)       | Sort the elements in a list, set or sorted set                                                               |\n| [WAIT ](https://redis.io/commands/wait)       | Wait for the synchronous replication of all the write commands sent in the context of the current connection |\n| [SCAN ](https://redis.io/commands/scan)       | Incrementally iterate the keys space                                                                         |\n\n### DEL\n\n```{.wrap}\nDEL key [key ...]\n```\n\n#### Example\n\n```shell script\nredis> SET key1 \"Hello\"\n\"OK\"\nredis> SET key2 \"World\"\n\"OK\"\nredis> DEL key1 key2 key3\n(integer) 2\n```\n\nDelete a key\n\n### DUMP\n\n```{.wrap}\nDUMP key\n```\n\n#### Example\n\n```shell script\nredis> SET mykey 10\n\"OK\"\nredis> DUMP mykey\n\"\\u0000\\xC0\\n\\t\\u0000\\xBEm\\u0006\\x89Z(\\u0000\\n\"\n```\n\nReturn a serialized version of the value stored at the specified key.\n\n### EXISTS\n\n```{.wrap}\nEXISTS key [key ...]\n```\n\n#### Example\n\n```shell script\nredis> SET key1 \"Hello\"\n\"OK\"\nredis> EXISTS key1\n(integer) 1\nredis> EXISTS nosuchkey\n(integer) 0\nredis> SET key2 \"World\"\n\"OK\"\nredis> EXISTS key1 key2 nosuchkey\n(integer) 2\n```\n\nDetermine if a key exists\n\n### EXPIRE\n\n```{.wrap}\nEXPIRE key seconds\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"Hello\"\n\"OK\"\nredis> EXPIRE mykey 10\n(integer) 1\nredis> TTL mykey\n(integer) 10\nredis> SET mykey \"Hello World\"\n\"OK\"\nredis> TTL mykey\n(integer) -1\n```\n\nSet a key's time to live in seconds\n\n### EXPIREAT\n\n```{.wrap}\nEXPIREAT key timestamp\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"Hello\"\n\"OK\"\nredis> EXISTS mykey\n(integer) 1\nredis> EXPIREAT mykey 1293840000\n(integer) 1\nredis> EXISTS mykey\n(integer) 0\n```\n\nSet the expiration for a key as a UNIX timestamp\n\n### KEYS\n\n```{.wrap}\nKEYS pattern\n```\n\n#### Example\n\n```shell script\nredis> MSET firstname Jack lastname Stuntman age 35\n\"OK\"\nredis> KEYS *name*\n1) \"firstname\"\n2) \"lastname\"\nredis> KEYS a??\n1) \"age\"\nredis> KEYS *\n1) \"firstname\"\n2) \"age\"\n3) \"lastname\"\n```\n\nFind all keys matching the given pattern\n\n### PERSIST\n\n```{.wrap}\nPERSIST key\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"Hello\"\n\"OK\"\nredis> EXPIRE mykey 10\n(integer) 1\nredis> TTL mykey\n(integer) 10\nredis> PERSIST mykey\n(integer) 1\nredis> TTL mykey\n(integer) -1\n```\n\nRemove the expiration from a key\n\n### PEXPIRE\n\n```{.wrap}\nPEXPIRE key milliseconds\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"Hello\"\n\"OK\"\nredis> PEXPIRE mykey 1500\n(integer) 1\nredis> TTL mykey\n(integer) 1\nredis> PTTL mykey\n(integer) 1499\n```\n\nSet a key's time to live in milliseconds\n\n### PEXPIREAT\n\n```{.wrap}\nPEXPIREAT key milliseconds-timestamp\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"Hello\"\n\"OK\"\nredis> PEXPIREAT mykey 1555555555005\n(integer) 1\nredis> TTL mykey\n(integer) -2\nredis> PTTL mykey\n(integer) -2\n```\n\nSet the expiration for a key as a UNIX timestamp specified in milliseconds\n\n### PTTL\n\n```{.wrap}\nPTTL key\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"Hello\"\n\"OK\"\nredis> EXPIRE mykey 1\n(integer) 1\nredis> PTTL mykey\n(integer) 1000\n```\n\nGet the time to live for a key in milliseconds\n\n### RENAME\n\n```{.wrap}\nRENAME key newkey\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"Hello\"\n\"OK\"\nredis> RENAME mykey myotherkey\n\"OK\"\nredis> GET myotherkey\n\"Hello\"\n```\n\nRename a key\n\n### RENAMENX\n\n```{.wrap}\nRENAMENX key newkey\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"Hello\"\n\"OK\"\nredis> SET myotherkey \"World\"\n\"OK\"\nredis> RENAMENX mykey myotherkey\n(integer) 0\nredis> GET myotherkey\n\"World\"\n```\n\nRename a key, only if the new key does not exist\n\n### TOUCH\n\n```{.wrap}\nTOUCH key [key ...]\n```\n\n#### Example\n\n```shell script\nredis> SET key1 \"Hello\"\n\"OK\"\nredis> SET key2 \"World\"\n\"OK\"\nredis> TOUCH key1 key2\n(integer) 2\n```\n\nAlters the last access time of a key(s). Returns the number of existing keys specified.\n\n### TTL\n\n```{.wrap}\nTTL key\n```\n\n#### Example\n\n```shell script\nredis> SET mykey \"Hello\"\n\"OK\"\nredis> EXPIRE mykey 10\n(integer) 1\nredis> TTL mykey\n(integer) 10\n```\n\nGet the time to live for a key\n\n### TYPE\n\n```{.wrap}\nTYPE key\n```\n\n#### Example\n\n```shell script\nredis> SET key1 \"value\"\n\"OK\"\nredis> LPUSH key2 \"value\"\n(integer) 1\nredis> SADD key3 \"value\"\n(integer) 1\nredis> TYPE key1\n\"string\"\nredis> TYPE key2\n\"list\"\nredis> TYPE key3\n\"set\"\n```\n\nDetermine the type stored at key\n\n### UNLINK\n\n```{.wrap}\nUNLINK key [key ...]\n```\n\n#### Example\n\n```shell script\nredis> SET key1 \"Hello\"\n\"OK\"\nredis> SET key2 \"World\"\n\"OK\"\nredis> UNLINK key1 key2 key3\n(integer) 2\n```\n\nDelete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking.\n\n## Redis Connection command{.cols-3}\n\n### Misc\n\n| -                                                             | -                                                                          |\n| ------------------------------------------------------------- | -------------------------------------------------------------------------- |\n| [AUTH ](https://redis.io/commands/auth)                       | Authenticate to the server                                                 |\n| [CLIENT CACHING ](https://redis.io/commands/client-caching)   | Instruct the server about tracking or not keys in the next request         |\n| [CLIENT KILL ](https://redis.io/commands/client-kill)         | Kill the connection of a client                                            |\n| [CLIENT LIST ](https://redis.io/commands/client-list)         | Get the list of client connections                                         |\n| [CLIENT GETNAME](https://redis.io/commands/client-getname)    | Get the current connection name                                            |\n| [CLIENT GETREDIR](https://redis.io/commands/client-getredir)  | Get tracking notifications redirection client ID if any                    |\n| [CLIENT PAUSE ](https://redis.io/commands/client-pause)       | Stop processing commands from clients for some time                        |\n| [CLIENT REPLY ](https://redis.io/commands/client-reply)       | Instruct the server whether to reply to commands                           |\n| [CLIENT SETNAME ](https://redis.io/commands/client-setname)   | Set the current connection name                                            |\n| [CLIENT TRACKING ](https://redis.io/commands/client-tracking) | Enable or disable server assisted client side caching support              |\n| [CLIENT UNBLOCK ](https://redis.io/commands/client-unblock)   | Unblock a client blocked in a blocking command from a different connection |\n| [HELLO ](https://redis.io/commands/hello)                     | switch Redis protocol                                                      |\n| [QUIT](https://redis.io/commands/quit)                        | Close the connection                                                       |\n| [RESET](https://redis.io/commands/reset)                      | Reset the connection                                                       |\n| [SELECT ](https://redis.io/commands/select)                   | Change the selected database for the current connection                    |\n\n### CLIENT ID\n\n```{.wrap}\nCLIENT ID\n```\n\n#### Example\n\n```shell script\nredis> CLIENT ID\nERR Unknown or disabled command 'CLIENT'\n```\n\nReturns the client ID for the current connection\n\n### CLIENT INFO\n\n```{.wrap}\nCLIENT INFO\n```\n\n#### Example\n\n```shell script\nredis> CLIENT INFO\n\"id=55542 addr=127.0.0.1:58710 laddr=127.0.0.1:6379 fd=8 name= age=114920 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=40928 argv-mem=10 obl=0 oll=0 omem=0 tot-mem=61466 events=r cmd=client user=default redir=-1\\n\"\n```\n\nReturns information about the current client connection.\n\n### ECHO\n\n```{.wrap}\nECHO message\n```\n\n#### Example\n\n```shell script\nredis> ECHO \"Hello World!\"\n\"Hello World!\"\n```\n\nEcho the given string\n\n### PING\n\n```{.wrap}\nPING [message]\n```\n\n#### Example\n\n```shell script\nredis> PING\n\"PONG\"\nredis> PING \"hello world\"\n\"hello world\"\n```\n\nPing the server\n\n## Redis Stream command{.cols-2}\n\n### Misc\n\n| -                                                   | -                                                                                                                                                                                  |\n| --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [XINFO ](https://redis.io/commands/xinfo)           | Get information on streams and consumer groups                                                                                                                                     |\n| [XDEL ](https://redis.io/commands/xdel)             | Removes the specified entries from the stream. Returns the number of items actually deleted, that may be different from the number of IDs passed in case certain IDs do not exist. |\n| [XREAD ](https://redis.io/commands/xread)           | Return never seen elements in multiple streams, with IDs greater than the ones reported by the caller for each stream. Can block.                                                  |\n| [XGROUP ](https://redis.io/commands/xgroup)         | Create, destroy, and manage consumer groups.                                                                                                                                       |\n| [XREADGROUP ](https://redis.io/commands/xreadgroup) | Return new entries from a stream using a consumer group, or access the history of the pending entries for a given consumer. Can block.                                             |\n| [XCLAIM ](https://redis.io/commands/xclaim)         | Changes (or acquires) ownership of a message in a consumer group, as if the message was delivered to the specified consumer.                                                       |\n| [XPENDING ](https://redis.io/commands/xpending)     | Return information and entries from a stream consumer group pending entries list, that are messages fetched but never acknowledged.                                                |\n\n### XADD\n\n```{.wrap}\nXADD key [MAXLEN [=|~] length] [NOMKSTREAM] *|ID field value [field value ...]\n```\n\n#### Example\n\n```shell script\nredis> XADD mystream * name Sara surname OConnor\n\"1609040574632-0\"\nredis> XADD mystream * field1 value1 field2 value2 field3 value3\n\"1609040574632-1\"\nredis> XLEN mystream\n(integer) 2\nredis> XRANGE mystream - +\n1) 1) \"1609040574632-0\"\n   2) 1) \"name\"\n      2) \"Sara\"\n      3) \"surname\"\n      4) \"OConnor\"\n2) 1) \"1609040574632-1\"\n   2) 1) \"field1\"\n      2) \"value1\"\n      3) \"field2\"\n      4) \"value2\"\n      5) \"field3\"\n      6) \"value3\"\n```\n\nAppends a new entry to a stream\n\n### XTRIM\n\n```{.wrap}\nXTRIM key MAXLEN [=|~] length\n```\n\n#### Example\n\n```shell script\nredis> XADD mystream * field1 A field2 B field3 C field4 D\n\"1609040575750-0\"\nredis> XTRIM mystream MAXLEN 2\n(integer) 0\nredis> XRANGE mystream - +\n1) 1) \"1609040575750-0\"\n   2) 1) \"field1\"\n      2) \"A\"\n      3) \"field2\"\n      4) \"B\"\n      5) \"field3\"\n      6) \"C\"\n      7) \"field4\"\n      8) \"D\"\n```\n\nTrims the stream to (approximately if '~' is passed) a certain size\n\n### XRANGE\n\n```{.wrap}\nXRANGE key start end [COUNT count]\n```\n\n#### Example\n\n```shell script\nredis> XADD writers * name Virginia surname Woolf\n\"1609040578002-0\"\nredis> XADD writers * name Jane surname Austen\n\"1609040578002-1\"\nredis> XADD writers * name Toni surname Morrison\n\"1609040578003-0\"\nredis> XADD writers * name Agatha surname Christie\n\"1609040578003-1\"\nredis> XADD writers * name Ngozi surname Adichie\n\"1609040578003-2\"\nredis> XLEN writers\n(integer) 5\nredis> XRANGE writers - + COUNT 2\n1) 1) \"1609040578002-0\"\n   2) 1) \"name\"\n      2) \"Virginia\"\n      3) \"surname\"\n      4) \"Woolf\"\n2) 1) \"1609040578002-1\"\n   2) 1) \"name\"\n      2) \"Jane\"\n      3) \"surname\"\n      4) \"Austen\"\n```\n\nReturn a range of elements in a stream, with IDs matching the specified IDs interval\n\n### XREVRANGE\n\n```{.wrap}\nXREVRANGE key end start [COUNT count]\n```\n\n#### Example\n\n```shell script\nredis> XADD writers * name Virginia surname Woolf\n\"1609040579130-0\"\nredis> XADD writers * name Jane surname Austen\n\"1609040579130-1\"\nredis> XADD writers * name Toni surname Morrison\n\"1609040579130-2\"\nredis> XADD writers * name Agatha surname Christie\n\"1609040579131-0\"\nredis> XADD writers * name Ngozi surname Adichie\n\"1609040579131-1\"\nredis> XLEN writers\n(integer) 5\nredis> XREVRANGE writers + - COUNT 1\n1) 1) \"1609040579131-1\"\n   2) 1) \"name\"\n      2) \"Ngozi\"\n      3) \"surname\"\n      4) \"Adichie\"\n```\n\nReturn a range of elements in a stream, with IDs matching the specified IDs interval, in reverse order (from greater to\nsmaller IDs) compared to XRANGE\n\n### XLEN\n\n```{.wrap}\nXLEN key\n```\n\n#### Example\n\n```shell script\nredis> XADD mystream * item 1\n\"1609040580250-0\"\nredis> XADD mystream * item 2\n\"1609040580250-1\"\nredis> XADD mystream * item 3\n\"1609040580251-0\"\nredis> XLEN mystream\n(integer) 3\n```\n\nReturn the number of entries in a stream\n\n### XACK\n\n```{.wrap}\nXACK key group ID [ID ...]\n```\n\n#### Example\n\n```shell script\nredis> XACK mystream mygroup 1526569495631-0\nERR Unknown or disabled command 'XACK'\n```\n\nMarks a pending message as correctly processed, effectively removing it from the pending entries list of the consumer\ngroup. Return value of the command is the number of messages successfully acknowledged, that is, the IDs we were\nactually able to resolve in the PEL.\n\n## Miscellaneous {.cols-2}\n\n### Cluster\n\n| -                                                                                         | -                                                                |\n| ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |\n| [CLUSTER ADDSLOTS ](https://redis.io/commands/cluster-addslots)                           | Assign new hash slots to receiving node                          |\n| [CLUSTER BUMPEPOCH](https://redis.io/commands/cluster-bumpepoch)                          | Advance the cluster config epoch                                 |\n| [CLUSTER COUNT-FAILURE-REPORTS ](https://redis.io/commands/cluster-count-failure-reports) | Return the number of failure reports active for a given node     |\n| [CLUSTER COUNTKEYSINSLOT ](https://redis.io/commands/cluster-countkeysinslot)             | Return the number of local keys in the specified hash slot       |\n| [CLUSTER DELSLOTS ](https://redis.io/commands/cluster-delslots)                           | Set hash slots as unbound in receiving node                      |\n| [CLUSTER FAILOVER ](https://redis.io/commands/cluster-failover)                           | Forces a replica to perform a manual failover of its master.     |\n| [CLUSTER FLUSHSLOTS](https://redis.io/commands/cluster-flushslots)                        | Delete a node's own slots information                            |\n| [CLUSTER FORGET ](https://redis.io/commands/cluster-forget)                               | Remove a node from the nodes table                               |\n| [CLUSTER GETKEYSINSLOT ](https://redis.io/commands/cluster-getkeysinslot)                 | Return local key names in the specified hash slot                |\n| [CLUSTER INFO](https://redis.io/commands/cluster-info)                                    | Provides info about Redis Cluster node state                     |\n| [CLUSTER KEYSLOT ](https://redis.io/commands/cluster-keyslot)                             | Returns the hash slot of the specified key                       |\n| [CLUSTER MEET ](https://redis.io/commands/cluster-meet)                                   | Force a node cluster to handshake with another node              |\n| [CLUSTER MYID](https://redis.io/commands/cluster-myid)                                    | Return the node id                                               |\n| [CLUSTER NODES](https://redis.io/commands/cluster-nodes)                                  | Get Cluster config for the node                                  |\n| [CLUSTER REPLICATE ](https://redis.io/commands/cluster-replicate)                         | Reconfigure a node as a replica of the specified master node     |\n| [CLUSTER RESET ](https://redis.io/commands/cluster-reset)                                 | Reset a Redis Cluster node                                       |\n| [CLUSTER SAVECONFIG](https://redis.io/commands/cluster-saveconfig)                        | Forces the node to save cluster state on disk                    |\n| [CLUSTER SET-CONFIG-EPOCH ](https://redis.io/commands/cluster-set-config-epoch)           | Set the configuration epoch in a new node                        |\n| [CLUSTER SETSLOT ](https://redis.io/commands/cluster-setslot)                             | Bind a hash slot to a specific node                              |\n| [CLUSTER SLAVES ](https://redis.io/commands/cluster-slaves)                               | List replica nodes of the specified master node                  |\n| [CLUSTER REPLICAS ](https://redis.io/commands/cluster-replicas)                           | List replica nodes of the specified master node                  |\n| [CLUSTER SLOTS](https://redis.io/commands/cluster-slots)                                  | Get array of Cluster slot to node mappings                       |\n| [READONLY](https://redis.io/commands/readonly)                                            | Enables read queries for a connection to a cluster replica node  |\n| [READWRITE](https://redis.io/commands/readwrite)                                          | Disables read queries for a connection to a cluster replica node |\n\n### Transactions\n\n| -                                            | -                                                                   |\n| -------------------------------------------- | ------------------------------------------------------------------- |\n| [DISCARD](https://redis.io/commands/discard) | Discard all commands issued after MULTI                             |\n| [EXEC](https://redis.io/commands/exec)       | Execute all commands issued after MULTI                             |\n| [MULTI](https://redis.io/commands/multi)     | Mark the start of a transaction block                               |\n| [UNWATCH](https://redis.io/commands/unwatch) | Forget about all watched keys                                       |\n| [WATCH ](https://redis.io/commands/watch)    | Watch the given keys to determine execution of the MULTI/EXEC block |\n\n### Scripting\n\n| -                                                         | -                                                    |\n| --------------------------------------------------------- | ---------------------------------------------------- |\n| [EVAL ](https://redis.io/commands/eval)                   | Execute a Lua script server side                     |\n| [EVALSHA ](https://redis.io/commands/evalsha)             | Execute a Lua script server side                     |\n| [SCRIPT DEBUG ](https://redis.io/commands/script-debug)   | Set the debug mode for executed scripts.             |\n| [SCRIPT EXISTS ](https://redis.io/commands/script-exists) | Check existence of scripts in the script cache.      |\n| [SCRIPT FLUSH](https://redis.io/commands/script-flush)    | Remove all the scripts from the script cache.        |\n| [SCRIPT KILL](https://redis.io/commands/script-kill)      | Kill the script currently in execution.              |\n| [SCRIPT LOAD ](https://redis.io/commands/script-load)     | Load the specified Lua script into the script cache. |\n\n### Pubsub\n\n| -                                                       | -                                                                          |\n| ------------------------------------------------------- | -------------------------------------------------------------------------- |\n| [PSUBSCRIBE ](https://redis.io/commands/psubscribe)     | Listen for messages published to channels matching the given patterns      |\n| [PUBSUB ](https://redis.io/commands/pubsub)             | Inspect the state of the Pub/Sub subsystem                                 |\n| [PUBLISH ](https://redis.io/commands/publish)           | Post a message to a channel                                                |\n| [PUNSUBSCRIBE ](https://redis.io/commands/punsubscribe) | Stop listening for messages posted to channels matching the given patterns |\n| [SUBSCRIBE ](https://redis.io/commands/subscribe)       | Listen for messages published to the given channels                        |\n| [UNSUBSCRIBE ](https://redis.io/commands/unsubscribe)   | Stop listening for messages posted to the given channels                   |\n"
  },
  {
    "path": "source/_posts/regex.md",
    "content": "---\ntitle: RegEX\ndate: 2020-11-25 18:28:43\nbackground: bg-[#e56d2d]\ntags:\n  - regular expression\n  - regexp\n  - pattern\ncategories:\n  - Toolkit\nintro: |\n  A quick reference for regular expressions (regex), including symbols, ranges, grouping, assertions and some sample patterns to get you started.\nplugins:\n  - copyCode\n---\n\n<!-- Editor's note: this page uses <yel> (yellow tailwind spans) to color matching text and <red> to color non-matching\ntext -->\n\n## Getting Started\n\n### Introduction\n\nThis is a quick cheat sheet to getting started with regular expressions.\n\n- [Regex in Python](#regex-in-python) _(cheatsheets.zip)_\n- [Regex in JavaScript](#regex-in-javascript) _(cheatsheets.zip)_\n- [Regex in PHP](#regex-in-php) _(cheatsheets.zip)_\n- [Regex in Java](#regex-in-java) _(cheatsheets.zip)_\n- [Regex in MySQL](#regex-in-mysql) _(cheatsheets.zip)_\n- [Regex in Vim](/vim#search-and-replace) _(cheatsheets.zip)_\n- [Regex in Emacs](/emacs#search) _(cheatsheets.zip)_\n- [Online regex tester](https://regex101.com/) _(regex101.com)_\n\n{.cols-2 .marker-round}\n\n### Character Classes\n\n| Pattern       | Description                                                                |\n| ------------- | :------------------------------------------------------------------------- |\n| `[abc]`       | A single character of: <yel>a</yel>, <yel>b</yel> or <yel>c</yel>          |\n| `[^abc]`      | A character except: <yel>a</yel>, <yel>b</yel> or <yel>c</yel>             |\n| `[a-z]`       | A character in the range: <yel>a-z</yel>                                   |\n| `[^a-z]`      | A character not in the range: <red>a-z</red>                               |\n| `[0-9]`       | A digit in the range: <yel>0-9</yel>                                       |\n| `[a-zA-Z]`    | A character in the range: <yel>a-z</yel> or <yel>A-Z</yel>                 |\n| `[a-zA-Z0-9]` | A character in the range: <yel>a-z</yel>, <yel>A-Z</yel> or <yel>0-9</yel> |\n\n{.style-list}\n\n### Quantifiers\n\n| Pattern  | Description           |\n| -------- | :-------------------- |\n| `a?`     | Zero or one of a      |\n| `a*`     | Zero or more of a     |\n| `a+`     | One or more of a      |\n| `[0-9]+` | One or more of 0-9    |\n| `a{3}`   | Exactly 3 of a        |\n| `a{3,}`  | 3 or more of a        |\n| `a{3,6}` | Between 3 and 6 of a  |\n| `a*`     | Greedy quantifier     |\n| `a*?`    | Lazy quantifier       |\n| `a*+`    | Possessive quantifier |\n\n### Common Metacharacters\n\n| Pattern | Description                                                  |\n| ------- | :----------------------------------------------------------- | -------------------------------------------- |\n| `^`     | Matches the start of a string.                               |\n| `{`     | Starts a quantifier for the number of occurrences.           |\n| `+`     | Matches one or more of the preceding element.                |\n| `<`     | Not a standard regex meta character (commonly used in HTML). |\n| `[`     | Starts a character class.                                    |\n| `*`     | Matches zero or more of the preceding element.               |\n| `)`     | Ends a capturing group.                                      |\n| `>`     | Not a standard regex meta character (commonly used in HTML). |\n| `.`     | Matches any character except a newline.                      |\n| `(`     | Starts a capturing group.                                    |\n| `       | `                                                            | Acts as a logical OR within a regex pattern. |\n| `$`     | Matches the end of a string.                                 |\n| `\\`     | Escapes a meta character, giving it literal meaning.         |\n| `?`     | Matches zero or one of the preceding element.                |\n\n{.cols-3 .marker-none}\n\nEscape these special characters with `\\`\n\n### Meta Sequences {.row-span-4}\n\n| Pattern      | Description                                                 |\n| ------------ | :---------------------------------------------------------- |\n| `.`          | Any single character                                        |\n| `\\s`         | Any whitespace character                                    |\n| `\\S`         | Any non-whitespace character                                |\n| `\\d`         | Any digit, Same as [0-9]                                    |\n| `\\D`         | Any non-digit, Same as [^0-9]                               |\n| `\\w`         | Any word character                                          |\n| `\\W`         | Any non-word character                                      |\n| `\\X`         | Any Unicode sequences, linebreaks included                  |\n| `\\C`         | Match one data unit                                         |\n| `\\R`         | Unicode newlines                                            |\n| `\\v`         | Vertical whitespace character                               |\n| `\\V`         | Negation of \\v - anything except newlines and vertical tabs |\n| `\\h`         | Horizontal whitespace character                             |\n| `\\H`         | Negation of \\h                                              |\n| `\\K`         | Reset match                                                 |\n| `\\n`         | Match nth subpattern                                        |\n| `\\pX`        | Unicode property X                                          |\n| `\\p{...}`    | Unicode property or script category                         |\n| `\\PX`        | Negation of \\pX                                             |\n| `\\P{...}`    | Negation of \\p                                              |\n| `\\Q...\\E`    | Quote; treat as literals                                    |\n| `\\k<name>`   | Match subpattern `name`                                     |\n| `\\k'name'`   | Match subpattern `name`                                     |\n| `\\k{name}`   | Match subpattern `name`                                     |\n| `\\gn`        | Match nth subpattern                                        |\n| `\\g{n}`      | Match nth subpattern                                        |\n| `\\g<n>`      | Recurse nth capture group                                   |\n| `\\g'n'`      | Recurses nth capture group.                                 |\n| `\\g{-n}`     | Match nth relative previous subpattern                      |\n| `\\g<+n>`     | Recurse nth relative upcoming subpattern                    |\n| `\\g'+n'`     | Match nth relative upcoming subpattern                      |\n| `\\g'letter'` | Recurse named capture group `letter`                        |\n| `\\g{letter}` | Match previously-named capture group `letter`               |\n| `\\g<letter>` | Recurses named capture group `letter`                       |\n| `\\xYY`       | Hex character YY                                            |\n| `\\x{YYYY}`   | Hex character YYYY                                          |\n| `\\ddd`       | Octal character ddd                                         |\n| `\\cY`        | Control character Y                                         |\n| `[\\b]`       | Backspace character                                         |\n| `\\`          | Makes any character literal                                 |\n\n### Anchors\n\n| Pattern | Description            |\n| ------- | :--------------------- |\n| `\\G`    | Start of match         |\n| `^`     | Start of string        |\n| `$`     | End of string          |\n| `\\A`    | Start of string        |\n| `\\Z`    | End of string          |\n| `\\z`    | Absolute end of string |\n| `\\b`    | A word boundary        |\n| `\\B`    | Non-word boundary      |\n\n### Substitution\n\n| Pattern    | Description                     |\n| ---------- | :------------------------------ |\n| `\\0`       | Complete match contents         |\n| `\\1`       | Contents in capture group 1     |\n| `$1`       | Contents in capture group 1     |\n| `${foo}`   | Contents in capture group `foo` |\n| `\\x20`     | Hexadecimal replacement values  |\n| `\\x{06fa}` | Hexadecimal replacement values  |\n| `\\t`       | Tab                             |\n| `\\r`       | Carriage return                 |\n| `\\n`       | Newline                         |\n| `\\f`       | Form-feed                       |\n| `\\U`       | Uppercase Transformation        |\n| `\\L`       | Lowercase Transformation        |\n| `\\E`       | Terminate any Transformation    |\n\n### Group Constructs\n\n| Pattern               | Description                           |\n| --------------------- | :------------------------------------ |\n| `(...)`               | Capture everything enclosed           |\n| <code>(a\\|b)</code>   | Match either a or b                   |\n| `(?:...)`             | Match everything enclosed             |\n| `(?>...)`             | Atomic group (non-capturing)          |\n| <code>(?\\|...)</code> | Duplicate subpattern group number     |\n| `(?#...)`             | Comment                               |\n| `(?'name'...)`        | Named Capturing Group                 |\n| `(?<name>...)`        | Named Capturing Group                 |\n| `(?P<name>...)`       | Named Capturing Group                 |\n| `(?imsxXU)`           | Inline modifiers                      |\n| `(?(DEFINE)...)`      | Pre-define patterns before using them |\n\n### Assertions\n\n| -                               | -                               |\n| ------------------------------- | :------------------------------ |\n| <code>(?(1)yes\\|no)</code>      | Conditional statement           |\n| <code>(?(R)yes\\|no)</code>      | Conditional statement           |\n| <code>(?(R#)yes\\|no)</code>     | Recursive Conditional statement |\n| <code>(?(R&name\\yes\\|no)</code> | Conditional statement           |\n| <code>(?(?=...)yes\\|no)</code>  | Lookahead conditional           |\n| <code>(?(?<=...)yes\\|no)</code> | Lookbehind conditional          |\n\n### Lookarounds\n\n| -          | -                   |\n| ---------- | :------------------ |\n| `(?=...)`  | Positive Lookahead  |\n| `(?!...)`  | Negative Lookahead  |\n| `(?<=...)` | Positive Lookbehind |\n| `(?<!...)` | Negative Lookbehind |\n\nLookaround lets you match a group before (lookbehind) or after (lookahead) your main pattern without including it in the\nresult.\n\n### Flags/Modifiers\n\n| Pattern | Description           |\n| ------- | :-------------------- |\n| `g`     | Global                |\n| `m`     | Multiline             |\n| `i`     | Case insensitive      |\n| `x`     | Ignore whitespace     |\n| `s`     | Single line           |\n| `u`     | Unicode               |\n| `X`     | eXtended              |\n| `U`     | Ungreedy              |\n| `A`     | Anchor                |\n| `J`     | Duplicate group names |\n\n### Recurse\n\n| -           | -                                 |\n| ----------- | :-------------------------------- |\n| `(?R)`      | Recurse entire pattern            |\n| `(?1)`      | Recurse first subpattern          |\n| `(?+1)`     | Recurse first relative subpattern |\n| `(?&name)`  | Recurse subpattern `name`         |\n| `(?P=name)` | Match subpattern `name`           |\n| `(?P>name)` | Recurse subpattern `name`         |\n\n### POSIX Character Classes {.col-span-2}\n\n| Character Class | Same as                                            | Meaning                        |\n| --------------- | -------------------------------------------------- | :----------------------------- |\n| `[[:alnum:]]`   | `[0-9A-Za-z]`                                      | Letters and digits             |\n| `[[:alpha:]]`   | `[A-Za-z]`                                         | Letters                        |\n| `[[:ascii:]]`   | `[\\x00-\\x7F]`                                      | ASCII codes 0-127              |\n| `[[:blank:]]`   | `[\\t ]`                                            | Space or tab only              |\n| `[[:cntrl:]]`   | `[\\x00-\\x1F\\x7F]`                                  | Control characters             |\n| `[[:digit:]]`   | `[0-9]`                                            | Decimal digits                 |\n| `[[:graph:]]`   | `[[:alnum:][:punct:]]`                             | Visible characters (not space) |\n| `[[:lower:]]`   | `[a-z]`                                            | Lowercase letters              |\n| `[[:print:]]`   | `[ -~] == [ [:graph:]]`                            | Visible characters             |\n| `[[:punct:]]`   | <code>[!\"#$%&’()\\*+,-./:;<=>?@[]^\\_\\`{\\|}~]</code> | Visible punctuation characters |\n| `[[:space:]]`   | <code>[\\t\\n\\v\\f\\r ]</code>                         | Whitespace                     |\n| `[[:upper:]]`   | `[A-Z]`                                            | Uppercase letters              |\n| `[[:word:]]`    | `[0-9A-Za-z_]`                                     | Word characters                |\n| `[[:xdigit:]]`  | `[0-9A-Fa-f]`                                      | Hexadecimal digits             |\n| `[[:<:]]`       | `[\\b(?=\\w)]`                                       | Start of word                  |\n| `[[:>:]]`       | `[\\b(?<=\\w)]`                                      | End of word                    |\n\n{.show-header}\n\n### Control verb\n\n| -                      | -                     |\n| ---------------------- | :-------------------- |\n| `(*ACCEPT)`            | Control verb          |\n| `(*FAIL)`              | Control verb          |\n| `(*MARK:NAME)`         | Control verb          |\n| `(*COMMIT)`            | Control verb          |\n| `(*PRUNE)`             | Control verb          |\n| `(*SKIP)`              | Control verb          |\n| `(*THEN)`              | Control verb          |\n| `(*UTF)`               | Pattern modifier      |\n| `(*UTF8)`              | Pattern modifier      |\n| `(*UTF16)`             | Pattern modifier      |\n| `(*UTF32)`             | Pattern modifier      |\n| `(*UCP)`               | Pattern modifier      |\n| `(*CR)`                | Line break modifier   |\n| `(*LF)`                | Line break modifier   |\n| `(*CRLF)`              | Line break modifier   |\n| `(*ANYCRLF)`           | Line break modifier   |\n| `(*ANY)`               | Line break modifier   |\n| `\\R`                   | Line break modifier   |\n| `(*BSR_ANYCRLF)`       | Line break modifier   |\n| `(*BSR_UNICODE)`       | Line break modifier   |\n| `(*LIMIT_MATCH=x)`     | Regex engine modifier |\n| `(*LIMIT_RECURSION=d)` | Regex engine modifier |\n| `(*NO_AUTO_POSSESS)`   | Regex engine modifier |\n| `(*NO_START_OPT)`      | Regex engine modifier |\n\n## Regex examples{.cols-3}\n\n### Characters\n\n| Pattern        | Matches                                                   |\n| -------------- | :-------------------------------------------------------- |\n| `ring        ` | Match <yel>ring</yel> sp<yel>ring</yel>board etc.         |\n| `.           ` | Match <yel>a</yel>, <yel>9</yel>, <yel>+</yel> etc.       |\n| `h.o         ` | Match <yel>hoo</yel>, <yel>h2o</yel>, <yel>h/o</yel> etc. |\n| `ring\\?      ` | Match <yel>ring?</yel>                                    |\n| `\\(quiet\\)   ` | Match <yel>(quiet)</yel>                                  |\n| `c:\\\\windows ` | Match <yel>c:\\windows</yel>                               |\n\nUse `\\` to search for these special characters: <br> `[ \\ ^ $ . | ? * + ( ) { }`\n\n### Alternatives\n\n| Pattern                   | Matches                                    |\n| ------------------------- | :----------------------------------------- |\n| <code>cat\\|dog</code>     | Match <yel>cat</yel> or <yel>dog</yel>     |\n| <code>id\\|identity</code> | Match <yel>id</yel> or <yel>id</yel>entity |\n| <code>identity\\|id</code> | Match <yel>id</yel> or <yel>identity</yel> |\n\nOrder longer to shorter when alternatives overlap\n\n### Character classes\n\n| Pattern           | Matches                                                                |\n| ----------------- | :--------------------------------------------------------------------- |\n| `[aeiou]`         | Match any vowel                                                        |\n| `[^aeiou]`        | Match a NON vowel                                                      |\n| `r[iau]ng`        | Match <yel>ring</yel>, w<yel>rang</yel>le, sp<yel>rung</yel>, etc.     |\n| `gr[ae]y`         | Match <yel>gray</yel> or <yel>grey</yel>                               |\n| `[a-zA-Z0-9]`     | Match any letter or digit                                              |\n| `[\\u3a00-\\ufa99]` | Match any [Unicode Hàn (中文)](https://unicode.org/charts/unihan.html) |\n\nIn `[ ]` always escape `. \\ ]` and sometimes `^ - .`\n\n### Shorthand classes\n\n| Pattern          | Meaning                                               |\n| ---------------- | :---------------------------------------------------- |\n| `\\w            ` | \"Word\" character <br>_(letter, digit, or underscore)_ |\n| `\\d            ` | Digit                                                 |\n| `\\s            ` | Whitespace <br>_(space, tab, vtab, newline)_          |\n| `\\W, \\D, or \\S ` | Not word, digit, or whitespace                        |\n| `[\\D\\S]        ` | Means not digit or whitespace, both match             |\n| `[^\\d\\s]       ` | Disallow digit and whitespace                         |\n\n### Occurrences\n\n| Pattern             | Matches                                                            |\n| ------------------- | :----------------------------------------------------------------- |\n| `colou?r`           | Match <yel>color</yel> or <yel>colour</yel>                        |\n| `[BW]ill[ieamy's]*` | Match <yel>Bill</yel>, <yel>Willy</yel>, <yel>William's</yel> etc. |\n| `[a-zA-Z]+`         | Match 1 or more letters                                            |\n| `\\d{3}-\\d{2}-\\d{4}` | Match a SSN                                                        |\n| `[a-z]\\w{1,7}`      | Match a UW NetID                                                   |\n\n### Greedy versus lazy\n\n| Pattern                  | Meaning                                                 |\n| ------------------------ | :------------------------------------------------------ |\n| `*  + {n,}`<br>_greedy_  | Match as much as possible                               |\n| `<.+>   `                | Finds 1 big match in <yel>\\<b>bold\\<\\/b></yel>          |\n| `*?  +? {n,}?`<br>_lazy_ | Match as little as possible                             |\n| `<.+?>`                  | Finds 2 matches in \\<<yel>b</yel>>bold\\<<yel>\\/b</yel>> |\n\n### Scope {.col-span-2}\n\n| Pattern            | Meaning                                                                                 |\n| ------------------ | :-------------------------------------------------------------------------------------- |\n| `\\b              ` | \"Word\" edge (next to non \"word\" character)                                              |\n| `\\bring          ` | Word starts with \"ring\", ex <yel>ringtone</yel>                                         |\n| `ring\\b          ` | Word ends with \"ring\", ex <yel>spring</yel>                                             |\n| `\\b9\\b           ` | Match single digit <yel>9</yel>, not <red>19</red>, <red>91</red>, <red>99</red>, etc.. |\n| `\\b[a-zA-Z]{6}\\b ` | Match 6-letter words                                                                    |\n| `\\B              ` | Not word edge                                                                           |\n| `\\Bring\\B        ` | Match <yel>springs</yel> and <yel>wringer</yel>                                         |\n| `^\\d*$           ` | Entire string must be digits                                                            |\n| `^[a-zA-Z]{4,20}$` | String must have 4-20 letters                                                           |\n| `^[A-Z]          ` | String must begin with capital letter                                                   |\n| `[\\.!?\"')]$      ` | String must end with terminal puncutation                                               |\n\n### Modifiers\n\n| Pattern              | Meaning                                                  |\n| -------------------- | :------------------------------------------------------- |\n| `(?i)`[a-z]\\*`(?-i)` | Ignore case ON / OFF                                     |\n| `(?s)`.\\*`(?-s)`     | Match multiple lines (causes . to match newline)         |\n| `(?m)`^.\\*;$`(?-m)`  | <yel>^</yel> & <yel>$</yel> match lines not whole string |\n| `(?x)`               | #free-spacing mode, this EOL comment ignored             |\n| `(?-x)`              | free-spacing mode OFF                                    |\n| /regex/`ismx`        | Modify mode for entire string                            |\n\n### Groups\n\n| Pattern                   | Meaning                                     |\n| ------------------------- | :------------------------------------------ |\n| <code>(in\\|out)put</code> | Match <yel>input</yel> or <yel>output</yel> |\n| `\\d{5}(-\\d{4})?`          | US zip code _(\"+ 4\" optional)_              |\n\nParser tries EACH alternative if match fails after group. <br> Can lead to catastrophic backtracking.\n\n### Back references\n\n| Pattern                  | Matches                                                                     |\n| ------------------------ | :-------------------------------------------------------------------------- |\n| `(to) (be) or not \\1 \\2` | Match <yel>to be or not to be</yel>                                         |\n| `([^\\s])\\1{2}`           | Match non-space, then same twice more &nbsp; <yel>aaa</yel>, <yel>...</yel> |\n| `\\b(\\w+)\\s+\\1\\b`         | Match doubled words                                                         |\n\n### Non-capturing group\n\n| Pattern                        | Meaning                            |\n| ------------------------------ | :--------------------------------- |\n| <code>on(?:click\\|load)</code> | Faster than: <br>`on(click\\|load)` |\n\nUse non-capturing or atomic groups when possible\n\n### Atomic groups\n\n| Pattern                           | Meaning                                          |\n| --------------------------------- | :----------------------------------------------- |\n| <code>(?>red\\|green\\|blue)</code> | Faster than non-capturing                        |\n| <code>(?>id\\|identity)\\b</code>   | Match <yel>id</yel>, but not <red>id</red>entity |\n\n\"id\" matches, but `\\b` fails after atomic group, parser doesn't backtrack into group to retry 'identity'\n\nIf alternatives overlap, order longer to shorter.\n\n### Lookaround {.row-span-2 .col-span-2}\n\n| Pattern                 | Meaning                                                               |\n| ----------------------- | :-------------------------------------------------------------------- |\n| `(?= )`                 | Lookahead, if you can find ahead                                      |\n| `(?! )`                 | Lookahead,if you can not find ahead                                   |\n| `(?<= )`                | Lookbehind, if you can find behind                                    |\n| `(?<! )`                | Lookbehind, if you can NOT find behind                                |\n| `\\b\\w+?(?=ing\\b)`       | Match <yel>warbl</yel>ing, <yel>str</yel>ing, <yel>fish</yel>ing, ... |\n| `\\b(?!\\w+ing\\b)\\w+\\b`   | Words NOT ending in <red>ing</red>                                    |\n| `(?<=\\bpre).*?\\b `      | Match pre<yel>tend</yel>, pre<yel>sent</yel>, pre<yel>fix</yel>, ...  |\n| `\\b\\w{3}(?<!pre)\\w*?\\b` | Words NOT starting with <red>pre</red>                                |\n| `\\b\\w+(?<!ing)\\b`       | Match words NOT ending in <red>ing</red>                              |\n\n### If-then-else\n\nMatch \"Mr.\" or \"Ms.\" if word \"her\" is later in string\n\n```regex\nM(?(?=.*?\\bher\\b)s|r)\\.\n```\n\nrequires lookaround for IF condition\n\n## RegEx in Python\n\n### Getting started\n\nImport the regular expressions module\n\n```python\nimport re\n```\n\n### Examples {.col-span-2 .row-span-3}\n\n#### re.search()\n\n```python\n>>> sentence = 'This is a sample string'\n>>> bool(re.search(r'this', sentence, flags=re.I))\nTrue\n>>> bool(re.search(r'xyz', sentence))\nFalse\n```\n\n#### re.findall()\n\n```python\n>>> re.findall(r'\\bs?pare?\\b', 'par spar apparent spare part pare')\n['par', 'spar', 'spare', 'pare']\n>>> re.findall(r'\\b0*[1-9]\\d{2,}\\b', '0501 035 154 12 26 98234')\n['0501', '154', '98234']\n```\n\n#### re.finditer()\n\n```python\n>>> m_iter = re.finditer(r'[0-9]+', '45 349 651 593 4 204')\n>>> [m[0] for m in m_iter if int(m[0]) < 350]\n['45', '349', '4', '204']\n```\n\n#### re.split()\n\n```python\n>>> re.split(r'\\d+', 'Sample123string42with777numbers')\n['Sample', 'string', 'with', 'numbers']\n```\n\n#### re.sub()\n\n```python\n>>> ip_lines = \"catapults\\nconcatenate\\ncat\"\n>>> print(re.sub(r'^', r'* ', ip_lines, flags=re.M))\n* catapults\n* concatenate\n* cat\n```\n\n#### re.compile()\n\n```python\n>>> pet = re.compile(r'dog')\n>>> type(pet)\n<class '_sre.SRE_Pattern'>\n>>> bool(pet.search('They bought a dog'))\nTrue\n>>> bool(pet.search('A cat crossed their path'))\nFalse\n```\n\n### Functions\n\n| Function      | Description                                                       |\n| ------------- | :---------------------------------------------------------------- |\n| `re.findall`  | Returns a list containing all matches                             |\n| `re.finditer` | Return an iterable of match objects (one for each match)          |\n| `re.search`   | Returns a Match object if there is a match anywhere in the string |\n| `re.split`    | Returns a list where the string has been split at each match      |\n| `re.sub`      | Replaces one or many matches with a string                        |\n| `re.compile`  | Compile a regular expression pattern for later use                |\n| `re.escape`   | Return string with all non-alphanumerics backslashed              |\n\n### Flags\n\n| -      | -               | -                                            |\n| ------ | --------------- | :------------------------------------------- |\n| `re.I` | `re.IGNORECASE` | Ignore case                                  |\n| `re.M` | `re.MULTILINE`  | Multiline                                    |\n| `re.L` | `re.LOCALE`     | Make `\\w`,`\\b`,`\\s` _locale dependent_       |\n| `re.S` | `re.DOTALL`     | Dot matches all _(including newline)_        |\n| `re.U` | `re.UNICODE`    | Make `\\w`,`\\b`,`\\d`,`\\s` _unicode dependent_ |\n| `re.X` | `re.VERBOSE`    | Readable style                               |\n\n## Regex in JavaScript\n\n### test()\n\n```javascript\nlet textA = 'I like APPles very much';\nlet textB = 'I like APPles';\nlet regex = /apples$/i;\n\n// Output: false\nconsole.log(regex.test(textA));\n\n// Output: true\nconsole.log(regex.test(textB));\n```\n\n### search()\n\n```javascript\nlet text = 'I like APPles very much';\nlet regexA = /apples/;\nlet regexB = /apples/i;\n\n// Output: -1\nconsole.log(text.search(regexA));\n\n// Output: 7\nconsole.log(text.search(regexB));\n```\n\n### exec()\n\n```javascript\nlet text = 'Do you like apples?';\nlet regex = /apples/;\n\n// Output: apples\nconsole.log(regex.exec(text)[0]);\n\n// Output: Do you like apples?\nconsole.log(regex.exec(text).input);\n```\n\n### match()\n\n```javascript\nlet text = 'Here are apples and apPleS';\nlet regex = /apples/gi;\n\n// Output: [ \"apples\", \"apPleS\" ]\nconsole.log(text.match(regex));\n```\n\n### split() {.col-span-2}\n\n```javascript\nlet text = 'This 593 string will be brok294en at places where d1gits are.';\nlet regex = /\\d+/g;\n\n// Output: [ \"This \", \" string will be brok\", \"en at places where d\", \"gits are.\" ]\nconsole.log(text.split(regex));\n```\n\n### matchAll()\n\n```javascript\nlet regex = /t(e)(st(\\d?))/g;\nlet text = 'test1test2';\nlet array = [...text.matchAll(regex)];\n\n// Output: [\"test1\", \"e\", \"st1\", \"1\"]\nconsole.log(array[0]);\n\n// Output: [\"test2\", \"e\", \"st2\", \"2\"]\nconsole.log(array[1]);\n```\n\n### replace()\n\n```javascript {.wrap}\nlet text = 'Do you like aPPles?';\nlet regex = /apples/i;\n\n// Output: Do you like mangoes?\nlet result = text.replace(regex, 'mangoes');\nconsole.log(result);\n```\n\n### replaceAll()\n\n```javascript\nlet regex = /apples/gi;\nlet text = 'Here are apples and apPleS';\n\n// Output: Here are mangoes and mangoes\nlet result = text.replaceAll(regex, 'mangoes');\nconsole.log(result);\n```\n\n## Regex in PHP\n\n### Functions {.col-span-2}\n\n| -                         | -                                                                |\n| ------------------------- | :--------------------------------------------------------------- |\n| `preg_match()`            | Performs a regex match                                           |\n| `preg_match_all()`        | Perform a global regular expression match                        |\n| `preg_replace_callback()` | Perform a regular expression search and replace using a callback |\n| `preg_replace()`          | Perform a regular expression search and replace                  |\n| `preg_split()`            | Splits a string by regex pattern                                 |\n| `preg_grep()`             | Returns array entries that match a pattern                       |\n\n### preg_replace\n\n```php {.wrap}\n$str = \"Visit Microsoft!\";\n$regex = \"/microsoft/i\";\n\n// Output: Visit CheatSheets!\necho preg_replace($regex, \"CheatSheets\", $str);\n```\n\n### preg_match\n\n```php\n$str = \"Visit CheatSheets\";\n$regex = \"#cheatsheets#i\";\n\n// Output: 1\necho preg_match($regex, $str);\n```\n\n### preg_matchall {.col-span-2 .row-span-2}\n\n```php\n$regex = \"/[a-zA-Z]+ (\\d+)/\";\n$input_str = \"June 24, August 13, and December 30\";\nif (preg_match_all($regex, $input_str, $matches_out)) {\n\n    // Output: 2\n    echo count($matches_out);\n\n    // Output: 3\n    echo count($matches_out[0]);\n\n    // Output: Array(\"June 24\", \"August 13\", \"December 30\")\n    print_r($matches_out[0]);\n\n    // Output: Array(\"24\", \"13\", \"30\")\n    print_r($matches_out[1]);\n}\n```\n\n### preg_grep\n\n```php\n$arr = [\"Jane\", \"jane\", \"Joan\", \"JANE\"];\n$regex = \"/Jane/\";\n\n// Output: Jane\necho preg_grep($regex, $arr);\n```\n\n### preg_split {.col-span-2}\n\n```php\n$str = \"Jane\\tKate\\nLucy Marion\";\n$regex = \"@\\s@\";\n\n// Output: Array(\"Jane\", \"Kate\", \"Lucy\", \"Marion\")\nprint_r(preg_split($regex, $str));\n```\n\n## Regex in Java\n\n### Styles {.col-span-2}\n\n#### First way\n\n```java\nPattern p = Pattern.compile(\".s\", Pattern.CASE_INSENSITIVE);\nMatcher m = p.matcher(\"aS\");\nboolean s1 = m.matches();\nSystem.out.println(s1);   // Outputs: true\n```\n\n#### Second way\n\n```java\nboolean s2 = Pattern.compile(\"[0-9]+\").matcher(\"123\").matches();\nSystem.out.println(s2);   // Outputs: true\n```\n\n#### Third way\n\n```java\nboolean s3 = Pattern.matches(\".s\", \"XXXX\");\nSystem.out.println(s3);   // Outputs: false\n```\n\n### Pattern Fields\n\n| -                  | -                               |\n| ------------------ | :------------------------------ |\n| `CANON_EQ`         | Canonical equivalence           |\n| `CASE_INSENSITIVE` | Case-insensitive matching       |\n| `COMMENTS`         | Permits whitespace and comments |\n| `DOTALL`           | Dotall mode                     |\n| `MULTILINE`        | Multiline mode                  |\n| `UNICODE_CASE`     | Unicode-aware case folding      |\n| `UNIX_LINES`       | Unix lines mode                 |\n\n### Methods\n\n#### Pattern\n\n- Pattern compile(String regex [, int flags])\n- boolean matches([String regex, ] CharSequence input)\n- String[] split(String regex [, int limit])\n- String quote(String s)\n\n#### Matcher\n\n- int start([int group | String name])\n- int end([int group | String name])\n- boolean find([int start])\n- String group([int group | String name])\n- Matcher reset()\n\n#### String\n\n- boolean matches(String regex)\n- String replaceAll(String regex, String replacement)\n- String[] split(String regex[, int limit])\n\nThere are more methods ...\n\n### Examples {.col-span-2}\n\nReplace sentence:\n\n```java\nString regex = \"[A-Z\\n]{5}$\";\nString str = \"I like APP\\nLE\";\n\nPattern p = Pattern.compile(regex, Pattern.MULTILINE);\nMatcher m = p.matcher(str);\n\n// Outputs: I like Apple!\nSystem.out.println(m.replaceAll(\"pple!\"));\n```\n\nArray of all matches:\n\n```java\nString str = \"She sells seashells by the Seashore\";\nString regex = \"\\\\w*se\\\\w*\";\n\nPattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);\nMatcher m = p.matcher(str);\n\nList<String> matches = new ArrayList<>();\nwhile (m.find()) {\n    matches.add(m.group());\n}\n\n// Outputs: [sells, seashells, Seashore]\nSystem.out.println(matches);\n```\n\n## Regex in MySQL {.cols-2}\n\n### Functions\n\n| Name               | Description                                                              |\n| ------------------ | :----------------------------------------------------------------------- |\n| `REGEXP          ` | Whether string matches regex                                             |\n| `REGEXP_INSTR()  ` | Starting index of substring matching regex <br>_(NOTE: Only MySQL 8.0+)_ |\n| `REGEXP_LIKE()   ` | Whether string matches regex <br>_(NOTE: Only MySQL 8.0+)_               |\n| `REGEXP_REPLACE()` | Replace substrings matching regex <br>_(NOTE: Only MySQL 8.0+)_          |\n| `REGEXP_SUBSTR() ` | Return substring matching regex <br>_(NOTE: Only MySQL 8.0+)_            |\n\n### REGEXP\n\n```sql {.wrap}\nexpr REGEXP pat\n```\n\n#### Examples\n\n```sql\nmysql> SELECT 'abc' REGEXP '^[a-d]';\n1\nmysql> SELECT name FROM cities WHERE name REGEXP '^A';\nmysql> SELECT name FROM cities WHERE name NOT REGEXP '^A';\nmysql> SELECT name FROM cities WHERE name REGEXP 'A|B|R';\nmysql> SELECT 'a' REGEXP 'A', 'a' REGEXP BINARY 'A';\n1   0\n```\n\n### REGEXP_REPLACE\n\n```{.wrap}\nREGEXP_REPLACE(expr, pat, repl[, pos[, occurrence[, match_type]]])\n```\n\n#### Examples\n\n```sql\nmysql> SELECT REGEXP_REPLACE('a b c', 'b', 'X');\na X c\nmysql> SELECT REGEXP_REPLACE('abc ghi', '[a-z]+', 'X', 1, 2);\nabc X\n```\n\n### REGEXP_SUBSTR\n\n```{.wrap}\nREGEXP_SUBSTR(expr, pat[, pos[, occurrence[, match_type]]])\n```\n\n#### Examples\n\n```sql\nmysql> SELECT REGEXP_SUBSTR('abc def ghi', '[a-z]+');\nabc\nmysql> SELECT REGEXP_SUBSTR('abc def ghi', '[a-z]+', 1, 3);\nghi\n```\n\n### REGEXP_LIKE\n\n```\nREGEXP_LIKE(expr, pat[, match_type])\n```\n\n#### Examples\n\n```sql\nmysql> SELECT regexp_like('aba', 'b+')\n1\nmysql> SELECT regexp_like('aba', 'b{2}')\n0\nmysql> # i: case-insensitive\nmysql> SELECT regexp_like('Abba', 'ABBA', 'i');\n1\nmysql> # m: multi-line\nmysql> SELECT regexp_like('a\\nb\\nc', '^b$', 'm');\n1\n```\n\n### REGEXP_INSTR\n\n```{.wrap}\nREGEXP_INSTR(expr, pat[, pos[, occurrence[, return_option[, match_type]]]])\n```\n\n#### Examples\n\n```sql\nmysql> SELECT regexp_instr('aa aaa aaaa', 'a{3}');\n2\nmysql> SELECT regexp_instr('abba', 'b{2}', 2);\n2\nmysql> SELECT regexp_instr('abbabba', 'b{2}', 1, 2);\n5\nmysql> SELECT regexp_instr('abbabba', 'b{2}', 1, 3, 1);\n7\n```\n"
  },
  {
    "path": "source/_posts/resolutions.md",
    "content": "---\ntitle: Resolutions\ndate: 2020-12-27 17:21:54\ntags:\n  - design\n  - screen\n  - size\ncategories:\n  - Other\nintro: |\n  This cheat sheet lists screen sizes, viewport size and CSS media queries for popular Phones, Tablets, Laptops and Watches\n---\n\n## Getting Started {.cols-2}\n\n### Introduction\n\n- Resolution is the number of pixels (individual points of color)\n- Viewport is defined by the size of the rectangle filled by a web page on your screen\n- Screen resolution refers to the clarity of the text and images displayed on your screen\n- For design\n\n{.marker-round}\n\n### Multi-format of Resolutions\n\n- [Markdown Table](https://tableconvert.com/html-to-markdown?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [Template](https://tableconvert.com/html-to-template?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [LaTeX Table](https://tableconvert.com/html-to-latex?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [CSV](https://tableconvert.com/html-to-csv?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [Excel](https://tableconvert.com/html-to-excel?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [JSON Array](https://tableconvert.com/html-to-json?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [HTML Table](https://tableconvert.com/html-to-html?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [Insert SQL](https://tableconvert.com/html-to-sql?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [YAML Sequence](https://tableconvert.com/html-to-yaml?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [XML](https://tableconvert.com/html-to-xml?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [ASCII](https://tableconvert.com/html-to-ascii?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [MediaWiki Table](https://tableconvert.com/html-to-mediawiki?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [AsciiDoc Table](https://tableconvert.com/html-to-asciidoc?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [Jira Table](https://tableconvert.com/html-to-jira?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [Textile Table](https://tableconvert.com/html-to-textile?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [reStructuredText](https://tableconvert.com/html-to-restructuredtext?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [PHP Array](https://tableconvert.com/html-to-php?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [Ruby Array](https://tableconvert.com/html-to-ruby?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [ASP Array](https://tableconvert.com/html-to-asp?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [ActionScript](https://tableconvert.com/html-to-actionscript?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [BBCode](https://tableconvert.com/html-to-bbcode?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [PDF](https://tableconvert.com/html-to-pdf?data=https://cheatsheets.zip/resolutions#TableGenerator)\n- [JPEG](https://tableconvert.com/html-to-jpeg?data=https://cheatsheets.zip/resolutions#TableGenerator)\n\n{.cols-4 .marker-none}\n\n## Lists of Resolutions {.cols-1}\n\n### Mobile Phones\n\n| DEVICES                            | SCREEN SIZE          | RESOLUTION                | VIEWPORT                 | DENSITY            | DEVICE DENSITY     | RATIO                   | OS            |\n| ---------------------------------- | -------------------- | ------------------------- | ------------------------ | ------------------ | ------------------ | ----------------------- | ------------- |\n| Apple iPhone 11 (2019)             | 6.1 <sub>inch</sub>  | 828 x 1792 <sub>px</sub>  | 414 x 896 <sub>px</sub>  | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2 <sub>xhdpi</sub>      | iOS 13.0      |\n| Apple iPhone 11 Pro (2019)         | 5.8 <sub>inch</sub>  | 1125 x 2436 <sub>px</sub> | 375 x 812 <sub>px</sub>  | 458 <sub>ppi</sub> | 153 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | iOS 13.0      |\n| Apple iPhone 11 Pro Max (2019)     | 6.5 <sub>inch</sub>  | 1242 x 2688 <sub>px</sub> | 414 x 896 <sub>px</sub>  | 458 <sub>ppi</sub> | 153 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | iOS 13.0      |\n| Apple iPhone 12 (2020)             | 6.1 <sub>inch</sub>  | 1170 x 2532 <sub>px</sub> | 390 x 844 <sub>px</sub>  | 460 <sub>ppi</sub> | 153 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | iOS 14.1      |\n| Apple iPhone 12 Pro (2020)         | 6.1 <sub>inch</sub>  | 1170 x 2532 <sub>px</sub> | 390 x 844 <sub>px</sub>  | 460 <sub>ppi</sub> | 153 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | iOS 14.1      |\n| Apple iPhone 12 Pro Max (2020)     | 6.7 <sub>inch</sub>  | 1284 x 2778 <sub>px</sub> | 428 x 926 <sub>px</sub>  | 458 <sub>ppi</sub> | 153 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | iOS 14.1      |\n| Apple iPhone 12 mini (2020)        | 5.4 <sub>inch</sub>  | 1080 x 2340 <sub>px</sub> | 360 x 780 <sub>px</sub>  | 476 <sub>ppi</sub> | 159 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | iOS 14.1      |\n| Apple iPhone 5                     | 4 <sub>inch</sub>    | 640 x 1136 <sub>px</sub>  | 320 x 568 <sub>px</sub>  | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub>    | iOS 6         |\n| Apple iPhone 5c                    | 4 <sub>inch</sub>    | 640 x 1136 <sub>px</sub>  | 320 x 568 <sub>px</sub>  | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub>    | iOS 7         |\n| Apple iPhone 5s                    | 4 <sub>inch</sub>    | 640 x 1136 <sub>px</sub>  | 320 x 568 <sub>px</sub>  | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub>    | iOS 7         |\n| Apple iPhone 6                     | 4.7 <sub>inch</sub>  | 750 x 1334 <sub>px</sub>  | 375 x 667 <sub>px</sub>  | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub>    | iOS 8         |\n| Apple iPhone 6s                    | 4.7 <sub>inch</sub>  | 750 x 1334 <sub>px</sub>  | 375 x 667 <sub>px</sub>  | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub>    | iOS 9         |\n| Apple iPhone 6s Plus               | 5.5 <sub>inch</sub>  | 1080 x 1920 <sub>px</sub> | 414 x 736 <sub>px</sub>  | 401 <sub>ppi</sub> | 134 <sub>ppi</sub> | 3.0 <sub>xxhdpi</sub>   | iOS 9         |\n| Apple iPhone 7                     | 4.7 <sub>inch</sub>  | 750 x 1334 <sub>px</sub>  | 375 x 667 <sub>px</sub>  | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub>    | iOS 10.0.1    |\n| Apple iPhone 7 Plus                | 5.5 <sub>inch</sub>  | 1080 x 1920 <sub>px</sub> | 414 x 736 <sub>px</sub>  | 401 <sub>ppi</sub> | 134 <sub>ppi</sub> | 3.0 <sub>xxhdpi</sub>   | iOS 10.0.1    |\n| Apple iPhone 8                     | 4.7 <sub>inch</sub>  | 750 x 1334 <sub>px</sub>  | 375 x 667 <sub>px</sub>  | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub>    | iOS 11        |\n| Apple iPhone 8 Plus                | 5.5 <sub>inch</sub>  | 1080 x 1920 <sub>px</sub> | 414 x 736 <sub>px</sub>  | 401 <sub>ppi</sub> | 134 <sub>ppi</sub> | 3.0 <sub>xxhdpi</sub>   | iOS 11        |\n| Apple iPhone SE                    | 4.0 <sub>inch</sub>  | 640 x 1136 <sub>px</sub>  | 320 x 568 <sub>px</sub>  | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2 <sub>xhdpi</sub>      | iOS 9.3.2     |\n| Apple iPhone SE (2020)             | 4.7 <sub>inch</sub>  | 750 x 1334 <sub>px</sub>  | 375 x 667 <sub>px</sub>  | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2 <sub>xhdpi</sub>      | iOS 13.0      |\n| Apple iPhone X                     | 5.8 <sub>inch</sub>  | 1125 x 2436 <sub>px</sub> | 375 x 812 <sub>px</sub>  | 458 <sub>ppi</sub> | 153 <sub>ppi</sub> | 3.0 <sub>xxhdpi</sub>   | iOS 11.1.1    |\n| Apple iPhone XR                    | 6.1 <sub>inch</sub>  | 828 x 1792 <sub>px</sub>  | 414 x 896 <sub>px</sub>  | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub>    | iOS 12        |\n| Apple iPhone XS                    | 5.8 <sub>inch</sub>  | 1125 x 2436 <sub>px</sub> | 375 x 812 <sub>px</sub>  | 458 <sub>ppi</sub> | 153 <sub>ppi</sub> | 3.0 <sub>xxhdpi</sub>   | iOS 12        |\n| Apple iPhone XS Max                | 6.5 <sub>inch</sub>  | 1242 x 2688 <sub>px</sub> | 414 x 896 <sub>px</sub>  | 458 <sub>ppi</sub> | 153 <sub>ppi</sub> | 3.0 <sub>xxhdpi</sub>   | iOS 12        |\n| Google Pixel                       | 5.0 <sub>inch</sub>  | 1080 x 1920 <sub>px</sub> | 412 x 732 <sub>px</sub>  | 441 <sub>ppi</sub> | 168 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 7.1   |\n| Google Pixel                       | 5.0 <sub>inch</sub>  | 1080 x 1920 <sub>px</sub> | 411 x 731 <sub>px</sub>  | 441 <sub>ppi</sub> | 168 <sub>ppi</sub> | 2.6 <sub>xxhdpi</sub>   | Android 7.1   |\n| Google Pixel 2                     | 5.0 <sub>inch</sub>  | 1080 x 1920 <sub>px</sub> | 412 x 732 <sub>px</sub>  | 441 <sub>ppi</sub> | 168 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 8.0   |\n| Google Pixel 2 XL                  | 6.0 <sub>inch</sub>  | 1440 x 2880 <sub>px</sub> |                          | 538 <sub>ppi</sub> | 154 <sub>ppi</sub> | 3.5 <sub>xxxhdpi</sub>  | Android 8.0   |\n| Google Pixel 3 (2018)              | 5.5 <sub>inch</sub>  | 1080 x 2160 <sub>px</sub> | 393 x 786 <sub>px</sub>  | 443 <sub>ppi</sub> | 161 <sub>ppi</sub> | 2.75 <sub>xxhdpi</sub>  | Android 9.0   |\n| Google Pixel 3 XL (2018)           | 6.3 <sub>inch</sub>  | 1440 x 2960 <sub>px</sub> | 412 x 846 <sub>px</sub>  | 523 <sub>ppi</sub> | 149 <sub>ppi</sub> | 3.5 <sub>xxxhdpi</sub>  | Android 9.0   |\n| Google Pixel 3a (2019)             | 5.6 <sub>inch</sub>  | 1080 x 2220 <sub>px</sub> | 393 x 808 <sub>px</sub>  | 441 <sub>ppi</sub> | 160 <sub>ppi</sub> | 2.75 <sub>xxhdpi</sub>  | Android 9.0   |\n| Google Pixel 3a XL (2019)          | 6 <sub>inch</sub>    | 1080 x 2160 <sub>px</sub> | 412 x 823 <sub>px</sub>  | 402 <sub>ppi</sub> | 153 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 9.0   |\n| Google Pixel 4 (2019)              | 5.7 <sub>inch</sub>  | 1080 x 2280 <sub>px</sub> | 393 x 830 <sub>px</sub>  | 444 <sub>ppi</sub> | 161 <sub>ppi</sub> | 2.75 <sub>xxhdpi</sub>  | Android 10.0  |\n| Google Pixel 4 XL (2019)           | 6.3 <sub>inch</sub>  | 1440 x 3040 <sub>px</sub> | 412 x 869 <sub>px</sub>  | 537 <sub>ppi</sub> | 153 <sub>ppi</sub> | 3.5 <sub>xxxhdpi</sub>  | Android 10    |\n| Google Pixel 4a (2020)             | 5.81 <sub>inch</sub> | 1080 x 2340 <sub>px</sub> | 393 x 851 <sub>px</sub>  | 443 <sub>ppi</sub> | 161 <sub>ppi</sub> | 2.75 <sub>xxhdpi</sub>  | Android 10.0  |\n| Google Pixel 5 (2020)              | 6 <sub>inch</sub>    | 1080 x 2340 <sub>px</sub> | 393 x 851 <sub>px</sub>  | 432 <sub>ppi</sub> | 157 <sub>ppi</sub> | 2.75 <sub>xxhdpi</sub>  | Android 11.0  |\n| Google Pixel XL                    | 5.5 <sub>inch</sub>  | 1440 x 2560 <sub>px</sub> |                          | 534 <sub>ppi</sub> | 153 <sub>ppi</sub> | 3.5 <sub>xxxhdpi</sub>  | Android 7.1   |\n| HTC Desire 10 Lifestyle            | 5.5 <sub>inch</sub>  | 720 x 1280 <sub>px</sub>  | 360 x 640 <sub>px</sub>  | 267 <sub>ppi</sub> | 134 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub>    | Android 6.0   |\n| HTC Desire 628                     | 5.0 <sub>inch</sub>  | 720 x 1280 <sub>px</sub>  | 360 x 640 <sub>px</sub>  | 294 <sub>ppi</sub> | 147 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub>    | Android 5.1   |\n| Honor 6X (2016)                    | 5.5 <sub>inch</sub>  | 1080 x 1920 <sub>px</sub> | 360 x 640 <sub>px</sub>  | 403 <sub>ppi</sub> | 134 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | Android 6.0   |\n| Honor 7X (2017)                    | 5.93 <sub>inch</sub> | 1080 x 2160 <sub>px</sub> | 360 x 720 <sub>px</sub>  | 407 <sub>ppi</sub> | 136 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | Android 7.0   |\n| Honor 8X (2018)                    | 6.5 <sub>inch</sub>  | 1080 x 2340 <sub>px</sub> | 360 x 780 <sub>px</sub>  | 397 <sub>ppi</sub> | 132 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | Android 8.1   |\n| Honor 9X (2019)                    | 6.59 <sub>inch</sub> | 1080 x 2340 <sub>px</sub> | 360 x 780 <sub>px</sub>  | 391 <sub>ppi</sub> | 130 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | Android 9.0   |\n| Huawei Mate 10 Lite (2017)         | 5.9 <sub>inch</sub>  | 1080 x 2160 <sub>px</sub> | 360 x 720 <sub>px</sub>  | 409 <sub>ppi</sub> | 136 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | Android 7.0   |\n| Huawei Mate 20 Lite (2018)         | 6.3 <sub>inch</sub>  | 1080 x 2340 <sub>px</sub> | 360 x 780 <sub>px</sub>  | 409 <sub>ppi</sub> | 136 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | Android 8.1   |\n| Huawei Mate 20 Pro (2018)          | 6.39 <sub>inch</sub> | 1440 x 3120 <sub>px</sub> | 360 x 780 <sub>px</sub>  | 538 <sub>ppi</sub> | 135 <sub>ppi</sub> | 4 <sub>xxxhdpi</sub>    | Android 9.0   |\n| Huawei Mate 30 (2019)              | 6.62 <sub>inch</sub> | 1080 x 2340 <sub>px</sub> | 360 x 780 <sub>px</sub>  | 389 <sub>ppi</sub> | 130 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | Android 10.0  |\n| Huawei Mate 30 Pro (2019)          | 6.53 <sub>inch</sub> | 1176 x 2400 <sub>px</sub> | 392 x 800 <sub>px</sub>  | 409 <sub>ppi</sub> | 136 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | Android 10.0  |\n| Huawei Nova 7i (2020)              | 6.4 <sub>inch</sub>  | 1080 x 2310 <sub>px</sub> | 360 x 770 <sub>px</sub>  | 398 <sub>ppi</sub> | 133 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | Android 10.0  |\n| Huawei Y9 Prime (2019)             | 6.59 <sub>inch</sub> | 1080 x 2340 <sub>px</sub> | 360 x 780 <sub>px</sub>  | 391 <sub>ppi</sub> | 130 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | Android 9.0   |\n| Huawei Y9s (2019)                  | 6.59 <sub>inch</sub> | 1080 x 2340 <sub>px</sub> | 360 x 780 <sub>px</sub>  | 391 <sub>ppi</sub> | 130 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | Android 9.0   |\n| LG G5                              | 5.3 <sub>inch</sub>  | 1440 x 2560 <sub>px</sub> | 360 x 640 <sub>px</sub>  | 554 <sub>ppi</sub> | 139 <sub>ppi</sub> | 4.0 <sub>xxxhdpi</sub>  | Android 6.0.1 |\n| Motorola Moto E5 Plus              | 6.0 <sub>inch</sub>  | 720 x 1440 <sub>px</sub>  |                          | 268 <sub>ppi</sub> | 134 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub>    | Android 8.0   |\n| OnePlus 6                          | 6.28 <sub>inch</sub> | 1080 x 2280 <sub>px</sub> | 412 x 869 <sub>px</sub>  | 402 <sub>ppi</sub> | 153 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 8.1   |\n| OnePlus 6T                         | 6.41 <sub>inch</sub> | 1080 x 2340 <sub>px</sub> | 412 x 892 <sub>px</sub>  | 402 <sub>ppi</sub> | 153 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 9.0   |\n| OnePlus 7                          | 6.41 <sub>inch</sub> | 1080 x 2340 <sub>px</sub> | 412 x 892 <sub>px</sub>  | 402 <sub>ppi</sub> | 153 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 9.0   |\n| OnePlus 7 Pro                      | 6.67 <sub>inch</sub> | 1440 x 3120 <sub>px</sub> | 412 x 892 <sub>px</sub>  | 516 <sub>ppi</sub> | 147 <sub>ppi</sub> | 3.5 <sub>xxxhdpi</sub>  | Android 9.0   |\n| OnePlus 7T (2019)                  | 6.55 <sub>inch</sub> | 1080 x 2400 <sub>px</sub> | 412 x 914 <sub>px</sub>  | 402 <sub>ppi</sub> | 153 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 10.0  |\n| OnePlus 8 (2020)                   | 6.55 <sub>inch</sub> | 1080 x 2400 <sub>px</sub> | 412 x 915 <sub>px</sub>  | 402 <sub>ppi</sub> | 153 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 10.0  |\n| OnePlus 8 Pro (2020)               | 6.78 <sub>inch</sub> | 1440 x 3168 <sub>px</sub> | 412 x 906 <sub>px</sub>  | 513 <sub>ppi</sub> | 147 <sub>ppi</sub> | 3.5 <sub>xxxhdpi</sub>  | Android 10.0  |\n| OnePlus 8T (2020)                  | 6.55 <sub>inch</sub> | 1080 x 2400 <sub>px</sub> | 412 x 914 <sub>px</sub>  | 402 <sub>ppi</sub> | 153 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 11.0  |\n| OnePlus Nord (2020)                | 6.44 <sub>inch</sub> | 1080 x 2400 <sub>px</sub> | 412 x 915 <sub>px</sub>  | 408 <sub>ppi</sub> | 155 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 10.0  |\n| Redmi Note 9 Pro (2020)            | 6.67 <sub>inch</sub> | 1080 x 2400 <sub>px</sub> | 393 x 873 <sub>px</sub>  | 395 <sub>ppi</sub> | 144 <sub>ppi</sub> | 2.75 <sub>xxhdpi</sub>  | Android 10.0  |\n| Samsung A50 (2019)                 | 6.4 <sub>inch</sub>  | 1080 x 2340 <sub>px</sub> | 412 x 892 <sub>px</sub>  | 403 <sub>ppi</sub> | 154 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 9.0   |\n| Samsung Galaxy A30 (2019)          | 6.4 <sub>inch</sub>  | 1080 x 2340 <sub>px</sub> | 412 x 892 <sub>px</sub>  | 403 <sub>ppi</sub> | 154 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 9.0   |\n| Samsung Galaxy A50s (2019)         | 6.4 <sub>inch</sub>  | 1080 x 2340 <sub>px</sub> | 412 x 892 <sub>px</sub>  | 403 <sub>ppi</sub> | 154 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 9.0   |\n| Samsung Galaxy A51 (2019)          | 6.5 <sub>inch</sub>  | 1080 x 2400 <sub>px</sub> | 412 x 914 <sub>px</sub>  | 405 <sub>ppi</sub> | 154 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 10.0  |\n| Samsung Galaxy A6s                 | 6.0 <sub>inch</sub>  | 1080 x 2160 <sub>px</sub> | 360 x 720 <sub>px</sub>  | 402 <sub>ppi</sub> | 134 <sub>ppi</sub> | 3.0 <sub>xxhdpi</sub>   | Android 8.0   |\n| Samsung Galaxy A70s (2019)         | 6.7 <sub>inch</sub>  | 1080 x 2400 <sub>px</sub> | 412 x 914 <sub>px</sub>  | 393 <sub>ppi</sub> | 150 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 9.0   |\n| Samsung Galaxy A71 (2020)          | 6.7 <sub>inch</sub>  | 1080 x 2400 <sub>px</sub> | 412 x 914 <sub>px</sub>  | 393 <sub>ppi</sub> | 150 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 10.0  |\n| Samsung Galaxy Fold (2019)         | 7.3 <sub>inch</sub>  | 1536 x 2152 <sub>px</sub> | 768 x 1076 <sub>px</sub> | 362 <sub>ppi</sub> | 181 <sub>ppi</sub> | 2 <sub>xhdpi</sub>      | Android 9.0   |\n| Samsung Galaxy J4                  | 5.5 <sub>inch</sub>  | 720 x 1280 <sub>px</sub>  |                          |                    | 134 <sub>ppi</sub> | 2 <sub>xhdpi</sub>      | Android 8.0   |\n| Samsung Galaxy J5                  | 5.0 <sub>inch</sub>  | 720 x 1280 <sub>px</sub>  |                          | 294 <sub>ppi</sub> |                    | 2 <sub>xhdpi</sub>      | Android 5.1   |\n| Samsung Galaxy J5 Prime            | 5.0 <sub>inch</sub>  | 720 x 1280 <sub>px</sub>  |                          | 294 <sub>ppi</sub> | 147 <sub>ppi</sub> | 2 <sub>xhdpi</sub>      | Android 6.0.1 |\n| Samsung Galaxy J6                  | 5.6 <sub>inch</sub>  | 720 x 1480 <sub>px</sub>  |                          | 293 <sub>ppi</sub> | 147 <sub>ppi</sub> | 2 <sub>xhdpi</sub>      | Android 8.0   |\n| Samsung Galaxy J7                  | 5.5 <sub>inch</sub>  | 720 x 1280 <sub>px</sub>  | 360 x 640 <sub>px</sub>  | 267 <sub>ppi</sub> | 134 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub>    | Android 6.0.1 |\n| Samsung Galaxy J7 Prime            | 5.5 <sub>inch</sub>  | 1080 x 1920 <sub>px</sub> | 360 x 640 <sub>px</sub>  | 401 <sub>ppi</sub> | 134 <sub>ppi</sub> | 3.0 <sub>xxhdpi</sub>   | Android 6.0.1 |\n| Samsung Galaxy J7 Prime2 (2018)    | 5.5 <sub>inch</sub>  | 1080 x 1920 <sub>px</sub> | 412 x 732 <sub>px</sub>  | 401 <sub>ppi</sub> | 153 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 7.0   |\n| Samsung Galaxy J7 Pro              | 5.5 <sub>inch</sub>  | 1080 x 1920 <sub>px</sub> |                          | 401 <sub>ppi</sub> | 134 <sub>ppi</sub> | 3 <sub>xxhdpi</sub>     | Android 7.0   |\n| Samsung Galaxy J8                  | 6.0 <sub>inch</sub>  | 720 x 1480 <sub>px</sub>  |                          | 274 <sub>ppi</sub> | 137 <sub>ppi</sub> | 2 <sub>xhdpi</sub>      | Android 8.0   |\n| Samsung Galaxy Note20 (2020)       | 6.7 <sub>inch</sub>  | 1080 x 2400 <sub>px</sub> | 412 x 915 <sub>px</sub>  | 393 <sub>ppi</sub> | 150 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 10.0  |\n| Samsung Galaxy Note20 Ultra (2020) | 6.9 <sub>inch</sub>  | 1440 x 3088 <sub>px</sub> | 412 x 883 <sub>px</sub>  | 496 <sub>ppi</sub> | 142 <sub>ppi</sub> | 3.5 <sub>xxxhdpi</sub>  | Android 10.0  |\n| Samsung Galaxy Note8               | 6.3 <sub>inch</sub>  | 1440 x 2960 <sub>px</sub> |                          | 521 <sub>ppi</sub> | 149 <sub>ppi</sub> | 3.5 <sub>xxxhdpi</sub>  | Android 7.1.1 |\n| Samsung Galaxy On8                 | 5.5 <sub>inch</sub>  | 1080 x 1920 <sub>px</sub> | 360 x 640 <sub>px</sub>  | 401 <sub>ppi</sub> | 134 <sub>ppi</sub> | 3.0 <sub>xxhdpi</sub>   | Android 6.0.1 |\n| Samsung Galaxy S10                 | 6.1 <sub>inch</sub>  | 1440 x 3040 <sub>px</sub> | 360 x 760 <sub>px</sub>  | 550 <sub>ppi</sub> | 138 <sub>ppi</sub> | 4 <sub>xxxhdpi</sub>    | Android 9.0   |\n| Samsung Galaxy S10 Lite (2020)     | 6.7 <sub>inch</sub>  | 1080 x 2400 <sub>px</sub> | 412 x 914 <sub>px</sub>  | 394 <sub>ppi</sub> | 150 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 10.0  |\n| Samsung Galaxy S10+                | 6.4 <sub>inch</sub>  | 1440 x 3040 <sub>px</sub> | 412 x 869 <sub>px</sub>  | 522 <sub>ppi</sub> | 149 <sub>ppi</sub> | 3.5 <sub>xxxhdpi</sub>  | Android 9.0   |\n| Samsung Galaxy S20 (2020)          | 6.4 <sub>inch</sub>  | 1440 x 3200 <sub>px</sub> | 360 x 800 <sub>px</sub>  | 563 <sub>ppi</sub> | 141 <sub>ppi</sub> | 4 <sub>xxxhdpi</sub>    | Android 10.0  |\n| Samsung Galaxy S20 FE (2020)       | 6.5 <sub>inch</sub>  | 1080 x 2400 <sub>px</sub> | 412 x 914 <sub>px</sub>  | 407 <sub>ppi</sub> | 155 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 10.0  |\n| Samsung Galaxy S20 Ultra (2020)    | 6.9 <sub>inch</sub>  | 1440 x 3200 <sub>px</sub> | 412 x 915 <sub>px</sub>  | 511 <sub>ppi</sub> | 146 <sub>ppi</sub> | 3.5 <sub>xxxhdpi</sub>  | Android 10.0  |\n| Samsung Galaxy S20+ (2020)         | 6.7 <sub>inch</sub>  | 1440 x 3200 <sub>px</sub> | 384 x 854 <sub>px</sub>  | 525 <sub>ppi</sub> | 140 <sub>ppi</sub> | 3.75 <sub>xxxhdpi</sub> | Android 10.0  |\n| Samsung Galaxy S21 Ultra (2021)    | 6.8 <sub>inch</sub>  | 1440 x 3200 <sub>px</sub> | 384 x 854 <sub>px</sub>  | 515 <sub>ppi</sub> | 137 <sub>ppi</sub> | 3.75 <sub>xxxhdpi</sub> | Android 11.0  |\n| Samsung Galaxy S8                  | 5.8 <sub>inch</sub>  | 1440 x 2960 <sub>px</sub> | 360 x 740 <sub>px</sub>  | 570 <sub>ppi</sub> | 142 <sub>ppi</sub> | 4.0 <sub>xxxhdpi</sub>  | Android 7.0   |\n| Samsung Galaxy S8+                 | 6.2 <sub>inch</sub>  | 1440 x 2960 <sub>px</sub> |                          | 529 <sub>ppi</sub> | 132 <sub>ppi</sub> | 4.0 <sub>xxxhdpi</sub>  | Android 7.0   |\n| Samsung Galaxy S9                  | 5.8 <sub>inch</sub>  | 1440 x 2960 <sub>px</sub> | 360 x 740 <sub>px</sub>  | 570 <sub>ppi</sub> | 142 <sub>ppi</sub> | 4.0 <sub>xxxhdpi</sub>  | Android 8.0   |\n| Samsung Galaxy S9+                 | 6.2 <sub>inch</sub>  | 1440 x 2960 <sub>px</sub> |                          | 529 <sub>ppi</sub> | 151 <sub>ppi</sub> | 4 <sub>xxxhdpi</sub>    | Android 8.0   |\n| Samsung Galaxy Z Flip (2020)       | 6.7 <sub>inch</sub>  | 1080 x 2636 <sub>px</sub> | 412 x 1004 <sub>px</sub> | 425 <sub>ppi</sub> | 162 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 10.0  |\n| Samsung Galaxy Z Fold2 (2020)      | 7.6 <sub>inch</sub>  | 1768 x 2208 <sub>px</sub> | 884 x 1104 <sub>px</sub> | 373 <sub>ppi</sub> | 187 <sub>ppi</sub> | 2 <sub>xhdpi</sub>      | Android 10.0  |\n| Samsung Note10 (2019)              | 6.3 <sub>inch</sub>  | 1080 x 2280 <sub>px</sub> | 412 x 869 <sub>px</sub>  | 401 <sub>ppi</sub> | 153 <sub>ppi</sub> | 2.625 <sub>xxhdpi</sub> | Android 9.0   |\n| Samsung Note10+ (2019)             | 6.8 <sub>inch</sub>  | 1440 x 3040 <sub>px</sub> | 412 x 869 <sub>px</sub>  | 498 <sub>ppi</sub> | 142 <sub>ppi</sub> | 3.5 <sub>xxxhdpi</sub>  | Android 9.0   |\n| Samsung S6                         | 5.1 <sub>inch</sub>  | 1440 x 2560 <sub>px</sub> | 360 x 640 <sub>px</sub>  | 577 <sub>ppi</sub> | 144 <sub>ppi</sub> | 4.0 <sub>xxxhdpi</sub>  | Android 5.0.2 |\n| Samsung S6 edge                    | 5.1 <sub>inch</sub>  | 1440 x 2560 <sub>px</sub> | 360 x 640 <sub>px</sub>  | 577 <sub>ppi</sub> | 144 <sub>ppi</sub> | 4.0 <sub>xxxhdpi</sub>  | Android 5.0.2 |\n| Samsung S7                         | 5.1 <sub>inch</sub>  | 1440 x 2560 <sub>px</sub> | 360 x 640 <sub>px</sub>  | 577 <sub>ppi</sub> | 144 <sub>ppi</sub> | 4.0 <sub>xxxhdpi</sub>  | Android 6.0   |\n| Samsung S7 edge                    | 5.5 <sub>inch</sub>  | 1440 x 2560 <sub>px</sub> | 360 x 640 <sub>px</sub>  | 534 <sub>ppi</sub> | 153 <sub>ppi</sub> | 4.0 <sub>xxxhdpi</sub>  | Android 6.0   |\n| Sony Xperia X                      | 5 <sub>inch</sub>    | 1080 x 1920 <sub>px</sub> | 360 x 640 <sub>px</sub>  | 441 <sub>ppi</sub> | 147 <sub>ppi</sub> | 3.0 <sub>xxhdpi</sub>   | Android 6.0.1 |\n| Sony Xperia XZ                     | 5.2 <sub>inch</sub>  | 1080 x 1920 <sub>px</sub> | 360 x 640 <sub>px</sub>  | 424 <sub>ppi</sub> | 141 <sub>ppi</sub> | 3.0 <sub>xxhdpi</sub>   | Android 6.0.1 |\n| Xiaomi Redmi Note 7 (2019)         | 6.3 <sub>inch</sub>  | 1080 x 2340 <sub>px</sub> | 393 x 851 <sub>px</sub>  | 409 <sub>ppi</sub> | 149 <sub>ppi</sub> | 2.75 <sub>xxhdpi</sub>  | Android 9.0   |\n| Xiaomi Redmi Note 8 (2019)         | 6.3 <sub>inch</sub>  | 1080 x 2340 <sub>px</sub> | 393 x 851 <sub>px</sub>  | 409 <sub>ppi</sub> | 149 <sub>ppi</sub> | 2.75 <sub>xxhdpi</sub>  | Android 9.0   |\n| Xiaomi Redmi Note 8 Pro (2019)     | 6.53 <sub>inch</sub> | 1080 x 2340 <sub>px</sub> | 393 x 851 <sub>px</sub>  | 395 <sub>ppi</sub> | 144 <sub>ppi</sub> | 2.75 <sub>xxhdpi</sub>  | Android 9.0   |\n\n{.show-header}\n\n### Tablets\n\n| DEVICES                     | SCREEN SIZE          | RESOLUTION                | VIEWPORT                  | DENSITY            | DEVICE DENSITY     | RATIO                | OS            |\n| --------------------------- | -------------------- | ------------------------- | ------------------------- | ------------------ | ------------------ | -------------------- | ------------- |\n| Apple iPad 10.2\" (2019)     | 10.2 <sub>inch</sub> | 1620 x 2160 <sub>px</sub> | 810 x 1080 <sub>px</sub>  | 264 <sub>ppi</sub> | 132 <sub>ppi</sub> | 2 <sub>xhdpi</sub>   | iPadOS 13.1.2 |\n| Apple iPad 10.2\" (2020)     | 10.2 <sub>inch</sub> | 1620 x 2160 <sub>px</sub> | 810 x 1080 <sub>px</sub>  | 264 <sub>ppi</sub> | 132 <sub>ppi</sub> | 2 <sub>xhdpi</sub>   | iPadOS 14     |\n| Apple iPad Air              | 9.7 <sub>inch</sub>  | 1536 x 2048 <sub>px</sub> | 768 x 1024 <sub>px</sub>  | 264 <sub>ppi</sub> | 132 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | iOS 7         |\n| Apple iPad Air 10.5\" (2019) | 10.5 <sub>inch</sub> | 1668 x 2224 <sub>px</sub> | 834 x 1112 <sub>px</sub>  | 264 <sub>ppi</sub> | 132 <sub>ppi</sub> | 2 <sub>xhdpi</sub>   | iPadOS 13.1.2 |\n| Apple iPad Air 10.9\" (2020) | 10.9 <sub>inch</sub> | 1640 x 2360 <sub>px</sub> | 820 x 1180 <sub>px</sub>  | 264 <sub>ppi</sub> | 132 <sub>ppi</sub> | 2 <sub>xhdpi</sub>   | iPadOS 14     |\n| Apple iPad Air 2            | 9.7 <sub>inch</sub>  | 1536 x 2048 <sub>px</sub> | 768 x 1024 <sub>px</sub>  | 264 <sub>ppi</sub> | 132 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | iOS 8.1       |\n| Apple iPad Mini 7.9\" (2019) | 7.9 <sub>inch</sub>  | 1536 x 2048 <sub>px</sub> | 768 x 1024 <sub>px</sub>  | 324 <sub>ppi</sub> | 162 <sub>ppi</sub> | 2 <sub>xhdpi</sub>   | iPadOS 13.1.2 |\n| Apple iPad Pro              | 12.9 <sub>inch</sub> | 2048 x 2732 <sub>px</sub> | 1024 x 1366 <sub>px</sub> | 264 <sub>ppi</sub> | 132 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | iOS 9         |\n| Apple iPad Pro 10.5 (2017)  | 10.5 <sub>inch</sub> | 1668 x 2224 <sub>px</sub> | 834 x 1112 <sub>px</sub>  | 264 <sub>ppi</sub> | 132 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | iOS 11        |\n| Apple iPad Pro 11\" (2018)   | 11 <sub>inch</sub>   | 1668 x 2388 <sub>px</sub> | 834 x 1194 <sub>px</sub>  | 264 <sub>ppi</sub> | 132 <sub>ppi</sub> | 2 <sub>xhdpi</sub>   | iPadOS 13.1.2 |\n| Apple iPad Pro 11\" (2020)   | 11 <sub>inch</sub>   | 1668 x 2388 <sub>px</sub> | 834 x 1194 <sub>px</sub>  | 264 <sub>ppi</sub> | 132 <sub>ppi</sub> | 2 <sub>xhdpi</sub>   | iPadOS 13.4   |\n| Apple iPad Pro 12.9\" (2018) | 12.9 <sub>inch</sub> | 2048 x 2732 <sub>px</sub> | 1024 x 1366 <sub>px</sub> | 264 <sub>ppi</sub> | 132 <sub>ppi</sub> | 2 <sub>xhdpi</sub>   | iPadOS 13.1.2 |\n| Apple iPad Pro 12.9\" (2020) | 12.9 <sub>inch</sub> | 2048 x 2732 <sub>px</sub> | 1024 x 1366 <sub>px</sub> | 264 <sub>ppi</sub> | 132 <sub>ppi</sub> | 2 <sub>xhdpi</sub>   | iPadOS 13.4   |\n| Apple iPad Pro 9.7          | 9.7 <sub>inch</sub>  | 1536 x 2048 <sub>px</sub> | 768 x 1024 <sub>px</sub>  | 264 <sub>ppi</sub> | 132 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | iOS 9.3.2     |\n| Apple iPad Pro 9.7 (2017)   | 9.7 <sub>inch</sub>  | 1536 x 2048 <sub>px</sub> | 768 x 1024 <sub>px</sub>  | 264 <sub>ppi</sub> | 132 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | iOS 10.3      |\n| Apple iPad mini 3           | 7.9 <sub>inch</sub>  | 1536 x 2048 <sub>px</sub> | 768 x 1024 <sub>px</sub>  | 324 <sub>ppi</sub> | 132 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | iOS 9         |\n| Apple iPad mini 4           | 7.9 <sub>inch</sub>  | 1536 x 2048 <sub>px</sub> | 768 x 1024 <sub>px</sub>  | 324 <sub>ppi</sub> | 162 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | iOS 8.1       |\n| Google Pixel C (2015)       | 10.2 <sub>inch</sub> | 2560x1800 <sub>px</sub>   | 1280 x 900 <sub>px</sub>  | 308 <sub>ppi</sub> | 154 <sub>ppi</sub> | 2 <sub>xhdpi</sub>   | Android 6.0.1 |\n\n{.show-header}\n\n### Laptops\n\n| DEVICES              | SCREEN SIZE          | RESOLUTION                | VIEWPORT                 | DENSITY            | DEVICE DENSITY     | RATIO                | OS              |\n| -------------------- | -------------------- | ------------------------- | ------------------------ | ------------------ | ------------------ | -------------------- | --------------- |\n| MacBook 2015 12\"     | 12 <sub>inch</sub>   | 2304 x 1440 <sub>px</sub> | 1280 x 800 <sub>px</sub> | 226 <sub>ppi</sub> | 113 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | macOS Sierra    |\n| MacBook 2016 12\"     | 12 <sub>inch</sub>   | 2304 x 1440 <sub>px</sub> | 1280 x 800 <sub>px</sub> | 226 <sub>ppi</sub> | 113 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | macOS Sierra    |\n| MacBook 2017 12\"     | 12 <sub>inch</sub>   | 2304 x 1440 <sub>px</sub> | 1280 x 800 <sub>px</sub> | 226 <sub>ppi</sub> | 113 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | macOS Sierra    |\n| MacBook Air 2014 11\" | 11.6 <sub>inch</sub> | 1366 x 768 <sub>px</sub>  | 1366 x 768 <sub>px</sub> | 135 <sub>ppi</sub> | 135 <sub>ppi</sub> | 1.0 <sub>mdpi</sub>  | OS X Mavericks  |\n| MacBook Air 2014 13\" | 13.3 <sub>inch</sub> | 1440 x 900 <sub>px</sub>  | 1440 x 900 <sub>px</sub> | 128 <sub>ppi</sub> | 128 <sub>ppi</sub> | 1.0 <sub>mdpi</sub>  | OS X Mavericks  |\n| MacBook Air 2015 11\" | 11.6 <sub>inch</sub> | 1366 x 768 <sub>px</sub>  | 1366 x 768 <sub>px</sub> | 135 <sub>ppi</sub> | 135 <sub>ppi</sub> | 1.0 <sub>mdpi</sub>  | OS X El Capitan |\n| MacBook Air 2015 13\" | 13.3 <sub>inch</sub> | 1440 x 900 <sub>px</sub>  | 1440 x 900 <sub>px</sub> | 128 <sub>ppi</sub> | 128 <sub>ppi</sub> | 1.0 <sub>mdpi</sub>  | macOS Sierra    |\n| MacBook Air 2017 13\" | 13.3 <sub>inch</sub> | 1440 x 900 <sub>px</sub>  | 1440 x 900 <sub>px</sub> | 128 <sub>ppi</sub> | 128 <sub>ppi</sub> | 1.0 <sub>mdpi</sub>  | macOS Mojave    |\n| MacBook Air 2018 13\" | 13.3 <sub>inch</sub> | 2560 x 1600 <sub>px</sub> | 1280 x 800 <sub>px</sub> | 227 <sub>ppi</sub> | 113 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | macOS Mojave    |\n| MacBook Air 2020 13\" | 13.3 <sub>inch</sub> | 2560 x 1600 <sub>px</sub> | 1280 x 800 <sub>px</sub> | 227 <sub>ppi</sub> | 114 <sub>ppi</sub> | 2 <sub>xhdpi</sub>   | macOS Catalina  |\n| MacBook Pro 13\" 2018 | 13.3 <sub>inch</sub> | 2560 x 1600 <sub>px</sub> | 1280 x 800 <sub>px</sub> | 227 <sub>ppi</sub> | 113 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | macOS Mojave    |\n| MacBook Pro 15\" 2018 | 15.4 <sub>inch</sub> | 2880 x 1800 <sub>px</sub> | 1440 x 900 <sub>px</sub> | 220 <sub>ppi</sub> | 112 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | macOS Mojave    |\n| MacBook Pro 16\" 2019 | 16 <sub>inch</sub>   | 3072 x 1920 <sub>px</sub> | 1536 x 960 <sub>px</sub> | 226 <sub>ppi</sub> | 113 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | macOS Catalina  |\n| MacBook Pro 2014 13\" | 13.4 <sub>inch</sub> | 2560 x 1600 <sub>px</sub> | 1280 x 800 <sub>px</sub> | 227 <sub>ppi</sub> | 113 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | macOS Sierra    |\n| MacBook Pro 2014 15\" | 15.4 <sub>inch</sub> | 2880 x 1800 <sub>px</sub> | 1440 x 900 <sub>px</sub> | 220 <sub>ppi</sub> | 112 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | macOS Sierra    |\n| MacBook Pro 2015 13\" | 13.4 <sub>inch</sub> | 2560 x 1600 <sub>px</sub> | 1280 x 800 <sub>px</sub> | 227 <sub>ppi</sub> | 113 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | macOS Sierra    |\n| MacBook Pro 2015 15\" | 15.4 <sub>inch</sub> | 2880 x 1800 <sub>px</sub> | 1440 x 900 <sub>px</sub> | 220 <sub>ppi</sub> | 112 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | macOS Sierra    |\n| MacBook Pro 2016 13\" | 13.4 <sub>inch</sub> | 2560 x 1600 <sub>px</sub> | 1280 x 800 <sub>px</sub> | 227 <sub>ppi</sub> | 113 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | macOS Sierra    |\n| MacBook Pro 2016 15\" | 15.4 <sub>inch</sub> | 2880 x 1800 <sub>px</sub> | 1440 x 900 <sub>px</sub> | 220 <sub>ppi</sub> | 112 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | macOS Sierra    |\n| MacBook Pro 2017 13\" | 13.4 <sub>inch</sub> | 2560 x 1600 <sub>px</sub> | 1280 x 800 <sub>px</sub> | 227 <sub>ppi</sub> | 113 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | macOS Sierra    |\n| MacBook Pro 2017 15\" | 15.4 <sub>inch</sub> | 2880 x 1800 <sub>px</sub> | 1440 x 900 <sub>px</sub> | 220 <sub>ppi</sub> | 112 <sub>ppi</sub> | 2.0 <sub>xhdpi</sub> | macOS Sierra    |\n\n{.show-header}\n\n### Smart Watch\n\n| DEVICES                            | SCREEN SIZE          | RESOLUTION              | VIEWPORT                | DENSITY            | DEVICE DENSITY     | RATIO               | OS                               |\n| ---------------------------------- | -------------------- | ----------------------- | ----------------------- | ------------------ | ------------------ | ------------------- | -------------------------------- |\n| Apple Watch SE (40mm) (2020)       | 1.57 <sub>inch</sub> | 394 x 324 <sub>px</sub> | 197 x 162 <sub>px</sub> | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2 <sub>xhdpi</sub>  | watchOS 7.0                      |\n| Apple Watch SE (44mm) (2020)       | 1.78 <sub>inch</sub> | 448 x 368 <sub>px</sub> | 224 x 184 <sub>px</sub> | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2 <sub>xhdpi</sub>  | watchOS 7.0                      |\n| Apple Watch Series 3 (38mm)        | 1.5 <sub>inch</sub>  | 340 x 272 <sub>px</sub> | 170 x 136 <sub>px</sub> | 290 <sub>ppi</sub> | 145 <sub>ppi</sub> | 2 <sub>xhdpi</sub>  | watchOS 4.0                      |\n| Apple Watch Series 3 (42mm)        | 1.65 <sub>inch</sub> | 390 x 312 <sub>px</sub> | 195 x 156 <sub>px</sub> | 303 <sub>ppi</sub> | 152 <sub>ppi</sub> | 2 <sub>xhdpi</sub>  | watchOS 4.0                      |\n| Apple Watch Series 4 (40mm)        | 1.57 <sub>inch</sub> | 394 x 324 <sub>px</sub> | 197 x 162 <sub>px</sub> | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2 <sub>xhdpi</sub>  | watchOS 5.0                      |\n| Apple Watch Series 4 (44mm)        | 1.78 <sub>inch</sub> | 448 x 368 <sub>px</sub> | 224 x 184 <sub>px</sub> | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2 <sub>xhdpi</sub>  | watchOS 5.0                      |\n| Apple Watch Series 5 (40mm) (2019) | 1.57 <sub>inch</sub> | 394 x 324 <sub>px</sub> | 197 x 162 <sub>px</sub> | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2 <sub>xhdpi</sub>  | watchOS 6.0                      |\n| Apple Watch Series 5 (44mm) (2019) | 1.78 <sub>inch</sub> | 448 x 368 <sub>px</sub> | 224 x 184 <sub>px</sub> | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2 <sub>xhdpi</sub>  | watchOS 6.0                      |\n| Apple Watch Series 6 (40mm) (2020) | 1.57 <sub>inch</sub> | 394 x 324 <sub>px</sub> | 197 x 162 <sub>px</sub> | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2 <sub>xhdpi</sub>  | watchOS 7.0                      |\n| Apple Watch Series 6 (44mm) (2020) | 1.78 <sub>inch</sub> | 448 x 368 <sub>px</sub> | 224 x 184 <sub>px</sub> | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2 <sub>xhdpi</sub>  | watchOS 7.0                      |\n| Asus Zenwatch 2 (2015)             | 1.63 <sub>inch</sub> | 320 x 320 <sub>px</sub> | 213 x 213 <sub>px</sub> | 278 <sub>ppi</sub> | 185 <sub>ppi</sub> | 1.5 <sub>hdpi</sub> |                                  |\n| Asus Zenwatch 3 (2016)             | 1.39 <sub>inch</sub> | 400 x 400 <sub>px</sub> | 267 x 267 <sub>px</sub> | 287 <sub>ppi</sub> | 191 <sub>ppi</sub> | 1.5 <sub>hdpi</sub> | Android Wear OS 2.1              |\n| Asus Zenwatch 3 (2016)             | 1.39 <sub>inch</sub> | 400 x 400 <sub>px</sub> | 267 x 267 <sub>px</sub> | 287 <sub>ppi</sub> | 191 <sub>ppi</sub> | 1.5 <sub>hdpi</sub> | Android Wear OS 2.1              |\n| Huawei Watch GT (2018)             | 1.39 <sub>inch</sub> | 454 x 454 <sub>px</sub> | 227 x 227 <sub>px</sub> | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2 <sub>xhdpi</sub>  |                                  |\n| Huawei Watch Magic (2018)          | 1.2 <sub>inch</sub>  | 390 x 390 <sub>px</sub> | 195 x 195 <sub>px</sub> | 326 <sub>ppi</sub> | 163 <sub>ppi</sub> | 2 <sub>xhdpi</sub>  |                                  |\n| LG G Watch R (2015)                | 1.3 <sub>inch</sub>  | 320 x 320 <sub>px</sub> | 213 x 213 <sub>px</sub> | 245 <sub>ppi</sub> | 163 <sub>ppi</sub> | 1.5 <sub>hdpi</sub> | Android Wear OS 1.0              |\n| LG Watch Sport (2017)              | 1.38 <sub>inch</sub> | 480 x 480 <sub>px</sub> | 240 x 240 <sub>px</sub> | 348 <sub>ppi</sub> | 174 <sub>ppi</sub> | 2 <sub>xhdpi</sub>  | Android Wear 2.0                 |\n| LG Watch Urbane 2nd Edition (2016) | 1.38 <sub>inch</sub> | 480 x 480 <sub>px</sub> | 240 x 240 <sub>px</sub> | 348 <sub>ppi</sub> | 174 <sub>ppi</sub> | 2 <sub>xhdpi</sub>  | Android Wear 2.0                 |\n| LG Watch W7 (2018)                 | 1.2 <sub>inch</sub>  | 360 x 360 <sub>px</sub> | 240 x 240 <sub>px</sub> | 300 <sub>ppi</sub> | 200 <sub>ppi</sub> | 1.5 <sub>hdpi</sub> | Android Wear OS 2.0              |\n| Samsung Galaxy Watch (2018)        | 1.3 <sub>inch</sub>  | 360 x 360 <sub>px</sub> | 240 x 240 <sub>px</sub> | 278 <sub>ppi</sub> | 185 <sub>ppi</sub> | 1.5 <sub>hdpi</sub> | Tizen-based <br/>wearable OS 4.0 |\n\n{.show-header}\n"
  },
  {
    "path": "source/_posts/roam.md",
    "content": "---\ntitle: Roam Research\ndate: 2022-11-23 16:23:31.693680\nbackground: bg-[#090a0a]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 45 keyboard shortcuts found on Roam Research\n---\n\n## Keyboard Shortcuts\n\n### General\n\n| Shortcut           | Action                                           |\n| ------------------ | ------------------------------------------------ |\n| `/`                | Bring up a menu of many core functions           |\n| `Ctrl` `U`         | Search the database                              |\n| `Ctrl` `Enter`     | Jump back to page after search                   |\n| `Ctrl` `F`         | Search on the current page                       |\n| `Shift` `Enter`    | Open a new page created in search in the sidebar |\n| `Ctrl` `Shift` `D` | Jump to the Daily Notes page                     |\n| `Shift` `(click)`  | Open link in sidebar                             |\n| `Ctrl` `B`         | Toggle brackets                                  |\n\n{.shortcuts}\n\n### Lists and Blocks {.row-span-2}\n\n| Shortcut              | Action                                            |\n| --------------------- | ------------------------------------------------- |\n| `Tab`                 | Indent block                                      |\n| `Shift` `Tab`         | Un-indent block                                   |\n| `Ctrl` `Shift` `Up`   | Move block up                                     |\n| `Ctrl` `Shift` `Down` | Move block down                                   |\n| `Enter`               | Create a new block, bullet point                  |\n| `Ctrl` `Enter`        | Create a TODO checkbox                            |\n| `Shift` `Enter`       | Create a new line inside of a block               |\n| `Ctrl` `Z`            | Undo                                              |\n| `Ctrl` `Shift` `Z`    | Redo                                              |\n| `Ctrl` `.`            | Zoom in, show only the current block enlarged     |\n| `Ctrl` `,`            | Zoom out, restores the normal view                |\n| `Ctrl` `O`            | Follow link under cursor, when editing a block    |\n| `Ctrl` `Shift` `O`    | Open a link under cursor in the sidebar           |\n| `Ctrl` `Up`           | Collapse all child blocks under the current block |\n| `Ctrl` `Down`         | Expand all child blocks under the current block   |\n| `Shift` `Up`          | Select the block above where the cursor is placed |\n| `Shift` `Down`        | Select the block below where the cursor is placed |\n| `Ctrl` `Shift` `A`    | Select all blocks                                 |\n| `Ctrl` `A`            | Jump to the beginning of the current block        |\n| `Ctrl` `E`            | Jump to the end of the current block              |\n| `Ctrl` `F`            | Move one character to the right                   |\n| `Ctrl` `B`            | Move one character to the left                    |\n| `Ctrl` `T`            | Swap all characters on either side of the cursor  |\n| `Ctrl` `C` `Ctrl` `X` | Show avatar of the last user to edit the block    |\n\n{.shortcuts}\n\n### Version Control\n\n| Shortcut           | Action                                                            |\n| ------------------ | ----------------------------------------------------------------- |\n| `Ctrl` `,`         | Add a version                                                     |\n| `Ctrl` `Shift` `.` | Cycle versions to the right                                       |\n| `Ctrl` `Shift` `,` | Cycle versions to the left                                        |\n| `Ctrl` `.`         | Expand all versions, all versions will appear in their own blocks |\n\n{.shortcuts}\n\n### Formatting\n\n| Shortcut           | Action                             |\n| ------------------ | ---------------------------------- |\n| `Ctrl` `Alt` `1-3` | Toggle between heading styles      |\n| `Ctrl` `Alt` `0`   | Reset heading, or set to paragraph |\n| `Ctrl` `Enter`     | Toggle TODO or DONE                |\n| `Ctrl` `B`         | Bold                               |\n| `Ctrl` `I`         | Italic                             |\n| `Ctrl` `K`         | Create an HTML link                |\n| `Ctrl` `Y`         | Strike-through                     |\n| `Ctrl` `H`         | Highlight                          |\n| <code>\\`</code>    | Create an inline block of code     |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Roam Research](https://www.roamtips.com/home/the-complete-list-of-roam-research-keyboard-shortcuts)\n  _(www.roamtips.com)_\n"
  },
  {
    "path": "source/_posts/ruby.md",
    "content": "---\ntitle: Ruby\ndate: 2024-04-25 09:50:25\nbackground: bg-red-500\ntags:\n  - script\n  - interpret\ncategories:\n  - Programming\nintro: |\n  The [Ruby](https://www.ruby-lang.org/) cheat sheet is a one-page reference sheet for the Ruby programming language.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### Install\n\n```bash\n# Debian, Ubuntu\n$ sudo apt-get install ruby-full\n# Windows\n$ winget install RubyInstallerTeam.Ruby\n$ brew install ruby # macOS\n$ docker run -it --rm ruby:latest # Docker\n```\n\n### What is Gemfile and Gemfile.lock {.row-span-2}\n\n- [Gemfile](https://bundler.io/v2.3/man/gemfile.5.html) Is the Bundler (also gem) configuration file that contains the\n  project's gem list (dependencies)\n\n```ruby\n# Specify gem in the Gemfile in the project root directory\nruby '3.1.2'\n\nsource 'https://rubygems.org'\ngem 'nokogiri'\ngem 'rack', '~>3.0.10'\ngem 'rspec', :require => 'spec'\n```\n\nInstall all gems in Gemfile\n\n```bash\n$ bundle install\n```\n\nSolve the problem of Gemfile.lock inconsistency between mac for development and linux for production\n\n```bash\nbundle lock --add-platform x86_64-linux\n```\n\n### Install a specific version of a specific ruby gem\n\n```bash\n$ gem install bundler -v 2.4.20\n$ gem install minitest -v 5.22.3\n```\n\n### Update gems using Bundler\n\n```bash\n# Updating a single gem using Bundler\n$ bundle update nokogiri\n# Use Bundler to update each gem in the Gemfile\n$ bundle update\n```\n\n### Comment {.row-span-1}\n\n```ruby\n# This is a single line comments.\n=begin\nMulti-line\nComment\n=end\nputs \"Hello world!\"  # Inline comments for code\n```\n\n### reserved words {.col-span-1}\n\n| Reserved words | Description                                                                                                |\n| :------------- | :--------------------------------------------------------------------------------------------------------- |\n| `__ENCODING__` | The script encoding of the current file                                                                    |\n| `__LINE__`     | The line number of this keyword in the current file                                                        |\n| `__FILE__`     | The path of the current file                                                                               |\n| `BEGIN`        | Code enclosed in { } is run before the program is run                                                      |\n| `END`          | Code enclosed in { } is run at the end of the program                                                      |\n| `alias`        | Create an alias for an existing method, operator, or global variable                                       |\n| `and`          | Logical AND operator                                                                                       |\n| `begin`        | Begin a block of code                                                                                      |\n| `break`        | Terminate a loop                                                                                           |\n| `case`         | Compare an expression with matching `when` clauses, terminated with <br/> `end`                            |\n| `class`        | Define a class                                                                                             |\n| `def`          | define a function/method                                                                                   |\n| `defined?`     | Check if a variable or function exist                                                                      |\n| `do`           | Start a block of code, terminated with the <br/> `end` keyword                                             |\n| `else`         | Execute the following code if previous conditions are not met                                              |\n| `elsif`        | Alternative condition for if expressions                                                                   |\n| `end`          | End blocks of code starting with keywords like `begin`, `class`,`def`,`do`,`if`, etc.                      |\n| `ensure`       | Always execute at the end of a block                                                                       |\n| `false`        | Logical boolean value false                                                                                |\n| `for`          | Start a `for` loop                                                                                         |\n| `if`           | Execute the code block `if` the condition is `true`                                                        |\n| `in`           | Used with `for` loop                                                                                       |\n| `module`       | Define a module                                                                                            |\n| `next`         | jump to the point before the evaluation of the loop condition                                              |\n| `nil`          | Stand for null, invalid, or always false                                                                   |\n| `not`          | Logical NOT operator                                                                                       |\n| `or`           | Logical OR operator                                                                                        |\n| `redo`         | Jump back to the loop condition evaluation                                                                 |\n| `rescue`       | Evaluate expressions after an exception is raised                                                          |\n| `retry`        | Repeat method calls when called outside `rescue`, jump to the top of the block when called inside `rescue` |\n| `return`       | Return a value from a method or block                                                                      |\n| `self`         | Refer to the current object                                                                                |\n| `super`        | Call the same-named method in the superclass                                                               |\n| `then`         | Used as a separator with`if`,`unless`,`when`,`case`,`rescue`                                               |\n| `true`         | Logical boolean value true                                                                                 |\n| `undef`        | Undefine methods/functions within the current class                                                        |\n| `until`        | Execute the code block until the condition is false                                                        |\n| `when`         | Begin a clause under a `case` statement                                                                    |\n| `while`        | Execute the code block while the condition is true                                                         |\n| `yield`        | Execute the code block passed to a method                                                                  |\n\n### Operator {.row-span-7}\n\n#### Logical Operators\n\n- `and`\n- `or`\n- `not`\n- `&&`\n- `||`\n- `!`\n\n#### Bit operators\n\n- `&`\n- `|`\n- `^`\n- `~`\n- `<<`\n- `>>`\n\n#### Arithmetic operators\n\n- `+`\n- `-`\n- `*`\n- `/`\n- `%`\n- `**`\n\n#### Comparison operator\n\n- `==`\n- `!=`\n- `>`\n- `<`\n- `>=`\n- `<=`\n- `<=>`\n- `===`\n- `eql?`\n- `equal?`\n\n#### Operator examples\n\n```bash\n# Addition\n1 + 1   #=> 2\n# Subtraction\n2 - 1   #=> 1\n# Multiplication\n2 * 2   #=> 4\n# Division\n10 / 5  #=> 2\n17 / 5    #=> 3, not 3.4\n17 / 5.0  #=> 3.4\n# Exponentiation\n2 ** 2  #=> 4\n3 ** 4  #=> 81\n# Modulus (remainder of division)\n8 % 2   #=> 0  (8 / 2 = 4; no remainder)\n10 % 4  #=> 2  (10 / 4 = 2 remainder 2)\na = 10\nb = 20\na == b #=> false\na != b #=> true\na > b #=> false\na < b #=> true\na >= b #=> false\na <= b #=> true\n\n# Comparison operators\na <=> b #=> -1\nc = 20\nc <=> b #=> 0\nc <=> a  #=> 1\n# Equality used in when clauses for case statements\n(1...10) === 5 #=> true\n# True if the receiver and the argument have the same type and equal values\n1.eql?(1.0) #=> false\nc = a + b  #=> 30\nc += a #=> 40\nc -= a #=> 30\nc *= a #=> 300\nc /= a #=> 30\nc %= a #=> 3\nc **= a #=> 59049\n\n# Ruby parallel assignment\na = 10\nb = 20\nc = 30\na, b, c = 10, 20, 30\n# Ruby bitwise operators\na = 60\nb = 13\n# & Binary AND operator copies a bit to the result if it exists in both operands.\na & b #=> 12\n# | Binary OR operator copies a bit if it exists in either operand.\na | b #=> 61\n# ^ Binary XOR operator copies a bit if it is set in one operand but not both.\na ^ b #=> 49\n# ~ Binary Ones Complement is unary and has the effect of 'flipping' bits.\n~a\n# << Binary Left Shift Operator. The left operand's value is moved\n# left by the number of bits specified by the right operand.\na << 2\n# >> Binary Right Shift Operator. The left operand's value is moved\n# right by the number of bits specified by the right operand.\na >> 2\n\n# Ruby logical operators\na and b #=> true.\na or b #=> true.\na && b #=> true.\n(a || b) #=> true.\n!(a && b) #=> false.\nnot(a && b) #=> false.\n# Ruby ternary operator\n# ? :\n# If condition is true ? Then value X : Otherwise value Y\na == 10 ? puts 'Right' : puts 'Wrong'\n# Ruby range operators\n# .. Creates a range from the start point to the end point (inclusive)\n1..10 #=> Creates a range from 1 to 10 (inclusive of 1 and 10)\n# ... Creates an exclusive range from the start point to the end point\n1...10 #=> Creates an exclusive range from 1 to 10\n```\n\n### Operator precedence table\n\nFrom highest to lowest, this is the precedence table for ruby. High precedence operations happen before low precedence\noperations.\n\n- !, ~, unary +\n- \\*\\*\n- unary -\n- \\*, /, %\n- +, -\n- <<, >>\n- &\n- |, ^\n- > , >=, <, <=\n- <=>, ==, ===, !=, =~, !~\n- &&\n- ||\n- .., ...\n- ?, :\n- modifier-rescue\n- =, +=, -=, etc.\n- defined?\n- not\n- or, and\n- modifier-if, modifier-unless, modifier-while, modifier-until\n- { } blocks\n\n### Variables and scope {.col-span-2}\n\n| -              | -                 | -                             | -                                                                                                |\n| -------------- | ----------------- | ----------------------------- | :----------------------------------------------------------------------------------------------- |\n| Name           | Scope             | Example                       | Explanation                                                                                      |\n| `[a-z]` or `_` | Local             | `count = 10` or `_count = 10` | Local variables must be initialized                                                              |\n| `@`            | Instance variable | `@id = []`                    | Instance variables have a \"nil\" value before initialization                                      |\n| `@@`           | Class variable    | `@@name = []`                 | Class variables must be initialized                                                              |\n| `$`            | Global variable   | `$version = \"0.8.9\"`          | Global variables have a \"nil\" value before initialization                                        |\n| `[A-Z]`        | Constant          | `PI = 3.14`                   | Constant variables must be initialized, you can change constants, but you will receive a warning |\n\nThere are five different types of variables. The first character determines the range To read in deap about variables\ncheck [User Guide](https://ruby-doc.org/docs/ruby-doc-bundle/UsersGuide/rg/) cap 19,20,21,22,23\n[Pre-Defined Variables and Constants](https://ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/variable.html)\n\n### Check the scope of a variable\n\n```ruby\ndefined? count\n\"local-variable\"\ndefined? @id\n\"instance-variable\"\ndefined? @@name\n\"class variable\"\ndefined? $version\n\"global-variable\"\ndefined? PI\n\"constant\"\n```\n\n### Data Types {.col-span-2}\n\n| -         | -                            | -                                                  | -                                                                                                               |\n| :-------- | :--------------------------- | :------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------- |\n| Type      | Example                      | Class                                              | Documentation                                                                                                   |\n| `Integer` | a = 17                       | a.class > Integer <br>a.class.superclass > Numeric | [#](<(https://ruby-doc.org/3.3.1/Integer.html)>)                                                                |\n| `Float`   | a = 87.23                    | a.class > Float <br>a.class.superclass > Numeric   | [#](https://ruby-doc.org/3.3.1/Float.html)                                                                      |\n| `String`  | a = \"Hello universe\"         | a.class > String                                   | [#](https://ruby-doc.org/3.3.1/String.html)                                                                     |\n| `Array`   | a = [12, 34]                 | a.class > Array                                    | [#](https://ruby-doc.org/3.3.1/Array.html)                                                                      |\n| `Hash`    | a = {type: \"tea\", count: 10} | a.class > Hash                                     | [#](https://ruby-doc.org/3.3.1/Hash.html)                                                                       |\n| `Boolean` | a = false<br>a = true        | a.class > FalseClass <br>a.class > TrueClass       | [TrueClass](https://ruby-doc.org/3.3.1/TrueClass.html) [FalseClass](https://ruby-doc.org/3.3.1/FalseClass.html) |\n| `Symbol`  | a = :status                  | a.class > Symbol                                   | [#](https://ruby-doc.org/3.3.1/Symbol.html)                                                                     |\n| `Range`   | a = 1..3                     | a.class > Range                                    | [#](https://ruby-doc.org/3.3.1/Range.html)                                                                      |\n| `Nil`     | a = nil                      | a.class > NilClass                                 | [#](https://ruby-doc.org/3.3.1/NilClass.html)                                                                   |\n\n[further reading](https://www.digitalocean.com/community/tutorials/understanding-data-types-in-ruby)\n\n### Check data type\n\n```ruby\n# Both are synonyms\na = 37\na.kind_of? Integer\n# true\na.is_a? Integer\n# true\n```\n\n### Symbol\n\n```ruby\nweek_days = {sunday: 11, monday: 222}\n```\n\n### Integer useful methods\n\n```ruby\n2.even?\n# true\n3.even?\n# false\n```\n\n### Range\n\n`..` Used to create inclusive ranges\n\n```ruby\nrange = 1..10\nrange.to_a\n# output => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n```\n\n`...` Used to create exclusive ranges\n\n```ruby\nrange = 1...10\nrange.to_a\n# output => [1, 2, 3, 4, 5, 6, 7, 8, 9]\n```\n\nsome useful methods\n\n| Method name | Output                                |\n| :---------- | :------------------------------------ |\n| `cover?`    | `(1..5).cover?(5)` => `true`          |\n| `end`       | `('a'..'z').end` => `\"z\"`             |\n| `first`     | `(1..5).first` => `1`                 |\n| `first(3)`  | `('A'..'Z').first(2)` => `[\"A\", \"B\"]` |\n| `eql?`      | `((0..2).eql?(0..5)` => `false`       |\n\n### Using `step` in Range\n\n```ruby\n(1..20).step(2) { |number| puts \"#{number}\"}\n# output\n# 1\n# 3\n# 5\n# 7\n# 9\n# 11\n# 13\n# 15\n# 17\n# 19\n```\n\n## Ruby Flow control\n\n### if\n\n```ruby\nnum = 2\nputs 'two' if num == 2\n```\n\nIf the condition is true, execute the code\n\n### if elsif else\n\n```ruby\ntemp = 19\nif temp >= 25\n  puts \"hot\"\nelsif temp < 25 && temp >= 18\n  puts \"normal\"\nelse\n  puts \"cold\"\nend\n# output => normal\n```\n\n### unless\n\n```ruby\n# Unless contrary to if , evaluates when the statement is false\nname = \"rob\"\n# if name != \"bob\"\nunless name == \"bob\"\n  puts \"hello stranger\"\nelse\n  puts \"hello bob\"\nend\n# output => hello stranger\nnum = 6\nputs 'not two' unless num == 2\n# output => not two\n```\n\n### case {.row-span-2}\n\n```ruby\n# case returns the value of the last expression executed\ncase input\n# Check for an integer, 19\nwhen 19\n  puts \"It's 19\"\n  # Check for an exact string，“Zaman”\nwhen \"Zaman\"\n  puts \"Hi Zaman\"\nwhen 7..11\n  puts \"It's between 7 and 11\"\n  # Check multiple values, \"coffee\"\nwhen \"tea\", \"coffee\"\n  puts \"Happy days\"\nend\n```\n\n### case( short syntax )\n\n```ruby\ncase input\n  when 19 then puts \"It's 19\"\nend\n```\n\n### case( Optional failure )\n\n```ruby\ncase input\n  when 19 then puts \"It's 19\"\nelse\n  puts \"It's not 19\"\nend\n```\n\n### case( Get return value )\n\n```ruby\nmarks = 86\nresult = case marks\n        when 0..49 then \"Fail\"\n        when 50..64 then \"Pass\"\n        when 65..74 then \"Credit\"\n        when 75..84 then \"Distinction\"\n        when 85..100 then \"High Distinction\"\n        else \"Invalid marks\"\n        end\n\nputs result\n# High Distinction\n```\n\n## String\n\n### String interpolation\n\n```ruby\nname = \"World\"\nputs \"Hello #{name}\"\nputs \"The total is #{1+1}\"\n# \"the total is 2\"\n```\n\nString interpolation allows you to combine strings together\n\n### Extract substring\n\n```ruby\nstring = \"abc123\"\nstring[0,3]\n# \"abc\"\nstring[3,3]\n# \"123\"\nstring[0..-2]\n# \"abc12\"\n#remove or replace the substring\nstring[0..2] = \"\"\nputs string\n# \"123\"\n```\n\nA substring is a small part of a string, which is useful if you only want that specific part, like the beginning,\nmiddle, or end\n\n### Convert a string to lowercase or uppercase\n\n```ruby\n\"HELLO World\".downcase  # \"hello world\"\n\"hello worlD\".upcase    # \"HELLO WORLD\"\n\"hEllo wOrlD\".capitalize # \"Hello world\"\n\"hEllo WOrlD\".swapcase  # \"HeLLO woRLd\"\n```\n\n### useful methods {.col-span-3}\n\n| Function Name                  | Output                                                                                                | Note                                                                                                                                                                                |\n| :----------------------------- | :---------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| length or size                 | `\"HELLO World\".length` => `11` <br> `\"HELLO World\".size` => `11`                                      | Returns the length of the string                                                                                                                                                    |\n| reverse                        | `\"hello worlD\".reverse` => `\"Dlrow olleh\"`                                                            | Returns the reversed string                                                                                                                                                         |\n| include? other_str             | `\"hEllo wOrlD\".include? \"w\"` => `true`                                                                | Returns true if the string or character exists, otherwise returns false                                                                                                             |\n| gsub(pattern, replacement)     | `\"hEllo wOrlD\".gsub(\" \", \"_\")` => `\"hEllo_wOrlD\"`                                                     | gsub or global substitute replaces one or more strings with the provided string                                                                                                     |\n| gsub(pattern, hash)            | `\"organization\".gsub(\"z\", 'z' => 's')` => `\"organisation\"`                                            | gsub or global substitute replaces one or more strings with the provided hash                                                                                                       |\n| gsub(pattern) {\\|match\\|block} | `\"Price of the phone is 1000 AUD\".gsub(/\\d+/) {\\| s\\| '$'+s }`<br>`\"Price of the phone is $1000 AUD\"` | gsub or global substitute replaces one or more strings with the provided block                                                                                                      |\n| strip                          | `\" hEllo WOrlD \".strip` <br> `\"hEllo WOrlD\"`                                                          | It will remove (trim) any leading and trailing characters: null (“\\x00”), horizontal tab (“\\t”), newline (\\n), vertical tab (“\\v”), form feed (f), carriage return(\\r), space (\" \") |\n| prepend                        | `a = \"world\" <br> a.prepend(\"hello \")` <br> `\"hello world\"`                                           | Adds the string before another string                                                                                                                                               |\n| insert                         | `a = \"hello\" <br> a.insert(a.length, \" world\")` <br> `\"hello world\"`                                  | Inserts the string at a specific position                                                                                                                                           |\n| start_with?                    | `string = \"ruby programming\"` <br> `string.start_with? \"ruby\"` <br> `true`                            | Checks if the string starts with a specific prefix                                                                                                                                  |\n| end_with?                      | `string = \"ruby programming\"` <br> `string.end_with? \"ruby\"` <br> `false`                             | Checks if the string ends with a specific prefix                                                                                                                                    |\n| delete_suffix                  | `string = \"sausage is expensive\"` <br> `string.delete_suffix(\" is expensive\")` <br> `\"sausage\"`       | Deletes the suffix from the string                                                                                                                                                  |\n| delete_prefix                  | `string = \"sausage is expensive\"` <br> `string.delete_prefix(\"sausage\")` <br> `\" is expensive\"`       | Deletes the prefix from the string                                                                                                                                                  |\n| split                          | `string = \"a b c d\" <br> string.split` <br> `[\"a\", \"b\", \"c\", \"d\"]`                                    | Converts the string into an array of characters                                                                                                                                     |\n| join                           | `arr = ['a', 'b', 'c'] <br> arr.join` => `\"abc\"`                                                      | Converts an array into a string                                                                                                                                                     |\n| to_i                           | `a = \"49\" <br> a.to_i` => `49`                                                                        | Converts the string into an integer                                                                                                                                                 |\n| chop                           | `\"abcd?\".chop(\"?\")` => `\"abcd\"`                                                                       | Deletes the last character from the string                                                                                                                                          |\n| count                          | `str = \"aaab\" <br> str.count(\"a\")` <br> `3`                                                           | Counts the characters in the string                                                                                                                                                 |\n| to_f                           | `a = \"49\"` <br> `a.to_f` <br> `49.0`                                                                  | Converts the string into a floating point number                                                                                                                                    |\n| to_sym                         | `a = \"key\"` <br> `a.to_sym` <br> `:key`                                                               | Converts the string into a symbol                                                                                                                                                   |\n| match                          | `\"abcd?\".match(/ab/)` => `#<MatchData \"ab\">`                                                          | Converts the pattern into a regular expression and calls its match method on the string                                                                                             |\n| empty?                         | `\"hello\".empty?` => `false`                                                                           | Returns true if the length of the string is zero                                                                                                                                    |\n| squeeze                        | `\"Booook\".squeeze` => `\"Bok\"`                                                                         | Returns a copy of the string where runs of the same character are replaced by a single character                                                                                    |\n| \\*                             | `puts \"Ruby \" * 4` => `Ruby Ruby Ruby Ruby`                                                           | Returns the concatenation of multiple copies of self                                                                                                                                |\n| +                              | `\"sammy \" + \"shark\"` => `\"sammyshark\"`                                                                | Returns the concatenation of self and the given other string                                                                                                                        |\n| eql?                           | `s = 'foo'` => `true` <br> `s.eql?('foo')` => `true`                                                  | Returns true if the objects have the same length and content; false otherwise                                                                                                       |\n\n## Methods\n\n### Declare a method {.row-span-3}\n\n```ruby\ndef method_name(parameter1, parameter2)\n    puts \"#{parameter1} #{parameter2}\"\n    parameter1 + parameter2\nend\n```\n\n---\n\n```ruby\nres = method_name(20, 10)\n# output => 30\ndef method_name(parameter1, parameter2)\n    puts \"#{parameter1} #{parameter2}\"\n    return parameter1 + parameter2\nend\n# output => 30\n```\n\n### Call method\n\n```ruby\nres = method_name(parameter1, parameter2)\n# Methods can be called without parentheses\nres = method_name parameter1, parameter2\n```\n\n### Class method {.row-span-4}\n\nClass methods are class-level methods. There are multiple ways to define class methods\n\n```ruby\nclass Mobile\n    def self.ring\n        \"ring ring ring...\"\n    end\nend\n\nMobile.ring\n```\n\n---\n\n```ruby\nclass Mobile\n    def Mobile.ring\n        \"ring ring ring...\"\n    end\nend\nMobile.ring\n```\n\n---\n\n```ruby\nclass Mobile\n    class << self\n    def ring\n        \"ring ring ring...\"\n       end\n    end\nend\nMobile.ring\n```\n\nClass methods are instance methods of class objects. When a new class is created, an object of type \"Class\" is\ninitialized and assigned to a global constant (in this case Mobile)\n\n```ruby\nMobile = Class.new do\n    def self.ring\n        \"ring ring ring...\"\n    end\nend\nMobile.ring\n```\n\n```ruby\nMobile = Class.new\nclass << Mobile\n    def ring\n        \"ring ring ring...\"\n    end\nend\nMobile.ring\n```\n\n### Use another parameter as default value\n\n```ruby\ndef method_name(num1, num2 = num1)\n    return num1 + num2\nend\nres = method_name(10)\n# output => 20\n```\n\n### Define default values for method parameters\n\n```ruby\ndef method_name(parameter1, parameter2, type = \"ADD\")\n    puts \"#{parameter1} #{parameter2}\"\n    return parameter1 + parameter2 if type == \"ADD\"\n    return parameter1 - parameter2 if type == \"SUB\"\nend\nres = method_name(20, 10)\n# output => 30\n```\n\n### Pass variable length arguments to method parameters\n\n```ruby\ndef method_name(type, *values)\n    return values.reduce(:+) if type == \"ADD\"\n    return values.reduce(:-) if type == \"SUB\"\nend\nnumbers = [2, 2, 2, 3, 3, 3]\nres = method_name(\"ADD\", *numbers)\n# output => 15\nres = method_name(\"SUB\", *numbers)\n# output => -11\n# Or you can provide a value like this\nres = method_name(\"ADD\", 2, 2, 2, 3, 3, 3)\n# output => 15\n```\n\n### Modify object\n\n```ruby\na = [\"Drama\", \"Mystery\", \"Crime\",\n\"Sci-fi\", \"Disaster\", \"Thriller\"]\na.sort\nputs a\n# We did not modify the object\n# Drama\n# Mystery\n# Crime\n# Sci-fi\n# Disaster\n# Thriller\na.sort!\nputs a\n# Modify object\n# Crime\n# Disaster\n# Drama\n# Mystery\n# Sci-fi\n# Thriller\n```\n\nWhen you want to modify the object, use `!` after the method\n\n### Boolean method\n\nIn ruby, methods ending with a question mark (?) are called boolean methods, which return `true` or `false`\n\n```ruby\n\"some text\".nil?\n# false\nnil.nil?\n# true\n```\n\nYou can have your own boolean method\n\n```ruby\ndef is_vowel?(char)\n    ['a','e','i','o','u'].include? char\nend\nis_vowel? 'a'\n# true\nis_vowel? 'b'\n# false\n```\n\n## Blocks\n\n### Block example\n\n```ruby\n# return value\ndef give_me_data\n    data = yield\n    puts \"data = #{data}\"\nend\ngive_me_data { \"Big data\" }\n# output => data = Big data\n```\n\nThe code between `do` and `end` (for multiple lines) or curly braces `{` and `}` (for a single line) is called a block,\nand they can define multiple parameters between two pipes `( |arg1, arg2|)`\n\n### Single line block\n\n```ruby\nsalary = [399, 234, 566, 533, 233]\nsalary.each { |s| puts s }\n# puts s = block body\n# |s| = block arguments\n```\n\n### Multi-line block\n\n```ruby\nsalary.each do |s|\n    a = 10\n    res = a * s\n    puts res\nend\n# Block\n# a = 10\n# res = a * s\n# puts res\n# block parameters\n# |s|\n```\n\nBlocks can be passed as method parameters or associated with method calls. block returns the last evaluated statement\n\n### Implicitly passing a block\n\n```ruby\ndef give_me_data\n    puts \"I am inside give_me_data method\"\n    yield\n    puts \"I am back in give_me_data method\"\nend\n\ngive_me_data { puts \"Big data\" }\n\n# output\n# I am inside give_me_data method\n# Big data\n# I am back in give_me_data method\n```\n\n### Called multiple times\n\n```ruby\ndef give_me_data\n    yield\n    yield\n    yield\nend\n\ngive_me_data { puts \"Big data\" }\n\n# output\n# Big data\n# Big data\n# Big data\n```\n\n### Called with block parameters\n\n```ruby\ndef give_me_data\n    yield 10\n    yield 100\n    yield 30\nend\n\ngive_me_data { |data| puts \"Big data #{data} TB\" }\n\n# output\n# Big data 10 TB\n# Big data 100 TB\n# Big data 30 TB\n```\n\n### Called with multiple block parameters\n\n```ruby\ndef give_me_data\n    yield \"Big data\", 10, \"TB\"\n    yield \"Big data\", 100, \"GB\"\n    yield \"Big data\", 30, \"MB\"\nend\n\ngive_me_data { |text, data, unit| puts \"#{text} #{data} #{unit}\" }\n\n# output\n# Big data 10 TB\n# Big data 100 GB\n# Big data 30 MB\n```\n\n### Block will attempt to return from the current context\n\n```ruby\ngive_me_data\n    puts \"I'm inside the give_me_data method\"\nend\n\ndef test\n  puts \"I'm inside the test method\"\n  give_me_data { return 10 } # Code returns from here\n  puts \"I am back in test method\"\nend\n\nreturn_value = test\n\n# output\n# I'm inside the test method\n# I'm inside the give_me_data method\n# 10\n```\n\n### Pass the block explicitly by using the & parameter\n\n```ruby\ndef give_me_data(&block)\n    block.call\n    block.call\nend\n\ngive_me_data { puts \"Big data\" }\n\n# output\n# Big data\n# Big data\n```\n\n### Check if block is given\n\n```ruby\ndef give_me_data\n    yield\nend\n\ngive_me_data\n\n# output\n# LocalJumpError: no block given (yield)\n```\n\n### Ways to handle exceptions and make blocks optional\n\n```ruby\ndef give_me_data\n    return \"no block\" unless block_given?\n    yield\nend\n\ngive_me_data { puts \"Big data\" }\ngive_me_data\n\n# output\n# Big data\n```\n\n## Procs\n\n### Procs\n\n```ruby\np = Proc.new { puts \"Hello World\" }\n\ndef give_me_data(proc)\n    proc.call\nend\n\ngive_me_data p\n\n# output\n# Hello World\n```\n\nproc is like a block that can be stored in a variable\n\n### any parameter {.col-span-2}\n\n```ruby\np = Proc.new { |count| \"Hello World \" * count }\n\ndef give_me_data(proc)\n    proc.call 5, 2\nend\n\ngive_me_data p\n\n# output\n# \"Hello World Hello World Hello World Hello World Hello World \"\n```\n\n### proc will attempt to return from the current context\n\n```ruby\np = Proc.new { return 10 }\np.call\n# output\nLocalJumpError: unexpected return\n```\n\n### Cannot return from top-level context\n\n```ruby\ndef give_me_data\n    puts \"I'm inside the give_me_data method\"\n    p = Proc.new { return 10 }\n    p.call # Code returns from here\n    puts \"I am back in give_me_data method\"\nend\n\nreturn_value = give_me_data\nputs return_value\n\n# output\n# I'm inside the give_me_data method\n# 10\n```\n\n## Lambdas\n\n### Declare a lambda{.row-span-2}\n\n```ruby\nl = lambda { puts \"Hello World\" }\n# shorthand\nl = -> { puts \"Hello World\" }\n# transfer lambda\nl.call\n# output => Hello World\n```\n\nThere are multiple ways to call a lambda\n\n```ruby\nl.()\nl[]\n```\n\n### strict arguments\n\n```ruby\nl = -> (count) { \"Hello World \" * count }\nl.call 5\n# output\n# \"Hello World Hello World Hello World Hello World Hello World \"\nl.call 5, 2\n# output\nwrong number of arguments (given 2, expected 1)\n```\n\n### declare a lambda in block {.row-span-2}\n\n```ruby\ndef give_me_data\n    puts \"I am inside give_me_data method\"\n    l = -> { return 10 }\n    l.call\n    puts \"I am back in give_me_data method\"\nend\n\nreturn_value = give_me_data\nputs return_value\n\n# output\n# I am inside give_me_data method\n# I am back in give_me_data method\n# nil # because puts return nil\n```\n\n### lambdas are returned from the lambda itself, just like regular methods\n\n```ruby\nl = -> { return 10 }\nl.call\n\n# output => 10\n```\n\n## Array\n\n### Initialize an empty array\n\n```ruby\narray = Array.new   #=> []\n# or\narray = []\n```\n\n### Array containing objects of different types\n\n```ruby\narray = [1, \"two\", 3.0]\n#=> [1, \"two\", 3.0]\n```\n\n### Fill array with initial size and default objects {.row-span-2}\n\n```ruby\nnumbers = Array.new(3)\n#=> [nil, nil, nil]\nnumbers = Array.new(3, 7)\n#=> [7, 7, 7]\nnumbers = Array.new(3, true)\n#=> [true, true, true]\nnumbers = []\nnumbers.fill(7, 0..2)   #=> [7, 7, 7]\n```\n\n### array of different hashes {.col-span-2}\n\n```ruby\narray_with_hashes = Array.new(2) { {} } #=> [{}, {}]\narray_with_hashes[0][:name] = \"Bob\"\narray_with_hashes[0][:id] = 10          #=> [{:name=>\"Bob\", :id=>10}, {}]\n```\n\n### Two-dimensional array\n\n```ruby\ntemperature_data = [\n              [\"A908\", 38],\n              [\"A909\", 37],\n              [\"A910\", 38],\n          ]\ntemperature_data[0]    #=> [\"A908\", 38]\ntemperature_data[0][0] #=> \"A908\"\ntemperature_data[0][1] #=> 38\n```\n\n### array index\n\n```ruby\nstr_array = [\n  \"This\", \"is\", \"a\", \"small\", \"array\"\n]\nstr_array[0]            #=> \"This\"\nstr_array[1]            #=> \"is\"\nstr_array[4]            #=> \"array\"\n```\n\n### negative index\n\n```ruby\nstr_array = [\n  \"This\", \"is\", \"a\", \"small\", \"array\"\n]\n# Index -1 represents the last element\nstr_array[-1]        #=> \"array\"\n# Index -2 represents the second to last element\nstr_array[-2]        #=> \"small\"\nstr_array[-6]        #=> nil\n```\n\n### array method at\n\n```ruby\nstr_array = [\n  \"This\", \"is\", \"a\", \"small\", \"array\"\n]\n\nputs str_array.at(0)      #=> \"This\"\n```\n\n### Range acquisition\n\n```ruby\narr = [1, 2, 3, 4, 5, 6]\narr[100]                  #=> nil\narr[-3]                   #=> 4\narr[2, 3]                 #=> [3, 4, 5]\narr[1..4]                 #=> [2, 3, 4, 5]\narr[1..-3]                #=> [2, 3, 4]\n```\n\n### Array method fetch\n\n```ruby\narr = ['a', 'b', 'c', 'd', 'e', 'f']\narr.fetch(100)\n#=> IndexError: Index outside array bounds 100：-6...6\narr.fetch(100, \"oops\")    #=> \"oops\"\n```\n\nOut of bounds, give default value\n\n### Get array elements\n\n```ruby\narr = [1, 2, 3, 4, 5, 6]\n\narr.first     # first value => 1\narr.last      # last value => 6\n# take Returns the first n elements\narr.take(3)   #=> [1, 2, 3]\n# drop after n elements have been deleted\narr.drop(3)   #=> [4, 5, 6]\n```\n\n### Add value to end of array push\n\n```ruby\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnumbers.push(11)\n#=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\nnumbers.push(12, 13, 14)\n#=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]\n```\n\n### Delete the value at the end of the array pop\n\n```ruby\nnum_array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnum_array.pop             #=> 10\nnum_array\n#=> [1, 2, 3, 4, 5, 6, 7, 8, 9]\n```\n\n### Add value to beginning of array unshift\n\n```ruby\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnumbers.unshift(0)\n#=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnumbers.unshift(-3, -2, -1)\n#=> [-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n```\n\n### Retrieve and simultaneously delete the first element shift\n\n```ruby\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnumbers.shift #=> 1\nnumbers\n#=> [2, 3, 4, 5, 6, 7, 8, 9, 10]\n```\n\n### Remove element at specific index delete_at\n\n```ruby\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnumbers.delete_at(2) #=> 4\nnumbers\n#=> [2, 3, 5, 6, 7, 8, 9, 10]\n```\n\n### Remove a specific element anywhere in an array\n\n```ruby\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnumbers.delete(2) #=> 2\nnumbers           #=> [3, 5, 6, 7, 8, 9, 10]\n```\n\n### Insert value at given index insert {.row-span-2}\n\n```ruby\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnumbers.insert(0, 0)\n#=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnumbers.insert(0, -3, -2, -1)\n#=> [-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n\nnumbers.insert(-1, 12, 13, 14)\n#=> [-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14]\nnumbers.insert(-4, 11)\n#=> [-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]\n```\n\n### A block to fill the array with values\n\n```ruby\nnumbers = Array.new(10) { |n| n = n * 2 }\n#=> [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]\n```\n\n### Filling arrays becomes easier\n\n```ruby\nnumbers = Array(100..110)\n#=> [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110]\n\n# Or we can convert the range to an array\n(100..110).to_a\n#=> [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110]\n```\n\n### Remove nil value from array\n\n```ruby\narr = ['foo', 0, nil, 'bar', 7, nil]\narr.compact  #=> ['foo', 0, 'bar', 7]\narr      #=> ['foo', 0, nil, 'bar', 7, nil]\narr.compact! #=> ['foo', 0, 'bar', 7]\narr      #=> ['foo', 0, 'bar', 7]\n```\n\n### Remove duplicates uniq\n\n```ruby\narr = [2, 5, 6, 556, 6, 6, 8, 9, 0, 123, 556]\narr.uniq #=> [2, 5, 6, 556, 8, 9, 0, 123]\narr # => [2, 5, 6, 556, 6, 6, 8, 9, 0, 123, 556]\narr.uniq! #=> [2, 5, 6, 556, 8, 9, 0, 123]\narr #=> [2, 5, 6, 556, 8, 9, 0, 123]\n```\n\n### Check if a value exists in an array（`include？`）\n\n```ruby\nplanets = [\"Mercury\", \"Venus\", \"Earth\", \"Mars\", \"Jupiter\", \"Saturn\", \"Uranus\", \"Neptune\"]\nplanets.include? \"Mars\"\n# output => true\nplanets.include? \"Pluto\"\n# output => false\n```\n\n### Get array size\n\n```ruby\nplanets = [\"Mercury\", \"Venus\", \"Earth\", \"Mars\", \"Jupiter\", \"Saturn\", \"Uranus\", \"Neptune\"]\nplanets.size\n# output => 8\nplanets.length\n# output => 8\n```\n\nYou can use size or length, both are synonyms\n\n### clear array\n\n```ruby\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnumbers.clear\n# output => []\n```\n\n### Get the first element of the array\n\n```ruby\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnumbers[0]\n# or\nnumbers.first\n# output => 1\n```\n\n### Get the last element of the array\n\n```ruby\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnumbers[-1]\n# or\nnumbers.last\n# output => 10\n```\n\n### Merge two arrays\n\n```ruby\na = [\"tom\", \"mot\", \"otm\"]\nb = [2, 3, 5]\na.zip(b)\n# output\n# [[\"tom\", 2], [\"mot\", 3], [\"otm\", 5]]\n```\n\n### Sort array {.row-span-3}\n\n```ruby\nprimes = [7, 2, 3, 5]\nsorted_primes = primes.sort\nputs \"#{sorted_primes}\"\n# output => [2, 3, 5, 7]\n```\n\nor in-place sort\n\n```ruby\nprimes = [7, 2, 3, 5]\nprimes.sort!\nputs \"#{primes}\"\n# output => [2, 3, 5, 7]\n```\n\n```ruby\nplanets = [\"Mercury\", \"Venus\", \"Earth\", \"Mars\", \"Jupiter\", \"Saturn\", \"Uranus\", \"Neptune\"]\nplanets.sort\n# output\n# [\"Earth\", \"Jupiter\", \"Mars\", \"Mercury\", \"Neptune\", \"Saturn\", \"Uranus\", \"Venus\"]\nplanets.sort_by { |p| p }\n# output\n# [\"Earth\", \"Jupiter\", \"Mars\", \"Mercury\", \"Neptune\", \"Saturn\", \"Uranus\", \"Venus\"]\nplanets.sort_by { |p| p.length }\n# output\n# [\"Mars\", \"Earth\", \"Venus\", \"Saturn\", \"Uranus\", \"Neptune\", \"Jupiter\", \"Mercury\"]\n```\n\n### Get maximum value from array\n\n```ruby\nprimes = [7, 2, 3, 5]\nprimes.max_by { |p| p }\n# output => 7\n```\n\n### Get array elements using range {.row-span-2}\n\n```ruby\n# numbers[start..end], both index are inclusive\nputs numbers[0..3]\n# 1\n# 2\n# 3\n# 4\n# numbers[start..end], end index is exclusive\nputs numbers[0...3]\n# 1\n# 2\n# 3\n# or numbers[start..length]\nputs numbers[0, 1]\n# 1\n```\n\n### Get the first n elements of the array\n\n```ruby\nprimes = [7, 2, 3, 5]\nprimes.take(3)\n# [7, 2, 3]\n```\n\n### access element\n\n```ruby\nprimes = [7, 2, 3, 5]\nprimes.fetch(3)\n# 5\n# Fetch will throw an error if the element does not exist\nprimes.fetch(10)\n# (index 10 outside of array bounds: -4...4)\n# or get an default value\nprimes.fetch(10, -1)\n# -1\n```\n\n### Delete first n elements\n\n```ruby\nprimes = [7, 2, 3, 5]\nprimes.drop(3)\n# [5]\n```\n\n### Delete the first element\n\n```ruby\nprimes = [7, 2, 3, 5]\nprimes.shift\n# [2, 3, 5]\n```\n\n### Remove last element\n\n```ruby\nprimes = [7, 2, 3, 5]\nprimes.pop\n# [7, 2, 3]\n```\n\n### Delete element with index\n\n```ruby\nprimes = [7, 2, 3, 5]\nprimes.delete_at(-1)\n# [7, 2, 3]\n```\n\n### Remove all occurrences of elements\n\n```ruby\nprimes = [7, 2, 3, 5, 5]\nprimes.delete(5)\n# [7, 2, 3]\n```\n\n### each {.row-span-3}\n\n```ruby\n# When you have single line blocks\nsalary = [399, 234, 566, 533, 233]\nsalary.each { |s| puts s }\n# output\n# 399\n# 234\n# 566\n# 533\n# 233\n```\n\nWhen you have a multi-line block, you can replace the curly braces `{}` with `do` and `end`\n\n```ruby\nsalary.each do |s|\n  a = 10\n  res = a * s\n  puts res\nend\n# output\n# 3990\n# 2340\n# 5660\n# 5330\n# 2330\n```\n\nOr you can do the same thing using braces {} and semicolon as separator instead of newline\n\n```ruby\nsalary.each { |s| a = 10 ; res = a * s ; puts res }\n```\n\n### each_with_index\n\n```ruby\nsalary = [399, 234, 566, 533, 233]\nsalary.each_with_index { |value, index| puts \"#{index} #{value}\" }\n# output\n# 0 399\n# 1 234\n# 2 566\n# 3 533\n# 4 233\n```\n\n### each_index\n\n```ruby\nsalary = [399, 234, 566, 533, 233]\nsalary.each_index { |i| puts i}\n# output\n# 0\n# 1\n# 2\n# 3\n# 4\n```\n\n### map\n\n```ruby\nsalary = [399, 234, 566, 533, 233]\nsalary.map { |s|  s * 10  }\n# return\n# [3990, 2340, 5660, 5330, 2330]\n# On the other hand, each returns the original value\nsalary = [399, 234, 566, 533, 233]\nsalary.each { |s|  s * 10  }\n# return\n# [399, 234, 566, 533, 233]\n```\n\n### collect\n\n```ruby\nsalary = [399, 234, 566, 533, 233]\nsalary.collect { |s| s > 400 }\n# output\n# [false, false, true, true, false]\n```\n\n### for\n\n```ruby\nfor value in [2, 3, 5, 7]\n    puts value\nend\n```\n\n### each_with_object {.col-span-2}\n\n```ruby\ncolors = [\n  {color: \"red\", count: 3}, {color: \"red\", count: 5}, {color: \"black\", count: 4}\n]\ncolors.each_with_object(Hash.new(0)) { |color, hash| hash[\"color_\"+color[:color]] = color[:color].upcase; hash[\"count_\"+color[:color]] += color[:count] }\n# output\n{\"color_red\"=>\"RED\", \"count_red\"=>8, \"color_black\"=>\"BLACK\", \"count_black\"=>4}\n\n[1, 2, 3].each_with_object(0) { |number, sum| sum += number}\n# output\n# 0\n# Because 0 is immutable, and since the initial object is 0, the method returns 0\n```\n\n### while\n\n```ruby\nplanets = [\"Mercury\", \"Venus\", \"Earth\", \"Mars\", \"Jupiter\", \"Saturn\", \"Uranus\", \"Neptune\"]\nindex = 0\nwhile index < planets.size\n    puts \"#{planets[index]}\"\n    index += 1\nend\n```\n\n---\n\n```ruby\na = 1\nstar = '*'\nwhile a <= 10\n    puts star\n    star += '*'\n    a += 1\nend\n```\n\n### do while\n\n```ruby\nplanets = [\"Mercury\", \"Venus\", \"Earth\", \"Mars\", \"Jupiter\", \"Saturn\", \"Uranus\", \"Neptune\"]\nindex = 0\nloop do\n    puts \"#{planets[index]}\"\n    index += 1\n    break if planets[index] == \"Mars\" or index > planets.size\nend\n```\n\n### until\n\n```ruby\nplanets = [\"Mercury\", \"Venus\", \"Earth\", \"Mars\", \"Jupiter\", \"Saturn\", \"Uranus\", \"Neptune\"]\nindex = planets.size - 1\nuntil index < 0\n    puts \"#{planets[index]}\"\n    index -= 1\nend\n```\n\n```ruby\na = 1\nstar = '*'\nuntil star.length > 10\n    puts star\n    star += '*'\n    a += 1\nend\n```\n\n### times\n\n```ruby\n10.times { puts \"#{rand(1..100)}\"}\n# output\n# will print 10 random numbers\n```\n\nJust because you can doesn't mean you should iterate over an array like this\n\n```ruby\ndata_sample = [2, 3, 5, 7]\ndata_sample.size.times { |index| puts \"#{data_sample[index]}\" }\n# output\n# 2\n# 3\n# 5\n# 7\n```\n\n### upto\n\n```ruby\ndata_sample = [2, 3, 5, 7]\n0.upto((data_sample.size - 1) / 2) { |index| puts \"#{data_sample[index]}\" }\n# output\n# 2\n# 3\n```\n\n### downto\n\n```ruby\ndata_sample = [2, 3, 5, 7]\n(data_sample.size - 1).downto(data_sample.size / 2) { |index| puts \"#{data_sample[index]}\" }\n# output\n# 7\n# 5\n```\n\n### step {.row-span-2}\n\n```ruby\n1.step(20, 2) { |number| puts \"#{number}\"}\n# output\n# 1\n# 3\n# 5\n# 7\n# 9\n# 11\n# 13\n# 15\n# 17\n# 19\n```\n\n---\n\n```ruby\n19.step(1, -2) { |number| puts \"#{number}\"}\n# output\n# 19\n# 17\n# 15\n# 13\n# 11\n# 9\n# 7\n# 5\n# 3\n# 1\n```\n\n### inject {.row-span-2}\n\n```ruby\nnumbers = [2, 2, 2, 2, 2]\nnumbers.inject{ |res, n| res + n }\n# The output is the sum of all numbers\n# If no initial value is set for res, the first element of the array is used as the initial value of res.\n#10\n# Now set the value of res to 11\nnumbers = [2, 2, 2, 2, 2]\nnumbers.inject(11) { |res, n| res + n }\n# so 11 + 2, 13 + 2, 15 + 2, 17 + 2 and 19 + 2\n# 21\n# using symbol\nnumbers = [2, 2, 2, 2, 2]\nnumbers.inject(:+)\n# output\n# 10\n```\n\nUse initial values and symbols\n\n```ruby\nnumbers = [2, 2, 2, 2, 2]\nnumbers.inject(11, :+)\n# output\n# 21\n```\n\n### reduce\n\n```ruby\nnumbers = [2, 2, 2, 2, 2]\nnumbers.reduce(11, :+)\n# output\n# 21\n```\n\n### detect\n\n```ruby\nplanets = [\"Mercury\", \"Venus\", \"Earth\", \"Mars\", \"Jupiter\", \"Saturn\", \"Uranus\", \"Neptune\"]\nplanets.detect { |name| name.start_with?(\"E\") and name.end_with?(\"h\") }\n# output\n# Earth\nsalary = [399, 234, 566, 533, 233]\nsalary.detect { |s| s > 1000 }\n# output\n# nil\n```\n\n### find\n\n```ruby\nplanets = [\"Mercury\", \"Venus\", \"Earth\", \"Mars\", \"Jupiter\", \"Saturn\", \"Uranus\", \"Neptune\"]\nplanets.find { |name| name.start_with?(\"E\") and name.end_with?(\"h\") }\n# output\n# Earth\n```\n\n### select\n\n```ruby\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnumbers.select { |n| n % 2 == 0 }\n# Now you have an even array\n# [2, 4, 6, 8, 10]\n# If there are no values that satisfy your logic, return an empty array\n[1, 1, 1].select { |n| n % 2 == 0 }\n# no even numbers\n# []\n```\n\n### reject\n\n```ruby\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnumbers.reject { |n| n % 2 == 0 }\n# Reject if the number is even, so now we have an odd array\n# [1, 3, 5, 7, 9]\n```\n\n### keep_if\n\n```ruby\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnumbers.keep_if { |n| n % 2 == 0 }\n# numbers Array contains only even numbers\n# [2, 4, 6, 8, 10]\n```\n\n### delete_if\n\n```ruby\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnumbers.delete_if { |n| n % 2 == 0 }\n# numbers Array contains only odd numbers\n# [1, 3, 5, 7, 9]\n```\n\n### drop_while\n\n```ruby\nnumbers = [1, 2, 3, 1, 2, 3, 0]\nnumbers.drop_while { |n| n < 3 }\n# is 3 less than 3, returns false, so delete 1, 2\n# [3, 1, 2, 3, 0]\n```\n\n### reverse_each\n\n```ruby\nwords = %w[first second third fourth fifth sixth]\nstr = \"\"\nwords.reverse_each {|word| str += \"#{word} \"}\np str #=> \"sixth fifth fourth third second first \"\n```\n\n## boolean enumerable method\n\n### boolean enumerable method {.row-span-2}\n\n| Name       | When to use                                                              |\n| :--------- | :----------------------------------------------------------------------- |\n| `all?`     | When you want to check if all elements meet your condition               |\n| `any?`     | When you want to check if at least one item meets your condition         |\n| `one?`     | When you want to check if one element meets your requirement             |\n| `none?`    | When you want to check if no item meets your condition, the opposite of? |\n| `empty?`   | When you want to check if an object is empty                             |\n| `include?` | When you want to check if an element exists in the object                |\n\n### all?\n\n```ruby\n[2, 4, 6, 8, 10].all? { |num| num % 2 == 0 }\n# true\n[1, 4, 6, 8, 10].all? { |num| num % 2 == 0 }\n# false\n```\n\n### any?\n\n```ruby\n[1, 3, 5, 7, 10].any? { |num| num % 2 == 0 }\n# true\n[1, 3, 5, 7, 19].any? { |num| num % 2 == 0 }\n# false\n```\n\n### one?\n\n```ruby\n[1, 3, 2, 5, 7].one? { |num| num % 2 == 0 }\n# true\n[1, 3, 2, 5, 4].one? { |num| num % 2 == 0 }\n# false\n```\n\n### none?\n\n```ruby\n[1, 3, 5, 7, 9].none? { |num| num % 2 == 0 }\n# true\n[2, 3, 5, 7, 9].none? { |num| num % 2 == 0 }\n# false\n```\n\n### empty?\n\n```ruby\n[].empty?\n# true\n[1, 3, 5, 7, 9].empty?\n# false\n```\n\n## Combination method\n\n### Combination method {.row-span-2}\n\n- `&` Returns a new array containing each element found in array and array other_array; duplicates are omitted; use eql?\n  to compare items\n- `intersection` Returns a new array containing each element found in self and all given arrays other_arrays; duplicates\n  are omitted; use eql? to compare items\n- `+` Returns an array containing all elements of self followed by all elements of the given array\n- `-` Returns an array containing all elements of self not found in the given array\n- `union` Returns an array containing all elements of self and all elements of the given array, with duplicates removed\n- `difference` Returns an array containing all elements of self not found in any given array\n- `product` self Returns or produces all combinations of elements from self and the given array\n\n### &\n\n```ruby\n[0, 1, 2, 3] & [1, 2] # => [1, 2]\n[0, 1, 0, 1] & [0, 1] # => [0, 1]\n```\n\n### intersection\n\n```ruby\n[0, 1, 2, 3].intersection([0, 1, 2], [0, 1, 3])\n# => [0, 1]\n[0, 0, 1, 1, 2, 3].intersection([0, 1, 2], [0, 1, 3])\n# => [0, 1]\n```\n\n### +\n\n```ruby\na = [0, 1] + [2, 3]\na # => [0, 1, 2, 3]\n```\n\n### -\n\n```ruby\n[0, 1, 1, 2, 1, 1, 3, 1, 1] - [1]\n# => [0, 2, 3]\n[0, 1, 2, 3] - [3, 0]\n# => [1, 2]\n[0, 1, 2] - [4]\n# => [0, 1, 2]\n```\n\n### union\n\n```ruby\n[0, 1, 2, 3].union([4, 5], [6, 7])\n# => [0, 1, 2, 3, 4, 5, 6, 7]\n[0, 1, 1].union([2, 1], [3, 1])\n# => [0, 1, 2, 3]\n[0, 1, 2, 3].union([3, 2], [1, 0])\n# => [0, 1, 2, 3]\n```\n\n### difference\n\n```ruby\n[0, 1, 1, 2, 1, 1, 3, 1, 1].difference([1])\n# => [0, 2, 3]\n[0, 1, 2, 3].difference([3, 0], [1, 3])\n# => [2]\n[0, 1, 2].difference([4])\n# => [0, 1, 2]\n```\n\n### product\n\n```ruby\na = [0, 1, 2]\na1 = [3, 4]\np = a.product(a1)\np.size # => 6 # a.size * a1.size\np # => [[0, 3], [0, 4], [1, 3], [1, 4], [2, 3], [2, 4]]\n```\n\n## Loops\n\n### while loop\n\n```ruby\n# variable count\ncount = 4\n# using while loop\n# here conditional is count i.e. 4\nwhile count >= 1\n  # statements to be executed\n  puts \"Ruby Cheatsheet\"\n  count = count - 1\n  # while loop ends here\nend\n```\n\noutput\n\n```\nRuby Cheatsheet\nRuby Cheatsheet\nRuby Cheatsheet\nRuby Cheatsheet\n```\n\n### for loop\n\n```ruby\n# loop using range as expression\ntext = \"Ruby Cheatsheet\"\n# using for loop with the range\nfor count in 1..5 do\n  puts text\nend\n```\n\noutput\n\n```\nRuby Cheatsheet\nRuby Cheatsheet\nRuby Cheatsheet\nRuby Cheatsheet\nRuby Cheatsheet\n```\n\n### do..while loop\n\n```ruby\n# starting of do..while loop\nloop do\n  puts \"Ruby Cheatsheet\"\n  val = '7'\n  # using boolean expressions\n  if val == '7'\n    break\n  end\n  # ending of ruby do..while loop\nend\n```\n\noutput\n\n```\nRuby Cheatsheet\n```\n\n### until loop\n\n```ruby\nvar = 7\n# here do is optional\nuntil var == 11 do\n  # code to be executed\n  puts var * 10\n  var = var + 1\n  # here loop ends\nend\n```\n\noutput\n\n```\n70\n80\n90\n100\n```\n\n### Break out of loop\n\n```ruby\nsalary = [399, 234, 566, 533, 233]\nsalary.each do |s|\n  break if s == 566\n  puts s\nend\n# output\n# 399\n# 234\n```\n\nBy using the `break` keyword\n\n### skip within loop\n\n```ruby\nsalary = [399, 234, 566, 533, 233]\nsalary.each do |s|\n  next if s == 533\n  puts s\nend\n# output\n# 399\n# 234\n# 566\n# 233\n```\n\nBy using next keyword\n\n### Repeat current iteration\n\n```ruby\ndata = [456, 3000]\nretry_count = 0\nstatus = \"network failure\"\nsum = 0\ndata.each do |d|\n    if retry_count == 3\n        status = \"connection established\"\n        retry_count = 0\n        redo\n    elsif status == \"network failure\" and retry_count < 5\n        puts \"network failure #{retry_count}\"\n        retry_count += 1\n        redo\n    elsif status == \"connection established\"\n        puts d\n        sum += d\n    end\nend\n# output of sum\n# 3456\n```\n\n### Start the cycle again\n\n```ruby\nnumbers = [2, 2, 44, 44]\nsum = 0\nbegin\n    numbers.each do |s|\n        if rand(1..10) == 5\n            puts \"hi 5, let's do it again!\"\n            sum = 0\n            raise \"hi 5\"\n        end\n        puts s\n        sum += s\n    end\nrescue\n    retry\nend\n```\n\n## Classes\n\n### Classes Example {.row-span-2}\n\n```ruby\nclass Person\n    # when you create a new object, it looks for a method named initialize and executes it, like a constructor in java\n    # def initialize(name, number)\n    #    @name = name\n    #    @number = number\n    # end\n    # instance variable\n    # @name\n    # class variable\n    # @@count\n    # attr_accessor acts as a getter and setter for the following instance attributes\n    attr_accessor :name, :number\n    # class variable must be initialized\n    @@count = 0\n    def self.count\n        @@count\n    end\n    def self.count=(count)\n        @@count = count\n    end\n    def initialize\n        @@count += 1\n    end\nend\n# create an instance of the Person class\np1 = Person.new\n# set attributes of the Person class\np1.name = \"Yukihiro Matsumoto\"\np1.number = 9999999999\n# get attributes of the Person class\nputs \"#{p1.name}\"\nputs \"#{p1.number}\"\nputs \"#{Person.count}\"\n# Yukihiro Matsumoto\n# 9999999999\n# 1\np2 = Person.new\np2.name = \"Yukihiro Matsumoto\"\np2.number = 9999999999\n# get attributes of the Person class\nputs \"#{p2.name}\"\nputs \"#{p2.number}\"\nputs \"#{Person.count}\"\n# Yukihiro Matsumoto\n# 9999999999\n# 2\n# set class variable\nPerson.count = 3\nputs \"#{Person.count}\"\n# 3\n```\n\n### Inherit a class\n\n```ruby\nclass Person\n    attr_accessor :name, :number\nend\n# Inherit methods and properties from parent class using < symbol\nclass Student < Person\n    attr_accessor :id\nend\ns = Student.new\ns.name = \"James Bond\"\ns.number = 700\ns.id = 678\nputs \"#{p.name}\"\nJames Bond\nputs \"#{p.number}\"\n700\nputs \"#{p.id}\"\n678\n```\n\n### Check instance type\n\n```ruby\nclass Vehicle; end\nclass Car < Vehicle; end\nclass Audi < Car; end\ncar = Car.new\ncar.instance_of? Vehicle\nfalse\ncar.instance_of? Car\ntrue\ncar.instance_of? Audi\nfalse\na = 7\na.instance_of? Integer\ntrue\na.instance_of? Numeric\nfalse\n```\n\nReturns true if the object is an instance of the given class and not a subclass or superclass\n\n### Print all method names of a class\n\n```ruby\nputs (String.methods).sort\n# Exclude methods inherited from Object class\nputs (String.methods - Object.public_instance_methods).sort\n```\n\n### Check if a class has a specific method\n\n```ruby\nString.respond_to?(:prepend)\ntrue\nString.respond_to?(:append)\nfalse\n```\n\n## See Also\n\n- [Ruby](https://www.ruby-lang.org/en/) _(ruby-lang.org)_\n- [Ruby Cheatsheet](https://github.com/lifeparticle/Ruby-Cheatsheet) _(github.com)_\n"
  },
  {
    "path": "source/_posts/rust.md",
    "content": "---\ntitle: Rust\ndate: 2022-01-01 11:51:44\nbackground: bg-black\ntags:\ncategories:\n  - Programming\nintro: |\n  The Rust quick reference cheat sheet that aims at providing help on writing basic syntax and methods.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Hello_World.rs\n\n```rust\nfn main() {\n    println!(\"Hello, World!\");\n}\n```\n\n#### Compiling and Running\n\n```shell\n$ rustc Hello_World.rs\n$ ./Hello_World\nHello, World!\n```\n\n### Primitive types\n\n|                           |                                 |\n| ------------------------- | :------------------------------ |\n| `bool`                    | Boolean (`true` _/_ `false`)    |\n| `char`                    | character                       |\n| `f32`, `f64`              | 32-bits, 64-bits floats         |\n| `i64`, `i32`, `i16`, `i8` | signed 16- ... integers         |\n| `u64`, `u32`, `u16`, `u8` | unsigned 16-bits, ... integers  |\n| `isize`                   | pointer-sized signed integers   |\n| `usize`                   | pointer-sized unsigned integers |\n\nSee: [Rust Types](#rust-types)\n\n### Formatting {.row-span-2}\n\n```rust {.wrap}\n// Single Placeholder\nprintln!(\"{}\", 1);\n\n// Multiple Placeholder\nprintln!(\"{} {}\", 1, 3);\n\n// Positional Arguments\nprintln!(\n    \"{0} is a {1} {2}, also {0} is a {3} programming language\",\n    \"Rust\", \"cool\", \"language\", \"safe\"\n);\n\n// Named Arguments\nprintln!(\n    \"{country} is a diverse nation with unity.\",\n    country = \"India\"\n);\n\n// Placeholder traits :b for binary, :0x is for hex and :o is octal\nprintln!(\"Let us print 76 is binary which is {:b} , and hex equivalent is {:0x} and octal equivalent is {:o}\", 76, 76, 76);\n\n// Debug Trait\nprintln!(\n    \"Print whatever we want to here using debug trait {:?}\",\n    (76, 'A', 90)\n);\n\n// New Format Strings in 1.58\nlet x = \"world\";\nprintln!(\"Hello {x}!\");\n```\n\n### Printing Styles\n\n```rust\n// Prints the output\nprint!(\"Hello World\\n\");\n\n// Appends a new line after printing\nprintln!(\"Appending a new line\");\n\n// Prints as an error\neprint!(\"This is an error\\n\");\n\n// Prints as an error with new line\neprintln!(\"This is an error with new line\");\n```\n\n### Variables\n\n```rust\n// Initializing and declaring a variable\nlet some_variable = \"This_is_a_variable\";\n\n// Making a variable mutable\nlet mut mutable_variable = \"Mutable\";\n\n// Assigning multiple variables\nlet (name, age) = (\"ElementalX\", 20);\n\n// (Global) constant\nconst SCREAMING_SNAKE_CASE: i64 = 9;\n```\n\n### Comments\n\n```rust\n// Line Comments\n/*.............Block Comments */\n/// Outer doc comments\n//! Inner doc comments\n```\n\nSee: [Comment](https://doc.rust-lang.org/reference/comments.html)\n\n### Functions\n\n```rust\nfn test() {\n    println!(\"This is a function!\");\n}\n\nfn main() {\n    test();\n}\n```\n\nSee: [Functions](#rust-functions)\n\n## Rust Types\n\n### Integer\n\n```rust\nlet mut a: u32 = 8;\nlet b: u64 = 877;\nlet c: i64 = 8999;\nlet d = -90;\n```\n\n### Floating-Point\n\n```rust\nlet mut sixty_bit_float: f64 = 89.90;\nlet thirty_two_bit_float: f32 = 7.90;\nlet just_a_float = 69.69;\n```\n\n### Boolean\n\n```rust {.wrap}\nlet true_val: bool = true;\nlet false_val: bool = false;\nlet just_a_bool = true;\nlet is_true = 8 < 5; // => false\n```\n\n### Character\n\n```rust\nlet first_letter_of_alphabet = 'a';\nlet explicit_char: char = 'F';\nlet implicit_char = '8';\nlet emoji = \"\\u{1f600}\"; // => 😀\n```\n\n### String Literal\n\n```rust {.wrap}\nlet community_name = \"AXIAL\";\nlet no_of_members: &str = \"ten\";\n\nprintln!(\"The name of the community is {community_name} and it has {no_of_members} members\");\n```\n\nSee: [Strings](#rust-strings)\n\n### Arrays\n\n```rust\n┌─────┬─────┬─────┬─────┬─────┬─────┐\n| 92  | 97  | 98  | 99  | 98  | 94  |\n└─────┴─────┴─────┴─────┴─────┴─────┘\n   0     1     2     3     4     5\n```\n\n---\n\n```rust\nlet array: [i64; 6] = [92, 97, 98, 99, 98, 94];\n```\n\n### Multi-Dimensional Array {.row-span-2}\n\n```rust\n     j0   j1   j2   j3   j4   j5\n   ┌────┬────┬────┬────┬────┬────┐\ni0 | 1  | 2  | 3  | 4  | 5  | 6  |\n   ├────┼────┼────┼────┼────┼────┤\ni1 | 6  | 5  | 4  | 3  | 2  | 1  |\n   └────┴────┴────┴────┴────┴────┘\n```\n\n---\n\n```rust\nlet array: [[i64; 6]; 2] = [\n    [1, 2, 3, 4, 5, 6],\n    [6, 5, 4, 3, 2, 1]\n];\n```\n\n### Mutable Array\n\n```rust\nlet mut array: [i32; 3] = [2, 6, 10];\n\narray[1] = 4;\narray[2] = 6;\n```\n\nUse the `mut` keyword to make it mutable.\n\n### Slices\n\n```rust\nlet mut array: [i64; 4] = [1, 2, 3, 4];\nlet mut slices: &[i64] = &array[0..3]; // Lower range is inclusive and upper range is exclusive\n\nprintln!(\"The elements of the slices are : {slices:?}\");\n```\n\n### Vectors\n\n```rust\nlet some_vector = vec![1, 2, 3, 4, 5];\n```\n\nA vector is declared using the `vec!` macro.\n\n### Tuples\n\n```rust\nlet tuple = (1, 'A', \"Cool\", 78, true);\n```\n\n## Rust Strings\n\n### String Literal\n\n```rust\nlet cs: &str = \"cheat sheet\";\n\n// => Share cheat sheet for developers\nprintln!(\"Share {cs} for developers\");\n```\n\n### String Object\n\n```rust\n// Creating an empty string object\nlet my_string = String::new();\n\n// Converting to a string object\nlet S_string = a_string.to_string();\n\n// Creating an initialized string object\nlet lang = String::from(\"Rust\");\nprintln!(\"First language is {lang}\");\n```\n\n### .capacity()\n\n```rust\nlet rand = String::from(\"Random String\");\nrand.capacity() // => 13\n```\n\nCalculates the capacity of the string in bytes.\n\n### .contains()\n\n```rust\nlet name = String::from(\"ElementalX\");\nname.contains(\"Element\") // => true\n```\n\nChecks if the substring is contained inside the original string or not.\n\n### Pushing a single character\n\n```rust\nlet mut half_text = String::from(\"Hal\");\nhalf_text.push('f'); // => Half\n```\n\n### Pushing an entire String\n\n```rust\nlet mut hi = String::from(\"Hey there...\");\nhi.push_str(\"How are you doing??\");\n\n// => Hey there...How are you doing??\nprintln!(\"{hi}\");\n```\n\n## Rust Operators\n\n### Comparison Operators\n\n|          |                                  |\n| -------- | :------------------------------- |\n| `e == f` | `e` is equal to `f`              |\n| `e != f` | `e` is NOT equal to `f`          |\n| `e < f`  | `e` is less than `f`             |\n| `e > f`  | `e` is greater than `f`          |\n| `e <= f` | `e` is less than or equal to `f` |\n| `e >= f` | `e` is greater or equal to `f`   |\n\n---\n\n```rust\nlet (e, f) = (1, 100);\n\nlet greater = f > e;        // => true\nlet less = f < e;           // => false\nlet greater_equal = f >= e; // => true\nlet less_equal = e <= f;    // => true\nlet equal_to = e == f;      // => false\nlet not_equal_to = e != f;  // => true\n```\n\n### Arithmetic Operators\n\n|          |                                            |\n| -------- | :----------------------------------------- |\n| `a +  b` | `a` is added to `b`                        |\n| `a -  b` | `b` is subtracted from `a`                 |\n| `a /  b` | `a` is divided by `b`                      |\n| `a % b`  | Gets remainder of `a` by dividing with `b` |\n| `a * b`  | `a` is multiplied with `b`                 |\n\n---\n\n```rust {.wrap}\nlet (a, b) = (4, 5);\n\nlet sum: i32 = a + b;            // => 9\nlet subtractions: i32 = a - b;   // => -1\nlet multiplication: i32 = a * b; // => 20\nlet division: i32 = a / b;       // => 0\nlet modulus: i32 = a % b;        // => 4\n```\n\n### Bitwise Operators\n\n| Operator            | Description             |\n| ------------------- | ----------------------- |\n| `g & h`             | Binary AND              |\n| <code>g \\| h</code> | Binary OR               |\n| `g ^ h`             | Binary XOR              |\n| `!g`                | Binary one's complement |\n| `g << h`            | Binary shift left       |\n| `g >> h`            | Binary shift right      |\n\n---\n\n```rust {.wrap}\nlet (g, h) = (0x1, 0x2);\n\nlet bitwise_and = g & h;  // => 0\nlet bitwise_or = g | h;   // => 3\nlet bitwise_xor = g ^ h;  // => 3\nlet right_shift = g >> 2; // => 0\nlet left_shift = h << 4;  // => 32\n```\n\n### Logical Operators\n\n| Example               | Meaning               |\n| --------------------- | --------------------- |\n| `c && d`              | Both are true _(AND)_ |\n| <code>c \\|\\| d</code> | Either is true _(OR)_ |\n| `!c`                  | `c` is false _(NOT)_  |\n\n---\n\n```rust\nlet (c, d) = (true, false);\n\nlet and = c && d;  // => false\nlet or = c || d;   // => true\nlet not = !c;      // => false\n```\n\n### Compound Assignment Operator\n\n```rust\nlet mut k = 9;\nlet mut l = k;\n```\n\n---\n\n| Operator             | Description                             |\n| -------------------- | --------------------------------------- |\n| `k += l`             | Add a value and assign, then k=18       |\n| `k -= l`             | Subtract a value and assign, then k=0   |\n| `k /= l`             | Divide a value and assign, then k=1     |\n| `k *= l`             | Multiply a value and assign, then k=81  |\n| <code>k \\|= l</code> | Bitwise OR and assign, then k=89        |\n\n## Rust Flow Control\n\n### If Expression\n\n```rust\nlet case1: i32 = 81;\nlet case2: i32 = 82;\n\nif case1 < case2 {\n  println!(\"case1 is less than case2\");\n}\n```\n\n### If...Else Expression\n\n```rust\nlet case3 = 8;\nlet case4 = 9;\n\nif case3 >= case4 {\n    println!(\"case3 is better than case4\");\n} else {\n    println!(\"case4 is greater than case3\");\n}\n```\n\n### If...Else...if...Else Expression\n\n```rust\nlet foo = 12;\nlet bar = 13;\n\nif foo == bar {\n    println!(\"foo is equal to bar\");\n} else if foo < bar {\n    println!(\"foo less than bar\");\n} else if foo != bar {\n    println!(\"foo is not equal to bar\");\n} else {\n    println!(\"Nothing\");\n}\n```\n\n### If...Let Expression {.row-span-3}\n\n```rust\nlet mut arr1: [i64; 3] = [1, 2, 3];\nif let [1, 2, _] = arr1 {\n    println!(\"Works with array\");\n}\n\nlet mut arr2: [&str; 2] = [\"one\", \"two\"];\nif let [\"Apple\", _] = arr2 {\n    println!(\"Works with str array too\");\n}\n```\n\n---\n\n```rust\nlet tuple_1 = (\"India\", 7, 90, 90.432);\nif let (_, 7, 9, 78.99) = tuple_1 {\n    println!(\"Works with tuples too\");\n}\n\nlet tuple_2 = (9, 7, 89, 12, \"Okay\");\nif let (9, 7, 89, 12, blank) = tuple_2 {\n    println!(\"Everything {blank} mate?\");\n}\n\nlet tuple_3 = (89, 90, \"Yes\");\nif let (9, 89, \"Yes\") = tuple_3 {\n    println!(\"Pattern did match\");\n} else {\n    println!(\"Pattern did not match\");\n}\n```\n\n### Match Expression {.row-span-3}\n\n```rust\nlet day_of_week = 2;\nmatch day_of_week {\n    1 => {\n        println!(\"Its Monday my dudes\");\n    }\n    2 => {\n        println!(\"It's Tuesday my dudes\");\n    }\n    3 => {\n        println!(\"It's Wednesday my dudes\");\n    }\n    4 => {\n        println!(\"It's Thursday my dudes\");\n    }\n    5 => {\n        println!(\"It's Friday my dudes\");\n    }\n    6 => {\n        println!(\"It's Saturday my dudes\");\n    }\n    7 => {\n        println!(\"It's Sunday my dudes\");\n    }\n    _ => {\n        println!(\"Default!\")\n    }\n};\n```\n\n### Nested...If Expression\n\n```rust\nlet nested_conditions = 89;\nif nested_conditions == 89 {\n    let just_a_value = 98;\n    if just_a_value >= 97 {\n        println!(\"Greater than 97\");\n    }\n}\n```\n\n### For Loop\n\n```rust\nfor mut i in 0..15 {\n    i -= 1;\n    println!(\"The value of i is : {i}\");\n}\n```\n\n### While Loop\n\n```rust\nlet mut check = 0;\nwhile check < 11 {\n    println!(\"Check is : {check}\");\n    check += 1;\n    println!(\"After incrementing: {check}\");\n\n    if check == 10 {\n        break; // stop while\n    }\n}\n```\n\n### Loop keyword\n\n```rust\nloop {\n    println!(\"hello world forever!\");\n}\n```\n\nThe infinite loop indicated.\n\n### Break Statement\n\n```rust\nlet mut i = 1;\nloop {\n    println!(\"i is {i}\");\n    if i > 100 {\n        break;\n    }\n    i *= 2;\n}\n```\n\n### Continue Statement\n\n```rust\nfor (v, c) in (0..10 + 1).enumerate() {\n    println!(\"The {c} number loop\");\n    if v == 9 {\n        println!(\"Here we go continue?\");\n        continue;\n    }\n    println!(\"The value of v is : {v}\");\n}\n```\n\n## Rust Functions\n\n### Basic function\n\n```rust\nfn print_message() {\n    println!(\"Hello, CheatSheets.zip!\");\n}\n\nfn main() {\n    //Invoking a function in Rust.\n    print_message();\n}\n```\n\n### Pass by Value\n\n```rust\nfn main() {\n    let x: u32 = 10;\n    let y: u32 = 20;\n\n    // => 200\n    println!(\"Calc: {}\", cal_rect(x, y));\n}\n\nfn cal_rect(x: u32, y: u32) -> u32 {\n    x * y\n}\n```\n\n### Pass by Reference\n\n```rust\nfn main() {\n    let mut by_ref = 3; // => 3\n    power_of_three(&mut by_ref);\n    println!(\"{by_ref}\"); // => 9\n}\n\nfn power_of_three(by_ref: &mut i32) {\n    // de-referencing is important\n    *by_ref = *by_ref * *by_ref;\n    println!(\"{by_ref}\"); // => 9\n}\n```\n\n### Returns\n\n```rust {.wrap}\nfn main() {\n    let (mut radius, mut pi) = (3.0, 3.14);\n    let (area, _perimeter) = calculate(\n        &mut radius,\n        &mut pi\n    );\n    println!(\"The area and the perimeter of the circle are: {area} & {_perimeter}\");\n}\n\nfn calculate(radius: &mut f64, pi: &mut f64) -> (f64, f64) {\n    let perimeter = 2.0 * *pi * *radius;\n    let area = *pi * *radius * *radius;\n    return (area, perimeter);\n}\n```\n\n### Arrays as Arguments\n\n```rust\nfn main() {\n    let mut array: [i32; 5] = [1, 2, 3, 4, 6];\n    print_arrays(array);\n    println!(\"The elements: {array:?}\");\n}\n\nfn print_arrays(mut array: [i32; 5]) {\n    array[0] = 89;\n    array[1] = 90;\n    array[2] = 91;\n    array[3] = 92;\n    array[4] = 93;\n    println!(\"The elements: {array:?}\");\n}\n```\n\n### Returning Arrays\n\n```rust\nfn main() {\n    let mut arr: [i32; 5] = [2, 4, 6, 8, 10];\n    multiply(arr);\n    println!(\"The array is : {:?}\", multiply(arr));\n}\n\nfn multiply(mut arr: [i32; 5]) -> [i32; 5] {\n    arr[2] = 90;\n    for mut i in 0..5 {\n        arr[i] = arr[i] * arr[2];\n    }\n    return arr;\n}\n```\n\n## Misc\n\n### Type Casting\n\n```rust\nlet a_int = 90; // int\n// int to float\nlet mut type_cast = (a_int as f64);\n```\n\n---\n\n```rust\nlet original: char = 'I';\n// char to int => 73\nlet type_casted: i64 = original as i64;\n```\n\nTo perform type-casting in Rust one must use the `as` keyword.\n\n### Borrowing\n\n```rust\nlet mut foo = 4;\nlet mut borrowed_foo = &foo;\nprintln!(\"{borrowed_foo}\");\n```\n\n---\n\n```rust\nlet mut bar = 3;\nlet mut mutable_borrowed_bar = &mut bar;\nprintln!(\"{mutable_borrowed_bar}\");\n```\n\nHere borrowed value borrows the value from value one using `&` operator.\n\n### De-referencing\n\n```rust\nlet mut borrow = 10;\nlet deref = &mut borrow;\n\nprintln!(\"{}\", *deref);\n```\n\nDe-referencing in rust can be done using the `*` operator\n\n### Variable Scope\n\n```rust\n{\n    // The scope limited to this braces\n    let a_number = 1;\n}\nprintln!(\"{a_number}\");\n```\n\nThis will produce error as the scope of the variable `a_number` ends at the braces\n\n## Also see\n\n- [The Rust Document](https://doc.rust-lang.org/book/ch00-00-introduction.html) _(doc.rust-lang.org)_\n- [The Rust Reference](https://doc.rust-lang.org/reference/introduction.html) _(doc.rust-lang.org)_\n- [Rust Cheatsheet](https://phaiax.github.io/rust-cheatsheet/) _(phaiax.github.io)_\n"
  },
  {
    "path": "source/_posts/sass.md",
    "content": "---\ntitle: Sass\ndate: 2020-12-20 22:15:43\nbackground: bg-[#ba6993]\nlabel: CSS\ntags:\n  - css\ncategories:\n  - Programming\nintro: |\n  This is a quick reference cheat sheet that lists the most useful features of [SASS](https://sass-lang.com).\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Sass Basics\n\n### Introduction\n\n- [Documentation](https://sass-lang.com/documentation) _(sass-lang.com)_\n- [Learn X in Y minutes](https://learnxinyminutes.com/docs/sass/) _(learnxinyminutes.com)_\n\n### Variables\n\n```scss\n$defaultLinkColor: #46eac2;\n\na {\n  color: $defaultLinkColor;\n}\n```\n\n### String interpolation\n\n```scss\n$wk: -webkit-;\n\n.rounded-box {\n  #{$wk}border-radius: 4px;\n}\n```\n\n### Comments\n\n```scss\n/*\n Block comments\n Block comments\n Block comments\n*/\n\n// Line comments\n```\n\n### Mixins\n\n```scss\n@mixin heading-font {\n  font-family: sans-serif;\n  font-weight: bold;\n}\nh1 {\n  @include heading-font;\n}\n```\n\nSee: [Mixins](#sass-mixins)\n\n### Nesting {.row-span-2}\n\n```scss\n.markdown-body {\n  a {\n    color: blue;\n    &:hover {\n      color: red;\n    }\n  }\n}\n```\n\n#### to properties\n\n```scss\ntext: {\n  // like text-align: center\n  align: center;\n  // like text-transform: uppercase\n  transform: uppercase;\n}\n```\n\n### Extend\n\n```scss\n.button {\n    ···\n}\n```\n\n```scss\n.push-button {\n  @extend .button;\n}\n```\n\n### @import\n\n```scss\n@import './other_sass_file';\n@import '/code', 'lists';\n\n// Plain CSS @imports\n@import 'theme.css';\n@import url(theme);\n```\n\nThe `.sass` or `.sass` extension is optional.\n\n## Sass Mixins\n\n### Parameters\n\n```scss\n@mixin font-size($n) {\n  font-size: $n * 1.2em;\n}\n```\n\n```scss\nbody {\n  @include font-size(2);\n}\n```\n\n### Default values\n\n```scss\n@mixin pad($n: 10px) {\n  padding: $n;\n}\n```\n\n```scss\nbody {\n  @include pad(15px);\n}\n```\n\n### Default variable\n\n```scss\n$default-padding: 10px;\n\n@mixin pad($n: $default-padding) {\n  padding: $n;\n}\n\nbody {\n  @include pad(15px);\n}\n```\n\n## Sass Color functions {.cols-2}\n\n### rgba\n\n```scss\nrgb(100, 120, 140)\nrgba(100, 120, 140, .5)\nrgba($color, .5)\n```\n\n### Mixing\n\n```scss\nmix($a, $b, 10%)   // 10% a, 90% b\n```\n\n### Modifying HSLA\n\n```scss\ndarken($color, 5%)\nlighten($color, 5%)\n```\n\n```scss\nsaturate($color, 5%)\ndesaturate($color, 5%)\ngrayscale($color)\n```\n\n```scss\nadjust-hue($color, 15deg)\ncomplement($color)    // like adjust-hue(_, 180deg)\ninvert($color)\n```\n\n```scss\nfade-in($color, .5)   // aka opacify()\nfade-out($color, .5)  // aka transparentize()\nrgba($color, .5)      // sets alpha to .5\n```\n\n### Getting individual values\n\n#### HSLA\n\n```scss\nhue($color)         // 0deg..360deg\nsaturation($color)  // 0%..100%\nlightness($color)   // 0%..100%\nalpha($color)       // 0..1 (aka opacity())\n```\n\n#### RGB\n\n```scss\nred($color)         // 0..255\ngreen($color)\nblue($color)\n```\n\nSee: [hue()](http://sass-lang.com/documentation/Sass/Script/Functions.html#hue-instance_method),\n[red()](http://sass-lang.com/documentation/Sass/Script/Functions.html#red-instance_method)\n\n### Adjustments\n\n```scss\n// Changes by fixed amounts\nadjust-color($color, $blue: 5)\nadjust-color($color, $lightness: -30%) // darken(_, 30%)\nadjust-color($color, $alpha: -0.4)     // fade-out(_, .4)\nadjust-color($color, $hue: 30deg)      // adjust-hue(_, 15deg)\n```\n\n```scss\n// Changes via percentage\nscale-color($color, $lightness: 50%)\n```\n\n```scss\n// Changes one property completely\nchange-color($color, $hue: 180deg)\nchange-color($color, $blue: 250)\n```\n\nSupported: `$red`, `$green`, `$blue`, `$hue`, `$saturation`, `$lightness`, `$alpha`\n\n## Sass Other functions {.cols-2}\n\n### Strings\n\n```scss\nunquote('hello')\nquote(hello)\n```\n\n```scss\nto-upper-case(hello)\nto-lower-case(hello)\n```\n\n```scss\nstr-length(hello world)\nstr-slice(hello, 2, 5)     // \"ello\" - it's 1-based, not 0-based\nstr-insert(\"abcd\", \"X\", 1) // \"Xabcd\"\n```\n\n### Units\n\n```scss\nunit(3em)        // 'em'\nunitless(100px)  // false\n```\n\n### Numbers\n\n```scss\nfloor(3.5)\nceil(3.5)\nround(3.5)\nabs(3.5)\n```\n\n```scss\nmin(1, 2, 3)\nmax(1, 2, 3)\n```\n\n```scss\npercentage(.5)   // 50%\nrandom(3)        // 0..3\n```\n\n### Misc\n\n```scss\nvariable-exists(red)    // checks for $red\nmixin-exists(red-text)  // checks for @mixin red-text\nfunction-exists(redify)\n```\n\n```scss\nglobal-variable-exists(red)\n```\n\n```scss\nselector-append('.menu', 'li', 'a')   // .menu li a\nselector-nest('.menu', '&:hover li')  // .menu:hover li\nselector-extend(...)\nselector-parse(...)\nselector-replace(...)\nselector-unify(...)\n```\n\n## Sass Feature checks {.cols-2}\n\n### Feature check\n\n```scss\nfeature-exists(global-variable-shadowing)\n```\n\n### Features\n\n- global-variable-shadowing\n- extend-selector-pseudoclass\n- units-level-3\n- at-error\n\n## Sass Loops\n\n### For loops\n\n```scss\n@for $i from 1 through 4 {\n  .item-#{$i} {\n    left: 20px * $i;\n  }\n}\n```\n\n### Each loops (simple)\n\n```scss\n$menu-items: home about contact;\n\n@each $item in $menu-items {\n  .photo-#{$item} {\n    background: url('#{$item}.jpg');\n  }\n}\n```\n\n### Each loops (nested)\n\n```scss\n$backgrounds: (home, 'home.jpg'), (about, 'about.jpg');\n\n@each $id, $image in $backgrounds {\n  .photo-#{$id} {\n    background: url($image);\n  }\n}\n```\n\n### While loops\n\n```scss\n$i: 6;\n@while $i > 0 {\n  .item-#{$i} {\n    width: 2em * $i;\n  }\n  $i: $i - 2;\n}\n```\n\n## Sass Other features\n\n### Conditionals {.row-span-2}\n\n```scss\n@if $position == 'left' {\n  position: absolute;\n  left: 0;\n} @else if $position == 'right' {\n  position: absolute;\n  right: 0;\n} @else {\n  position: static;\n}\n```\n\n### Interpolation\n\n```scss\n.#{$klass} { ... }      // Class\ncall($function-name)    // Functions\n\n@media #{$tablet}\nfont: #{$size}/#{$line-height}\nurl(\"#{$background}.jpg\")\n```\n\n### Lists\n\n```scss\n$list: (a b c);\n\nnth($list, 1)  // starts with 1\nlength($list)\n\n@each $item in $list { ... }\n```\n\n### Maps {.col-span-2}\n\n```scss\n$map: (key1: value1, key2: value2, key3: value3);\n\nmap-get($map, key1)\n```\n"
  },
  {
    "path": "source/_posts/screen.md",
    "content": "---\ntitle: Screen\ndate: 2021-01-02 20:03:55\nbackground: bg-indigo-500\ntags:\n  - terminal\n  - session\n  - utility\ncategories:\n  - Linux Command\nintro: |\n  This is a quick reference guide cheat sheet for the screen command.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Getting started\n\n```shell script\n$ screen\n```\n\n1\\. Press <kbd>Ctrl-A</kbd> <kbd>D</kbd> to detach session\n\n---\n\n2\\. List all screen sessions\n\n```shell script\n$ screen -ls\n```\n\n3\\. Re-attach a screen Session\n\n```shell script\n$ screen -r <name/pid>\n```\n\n### Options {.col-span-2}\n\n| Options | Example                               | Description                                             |\n| ------- | ------------------------------------- | ------------------------------------------------------- |\n| `-S`    | screen -S debug                       | Start a new session with session name                   |\n| `-ls`   | screen -ls                            | List running sessions / screens                         |\n| `-x`    | screen -x                             | Attach to a running session                             |\n| `-r`    | screen -r debug                       | Attach to a running session with name                   |\n| `-R`    | screen -R debug                       | Attach to a session _(Will create if it doesn't exist)_ |\n| `-d`    | screen -d -m wget xxxx.com/large.file | Start screen in detached mode                           |\n| `-X`    | screen -X -S debug kill               | Kill a running session                                  |\n\n{.show-header}\n\n### Help\n\n| Command      | Description                    |\n| ------------ | ------------------------------ |\n| `Ctrl-A` `?` | See help _(Lists keybindings)_ |\n\n{.shortcuts}\n\n### Window Management {.col-span-2 .row-span-2}\n\n| Command                                | Description                             |\n| -------------------------------------- | --------------------------------------- |\n| `Ctrl-A` `C`                           | Create new window                       |\n| `Ctrl-A` `Ctrl-A`                      | Change to last-visited active window    |\n| `Ctrl-A` `0...9`                       | Change to window by number              |\n| `Ctrl-A` `'` `<0...9 or title>`        | Change to window by number or name      |\n| `Ctrl-A` `N` or `Ctrl-A` `<space>`     | Change to next window in list           |\n| `Ctrl-A` `P` or `Ctrl-A` `<backspace>` | Change to previous window in list       |\n| `Ctrl-A` `\"`                           | See window list                         |\n| `Ctrl-A` `W`                           | Show window bar                         |\n| `Ctrl-A` `K`                           | Kill current window _(not recommended)_ |\n| `Ctrl-A` `\\`                           | Kill all windows _(not recommended)_    |\n| `Ctrl-A` `A`                           | Rename current window                   |\n\n{.shortcuts}\n\n### Getting Out\n\n| Command          | Description                               |\n| ---------------- | ----------------------------------------- |\n| `Ctrl-A` `D`     | Detach                                    |\n| `Ctrl-A` `D` `D` | Detach and logout <br>_(quick exit)_      |\n| `Ctrl-A` `:`     | Exit all session                          |\n| `Ctrl-A` `C-\\`   | Force-exit screen <br>_(not recommended)_ |\n\n{.shortcuts}\n\n### Split screen\n\n| Command        | Description                            |\n| -------------- | -------------------------------------- | ------------------------ |\n| `Ctrl-A` `S`   | Split display horizontally             |\n| `Ctrl-A` `V`   | Split display vertically               |\n| `Ctrl-A` `     | `                                      | Split display vertically |\n| `Ctrl-A` `TAB` | Jump to next display region            |\n| `Ctrl-A` `X`   | Remove current region                  |\n| `Ctrl-A` `Q`   | Remove all regions but the current one |\n\n{.shortcuts}\n\n### Misc {.col-span-2 .row-span-2}\n\n| Command           | Description                                |\n| ----------------- | ------------------------------------------ |\n| `Ctrl-A` `C-l`    | Redraw window                              |\n| `Ctrl-A` `[`      | Copy mode                                  |\n| `Ctrl-A` `ESC`    | Copy mode                                  |\n| `Ctrl-A` `]`      | Paste                                      |\n| `Ctrl-A` `M`      | Monitor window for activity                |\n| `Ctrl-A` `_`      | Monitor window for silence                 |\n| `Ctrl-A` `Ctrl-V` | Enter digraph <br>_(non-ASCII characters)_ |\n| `Ctrl-A` `X`      | Lock (password protect) display            |\n| `Ctrl-A` `:`      | Enter screen command                       |\n| `Ctrl-A` `H`      | Enable logging in the screen session       |\n\n{.shortcuts}\n\n### Screen tricks\n\nSSH and attach in one line\n\n```shell script\n$ ssh -t user@host screen -x <name/pid>\n```\n"
  },
  {
    "path": "source/_posts/sdkman.md",
    "content": "---\ntitle: SDKMAN!\ndate: 2023-12-18 20:25:30\nbackground: bg-[#cf5e3c]\nlabel:\ntags:\n  - command\n  - software development kits\n  - sdk\ncategories:\n  - Linux Command\nintro: |\n  This cheatsheet provides the most commonly used SDKMAN! command line instructions\nplugins:\n  - copyCode\n---\n\n## Getting Started {.cols-2}\n\n### Installing SDKMAN!\n\nDownload SDKMAN!\n\n```shell script\n$ curl -s \"https://get.sdkman.io\" | bash\n```\n\nInstall SDKMAN!\n\n```shell script\n$ source \"$HOME/.sdkman/bin/sdkman-init.sh\"\n```\n\nCheck the version\n\n```shell script\n$ sdk version\n```\n\nUpdate\n\n```shell script\n$ sdk update\n```\n\nHelp\n\n```shell script\n$ sdk help\n```\n\n### Installing and managing candidates {.row-span-2}\n\nList all candidates\n\n```shell script\n$ sdk list\n```\n\nList versions of a candidate\n\n```shell script\n$ sdk list <candidate>\n```\n\nInstall a candidate with the latest version\n\n```shell script\n$ sdk install <candidate>\n```\n\nInstall a candidate with specific version\n\n```shell script\n$ sdk install <candidate> <version>\n```\n\nTemporarily switch between versions\n\n```shell script\n$ sdk use <candidate> <version>\n```\n\nPermanently switch to version\n\n```shell script\n$ sdk default <candidate> <version>\n```\n\nDisplay specific candidate version in use\n\n```shell script\n$ sdk current <candidate>\n```\n\nDisplay all candidates versions in use\n\n```shell script\n$ sdk current\n```\n\nRemove a candidate\n\n```shell script\n$ sdk uninstall <candidate> <version>\n```\n"
  },
  {
    "path": "source/_posts/sed.md",
    "content": "---\ntitle: Sed\ndate: 2020-12-27 18:34:08\nbackground: bg-red-400\ntags:\n  - editor\n  - replace\n  - text\n  - utility\ncategories:\n  - Linux Command\nintro: |\n  [Sed](https://www.gnu.org/software/sed/manual/sed.html) is a stream editor, this sed cheat sheet contains sed commands and some common sed tricks.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Sed Usage\n\nSyntax\n\n```shell script\n$ sed [options] command [input-file]\n```\n\nWith pipeline\n\n```shell script\n$ cat report.txt | sed 's/Nick/John/g'\n```\n\n```shell script\n$ echo '123abc' | sed 's/[0-9]+//g'\n```\n\n### Option Examples {.col-span-2}\n\n| Option | Example                                    | Description                             |\n| ------ | ------------------------------------------ | --------------------------------------- |\n| `-i`   | sed -ibak 's/On/Off/' php.ini              | Backup and modify input file directly   |\n| `-E`   | sed -E 's/[0-9]+//g' input-file            | Use extended regular expressions        |\n| `-n`   | sed -n '3 p' config.conf                   | Suppress default pattern space printing |\n| `-f`   | sed -f script.sed config.conf              | Execute sed script file                 |\n| `-e`   | sed -e 'command1' -e 'command2' input-file | Execute multiple sed commands           |\n\n{.show-header}\n\n### Multiple commands\n\n```shell script {.wrap}\n$ echo \"hello world\" | sed -e 's/h/H/g' -e 's/w/W/g'\nHello World\n```\n\nUse `-e` to execute multiple sed commands\n\n### Sed script\n\n```shell script\n$ echo 's/h/H/g' >> hello.sed\n$ echo 's/w/W/g' >> hello.sed\n$ echo \"hello world\" | sed -f hello.sed\nHello World\n```\n\nUse `-f` to execute sed script file\n\n### Examples\n\n```shell script\n$ sed 's/old/new/g' file.txt\n$ sed 's/old/new/g' file.txt > new.txt\n\n$ sed 's/old/new/g' -i file.txt\n$ sed 's/old/new/g' -i.backup file.txt\n```\n\nSee: [Sed examples](#sed-examples)\n\n## Sed commands\n\n### Commands {.col-span-2}\n\n| Command | Example                                | Description                 |\n| ------- | -------------------------------------- | --------------------------- |\n| `p`     | sed -n '1,4 p' input.txt               | Print lines 1-4             |\n| `p`     | sed -n -e '1,4 p' -e '6,7 p' input.txt | Print lines 1-4 and 6-7     |\n| `d`     | sed '1,4 d' input.txt                  | Print lines except 1-4      |\n| `w`     | sed -n '1,4 w output.txt' input.txt    | Write pattern space to file |\n| `a`     | sed '2 a new-line' input.txt           | Append line after           |\n| `i`     | sed '2 i new-line' input.txt           | Insert line before          |\n\n{.show-header}\n\n### Space commands\n\n| Command | Description                                                  |\n| ------- | ------------------------------------------------------------ |\n| `n`     | Print pattern space, empty pattern space, and read next line |\n| `x`     | Swap pattern space with hold space                           |\n| `h`     | Copy pattern space to hold space                             |\n| `H`     | Append pattern space to hold space                           |\n| `g`     | Copy hold space to pattern space                             |\n| `G`     | Append hold space to pattern space                           |\n\nSee also: [File spacing](#file-spacing)\n\n### Flags\n\n```shell script\n$ sed 's/old/new/[flags]' [input-file]\n```\n\n---\n\n| Flag     | Description                                |\n| -------- | ------------------------------------------ |\n| `g`      | Global substitution                        |\n| `1,2...` | Substitute the nth occurrence              |\n| `p`      | Print only the substituted line            |\n| `w`      | Write only the substituted line to a file  |\n| `I`      | Ignore case while searching                |\n| `e`      | Substitute and execute in the command line |\n\n### Loops commands\n\n| Command   | Description                                                        |\n| --------- | ------------------------------------------------------------------ |\n| `b label` | Branch to a label (for looping)                                    |\n| `t label` | Branch to a label only on successful substitution<br>(for looping) |\n| `:label`  | Label for the b and t commands (for looping)                       |\n| `N`       | Append next line to pattern space                                  |\n| `P`       | Print 1st line in multi-line                                       |\n| `D`       | Delete 1st line in multi-line                                      |\n\n### Misc Flags\n\n| Flag                      | Description                                                                  |\n| ------------------------- | ---------------------------------------------------------------------------- |\n| <code>/ \\| ^ @ ! #</code> | Substitution delimiter can be any character                                  |\n| `&`                       | Gets the matched pattern                                                     |\n| `( ) \\1 \\2 \\3`            | Group using `(` and `)`.<br>Use `\\1`, `\\2` in replacement to refer the group |\n\n## Sed examples\n\n### Replacing text {.row-span-2}\n\nReplace all occurrences of a string\n\n```shell script\n$ sed 's/old/new/g' file.txt\n```\n\nReplace only the nth occurrence of a string\n\n```shell script\n$ sed 's/old/new/2' file.txt\n```\n\nReplace a string only on the 5th line\n\n```shell script\n$ sed '5 s/old/new/' file.txt\n```\n\nReplace \"world\" with \"universe\" but only if the line begins with \"hello\"\n\n```shell script\n$ sed '/hello/s/world/universe/' file.txt\n```\n\nRemove \"\\\" from the end of each line\n\n```shell script\n$ sed 's/\\\\$//' file.txt\n```\n\nRemove all whitespace from beginning of each line\n\n```shell script\n$ sed 's/^\\s*//' file.txt\n```\n\nRemove comments. Even those that are at the end of a line\n\n```shell script\n$ sed 's/#.*$//' file.txt\n```\n\n### Search for text\n\nSearch for a string and only print the lines that were matched\n\n```shell script\n$ sed -n '/hello/p' file.txt\n```\n\nCase insensitive search\n\n```shell script\n$ sed -n '/hello/Ip' file.txt\n```\n\nSearch for a string but only output lines that do not match\n\n```shell script\n$ sed -n '/hello/!p' file.txt\n```\n\n### Appending lines\n\nAppend line after line 2\n\n```shell script\n$ sed '2a Text after line 2' file.txt\n```\n\nAppend line at the end of the file\n\n```shell script\n$ sed '$a THE END!' file.txt\n```\n\nAppend line after every 3rd line starting from line 3\n\n```shell script\n$ sed '3~3a Some text' file.txt\n```\n\n### Numbering {.col-span-2}\n\nNumber line of a file (simple left alignment)\n\n```shell script\n$ sed = file.txt | sed 'N;s/\\n/\\t/'\n```\n\nNumber line of a file (number on left, right-aligned)\n\n```shell script\n$ sed = file.txt | sed 'N; s/^/   /; s/ *\\(.\\{6,\\}\\)\\n/\\1  /'\n```\n\nNumber line of file, but only print numbers if line is not blank\n\n```shell script\n$ sed '/./=' file.txt | sed '/./N; s/\\n/ /'\n```\n\nCount lines (emulates \"wc -l\")\n\n```shell script\n$ sed -n '$='\n```\n\n### Prepending lines\n\nInsert text before line 5\n\n```shell script\n$ sed '5i line number five' file.txt\n```\n\nInsert \"Example: \" before each line that contains \"hello\"\n\n```shell script\n$ sed '/hello/i Example: ' file.txt\n```\n\n### Deleting lines\n\nDelete line 5-7 in file\n\n```shell script\n$ sed '5,7d' file.txt\n```\n\nDelete every 2nd line starting with line 3\n\n```shell script\n$ sed '3~2d' file.txt\n```\n\nDelete the last line in file\n\n```shell script\n$ sed '$d' file.txt\n```\n\nDelete lines starting with \"Hello\"\n\n```shell script\n$ sed '/^Hello/d' file.txt\n```\n\nDelete all empty lines\n\n```shell script\n$ sed '/^$/d' file.txt\n```\n\nDelete lines starting with \"#\"\n\n```shell script\n$ sed '/^#/d' file.txt\n```\n\n### File spacing\n\nDouble space\n\n```shell script\n$ sed G\n```\n\nDelete all blank lines and double space\n\n```shell script\n$ sed '/^$/d;G'\n```\n\nTriple space a file\n\n```shell script\n$ sed 'G;G'\n```\n\nUndo double-spacing\n\n```shell script\n$ sed 'n;d'\n```\n\nInsert a blank line above line which matches \"regex\"\n\n```shell script\n$ sed '/regex/{x;p;x;}'\n```\n\nInsert a blank line below line which matches \"regex\"\n\n```shell script\n$ sed '/regex/G'\n```\n\nInsert a blank line around line which matches \"regex\"\n\n```shell script\n$ sed '/regex/{x;p;x;G;}'\n```\n\n## Also see {.cols-1}\n\n- [sed cheatsheet](https://gist.github.com/ssstonebraker/6140154) _(gist.github.com)_\n"
  },
  {
    "path": "source/_posts/selenium.md",
    "content": "---\ntitle: Selenium\ndate: 2024-05-04 19:50:01\nbackground: bg-[#62ae41]\ntags:\n  - automation\n  - testing\ncategories:\n  - Programming\nintro: |\n  This cheat sheet is a crash course for Selenium beginners and help to get the idea about the basic concepts of Selenium.\n---\n\n## Getting Started\n\n### Initialize Browser Drivers {.row-span-2}\n\n| Browser   | Syntax                                  |\n| --------- | --------------------------------------- |\n| `Chrome`  | WebDriver driver = new ChromeDriver();  |\n| `Edge`    | WebDriver driver = new EdgeDriver();    |\n| `Firefox` | WebDriver driver = new FirefoxDriver(); |\n| `Safari`  | WebDriver driver = new SafariDriver();  |\n\n{.show-header .left-text}\n\n### Selenium Locators {.col-span-2}\n\n| Locator           | Syntax                                        |\n| ----------------- | --------------------------------------------- |\n| `className`       | driver.findElement(By.className (“key”))      |\n| `cssSelector`     | driver.findElement(By.cssSelector(key\"))      |\n| `id `             | driver.findElement(By.id(key\"))               |\n| `linkText`        | driver.findElement(By.linkText(key\"))         |\n| `name`            | driver.findElement(By.name(“key\"))            |\n| `partialLinkText` | driver.findElement(By.partialLinkText(“key\")) |\n| `tagName `        | driver.findElement(By.tagName (“key”))        |\n| `xpath`           | driver.findElement(By.xpath(“key\"))           |\n\n{.show-header .left-text}\n\n### Navigate to URL\n\n```shell script\ndriver.get(\"https://www.example.com\");\n```\n\n### Close all browser windows\n\n```shell script\ndriver.quit();\n```\n\n### Close the current browser window\n\n```shell script\ndriver.close();\n```\n\n### Navigation {.col-span-2}\n\n| Description                     | Syntax                                           |\n| ------------------------------- | ------------------------------------------------ |\n| `Navigate to a new URL`         | driver.navigate().to(\"https://www.newsite.com\"); |\n| `Go forward to the next page`   | driver.navigate().forward();                     |\n| `Go back to the previous page ` | driver.navigate().back();                        |\n| `Refresh the current page`      | driver.navigate().refresh();                     |\n\n{.show-header .left-text}\n\n### Frame Handling {.col-span-2}\n\n| Description                       | Syntax                              |\n| --------------------------------- | ----------------------------------- |\n| `Switch to a frame`               | driver.switchTo().frame(\"frameId\"); |\n| `Switch back to the main content` | driver.switchTo().defaultContent(); |\n\n{.show-header .left-text}\n\n### Alerts/Pop-Ups\n\n```shell script\nAlert alert = driver.switchTo().alert();\n\n// Used to click on the ‘OK’ button of the alert.\nalert.accept();\n\n// Used when the ‘Cancel’ button is clicked in the alert box.\nalert.dismiss();\n\n// Used to send text to an alert\nalert.sendKeys(\"text\");\n\n// Used to capture the alert message.\nalert().getText();\n\n```\n\n### Mouse and Keyboard Actions {.col-span-2}\n\n```shell script\nActions actions = new Actions(driver);\n\n// Shifts the mouse pointer to the center of the element and click on it\nactions.moveToElement(element).click().build().perform();\n\n// Performs double click on the element\nactions.doubleClick(element).perform();\n\n// Drags the element from one point and drops to another\nactions.dragAndDrop(source, target).perform();\n\n// Sends a series of keys to the element\nactions.sendKeys(element, \"text\").perform();\n\n```\n\n### Page Information {.col-span-1}\n\n```shell script\n// Get the page title\ndriver.getTitle();\n\n// Get the current page URL\ndriver.getCurrentUrl();\n\n// Get the entire page source code\ndriver.getPageSource();\n\n```\n\n### Waits {.col-span-3}\n\n```shell script\n// Explicit Wait :- These are conditional waits can be applied to satisfy a particular condition\nWebDriverWait wait = new WebDriverWait(driver, 10);\nwait.until(ExpectedConditions.elementToBeClickable(element));\n```\n\n```shell script\n// Implicit Wait :- Once the command is run, Implicit Wait remains for the entire duration for which the browser is open.\ndriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);\n```\n\n```shell script\n// Fluent Wait :- Fluent Wait in Selenium marks the maximum amount of time for Selenium WebDriver to wait for a certain condition (web element) becomes visible. It also defines how frequently WebDriver will check if the condition appears before throwing the “ElementNotVisibleException”.\nFluentWait wait = new FluentWait(driver);\n//Specify the timeout of the wait\nwait.withTimeout(5000, TimeUnit.MILLISECONDS);\n//Specify polling time\nwait.pollingEvery(250, TimeUnit.MILLISECONDS);\n//Specify what exceptions to ignore\nwait.ignoring(NoSuchElementException.class)\n//This is how we specify the condition to wait on.\nwait.until(ExpectedConditions.alertIsPresent());\n```\n"
  },
  {
    "path": "source/_posts/sequel-pro.md",
    "content": "---\ntitle: Sequel Pro\ndate: 2022-11-23 16:23:31.701510\nbackground: bg-[#ca9c3d]\nlabel: Mac\ntags:\n  -\n  - mac\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 71 keyboard shortcuts found in Sequel Pro. This application is MacOS-only.\n---\n\n## Keyboard Shortcuts\n\n### Main Tabs\n\n| Shortcut  | Action          |\n| --------- | --------------- |\n| `Cmd` `1` | Table Structure |\n| `Cmd` `2` | Table Content   |\n| `Cmd` `3` | Table Relations |\n| `Cmd` `4` | Table Info      |\n| `Cmd` `5` | Custom Query    |\n| `Cmd` `6` | Table Triggers  |\n\n{.shortcuts}\n\n### General Shortcuts {.row-span-4}\n\n| Shortcut               | Action                                     |\n| ---------------------- | ------------------------------------------ |\n| `Cmd` `N`              | New window (connection file)               |\n| `Cmd` `T`              | New tab (connection file)                  |\n| `Cmd` `Shift` `A`      | Add connection to favorites                |\n| `Cmd` `O`              | Open (connection file or SQL file)         |\n| `Cmd` `Opt` `O`        | Open current connection file in new window |\n| `Cmd` `S`              | Save (connection file)                     |\n| `Cmd` `Shift` `S`      | Save as (connection file)                  |\n| `Cmd` `Ctrl` `S`       | Save query                                 |\n| `Cmd` `W`              | Close (connection file)                    |\n| `Cmd` `Opt` `W`        | Close all (connection file)                |\n| `Cmd` `P`              | Print                                      |\n| `Cmd` `Shift` `I`      | Import                                     |\n| `Cmd` `Shift` `K`      | Show console window                        |\n| `Cmd` `K`              | Clear console                              |\n| `Ctrl` `Opt` `Left`    | Back in history                            |\n| `Ctrl` `Opt` `Right`   | Forward in history                         |\n| `Ctrl` `Tab`           | Select next tab                            |\n| `Ctrl` `Shift` `Tab`   | Select previous tab                        |\n| `Ctrl` `Shift` `N`     | Insert NULL value                          |\n| `Cmd` `Shift` `C`      | Copy create table syntax                   |\n| `Cmd` `Opt` `S`        | Show create table syntax                   |\n| `Cmd` `Shift` `R`      | Refresh databases                          |\n| `Cmd` `Shift` `D`      | Choose database                            |\n| `Cmd` `Shift` `V`      | Show server variables                      |\n| `Cmd` `Opt` `P`        | Show server processes                      |\n| `Cmd` `Ctrl` `R`       | Refresh tables                             |\n| `Cmd` `Shift` `F`      | Flush privileges                           |\n| `Cmd` `U`              | User accounts...                           |\n| `Cmd` `C`              | Copy selection or selected row(s)          |\n| `Cmd` `Opt` `C`        | Copy selected row(s) with column names     |\n| `Cmd` `Opt` `Ctrl` `C` | Copy selected row(s) as SQL INSERT         |\n| `Cmd` `Shift` `T`      | Show/hide toolbar                          |\n| `Cmd` `Ctrl` `F`       | Filter table content                       |\n| `Cmd` `Opt` `Ctrl` `F` | Filter tables                              |\n| `Cmd` `Opt` `Ctrl` `B` | Bundle editor                              |\n| `Cmd` `Opt` `Ctrl` `N` | Navigator                                  |\n\n{.shortcuts}\n\n### Select\n\n| Shortcut          | Action                    |\n| ----------------- | ------------------------- |\n| `Ctrl` `W`        | Select current word       |\n| `Ctrl` `L`        | Select current line       |\n| `Cmd` `Shift` `B` | Select enclosing brackets |\n| `Cmd` `A`         | Select all                |\n\n{.shortcuts}\n\n### Table Structure Tab\n\n| Shortcut        | Action                   |\n| --------------- | ------------------------ |\n| `Cmd` `Opt` `A` | Add a new field          |\n| `Del`           | Delete selected field    |\n| `Cmd` `D`       | Duplicate selected field |\n| `Cmd` `R`       | Refresh table structure  |\n| `Cmd` `4`       | Edit table details       |\n\n{.shortcuts}\n\n### Table Content Tab\n\n| Shortcut        | Action                 |\n| --------------- | ---------------------- |\n| `Cmd` `Opt` `A` | Add a new row          |\n| `Del`           | Delete selected row(s) |\n| `Cmd` `D`       | Duplicate selected row |\n| `Cmd` `R`       | Refresh table contents |\n\n{.shortcuts}\n\n### Custom Query Tab\n\n| Shortcut        | Action                                                              |\n| --------------- | ------------------------------------------------------------------- |\n| `Cmd` `Opt` `R` | Run all queries (1.0+) / Run current query or selection (<=0.9.9.1) |\n| `Cmd` `R`       | Run current query or selection (1.0+) / Run all queries (<=0.9.9.1) |\n| `Cmd` `[`       | Shift line or selection rightwards                                  |\n| `Cmd` `]`       | Shift line or selection leftwards                                   |\n| `Cmd` `/`       | Toggle comment line or selection                                    |\n| `Cmd` `Opt` `/` | Toggle comment current query                                        |\n| `F5`            | Spell checker completion (narrow-down list)                         |\n| `Ctrl` `Y`      | Select current query                                                |\n| `Ctrl` `H`      | Show MySQL help for current word or selection                       |\n| `Cmd` `Opt` `F` | Open query favorites popup menu                                     |\n| `Cmd` `Opt` `Y` | Open query history popup menu                                       |\n| `Ctrl` `Up`     | Insert previous history item (successively)                         |\n| `Ctrl` `Down`   | Insert next history item (successively)                             |\n| `Cmd` `Opt` `1` | Show all database names as completion list                          |\n| `Cmd` `Opt` `2` | Show all table and view names as completion list                    |\n| `Cmd` `Opt` `3` | Show all table names from current database as completion list       |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Sequel Pro](https://sequelpro.com/docs/get-started/keyboard-shortcuts) _(sequelpro.com)_\n"
  },
  {
    "path": "source/_posts/shopify.md",
    "content": "---\ntitle: Shopify\ndate: 2022-11-23 16:23:31.704478\nbackground: bg-[#8bbb55]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 50 keyboard shortcuts found on the Shopify website\n---\n\n## Keyboard Shortcuts\n\n### General Shortcuts\n\n| Shortcut    | Action                  |\n| ----------- | ----------------------- |\n| `?`         | Keyboard help           |\n| `S`         | Focus search bar        |\n| `F`         | Focus filter bar        |\n| `B` `Y` `E` | Log out                 |\n| `M` `E`     | Your profile            |\n| `O` `S`     | Open the store switcher |\n\n{.shortcuts}\n\n### Adding Items\n\n| Shortcut | Action         |\n| -------- | -------------- |\n| `A` `P`  | Add product    |\n| `A` `C`  | Add collection |\n| `A` `D`  | Add discount   |\n| `A` `O`  | Add order      |\n| `A` `U`  | Add customer   |\n| `A` `B`  | Add blog post  |\n| `A` `L`  | Add blog       |\n| `A` `G`  | Add page       |\n\n{.shortcuts}\n\n### Admin Panel I\n\n| Shortcut    | Action                         |\n| ----------- | ------------------------------ |\n| `G` `H`     | Go to home                     |\n| `G` `P` `P` | Go to products                 |\n| `G` `N`     | Go to analytics                |\n| `G` `D`     | Go to discounts                |\n| `G` `A`     | Go to apps                     |\n| `G` `B` `C` | Go to abandoned checkouts      |\n| `G` `P` `I` | Go to products, inventory      |\n| `G` `P` `G` | Go to products, gift cards     |\n| `G` `W` `B` | Go to online store, blog posts |\n| `G` `W` `T` | Go to online store, themes     |\n| `G` `W` `D` | Go to online store, domains    |\n| `G` `T` `L` | Go to settings, locations      |\n\n{.shortcuts}\n\n### Admin Panel II\n\n| Shortcut    | Action                         |\n| ----------- | ------------------------------ |\n| `G` `S` `P` | Go to settings, payments       |\n| `G` `S` `S` | Go to settings, shipping       |\n| `G` `S` `N` | Go to settings, notifications  |\n| `G` `S` `F` | Go to settings, files          |\n| `G` `S` `W` | Go to settings, online store   |\n| `G` `S` `L` | Go to settings, sales channels |\n| `G` `O`     | Go to orders                   |\n| `G` `C`     | Go to customers                |\n| `G` `M`     | Go to marketing                |\n| `G` `L`     | Go to sales channels           |\n| `G` `S`     | Go to settings                 |\n| `G` `P` `T` | Go to products, transfers      |\n| `G` `P` `C` | Go to products, collections    |\n\n{.shortcuts}\n\n### Admin Panel III\n\n| Shortcut    | Action                        |\n| ----------- | ----------------------------- |\n| `G` `W` `O` | Go to online store, overview  |\n| `G` `W` `P` | Go to online store, pages     |\n| `G` `W` `N` | Go to line store, navigation  |\n| `G` `T` `O` | Go to point of sale, overview |\n| `G` `S` `G` | Go to settings, general       |\n| `G` `S` `C` | Go to settings, checkout      |\n| `G` `S` `X` | Go to settings, taxes         |\n| `G` `S` `I` | Go to settings, gift cards    |\n| `G` `S` `A` | Go to settings, account       |\n| `G` `S` `T` | Go to settings, point of sale |\n| `G` `S` `B` | Go to settings, billing       |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Shopify](https://help.shopify.com/en/manual/productivity-tools/keyboard-shortcuts)\n  _(help.shopify.com)_\n"
  },
  {
    "path": "source/_posts/sketch.md",
    "content": "---\ntitle: Sketch\ndate: 2022-11-23 16:23:31.699427\nbackground: bg-[#d36f2b]\nlabel: Mac\ntags:\n  -\n  - mac\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 149 keyboard shortcuts found in Sketch. This application is MacOS-only.\n---\n\n## Keyboard Shortcuts\n\n### General {.row-span-2}\n\n| Shortcut                | Action                  |\n| ----------------------- | ----------------------- |\n| `Cmd` `C`               | Copy                    |\n| `Cmd` `X`               | Cut                     |\n| `Cmd` `V`               | Paste                   |\n| `Cmd` `Shift` `V`       | Paste over selection    |\n| `Space` `(drag)`        | Pan Canvas              |\n| `Cmd` `Shift` `N`       | New page                |\n| `Fn` `Up`               | Previous page           |\n| `Fn` `Down`             | Next page               |\n| `Cmd` `+`               | Zoom in                 |\n| `Cmd` `-`               | Zoom out                |\n| `Ctrl` `R`              | Toggle rulers           |\n| `Ctrl` `P`              | Toggle pixels           |\n| `Ctrl` `X`              | Toggle pixel grid       |\n| `Ctrl` `G`              | Toggle grid             |\n| `Ctrl` `L`              | Toggle layout           |\n| `Ctrl` `E`              | Toggle slices           |\n| `Ctrl` `F`              | Toggle prototyping      |\n| `Cmd` `F`               | Filter in Layer List    |\n| `Cmd` `Ctrl` `K`        | Run custom plugin       |\n| `Cmd` `Z`               | Undo                    |\n| `Cmd` `Shift` `Z`       | Redo                    |\n| `Cmd` `N`               | New document            |\n| `Cmd` `Shift` `N`       | New Cloud document      |\n| `Cmd` `O`               | Open document           |\n| `Cmd` `Shift` `O`       | Open Cloud document     |\n| `Cmd` `W`               | Close window            |\n| `Cmd` `S`               | Save document           |\n| `Cmd` `Shift` `S`       | Duplicate document      |\n| `Cmd` `Shift` `Opt` `S` | Save document as...     |\n| `Cmd` `Shift` `P`       | Page setup              |\n| `Cmd` `,`               | Open Preferences window |\n| `Cmd` `H`               | Hide Sketch             |\n| `Cmd` `Q`               | Quit Sketch             |\n| `Cmd` `Shift` `?`       | Open the Help menu      |\n| `Cmd` `P`               | Open Preview window     |\n\n{.shortcuts}\n\n### Inserting Layers\n\n| Shortcut | Action            |\n| -------- | ----------------- |\n| `R`      | Rectangle         |\n| `O`      | Oval              |\n| `L`      | Line              |\n| `U`      | Rounded rectangle |\n| `V`      | Vector tool       |\n| `P`      | Pencil tool       |\n| `T`      | Text tool         |\n| `A`      | Artboard tool     |\n| `S`      | Slice tool        |\n| `H`      | Hotspot tool      |\n\n{.shortcuts}\n\n### Selecting Layers\n\n| Shortcut          | Action                         |\n| ----------------- | ------------------------------ |\n| `Cmd` `A`         | Select all                     |\n| `Cmd` `Shift` `A` | Select all Artboards           |\n| `Fn` `Right`      | Select next Artboard           |\n| `Fn` `Left`       | Select previous Artboard       |\n| `Cmd` `Shift` `J` | Reveal selection in Layer List |\n\n{.shortcuts}\n\n### Moving and Resizing Layers\n\n| Shortcut                   | Action                                                                  |\n| -------------------------- | ----------------------------------------------------------------------- |\n| `Opt`                      | Display distance between other layers (while hovering)                  |\n| `Cmd` `D`                  | Duplicate                                                               |\n| `(arrows)`                 | Nudge layer any direction by 1px                                        |\n| `Shift` `(arrows)`         | Nudge layer any direction by 10px                                       |\n| `Cmd` `K`                  | Scale layer                                                             |\n| `Cmd` `Right/Down`         | Expand by 1px                                                           |\n| `Cmd` `Left/Up`            | Contract by 1px                                                         |\n| `Cmd` `Shift` `Right/Down` | Expand by 10px                                                          |\n| `Cmd` `Shift` `Left/Up`    | Contract by 10px                                                        |\n| `Ctrl` `Opt`               | Show distance to baseline or cap height on text layers (while hovering) |\n\n{.shortcuts}\n\n### Editing Layers\n\n| Shortcut          | Action                                        |\n| ----------------- | --------------------------------------------- |\n| `Enter`           | Edit layer                                    |\n| `Esc`             | Finish editing                                |\n| `Opt` `Tab`       | Focus X position input field in the Inspector |\n| `Del`             | Delete layer                                  |\n| `Cmd` `Opt` `C`   | Copy style                                    |\n| `Cmd` `Opt` `V`   | Paste style                                   |\n| `Ctrl` `S`        | Sync shared style                             |\n| `Opt` `Ctrl` `S`  | Reset shared style                            |\n| `W`               | Add link to Artboard                          |\n| `F`               | Toggle fill                                   |\n| `B`               | Toggle border                                 |\n| `Ctrl` `C`        | Pick color                                    |\n| `0-9`             | Edit layer opacity                            |\n| `Cmd` `Shift` `T` | Transform shape                               |\n| `Cmd` `Shift` `R` | Rotate layer                                  |\n| `Cmd` `Ctrl` `M`  | Use as mask                                   |\n| `Cmd` `Esc`       | Return to instance                            |\n| `Cmd` `Opt` `U`   | Union multiple layers                         |\n| `Cmd` `Opt` `S`   | Subtract multiple layers                      |\n| `Cmd` `Opt` `I`   | Intersect multiple layers                     |\n| `Cmd` `Opt` `X`   | Difference multiple layers                    |\n\n{.shortcuts}\n\n### Vector Editing\n\n| Shortcut        | Action                         |\n| --------------- | ------------------------------ |\n| `Cmd` `Opt` `O` | Open or close path             |\n| `Tab`           | Selects next point             |\n| `Opt`           | Show all handle control points |\n| `1`             | Straight point type            |\n| `2`             | Mirrored point type            |\n| `3`             | Disconnected point type        |\n| `4`             | Asymmetric point type          |\n\n{.shortcuts}\n\n### Text Editing {.row-span-2}\n\n| Shortcut                | Action                     |\n| ----------------------- | -------------------------- |\n| `Cmd` `Shift` `Opt` `V` | Paste as rich text         |\n| `Cmd` `T`               | Change typeface            |\n| `Cmd` `B`               | Bold                       |\n| `Cmd` `I`               | Italic                     |\n| `Cmd` `U`               | Underline                  |\n| `Cmd` `Opt` `+`         | Increase font size         |\n| `Cmd` `Opt` `-`         | Decrease font size         |\n| `Ctrl` `Opt` `L`        | Increase character spacing |\n| `Ctrl` `Opt` `T`        | Decrease character spacing |\n| `Cmd` `Shift` `[`       | Align left                 |\n| `Cmd` `Shift` `\\`       | Align center               |\n| `Cmd` `Shift` `]`       | Align right                |\n| `Cmd` `Opt` `Space`     | Emoji and symbols          |\n| `Cmd` `Opt` `O`         | Convert to outlines        |\n| `Shift` `Enter`         | Insert a line break        |\n\n{.shortcuts}\n\n### Arranging Layers {.row-span-2}\n\n| Shortcut                 | Action                            |\n| ------------------------ | --------------------------------- |\n| `Cmd` `G`                | Group                             |\n| `Cmd` `Shift` `G`        | Ungroup                           |\n| `Cmd` `R`                | Rename layer                      |\n| `Tab`                    | Select next layer in group        |\n| `Shift` `Tab`            | Select previous layer in group    |\n| `Enter`                  | Selects layer inside group        |\n| `Esc`                    | Selects parent group              |\n| `Cmd` `]`                | Bring forward                     |\n| `Cmd` `Opt` `]`          | Bring to front                    |\n| `Cmd` `[`                | Send backward                     |\n| `Cmd` `Opt` `[`          | Send to back                      |\n| `Cmd` `Shift` `Opt` `Up` | Move up, out of group or Artboard |\n| `Cmd` `Ctrl` `H`         | Distribute horizontally           |\n| `Cmd` `Ctrl` `V`         | Distribute vertically             |\n| `Cmd` `Shift` `H`        | Hide or show layer                |\n| `Cmd` `Shift` `L`        | Lock or unlock layer              |\n\n{.shortcuts}\n\n### Exporting Layers\n\n| Shortcut          | Action                   |\n| ----------------- | ------------------------ |\n| `Cmd` `Shift` `E` | Export                   |\n| `Cmd` `E`         | Export selected layer(s) |\n\n{.shortcuts}\n\n### Zoom and Focus\n\n| Shortcut                | Action                             |\n| ----------------------- | ---------------------------------- |\n| `Cmd` `0`               | Zoom to 100%                       |\n| `Cmd` `1`               | Zoom to all elements on Canvas     |\n| `Cmd` `2`               | Zoom to selected layer(s)          |\n| `Cmd` `3`               | Center selected layer(s) in Canvas |\n| `Shift` <code>\\`</code> | Temporarily zoom out to 100%       |\n| `Cmd` `Ctrl` `F`        | Toggle full screen                 |\n| `Cmd` `Opt` `1`         | Show or hide Layer list            |\n| `Cmd` `Opt` `2`         | Show or hide Inspector             |\n| `Cmd` `.`               | Enter presentation mode            |\n| `Cmd` `Opt` `T`         | Show or hide Toolbar               |\n\n{.shortcuts}\n\n### Text Fields\n\n| Shortcut       | Action                |\n| -------------- | --------------------- |\n| `Opt` `Tab`    | Focus Inspector       |\n| `Tab`          | Select next field     |\n| `Shift` `Tab`  | Select previous field |\n| `Enter`        | Confirm change        |\n| `Esc`          | Clear change          |\n| `Up`           | Increase value by 1   |\n| `Down`         | Decrease value by 1   |\n| `Shift` `Up`   | Increase value by 10  |\n| `Shift` `Down` | Decrease value by 10  |\n| `Opt` `Up`     | Increase value by 0.1 |\n| `Opt` `Down`   | Decrease value by 0.1 |\n\n{.shortcuts}\n\n### Miscellaneous\n\n| Shortcut               | Action                                                              |\n| ---------------------- | ------------------------------------------------------------------- |\n| `Shift`                | Launch Sketch with all plugins disabled (hold on startup)           |\n| `Cmd` `Ctrl` `D`       | Detach from Symbol                                                  |\n| `Cmd` `Ctrl` `Opt` `D` | Detach all contents from Symbol                                     |\n| `Cmd` `Shift` `D`      | Refresh Data                                                        |\n| `Cmd` `Ctrl` `R`       | Run last-used plugin again                                          |\n| `0-9`                  | With a gradient stop selected, position it between 0% and 100%      |\n| `=`                    | Position selected gradient stop directly between two existing stops |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Sketch](https://www.sketch.com/docs/shortcuts/) _(www.sketch.com)_\n"
  },
  {
    "path": "source/_posts/sketchup.md",
    "content": "---\ntitle: SketchUp Pro\ndate: 2022-11-23 16:23:31.693091\nbackground: bg-[#265a94]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 135 default keyboard shortcuts found in SketchUp Pro\n---\n\n## Keyboard Shortcuts {.cols-2}\n\n### General I\n\n| Shortcut          | Action                                                                             |\n| ----------------- | ---------------------------------------------------------------------------------- |\n| `A`               | 2 point arc tool                                                                   |\n| `C`               | Circle tool                                                                        |\n| `Shift` `C`       | Circle tool - lock current inferences                                              |\n| `E`               | Eraser tool                                                                        |\n| `Alt` `E`         | Eraser tool - soften or smooth (use on edges to make adjacent faces appear curved) |\n| `Shift` `E`       | Eraser tool - hide                                                                 |\n| `Alt` `Shift` `E` | Eraser tool - unsoften or unsmooth                                                 |\n| `L`               | Line tool                                                                          |\n| `Shift` `L`       | Line tool - lock in current inference direction                                    |\n| `(arrows)` `L`    | Line tool - lock direction                                                         |\n| `M`               | Move tool                                                                          |\n| `Alt` `M`         | Move tool - move a copy                                                            |\n| `Shift` `M`       | Move tool - hold down to lock in current inference direction                       |\n| `Ctrl` `M`        | Move tool - auto-fold (allow move even if it means adding extra edges and faces)   |\n| `(arrows)` `M`    | Move tool - lock direction                                                         |\n| `F`               | Offset tool                                                                        |\n| `O`               | Orbit tool                                                                         |\n| `Alt` `O`         | Orbit tool - disable 'gravity-weighted' orbiting                                   |\n| `Shift` `O`       | Orbit tool - activate pan tool                                                     |\n| `B`               | Paint bucket tool                                                                  |\n| `Alt` `B`         | Paint bucket tool - fill material, paint all matching adjacent faces               |\n| `Shift` `B`       | Paint bucket tool - replace material, paint all matching faces in the model        |\n\n{.shortcuts}\n\n### General II\n\n| Shortcut              | Action                                                                                      |\n| --------------------- | ------------------------------------------------------------------------------------------- |\n| `Shift` `B`           | Paint bucket tool - replace material, paint all matching faces in the model                 |\n| `Alt` `Shift` `B`     | Paint bucket tool - replace material on object, paint all matching faces on the same object |\n| `Ctrl` `B`            | Paint bucket tool - sample material                                                         |\n| `P`                   | Push and pull tool                                                                          |\n| `Alt` `P`             | Push and pull tool - push or pull a copy of the face, leaving original in place             |\n| `R`                   | Rectangle tool                                                                              |\n| `Alt` `R`             | Rectangle tool - start drawing from center                                                  |\n| `Q`                   | Rotate tool                                                                                 |\n| `Alt` `Q`             | Rotate tool - rotate a copy                                                                 |\n| `S`                   | Scale tool                                                                                  |\n| `Alt` `S`             | Scale tool - scale about center                                                             |\n| `Shift` `S`           | Scale tool - scale uniformly, don't distort                                                 |\n| `Space`               | Select tool                                                                                 |\n| `Alt` `Space`         | Select tool - add to selection                                                              |\n| `Shift`               | Select tool - add or subtract from selection                                                |\n| `Alt` `Shift` `Space` | Select tool - subtract from selection                                                       |\n| `T`                   | Tape measure tool                                                                           |\n| `Alt` `T`             | Tape measure tool - toggle create guide or measure only                                     |\n| `(arrows)` `T`        | Tape measure tool - lock direction                                                          |\n| `Z`                   | Zoom tool                                                                                   |\n| `Shift` `Z`           | Zoom tool - combine with click-drag mouse to change field of view                           |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for SketchUp](https://help.sketchup.com/en/sketchup/getting-started-sketchup#qrc)\n  _(help.sketchup.com)_\n"
  },
  {
    "path": "source/_posts/skype.md",
    "content": "---\ntitle: Skype\ndate: 2022-11-23 16:23:31.698711\nbackground: bg-[#52ace2]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 31 keyboard shortcuts found in Skype\n---\n\n## Keyboard Shortcuts {.cols-2}\n\n### General I\n\n| Shortcut            | Action                                    |\n| ------------------- | ----------------------------------------- |\n| `Ctrl` `Shift` `O`  | Open Notification panel                   |\n| `Ctrl` `,`          | Open app settings                         |\n| `Ctrl` `2`          | Launch main dial pad                      |\n| `Ctrl` `N`          | Start new conversation                    |\n| `Ctrl` `G`          | New group                                 |\n| `Ctrl` `F`          | Find in current conversation              |\n| `Shift` `Enter`     | Select next message in search results     |\n| `Enter`             | Select previous message in search results |\n| `Ctrl` `Shift` `E`  | Focus Message Composer                    |\n| `Ctrl` `Option` `S` | Search for People, Groups, and Messages   |\n| `Alt` `1`           | Navigate to recent chats                  |\n| `Ctrl` `Shift` `C`  | Open contacts                             |\n| `Ctrl` `Shift` `B`  | Open contact screen to bots               |\n| `Ctrl` `Alt` `O`    | Send feedback                             |\n| `Ctrl` `R`          | Refresh the app                           |\n| `Ctrl` `T`          | Open themes                               |\n\n{.shortcuts}\n\n### General II\n\n| Shortcut           | Action                                   |\n| ------------------ | ---------------------------------------- |\n| `Ctrl` `Shift` `T` | Toggle between light and dark mode       |\n| `Ctrl` `+/-/0`     | Zoom in, out, or actual size             |\n| `Ctrl` `Shift` `E` | Edit the last message sent               |\n| `Ctrl` `I`         | Show conversation profile                |\n| `Ctrl` `Shift` `A` | Add people to conversation or call       |\n| `Ctrl` `E`         | Hide conversation                        |\n| `Ctrl` `Shift` `U` | Mark as unread                           |\n| `Ctrl` `Shift` `K` | Start video call or toggle video on/off  |\n| `Ctrl` `Shift` `L` | Select multiple messages in conversation |\n| `Ctrl` `Shift` `R` | Start or answer audio call               |\n| `Ctrl` `Shift` `F` | Send a file                              |\n| `Ctrl` `Shift` `G` | Open gallery                             |\n| `Ctrl` `S`         | Take a snapshot                          |\n| `Ctrl` `Shift` `H` | Hang up                                  |\n| `Ctrl` `Shift` `M` | Toggle mute                              |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Skype](https://support.skype.com/en/faq/FA12025/what-are-keyboard-shortcuts-and-how-do-i-use-them-in-skype)\n  _(support.skype.com)_\n"
  },
  {
    "path": "source/_posts/slack.md",
    "content": "---\ntitle: Slack\ndate: 2022-11-23 16:23:31.705147\nbackground: bg-[#4d1a51]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 62 keyboard shortcuts found in Slack\n---\n\n## Keyboard Shortcuts\n\n### Navigation {.row-span-4}\n\n| Shortcut             | Action                                         |\n| -------------------- | ---------------------------------------------- |\n| `Tab`                | Move focus to the next element                 |\n| `Shift` `Tab`        | Move focus to the previous element             |\n| `Up/Down`            | Move focus through messages in a channel or DM |\n| `F6`                 | Move focus to the next section                 |\n| `Shift` `F6`         | Move focus to the previous section             |\n| `Space`              | Take action or 'click' on buttons              |\n| `Enter`              | Take action or 'click' on links                |\n| `Esc`                | Close windows, menus, or the message field     |\n| `Ctrl` `+/-`         | Zoom in/out                                    |\n| `Home/PgUp`          | Scroll up                                      |\n| `End/PgDown`         | Scroll down                                    |\n| `Ctrl` `K`           | Quick Switcher                                 |\n| `Ctrl` `Shift` `K`   | Open direct messages menu                      |\n| `Ctrl` `Shift` `L`   | Browse all channels                            |\n| `Ctrl` `Shift` `T`   | Open All Threads view                          |\n| `Alt` `Up`           | Previous channel or DM                         |\n| `Alt` `Down`         | Next channel or DM                             |\n| `Alt` `Shift` `Up`   | Previous unread channel or DM                  |\n| `Alt` `Shift` `Down` | Next unread channel or DM                      |\n| `Alt` `Left`         | Previous channel or DM visited                 |\n| `Alt` `Right`        | Next channel or DM visited                     |\n| `Ctrl` `,`           | Preferences (desktop apps only)                |\n| `Ctrl` `.`           | Open or close right pane                       |\n| `Ctrl` `Shift` `I`   | Channel info pane                              |\n| `Ctrl` `Shift` `M`   | Activity                                       |\n| `Ctrl` `Shift` `E`   | Directory                                      |\n| `Ctrl` `Shift` `S`   | Starred Items                                  |\n| `Ctrl` `F`           | Search the current channel or conversation     |\n| `Ctrl` `G`           | Open previous search                           |\n| `Ctrl` `Shift` `F`   | Toggle full screen view                        |\n\n{.shortcuts}\n\n### All Unreads navigation\n\n| Shortcut                  | Action                                |\n| ------------------------- | ------------------------------------- |\n| `Ctrl` `Shift` `A`        | Open All Unreads view                 |\n| `Alt` `(click a message)` | Mark message as unread                |\n| `Left/Right`              | Move between channels                 |\n| `R`                       | Toggle current channel read or unread |\n\n{.shortcuts}\n\n### Switch workspaces\n\n| Shortcut             | Action                         |\n| -------------------- | ------------------------------ |\n| `Ctrl` `Shift` `Tab` | Switch to previous workspace   |\n| `Ctrl` `Tab`         | Switch to next workspace       |\n| `Ctrl` `[number]`    | Switch to a specific workspace |\n\n{.shortcuts}\n\n### Mark messages read or unread\n\n| Shortcut                  | Action                                             |\n| ------------------------- | -------------------------------------------------- |\n| `Esc`                     | Mark all messages in current channel or DM as read |\n| `Shift` `Esc`             | Mark all messages as read                          |\n| `Alt` `(click a message)` | Set a message as your oldest unread message        |\n\n{.shortcuts}\n\n### Message shortcuts {.row-span-2}\n\n| Shortcut           | Action                                   |\n| ------------------ | ---------------------------------------- |\n| `Up`               | Edit your last message                   |\n| `Shift` `Up`       | Select text to beginning of current line |\n| `Shift` `Down`     | Select text to end of current line       |\n| `Shift` `Enter`    | Create a new line in your message        |\n| `Ctrl` `Shift` `\\` | Add emoji reactions to a message         |\n| `Ctrl` `B`         | Bold selected text                       |\n| `Ctrl` `I`         | Italicize selected text                  |\n| `Ctrl` `Shift` `X` | Strikethrough selected text              |\n| `Ctrl` `Shift` `>` | Quote selected text                      |\n| `Ctrl` `Shift` `C` | Codeblock selected text                  |\n| `Ctrl` `Shift` `7` | Turn selected text into a numbered list  |\n| `Ctrl` `Shift` `8` | Turn selected text into a bulleted list  |\n| `Ctrl` `Shift` `Y` | Set or edit your status                  |\n\n{.shortcuts}\n\n### Message autocomplete\n\n| Shortcut             | Action                                                |\n| -------------------- | ----------------------------------------------------- |\n| `[character]` `Tab`  | Autocomplete @display name beginning with [character] |\n| `#[character]` `Tab` | Autocomplete channel beginning with [character]       |\n| `:[character]` `Tab` | Autocomplete emoji beginning with [character]         |\n\n{.shortcuts}\n\n### File and snippets\n\n| Shortcut               | Action               |\n| ---------------------- | -------------------- |\n| `Ctrl` `U`             | Upload a file        |\n| `Ctrl` `Shift` `Enter` | Create a new snippet |\n\n{.shortcuts}\n\n### Call actions\n\n| Shortcut  | Action                          |\n| --------- | ------------------------------- |\n| `M`       | Toggle mute on and off          |\n| `V`       | Toggle video on and off         |\n| `+/A`     | Show the invite list            |\n| `E` `1-9` | View and select emoji reactions |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Slack](https://get.slack.help/hc/en-us/articles/201374536-Slack-keyboard-shortcuts)\n  _(get.slack.help)_\n"
  },
  {
    "path": "source/_posts/socket-io.md",
    "content": "---\ntitle: Socket io\ndate: 27-06-2025\nicon: icon-style\nbackground: bg-[#1289D8]\ntags:\n  - socket io\n  - web\ncategories:\n  - Programming\nintro: |\n  Socket.IO is a JavaScript library for real-time web applications. It enables bi-directional, event-based communication between clients (typically browsers or native apps) and servers.\nplugins:\n  - copyCode\n---\n\n# Socket.IO Multi-Language Cheat Sheet (v4)\n\n## Introduction\n\n### Introduction\n\n- [Socket.IO Official Website](https://socket.io/) _(socket.io)_\n- [Socket.IO Documentation (v4.1)](https://socket.io/docs/v4/) _(socket.io)_\n- [Socket.IO GitHub Repository](https://github.com/socketio/socket.io) _(github.com)_\n- [Getting Started with Socket.IO (Chat App Tutorial)](https://socket.io/get-started/chat/) _(socket.io)_\n- [FreeCodeCamp Socket.IO Tutorial](https://www.freecodecamp.org/news/socket-io-tutorial/) _(freecodecamp.org)_\n\n## Installation / Setup\n\n### Installation / Setup\n\n**JavaScript (Node.js)**\n\n```bash\nnpm install socket.io socket.io-client\n```\n\n**Python**\n\n```bash\npip install python-socketio eventlet\n# or\npip install python-socketio aiohttp\n```\n\n**Java**\n\n```groovy\nimplementation 'io.socket:socket.io-client:2.0.1'\n```\n\n### Installation / Setup\n\n**Swift (iOS)**\n\n```ruby\npod 'Socket.IO-Client-Swift', '~> 16.0.1'\n```\n\n**C# (.NET)**\n\n```powershell\nInstall-Package SocketIoClientDotNet\n```\n\n**React Native**\n\n```bash\nnpm install socket.io-client\n```\n\n### Installation / Setup\n\n**Go**\n\n```bash\ngo get github.com/googollee/go-socket.io\n```\n\n**Rust**\n\n```bash\n\ncargo add socketio-client\n\n```\n\n---\n\n## Connecting / Setup\n\n### JavaScript (Browser Client then Node.js Server)\n\n**Client**\n\n```js\nimport { io } from 'socket.io-client';\nconst socket = io('http://localhost:3000');\n```\n\n**Server**\n\n```js\nconst io = require('socket.io')(3000, {\n  cors: { origin: '*' }\n});\nio.on('connection', (socket) => {\n  console.log('Client connected:', socket.id);\n});\n```\n\n### Python (Client then Server)\n\n**Client**\n\n```python\nimport socketio\nsio = socketio.Client()\nsio.connect('http://localhost:3000')\n```\n\n**Server**\n\n```python\nimport socketio, eventlet, flask\n\napp = flask.Flask(__name__)\nsio = socketio.Server(cors_allowed_origins='*')\napp = socketio.WSGIApp(sio, app)\n\n@sio.event\ndef connect(sid, environ):\n    print('Client connected:', sid)\n\nif __name__ == '__main__':\n    eventlet.wsgi.server(eventlet.listen(('', 3000)), app)\n```\n\n### Java (Client then Server)\n\n**Client**\n\n```java\nIO.Options opts = new IO.Options();\nSocket socket = IO.socket(\"http://localhost:3000\", opts);\nsocket.connect();\n```\n\n**Server**\n\n```java\nimport io.socket.engineio.server.EngineIoServer;\nimport io.socket.server.SocketIoServer;\n\nEngineIoServer engineIo = new EngineIoServer();\nSocketIoServer io = new SocketIoServer(engineIo);\nio.listen(3000);\n\nio.on(\"connection\", args -> {\n    var client = args[0];\n    System.out.println(\"Client connected: \" + client.id());\n});\n```\n\n### Swift (iOS Client then Server)\n\n**Client**\n\n```swift\nlet manager = SocketManager(\n  socketURL: URL(string: \"http://localhost:3000\")!,\n  config: [.log(true), .compress]\n)\nlet socket = manager.defaultSocket\nsocket.connect()\n```\n\n**Server**\n_Server setups in Swift are uncommon; usually Node.js or Python is used._\n\n### C# (.NET Client then Server)\n\n**Client**\n\n```csharp\nvar socket = IO.Socket(\"http://localhost:3000\");\nsocket.Connect();\n```\n\n**Server**\n\n```csharp\nusing Fleck;\nvar server = new WebSocketServer(\"ws://0.0.0.0:3000\");\nserver.Start(socket =>\n{\n    socket.OnOpen = () => Console.WriteLine(\"Client connected\");\n});\n```\n\n### React Native (Client)\n\n**Client**\n\n```js\nimport io from 'socket.io-client';\nconst socket = io('http://localhost:3000');\n```\n\n_(Server side same as JavaScript above.)_\n\n### Go (Client then Server)\n\n**Client**\n\n```go\nimport \"github.com/googollee/go-socket.io-client\"\nsocket, err := gosocketio.Dial(\n    gosocketio.GetUrl(\"localhost\", 3000, false),\n    transport.GetDefaultWebsocketTransport(),\n)\n```\n\n**Server**\n\n```go\nimport (\n    \"github.com/googollee/go-socket.io\"\n    \"net/http\"\n)\n\nserver, _ := socketio.NewServer(nil)\nserver.OnConnect(\"/\", func(s socketio.Conn) error {\n    fmt.Println(\"Client connected:\", s.ID())\n    return nil\n})\nhttp.Handle(\"/socket.io/\", server)\ngo http.ListenAndServe(\":3000\", nil)\n```\n\n### Rust (Client then Server)\n\n**Client**\n\n```rust\nuse socketio_client::ClientBuilder;\n\nasync fn run() -> Result<(), Box<dyn std::error::Error>> {\n    let socket = ClientBuilder::new(\"http://localhost:3000\")\n        .transport(\"websocket\")\n        .connect()\n        .await?;\n    Ok(())\n}\n```\n\n**Server**\n_Rust server support is experimental; commonly use Node.js/Python servers._\n\n---\n\n## Emitting & Listening to Events\n\n### JavaScript (Client then Server)\n\n**Client**\n\n```js\nsocket.emit('msg', 'Hi');\nsocket.on('reply', (data) => console.log('Reply:', data));\n```\n\n**Server**\n\n```js\nio.on('connection', (socket) => {\n  socket.on('msg', (msg) => {\n    console.log('Received:', msg);\n    socket.emit('reply', 'Hello from server');\n  });\n});\n```\n\n### Python (Client then Server)\n\n**Client**\n\n```python\nsio.emit('msg', 'Hi')\n\n@sio.on('reply')\ndef on_reply(data):\n    print('Reply:', data)\n```\n\n**Server**\n\n```python\n@sio.event\ndef msg(sid, data):\n    print('Received:', data)\n    sio.emit('reply', 'Hello from server', to=sid)\n```\n\n### Java (Client then Server)\n\n**Client**\n\n```java\nsocket.emit(\"msg\", \"Hi\");\nsocket.on(\"reply\", args -> System.out.println(\"Reply: \" + args[0]));\n```\n\n**Server**\n\n```java\nio.on(\"connection\", args -> {\n    var client = args[0];\n    client.on(\"msg\", msgArgs -> {\n        System.out.println(\"Received: \" + msgArgs[0]);\n        client.emit(\"reply\", \"Hello from server\");\n    });\n});\n```\n\n### Swift (Client then Server)\n\n**Client**\n\n```swift\nsocket.emit(\"msg\", \"Hi\")\nsocket.on(\"reply\") { data, _ in\n  print(\"Reply:\", data[0])\n}\n```\n\n**Server**\n_Server side in Swift is rare; use Node.js/Python._\n\n### C# (Client then Server)\n\n**Client**\n\n```csharp\nsocket.Emit(\"msg\", \"Hi\");\nsocket.On(\"reply\", data => Console.WriteLine(\"Reply: \" + data));\n```\n\n**Server**\n\n```csharp\nsocket.OnMessage = message =>\n{\n    Console.WriteLine(\"Received: \" + message);\n    socket.Send(\"reply\", \"Hello from server\");\n};\n```\n\n### Go (Client then Server)\n\n**Client**\n\n```go\nsocket.Emit(\"msg\", \"Hi\")\nsocket.On(\"reply\", func(msg string) {\n    fmt.Println(\"Reply:\", msg)\n})\n```\n\n**Server**\n\n```go\nserver.OnEvent(\"/\", \"msg\", func(s socketio.Conn, msg string) {\n    fmt.Println(\"Received:\", msg)\n    s.Emit(\"reply\", \"Hello from server\")\n})\n```\n\n### Rust (Client then Server)\n\n**Client**\n\n```rust\nsocket.emit(\"msg\", Payload::String(\"Hi\"));\nsocket.on(\"reply\", |payload| println!(\"Reply: {:?}\", payload));\n```\n\n**Server**\n_Experimental; typically use Node.js/Python._\n\n---\n\n## Broadcasting & Rooms\n\n### Client (All Languages)\n\n- **Join a room:**\n\n  ```js\n  // JavaScript/Python/C#/etc.\n  socket.emit('join', 'room1');\n  socket.on('msg', (data) => console.log('Room message:', data));\n  ```\n\n### Server (All Languages)\n\n- **Node.js**\n\n  ```js\n  io.on('connection', (socket) => {\n    socket.on('join', (room) => {\n      socket.join(room);\n      io.to(room).emit('msg', 'Hello Room');\n    });\n  });\n  ```\n\n- **Python**\n\n  ```python\n  @sio.event\n  def join(sid, room):\n      sio.enter_room(sid, room)\n      sio.emit('msg', 'Hello Room', room=room)\n  ```\n\n- **Go**\n\n  ```go\n  server.OnEvent(\"/\", \"join\", func(s socketio.Conn, room string) {\n      s.Join(room)\n      server.BroadcastToRoom(\"/\", room, \"msg\", \"Welcome\")\n  })\n  ```\n\n---\n\n## Disconnects & Errors\n\n### Client (All Languages)\n\n```js\nsocket.on('disconnect', (reason) => console.log('Disconnected:', reason));\nsocket.on('connect_error', (err) => console.error('Connection error:', err));\n```\n\n```python\n@sio.event\ndef disconnect():\n    print('Disconnected')\n\n@sio.event\ndef connect_error(data):\n    print('Connection error:', data)\n```\n\n```go\n// Go client library varies; similar patterns apply.\n```\n\n### Server (All Languages)\n\n```js\nio.on('connection', (socket) => {\n  socket.on('disconnect', (reason) =>\n    console.log('Client disconnected:', reason)\n  );\n});\n```\n\n```go\nserver.OnDisconnect(\"/\", func(s socketio.Conn, reason string) {\n    fmt.Println(\"Client disconnected:\", reason)\n})\n```\n\n---\n\n## Namespaces\n\n### Client (All Languages)\n\n```js\nconst adminSocket = io('/admin');\n```\n\n```python\nsio.connect('http://localhost:3000/admin', namespaces=['/admin'])\n```\n\n### Server (All Languages)\n\n```js\nio.of('/admin').on('connection', (socket) => {\n  console.log('Admin connected:', socket.id);\n});\n```\n\n```go\nserver.Of(\"/admin\").OnConnect(func(s socketio.Conn) {\n  fmt.Println(\"Admin connected:\", s.ID())\n})\n```\n\n---\n\n## Authentication (Basic Token)\n\n### Client (All Languages)\n\n```js\nconst socket = io('http://localhost:3000', {\n  auth: { token: 'abc' }\n});\n```\n\n```python\nsio.connect('http://localhost:3000', auth={'token': 'abc'})\n```\n\n### Server (All Languages)\n\n```js\nio.use((socket, next) => {\n  const token = socket.handshake.auth.token;\n  token === 'abc' ? next() : next(new Error('Auth error'));\n});\n```\n\n---\n\n## Tips for Debugging & Logging\n\n### Client\n\n- Log events:\n\n  ```js\n  socket.onAny((event, ...args) => console.log(event, args));\n  ```\n\n- Inspect network in browser devtools.\n\n### Server\n\n- **JavaScript**\n\n  ```bash\n  DEBUG=socket.io* node server.js\n  ```\n\n- **Python**\n\n  ```python\n  import logging\n  logging.getLogger('socketio').setLevel(logging.DEBUG)\n  ```\n\n- **Go**\n  Print handler errors and use middleware for structured logs.\n\n---\n\n## Advanced Features\n\n### Middleware\n\n**Client**\n_(Rarely needed)_\n\n**Server**\n\n```js\nio.use((socket, next) => {\n  console.log('Middleware:', socket.id);\n  next();\n});\n```\n\n```go\nserver.Use(func(s socketio.Conn, next func()) {\n  fmt.Println(\"Middleware triggered:\", s.ID())\n  next()\n})\n```\n\n### Binary Streaming\n\n**Client**\n\n```js\nfetch('/file')\n  .then((res) => res.arrayBuffer())\n  .then((buf) => socket.emit('file', buf));\n```\n\n**Server**\n\n```go\nserver.OnEvent(\"/\", \"file\", func(s socketio.Conn, data []byte) {\n    ioutil.WriteFile(\"upload\", data, 0644)\n})\n```\n\n---\n\n## Best Practices\n\n# Implement reconnection with exponential backoff on the client.\n\n# Sanitize and validate all data on both sides.\n\n# Use TLS in production and rotate authentication tokens frequently.\n\n# Separate concerns with namespaces and rooms.\n\n# Throttle high-frequency events and enable compression where possible.\n\n> Official docs: [https://socket.io/docs/v4/](https://socket.io/docs/v4/)\n"
  },
  {
    "path": "source/_posts/soundcloud.md",
    "content": "---\ntitle: SoundCloud\ndate: 2022-11-23 16:23:31.705804\nbackground: bg-[#ec622b]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 22 keyboard shortcuts found on SoundCloud\n---\n\n## Keyboard Shortcuts {.cols-2}\n\n### General I\n\n| Shortcut        | Action               |\n| --------------- | -------------------- |\n| `Space`         | Play or pause        |\n| `Shift` `Right` | Play next track      |\n| `Shift` `L`     | Repeat playing track |\n| `Shift` `Left`  | Play previous track  |\n| `Right`         | Seek forward         |\n| `L`             | Like playing track   |\n| `R`             | Repost playing track |\n| `S`             | Search               |\n| `G` `L`         | Navigate to likes    |\n| `G` `C`         | Navigate to library  |\n\n{.shortcuts}\n\n### General II\n\n| Shortcut       | Action                    |\n| -------------- | ------------------------- |\n| `G` `H`        | Navigate to history       |\n| `Shift` `S`    | Shuffle                   |\n| `Shift` `Down` | Decrease volume           |\n| `Shift` `Up`   | Increase volume           |\n| `M`            | Mute volume               |\n| `Left`         | Seek backwards            |\n| `0-9`          | Seek to position          |\n| `P`            | Navigate to playing track |\n| `H`            | Show keyboard shortcuts   |\n| `G` `S`        | Navigate to stream        |\n| `G` `P`        | Navigate to profile       |\n| `Q`            | Show next up              |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for SoundCloud](https://i.imgur.com/ZQf24je.png) _(i.imgur.com)_\n"
  },
  {
    "path": "source/_posts/spotify.md",
    "content": "---\ntitle: Spotify\ndate: 2022-11-23 16:23:31.699093\nbackground: bg-[#65d46e]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 23 keyboard shortcuts found in Spotify\n---\n\n## Keyboard Shortcuts {.cols-2}\n\n### General I\n\n| Shortcut         | Action                  |\n| ---------------- | ----------------------- |\n| `Ctrl` `N`       | Create new playlist     |\n| `Ctrl` `X`       | Cut                     |\n| `Ctrl` `C`       | Copy                    |\n| `Ctrl` `Alt` `C` | Copy (alternative link) |\n| `Ctrl` `V`       | Paste                   |\n| `Del`            | Delete                  |\n| `Ctrl` `A`       | Select all              |\n| `Space`          | Play/pause              |\n| `Ctrl` `Right`   | Next track              |\n| `Ctrl` `Left`    | Previous track          |\n| `Ctrl` `Up`      | Volume up               |\n\n{.shortcuts}\n\n### General II\n\n| Shortcut              | Action                          |\n| --------------------- | ------------------------------- |\n| `Ctrl` `Down`         | Volume down                     |\n| `Ctrl` `Shift` `Down` | Mute                            |\n| `Ctrl` `Shift` `Up`   | Max volume                      |\n| `F1`                  | Show help                       |\n| `Ctrl` `F`            | Filter (in Songs and Playlists) |\n| `Ctrl` `L`            | Give focus to search field      |\n| `Alt` `Left`          | Go back                         |\n| `Alt` `Right`         | Go forward                      |\n| `Enter`               | Play selected row               |\n| `Ctrl` `P`            | Preferences                     |\n| `Ctrl` `Shift` `W`    | Logout active user              |\n| `Alt` `F4`            | Quit                            |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Spotify](https://support.spotify.com/is/using_spotify/system_settings/keyboard-shortcuts/)\n  _(support.spotify.com)_\n"
  },
  {
    "path": "source/_posts/ssh.md",
    "content": "---\ntitle: SSH\ndate: 2021-01-27 11:48:05\nbackground: bg-blue-400\ntags:\n  - protocol\n  - remote\n  - network\n  - 22\ncategories:\n  - Linux Command\nintro: |\n  This quick reference cheat sheet provides various for using SSH.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Connecting\n\nConnect to a server (default port 22)\n\n```shell script\n$ ssh root@192.168.1.5\n```\n\nConnect on a specific port\n\n```shell script\n$ ssh root@192.168.1.5 -p 6222\n```\n\nConnect via pem file (0400 permissions)\n\n```shell script\n$ ssh -i /path/file.pem root@192.168.1.5\n```\n\nSee: [SSH Permissions](/chmod#ssh-permissions)\n\n### Executing\n\nExecutes remote command\n\n```shell script\n$ ssh root@192.168.1.5 'ls -l'\n```\n\nInvoke a local script\n\n```shell script\n$ ssh root@192.168.1.5 bash < script.sh\n```\n\nCompresses and downloads from a server\n\n```shell script {.wrap}\n$ ssh root@192.168.1.5 \"tar cvzf - ~/source\" > output.tgz\n```\n\n### SCP {.row-span-2}\n\nCopies from remote to local\n\n```shell script\n$ scp user@server:/dir/file.ext dest/\n```\n\nCopies between two servers\n\n```shell script\n$ scp user@server:/file user@server:/dir\n```\n\nCopies from local to remote\n\n```shell script\n$ scp dest/file.ext user@server:/dir\n```\n\nCopies a whole folder\n\n```shell script\n$ scp -r user@server:/dir dest/\n```\n\nCopies all files from a folder\n\n```shell script\n$ scp user@server:/dir/* dest/\n```\n\nCopies from a server folder to the current folder\n\n```shell script\n$ scp user@server:/dir/* .\n```\n\n### Config location\n\n| File Path                | Description          |\n| ------------------------ | -------------------- |\n| `/etc/ssh/ssh_config`    | System-wide config   |\n| `~/.ssh/config`          | User-specific config |\n| `~/.ssh/id_{type}`       | Private key          |\n| `~/.ssh/id_{type}.pub`   | Public key           |\n| `~/.ssh/known_hosts`     | Known Servers        |\n| `~/.ssh/authorized_keys` | Authorized login key |\n\n### SCP Options\n\n| Options       | Description                                    |\n| ------------- | ---------------------------------------------- |\n| scp `-r`      | <yel>R</yel>ecursively copy entire directories |\n| scp `-C`      | <yel>C</yel>ompresses data                     |\n| scp `-v`      | Prints <yel>v</yel>erbose info                 |\n| scp `-P` 8080 | Uses a specific <yel>P</yel>ort                |\n| scp `-B`      | <yel>B</yel>atch mode _(Prevents password)_    |\n| scp `-p`      | <yel>P</yel>reserves times and modes           |\n\n### Config sample\n\n```toml\nHost server1\n    HostName 192.168.1.5\n    User root\n    Port 22\n    IdentityFile ~/.ssh/server1.key\n```\n\nLaunch by alias\n\n```shell script\n$ ssh server1\n```\n\nSee: Full [Config Options](https://linux.die.net/man/5/ssh_config)\n\n### ProxyJump\n\n```shell script\n$ ssh -J proxy_host1 remote_host2\n```\n\n```shell script {.wrap}\n$ ssh -J user@proxy_host1 user@remote_host2\n```\n\nMultiple jumps\n\n```shell script {.wrap}\n$ ssh -J user@proxy_host1:port1,user@proxy_host2:port2 user@remote_host3\n```\n\n### ssh-copy-id\n\n```shell script {.wrap}\n$ ssh-copy-id user@server\n```\n\nCopy to alias server\n\n```shell script {.wrap}\n$ ssh-copy-id server1\n```\n\nCopy specific key\n\n```shell script {.wrap}\n$ ssh-copy-id -i ~/.ssh/id_rsa.pub user@server\n```\n\n## SSH keygen {.cols-5}\n\n### ssh-keygen {.col-span-2}\n\n```shell script\n$ ssh-keygen -t rsa -b 4096 -C \"your@mail.com\"\n```\n\n---\n\n| -   | -    | -                             |\n| --- | ---- | ----------------------------- |\n|     | `-t` | [Type](#key-type) of key      |\n|     | `-b` | The number of bits in the key |\n|     | `-C` | Provides a new comment        |\n\n{.left-text}\n\nGenerate an RSA 4096 bit key with email as a comment, or use [SSH Key Generator](https://sshkeygenerator.com/) online\n\n### Generate {.col-span-2 .row-span-2}\n\nGenerate a key interactively\n\n```shell script\n$ ssh-keygen\n```\n\nSpecify filename\n\n```shell script\n$ ssh-keygen -f ~/.ssh/filename\n```\n\nGenerate public key from private key\n\n```shell script\n$ ssh-keygen -y -f private.key > public.pub\n```\n\nChange comment\n\n```shell script\n$ ssh-keygen -c -f ~/.ssh/id_rsa\n```\n\nChange private key passphrase\n\n```shell script\n$ ssh-keygen -p -f ~/.ssh/id_rsa\n```\n\n### Key type\n\n- rsa\n- ed25519\n- dsa\n- ecdsa\n\n### known_hosts {.col-span-2}\n\nSearch from known_hosts\n\n```shell script\n$ ssh-keygen -F <ip/hostname>\n```\n\nRemove from known_hosts\n\n```shell script\n$ ssh-keygen -R <ip/hostname>\n```\n\n### Key format\n\n- PEM\n- PKCS8\n\n## SSH Tunneling\n\n### SSH Tunnel Options {.row-span-2}\n\n| Option | Description                                            |\n| ------ | :----------------------------------------------------- |\n| `-L`   | Local port forwarding                                  |\n| `-R`   | Remote port forwarding                                 |\n| `-D`   | Dynamic port forwarding                                |\n| `-f`   | Run in background                                      |\n| `-N`   | Do not execute a remote command                        |\n| `-g`   | Allow remote hosts to connect to local forwarded ports |\n\n{.left-text}\n\nmore details on flag above with `man ssh`\n\n### Local Port Forwarding {.col-span-2}\n\n```bash\n# Forward a local port to a remote server\nssh -L local_port:remote_host:remote_port user@ssh_server\n\n# Example: Forward local port 8080 to remote port 80 on example.com\nssh -L 8080:example.com:80 user@ssh_server\n```\n\n### Dynamic Port Forwarding {.col-span-2}\n\n```bash\n# Create a SOCKS proxy on a local port\nssh -D local_port user@ssh_server\n\n# Create a SOCKS proxy on local port 1080 in the background\nssh -f -N -D 1080 user@ssh_server\n```\n\n### Background Tunnel {.col-span-3}\n\n```bash\n# Create a local port forwarding tunnel in the background\nssh -f -N -L local_port:remote_host:remote_port user@ssh_server\n```\n\n### Multiple Tunnels {.col-span-3}\n\n```bash\n# Create multiple tunnels in a single SSH command\nssh -L 8080:example.com:80 -L 3306:db.example.com:3306 user@ssh_server\n```\n\n### Combining Options {.col-span-3}\n\n```bash\n# In background, no command, allow remote host, local port forward, identity_file\nssh -f -N -g -L 8080:example.com:80 -i ~/.ssh/custom_key user@ssh_server\n```\n\n## Also see\n\n- [OpenSSH Config File Examples](https://www.cyberciti.biz/faq/create-ssh-config-file-on-linux-unix/) _(cyberciti.biz)_\n- [ssh_config](https://linux.die.net/man/5/ssh_config) _(linux.die.net)_\n- [man-ssh](https://man7.org/linux/man-pages/man1/ssh.1.html)\n"
  },
  {
    "path": "source/_posts/sublime-text.md",
    "content": "---\ntitle: Sublime Text\ndate: 2022-11-23 16:23:31.695666\nbackground: bg-[#e8973e]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 49 keyboard shortcuts found in Sublime Text\n---\n\n## Keyboard Shortcuts\n\n### Editing {.row-span-3}\n\n| Shortcut               | Action                                                                    |\n| ---------------------- | ------------------------------------------------------------------------- |\n| `Ctrl` `X`             | Cut line                                                                  |\n| `Ctrl` `Enter`         | Insert line after                                                         |\n| `Ctrl` `Shift` `Enter` | Insert line before                                                        |\n| `Ctrl` `Shift` `Up`    | Move line/selection up                                                    |\n| `Ctrl` `Shift` `Down`  | Move line/selection down                                                  |\n| `Ctrl` `L`             | Select line - Repeat to select next lines                                 |\n| `Ctrl` `D`             | Select word - Repeat selects other occurrences                            |\n| `Ctrl` `M`             | Jump to closing parentheses - Repeat to jump to opening parentheses       |\n| `Ctrl` `Shift` `M`     | Select all contents of the current parentheses                            |\n| `Ctrl` `Shift` `K`     | Delete line                                                               |\n| `Ctrl` `K, K`          | Delete from cursor to end of line                                         |\n| `Ctrl` `K` `Backspace` | Delete from cursor to start of line                                       |\n| `Ctrl` `]`             | Indent current line(s)                                                    |\n| `Ctrl` `[`             | Un-indent current line(s)                                                 |\n| `Ctrl` `Shift` `D`     | Duplicate line(s)                                                         |\n| `Ctrl` `J`             | Join line below to the end of the current line                            |\n| `Ctrl` `/`             | Comment/un-comment current line                                           |\n| `Ctrl` `Shift` `/`     | Block comment current selection                                           |\n| `Ctrl` `Y`             | Redo, or repeat last keyboard shortcut command                            |\n| `Ctrl` `Shift` `V`     | Paste and indent correctly                                                |\n| `Ctrl` `Space`         | Select next auto-complete suggestion                                      |\n| `Ctrl` `U`             | Soft undo; jumps to your last change before undoing, change when repeated |\n| `Alt` `Shift` `W`      | Wrap selection in HTML tag                                                |\n| `Alt` `.`              | Close current HTML tag                                                    |\n| `Alt` `Q`              | Hard wrap line to ruler column setting                                    |\n\n{.shortcuts}\n\n### Navigation\n\n| Shortcut   | Action                    |\n| ---------- | ------------------------- |\n| `Ctrl` `P` | Quick-open files by name  |\n| `Ctrl` `R` | Goto symbol               |\n| `Ctrl` `;` | Goto word in current file |\n| `Ctrl` `G` | Goto line in current file |\n\n{.shortcuts}\n\n### General\n\n| Shortcut                 | Action                   |\n| ------------------------ | ------------------------ |\n| `Ctrl` `Shift` `P`       | Command prompt           |\n| `Ctrl` `K, B`            | Toggle sidebar           |\n| `Ctrl` `Shift` `Alt` `P` | Show scope in status bar |\n\n{.shortcuts}\n\n### Find/Replace\n\n| Shortcut           | Action        |\n| ------------------ | ------------- |\n| `Ctrl` `F`         | Find          |\n| `Ctrl` `H`         | Replace       |\n| `Ctrl` `Shift` `F` | Find in files |\n\n{.shortcuts}\n\n### Split window\n\n| Shortcut             | Action                                           |\n| -------------------- | ------------------------------------------------ |\n| `Alt` `Shift` `1`    | Revert view to single column                     |\n| `Alt` `Shift` `2`    | Split view into two columns                      |\n| `Alt` `Shift` `3`    | Split view into three columns                    |\n| `Alt` `Shift` `4`    | Split view into four columns                     |\n| `Alt` `Shift` `5`    | Set view to grid (4 groups)                      |\n| `Alt` `Shift` `8`    | Split view into two rows                         |\n| `Ctrl` `1-4`         | Jump to group where number is 1-4                |\n| `Ctrl` `Shift` `1-4` | Move file to specified group where number is 1-4 |\n\n{.shortcuts}\n\n### Bookmarks\n\n| Shortcut            | Action            |\n| ------------------- | ----------------- |\n| `Ctrl` `F2`         | Toggle bookmark   |\n| `F2`                | Next bookmark     |\n| `Shift` `F2`        | Previous bookmark |\n| `Ctrl` `Shift` `F2` | Clear bookmarks   |\n\n{.shortcuts}\n\n### Text manipulation\n\n| Shortcut      | Action                 |\n| ------------- | ---------------------- |\n| `Ctrl` `K, U` | Transform to uppercase |\n| `Ctrl` `K, L` | Transform to lowercase |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Sublime Text](http://docs.sublimetext.info/en/latest/reference/keyboard_shortcuts_win.html)\n  _(docs.sublimetext.info)_\n"
  },
  {
    "path": "source/_posts/superhuman.md",
    "content": "---\ntitle: Superhuman\ndate: 2022-11-23 16:23:31.694365\nbackground: bg-[#6bafe2]\nlabel: Mac\ntags:\n  -\n  - mac\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 105 keyboard shortcuts found in Superhuman. This application is MacOS-only.\n---\n\n## Keyboard Shortcuts\n\n### Actions\n\n| Shortcut      | Action              |\n| ------------- | ------------------- |\n| `Cmd` `K`     | Superhuman command  |\n| `/`           | Search              |\n| `Z`           | Undo                |\n| `?`           | Shortcuts           |\n| `X`           | Select conversation |\n| `Shift` `J/K` | Add to selection    |\n\n{.shortcuts}\n\n### Filters\n\n| Shortcut    | Action    |\n| ----------- | --------- |\n| `Shift` `U` | Unread    |\n| `Shift` `S` | Starred   |\n| `Shift` `I` | Important |\n| `Shift` `R` | No reply  |\n\n{.shortcuts}\n\n### Messages\n\n| Shortcut    | Action                        |\n| ----------- | ----------------------------- |\n| `C`         | Compose                       |\n| `Enter`     | Reply all                     |\n| `R`         | Reply                         |\n| `F`         | Forward                       |\n| `Cmd` `O`   | Open links and attachments    |\n| `Tab`       | Cycle through links and dates |\n| `O`         | Expand message                |\n| `Shift` `O` | Expand all messages           |\n\n{.shortcuts}\n\n### Conversations\n\n| Shortcut    | Action                 |\n| ----------- | ---------------------- |\n| `E`         | Mark done (archive)    |\n| `Shift` `E` | Mark as not done       |\n| `H`         | Remind me (snooze)     |\n| `S`         | Star                   |\n| `U`         | Mark as read or unread |\n| `Shift` `3` | Trash                  |\n| `Shift` `1` | Mark as spam           |\n| `Shift` `M` | Mute                   |\n| `Cmd` `U`   | Unsubscribe            |\n\n{.shortcuts}\n\n### Folders (Press keys separately)\n\n| Shortcut | Action                   |\n| -------- | ------------------------ |\n| `G` `I`  | Go to inbox or important |\n| `G` `O`  | Go to other              |\n| `G` `S`  | Go to starred            |\n| `G` `D`  | Go to drafts             |\n| `G` `T`  | Go to sent mail          |\n| `G` `E`  | Go to done               |\n| `G` `H`  | Go to reminders          |\n| `G` `M`  | Go to muted              |\n| `G` `;`  | Go to snippets           |\n| `G` `!`  | Go to spam               |\n| `G` `#`  | Go to trash              |\n| `G` `A`  | Go to all mail           |\n| `G` `L`  | Go to label              |\n\n{.shortcuts}\n\n### Format\n\n| Shortcut          | Action          |\n| ----------------- | --------------- |\n| `Cmd` `B`         | Bold            |\n| `Cmd` `I`         | Italics         |\n| `Cmd` `U`         | Underline       |\n| `Cmd` `K`         | Hyperlink       |\n| `Cmd` `O`         | Color           |\n| `Cmd` `Shift` `X` | Strikethrough   |\n| `Cmd` `Shift` `7` | Numbers         |\n| `Cmd` `Shift` `8` | Bullets         |\n| `Cmd` `Shift` `9` | Quote           |\n| `Tab`             | Indent list     |\n| `Shift` `Tab`     | Outdent list    |\n| `Cmd` `]`         | Increase indent |\n| `Cmd` `[`         | Decrease indent |\n\n{.shortcuts}\n\n### Labels\n\n| Shortcut    | Action                 |\n| ----------- | ---------------------- |\n| `L`         | Add or remove a label  |\n| `Y`         | Remove label           |\n| `[`         | Remove label, next     |\n| `]`         | Remove label, previous |\n| `Shift` `Y` | Remove all labels      |\n| `V`         | Move                   |\n\n{.shortcuts}\n\n### Calendar\n\n| Shortcut | Action          |\n| -------- | --------------- |\n| `0`      | Toggle calendar |\n| `-`      | Previous day    |\n| `=`      | Next day        |\n\n{.shortcuts}\n\n### Navigation {.row-span-2}\n\n| Shortcut             | Action                        |\n| -------------------- | ----------------------------- |\n| `Up/Down/Left/Right` | Superhuman focus              |\n| `Tab`                | Next split                    |\n| `Shift` `Tab`        | Previous split                |\n| `Enter`              | Open conversation             |\n| `J/K`                | Next or previous conversation |\n| `N/P`                | Next or previous message      |\n| `Space`              | Scroll down                   |\n| `Shift` `Space`      | Scroll up                     |\n| `Cmd` `Up/Down`      | Jump to the top or bottom     |\n| `Cmd` `N`            | New window                    |\n| `Cmd` `T`            | New tab                       |\n| `Cmd` `Shift` `]`    | Next tab                      |\n| `Cmd` `Shift` `[`    | Previous tab                  |\n| `Cmd` `1/2/3`        | Switch tabs                   |\n| `Cmd` `W`            | Close tab                     |\n| `Ctrl` `1/2/3`       | Switch accounts               |\n| `Cmd` `=`            | Increase font size            |\n| `Cmd` `-`            | Decrease font size            |\n| `Cmd` `0`            | Reset font size               |\n| `Ctrl` `/`           | Copy page link                |\n| `Esc`                | Back                          |\n\n{.shortcuts}\n\n### Pop Out Compose\n\n| Shortcut          | Action                     |\n| ----------------- | -------------------------- |\n| `Cmd` `Shift` `P` | Pop draft in or out        |\n| `Shift` `R`       | Pop out reply              |\n| `Shift` `Enter`   | Pop out reply-all          |\n| `Shift` `C`       | Pop out new message        |\n| `Shift` `F`       | Pop out forward            |\n| `Cmd` `/`         | Pop out a draft and search |\n| `Cmd` `D`         | Switch to or from a draft  |\n\n{.shortcuts}\n\n### Compose\n\n| Shortcut              | Action               |\n| --------------------- | -------------------- |\n| `Cmd` `Shift` `O`     | To                   |\n| `Cmd` `Shift` `C`     | CC                   |\n| `Cmd` `Shift` `B`     | BCC                  |\n| `Cmd` `Shift` `F`     | From                 |\n| `Cmd` `Shift` `S`     | Edit subject         |\n| `Cmd` `Shift` `M`     | Edit message         |\n| `Cmd` `Shift` `A`     | Attach               |\n| `Cmd` `Shift` `,`     | Discard draft        |\n| `Cmd` `Shift` `I`     | Move contacts to BCC |\n| `Cmd` `Shift` `H`     | Remind me            |\n| `Cmd` `Shift` `L`     | Send later           |\n| `Cmd` `;`             | Use snippet          |\n| `Cmd` `Enter`         | Send                 |\n| `Cmd` `Shift` `Enter` | Send and mark done   |\n| `Cmd` `Shift` `Z`     | Instant send         |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Superhuman](https://download.superhuman.com/Superhuman%20Keyboard%20Shortcuts.pdf)\n  _(download.superhuman.com)_\n"
  },
  {
    "path": "source/_posts/svelte.md",
    "content": "---\ntitle: Svelte\ndate: 2025-08-16 10:30:00\nbackground: bg-[#FF3E00]\ntags:\n  - svelte\n  - web\ncategories:\n  - Programming\nintro: |\n  A Svelte cheat sheet with the most important concepts, functions, reactivity, and more. A complete quick reference for beginners, updated for Svelte 5.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### Basic Syntax\n\n```js\n<script>\n  let name = 'world';\n</script>\n\n<h1>Hello {name}!</h1>\n```\n\n### Expressions\n\n```js\n<script>\n  let firstName = \"Zehan\";\n  let lastName = \"Khan\";\n\n  function fullName() {\n    return `${firstName} ${lastName}`;\n  }\n</script>\n\n<h1>Hello {fullName()}!</h1>\n```\n\n### Attributes\n\n```js\n<script>\n  let avatarUrl = 'https://example.com/avatar.png';\n</script>\n\n<img src={avatarUrl} alt=\"Avatar\" />\n<button class=\"btn\">Click me</button>\n```\n\n### Functions in Markup\n\n```js\n<script>\n  function name() {\n    return \"Zehan\";\n  }\n</script>\n\n<h1>Hi {name()}!</h1>\n```\n\n### Conditional Rendering {.col-span-2}\n\n```js\n<script>\n  let temperature = 24;\n  let city = \"New York\";\n</script>\n\n{#if temperature >= 20}\n  <p>It is {temperature}°C (Warm) in {city}</p>\n{:else}\n  <p>It is {temperature}°C in {city}</p>\n{/if}\n```\n\nNote: Svelte components must always return a root element or content.\n\n## Components\n\n### Functional Component\n\n```js\n<script>\n  let { name = \"User\" } = $props();\n</script>\n\n<div class=\"UserProfile\">\n  <div>Hello</div>\n  <div>{name}</div>\n</div>\n```\n\n### Embed an internal Component\n\n```js\n<script>\n  import UserAvatar from './UserAvatar.svelte';\n</script>\n\n<div class=\"UserProfile\">\n  <UserAvatar />\n  <UserAvatar />\n</div>\n```\n\n### Embed an external Component\n\n```js\n<script>\n  import ComponentName from 'some-library';\n</script>\n\n<div class=\"UserProfile\">\n  <ComponentName />\n</div>\n```\n\nNote: External components should be installed via npm first.\n\n### Advanced Functional Components\n\n```js\n<script>\n  let { firstName, lastName } = $props();\n\n  function fullName() {\n    return `${firstName} ${lastName}`;\n  }\n</script>\n\n<p>{fullName()}</p>\n```\n\n## Properties {.cols-2}\n\n### Passing Properties to a Component\n\n```js\n<Student firstName=\"Zehan\" lastName=\"Khan\" age={23} pro={true} />\n```\n\n### Assigning the Properties from a Component\n\n```js\n<script>\n  let { firstName, lastName, age } = $props();\n</script>\n\n<h1>{firstName} {lastName} is {age}.</h1>\n```\n\n## State {.cols-1}\n\n### Local State\n\n```js\n<script>\n  let name = $state(\"Zehan\");\n\n  function updateName() {\n    name = prompt(\"What is your name?\") || name;\n  }\n</script>\n\n<h1>{name}</h1>\n<button onclick={updateName}>Update name</button>\n```\n\n## Events {.cols-1}\n\n### Event Listener\n\n```js\n<script>\n  function handleClick(event) {\n    event.preventDefault();\n    alert(\"Hello World\");\n  }\n</script>\n\n<a href=\"#\" onclick|preventDefault={handleClick}>\n  Say Hi\n</a>\n```\n\nNote: The most common event listeners are `onclick` and `onsubmit`.\n\n## Loops {.cols-2}\n\n### Looping through an Array\n\n```js\n<script>\n  let elements = [\"one\", \"two\", \"three\"];\n</script>\n\n<ul>\n  {#each elements as value, index}\n    <li>{value}</li>\n  {/each}\n</ul>\n```\n\n### Looping through an Array of Objects\n\n```js\n<script>\n  let elements = [\n    { name: \"one\", value: 1 },\n    { name: \"two\", value: 2 },\n    { name: \"three\", value: 3 }\n  ];\n</script>\n\n<ul>\n  {#each elements as element, index}\n    <li>\n      The value for {element.name} is {element.value}\n    </li>\n  {/each}\n</ul>\n```\n\n## Forms {.cols-1}\n\n### Form Example\n\n```js\n<script>\n  let username = $state(\"\");\n  let password = $state(\"\");\n\n  function handleSubmit(event) {\n    event.preventDefault();\n    alert(`Logging in with ${username} and ${password}`);\n  }\n</script>\n\n<form onsubmit={handleSubmit}>\n  <input type=\"text\" placeholder=\"Username\" bind:value={username} />\n  <input type=\"password\" placeholder=\"Password\" bind:value={password} />\n  <input type=\"submit\" value=\"Login\" />\n</form>\n```\n\n## CSS {.cols-1}\n\n### Scoped CSS\n\n```js\n<style>\n  .student {\n    color: blue;\n  }\n</style>\n\n<div class=\"student\">Zehan Khan</div>\n```\n\n## Fetching Data {.cols-1}\n\n### Fetching Data with onMount\n\n```js\n<script>\n  import { onMount } from 'svelte';\n  let notifications = [];\n  let loading = $state(true);\n\n  onMount(async () => {\n    const res = await fetch(\"https://notifications.com\");\n    notifications = await res.json();\n    loading = false;\n  });\n</script>\n\n{#if loading}\n  <p>Loading notifications...</p>\n{:else}\n  <ul>\n    {#each notifications as note}\n      <li>{note.title}</li>\n    {/each}\n  </ul>\n{/if}\n```\n\nNote: Use `onMount` for side effects like API calls.\n\n## Lifecycle Hooks {.cols-1}\n\n### onMount\n\n```js\n<script>\n  import { onMount } from 'svelte';\n\n  onMount(() => {\n    console.log('Component mounted');\n  });\n</script>\n```\n\n### beforeUpdate\n\n```js\n<script>\n  import { beforeUpdate } from 'svelte';\n\n  beforeUpdate(() => {\n    console.log('Before component updates');\n  });\n</script>\n```\n\n### afterUpdate\n\n```js\n<script>\n  import { afterUpdate } from 'svelte';\n\n  afterUpdate(() => {\n    console.log('After component updates');\n  });\n</script>\n```\n\n### onDestroy\n\n```js\n<script>\n  import { onDestroy } from 'svelte';\n\n  onDestroy(() => {\n    console.log('Component destroyed');\n  });\n</script>\n```\n\nNote: Svelte lifecycle functions are similar to React Hooks, but they are imported individually and used directly in the\n`<script>` block.\n\n## More Svelte Features {.cols-1}\n\n### Derived Store\n\n```js\n// store.js\nimport { writable, derived } from 'svelte/store';\n\nexport const count = writable(0);\nexport const double = derived(count, ($count) => $count * 2);\n```\n\n```js\n// App.svelte\n<script>\n  import { count, double } from './store.js';\n</script>\n\n<p>Count: {$count}</p>\n<p>Double: {$double}</p>\n```\n\n### Readable Store\n\n```js\nimport { readable } from 'svelte/store';\n\nexport const time = readable(new Date(), function start(set) {\n  const interval = setInterval(() => {\n    set(new Date());\n  }, 1000);\n\n  return function stop() {\n    clearInterval(interval);\n  };\n});\n```\n\n### Reactive Declarations\n\n```js\n<script>\n  let a = $state(2);\n  let b = $state(3);\n  let sum = $derived(a + b);\n</script>\n\n<p>{sum}</p>\n```\n\n### Reactive Statements with Side Effects\n\n```js\n<script>\n  let name = 'Zehan';\n  $effect(() => console.log('Name changed to', name));\n</script>\n```\n\n### Bind to DOM Properties\n\n```js\n<script>\n  let text = $state('');\n</script>\n\n<textarea bind:value={text} />\n<p>{text.length} characters</p>\n```\n\n### Bind Grouped Inputs (Radio, Checkbox)\n\n```js\n<script>\n  let selected = $state('apple');\n</script>\n\n<label><input type=\"radio\" bind:group={selected} value=\"apple\" /> Apple</label>\n<label><input type=\"radio\" bind:group={selected} value=\"orange\" /> Orange</label>\n<p>Selected: {selected}</p>\n```\n\n### Class and Style Directives\n\n```js\n<script>\n  let isActive = true;\n</script>\n\n<div class:active={isActive}>Toggle me</div>\n```\n\n```js\n<script>\n  let size = 16;\n</script>\n\n<p style:font-size={`${size}px`}>Resizable text</p>\n```\n\n### Await Blocks\n\n```js\n<script>\n  let userPromise = fetch('https://jsonplaceholder.typicode.com/users/1')\n    .then(res => res.json());\n</script>\n\n{#await userPromise}\n  <p>Loading...</p>\n{:then user}\n  <p>{user.name}</p>\n{:catch error}\n  <p>Error: {error.message}</p>\n{/await}\n```\n\n### SSR with SvelteKit (Basic Example)\n\n```js\n// +page.server.js\nexport async function load({ fetch }) {\n  const res = await fetch('/api/data');\n  const data = await res.json();\n  return { data };\n}\n```\n\n```js\n// +page.svelte\n<script>\n  let { data } = $props();\n</script>\n\n<h1>{data.title}</h1>\n```\n\nNote: Requires SvelteKit setup for SSR routes.\n"
  },
  {
    "path": "source/_posts/swift.md",
    "content": "---\ntitle: Swift\ndate: 2023-02-28 14:50:01\nbackground: bg-[#eb4e38]\ntags:\n  - Apple\n  - iOS\n  - iPadOS\ncategories:\n  - Programming\nintro: |\n  This cheat sheet provides examples of using Swift that cover basic Swift knowledge, control flow etc.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Variable {.row-span-2}\n\n```swift\nvar score = 0  // Variable\nlet pi = 3.14  // Constant\n\nvar greeting = \"Hello\"\nvar numberOfToys = 8\nvar isMorning = true\n\nvar numberOfToys: Int = 8\nnumberOfToys += 1\n\nprint(numberOfToys)\n// prints \"9\"\n```\n\n### Type annotations\n\n```swift\nvar greeting: String = \"Hello\"\nvar numberOfToys: Int = 8\nvar isMorning: Bool = true\nvar price: Double = 8.99\n```\n\n### Arithmetic operators {.row-span-3}\n\n- `+` Add\n- `-` Subtraction\n- `*` Multiplication\n- `/` Division\n- `%` Remainder\n\n{.cols-2 .marker-none}\n\n---\n\n```swift\nvar x = 0\nx = 4 + 2 // x is now 6\nx = 4 - 2 // x is now 2\nx = 4 * 2 // x is now 8\nx = 4 / 2 // x is now 2\nx = 4 % 2 // x is now 0\n```\n\n---\n\n- `+=` Adds and assigns sums\n- `-=` subtract and assign the difference\n- `*=` Multiplication and assignment\n- `/=` Divide and assign quotient\n- `%=` Divide and assign remainder\n\n{.marker-none}\n\n#### Compound Assignment Operators\n\n```swift\nvar numberOfDogs = 100\nnumberOfDogs += 1\nprint(\"There are \\(numberOfDogs) Dalmatians!\")\n\n// print: There are 101 Dalmatians!\n```\n\n### String interpolation\n\n```swift\nvar apples = 6\nprint(\"I have \\(apples) apples!\")\n\n// print: I have 6 apples!\n```\n\n### Multi-line string\n\n```swift\nlet myLongString = \"\"\"\nSwift?\nThis is my favorite language!\nYeah!\n\"\"\"\n```\n\n### Code Comments\n\n```swift\n// This line represents a comment in Swift.\n\n/*\nThis is all commented out.\nNone will run!\n*/\n```\n\n### Form a tuple {.col-span-2}\n\n```swift\nlet player = (\"Maya\", 5, 150)\n\nprint(player) // (\"Maya\", 5, 150)\nprint(\"\\(player.0): level \\(player.1), \\(player.2) pts\") // Maya: level 5, 150 pts\n```\n\n### Decompose tuple\n\n```swift\nlet player = (name: \"Maya\", level: 5)\nlet (currentName, curLevel) = player\nprint(\"\\(currentName): level \\(curLevel)\")\n// print: Maya: level 5\n```\n\n### Special comment syntax (MARK)\n\n```swift\n// MARK: -view settings\n```\n\n`MARK` can be used to display comments in the column\n\n### Special comment syntax (TODO)\n\n```swift\n// TODO: update logic to accommodate data changes\n```\n\n`TODO` is used to display reminders of things that need to be done\n\n### Special Comment Syntax (FIXME)\n\n```swift\n// FIXME: Fix buggy behavior when making changes to existing entries\n```\n\n`FIXME` is used to display reminders about things that need to be fixed\n\n## Variable\n\n### Variable declaration\n\nVariables are declared with `var`:\n\n```swift\nvar greeting = \"Hello\"\nvar numberOfToys = 8\nvar isMorning = true\n```\n\nFor clarity, variable declarations can contain type annotations:\n\n```swift\nvar greeting: String = \"Hello\"\nvar numberOfToys: Int = 8\nvar isMorning: Bool = true\n```\n\nVariables are mutable. Their values be changed:\n\n```swift\nvar numberOfToys: Int = 8\nnumberOfToys += 1\n\nprint(numberOfToys)\n// print \"9\"\n```\n\n### Constants\n\nConstants are declared with `let`:\n\n```swift\nlet greeting = \"Hello\"\nlet numberOfToys = 8\nlet isMorning = true\n```\n\nFor clarity, constant declarations can contain type annotations:\n\n```swift\nlet greeting: String = \"Hello\"\nlet numberOfToys: Int = 8\nlet isMorning: Bool = true\n```\n\nConstants are immutable. Their values can not be changed:\n\n```swift\nlet numberOfToys: Int = 8\nnumberOfToys += 1\n// Error: numberOfToys is immutable\n```\n\n### Computed variables (get and set) {.row-span-3}\n\n```swift\nimport Foundation\n\nlet df = DateFormatter()\ndf.dateFormat = \"d MMMM yyyy\"\n\nguard var birth = df.date(from: \"5 June 1999\") else {\n    print(\"Date is not valid\")\n    return\n}\n\nvar age: Int {\n    Calendar.current\n        .dateComponents([.year],\n                        from: birth,\n                        to: Date()).year!\n}\n\nprint(age) // 23\nguard let birth2 = df.date(from: \"5 June 2002\") else {\n    print(\"Date is not valid\")\n    return\n}\nbirth = birth2\nprint(age) // 20\n```\n\nIn the example below, distanceInFeet has a `getter` and a `setter`. Because of the `setter`, the `getter` requires the\nkeyword `get`:\n\n```swift\nvar distanceInMeters: Float = 100\n\nvar distanceInFeet: Float {\n  get {\n    distanceInMeters *3.28\n  }\n  set(newDistance) {\n    distanceInMeters = newDistance /3.28\n  }\n}\n\nprint(distanceInMeters) // 100.0\nprint(distanceInFeet)   // 328.0\n\ndistanceInFeet = 250\nprint(distanceInMeters) // 76.21951\nprint(distanceInFeet)   // 250.0\n\ndistanceInMeters = 800\nprint(distanceInMeters) // 800.0\nprint(distanceInFeet)   // 2624.0\n```\n\n### willSet {.row-span-2}\n\n```swift\nvar distance = 5 {\n  willSet {\n    print(\"The distance will be set\")\n  }\n}\n\ndistance = 10 // print: distance will be set\n```\n\nThe new value can be accessed in `willSet`:\n\n```swift\nvar distance = 5 {\n  willSet(newDistance) {\n    print(\"The distance will be set \\(newDistance)\")\n  }\n}\n\ndistance = 10 // print: distance will be set to 10\n```\n\n`willSet` can be used to execute some code before setting the variable value\n\n### didSet\n\n```swift\nvar distance = 5 {\n  didSet {\n    print(\"The distance is set to \\(distance)\")\n    print(\"Its old value is: \\(oldValue)\")\n  }\n}\ndistance = 10 // print: distance will be set to 10\n              // print: its old value is: 5\n```\n\n### willSet and didSet\n\n```swift\nvar distance = 5 {\n  willSet(newDistance) {\n    print(\"The distance will be set to \\(newDistance)\")\n  }\n  didSet {\n    print(\"The distance is set to \\(distance)\")\n    print(\"Its old value is: \\(oldValue)\")\n  }\n}\ndistance = 10\n```\n\n## Conditions\n\n### if statement\n\n```swift\nvar halloween = true\nif halloween {\n  print(\"Trick or treat!\")\n}\n// print: Trick or treat!\nif 5 > 3 {\n  print(\"5 is greater than 3\")\n} else {\n  print(\"5 is not more than 3\")\n}\n// output: \"5 is greater than 3\"\n```\n\n### else statement\n\n```swift\nvar turbulence = false\n\nif turbulence {\n  print(\"Please sit down.\")\n} else {\n  print(\"You are free to move around.\")\n}\n// print: You are free to move around.\n```\n\n### else if statement\n\n```swift\nvar weather = \"rainy\"\nif weather == \"sunny\" {\n  print(\"Get some sunscreen\")\n} else if weather == \"rainy\" {\n  print(\"Take an umbrella\")\n} else if weather == \"snowing\" {\n  print(\"Put on your snow boots\")\n} else {\n  print(\"Invalid weather\")\n}\n// print: take an umbrella\n```\n\n### Comparison Operators\n\n```swift\n5 > 1      // true\n6 < 10     // true\n2 >= 3     // false\n3 <= 5     // true\n\"A\" == \"a\" // false\n\"B\" != \"b\" // true\n```\n\n-`<` less than <br> -`>` greater than <br> -`<=` less than or equal to <br> -`>=` greater than or equal to <br> -`==` is\nequal to <br> -`!=` is not equal to\n\n### Range Operators\n\n```swift\na...b      // numbers between a and b (including both a and b)\na..<b      // numbers between a and b (including a but excluding b)\n...b      // numbers till b (including b)\n```\n\n-`a...b` Closed Range <br> -`a..<b` Half-Open Range <br> -`...b` One-Sided Range\n\n### Ternary conditional operator\n\n```swift\nvar driverLicense = true\n\ndriverLicense\n    ? print(\"driver seat\") : print(\"passenger seat\")\n// print: driver's seat\n```\n\n### switch statement\n\n```swift\nvar secondaryColor = \"green\"\n\nswitch secondaryColor {\n  case \"orange\":\n    print(\"A mixture of red and yellow\")\n  case \"purple\":\n    print(\"A mix of red and blue\")\n  default:\n    print(\"This may not be a secondary color\")\n}\n// print: mix of blue and yellow\n```\n\n### switch statement: interval matching\n\n```swift\nlet year = 1905\nvar artPeriod: String\n\nswitch year {\n  case 1860...1885:\n    artPeriod = \"Impressionism\"\n  case 1886...1910:\n    artPeriod = \"Post-Impressionism\"\n  default:\n    artPeriod = \"Unknown\"\n}\n// print: post-impressionism\n```\n\n### switch statement: composite case\n\n```swift\nlet service = \"Seamless\"\n\nswitch service {\ncase \"Uber\", \"Lyft\":\n    print(\"travel\")\n  case \"DoorDash\", \"Seamless\", \"GrubHub\":\n    print(\"Restaurant delivery\")\n  case \"Instacart\", \"FreshDirect\":\n    print(\"Grocery Delivery\")\n  default:\n    print(\"Unknown service\")\n}\n// print: restaurant takeaway\n```\n\n### switch statement: where clause\n\n```swift\nlet num = 7\n\nswitch num {\n  case let x where x % 2 == 0:\n    print(\"\\(num) is even\")\n  case let x where x % 2 == 1:\n    print(\"\\(num) odd number\")\n  default:\n    print(\"\\(num) is invalid\")\n}\n\n// print: 7 odd\n```\n\n### Logical Operators\n\n```swift\n!true  // false\n!false //true\n```\n\n### Logical Operators &&\n\n```swift\ntrue && true   // true\ntrue && false  // false\nfalse && true  // false\nfalse && false // false\n```\n\n### Logical operators ||\n\n```swift\ntrue || true   // true\ntrue || false  // true\nfalse || true  // true\nfalse || false // false\n```\n\n### Combined Logical Operators\n\n```swift\n!false && true || false // true\n```\n\n`!false && true` first evaluates and returns `true` Then, the expression, `true` || `false` evaluates and returns the\nfinal result `true`\n\n```swift\nfalse || true && false // false\n```\n\n`true && false` first evaluates to return `false` Then, the expression, `false` || `false` evaluates and returns the\nfinal result `false`\n\n### Control the order of execution\n\n```swift\n\n// without parentheses:\ntrue || true && false || false\n//----> true\n\n// with brackets:\n(true || true) && (false || false)\n//----> false\n\n```\n\n### Simple guards\n\n```swift\nfunc greet(name: String?) {\n  guard let unwrapped = name else {\n    print(\"Hello guest!\")\n    return\n  }\n  print(\"Hello \\(unwrapped)!\")\n}\ngreet(name: \"Asma\") // output: Hello Asma!\ngreet(name: nil)    // output: Hello guest!\n```\n\n## cycle\n\n### scope\n\n```swift\nlet zeroToThree = 0...3\n//zeroToThree: 0, 1, 2, 3\n```\n\n### stride() function\n\n```swift\nfor oddNum in stride(from: 1, to: 5, by: 2) {\n  print(oddNum)\n}\n// print: 1\n// print: 3\n```\n\n### for-in loop\n\n```swift\nfor char in \"hehe\" {\n  print(char)\n}\n// print: h\n// print: e\n// print: h\n// print: e\n```\n\n### continue keyword\n\n```swift\nfor num in 0...5 {\n  if num % 2 == 0 {\n    continue\n  }\n  print(num)\n}\n// print: 1\n// print: 3\n// print: 5\n```\n\nThe `continue` keyword will force the loop to continue for the next iteration\n\n### break keyword\n\n```swift\nfor char in \"supercalifragilistic\" {\nif char == \"c\" {\n    break\n  }\n  print(char)\n}\n// print: s\n// print: u\n// print: p\n// print: e\n// print: r\n```\n\n### Use underscores\n\n```swift\nfor _ in 1...3 {\n  print(\"Ole\")\n}\n// print: Ole\n// print: Ole\n// print: Ole\n```\n\n### while loop\n\n```swift\nvar counter = 1\nvar stopNum = Int.random(in: 1...10)\n\nwhile counter < stopNum {\n  print(counter)\n  counter += 1\n}\n// loop to print until the stop condition is met\n```\n\nA `while` loop accepts a condition and keeps executing its body code while the provided condition is `true`. If the\ncondition is never false, the loop will keep running and the program will get stuck in an `infinite loop`\n\n## Arrays and collections\n\n### Array\n\n```swift\nvar scores = [Int]()\n// array is empty: []\n```\n\n### .count property\n\n```swift\nvar grocery = [\"🥓\", \"🥞\", \"🍪\", \"🥛\", \"🍊\"]\nprint(grocery.count)\n// print: 5\n```\n\n### index {.row-span-2}\n\nThe index refers to the item's position in the ordered list, and a single element is retrieved from the array using the\nsubscript syntax `array[index]`.\n\n```swift\nvar vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\nprint(vowels[0]) // prints: a\nprint(vowels[1]) // prints: e\nprint(vowels[2]) // print: i\nprint(vowels[3]) // prints: o\nprint(vowels[4]) // prints: u\n```\n\nNote: Swift arrays are zero-indexed, meaning the first element has index 0.\n\n### Initialize with array literal\n\n```swift\n// use type inference:\nvar snowfall = [2.4, 3.6, 3.4, 1.8, 0.0]\n// explicit type:\nvar temp: [Int] = [33, 31, 30, 38, 44]\n```\n\n### Initialize with default value\n\n```swift\nvar teams = [Int](repeating: 0, count: 3)\nprint(teams) // prints: [0, 0, 0]\n// or with Array type\nvar sizes = Array<Int>(repeating: 0, count: 3)\nprint(sizes) // prints: [0, 0, 0]\n```\n\n### .append() method and += operator\n\n```swift\nvar gymBadges = [\"Boulder\", \"Cascade\"]\ngymBadges.append(\"Thunder\")\ngymBadges += [\"Rainbow\", \"Soul\"]\n// [\"Boulder\", \"Cascade\", \"Thunder\",\n// \"Rainbow\", \"Soul\"]\n```\n\n### .insert() and .remove() methods\n\n```swift\nvar moon = [\"🌖\", \"🌗\", \"🌘\", \"🌑\"]\nmoon.insert(\"🌕\", at: 0)\n// [\"🌕\", \"🌖\", \"🌗\", \"🌘\", \"🌑\"]\n\nmoon.remove(at: 4)\n// [\"🌕\", \"🌖\", \"🌗\", \"🌘\"]\n```\n\n### Iterate over an array\n\n```swift\nvar employees = [\"Peter\", \"Denial\", \"Jame\"]\nfor person in employees {\n  print(person)\n}\n// print: Peter\n// print: Denial\n// print: Jam\n```\n\n### Collection (Set)\n\n```swift\nvar paintingsInMOMA: Set = [\n  \"The Dream\",\n  \"The Starry Night\",\n  \"The False Mirror\"\n]\n```\n\nWe can use a collection (`Set`) to store `unique` elements of the same data type\n\n### Empty collection (Set)\n\n```swift\nvar team = Set<String>()\n\nprint(team)\n// print: []\n```\n\n### Populate the collection\n\n```swift\nvar vowels: Set = [\"a\", \"e\", \"i\", \"o\",\"u\"]\n```\n\nTo create a set filled with values, use the `Set` keyword before the assignment operator.\n\n### .insert()\n\n```swift\nvar cookieJar: Set = [\n  \"Chocolate Chip\",\n  \"Oatmeal Raisin\"\n]\n// add a new element\ncookieJar.insert(\"Peanut Butter Chip\")\n```\n\n### .remove() and .removeAll() methods\n\n```swift\nvar oddNumbers: Set = [1, 2, 3, 5]\n\n// remove existing element\noddNumbers.remove(2)\n// remove all elements\noddNumbers.removeAll()\n```\n\n### .contains()\n\n```swift\nvar names: Set = [\"Rosa\", \"Doug\", \"Waldo\"]\nprint(names.contains(\"Lola\")) // print: false\n\nif names.contains(\"Waldo\"){\n  print(\"There's Waldo!\")\n} else {\n  print(\"Where's Waldo?\")\n}\n// print: There's Waldo!\n```\n\n### .isEmpty property\n\n```swift\nvar emptyList = [String]()\nprint(emptyList.isEmpty)     // print: true\n\nvar populatedList: [Int] = [1, 2, 3]\nprint(populatedList.isEmpty) // print: false\n```\n\n### Iterate over a collection\n\n```swift\nvar recipe: Set = [\"Egg\", \"Flour\", \"Sugar\"]\n\nfor ingredient in recipe {\n  print (\"Include \\(ingredient) in the recipe\")\n}\n```\n\n### .isEmpty property\n\n```swift\nvar emptySet = Set<String>()\nprint(emptySet.isEmpty)     // print: true\n\nvar populatedSet: Set = [1, 2, 3]\nprint(populatedSet.isEmpty) // print: false\n```\n\n### .count property\n\n```swift\nvar band: Set = [\"Peter\", \"Denial\", \"Jame\"]\n\nprint(\"The band has \\(band.count) players.\")\n// print: Band has 4 players.\n```\n\n### .intersection() Intersection\n\n```swift\nvar setA: Set = [\"A\", \"B\", \"C\", \"D\"]\nvar setB: Set = [\"C\", \"D\", \"E\", \"F\"]\n\nvar setC = setA.intersection(setB)\nprint(setC) // print: [\"D\", \"C\"]\n```\n\n### .union()\n\n```swift\nvar setA: Set = [\"A\", \"B\", \"C\", \"D\"]\nvar setB: Set = [\"C\", \"D\", \"E\", \"F\"]\n\nvar setC = setA.union(setB)\nprint(setC)\n// print: [\"B\", \"A\", \"D\", \"F\", \"C\", \"E\"]\n```\n\n### .symmetricDifference() Symmetric difference\n\n```swift\nvar setA: Set = [\"A\", \"B\", \"C\", \"D\"]\nvar setB: Set = [\"C\", \"D\", \"E\", \"F\"]\n\nvar setC = setA.symmetricDifference(setB)\nprint(setC)\n// print: [\"B\", \"E\", \"F\", \"A\"]\n```\n\n### .subtracting() Subtraction\n\n```swift\nvar setA: Set = [\"A\", \"B\", \"C\", \"D\"]\nvar setB: Set = [\"C\", \"D\"]\n\nvar setC = setA.subtracting(setB)\nprint(setC)\n// print: [\"B\", \"A\"]\n```\n\n## dictionary\n\n### Base Dictionary\n\n```swift\nvar dictionaryName = [\n  \"Key1\": \"Value1\",\n  \"Key2\": \"Value2\",\n  \"Key3\": \"Value3\"\n]\n```\n\nAn `unordered` collection of pairs of data or key-value pairs\n\n### Keys\n\n```swift\nvar fruitStand = [\n  \"Coconuts\": 12,\n  \"Pineapples\": 12,\n  \"Papaya\": 12\n]\n```\n\nEach `key` is `unique` even if they all contain the same `value`\n\n### Type Consistency\n\n```swift\nvar numberOfSides = [\n  \"triangle\": 3,\n  \"square\": 4,\n  \"rectangle\": 4\n]\n```\n\nContains only `String` keys and `Int` values\n\n### Initialize and populate the dictionary\n\n```swift\nvar employeeID = [\n  \"Hamlet\": 1367,\n  \"Horatio\": 8261,\n  \"Ophelia\": 9318\n]\n```\n\n### Initialize an empty dictionary\n\n```swift\n// initializer syntax:\nvar yearlyFishPopulation = [Int: Int]()\n\n// Empty dictionary literal syntax:\nvar yearlyBirdPopulation: [Int: Int] = [:]\n```\n\n### add to dictionary\n\n```swift\nvar pronunciation = [\n  \"library\": \"lai·breh·ree\",\n  \"apple\": \"a·pl\"\n]\n// new key: \"programming\", new value: \"prow gra\"\npronunciation[\"programming\"] = \"prow·gra\"\n```\n\n### Delete key-value pair {.row-span-2}\n\n```swift\nvar bookShelf = [\n  \"Goodnight\": \"Margaret Wise Brown\",\n  \"The BFG\": \"Roald Dahl\",\n  \"Falling Up\": \"Shel Silverstein\",\n  \"No, David!\": \"David Shannon\"\n]\n// remove value by setting key to nil\nbookShelf[\"The BFG\"] = nil\n\n// remove value using .removeValue()\nbookShelf.removeValue(forKey: \"Goodnight\")\n\n// remove all values\nbookShelf.removeAll()\n```\n\n### Modify the key-value pair {.row-span-2}\n\n```swift\nvar change = [\n  \"Quarter\": 0.29,\n  \"Dime\": 0.15,\n  \"Nickel\": 0.05\n]\n\n// Change the value using subscript syntax\nchange[\"Quarter\"] = .25\n\n// Change the value using .updateValue()\nchange.updateValue(.10, forKey: \"Dime\")\n```\n\nTo change the value of a key-value pair, use the `.updateValue()` method or the subscript syntax by appending brackets\n`[ ]` with the existing keys within to the name of the dictionary, then adding the assignment operator _(`= `)_ followed\nby the modified value\n\n### .isEmpty property\n\n```swift\nvar bakery = [String:Int]()\n\n// check if the dictionary is empty\nprint(bakery.isEmpty) // prints true\nbakery[\"Cupcakes\"] = 12\n// check if the dictionary is empty\nprint(bakery.isEmpty) // print false\n```\n\n### .count property\n\n```swift\nvar fruitStand = [\n  \"Apples\": 12,\n  \"Oranges\", 17\n]\nprint(fruitStand.count) // print: 2\n```\n\n### Assigning values to variables\n\n```swift\nvar hex = [\n  \"red\": \"#ff0000\",\n  \"yellow\": \"#ffff00\",\n  \"blue\": \"#0000ff\",\n]\n\nprint(\"Blue hexadecimal code \\(hex[\"blue\"])\")\n// print: blue hex code Optional(\"#0000ff\")\n\nif let redHex = hex[\"red\"] {\n  print(\"red hexadecimal code \\(redHex)\")\n}\n// print: red hex code #ff0000\n```\n\nAssigning the value of a key-value pair to a variable will return an optional value. To extract values, use the optional\nexpansion\n\n### Traversing the dictionary\n\n```swift\nvar emojiMeaning = [\n  \"🤔\": \"Thinking Face\",\n  \"😪\": \"Sleepy Face\",\n  \"😵\": \"Dizzy Face\"\n]\n// loop through keys and values\nfor (emoji, meaning) in emojiMeaning {\n  print(\"\\(emoji) is called '\\(meaning)Emoji'\")\n}\n// iterate through keys only\nfor emoji in emojiMeaning.keys {\n  print(emoji)\n}\n// iterate through values only\nfor meaning in emojiMeaning.values {\n  print(meaning)\n}\n```\n\n## function\n\n### Basic functions\n\n```swift\nfunc washCar() -> Void {\n  print(\"Soap\")\n  print(\"Scrub\")\n  print(\"Rinse\")\n  print(\"Dry\")\n}\n```\n\n### Call functions\n\n```swift\nfunc greetLearner() {\n print(\"Welcome to CheatSheets.zip!\")\n}\n// function call:\ngreetLearner()\n// print: Welcome to CheatSheets.zip!\n```\n\n### return value\n\n```swift\nlet birthYear = 1994\nvar currentYear = 2020\n\nfunc findAge() -> Int {\n  return currentYear-birthYear\n}\n\nprint(findAge()) // prints: 26\n```\n\n### Multiple parameters {.col-span-2}\n\n```swift\nfunc convertFracToDec(numerator: Double, denominator: Double) -> Double {\n  return numerator / denominator\n}\n\nlet decimal = convertFracToDec(numerator: 1.0, denominator: 2.0)\nprint(decimal) // prints: 0.5\n```\n\n### Omit parameter labels\n\n```swift\nfunc findDiff(_ a: Int, b: Int) -> Int {\n  return a -b\n}\n\nprint(findDiff(6, b: 4)) // prints: 2\n```\n\n### return multiple values {.col-span-2}\n\n```swift\nfunc smartphoneModel() -> (name: String, version: String, yearReleased: Int) {\n  return (\"iPhone\", \"8 Plus\", 2017)\n}\nlet phone = smartphoneModel()\n\nprint(phone.name)         // print: iPhone\nprint(phone.version)      // print: 8 Plus\nprint(phone.yearReleased) // print: 2017\n```\n\n### Parameters & Arguments\n\n```swift\nfunc findSquarePerimet(side: Int) -> Int {\n  return side *4\n}\n\nlet perimeter = findSquarePerimet(side: 5)\nprint(perimeter) // print: 20\n\n// Parameter: side\n// Argument: 5\n```\n\n### Implicit return\n\n```swift\nfunc nextTotalSolarEclipse() -> String {\n  \"April 8th, 2024 🌎\"\n}\n\nprint(nextTotalSolarEclipse())\n// print: April 8th, 2024 🌎\n```\n\n### Default parameters\n\n```swift\nfunc greet(person: String = \"guest\") {\n  print(\"Hello \\(person)\")\n}\ngreet() // Hello guest\ngreet(person: \"Aliya\") // Hello Aliya\n```\n\n### Input and output parameters {.row-span-2}\n\n```swift\nvar currentSeason = \"Winter\"\n\nfunc season(month: Int, name: inout String) {\n  switch month {\n    case 1...2:\n      name = \"Winter ⛄️\"\n    case 3...6:\n      name = \"Spring 🌱\"\n    case 7...9:\n      name = \"Summer ⛱\"\n    case 10...11:\n      name = \"Autumn 🍂\"\n    default:\n      name = \"Unknown\"\n  }\n}\nseason(month: 4, name: &currentSeason)\n\nprint(currentSeason) // Spring 🌱\n```\n\n### variable parameter\n\n```swift\nfunc totalStudent(data: String...) -> Int {\n  let numStudents = data.count\n  return numStudents\n}\n\nprint(totalStudent(data: \"Denial\", \"Peter\"))\n// print: 2\n```\n\n### Optional parameters\n\n```swift\nfunc getFirstInitial(from name: String?) -> String? {\n  return name?.first\n}\n```\n\nFunctions can accept optional types and return optional types. When a function cannot return a reasonable instance of\nthe requested type, it should return `nil`\n\n## structure\n\n### Structure Creation\n\n```swift\nstruct Building {\n  var address: String\n  var floors: Int\n  init(address: String, floors: Int) {\n    self.address = address\n    self.floors = floors\n  }\n}\n```\n\nStructs or structs are used to programmatically represent real-life objects in code. A structure is created using the\n`struct` keyword, followed by its name, followed by a body containing its properties and methods\n\n### Default property values\n\n```swift\nstruct Car {\n  var numOfWheels = 4\n  var topSpeed = 80\n}\n\nvar reliantRobin = Car(numOfWheels: 3)\n\nprint(reliantRobin.numOfWheels) // prints: 3\nprint(reliantRobin.topSpeed)    // print: 80\n```\n\n### Structural instance creation\n\n```swift\nstruct Person {\n  var name: String\n  var age: Int\n\n  init(name: String, age: Int) {\n    self.name = name\n    self.age = age\n  }\n}\n\n// Person instance:\nvar morty = Person(name: \"Peter\", age: 14)\n```\n\n### init() method {.row-span-2}\n\n```swift\nstruct TV {\n  var size: Int\n  var type: String\n\n  init(size: Int, type: String) {\n    self.size = size\n    self.type = type\n  }\n}\n```\n\nUsing the `TV` class\n\n```swift\nvar newTV = TV(size: 65, type: \"LED\")\n```\n\n### Check type\n\n```swift\nprint(type(of: \"abc\")) // print: String\nprint(type(of: 123))   // print: 123\n```\n\n### Mutation method (mutating) {.row-span-2}\n\n```swift\nstruct Menu {\n  var menuItems = [\"Fries\", \"Burgers\"]\n  mutating func addToMenu(dish: String) {\n    self.menuItems.append(dish)\n  }\n}\n```\n\nUsing the `Menu` class\n\n```swift\nvar dinerMenu = Menu()\ndinerMenu.addToMenu(dish: \"Toast\")\nprint(dinerMenu.menuItems)\n// prints: [\"Fries\", \"Burgers\", \"Toast\"]\n```\n\n### Structural methods\n\n```swift\nstruct Dog {\n  func bark() {\n    print(\"Woof\")\n  }\n}\nlet fido = Dog()\nfido.bark() // prints: Woof\n```\n\n## class\n\n### reference type (class) {.row-span-2}\n\n```swift\nclass Player {\n  var name: String\n\n  init(name: String) {\n    self.name = name\n  }\n}\n\nvar player1 = Player(name: \"Tomoko\")\nvar player2 = player1\nplayer2.name = \"Isabella\"\n\nprint(player1.name) // Isabella\nprint(player2.name) // Isabella\n```\n\n### instance of the class\n\n```swift\nclass Person {\n  var name = \"\"\n  var age = 0\n}\n\nvar sonny = Person()\n// sonny is now an instance of Person\n```\n\n### init() method {.row-span-2}\n\n```swift\nclass Fruit {\n  var hasSeeds = true\n  var color: String\n\n  init(color: String) {\n    self.color = color\n  }\n}\n```\n\nUsing the Fruit class\n\n```swift\nlet apple = Fruit(color: \"red\")\n```\n\nA class can be initialized using the `init()` method and the corresponding initialization properties. In the `init()`\nmethod, the `self` keyword is used to refer to the actual instance of the class assigning property values\n\n### Class Attributes\n\n```swift\nvar ferris = Student()\n\nferris.name = \"Ferris Bueller\"\nferris.year = 12\nferris.gpa = 3.81\nferris.honors = false\n```\n\n### Inherit {.row-span-2}\n\nSuppose we have a BankAccount class:\n\n```swift\nclass BankAccount {\n  var balance = 0.0\n  func deposit(amount: Double) {\n    balance += amount\n  }\n  func withdraw(amount: Double) {\n    balance -= amount\n  }\n}\n```\n\n`SavingsAccount` extends `BankAccount` class\n\n```swift\nclass SavingsAccount: BankAccount {\n  var interest = 0.0\n\n  func addInterest() {\n    let interest = balance *0.005\n    self.deposit(amount: interest)\n  }\n}\n```\n\nThe new `SavingsAccount` class (subclass) automatically gets all the characteristics of the `BankAccount` class\n(superclass). Additionally, the `SavingsAccount` class defines an `.interest` property and an `.addInterest()` method.\n\n### Example\n\nuse data type\n\n```swift\nclass Student {\n  var name: String\n  var year: Int\n  var gpa: Double\n  var honors: Bool\n}\n```\n\nUse default property values\n\n```swift\nclass Student {\n  var name = \"\"\n  var gpa = 0.0\n  var honors = false\n}\n```\n\n### This is an example of a struct definition and a class definition\n\n```swift\nstruct Resolution {\n  var width = 0\n  var height = 0\n}\nclass VideoMode {\n  var resolution = Resolution()\n  var interlaced = false\n  var frameRate = 0.0\n  var name: String?\n}\n```\n\nThe `Resolution` structure definition and the `VideoMode` class definition only describe the appearance of `Resolution`\nor `VideoMode`, create an instance of the structure or class:\n\n```swift\nlet resolution = Resolution(width: 1920)\nlet someVideoMode = VideoMode()\n```\n\n## Enumerate\n\n### Define the enumeration\n\n```swift\nenum Day {\n  case monday\n  case tuesday\n  case wednesday\n  case thursday\n  case friday\n  case saturday\n  case sunday\n}\n\nlet casualWorkday: Day = .friday\n```\n\n### Switch statement\n\n```swift\nenum Dessert {\n  case cake(flavor: String)\n  case vanillaIceCream(scoops: Int)\n  case brownie\n}\n\nlet customerOrder: Dessert = .cake(flavor: \"Red Velvet\")\nswitch customerOrder {\n  case let .cake(flavor):\n    print(\"You ordered a \\(flavor) cake\")\n  case .brownie:\n    print(\"You ordered a chocolate cake\")\n}\n// prints: \"You ordered a red velvet cake\"\n```\n\n### CaseIterable\n\n```swift\nenum Season: CaseIterable {\n  case winter\n  case spring\n  case summer\n  case falls\n}\n\nfor season in Season.allCases {\n  print(season)\n}\n```\n\nAdd conformance to the `CaseIterable` protocol to access the `allCases` property, which returns an array of all cases of\nthe enumeration\n\n### Original value\n\n```swift\nenum Beatle: String {\n  case john paul george ringo\n}\n\nprint(\"The Beatles are \\(Beatle.john.rawValue).\")\n// print: The Beatles are john.\n```\n\n### Related values\n\n```swift\nenum Dessert {\n  case cake(flavor: String)\n  case vanillaIceCream(scoops: Int)\n  case brownie\n}\n\nlet order: Dessert = .cake(flavor: \"Red Velvet\")\n```\n\n### instance method {.row-span-2}\n\n```swift\nenum Traffic {\n  case light\n  case heavy\n\n  mutating func reportAccident() {\n    self = .heavy\n  }\n}\n\nvar currentTraffic: Traffic = .light\n\ncurrentTraffic.reportAccident()\n// currentTraffic is now .heavy\n```\n\nJust like classes and structs, enumerations can have instance methods. If an instance method mutates the value of the\nenum, it needs to be marked `mutating`\n\n### Initialize from primitive value\n\n```swift\nenum Hello: String {\n  case english = \"Hello\"\n  case japanese = \"Hello!\"\n  case emoji = \"👋\"\n}\nlet hello1 = Hello(rawValue: \"Hello!\")\nlet hello2 = Hello(rawValue: \"Привет\")\nprint(hello1) // Optional(Hello.japanese)\nprint(hello2) // nil\n```\n\n### Computed properties\n\n```swift\nenum ShirtSize: String {\n  case small = \"S\"\n  case medium = \"M\"\n  case large = \"L\"\n  case extraLarge = \"XL\"\n  var description: String {\n    return \"The size of this shirt is \\(self.rawValue)\"\n  }\n}\n```\n\n## Extensions\n\n### What are extensions?\n\nExtensions is a way to add new add new functionality to existing classes, structures, enumerations, or protocol types.\nThis includes adding new methods, properties, initializers, and more.\n\n### Why use extensions?\n\nExtensions are particularly useful for organizing and modularizing our code without needing to modify the original type,\nespecially when we don't have access to the original source code.\n\n### Extension syntax\n\n```swift\nextension SomeType {\n    // New functionalities to be added\n}\n```\n\n### Computed properties\n\n```swift\nextension Int {\n    var isEven: Bool {\n        self % 2 == 0\n    }\n}\n\nprint(4.isEven) // Outputs: true\nprint(7.isEven) // Outputs: false\n```\n\n### Methods\n\n```swift\nextension String {\n    func reverse() -> String {\n        String(self.reversed())\n    }\n}\n\nprint(\"abc\".reverse()) // Output: cba\n```\n\n### Mutating methods\n\n```swift\nextension Int {\n    mutating func square() {\n        self = self * self\n    }\n}\n\nvar number = 5\nnumber.square()\nprint(number) // Output: 25\n```\n\n### Initializers\n\n```swift\nextension Date {\n    init?(timestamp: Double) {\n        self.init(timeIntervalSince1970: timestamp)\n    }\n}\n\nlet timestamp = 1693982400.0 // Unix timestamp for 2023-09-06 06:40:00\nif let date = Date(timestamp: timestamp) {\n    print(date) // Output: 2023-09-06 06:40:00 +0000\n}\n```\n\n### Subscripts\n\n```swift\nextension String {\n    subscript(index: Int) -> Character {\n        self[self.index(startIndex, offsetBy: index)]\n    }\n}\n\nprint(\"Swift\"[0]) // Output: S\nprint(\"Swift\"[1]) // Output: w\nprint(\"Swift\"[2]) // Output: i\nprint(\"Swift\"[3]) // Output: f\nprint(\"Swift\"[4]) // Output: t\n```\n\n### Protocol extensions {.row-span-2}\n\nIt works pretty much like abstract classes when regarding a functionality we want to be available in all the classes\nthat implements some protocol (without having to inherit from a base common class).\n\n```swift\n// Define a protocol\nprotocol Describable {\n    func describe() -> String\n}\n\n// Provide a default implementation using a protocol extension\nextension Describable {\n    func describe() -> String {\n        \"This is a generic description\"\n    }\n}\n\n// Define a struct that conforms Describable protocol\nstruct Person: Describable {\n    var name: String\n    var age: Int\n\n    // Overriding the default implementation\n    func describe() -> String {\n        \"My name is \\(name) and I am \\(age) years old.\"\n    }\n}\n\nstruct Employee: Describable {\n    var name: String\n    var age: Int\n\n    // Using the default implementation\n}\n\n// By just implementing the protocol the describe() method is available\n\nlet person = Person(name: \"Ivan\", age: 21)\nlet employee = Employee(name: \"Saul\", age: 25)\n\nprint(person.describe()) // Output: My name is Ivan and I am 21 years old.\nprint(employee.describe()) // Output: This is a generic description\n```\n\n### Constraints for extensions\n\nThis is especially useful when we want to add functionality to a type that conforms to a specific protocol or has\ncertain conditions.\n\n```swift\nextension Array where Element: Numeric {\n    func sum() -> Element {\n        reduce(0, +)\n    }\n}\n\nlet numbers = [1, 2, 3, 4, 5]\nprint(numbers.sum()) // Output: 15\n\nlet doubles = [1.5, 2.5, 3.5]\nprint(doubles.sum()) // Output: 7.5\n\n// This will not work because String is not Numeric\n// let strings = [\"a\", \"b\", \"c\"]\n// print(strings.sum()) // Error: Cannot invoke 'sum' with an array of strings\n```\n\n### Organizing code with extensions\n\nExtensions are not limited to adding functionality; they are also handy for code organization. We can group related\nmethods, properties or views in separate extensions.\n\n```swift\nimport SwiftUI\n\nstruct HomeView: View {\n    var body: some View {\n        ScrollView {\n            header\n            // Add other views\n        }\n    }\n}\n\nextension HomeView {\n    private var header: some View {\n        Text(\"Header ...\")\n    }\n}\n\n#Preview {\n    HomeView()\n}\n```\n\n## Generics\n\n### What are generics?\n\nGenerics in Swift are a feature that allows us to create functions, classes, structures, and protocols that can work\nwith any data type.\n\n### Why use generics?\n\nGenerics enable us to write clear and concise code that works with any data type. By using placeholders (like `T`), this\nreduces the risk of introducing bugs.\n\n### Type parameters {.row-span-2}\n\n```swift\nfunc foo<T, U>(a: T, b: U) {\n  // ...\n}\n\nstruct Foo<T, U> {\n  var a: T\n  // ...\n}\n```\n\nThe placeholders `T` is an example of a type parameter, are written inside angle brackets(such as `<T>`).\n\n### Generic Data Structures\n\n```swift\nstruct Box<T> {\n    var value: T\n}\nlet intBox = Box(value: 10)\nlet stringBox = Box(value: \"Hello\")\n\nprint(intBox.value) // Output: 10\nprint(stringBox.value) // Output: \"Hello\"\n```\n\n### Generic Functions {.row-span-2}\n\n```swift\nfunc swapValues<T>(_ a: inout T, _ b: inout T) {\n    let temp = a\n    a = b\n    b = temp\n}\n\nvar a = 10\nvar b = 20\nswapValues(&a, &b)\nprint(a) // Output: 20\nprint(b) // Output: 10\n\nvar c = \"Hello\"\nvar d = \"World\"\nswapValues(&c, &d)\nprint(c) // Output: \"World\"\nprint(d) // Output: \"Hello\"\n```\n\n### Constraints on Generics\n\n```swift\nfunc sum<T: Numeric>(_ array: [T]) -> T {\n    array.reduce(0, +)\n}\n\nprint(sum([1, 1.5, 2])) // Output: 4.5\n\n// This will not work because String is not Numeric\n// print(sum([\"a\", \"b\", \"c\"]))\n// Error: function 'sum' requires that 'String' conform to 'Numeric'\n```\n\n### Associated Types\n\n```swift\nprotocol Foo {\n    associatedtype T\n    func foo() -> T\n}\n```\n\nAssociated types are used in protocols to define a placeholder for a type that will be specified later. They act as a\ngeneric placeholder. The exact type isn't defined in the protocol itself; instead, it's determined when a class, struct,\nor enum conforms to the protocol.\n\n### Generic Protocols {.row-span-2}\n\n```swift\nprotocol Storage {\n    associatedtype Item\n    func store(item: Item)\n    func retrieve() -> Item?\n}\n\nclass SimpleStorage<T>: Storage {\n    private var items: [T] = []\n\n    func store(item: T) {\n        items.append(item)\n    }\n\n    func retrieve() -> T? {\n        return items.isEmpty ? nil : items.removeLast()\n    }\n}\n\nlet intStorage = SimpleStorage<Int>()\nintStorage.store(item: 42)\nprint(intStorage.retrieve() ?? \"Empty\")  // Output: 42\n```\n\n### Generic Typealiases\n\nGeneric typealiases allow us to create a new name for an existing type (i.e., they would not introduce a new type).\n\n```swift\ntypealias StringDictionary<T> = [String: T]\ntypealias IntFunction<T> = (Int) -> Int\ntypealias Vector<T> = (T, T, T)\n```\n\n## Also See\n\n- [Swift Documentation (Official)](https://www.swift.org/documentation/) _(swift.or)_\n- [Swift Programming Language (Official)](https://docs.swift.org/swift-book/) _(swift.or)_\n- [One-Stop Quick Reference for Swift Developers](https://swiftly.dev/) _(swiftly.dev)_\n"
  },
  {
    "path": "source/_posts/symfony.md",
    "content": "---\r\ntitle: Symfony\r\ndate: 2025-07-23 18:28:43\r\nbackground: bg-[#67526d]\r\nlabel: php\r\ntags:\r\n  - php\r\n  - web\r\ncategories:\r\n  - Programming\r\nintro: |\r\n  This Symfony Cheat Sheet is a non exhaustive list of main symfony basics that you can use or need.\r\nplugins:\r\n  - copyCode\r\n---\r\n\r\n\r\n## Getting Started \r\n\r\n### Installation \r\n\r\n```bash\r\ncurl -sS https://get.symfony.com/cli/installer | bash\r\n```\r\n- [Doc Symfony Download](https://symfony.com/download) \r\n\r\n{.marker-round}\r\n\r\n### Symfony CLI: Basic Commands {.col-span-2}  \r\n\r\n\r\n| Command                         | Description                                   |\r\n|:--------------------------------|:----------------------------------------------|\r\n| `symfony check:requirements`    | Check system requirements for running Symfony |\r\n| `symfony version`               | Display the Symfony CLI version               |\r\n| `symfony help`                  | Display all available commands                |\r\n| `symfony help <cmd>`            | Display help for a specific command           |\r\n| `symfony server:start`          | Start server                                  |\r\n| `symfony server:stop`           | Stop server                                   |\r\n| `symfony serve -d`              | Run Symfony server in background              |\r\n\r\n\r\n\r\n### Creating a New Symfony Project   {.col-span-3}\r\n\r\n| Command                                                       | Description                                        |\r\n|:--------------------------------------------------------------|:---------------------------------------------------|\r\n| `symfony new <dir>`                                           | Create a new Symfony project in `<dir>`            |\r\n| `symfony new my_project_directory --version=\"7.3.x\" --webapp` | Create a new web application                       |\r\n| `symfony new my_project_directory --version=\"7.3.x\"`          | Create a new API application                       |\r\n| `composer create-project symfony/skeleton <dir>`              | Create a new Symfony project using Composer        |\r\n\r\n----\r\n\r\n[Doc Symfony creating app](https://symfony.com/doc/current/setup.html#creating-symfony-applications) {.link-arrow}\r\n\r\n\r\n\r\n### Symfony Console Basic Usage \r\n\r\n| CMD                       | Description                                               |\r\n|:--------------------------|:----------------------------------------------------------|\r\n| `bin/console`             | List all available commands                               |\r\n| `bin/console <namespace>` | List all commands in a specific namespace or bundle       |\r\n| `bin/console <cmd>`       | Run a specific command                                    |\r\n| `bin/console help <cmd>`  | Show help for a specific command                          |\r\n| `bin/console --env=<env>` | Run console in environment: dev, test, or prod            |\r\n| `bin/console cache:clear` | Clear the cache                                           |\r\n\r\n### Linting Commands   {.col-span-2}\r\n\r\n| CMD                            | Description                                            |\r\n|:-------------------------------|:-------------------------------------------------------|\r\n| `bin/console lint:container`   | Check service arguments for type mismatches            |\r\n| `bin/console lint:twig <dir>`  | Lint Twig templates for syntax errors                  |\r\n| `bin/console lint:yaml <dir>`  | Lint YAML files for syntax errors                      |\r\n| `bin/console lint:xliff <dir>` | Lint XLIFF translation files                           |\r\n\r\n\r\n### Debugging Commands   {.col-span-3}\r\n\r\n| CMD                                          | Description                             |\r\n|:---------------------------------------------|:----------------------------------------|\r\n| `bin/console debug:asset-map`                | Show all mapped assets                  |\r\n| `bin/console debug:autowiring`               | List all autowireable services          |\r\n| `bin/console debug:config <bundle>`          | Dump configuration of a bundle          |\r\n| `bin/console debug:container`                | List all public services                |\r\n| `bin/console debug:container <service>`      | Get info about a specific service       |\r\n| `bin/console debug:container --env-vars`     | Show environment variables in container |\r\n| `bin/console debug:container --tags`         | List tagged public services             |\r\n| `bin/console debug:container --tag=<t>`      | List services with a specific tag       |\r\n| `bin/console debug:dotenv`                   | Display parsed dotenv values            |\r\n| `bin/console debug:dotenv <search>`          | Show dotenv values matching a search    |\r\n| `bin/console debug:event-dispatcher`         | List all event listeners                |\r\n| `bin/console debug:firewall <name>`          | Show details of a firewall              |\r\n| `bin/console debug:form`                     | Show form type information              |\r\n| `bin/console debug:messenger`                | List dispatchable messages              |\r\n| `bin/console debug:router`                   | List all registered routes              |\r\n| `bin/console debug:router <name>`            | Get info about a specific route         |\r\n| `bin/console debug:translation <loc>`        | Show messages for a locale              |\r\n\r\n### AssetMap Commands  {.col-span-2}\r\n\r\n| CMD                                   | Description                                        |\r\n|:--------------------------------------|:---------------------------------------------------|\r\n| `bin/console asset-map:compile`       | Compile assets for production                      |\r\n| `bin/console importmap:require <pkg>` | Add an NPM package to the import map               |\r\n| `bin/console importmap:install`       | Download all importmap packages                    |\r\n| `bin/console importmap:update`        | Update all importmap packages                      |\r\n| `bin/console importmap:remove <pkg>`  | Remove a package from import map                   |\r\n| `bin/console importmap:outdated`      | List outdated importmap packages                   |\r\n| `bin/console importmap:audit`         | Check dependencies for vulnerabilities             |\r\n\r\n\r\n\r\n\r\n## ORM & Migration \r\n\r\n### Database Connection    {.col-span-2}\r\n\r\n\r\n```bash\r\n# MySQL \r\nDATABASE_URL=\"mysql://username:password@127.0.0.1:3306/db_name?serverVersion=X.Y.Z&charset=utf8mb4\"\r\n\r\n# MariaDB \r\nDATABASE_URL=\"mysql://username:password@127.0.0.1:3307/db_name?serverVersion=X.Y.Z-MariaDB&charset=utf8mb4\"\r\n\r\n# PostgreSQL \r\nDATABASE_URL=\"postgresql://username:password@127.0.0.1:5432/db_name?serverVersion=X.Y.Z&charset=utf8\"\r\n```\r\n----\r\n\r\n`username` : user of DBMS <br>\r\n`password` : password of DBMS <br>\r\n`127.0.0.1`:  `3306` MySQL `3307` MariaDB `5432` PostgreSQL <br> \r\n`db_name` : name of data base <br>\r\n`serverVersion` : to know server version <code>SHOW GLOBAL VARIABLE LIKE</code> `%version%` in your DBMS\r\n\r\n\r\n\r\n\r\n### Doctrine Commands  {.col-span-3}\r\n\r\n\r\n\r\n| CMD                                                                                                                                         | Description                              |\r\n|:--------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------|\r\n| `bin/console doctrine:database:create`or `php bin/console d:d:c`                                                                            | Create the configured database           |\r\n| `bin/console doctrine:database:drop`  or `php bin/console d:d:d`                                                                            | Drop the configured database             |\r\n| `bin/console doctrine:mapping:info`                                                                                                         | List mapped entities                     |\r\n| `bin/console doctrine:schema:update --dump-sql`                                                                                             | Generate SQL to sync DB schema           |\r\n| `bin/console doctrine:schema:update --force`                                                                                                | Sync DB schema with mapping info         |\r\n| `bin/console doctrine:schema:validate`                                                                                                      | Validate the mapping files               |\r\n| `bin/console doctrine:query:sql <sql cmd>`                                                                                                  | Run a raw SQL query                      |\r\n| `bin/console doctrine:query:dql <dql cmd>`                                                                                                  | Run a DQL query                          |\r\n| `bin/console doctrine:fixtures:load`                                                                                                        | Load data fixtures into the database     |\r\n\r\n---\r\n\r\nYou can run <code>php bin/console doctrine:schema:drop --force && php bin/console doctrine:schema:update --force && php bin/console doctrine:fixtures:load -n</code> to Load data fixtures & reset sequence to 0 \r\n\r\n----\r\n\r\n[Doc Symfony Database](https://symfony.com/doc/current/doctrine.html#configuring-the-database) {.link-arrow}\r\n\r\n\r\n\r\n### Migration Commands  {.col-span-3}\r\n\r\n| CMD                                                                 | Description                                                         |\r\n|:--------------------------------------------------------------------|:--------------------------------------------------------------------|\r\n| `bin/console make:migration`                                        | Generate a new migration based on schema changes                    |\r\n| `bin/console doctrine:migration:generate`                           | Generate a new migration based on schema changes                    |\r\n| `bin/console doctrine:migration:migrate` or `php bin/console d:m:m` | Execute pending migrations to update the database                   |\r\n| `bin/console doctrine:migration:status`                             | Show status of migrations (pending, executed)                       |\r\n| `bin/console doctrine:migration:diff`                               | Compare current schema with the database and generate migration SQL |\r\n\r\n\r\n## Symfony Maker\r\n\r\n### Maker-Bundle List  {.col-span-2}\r\n\r\n| Command                      | Description                                                                                          |\r\n|:-----------------------------|:-----------------------------------------------------------------------------------------------------|\r\n| `bin/console list make `     | List all make commands available                                                                     |\r\n| `make:auth`                  | Create a Guard authenticator of different flavors                                                    |\r\n| `make:command`               | Create a new console command class                                                                   |\r\n| `make:controller`            | Create a new controller class                                                                        |\r\n| `make:crud`                  | Create CRUD for Doctrine entity class                                                                |\r\n| `make:docker:database`       | Add a database container to your compose.yaml file                                                   |\r\n| `make:entity`                | Create or update a Doctrine entity class, and optionally an API Platform resource                    |\r\n| `make:fixtures`              | Create a new class to load Doctrine fixtures                                                         |\r\n| `make:form`                  | Create a new form class                                                                              |\r\n| `make:functional-test`       | Create a new test class                                                                              |\r\n| `make:listener`              | [make:subscriber] Creates a new event subscriber class or a new event listener class                 |\r\n| `make:message`               | Create a new message and handler                                                                     |\r\n| `make:messenger-middleware`  | Create a new messenger middleware                                                                    |\r\n| `make:migration`             | Create a new migration based on database changes                                                     |\r\n| `make:registration-form`     | Create a new registration form system                                                                |\r\n| `make:reset-password`        | Create controller, entity, and repositories for use with symfonycasts/reset-password-bundle          |\r\n| `make:schedule`              | Create a scheduler component                                                                         |\r\n| `make:security:custom`       | Create a custom security authenticator                                                               |\r\n| `make:security:form-login`   | Generate the code needed for the form_login authenticator                                            |\r\n| `make:serializer:encoder`    | Create a new serializer encoder class                                                                |\r\n| `make:serializer:normalizer` | Create a new serializer normalizer class                                                             |\r\n| `make:stimulus-controller`   | Create a new Stimulus controller                                                                     |\r\n| `make:subscriber`            | Creates a new event subscriber class or a new event listener class                                   |\r\n| `make:test`                  | [make:unit-test make:functional-test] Create a new test class                                        |\r\n| `make:twig-component`        | Create a Twig (or Live) component                                                                    |\r\n| `make:twig-extension`        | Create a new Twig extension with its runtime class                                                   |\r\n| `make:unit-test`             | Create a new test class                                                                              |\r\n| `make:user`                  | Create a new security user class                                                                     |\r\n| `make:validator`             | Create a new validator and constraint class                                                          |\r\n| `make:voter`                 | Create a new security voter class                                                                    |\r\n| `make:webhook`               | Create a new Webhook                                                                                 |\r\n\r\n\r\n[Doc Symfony Maker Bundle](https://symfony.com/bundles/SymfonyMakerBundle/current/index.html)   {.link-arrow}\r\n\r\n## Controller Basics\r\n\r\n### Route Attributes and Descriptions  {.col-span-3}\r\n\r\n\r\n`use Symfony\\Component\\Routing\\Attribute\\Route;`\r\n\r\n| Attribute                                                                   | Description                                |\r\n|:----------------------------------------------------------------------------|:-------------------------------------------|\r\n| `#[Route('/path')]`                                                         | Define a route for a controller method     |\r\n| `#[Route('/path', name: 'name')]`                                           | Define a named route for a method          |\r\n| `#[Route('/path', methods: ['GET'])]`                                       | Define allowed HTTP methods                |\r\n| `#[Route('/blog/{slug}')]`                                                  | Define a route with a parameter            |\r\n| `#[Route('/page/{page}', requirements: ['page' => '\\d+'])]`                 | Define a route with a parameter constraint |\r\n| `#[Route(path: ['en' => '/about-us', 'nl' => '/over-ons'], name: 'about')]` | Define localized routes                    |\r\n\r\n[Doc Symfony Route Parameters](https://symfony.com/doc/current/routing.html#route-parameters)  {.link-arrow}\r\n\r\n### AbstractController Methods  {.col-span-3}\r\n\r\n| Method                                                 | Description                                   |\r\n|:-------------------------------------------------------|:----------------------------------------------|\r\n| `$this->render('template.html')`                       | Returns a Response with the rendered template |\r\n| `$this->redirectToRoute('homepage')`                   | Returns a RedirectResponse to a named route   |\r\n| `$this->redirectToRoute('name', ['param' => 'value'])` | Returns a redirect to a route with parameters |\r\n| `$this->redirectToRoute('name', [], 301)`              | Returns a RedirectResponse with status code   |\r\n| `$this->redirect('http://example.com')`                | Returns a RedirectResponse to an external URL |\r\n| `$this->createNotFoundException($msg)`                 | Returns a NotFoundHttpException               |\r\n| `$this->createForm(FormType::class, $data)`            | Creates a new Form instance based on the type |\r\n\r\n### Form Methods {.col-span-2}\r\n\r\n| Method                           | Description                     |\r\n|:---------------------------------|:--------------------------------|\r\n| `$form->handleRequest($request)` | Handle a form submission        |\r\n| `$form->isSubmitted()`           | Check if the form was submitted |\r\n| `$form->isValid()`               | Check if the form is valid      |\r\n\r\n\r\n## Form Type : [Doc Symfony Form types](https://symfony.com/doc/current/reference/forms/types.html)  \r\n\r\n\r\n### Form Fields: Text Fields\r\n\r\n| Type           | Description                             |\r\n|:---------------|:----------------------------------------|\r\n| `TextType`     | A basic text input field                |\r\n| `TextareaType` | A multi-line textarea field             |\r\n| `EmailType`    | An email field (`<input type=\"email\">`) |\r\n| `PasswordType` | A password field                        |\r\n| `SearchType`   | A search field                          |\r\n| `UrlType`      | A URL field (`<input type=\"url\">`)      |\r\n| `TelType`      | A tel (phone number) input field        |\r\n| `UuidType`     | A UUID field                            |\r\n\r\n\r\n### Form Fields: Numeric Fields\r\n\r\n| Type           | Description                                |\r\n|:---------------|:-------------------------------------------|\r\n| `IntegerType`  | A number field for integers                |\r\n| `MoneyType`    | A money field, with a specifiable currency |\r\n| `NumberType`   | A number field                             |\r\n| `PercentType`  | A number field for percentages             |\r\n| `RangeType`    | A range input field (slider)               |\r\n\r\n\r\n\r\n### Form Fields: Choice Fields\r\n\r\n| Type           | Description                             |\r\n|:---------------|:----------------------------------------|\r\n| `ChoiceType`   | Field for selecting one or more options |\r\n| `EnumType`     | Choose from PHP enum cases              |\r\n| `EntityType`   | Choose from a Doctrine entity           |\r\n| `CountryType`  | Choose a country                        |\r\n| `LanguageType` | Choose a language                       |\r\n| `LocaleType`   | Choose a locale                         |\r\n| `TimezoneType` | Choose a timezone                       |\r\n| `CurrencyType` | Choose a currency                       |\r\n\r\n\r\n\r\n### Form Fields: Symfony UX Fields\r\n\r\n| Type            | Description                        |\r\n|:----------------|:-----------------------------------|\r\n| `CropperType`   | A Cropper.js image cropper field   |\r\n| `DropzoneType`  | A Dropzone file upload field       |\r\n\r\n\r\n\r\n### Form Fields: Date and Time Fields\r\n\r\n| Type               | Description                 |\r\n|:-------------------|:----------------------------|\r\n| `DateType`         | A date field                |\r\n| `DateIntervalType` | A date interval field       |\r\n| `DateTimeType`     | A date and time field       |\r\n| `TimeType`         | A time field                |\r\n| `BirthdayType`     | A date field for birthdays  |\r\n| `WeekType`         | Select a year and week      |\r\n\r\n\r\n\r\n### Form Fields: Other Fields\r\n\r\n| Type           | Description                         |\r\n|:---------------|:------------------------------------|\r\n| `CheckboxType` | A single checkbox field             |\r\n| `FileType`     | A file upload field                 |\r\n| `RadioType`    | A radio button field                |\r\n| `HiddenType`   | A hidden field                      |\r\n\r\n\r\n\r\n### Form Fields: Field Groups\r\n\r\n| Type              | Description                                                |\r\n|:------------------|:-----------------------------------------------------------|\r\n| `CollectionType`  | A group of fields that can be added or removed             |\r\n| `RepeatedType`    | A field that is repeated (e.g., password confirmation)     |\r\n\r\n\r\n\r\n## Validation Attributes and Descriptions :  [Doc Symfony Validation](https://symfony.com/doc/current/validation.html)\r\n\r\n\r\n### General Constraints\r\n| Attribute                  | Description                                       |\r\n|:---------------------------|:--------------------------------------------------|\r\n| `#[Assert\\NotBlank]`       | Value is not an empty string/array, false or null |\r\n| `#[Assert\\Blank]`          | Value is an empty string or null                  |\r\n| `#[Assert\\NotNull]`        | Value is not strictly equal to null               |\r\n| `#[Assert\\IsNull]`         | Value is exactly equal to null                    |\r\n| `#[Assert\\Type('string')]` | Value is of a specific type                       |\r\n\r\n### Validation: Comparison Constraints  {.col-span-2}\r\n| Attribute                           | Description                                       |\r\n|:------------------------------------|:--------------------------------------------------|\r\n| `#[Assert\\<Not>EqualTo('Foo')]`     | Value is (not) equal to another value             |\r\n| `#[Assert\\<Not>IdenticalTo('Foo')]` | Value is (not) identical to another value         |\r\n| `#[Assert\\LessThan<OrEqual>(5)]`    | Value is less than (or equal to) another value    |\r\n| `#[Assert\\GreaterThan<OrEqual>(5)]` | Value is greater than (or equal to) another value |\r\n| `#[Assert\\Range(min: 2, max: 10)]`  | Number or DateTime object is within a range       |\r\n \r\n### Validation: String Constraints  {.col-span-2}\r\n| Attribute                          | Description                                           |\r\n|:-----------------------------------|:------------------------------------------------------|\r\n| `#[Assert\\Length(2, 10)]`          | String is between `<min>` and `<max>` characters long |\r\n| `#[Assert\\Email]`                  | String is a valid email address                       |\r\n| `#[Assert\\Url]`                    | String is a valid URL                                 |\r\n| `#[Assert\\Hostname]`               | String is a valid hostname                            |\r\n| `#[Assert\\Ip]`                     | String is a valid IP address                          |\r\n| `#[Assert\\NoSuspiciousCharacters]` | String does not contain spoofing characters           |\r\n| `#[Assert\\Uuid]`                   | String is a valid UUID                                |\r\n| `#[Assert\\CssColor]`               | String is a valid CSS color                           |\r\n\r\n\r\n### Validation: Date and Time Constraints\r\n| Attribute            | Description                                       |\r\n|:---------------------|:--------------------------------------------------|\r\n| `#[Assert\\Date]`     | Value is a valid date string in `Y-m-d` format    |\r\n| `#[Assert\\DateTime]` | Value is a valid datetime in the specified format |\r\n| `#[Assert\\Time]`     | Value is a valid time string in `H:i:s` format    |\r\n| `#[Assert\\Timezone]` | Value is a valid timezone identifier              |\r\n\r\n### Validation: Password Constraints  {.col-span-2}\r\n| Attribute                          | Description                                 |\r\n|:-----------------------------------|:--------------------------------------------|\r\n| `#[Assert\\UserPassword]`           | String is the authenticated user's password |\r\n| `#[Assert\\NotCompromisedPassword]` | Password is not found in any data breaches  |\r\n| `#[Assert\\PasswordStrength]`       | Password has sufficient entropy             |\r\n\r\n### Validation: Financial and Other Number Constraints\r\n| Attribute              | Description                                      |\r\n|:-----------------------|:-------------------------------------------------|\r\n| `#[Assert\\Bic]`        | Value is a valid Business Identifier Code (BIC)  |\r\n| `#[Assert\\CardScheme]` | Value is a valid credit card number              |\r\n| `#[Assert\\Currency]`   | Value is a valid 3-letter ISO 4217 currency code |\r\n| `#[Assert\\Luhn]`       | Value passes the Luhn algorithm                  |\r\n| `#[Assert\\Iban]`       | Value is a valid IBAN                            |\r\n| `#[Assert\\Isbn]`       | Value is a valid ISBN                            |\r\n\r\n\r\n### Validation: File Constraints\r\n| Attribute         | Description                                     |\r\n|:------------------|:------------------------------------------------|\r\n| `#[Assert\\File]`  | Value is a valid file path or File object       |\r\n| `#[Assert\\Image]` | Same as File, but only accepts image MIME types |\r\n\r\n\r\n### Validation: Number Constraints {.col-span-2}\r\n| Attribute                    | Description                 |\r\n|:-----------------------------|:----------------------------|\r\n| `#[Assert\\Positive<OrZero>]` | Value is positive (or zero) |\r\n| `#[Assert\\Negative<OrZero>]` | Value is negative (or zero) |\r\n\r\n\r\n### Validation: Choice Constraints {.col-span-2}\r\n| Attribute                            | Description                               |\r\n|:-------------------------------------|:------------------------------------------|\r\n| `#[Assert\\Choice(['A', 'B', 'C'])]`  | Value is one of the specified choices     |\r\n| `#[Assert\\Country]`                  | Value is a valid ISO 3166-1 country code  |\r\n| `#[Assert\\Language]`                 | Value is a valid two-letter language code |\r\n| `#[Assert\\Locale]`                   | Value is a valid locale identifier        |\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
  },
  {
    "path": "source/_posts/systemd.md",
    "content": "---\ntitle: Systemd\ndate: 02-07-2025\nicon: icon-systemd\nbackground: bg-[#00ADEF]\ntags:\n  - systemd\n  - linux\ncategories:\n  - Linux Command\nintro: |\n  systemd is the init system and service manager used by most modern Linux distributions.\nplugins:\n  - copyCode\n---\n\n## systemd Core Utilities{.cols-4}\n\n### systemd utility List {.col-span-4}\n\n| Utility                               | Description                                                    |\n| ------------------------------------- | -------------------------------------------------------------- |\n| [`systemctl`](#systemctl)             | Manages services (start, stop, restart, enable, disable, etc.) |\n| [`journalctl`](#journalctl)           | Views and filters logs collected by the systemd journal        |\n| [`loginctl`](#loginctl)               | Manages user logins and sessions                               |\n| [`hostnamectl`](#hostnamectl)         | Sets or queries the hostname and related machine metadata      |\n| [`timedatectl`](#timedatectl)         | Sets or queries the system date, time, and NTP settings        |\n| [`systemd-analyze`](#systemd-analyze) | Analyzes system boot-up performance                            |\n| [`systemd-cgtop`](#systemd-cgtop)     | Monitors control group resource usage in real time             |\n| [`systemd-run`](#systemd-run)         | Runs a command as a transient service or scope                 |\n| [`resolvectl`](#resolvectl)           | Resolves domain names using the systemd-resolved service       |\n| [`busctl`](#busctl)                   | Interacts with the D-Bus message bus system                    |\n\n{.left-text}\n\n---\n\n## Utility Commands {.cols-4}\n\n### systemctl {#systemctl .col-span-2 .row-span-2}\n\n#### systemctl - System Commands\n\n- Manage systemd units and control system services (start, stop, enable, etc.).\n\n| Command               | Description                                                        |\n| --------------------- | ------------------------------------------------------------------ |\n| `systemctl halt`      | Stop all running software, leave the hardware powered on.          |\n| `systemctl hibernate` | Save contents of system memory to disk and power off the hardware. |\n| `systemctl poweroff`  | Halt and power off the system.                                     |\n| `systemctl reboot`    | Reboot the system.                                                 |\n\n{.left-text}\n\n#### systemctl - Service Commands\n\n| Command                       | Description                                  |\n| ----------------------------- | -------------------------------------------- |\n| `systemctl start <service>`   | Start a service immediately                  |\n| `systemctl stop <service>`    | Stop a running service                       |\n| `systemctl restart <service>` | Restart a service                            |\n| `systemctl reload <service>`  | Reload service configuration without restart |\n| `systemctl enable <service>`  | Enable service to start at boot              |\n| `systemctl disable <service>` | Disable boot-time start                      |\n| `systemctl status <service>`  | Show current status and recent logs          |\n| `systemctl mask <service>`    | Prevent service from being started           |\n| `systemctl unmask <service>`  | Remove mask so it can start again            |\n| `systemctl list-units`        | List active units                            |\n| `systemctl list-unit-files`   | List all unit files and their enabled state  |\n\n{.left-text}\n\n### journalctl {#journalctl .col-span-2}\n\n- Query and filter logs from the systemd journal.\n\n| Command                    | Description                               |\n| -------------------------- | ----------------------------------------- |\n| `journalctl`               | Show entire journal                       |\n| `journalctl -b`            | Show logs from current boot               |\n| `journalctl --list-boots`  | List all boot sessions                    |\n| `journalctl -b -1`         | Logs from previous boot                   |\n| `journalctl -u <service>`  | Show logs for a specific unit/service     |\n| `journalctl -n 100`        | Show the last 100 log entries             |\n| `journalctl -f`            | Follow new log entries (tail -f style)    |\n| `journalctl -p err..emerg` | Show only error (and above) priority logs |\n| `journalctl --disk-usage`  | Show disk usage of journal                |\n| `journalctl --since today` | Show logs since today                     |\n\n{.left-text}\n\n### busctl {#busctl .col-span-2}\n\n- Inspect and monitor D-Bus (Desktop Bus) for debugging or introspection.\n\n| Command                        | Description                                        |\n| ------------------------------ | -------------------------------------------------- |\n| `busctl list`                  | List all services/peers on the bus                 |\n| `busctl status [SERVICE\\|PID]` | Show process info & credentials for service or PID |\n| `busctl monitor [SERVICE...]`  | Dump live message traffic, Ctrl+C to stop          |\n| `busctl capture [SERVICE...]`  | Capture bus traffic to a pcap file                 |\n| `busctl tree [SERVICE...]`     | Show object tree exported by service(s)            |\n\n{.left-text}\n\n### loginctl{#loginctl .col-span-2 .row-span-2}\n\n- Manages user sessions and login-related settings.\n\n| Command                           | Description                                    |\n| --------------------------------- | ---------------------------------------------- |\n| `loginctl list-sessions`          | List all active sessions                       |\n| `loginctl list-users`             | List logged-in users                           |\n| `loginctl user-status <UID>`      | Show all sessions & processes for user `<UID>` |\n| `loginctl session-status <ID>`    | Show detailed info and logs for session `<ID>` |\n| `loginctl show-session <ID>`      | Show machine-parsable properties of a session  |\n| `loginctl terminate-session <ID>` | End all processes in session `<ID>`            |\n| `loginctl lock-session <ID>`      | Lock the specified session                     |\n| `loginctl unlock-session <ID>`    | Unlock the specified session                   |\n\n{.left-text}\n\n### systemd-analyze{#systemd-analyze .col-span-2}\n\n- Analyze system boot performance and unit dependencies.\n\n| Command                           | Description                           |\n| --------------------------------- | ------------------------------------- |\n| `systemd-analyze`                 | Show total boot time breakdown        |\n| `systemd-analyze blame`           | List services ordered by startup time |\n| `systemd-analyze plot > boot.svg` | Generate SVG visual of boot sequence  |\n\n{.left-text}\n\n### systemd-cgtop{#systemd-cgtop .col-span-2}\n\n- Real-time monitoring of resource usage by cgroups (CPU, memory, I/O).\n\n| Command                    | Description                        |\n| -------------------------- | ---------------------------------- |\n| `systemd-cgtop`            | Monitor top cgroups resource usage |\n| `systemd-cgtop -c`         | Sort cgroups by CPU usage          |\n| `systemd-cgtop -d <delay>` | Change refresh delay interval      |\n\n{.left-text}\n\n### timedatectl{#timedatectl .col-span-2}\n\n- Manage system date, time, timezone, and NTP synchronization.\n\n| Command                             | Description                     |\n| ----------------------------------- | ------------------------------- |\n| `timedatectl status`                | Show current date/time settings |\n| `timedatectl list-timezones`        | List all available timezones    |\n| `timedatectl set-timezone <Zone>`   | Set system timezone             |\n| `timedatectl set-time \"YYYY-MM-DD\"` | Manually set date               |\n| `timedatectl set-time \"HH:MM:SS\"`   | Manually set time               |\n| `timedatectl set-ntp true`          | Enable NTP sync                 |\n| `timedatectl set-ntp false`         | Disable NTP sync                |\n\n{.left-text}\n\n### resolvectl{#resolvectl .col-span-2}\n\n- Interact with systemd-resolved DNS resolver service.\n\n| Command                                | Description                                     |\n| -------------------------------------- | ----------------------------------------------- |\n| `resolvectl status`                    | Show DNS configuration and link info            |\n| `resolvectl query <hostname>`          | Resolve hostname via systemd-resolved           |\n| `resolvectl dns <interface> <IP>`      | Set DNS server(s) for a specific interface      |\n| `resolvectl domain <interface> <name>` | Set search domain(s) for an interface           |\n| `resolvectl flush-caches`              | Clear the DNS cache managed by systemd-resolved |\n| `resolvectl reset-statistics`          | Reset all DNS resolution statistics             |\n\n{.left-text}\n\n### hostnamectl{#hostnamectl .col-span-4}\n\n- Query and set the system hostname (static, transient, pretty) and related metadata.\n\n#### ↓ Commands\n\n| Command                                       | Description                                      |\n| --------------------------------------------- | ------------------------------------------------ |\n| `hostnamectl status`                          | Show current hostname & system info              |\n| `hostnamectl hostname <NAME>`                 | Set the static/transient/pretty hostname         |\n| `hostnamectl set-hostname <NAME> --static`    | Set only the static hostname                     |\n| `hostnamectl set-hostname <NAME> --transient` | Set only the transient hostname                  |\n| `hostnamectl set-hostname <NAME> --pretty`    | Set the pretty (user-friendly) hostname          |\n| `hostnamectl set-chassis <TYPE>`              | Set chassis type (e.g., desktop, laptop, server) |\n\n{.left-text}\n\n#### ↓ Description\n\n```markdown\n- Static - The permanent hostname stored in `/etc/hostname`. Used at boot time.\n- Transient - Temporary hostname set at runtime (often by DHCP or manually). Lost on reboot.\n- Pretty - A user-friendly, display name (can include spaces and special characters).\n```\n\n{.left-text}\n\n### systemd-run{#systemd-run .col-span-4}\n\n- Run a command as a transient systemd unit (service, scope, timer, etc.).\n\n| Command                                                  | Description                                        |\n| -------------------------------------------------------- | -------------------------------------------------- |\n| `systemd-run <command>`                                  | Run command as a transient `.service` unit         |\n| `systemd-run -p BlockIOWeight=10 updatedb`               | Run with a specific resource limit property        |\n| `systemd-run -p MemoryMax=100M script.sh`                | Run a memory-hungry task with a memory usage limit |\n| `systemd-run --on-calendar='YYYY-MM-DD HH:MM' script.sh` | Schedule script to run at a specific date and time |\n| `systemd-run -E VAR=value script.sh`                     | Run a script with environment variables set        |\n\n{.left-text}\n\n#### Types of systemd limits{.col-span-3}\n\n```markdown\nThere are different kinds of limit that can be imposed:\n\n- CPU Limits\n- Memory Limits\n- I/O Limits\n- Task/Thread Limits\n- Security/Isolation\n- Execution/Environment\n```\n\nExample\n\n```bash\nsystemd-run -p MemoryMax=100M -p CPUQuota=50% scriptFile.sh\n```\n\n## Also See\n\n- [linux training academy](https://www.linuxtrainingacademy.com/systemd-cheat-sheet/)\n- [linux Audit Cheat Sheet](https://linux-audit.com/cheat-sheets/systemd/)\n- [RedHat Reference](https://www.redhat.com/en/blog/systemd-commands)\n"
  },
  {
    "path": "source/_posts/table-plus.md",
    "content": "---\ntitle: TablePlus\ndate: 2022-11-23 16:23:31.706905\nbackground: bg-[#ecc550]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 34 keyboard shortcuts found in TablePlus\n---\n\n## Keyboard Shortcuts\n\n### Global\n\n| Shortcut           | Action                |\n| ------------------ | --------------------- |\n| `Ctrl` `N`         | Open a new connection |\n| `Ctrl` `Q`         | Quit app              |\n| `Ctrl` `Shift` `O` | Open SQL file         |\n| `Ctrl` `,`         | Open Preferences      |\n\n{.shortcuts}\n\n### Workspace\n\n| Shortcut               | Action                         |\n| ---------------------- | ------------------------------ |\n| `Ctrl` `W`             | Close a tab/window             |\n| `Ctrl` `S`             | Commit the changes             |\n| `Ctrl` `T`             | Open a new tab                 |\n| `Ctrl` `L`             | Open plugin manager            |\n| `Ctrl` `.`             | Run custom script              |\n| `Ctrl` `R`             | Reload workspace               |\n| `Ctrl` `[`             | Navigate to left tab           |\n| `Ctrl` `]`             | Navigate to right tab          |\n| `Ctrl` `Shift` `[`     | Navigate to left Pane          |\n| `Ctrl` `Shift` `]`     | Navigate to right Pane         |\n| `Ctrl` `D`             | Split Pane horizontally        |\n| `Ctrl` `1-9`           | Navigate to number tab         |\n| `Ctrl` `K`             | Switch database                |\n| `Ctrl` `Shift` `K`     | Switch connection              |\n| `Ctrl` `I`             | Indent selected SQL Code       |\n| `Ctrl` `E`             | Execute SQL Code               |\n| `Ctrl` `O`             | Open file SQL                  |\n| `Ctrl` `Shift` `Enter` | Uglify selected SQL statements |\n| `Ctrl` `\\`             | Comment/Uncomment lines of SQL |\n| `Ctrl` `Z`             | Undo                           |\n| `Ctrl` `Shift` `Z`     | Redo                           |\n| `Ctrl` `P`             | Open anything                  |\n| `Ctrl` `E`             | Open SQL Query                 |\n| `Ctrl` `(click)`       | Open item in new tab           |\n| `Tab`                  | Move focus while editing       |\n\n{.shortcuts}\n\n### Table Data\n\n| Shortcut         | Action                              |\n| ---------------- | ----------------------------------- |\n| `Space`          | Toggle row detail when row selected |\n| `Ctrl` `C`       | Copy rows                           |\n| `Ctrl` `V`       | Paste rows                          |\n| `Ctrl` `Alt` `I` | Insert a new row                    |\n| `Tab`            | Move focus while editing            |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for TablePlus app](https://tableplus.com/blog/2018/02/shortcut-keys.html) _(tableplus.com)_\n"
  },
  {
    "path": "source/_posts/taskset.md",
    "content": "---\ntitle: Taskset\ndate: 2023-04-07 14:25:44\nbackground: bg-[#8bbb55]\ntags:\n  - process\n  - process manager\ncategories:\n  - Linux Command\nintro:\n  The taskset command is used to set or retrieve the CPU affinity of a running process given its pid, or to launch a new\n  command with a given CPU affinity.\nplugins:\n  - copyCode\n---\n\n## Getting Started {.cols-3}\n\n### Usage\n\nThe default behavior is to run a new command with a given affinity mask\n\n```shell\n$ taskset [mask] [command] [arguments]\n```\n\n#### Usage #2\n\n```shell\n$ taskset -p [pid]\n```\n\n---\n\n```shell\n$ taskset -p [mask] [pid]\n```\n\nYou can also retrieve the CPU affinity of an existing task\n\n### Common Options {.col-span-2}\n\n| Command | Alternavite | Meaning                                                                                                                                                  |\n| ------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `-a`    | --all-tasks | Set or retrieve the CPU affinity of all the task (threads) for a given PID.                                                                              |\n| `-c`    | --cpu-list  | Interpret mask as numerical list of processors instead of a bitmask.</br>Numbers are separated by commas and may include ranges. For example: `0,5,8-11` |\n| `-p`    | --pid       | Operate on an existing PID and do not launch a new task.                                                                                                 |\n| `-h`    | --help      | Display help text and exit.                                                                                                                              |\n| `-v`    | --version   | Print version and exit.                                                                                                                                  |\n\n{.show-header}\n\n## Example\n\n### View CPU Affinity\n\n```shell\n$ taskset -cp 29523\npid 29523's current affinity list: 0-15\n```\n\nThat mean process with PID `29523` is active on CPU range from `[0,1,...,15]` which means `16` total.\n\n**PID**: Process Identifier - is a unique numerical identifier given to each running process, you can view PID of\nprocesses in `top` or `htop` tools\n\n_If you run the above command but get the message `bad usage`, try with PID = 1_\n\n```shell\n$ taskset -cp 1\n```\n\n### Set CPU Affinity\n\nNow let's try to set process in to a specify CPU. For example, we have a process has PID = 14846\n\nLet's see the CPU affinity list of this process first:\n\n```shell\n$ taskset -cp 14846\npid 14846's current affinity list: 0-15\n```\n\n#### Change CPU affinity to 1:\n\n```shell\n$ taskset -cp 1 14846\npid 14846's current affinity list: 0-15\npid 14846's new affinity list: 1\n```\n\nAs we see, CPU affinity was changed\n\n### Set CPU Affinity with multiple value\n\nThat mean new CPU affinity list is `[0,1,2,3]`\n\n```shell\n$ taskset -cp 0-3 14846\npid 14846's current affinity list: 1\npid 14846's new affinity list: 0-3\n```\n\nYou can set single CPU with the following command:\n\n```shell\n$ taskset -cp 5,8,12 14846\npid 14846's current affinity list: 0-3\npid 14846's new affinity list: 5,8,12\n```\n\nThat mean new CPU affinity list is `[5,8,12]`\n\n### Other\n\nYou can set affinity by range with other like a specify CPU\n\n```shell\n$ taskset -cp 1-3,12 14846\n```\n\nOr\n\n```shell\n$ taskset -cp 1-6:2 14846\n```\n\nThe suffix \":N\" specifies stride in the range, for example 0-10:3 is interpreted as 0,3,6,9 list.\n\n## Also see\n\n[taskset — Linux manual page](https://man7.org/linux/man-pages/man1/taskset.1.html) _(man7.org)_\n"
  },
  {
    "path": "source/_posts/telegram.md",
    "content": "---\ntitle: Telegram Desktop\ndate: 2022-11-23 16:23:31.700963\nbackground: bg-[#50a1dc]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 37 keyboard shortcuts found on the Telegram Desktop app\n---\n\n## Keyboard Shortcuts\n\n### Chats\n\n| Shortcut             | Action                        |\n| -------------------- | ----------------------------- |\n| `Up/Down`            | In-Chat Navigation            |\n| `Up/Down/Left/Right` | Suggested Stickers Navigation |\n| `Left/Right`         | Suggested Emojis Navigation   |\n| `Ctrl` `Tab`         | Move to the Chat Below        |\n| `Ctrl` `Shift` `Tab` | Move to the Chat Above        |\n| `Esc`                | Exit                          |\n| `Esc`                | Go Back                       |\n| `Esc`                | Cancel Current Action         |\n| `Ctrl` `O`           | Send File                     |\n\n{.shortcuts}\n\n### Messages\n\n| Shortcut              | Action                              |\n| --------------------- | ----------------------------------- |\n| `Ctrl` `Up/Down`      | Reply to a Message                  |\n| `Ctrl` `Down`         | Cancel Reply                        |\n| `Up`                  | Edit Last Message Sent              |\n| `Del`                 | Delete Currently Selected Message   |\n| `Ctrl` `E`            | Edit Media                          |\n| `Ctrl` `(click gif)`  | Send GIF Directly                   |\n| `Ctrl` `(click name)` | Open Bot Profile via Inline Message |\n\n{.shortcuts}\n\n### Search\n\n| Shortcut   | Action               |\n| ---------- | -------------------- |\n| `Ctrl` `F` | Search Selected Chat |\n| `Esc`      | Exit Search          |\n\n{.shortcuts}\n\n### QuickShare Panel\n\n| Shortcut       | Action       |\n| -------------- | ------------ |\n| `Up/Down`      | Navigate     |\n| `Enter`        | Select Chat  |\n| `Backspace`    | Remove Chat  |\n| `Ctrl` `Enter` | Send Message |\n\n{.shortcuts}\n\n### Jump to\n\n| Shortcut              | Action                          |\n| --------------------- | ------------------------------- |\n| `Alt` `Enter`         | Jump to the bottom of the chat  |\n| `Alt` `Enter`         | Scroll the chat list to the top |\n| `Ctrl` `0`            | Jump to your saved messages     |\n| `Ctrl` `1-5`          | Jump between folders            |\n| `Ctrl` `Shift` `Down` | Jump to the next folder         |\n| `Ctrl` `Shift` `Up`   | Jump to the previous folder     |\n\n{.shortcuts}\n\n### Window Related\n\n| Shortcut   | Action                  |\n| ---------- | ----------------------- |\n| `Ctrl` `W` | Minimize to System Tray |\n| `Ctrl` `Q` | Quit Telegram           |\n| `Ctrl` `L` | Lock Telegram           |\n| `Ctrl` `M` | Minimize Telegram       |\n\n{.shortcuts}\n\n### Selected Text\n\n| Shortcut           | Action            |\n| ------------------ | ----------------- |\n| `Ctrl` `B`         | Bold              |\n| `Ctrl` `I`         | Italic            |\n| `Ctrl` `K`         | Create Link       |\n| `Ctrl` `U`         | Underline         |\n| `Ctrl` `Shift` `M` | Monospace         |\n| `Ctrl` `Shift` `N` | Null / Plain Text |\n| `Ctrl` `Shift` `X` | Strikethrough     |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Telegram Desktop](https://github.com/telegramdesktop/tdesktop/wiki/Keyboard-Shortcuts)\n  _(github.com)_\n"
  },
  {
    "path": "source/_posts/telnet.md",
    "content": "---\ntitle: Telnet\ndate: 2025-08-10 18:28:43\nbackground: bg-indigo-400\ntags:\n  - network\n  - scan\n  - port\ncategories:\n  - Linux Command\nintro:\n  This cheat sheet is intended to be a quick reminder for the main concepts involved in using the command line program\n  telnet and assumes you already understand its usage.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Usage\n\nStandard usage (i.e. a host to connect can be by ip or by domain)\n\n```shell script\n$ telnet [options] target [port]\n```\n\ncommunicate over http protocol\n```shell script\n$ telnet example.com 80\n```\n\ncreate traceroute file\n```shell script\n$ telnet example.com 80\n```\n\n\n### Option examples\n\n| Option | Example                                   | Operation                                            |\n| ------ | ----------------------------------------- | ---------------------------------------------------- |\n| `-E`   | telnet -E target port                      | To treat all characters as data and prevent dropping to command\n| `-e`   | telnet -e '^C' host                     | Set a custom escape character  instead of default ^]                   |\n| `-l`   | telnet -l alice host           |   Pass a username to the remote host              |\n| `-d`   | telnet -d host           |   Enable debug mode              |\n| `-l`   | telnet -n host           |   Creates a trace file              |\n\n## Also see\n\n- [Telnet manpage](https://www.commandlinux.com/man-page/man1/telnet.1.html)\n\n"
  },
  {
    "path": "source/_posts/tensorflow.md",
    "content": "---\ntitle: Tensorflow\ndate: 2025-11-04\nbackground: bg-[#ffa800]\ntags:\n  - AI\n  - Python\ncategories:\n  - Other\nintro: This is a quick reference list of cheat sheets for Tensorflow. See also [Tensorflow website](https://tensorflow.org/).\n---\n\n## Imports { .cols-1 }\n\n### General\n\n```\nimport tensorflow as tf                             # root package\nimport tensorflow_datasets as tfds                  # dataset representation and loading\nmodel.compile(optimizer, loss, metrics)             # compile necessary components for training and evaluation\nmodel.fit(x_train, y_train, epoch, batch_size)      # model training\nmodel.evaluate(x_test, y_test)                      # model evaluation\n```\n\n## Tensors { .cols-1 }\n\n### Basic Operations\n```\na = tf.constant(5) + tf.constant(3)      # tf.constant is an immutable tensor storing the fixed value\na.numpy()                                # This will return the value, which is 8\nb = tf.Variable(10)                      # tf.Variable is a shared state for an entire execution time\nb.assign(15)                             # this assign the new value to the variable\nwith tf.GradientTape() as tape:          # record operations on variables for automatic differentiation\n```\n\n### Creation\n\n```\nx = \ntf.random_normal_initializer(mean, std)            # tensor with independent N(mean,stf) entries\ntf.random_uniform_initializer(min_val, max_val)    # tensor with independent Uniform(min_val, max_val) entries\nx = tf.[ones|zeros](*size)          # tensor with all 1's [or 0's]\ny = x.clone()                       # clone of x\nwith torch.no_grad():               # code wrap that stops autograd from tracking tensor history\nrequires_grad=True                  # arg, when set to True, tracks computation\n                                    # history for future derivative calculations\n```\n\n### Dimensionality\n\n```\ntf.shape                               # shape of the tensor\ntf.rank                                # number of dimension of the tensors\ntf.size                                # number of elements in the tensor?\nx = tf.concat(tensor_seq, axis=0)      # concatenates tensors along axis\ny = tf.reshape(tensor, [new_shape])    # reshapes x into size (a,b,...)\ny = tf.reshape(tensor, [(-1,a])        # reshapes x into size (b,a) for some b\ny = x.permute(*dims)                   # permutes dimensions\ny = tf.expand_dims(x)                  # tensor with added axis\ny = tf.expand_dims(x, axis=2)          # (a,b,c) tensor -> (a,b,1,c) tensor\n```\n\n### Algebra\n\n```\ntf.add(a, b), a + b        # matrix addition\ntf.multiply(a, b), a * b   # matrix-vector multiplication\ntf.matmul(a, b), a @ b     # matrix multiplication\ntf.transpose()             # matrix transpose\n```\n\n### GPU Usage\n\n```\ngpus = tf.config.list_physical_devices('GPU')              # check whether there is a GPU usage\nif gpus:\n\ntf.device()                                                # manual device placement\n                                                           # either \"/CPU:0\", \"/GPU:0\", or other qualified name\n                                                           # of the second GPU of your machine\n\ntry:\n    tf.config.set_visible_devices(gpus[0], 'GPU')          # Limiting GPU memory growth\n\n\n```\n\n## Deep Learning Models { .cols-1 }\n\n### Creating Models\n```\ntf.keras.Sequential                                # stack layers in a way that the computation\n                                                   # will be performed sequentially\n```\n\n### Layers\n\n```\ntf.keras.layers.Dense(m,n)                          # fully connected layer from\n                                                    # m to n units\n\ntf.keras.layers.ConvXd(m,n,s)                       # X dimensional conv layer from\n                                                    # m to n channels where X⍷{1,2,3}\n                                                    # and the kernel size is s\n\ntf.keras.layers.MaxPoolXd(s)                        # X dimension pooling layer\n                                                    # (notation as above)\n\ntf.keras.layers.BatchNormalization                  # batch norm layer\ntf.keras.layers.RNN/LSTM/GRU                        # recurrent layers\ntf.keras.layers.Dropout(rate=0.5)                   # dropout layer for any dimensional input\ntf.keras.layers.Embedding(input_dim, output_dim)    # (tensor-wise) mapping from\n                                                    # indices to embedding vectors\n```\n\n### Loss Functions\n\n```\ntf.keras.losses.X                   # where X is BinaryCrossentropy, BinaryFocalCrossentropy, CTC\n                                    # CategoricalCrossentropy, CategoricalFocalCrossentropy,\n                                    # CategoricalHinge, CosineSimilarity, Dice, Hinge, Huber\n                                    # KLDivergence, LogCosh, MeanAbsoluteError, MeanAbsolutePercentageError\n                                    # MeanSquaredError, MeanSquaredLogarithmicError, Poisson\n                                    # Reduction, SparseCategoricalCrossentropy, SquaredHinge, Tversky\n```\n\n### Activation Functions\n\n```\ntf.keras.activations.X                # where X is ReLU, ReLU6, ELU, SELU, PReLU, LeakyReLU,\n                                      # RReLu, CELU, GELU, Threshold, Hardshrink, HardTanh,\n                                      # Sigmoid, LogSigmoid, Softplus, SoftShrink,\n                                      # Softsign, Tanh, TanhShrink, Softmin, Softmax,\n                                      # Softmax2d, LogSoftmax or AdaptiveSoftmaxWithLoss\n```\n\n### Optimizers\n\n```\nopt = tf.keras.optimizer.x(model.parameters(), ...)      # create optimizer\nopt.step()                                  # update weights\noptim.X                                     # where X is SGD, Adadelta, Adafactor,\n                                            # Adagrad, Adam, AdamW, Adamax, Ftrl, Lion,\n                                            # LossScaleOptimizer ,RMSprop or Rprop\n```\n\n### Learning rate scheduling - Callbacks\n\n```\ncallbacks = tf.keras.callbacks.LearningRateScheduler(scheduler)     # create lr scheduler\nmodel.fit(..., callbacks=[callback], ....)                          # update lr after optimizer updates weights\n                                                                    # using with fit(), evaluate(), and predict()\n```\n\n### Saving and Loading Models\n```\ntf.keras.models.clone_model(...)         # Clone a Functional or Sequential Model instance.\ntf.keras.models.load_model(...)          # Loads a model saved via model.save().\ntf.keras.models.model_from_json(...)     # Parses a JSON model configuration string and returns a model instance.\ntf.keras.models.save_model(...)          # Saves a model as a .keras file.\n```\n\n## Data Utilities { .cols-1 }\n\n### Datasets\n\n```\npip install tensorflow-datasets          # install the module\ntfds.load('mnist', split, shuffle_files) # loading a dataset\n```\n"
  },
  {
    "path": "source/_posts/terraform.md",
    "content": "---\ntitle: Terraform\ndate: 2024-4-18\nbackground: bg-[#7345b6]\ntags:\n  - container\n  - virtual\ncategories:\n  - Programming\nintro: |\n  This is a quick reference cheat sheet for [Terraform](https://docs.docker.com/get-started/).\nplugins:\n  - copyCode\n---\n\n## HCL Syntax: {.cols-2}\n\n```\n(Block Name)  (Resource Type)  (Resource Name)\n      |           |                 |\n      ▽           ▽                 ▽\n  resource \"aws_instance\" \"my_aws_server\" {\n                                            --\n      ami           = \"ami-1251351351513\"    |<--(Arguments)\n      instance_type = \"t2.micro\"             |\n                                            --\n\n}\n\n```\n\n### Variable Types\n\n- Simple types: number, string, bool, null.\n\n- Complex types: Collection types: list, map, set Structural types: `object({<KEY> = <TYPE>, ...})`,\n  `tuple([<TYPE>, ...])`\n\nOrder of Precedence: defaults < env vars < terraform.tfvars file < terraform.tfvars.json file < .auto.tfvars < command\nline (-var & -var-file)\n\n```\nvariable \"<VAR NAME>\" {\n    description = \"<DESCRIPTION OF THE VAR>\"\n    type        = <VAR TYPE>\n    default     = <DEFAULT VALUE>\n}\n\n# type string\nvariable \"aws_region\" {\n    description = \"AWS Region\"\n    type        = string\n    default     = \"us-east-1\"\n}\n\n# type list(string)\nvariable \"azs\" {\n    description = \"AZs in the Region\"\n    type        = list(string)\n    default     = [ \"us-east-1a\", \"us-east-1b\", \"us-east-1c\"]\n}\n\n# type map\nvariable \"amis\" {\n    type = map(string)\n    default = {\n      \"eu-west-1\" = \"ami-0fdke15151513145\",\n      \"us-east-1\" = \"ami-0d17359173587519\"\n    }\n}\n\n# type object\nvariable \"egress_dsg\" {\n    type = object({\n        from_port = number\n        to_port = number\n        protocol = string\n        cidr_blocks = list(string)\n    })\n    default = {\n     from_port = 0,\n     to_port = 65365,\n     protocol = \"tcp\",\n     cidr_blocks = [\"100.0.0.0/16\", \"200.0.0.0/16\", \"0.0.0.0/0\"]\n    }\n}\n```\n\n## Meta-Arguments\n\n### Loops\n\ncount, for_each, [for( o in var.list: o.id])\n\n```\n# creating multiple EC2 instances using count\nresource \"aws_instance\" \"server\" {\n  ami = \"ami-06ec8443c2a35b0ba\"\n  instance_type = \"t2.micro\"\n  count = 3  # creating 3 resources\n}\n\n# declaring a variable\nvariable \"users\" {\n  type = list(string)\n  default = [\"demo-user\", \"admin1\", \"john\"]\n}\n\n# creating IAM users using for_each\nresource \"aws_iam_user\" \"test\" {\n  for_each = toset(var.users) # converts a list to a set\n  name = each.key\n}\n\n# A for expression creates a complex type value by transforming another complex type value.\nvariable \"names\" {\n    type = list\n    default = [\"som\", \"john\", \"mary\"]\n}\n\noutput \"show_names\" {\n    # similar to Python's list comprehension\n    value = [for n in var.names : upper(n)]\n}\n\noutput \"short_upper_names\" {\n  # filter the resulting list by specifying a condition:\n  value = [for name in var.names : upper(name) if length(name) > 7]\n}\n```\n\n### Splat\n\n`Splat(var.list[*].id)`\n\n```\n# Launch an EC2 instance\nresource \"aws_instance\" \"server\" {\n  ami = \"ami-05cafdf7c9f772ad2\"\n  instance_type = \"t2.micro\"\n  count = 3\n}\n\noutput \"private_addresses\"{\n  value = aws_instance.server[*].private_ip  # splat expression\n}\n```\n\n### depends_on\n\nif two resources depends on each other, depends_on specifies that dependency to enforce ordering\n\n```\nresource \"aws_iam_role_policy\" \"example\" {\n    name = \"example\"\n    role = \"s3 access\"\n    policy = jsonencode({\n      \"Statement\" = [{\n        \"Action\" = \"s3:*\",\n        \"Effect\" = \"Allow\",\n      }],\n    })\n}\n\nresource \"aws_instance\" \"my_server\" {\n    ami  = \"ami-a255235\"\n    instance_type = \"t2.micro\"\n\n    iam_instance_profile = aws_iam_instance_profile.my_server\n\n    depends_on = [\n      aws_iam_role_policy.example,\n    ]\n```\n\n### lifecycle\n\nA set of meta arguments to control behavior specific resources\n\n```\nresources \"aws_instance\" \"server\" {\n  ami           = \"ami-a1b3414\"\n  instance_type = \"t2.micro\"\n\n  lifecycle {\n    create_before_destroy = true\n    ignore_changes = [\n      # Some resources have metadata\n      # modified automatically outside of TF\n\n      tags\n    ]\n  }\n}\n```\n\n### Conditionals\n\n`condition ? true_val : false_val`\n\n### Built-In functions\n\n| Function                                   | Result                  |\n| ------------------------------------------ | ----------------------- |\n| `max(5, 10, 9)`                            | 12                      |\n| `min(5, 10, 9)`                            | 5                       |\n| `format(\"There are %d servers\", 4)`        | There are 4 lights      |\n| `join(\",\" [\"foo\", \"bar\", \"baz\"])`          | foo,bar,baz             |\n| `split(\",\", \"foo,bar,baz\")`                | `[\"foo\", \"bar\", \"baz\"]` |\n| `replace(\"hi world\", \"/w.*d/\", \"mom\"`      | hi mom                  |\n| `substr(\"hello world\", 1, 4)`              | ello                    |\n| `lookup({a=\"lol\", b=\"sad\"}, \"a\", \"what?\")` | lol                     |\n| `lookup({a=\"lol\", b=\"sad\"}, \"c\", \"what?\")` | what?                   |\n| `slice([\"a\", \"b\", \"c\", \"d\"], 1, 3)`        | `[\"b\", \"c\"]`            |\n| `timestamp()`                              | \"2022-04-02T05:52:48Z\"  |\n| `cidr(\"10.1.2.240/28\", 1)`                 | 10.1.2.241              |\n| `cidr(\"10.1.2.240/28\", 14)`                | 10.1.2.254              |\n\n### Provider block\n\nDetails of the provider(s) being used. Includes information like access mechanisms, regional options, profile touse etc.\n\n```\nprovider \"aws\" {\n  region = \"us-east-1\"\n}\n\n# Additional provider config reference as `aws.west`.\nprovider \"aws\" {\n  alias  = \"west\"\n  region = \"us-west-2\"\n}\n```\n\n### Requiring Providers\n\n```\nterraform {\n\n  # required_providers block specifies source and version\n  required_providers {\n    aws = {\n      source  = \"hashicorp/aws\" # where to find the provider\n      version = \"5.8.0\" # which version of the provider is needed for this config\n    }\n  }\n}\n```\n\n### Locals block\n\nA local value assigns a name to an expression, so you can use the name multiple times within a module instead of\nrepeating the expression\n\n```\nlocals {\n  service_name = \"forum\"\n  owner        = \"Community Team\"\n}\n\n# once local declared you can reference it\nlocals {\n  common_tags = {\n    Service = local.service_name\n    Owner   = local.owner\n```\n\n### Output block\n\n```\noutput \"api_base_url\" {\n  value = \"https://${aws_instance.example.private_dns}:8433/\"\n\n  # The EC2 instance must have an encrypted root volume.\n  precondition {\n    condition     = data.aws_ebs_volume.example.encrypted\n    error_message = \"The server's root volume is not encrypted.\"\n  }\n\n  # output can be marked as containing sensitive\n  sensitive = true # output can be marked as containing sensitive\n}\n```\n\n### Data block\n\nData sources that can be queried (cloud provider, local list, etc.)\n\n```\ndata \"aws_ami\" \"example\" {\n  most_recent = true\n\n  owners = [\"self\"]\n  tags = {\n    Name   = \"app-server\"\n    Tested = \"true\"\n  }\n}\n```\n\n### Modules\n\n```\nmodule \"myec2\" {\n  source = \"../modules/ec2\"\n\n  # module inputs\n  ami_id = var.ami_id\n  instance_type = var.instance_type\n  servers = var.servers\n}\n```\n\n### Backends\n\nA backend defines where Terraform stores its state data files.\n\nAvailable backends: local(default), remote, azurerm, consul, cos, gcs, http, Kubernetes, oss, pg, s3\n\n```\nterraform {\n  backend \"remote\" {\n    organization = \"example_corp\"\n\n    workspaces {\n      name = \"my-app-prod\"\n    }\n  }\n}\n```\n\n### Resource Addressing\n\n| Example                                           | Description             |\n| ------------------------------------------------- | ----------------------- |\n| `[module path][resource info`                     | Resource path syntax    |\n| `module.<MODULE_PATH>[optional] module index`     | Module path syntax      |\n| `resource_type.user_defined_name[optional index]` | Resource spec syntax    |\n| `<RESOURCE_TYPE>.<NAME>`                          | List all images         |\n| `var.<NAME>`                                      | Input Variable          |\n| `local.<NAME>`                                    | Locals                  |\n| `module.<MODULE_NAME>`                            | Child module outputs    |\n| `data.<DATA TYPE>.<NAME>`                         | Data blocks             |\n| `path.module`                                     | Location of expresssion |\n| `path.root`                                       | Root Module location    |\n| `terraform.workspace`                             | Current workspace       |\n\n---\n\n## Terraform CLI\n\n<!-- I don't know what this means but it doesn't fit in a category and breaks the content -->\n<!-- I'm leaving it commented... -->\n\n<!-- Create/Edit TF config file -> init -> plan -> validate -> apply -> destroy -->\n\n### Initialization\n\n```sh\nterraform init [options]\n\n    -upgrade            # Install latest module & provider versions\n    -reconfigure        # reconfigure backend, ignoring any saved config\n    -backend=false      # Disable backend & use previous Initialization\n    -migrate-state      # reconfigure backend & attempt to migrate any existing state\n```\n\n### Planning\n\nGenerates & review an execution plan\n\n```sh\nterraform plan [options]\n\n    -var 'user=john'    # set value for input vars in the root module of config\n    -var-file=filename  # load var values from the given file\n    -input=true         # ask for input for vars if not directly set\n    -out=path           # write a plan file to given path. can be used as input for \"apply\"\n    -refresh-only       # verifies remote object consistency without proposing actions to undo changes done outside TF\n    -destroy            # create plan to destroy all objects currenly managed\n    -target=resource    # target planning to given resouce & its dependencies only.\n\nterraform plan -refresh-only # updates state to match changes made outside of TF. Good for drift detection\n\n```\n\n### Validation\n\n```sh\nterraform validate      # Validates the config files for errors\n\n```\n\n### Apply\n\nExecutes changes to infra\n\n```sh\nterraform apply [options]\n\n    -auto-approve       # skip interactive approval of plan before applying\n    -replace            # force replacement of a particular resource instance\n    -var 'foo=bar'      # set a value for input vars in the root module of config\n    -var-file=filename  # load var values from the given file\n    -parallelism=n      # limit the no of concurrent operations. Default=10\n\nterraform apply -auto-approve var-file=web-dev.tfvars\nterraform apply -replace=\"aws_instance.server\"\nterraform plan -refresh-only # Updates statefile to accept changes made manually.\n```\n\n### Destroy\n\nDestroy (deletes) Terraform managed infra. Same as `terraform apply -destroy `\n\n```sh\nterraform destroy [options]\n\n    -auto-approve        # skip interactive approval before destroying\n    -target              # limits destroy to only given resource & its dependencies\n\n\nterraform destroy -target aws_vpc.my_vpc -auto-approve\n```\n\nMiscellaneous\n\n```sh\nterraform state show aws_instance.my_vm\nterraform state pull > my_terraform.tfstate\nterraform state mv aws_iam_role.my_ssm_role\nterraform state list\nterraform state rm aws_instance.my_server\n\nterraform import aws_instance.new_server i-243abc\nsudo apt install graphviz\nterraform graph | dot -Tpng > graph.png\n```\n\nLogging\n\nlog levels = TRACE > DEBUG > INFO > WARN > ERROR\n\n```sh\nexport TF_LOG_CORE=TRACE     # enable core logging\nexport TF_LOG_PROVIDER=TRACE # enable provider logging\nexport TF_LOG_PATH=logs.txt  # to persist logs\n```\n\n## Also See\n\n- [Docs](https://developer.hashicorp.com/terraform/language)\n- [Good FCC Article](https://www.freecodecamp.org/news/terraform-certified-associate-003-study-notes/)\n"
  },
  {
    "path": "source/_posts/ticktick.md",
    "content": "---\ntitle: TickTick\ndate: 2022-11-23 16:23:31.696573\nbackground: bg-[#526ac9]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 25 keyboard shortcuts found in the TickTick desktop app\n---\n\n## Keyboard Shortcuts (Mac) {.cols-3}\n\n### General\n\n| Shortcut          | Action            |\n| ----------------- | ----------------- |\n| `Cmd` `S`         | Sync task         |\n| `Esc`             | Cancel            |\n| `Cmd` `Z`         | Undo              |\n| `Cmd` `Shift` `Z` | Redo              |\n| `Cmd` `P`         | Print             |\n| `Cmd` `K`         | Open command menu |\n| `?`               | Shortcuts         |\n\n{.shortcuts}\n\n### Global Action\n\n| Shortcut                   | Action                   |\n| -------------------------- | ------------------------ |\n| `Ctrl` `Shift` `A`         | Quick add                |\n| `Cmd` `Shift` `O`          | Show or hide mini window |\n| `Cmd` `Option` `Shift` `P` | Start or abandon pomo    |\n\n{.shortcuts}\n\n### Navigation\n\n| Shortcut                  | Action             |\n| ------------------------- | ------------------ |\n| `G` then `S` or `Cmd` `,` | Go to Settings     |\n| `G` then `A`              | Go to All          |\n| `G` then `T`              | Go to Today        |\n| `G` then `R`              | Go to Tomorrow     |\n| `G` then `N`              | Go to Next 7 days  |\n| `G` then `M`              | Go to Assign to me |\n| `G` then `I`              | Go to Inbox        |\n| `G` then `C`              | Go to Completed    |\n| `G` then `W`              | Go to Won't do     |\n| `G` then `B`              | Go to Summary      |\n| `G` then `G`              | Go to Trash        |\n\n{.shortcuts}\n\n### Task\n\n| Shortcut         | Action         |\n| ---------------- | -------------- |\n| `Cmd` `N`        | Add task       |\n| `Return`         | Add task below |\n| `Shift` `Return` | Add subtask    |\n\n{.shortcuts}\n\n### Quick Add\n\n| Shortcut | Action                     |\n| -------- | -------------------------- |\n| `*`      | Set due date for the task  |\n| `!`      | Set priority for the task. |\n| `#`      | Set tag for the task.      |\n| `~/^`    | Add/move task to list.     |\n| `@`      | Assigned task to a member  |\n\n{.shortcuts}\n\n### Edit Tasks\n\n| Shortcut          | Action              |\n| ----------------- | ------------------- |\n| `Cmd` `Shift` `M` | Complete tasks      |\n| `Cmd` `Delete`    | Delete tasks        |\n| `Cmd` `D`         | Set date            |\n| `Cmd` `0`         | Clear date          |\n| `Cmd` `1`         | Set today           |\n| `Cmd` `2`         | Set tomorrow        |\n| `Cmd` `3`         | Set next week       |\n| `Ctrl` `0`        | Set no priority     |\n| `Ctrl` `1`        | Set low priority    |\n| `Ctrl` `2`        | Set medium priority |\n| `Ctrl` `3`        | Set high priority   |\n\n{.shortcuts}\n\n### Switch Views\n\n| Shortcut     | Action        |\n| ------------ | ------------- |\n| `V` then `L` | List View     |\n| `V` then `K` | Kanban View   |\n| `G` then `T` | Timeline View |\n| `D` / `1`    | Day View      |\n| `W` / `2`    | Week View     |\n| `M` / `3`    | Month View    |\n| `T`          | Back to Today |\n\n{.shortcuts}\n\n### Sticky Note\n\n| Shortcut          | Action              |\n| ----------------- | ------------------- |\n| `F12`             | Pin                 |\n| `Cmd` `Shift` `C` | Color               |\n| `Cmd` `E`         | Expand/Collapse All |\n| `Cmd` `Opt` `↑`   | Arrange by Top      |\n| `Cmd` `Opt` `←`   | Arrange by Left     |\n| `Cmd` `Opt` `→`   | Arrange by Right    |\n\n{.shortcuts}\n\n## Keyboard Shortcuts (Windows) {.cols-2}\n\n### General I\n\n| Shortcut           | Action                   |\n| ------------------ | ------------------------ |\n| `Ctrl` `Shift` `A` | Show quick add bar       |\n| `Ctrl` `Shift` `L` | Show or hide mini window |\n| `Ctrl` `Shift` `P` | Start or abandon pomo    |\n| `Ctrl` `S`         | Sync task                |\n| `Ctrl` `F`         | Search for a task        |\n| `Ctrl` `N`         | Add task                 |\n| `Ctrl` `Shift` `M` | Complete task            |\n| `Ctrl` `0`         | Clear date               |\n| `Ctrl` `D`         | Set date                 |\n| `Ctrl` `1`         | Set today                |\n| `Ctrl` `2`         | Set tomorrow             |\n| `Ctrl` `3`         | Set next week            |\n\n{.shortcuts}\n\n### General II\n\n| Shortcut         | Action                       |\n| ---------------- | ---------------------------- |\n| `Ctrl` `0`       | Set no priority              |\n| `Ctrl` `1`       | Set low priority             |\n| `Ctrl` `2`       | Set medium priority          |\n| `Ctrl` `3`       | Set high priority            |\n| `Ctrl` `P`       | Print                        |\n| `Ctrl` `Alt` `T` | Open today's list            |\n| `Ctrl` `Opt` `T` | Open tomorrow's list         |\n| `Ctrl` `Alt` `N` | Open next 7 days list        |\n| `Ctrl` `Alt` `A` | Open all list                |\n| `Ctrl` `Alt` `C` | Open the calendar view       |\n| `Ctrl` `Alt` `A` | Open the assigned to me list |\n| `Ctrl` `Alt` `1` | Open the inbox               |\n| `Ctrl` `Alt` `C` | Open completed tasks         |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for TickTick](https://support.ticktick.com/hc/en-us/articles/360016272252-Shortcuts)\n  _(support.ticktick.com)_\n"
  },
  {
    "path": "source/_posts/tmux.md",
    "content": "---\ntitle: Tmux\ndate: 2021-02-20 14:31:24\nbackground: bg-indigo-600\ntags:\n  - utility\n  - terminal\n  - session\ncategories:\n  - Linux Command\nintro: |\n  The tmux cheat sheet quick reference of most commonly used shortcuts and commands\nplugins:\n  - copyCode\n---\n\n## Tmux CLI\n\n### New session {.row-span-2}\n\nStart a new session\n\n```shell script\n$ tmux\n```\n\nStart a new named session\n\n```shell script\n$ tmux new -s myname\n```\n\nShow all sessions\n\n```shell script\n$ tmux ls\n```\n\n### Attach session\n\nAttach to last session\n\n```shell script\n$ tmux a\n```\n\nAttach to named\n\n```shell script\n$ tmux a -t myname\n```\n\n### Kill session {.row-span-2}\n\nKill a session by name\n\n```shell script\n$ tmux kill-ses -t myname\n```\n\nKill sessions but the current\n\n```shell script\n$ tmux kill-ses -a\n```\n\nKill sessions but 'myname'\n\n```shell script\n$ tmux kill-ses -a -t myname\n```\n\n### Tmux help\n\n```shell script\n$ tmux info\n```\n\n### Config\n\nReload config\n\n```shell script\n$ tmux source-file ~/.tmux.conf\n```\n\nShow config\n\n```shell script\n$ tmux show-options -g\n```\n\n### Copy Mode\n\n| Command      | Description                |\n| ------------ | -------------------------- |\n| `Ctrl+b` `[` | Enter copy mode            |\n| `<Space>`    | Start selection            |\n| `Enter`      | Copy selection             |\n| `q`          | Quit copy mode             |\n| `Ctrl+b` `]` | Paste contents of buffer_0 |\n\n---\n\nFor tmux version 3.5a on macOS 15.3.1 Sequoia, \"Copy Mode\" functions a bit differently:\n\n| Command          | Description     |\n| ---------------- | --------------- |\n| `Ctrl + <Space>` | Start selection |\n| `Ctrl + w`       | Copy selection  |\n\n---\n\n{.shortcuts}\n\nMainly works like selecting text in [Vim](/vim#motions)\n\n## Tmux shortcuts\n\n### Getting started {.secondary}\n\n| Shortcuts    | Description        |\n| ------------ | ------------------ |\n| `Ctrl+b` `?` | List all shortcuts |\n\n{.shortcuts .show-header}\n\n<br/>\n\n---\n\nShow every session, window, pane, etc.\n\n```shell script\n$ tmux info\n```\n\n### Panes (Splits) {.row-span-2}\n\n| Shortcuts              | Description        |\n| ---------------------- | ------------------ |\n| `Ctrl+b` `\"` _/_ `%`   | Split Horiz/Vert   |\n| `Ctrl+b` `!`           | Pane -> Window     |\n| `Ctrl+b` `x`           | Kill pane          |\n| `Ctrl+b` <Arrow\\>      | Navigate panes     |\n| `Ctrl+b` <Space\\>      | Toggle layouts     |\n| `Ctrl+b` `{` _/_ `}`   | Move to Left/Right |\n| `Ctrl+b` `o`           | Go to next panes   |\n| `Ctrl+b` `z`           | Toggle full-screen |\n| `Ctrl+b` `;`           | Toggle Last pane   |\n| `Ctrl+b` `q`           | Show numbers       |\n| `Ctrl+b` `q` `0`...`9` | Go to # pane       |\n\n{.shortcuts}\n\n### Window (Tabs) {.row-span-2}\n\n| -                    | -                    |\n| -------------------- | -------------------- |\n| `Ctrl+b` `c`         | Create window        |\n| `Ctrl+b` `p` _/_ `n` | Previous/Next window |\n| `Ctrl+b` `\"` _/_ `%` | Split Horiz/Vert     |\n| `Ctrl+b` `w`         | List window          |\n| `Ctrl+b` `,`         | Rename window        |\n| `Ctrl+b` `f`         | Find window          |\n| `Ctrl+b` `l`         | Last window          |\n| `Ctrl+b` `.`         | Move window          |\n| `Ctrl+b` `&`         | Close window         |\n| `Ctrl+b` `0`...`9`   | Go to # window       |\n\n{.shortcuts}\n\n### Session (Set of Windows)\n\n| -                    | -                              |\n| -------------------- | ------------------------------ |\n| `Ctrl+b` `d`         | <red>Detach from session</red> |\n| `Ctrl+b` `s`         | Show all sessions              |\n| `Ctrl+b` `$`         | Rename session                 |\n| `Ctrl+b` `(` _/_ `)` | Previous/Next session          |\n\n{.shortcuts}\n\n## Tmux Command Mode\n\n### Usage {.secondary}\n\n| Command      | Description        |\n| ------------ | ------------------ |\n| `Ctrl+b` `:` | Enter command mode |\n\n{.shortcuts}\n\n### Resizing\n\n| Command             | Description  |\n| ------------------- | ------------ |\n| `resize-pane -D 20` | Resize down  |\n| `resize-pane -U 20` | Resize up    |\n| `resize-pane -L 20` | Resize left  |\n| `resize-pane -R 20` | Resize right |\n\n### Listing\n\n| Command        | Description  |\n| -------------- | ------------ |\n| `list-keys`    | All commands |\n| `list-panes`   | All panes    |\n| `list-windows` | All Windows  |\n\n### Copying\n\n| Command              | Description      |\n| -------------------- | ---------------- |\n| `list-buffers`       | List all buffers |\n| `show-buffer`        | Show #0 contents |\n| `capture-pane`       | Copy of pane     |\n| `choose-buffer`      | Show and paste   |\n| `save-buffer a.txt`  | Save to file     |\n| `delete-buffer -b 1` | Delete buffer 1  |\n\n### Setting\n\n| Command                | Description          |\n| ---------------------- | -------------------- |\n| `set -g OPTION`        | Set for all sessions |\n| `setw -g OPTION`       | Set for all windows  |\n| `setw -g mode-keys vi` | Enable vi-mode       |\n| `set -g prefix C-a`    | Set prefix           |\n\n### Misc\n\n| Command                  | Description  |\n| ------------------------ | ------------ |\n| `swap-pane -s 3 -t 1`    | Swap pane    |\n| `swap-window -t -1`      | Move to left |\n| `setw synchronize-panes` | Sync Panes   |\n| `join-pane -t :#`        | Join pane    |\n"
  },
  {
    "path": "source/_posts/todoist.md",
    "content": "---\ntitle: Todoist\ndate: 2022-11-23 16:23:31.696934\nbackground: bg-[#cc4d3b]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 37 keyboard shortcuts found in Todoist\n---\n\n## Keyboard Shortcuts\n\n### Task Quick Add\n\n| Shortcut      | Action                                |\n| ------------- | ------------------------------------- |\n| `@`           | Add a label                           |\n| `#`           | Pick a project                        |\n| `+`           | Add an assignee                       |\n| `p1/p2/p3/p4` | Set a priority level                  |\n| `Ctrl` `M`    | Add a comment to a newly created task |\n| `Alt` `Enter` | Save and go to comments (Win 10 only) |\n| `Tab`         | Open full task editor (Win 10 only)   |\n\n{.shortcuts}\n\n### General\n\n| Shortcut       | Action                                   |\n| -------------- | ---------------------------------------- |\n| `Ctrl` `Click` | Select and change multiple tasks at once |\n| `Q`            | Add task                                 |\n| `A`            | Add new task at the bottom of the list   |\n| `Shift` `A`    | Add new task at the top of the list      |\n| `/`            | Open search                              |\n| `U`            | Undo last action                         |\n| `F5`           | Manually sync                            |\n| `Home`         | Navigate to default page                 |\n| `PgUp`         | Navigate back in 1-pane/2-pane view      |\n| `PgDown`       | Navigate forward in 1-pane/2-pane view   |\n\n{.shortcuts}\n\n### Adding or editing tasks\n\n| Shortcut        | Action                                                                            |\n| --------------- | --------------------------------------------------------------------------------- |\n| `Esc`           | Cancel current changes                                                            |\n| `Enter`         | Save a newly created task and create a new one below it                           |\n| `Shift` `Enter` | Save changes to an existing task and create a new task below it                   |\n| `Ctrl` `Enter`  | Save a new task or save changes to an existing one and create a new task above it |\n| `Ctrl` `Up`     | Move to the task above the task currently being edited                            |\n| `Ctrl` `Down`   | Move to the task below the task currently being edited                            |\n\n{.shortcuts}\n\n### Creating and completing sub-tasks\n\n| Shortcut             | Action                                               |\n| -------------------- | ---------------------------------------------------- |\n| `Ctrl` `Alt` `Right` | Increase task indent                                 |\n| `Ctrl` `Alt` `Left`  | Decrease task indent                                 |\n| `Shift` `(click)`    | Complete a sub-task or recurring task and archive it |\n\n{.shortcuts}\n\n### Sorting tasks inside a project\n\n| Shortcut | Action           |\n| -------- | ---------------- |\n| `S`      | Sort by date     |\n| `P`      | Sort by priority |\n| `R`      | Sort by assignee |\n\n{.shortcuts}\n\n### Navigation\n\n| Shortcut           | Action                             |\n| ------------------ | ---------------------------------- |\n| `Ctrl` `1`         | Inbox                              |\n| `Ctrl` `Shift` `1` | Team Inbox (Todoist Business only) |\n| `Ctrl` `2`         | Today                              |\n| `Ctrl` `3`         | Next 7 days                        |\n| `Ctrl` `4`         | Projects                           |\n| `Ctrl` `5`         | Labels                             |\n| `Ctrl` `6`         | Filters                            |\n| `Ctrl` `,`         | Settings                           |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Todoist](https://get.todoist.help/hc/en-us/articles/205063212-Keyboard-Shortcuts)\n  _(get.todoist.help)_\n"
  },
  {
    "path": "source/_posts/toml.md",
    "content": "---\ntitle: TOML\ndate: 2020-12-29 20:36:35\nbackground: bg-[#848484]\ntags:\n  - config\n  - format\ncategories:\n  - Programming\nintro: |\n  This is a quick reference cheat sheet to the TOML format configuration file syntax.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Introduction\n\n[TOML](https://toml.io/en/) is a minimal configuration file format that's easy to read due to obvious semantics.\n\n- [Document](https://toml.io/en/latest) _(toml.io)_\n- [Learn X in Y minutes](https://learnxinyminutes.com/docs/toml/) _(learnxinyminutes.com)_\n\n### Examples\n\n```toml\nbool = true\ndate = 2006-05-27T07:32:00Z\nstring = \"hello\"\nnumber = 42\nfloat = 3.14\nscientificNotation = 1e+12\n```\n\n### Comments\n\n```yaml\n# A single line comment example\n\n# block level comment example\n# comment line 1\n# comment line 2\n# comment line 3\n```\n\n### Integer\n\n```toml\nint1 = +42\nint2 = 0\nint3 = -21\nintegerRange = 64\n```\n\n### Float\n\n```toml\nfloat2 = 3.1415\nfloat4 = 5e+22\nfloat7 = 6.626e-34\n```\n\n### Boolean\n\n```toml\nbool1 = true\nbool2 = false\nboolMustBeLowercase = true\n```\n\n### Datetime\n\n```toml\ndate1 = 1989-05-27T07:32:00Z\ndate2 = 1989-05-26T15:32:00-07:00\ndate3 = 1989-05-27T07:32:00\ndate4 = 1989-05-27\ntime1 = 07:32:00\ntime2 = 00:32:00.999999\n```\n\n### String\n\n```toml\nstr1 = \"I'm a string.\"\nstr2 = \"You can \\\"quote\\\" me.\"\nstr3 = \"Name\\tJos\\u00E9\\nLoc\\tSF.\"\n```\n\nSee: [Strings](#toml-strings)\n\n### Table\n\n```toml\n[owner]\nname = \"Tom Preston-Werner\"\ndob = 1979-05-27T07:32:00-08:00\n```\n\nSee: [Tables](#toml-tables)\n\n### Array\n\n```toml\narray1 = [1, 2, 3]\narray2 = [\"Commas\", \"are\", \"delimiter\"]\narray3 = [8001, 8001, 8002]\n```\n\n### Friendly Array {.col-span-2}\n\n```toml\narray1 = [ \"Don't mix\", \"different\", \"types\" ]\narray2 = [ [ 1.2, 2.4 ], [\"all\", 'strings', \"\"\"are the same\"\"\", '''type'''] ]\narray3 = [\n  \"Whitespace\", \"is\",\n  \"ignored\"\n]\n```\n\n## TOML Strings\n\n### Multiline String\n\n```toml\nmultiLineString = \"\"\"\nMulti-line basic strings are surrounded\nby three quotation marks on each side\nand allow newlines.\n\"\"\"\n```\n\n### Literal String\n\n```toml {.wrap}\npath = 'C:\\Users\\nodejs\\templates'\npath2 = '\\\\User\\admin$\\system32'\nquoted = 'Tom \"Dubs\" Preston-Werner'\nregex = '<\\i\\c*\\s*>'\n```\n\nSurrounded by single quotes. Escaping are not allowed.\n\n### MultiLine Literal String\n\n```toml\nre = '''\\d{2} apps is t[wo]o many'''\nlines = '''\nThe first newline is\ntrimmed in raw strings.\nAll other whitespace\nis preserved.\n'''\n```\n\n## TOML Tables\n\n### Basic\n\n```toml\n[name]\nfoo = 1\nbar = 2\n```\n\n`foo` and `bar` are keys in the table called `name`\n\n### Nested\n\n```toml\n[table1]\n\tfoo = \"bar\"\n\n[table1.nested_table]\n\tbaz = \"bat\"\n```\n\n### Array-like {.row-span-2}\n\n```toml\n[[comments]]\nauthor = \"Nate\"\ntext = \"Great Article!\"\n\n[[comments]]\nauthor = \"Anonymous\"\ntext = \"Love it!\"\n```\n\n#### ↓ Equivalent JSON\n\n```json\n{\n  \"comments\": [\n    {\n      \"author\": \"Nate\",\n      \"text\": \"Great Article!\"\n    },\n    {\n      \"author\": \"Anonymous\",\n      \"text\": \"Love It!\"\n    }\n  ]\n}\n```\n\n### Dot separated\n\n```toml\n[dog.\"tater.man\"]\ntype = \"pug\"\n```\n\n#### ↓ Equivalent JSON\n\n```json\n{\n  \"dog\": {\n    \"tater.man\": {\n      \"type\": \"pug\"\n    }\n  }\n}\n```\n\n### Multi-nested\n\n```toml\n[foo.bar.baz]\nbat = \"hi\"\n```\n\n#### ↓ Equivalent JSON\n\n```json\n{\n  \"foo\": {\n    \"bar\": {\n      \"baz\": {\n        \"bat\": \"hi\"\n      }\n    }\n  }\n}\n```\n\n### Ignore whitespace\n\n```toml\n[a.b.c]          # this is best practice\n[ d.e.f ]        # same as [d.e.f]\n[ g .  h  .i ]   # same as [g.h.i]\n[ j . \"ʞ\" .'l' ] # same as [j.\"ʞ\".'l']\n```\n\n### Inline Table {.col-span-2}\n\n```toml\nname = { first = \"Tom\", last = \"Preston-Werner\" }\npoint = { x = 1, y = 2 }\nanimal = { type.name = \"pug\" }\n```\n"
  },
  {
    "path": "source/_posts/transmit.md",
    "content": "---\ntitle: Transmit\ndate: 2022-11-23 16:23:31.695841\nbackground: bg-[#646fed]\nlabel: Mac\ntags:\n  -\n  - mac\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 62 keyboard shortcuts found in Transmit. This application is MacOS-only.\n---\n\n## Keyboard Shortcuts\n\n### Transmit Menu\n\n| Shortcut        | Action                     |\n| --------------- | -------------------------- |\n| `Cmd` `,`       | Preferences...             |\n| `Cmd` `H`       | Hide Transmit              |\n| `Cmd` `Opt` `H` | Hide others                |\n| `Cmd` `Q`       | Quit Transmit              |\n| `Cmd` `Opt` `Q` | Quit and close all windows |\n\n{.shortcuts}\n\n### File Menu {.row-span-2}\n\n| Shortcut          | Action                      |\n| ----------------- | --------------------------- |\n| `Cmd` `N`         | New window                  |\n| `Cmd` `T`         | New tab                     |\n| `Cmd` `Shift` `N` | New folder                  |\n| `Cmd` `Opt` `N`   | New file                    |\n| `Cmd` `W`         | Close tab                   |\n| `Cmd` `Shift` `W` | Close window                |\n| `Cmd` `Opt` `W`   | Close all                   |\n| `Cmd` `E`         | Disconnect                  |\n| `Cmd` `O`         | Open                        |\n| `Cmd` `S`         | Save                        |\n| `Cmd` `B`         | Preview in browser          |\n| `Cmd` `I`         | Get info                    |\n| `Cmd` `Opt` `I`   | Show inspector              |\n| `Cmd` `D`         | Duplicate                   |\n| `Cmd` `Y`         | Quick look at selected-file |\n| `Cmd` `P`         | Print...                    |\n\n{.shortcuts}\n\n### Edit Menu\n\n| Shortcut          | Action                    |\n| ----------------- | ------------------------- |\n| `Cmd` `Z`         | Undo                      |\n| `Cmd` `Shift` `Z` | Redo                      |\n| `Cmd` `X`         | Cut                       |\n| `Cmd` `C`         | Copy                      |\n| `Cmd` `V`         | Paste                     |\n| `Cmd` `A`         | Select all                |\n| `Cmd` `J`         | Jump to selection         |\n| `Cmd` `:`         | Show spelling and grammar |\n| `Cmd` `;`         | Check spelling            |\n\n{.shortcuts}\n\n### View Menu\n\n| Shortcut            | Action                |\n| ------------------- | --------------------- |\n| `Cmd` `L`           | Show transfers        |\n| `Cmd` `Opt` `L`     | Show transfers window |\n| `Cmd` `1`           | View as thumbnails    |\n| `Cmd` `2`           | View as list          |\n| `Cmd` `3`           | View as columns       |\n| `Cmd` `4`           | View as cover flow    |\n| `Cmd` `R`           | Refresh               |\n| `Cmd` `Shift` `B`   | Show invisible files  |\n| `Cmd` `Shift` `S`   | Hide places bar       |\n| `Cmd` `Shift` `J`   | Show view options     |\n| `Cmd` `Ctrl` `F`    | Enter full screen     |\n| `Cmd` `Opt` `Left`  | Focus on local        |\n| `Cmd` `Opt` `Right` | Focus on remote       |\n\n{.shortcuts}\n\n### Go Menu\n\n| Shortcut          | Action                        |\n| ----------------- | ----------------------------- |\n| `Cmd` `[`         | Back                          |\n| `Cmd` `]`         | Forward                       |\n| `Cmd` `Up`        | Enclosing folder              |\n| `Cmd` `Opt` `G`   | Go to folder...               |\n| `Cmd` `Opt` `T`   | Open in terminal              |\n| `Cmd` `Shift` `L` | Link folder navigation        |\n| `Cmd` `K`         | Connect to last used protocol |\n\n{.shortcuts}\n\n### Transfer Menu\n\n| Shortcut                | Action                                |\n| ----------------------- | ------------------------------------- |\n| `Cmd` `Shift` `R`       | Transfer selected items               |\n| `Cmd` `Opt` `Shift` `R` | Transfer selected items without rules |\n| `Cmd` `.`               | Cancel                                |\n\n{.shortcuts}\n\n### Servers Menu\n\n| Shortcut          | Action             |\n| ----------------- | ------------------ |\n| `Cmd` `Shift` `A` | Add new server     |\n| `Cmd` `Shift` `F` | Show quick connect |\n| `Cmd` `Shift` `I` | Edit server        |\n\n{.shortcuts}\n\n### Window Menu\n\n| Shortcut             | Action              |\n| -------------------- | ------------------- |\n| `Cmd` `M`            | Minimize            |\n| `Cmd` `Opt` `M`      | Minimize all        |\n| `Ctrl` `Tab`         | Select next tab     |\n| `Ctrl` `Shift` `Tab` | Select previous tab |\n| `Cmd` `Ctrl` `T`     | Transcript          |\n| `Cmd` `Opt` `I`      | Show inspector      |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for the Transmit app](https://library.panic.com/transmit/transmit5/shortcuts/)\n  _(library.panic.com)_\n"
  },
  {
    "path": "source/_posts/trello.md",
    "content": "---\ntitle: Trello\ndate: 2022-11-23 16:23:31.702599\nbackground: bg-[#417eef]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 29 keyboard shortcuts found on Trello\n---\n\n## Keyboard Shortcuts {.cols-2}\n\n### General I\n\n| Shortcut             | Action                     |\n| -------------------- | -------------------------- |\n| `Up/Down/Left/Right` | Navigate Cards             |\n| `B`                  | Open Header Boards Menu    |\n| `/`                  | Focus Search Box           |\n| `C`                  | Archive Card               |\n| `D`                  | Due Date                   |\n| `E`                  | Quick Edit Mode            |\n| `Esc`                | Close Menu/Cancel Editing  |\n| `Ctrl` `Enter`       | Save Text                  |\n| `Enter`              | Open Card                  |\n| `F`                  | Open Card Filter Menu      |\n| `L`                  | Label                      |\n| `;`                  | Toggle Label Names         |\n| `M`                  | Add/Remove Members         |\n| `N`                  | Insert New Card            |\n| `,/./</>`            | Move Card to Adjacent List |\n\n{.shortcuts}\n\n### General II\n\n| Shortcut    | Action                |\n| ----------- | --------------------- |\n| `Q`         | My Cards Filter       |\n| `S`         | Watch                 |\n| `Space`     | Assign Self           |\n| `T`         | Edit Title            |\n| `V`         | Vote                  |\n| `W`         | Toggle Board Menu     |\n| `X`         | Clear All Filters     |\n| `?`         | Open Shortcuts Page   |\n| `Shift` `2` | Autocomplete Members  |\n| `Shift` `3` | Autocomplete Labels   |\n| `Shift` `6` | Autocomplete Position |\n| `Ctrl` `C`  | Copy Card             |\n| `Ctrl` `V`  | Paste Card            |\n| `Ctrl` `X`  | Move Card             |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Trello](https://trello.com/shortcuts) _(trello.com)_\n"
  },
  {
    "path": "source/_posts/twitter.md",
    "content": "---\ntitle: Twitter\ndate: 2022-11-23 16:23:31.705009\nbackground: bg-[#4894e2]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 26 keyboard shortcuts found on Twitter\n---\n\n## Keyboard Shortcuts\n\n### Actions\n\n| Shortcut       | Action             |\n| -------------- | ------------------ |\n| `N`            | New tweet          |\n| `L`            | Like tweet         |\n| `R`            | Reply to tweet     |\n| `T`            | Retweet            |\n| `M`            | Direct message     |\n| `U`            | Mute account       |\n| `B`            | Block account      |\n| `Enter`        | Open tweet details |\n| `O`            | Expand photos      |\n| `/`            | Search             |\n| `Ctrl` `Enter` | Send tweet         |\n\n{.shortcuts}\n\n### Navigation\n\n| Shortcut | Action             |\n| -------- | ------------------ |\n| `?`      | Full keyboard menu |\n| `J`      | Next tweet         |\n| `K`      | Previous tweet     |\n| `Space`  | Page down          |\n| `.`      | Load new tweets    |\n\n{.shortcuts}\n\n### Timelines\n\n| Shortcut | Action                  |\n| -------- | ----------------------- |\n| `G` `N`  | Home timeline           |\n| `G` `O`  | Moments                 |\n| `G` `N`  | Notifications tab       |\n| `G` `R`  | Mentions                |\n| `G` `P`  | Profile                 |\n| `G` `L`  | Likes tab               |\n| `G` `I`  | Lists tab               |\n| `G` `M`  | Direct messages         |\n| `G` `S`  | Settings and privacy    |\n| `G` `U`  | Go to someone's profile |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Twitter](https://help.twitter.com/en/using-twitter/how-to-tweet) _(help.twitter.com)_\n"
  },
  {
    "path": "source/_posts/typescript.md",
    "content": "---\ntitle: TypeScript\ndate: 2024-05-28 22:12:25\nbackground: bg-[#4476c0]\ntags:\n  - ts\n  - web\ncategories:\n  - Programming\nintro: |\n  A TypeScript cheat sheet with the most important concepts, functions, methods, and more. A complete quick reference for beginners.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## Getting Started\n\n### Installing the Compiler\n\n```shell\nnpm install typescript --save-dev\nnpm tsc\n```\n\n### Introduction\n\nTypeScript is a superset of JavaScript that adds **static typing**, **interfaces**, and **compile-time error checking**. It compiles down to plain JavaScript.\n- [TypeScript Handbook](https://www.typescriptlang.org/docs/)\n\n### Basic Types\n\n```typescript\nlet age: number = 25;\nlet name: string = \"Alice\";\nlet isOnline: boolean = true;\nlet notSure: any = \"Could be anything\";\nlet nothingHere: null = null;\nlet notDefined: undefined = undefined;\nlet symbolValue: symbol = Symbol(\"unique\");\nlet bigIntValue: bigint = 9007199254740991n;\n```\n\n### Arrays\n\n```typescript\nlet numbers: number[] = [1, 2, 3];\nlet fruits: Array<string> = [\"apple\", \"banana\"];\nlet mixed: (string | number)[] = [\"one\", 2, \"three\"];\n```\n\n### Tuples\n\n```typescript\nlet person: [string, number];\nperson = [\"John\", 30]; // ✅\nperson = [30, \"John\"]; // ❌ Error\n```\n\n### Enums\n\n```typescript\nenum Direction {\n  Up = 1,\n  Down,\n  Left,\n  Right\n}\n\nlet move: Direction = Direction.Up;\n\nenum Status {\n  Success = \"SUCCESS\",\n  Error = \"ERROR\"\n}\n```\n\n### Type Aliases\n\n```typescript\ntype ID = string | number;\nlet userId: ID = 123;\n\ntype Callback = () => void;\n```\n\n### Interfaces\n\n```typescript\ninterface User {\n  name: string;\n  age: number;\n  isAdmin?: boolean; // optional\n  readonly id: number; // readonly\n}\n\nconst user: User = { name: \"Bob\", age: 25, id: 1 };\n```\n\n### Extending Interfaces\n\n```typescript\ninterface Animal {\n  name: string;\n}\n\ninterface Dog extends Animal {\n  breed: string;\n}\n\nconst dog: Dog = { name: \"Fido\", breed: \"Labrador\" };\n```\n\n### Functions\n\n```typescript\nfunction greet(name: string): string {\n  return `Hello, ${name}`;\n}\n\nconst add = (a: number, b: number): number => a + b;\n```\n\n### Optional & Default Parameters\n\n```typescript\nfunction log(message: string, userId?: string) {\n  console.log(message, userId ?? \"Guest\");\n}\n\nfunction multiply(a: number, b: number = 2) {\n  return a * b;\n}\n```\n\n### Rest Parameters\n\n```typescript\nfunction sum(...numbers: number[]): number {\n  return numbers.reduce((acc, curr) => acc + curr, 0);\n}\n```\n\n### Function Overloads\n\n```typescript\nfunction combine(a: number, b: number): number;\nfunction combine(a: string, b: string): string;\nfunction combine(a: any, b: any): any {\n  return a + b;\n}\n```\n\n### Union & Intersection Types\n\n```typescript\ntype Status = \"success\" | \"error\" | \"loading\";\n\ntype UserInfo = { name: string };\ntype AdminInfo = { admin: boolean };\n\ntype AdminUser = UserInfo & AdminInfo;\n```\n\n### Literal Types\n\n```typescript\ntype Alignment = \"left\" | \"center\" | \"right\";\nlet align: Alignment = \"left\";\n```\n\n### Generics\n\n```typescript\nfunction identity<T>(value: T): T {\n  return value;\n}\n\nlet num = identity<number>(42);\nlet str = identity(\"Hello\");\n```\n\n### Generic Constraints\n\n```typescript\ninterface Lengthwise {\n  length: number;\n}\n\nfunction logLength<T extends Lengthwise>(arg: T): void {\n  console.log(arg.length);\n}\n```\n\n### Generic Interfaces\n\n```typescript\ninterface GenericIdentityFn<T> {\n  (arg: T): T;\n}\n\nconst myIdentity: GenericIdentityFn<number> = identity;\n```\n\n### Classes\n\n```typescript\nclass Person {\n  name: string;\n  constructor(name: string) {\n    this.name = name;\n  }\n  greet() {\n    console.log(`Hello, I'm ${this.name}`);\n  }\n}\n\nconst alice = new Person(\"Alice\");\nalice.greet();\n```\n\n### Access Modifiers\n\n```typescript\nclass Car {\n  public brand: string;\n  private speed: number;\n  protected year: number;\n\n  constructor(brand: string, speed: number, year: number) {\n    this.brand = brand;\n    this.speed = speed;\n    this.year = year;\n  }\n}\n```\n\n### Abstract Classes\n\n```typescript\nabstract class Animal {\n  abstract makeSound(): void;\n  move(): void {\n    console.log(\"Moving...\");\n  }\n}\n\nclass Dog extends Animal {\n  makeSound() {\n    console.log(\"Woof!\");\n  }\n}\n```\n\n### Implements Interface\n\n```typescript\ninterface Vehicle {\n  start(): void;\n}\n\nclass Bike implements Vehicle {\n  start() {\n    console.log(\"Bike starting...\");\n  }\n}\n```\n\n### Type Assertions\n\n```typescript\nlet someValue: unknown = \"Hello TypeScript\";\nlet strLength: number = (someValue as string).length;\n```\n\n### Nullish Coalescing\n\n```typescript\nlet input: string | null = null;\nlet result = input ?? \"Default\";\n```\n\n### Optional Chaining\n\n```typescript\nconst user = { profile: { name: \"Alice\" } };\nconsole.log(user.profile?.name); // Alice\nconsole.log(user.address?.street); // undefined\n```\n\n### Namespaces\n\n```typescript\nnamespace Utils {\n  export function log(msg: string) {\n    console.log(msg);\n  }\n}\n\nUtils.log(\"Hello\");\n```\n\n### Modules\n\n```typescript\n// math.ts\nexport function add(a: number, b: number) {\n  return a + b;\n}\n\n// app.ts\nimport { add } from \"./math\";\nconsole.log(add(2, 3));\n```\n\n### Export Default\n\n```typescript\n// logger.ts\nexport default class Logger {\n  log(msg: string) {\n    console.log(msg);\n  }\n}\n\n// main.ts\nimport Logger from \"./logger\";\nconst logger = new Logger();\nlogger.log(\"Info\");\n```\n\n### Promises & Async/Await\n\n```typescript\nasync function fetchData(): Promise<string> {\n  return \"Data loaded\";\n}\n\nfetchData().then(console.log);\n```\n\n### Typing Async Functions\n\n```typescript\ninterface User {\n  id: number;\n  name: string;\n}\n\nasync function getUser(id: number): Promise<User> {\n  // Simulate fetch\n  return { id, name: \"User\" };\n}\n```\n\n### Readonly & Record\n\n```typescript\ninterface Config {\n  readonly apiKey: string;\n}\n\ntype Point = Record<\"x\" | \"y\", number>;\nconst origin: Point = { x: 0, y: 0 };\n```\n\n## Advanced Features\n\n### Type Guards\n\n```typescript\nfunction isString(value: any): value is string {\n  return typeof value === \"string\";\n}\n\nfunction process(value: string | number) {\n  if (isString(value)) {\n    console.log(value.toUpperCase());\n  } else {\n    console.log(value.toFixed(2));\n  }\n}\n```\n\n### Index Signatures\n\n```typescript\ninterface Dictionary {\n  [key: string]: string;\n}\n\nconst dict: Dictionary = { hello: \"world\" };\n```\n\n### Mapped Types\n\n```typescript\ntype Flags = { [K in \"option1\" | \"option2\"]: boolean };\nconst flags: Flags = { option1: true, option2: false };\n```\n\n### Conditional Types\n\n```typescript\ntype NonNullable<T> = T extends null | undefined ? never : T;\ntype SafeString = NonNullable<string | null>; // string\n```\n\n### Unknown vs Any\n\n```typescript\nlet value: unknown;\nvalue = 5; // OK\n// console.log(value.length); // Error\n\nlet anyValue: any;\nanyValue = 5;\nconsole.log(anyValue.length); // No error, but risky\n```\n\n### Never Type\n\n```typescript\nfunction throwError(msg: string): never {\n  throw new Error(msg);\n}\n```\n\n### Decorators (Experimental)\n\n```typescript\nfunction sealed(target: any) {\n  Object.seal(target);\n  Object.seal(target.prototype);\n}\n\n@sealed\nclass SealedClass {}\n```\n\n### Utility Types\n\n```typescript\ninterface Todo {\n  title: string;\n  description: string;\n  completed: boolean;\n}\n\n// Partial\ntype PartialTodo = Partial<Todo>;\n\n// Required\ntype RequiredTodo = Required<PartialTodo>;\n\n// Pick\ntype TodoPreview = Pick<Todo, \"title\" | \"completed\">;\n\n// Omit\ntype TodoWithoutDesc = Omit<Todo, \"description\">;\n\n// ReturnType\nfunction f() { return { x: 10, y: 3 }; }\ntype P = ReturnType<typeof f>;\n\n// Parameters\ntype Params = Parameters<(a: number, b: string) => void>;\n```\n\n### Keyof and Typeof\n\n```typescript\ninterface Person {\n  name: string;\n  age: number;\n}\n\ntype PersonKeys = keyof Person; // \"name\" | \"age\"\n\nconst person = { name: \"Alice\", age: 30 };\ntype PersonType = typeof person; // { name: string; age: number }\n```\n\n### Infer Keyword\n\n```typescript\ntype ReturnType<T> = T extends (...args: any[]) => infer R ? R : any;\n```\n\n## Conditionals and Loops\n\n### if Statement\n\n```typescript\nconst max: number = 100;\nif (max > 50) {\n  console.log(\"Large\");\n}\n```\n\n### Ternary Operator\n\n```typescript\nconst isEven: boolean = (10 % 2 === 0) ? true : false;\n```\n\n### Switch Statement\n\n```typescript\nconst color: string = \"red\";\nswitch (color) {\n  case \"red\":\n    console.log(\"Stop\");\n    break;\n  default:\n    console.log(\"Go\");\n}\n```\n\n### For Loop\n\n```typescript\nfor (let i: number = 0; i < 5; i++) {\n  console.log(i);\n}\n```\n\n### While Loop\n\n```typescript\nlet count: number = 0;\nwhile (count < 5) {\n  console.log(count++);\n}\n```\n\n### For...of Loop\n\n```typescript\nconst arr: number[] = [1, 2, 3];\nfor (const num of arr) {\n  console.log(num);\n}\n```\n\n### For...in Loop\n\n```typescript\nconst obj = { a: 1, b: 2 };\nfor (const key in obj) {\n  console.log(key);\n}\n```\n\n## Arrays and Iterables\n\n### Array Methods\n\n```typescript\nconst nums: number[] = [1, 2, 3];\n\n// Map\nconst doubled: number[] = nums.map(n => n * 2);\n\n// Filter\nconst evens: number[] = nums.filter(n => n % 2 === 0);\n\n// Reduce\nconst sum: number = nums.reduce((acc, curr) => acc + curr, 0);\n```\n\n### Readonly Arrays\n\n```typescript\nconst readOnlyNums: ReadonlyArray<number> = [1, 2, 3];\n// readOnlyNums.push(4); // Error\n```\n\n### Sets\n\n```typescript\nconst set: Set<number> = new Set([1, 2, 3]);\nset.add(4);\nset.delete(1);\n```\n\n### Maps\n\n```typescript\nconst map: Map<string, number> = new Map();\nmap.set(\"one\", 1);\nmap.get(\"one\"); // 1\n```\n\n## Objects\n\n### Object Types\n\n```typescript\nconst car: { type: string, mileage?: number } = {\n  type: \"Toyota\"\n};\n```\n\n### Indexable Types\n\n```typescript\ninterface StringArray {\n  [index: number]: string;\n}\n\nconst myArray: StringArray = [\"Bob\", \"Fred\"];\n```\n\n### Excess Property Checks\n\n```typescript\ninterface Square {\n  color: string;\n  width: number;\n}\n\n// const redSquare = { color: \"red\", width: 100, height: 100 }; // Error if strict\n```\n\n## Modules and Namespaces\n\n### Namespace with Internal Modules\n\n```typescript\nnamespace Geometry {\n  export interface Point {\n    x: number;\n    y: number;\n  }\n  export function distance(p1: Point, p2: Point): number {\n    return Math.sqrt((p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2);\n  }\n}\n```\n\n### Module Resolution\n\n// tsconfig.json\n{\n  \"compilerOptions\": {\n    \"moduleResolution\": \"node\"\n  }\n}\n\n## Error Handling\n\n### Try Catch\n\n```typescript\ntry {\n  throw new Error(\"Oops\");\n} catch (e: unknown) {\n  if (e instanceof Error) {\n    console.log(e.message);\n  }\n}\n```\n\n### Custom Errors\n\n```typescript\nclass CustomError extends Error {\n  constructor(message: string) {\n    super(message);\n  }\n}\n```\n\n## TypeScript with JavaScript Features\n\n### Destructuring\n\n```typescript\nconst [first, second]: [number, number] = [1, 2];\nconst { name: userName, age }: { name: string, age: number } = { name: \"Alice\", age: 30 };\n```\n\n### Spread Operator\n\n```typescript\nconst arr1: number[] = [1, 2];\nconst arr2: number[] = [...arr1, 3, 4];\n```\n\n### Template Literals\n\n```typescript\nconst greeting: string = `Hello, ${name}`;\n```\n\n### Arrow Functions\n\n```typescript\nconst square = (x: number): number => x * x;\n```\n"
  },
  {
    "path": "source/_posts/unity-3d.md",
    "content": "---\ntitle: Unity 3D\ndate: 2022-11-23 16:23:31.692703\nbackground: bg-[#7c7c7c]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 50 keyboard shortcuts found in Unity 3D\n---\n\n## Keyboard Shortcuts\n\n### Tools\n\n| Shortcut              | Action                |\n| --------------------- | --------------------- |\n| `Q`                   | Pan                   |\n| `W`                   | Move                  |\n| `E`                   | Rotate                |\n| `R`                   | Scale                 |\n| `T`                   | Rect tool             |\n| `Z`                   | Pivot mode toggle     |\n| `X`                   | Pivot rotation toggle |\n| `V`                   | Vertex snap           |\n| `Ctrl` `(left click)` | Snap                  |\n\n{.shortcuts}\n\n### GameObject\n\n| Shortcut           | Action                                                 |\n| ------------------ | ------------------------------------------------------ |\n| `Ctrl` `Shift` `N` | New empty game object                                  |\n| `Alt` `Shift` `N`  | New empty child to selected game object                |\n| `Ctrl` `Alt` `F`   | Move to view                                           |\n| `Ctrl` `Shift` `F` | Align with view                                        |\n| `Shift` `F`        | Locks the scene view camera to the selected GameObject |\n\n{.shortcuts}\n\n### Window\n\n| Shortcut           | Action          |\n| ------------------ | --------------- |\n| `Ctrl` `1`         | Scene           |\n| `Ctrl` `2`         | Game            |\n| `Ctrl` `3`         | Inspector       |\n| `Ctrl` `4`         | Hierarchy       |\n| `Ctrl` `5`         | Project         |\n| `Ctrl` `6`         | Animation       |\n| `Ctrl` `7`         | Profiler        |\n| `Ctrl` `9`         | Asset store     |\n| `Ctrl` `0`         | Version control |\n| `Ctrl` `Shift` `C` | Console         |\n\n{.shortcuts}\n\n### Edit {.row-span-2}\n\n| Shortcut           | Action                 |\n| ------------------ | ---------------------- |\n| `Ctrl` `Z`         | Undo                   |\n| `Ctrl` `Shift` `Z` | Redo (MacOS)           |\n| `Ctrl` `Y`         | Redo (Windows)         |\n| `Ctrl` `X`         | Cut                    |\n| `Ctrl` `C`         | Copy                   |\n| `Ctrl` `V`         | Paste                  |\n| `Ctrl` `D`         | Duplicate              |\n| `Shift` `Del`      | Delete                 |\n| `F`                | Frame center selection |\n| `Ctrl` `F`         | Find                   |\n| `Ctrl` `A`         | Select all             |\n| `Ctrl` `P`         | Play                   |\n| `Ctrl` `Shift` `P` | Pause                  |\n| `Ctrl` `Alt` `P`   | Step                   |\n\n{.shortcuts}\n\n### Selection\n\n| Shortcut             | Action             |\n| -------------------- | ------------------ |\n| `Ctrl` `Shift` `1-9` | Load selection 1-9 |\n| `Ctrl` `Alt` `1-9`   | Save selection 1-9 |\n\n{.shortcuts}\n\n### Assets\n\n| Shortcut   | Action  |\n| ---------- | ------- |\n| `Ctrl` `R` | Refresh |\n\n{.shortcuts}\n\n### Animation\n\n| Shortcut    | Action            |\n| ----------- | ----------------- |\n| `Shift` `,` | First keyframe    |\n| `Shift` `K` | Key modified      |\n| `K`         | Key selected      |\n| `Shift` `.` | Last keyframe     |\n| `.`         | Next frame        |\n| `Alt` `.`   | Next keyframe     |\n| `Space`     | Play animation    |\n| `,`         | Previous frame    |\n| `Alt` `,`   | Previous keyframe |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Unity 3D](https://docs.unity3d.com/2018.1/Documentation/Manual/UnityHotkeys.html)\n  _(docs.unity3d.com)_\n"
  },
  {
    "path": "source/_posts/unity-shader-graph.md",
    "content": "---\ntitle: Unity Shader Graph\ndate: 2024-08-10 12:15:05\nbackground: bg-[#7c7c7c]\nlabel:\ntags:\n  - unity\n  - shader\n  - computer graphics\n  - visual effects\ncategories:\n  - Programming\nintro: |\n  This is a visual cheat-sheet for the Unity Shader Graph. This tool is used to create custom shaders material in Unity, a popular game engine.\n---\n\n## Shader Graph Nodes {.cols-2}\n\n<code>We are using <yel>**SAIT**</yel> to indicate the output type is \"same as the input type\".</code> {.col-span-2}\n\n## 1. Attributes {.cols-2}\n\n### Positioning {.row-span-2}\n\n<yel>**Position**</yel> - provides vertex position\n\n- **Inputs**\n\n  - | -   | -         |\n    | --- | --------- |\n    | /   | No inputs |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                        |\n    | --------- | ------------------------ |\n    | `Vector3` | Provides vertex position |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Normal**</yel> - supplies surface normal direction\n\n- **Inputs**\n\n  - | -   | -         |\n    | --- | --------- |\n    | /   | No inputs |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                       |\n    | --------- | ----------------------- |\n    | `Vector3` | Provides surface normal |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**World Position**</yel> - returns the object's world space position\n\n- **Inputs**\n\n  - | -   | -         |\n    | --- | --------- |\n    | /   | No inputs |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                    |\n    | --------- | -------------------- |\n    | `Vector3` | World space position |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Object Position**</yel> - returns the object's local space position\n\n- **Inputs**\n\n  - | -   | -         |\n    | --- | --------- |\n    | /   | No inputs |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                    |\n    | --------- | -------------------- |\n    | `Vector3` | Local space position |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Screen Position**</yel> - returns the object's screen space position\n\n- **Inputs**\n\n  - | -   | -         |\n    | --- | --------- |\n    | /   | No inputs |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                     |\n    | --------- | --------------------- |\n    | `Vector4` | Screen space position |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Camera Position**</yel> - returns the camera's world space position\n\n- **Inputs**\n\n  - | -   | -         |\n    | --- | --------- |\n    | /   | No inputs |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                           |\n    | --------- | --------------------------- |\n    | `Vector3` | Camera world space position |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n### Timing\n\n<yel>**Time**</yel> - outputs various time-related values\n\n- **Inputs**\n\n  - | -   | -         |\n    | --- | --------- |\n    | /   | No inputs |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -       | -                                                                         |\n    | ------- | ------------------------------------------------------------------------- |\n    | `Float` | Time (T) - The total elapsed time since the start of the shader           |\n    | `Float` | Sin Time (T/8π) - A sine wave based on time                               |\n    | `Float` | Cos Time (T/8π) - A cosine wave based on time                             |\n    | `Float` | Delta Time - Time passed between the previous frame and the current frame |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n## 2. Math Operations {.cols-2}\n\n### Basic Math\n\n<yel>**Add**</yel> - adds two values\n\n- **Inputs**\n\n  - | -                     | -            |\n    | --------------------- | ------------ |\n    | `Float` <br> `Vector` | First value  |\n    | `Float` <br> `Vector` | Second value |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -    | -                     |\n    | ---- | --------------------- |\n    | SAIT | Sum of the two inputs |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Subtract**</yel> - subtracts one value from another\n\n- **Inputs**\n\n  - | -                     | -          |\n    | --------------------- | ---------- |\n    | `Float` <br> `Vector` | Minuend    |\n    | `Float` <br> `Vector` | Subtrahend |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -    | -                            |\n    | ---- | ---------------------------- |\n    | SAIT | Difference of the two inputs |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Multiply**</yel> - multiplies two values\n\n- **Inputs**\n\n  - | -                                   | -            |\n    | ----------------------------------- | ------------ |\n    | `Float` <br> `Vector` <br> `Matrix` | First value  |\n    | `Float` <br> `Vector` <br> `Matrix` | Second value |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -    | -                             |\n    | ---- | ----------------------------- |\n    | SAIT | The product of the two inputs |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n### Advanced Math {.row-span-2}\n\n<yel>**Power**</yel> - raises input to a power\n\n- **Inputs**\n\n  - | -       | -        |\n    | ------- | -------- |\n    | `Float` | Base     |\n    | `Float` | Exponent |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -       | -                                                  |\n    | ------- | -------------------------------------------------- |\n    | `Float` | Result of base raised to the power of the exponent |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Sqrt**</yel> - square root of input\n\n- **Inputs**\n\n  - | -       | -           |\n    | ------- | ----------- |\n    | `Float` | Input value |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -       | -                        |\n    | ------- | ------------------------ |\n    | `Float` | Square root of the input |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Abs**</yel> - outputs absolute value\n\n- **Inputs**\n\n  - | -                     | -           |\n    | --------------------- | ----------- |\n    | `Float` <br> `Vector` | Input value |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -    | -                           |\n    | ---- | --------------------------- |\n    | SAIT | Absolute value of the input |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Dot Product**</yel> - calculates dot product between two vectors\n\n- **Inputs**\n\n  - | -                        | -             |\n    | ------------------------ | ------------- |\n    | `Vector3` <br> `Vector4` | First vector  |\n    | `Vector3` <br> `Vector4` | Second vector |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -       | -                  |\n    | ------- | ------------------ |\n    | `Float` | Dot product result |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Cross Product**</yel> - calculates cross product between two vectors\n\n- **Inputs**\n\n  - | -         | -             |\n    | --------- | ------------- |\n    | `Vector3` | First vector  |\n    | `Vector3` | Second vector |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                    |\n    | --------- | -------------------- |\n    | `Vector3` | Cross product result |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n### Trigonometry\n\n<yel>**Sin**</yel> - outputs sine of input\n\n- **Inputs**\n\n  - | -       | -                |\n    | ------- | ---------------- |\n    | `Float` | Input in radians |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -       | -                 |\n    | ------- | ----------------- |\n    | `Float` | Sine of the input |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Cos**</yel> - outputs cosine of input\n\n- **Inputs**\n\n  - | -       | -                |\n    | ------- | ---------------- |\n    | `Float` | Input in radians |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -       | -                   |\n    | ------- | ------------------- |\n    | `Float` | Cosine of the input |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n### Interpolation {.row-span-2}\n\n<yel>**Lerp**</yel> - linear interpolation between two values\n\n- **Inputs**\n\n  - | -                     | -                        |\n    | --------------------- | ------------------------ |\n    | `Float` <br> `Vector` | Start value              |\n    | `Float` <br> `Vector` | End value                |\n    | `Float` <br> `Vector` | Interpolation factor (T) |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -    | -                   |\n    | ---- | ------------------- |\n    | SAIT | Interpolated result |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Step**</yel> - creates a step between two thresholds\n\n- **Inputs**\n\n  - | -                     | -         |\n    | --------------------- | --------- |\n    | `Float` <br> `Vector` | Threshold |\n    | `Float` <br> `Vector` | Input     |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -    | -           |\n    | ---- | ----------- |\n    | SAIT | Step result |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n## 3. Color Processing {.cols-2}\n\n### Basic Color Manipulation\n\n<yel>**Color**</yel> - provides a constant color value\n\n- **Inputs**\n\n  - | -   | -         |\n    | --- | --------- |\n    | /   | No inputs |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                |\n    | --------- | ---------------- |\n    | `Vector4` | RGBA color value |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Add Color**</yel> - adds two color values\n\n- **Inputs**\n\n  - | -         | -            |\n    | --------- | ------------ |\n    | `Vector4` | First color  |\n    | `Vector4` | Second color |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                     |\n    | --------- | --------------------- |\n    | `Vector4` | Sum of the two colors |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Multiply Color**</yel> - multiplies two color values\n\n- **Inputs**\n\n  - | -         | -            |\n    | --------- | ------------ |\n    | `Vector4` | First color  |\n    | `Vector4` | Second color |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                         |\n    | --------- | ------------------------- |\n    | `Vector4` | Product of the two colors |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Lerp Color**</yel> - interpolates between two colors\n\n- **Inputs**\n\n  - | -         | -                        |\n    | --------- | ------------------------ |\n    | `Vector4` | Start color              |\n    | `Vector4` | End color                |\n    | `Float`   | Interpolation factor (T) |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                  |\n    | --------- | ------------------ |\n    | `Vector4` | Interpolated color |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n### Color Adjustment {.row-span-2}\n\n<yel>**Saturation**</yel> - adjusts the saturation of input color\n\n- **Inputs**\n\n  - | -         | -                 |\n    | --------- | ----------------- |\n    | `Vector4` | Input color       |\n    | `Float`   | Saturation factor |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -              |\n    | --------- | -------------- |\n    | `Vector4` | Adjusted color |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Contrast**</yel> - adjusts contrast of input color\n\n- **Inputs**\n\n  - | -         | -               |\n    | --------- | --------------- |\n    | `Vector4` | Input color     |\n    | `Float`   | Contrast factor |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -              |\n    | --------- | -------------- |\n    | `Vector4` | Adjusted color |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Hue**</yel> - shifts the hue of the input color\n\n- **Inputs**\n\n  - | -         | -                |\n    | --------- | ---------------- |\n    | `Vector4` | Input color      |\n    | `Float`   | Hue shift amount |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                      |\n    | --------- | ---------------------- |\n    | `Vector4` | Color with shifted hue |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Invert Colors**</yel> - inverts the input color\n\n- **Inputs**\n\n  - | -         | -           |\n    | --------- | ----------- |\n    | `Vector4` | Input color |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -              |\n    | --------- | -------------- |\n    | `Vector4` | Inverted color |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Replace Color**</yel> - replaces a specific color in the input with a new color\n\n- **Inputs**\n\n  - | -         | -                 |\n    | --------- | ----------------- |\n    | `Vector4` | Input color       |\n    | `Vector4` | Target color      |\n    | `Vector4` | Replacement color |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                          |\n    | --------- | -------------------------- |\n    | `Vector4` | Color with replaced values |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**White Balance**</yel> - adjusts the white balance of input color\n\n- **Inputs**\n\n  - | -         | -                 |\n    | --------- | ----------------- |\n    | `Vector4` | Input color       |\n    | `Float`   | Temperature value |\n    | `Float`   | Tint value        |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -              |\n    | --------- | -------------- |\n    | `Vector4` | Adjusted color |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n### Channel Operations\n\n<yel>**Channel Mixer**</yel> - modifies color channels independently\n\n- **Inputs**\n\n  - | -         | -                        |\n    | --------- | ------------------------ |\n    | `Vector4` | Input color              |\n    | `Float`   | Red channel multiplier   |\n    | `Float`   | Green channel multiplier |\n    | `Float`   | Blue channel multiplier  |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -              |\n    | --------- | -------------- |\n    | `Vector4` | Modified color |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n## 4. Texture Processing {.cols-2}\n\n### Sampling\n\n<yel>**Sample Texture**</yel> - retrieves color data from texture\n\n- **Inputs**\n\n  - | -                   | -              |\n    | ------------------- | -------------- |\n    | `Texture (sampler)` | Texture input  |\n    | `Vector2`           | UV coordinates |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                           |\n    | --------- | --------------------------- |\n    | `Vector4` | Color data from the texture |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**UV**</yel> - provides UV coordinates for texture mapping\n\n- **Inputs**\n\n  - | -   | -         |\n    | --- | --------- |\n    | /   | No inputs |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -              |\n    | --------- | -------------- |\n    | `Vector2` | UV coordinates |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n### Manipulation {.row-span-2}\n\n<yel>**Tiling Offset**</yel> - adjusts tiling and offset of texture\n\n- **Inputs**\n\n  - | -         | -             |\n    | --------- | ------------- |\n    | `Vector2` | Tiling values |\n    | `Vector2` | Offset values |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                       |\n    | --------- | ----------------------- |\n    | `Vector2` | Modified UV coordinates |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Distortion**</yel> - warps the surface of the object\n\n- **Inputs**\n\n  - | -         | -                   |\n    | --------- | ------------------- |\n    | `Float`   | Distortion strength |\n    | `Vector2` | UV coordinates      |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                     |\n    | --------- | --------------------- |\n    | `Vector2` | Warped UV coordinates |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Parallax**</yel> - simulates depth using parallax mapping\n\n- **Inputs**\n\n  - | -                 | -              |\n    | ----------------- | -------------- |\n    | Texture (sampler) | Input texture  |\n    | `Vector2`         | UV coordinates |\n    | `Float`           | Depth value    |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                       |\n    | --------- | ----------------------- |\n    | `Vector2` | Adjusted UV coordinates |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n## 5. Effects {.cols-2}\n\n### Visual Effects {.row-span-2}\n\n<yel>**Fresnel Effect**</yel> - creates a glow effect on object edges\n\n- **Inputs**\n\n  - | -         | -                   |\n    | --------- | ------------------- |\n    | `Vector3` | View direction      |\n    | `Float`   | Power of the effect |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -       | -                    |\n    | ------- | -------------------- |\n    | `Float` | Fresnel effect value |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n<yel>**Dissolve**</yel> - generates a dissolve transition effect\n\n- **Inputs**\n\n  - | -                   | -                  |\n    | ------------------- | ------------------ |\n    | `Texture (sampler)` | Input texture      |\n    | `Float`             | Dissolve threshold |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                      |\n    | --------- | ---------------------- |\n    | `Vector4` | Dissolve effect output |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n### Reflection {.row-span-2}\n\n<yel>**Reflection**</yel> - reflects based on surface normal direction\n\n- **Inputs**\n\n  - | -         | -                  |\n    | --------- | ------------------ |\n    | `Vector3` | Incident direction |\n    | `Vector3` | Surface normal     |\n\n  {.left-text}\n\n- **Outputs**\n\n  - | -         | -                   |\n    | --------- | ------------------- |\n    | `Vector3` | Reflected direction |\n\n  {.left-text}\n\n{.shortcuts .marker-round .cols-2}\n\n## Custom Function Node\n\n### Steps to Create a Custom Function Node {.col-span-2}\n\n- **Step 1: Add Custom Function Node in Shader Graph**\n\n  - Right-click in Shader Graph and choose **\"Create Node\"** > **\"Custom Function\"**.\n  - Choose between **\"String\"** (for inline HLSL code) or **\"File\"** (for an external HLSL file).\n\n- **Step 2: Configure the Node in Shader Graph**\n\n  - Set the name of the node.\n  - If using **\"File\"**, ensure the external HLSL file name exactly matches the function name defined in the HLSL file.\n    This ensures the function is correctly referenced in the Shader Graph pipeline.\n\n    <yel>**Example**</yel>: If the file is named `CustomFunction.hlsl`, the function inside it should also be named\n    `CustomFunction`.\n\n- **Step 3: Add Inputs/Outputs in Shader Graph**\n\n  - Define the required `Inputs` and `Outputs` for the custom function in Shader Graph. These will automatically\n    generate ports for you to connect other nodes.\n\n    <yel>**Example**</yel>:\n\n    - **Inputs**: `Float` (time), `Vector3` (position)\n    - **Outputs**: `Vector3` (new position)\n\n    In the custom HLSL code, the `in` and `out` parameters correspond to these inputs and outputs:\n\n    - `in` represents the data coming into the function (e.g., `time`, `position`).\n    - `out` defines the return value (e.g., modified `position`).\n\n- **Step 4: Write HLSL Code**\n\n  - If using the **\"String\"** option:\n\n    - Directly write the HLSL code inside the custom function node editor in Shader Graph.\n    - Ensure that the `in` and `out` parameters match the inputs and outputs you defined in Shader Graph.\n\n    - <yel>**Example of inline code**</yel> (using **\"String\"** mode):\n\n      ```cpp\n      float3 CustomPosition(in float time, in float3 position, out float3 newPosition) {\n        newPosition = position + float3(sin(time), cos(time), 0.0);\n        return newPosition;\n      }\n      ```\n\n  - If using the **\"File\"** option:\n\n    - Write the HLSL code in an external `.hlsl` file and reference the file in Shader Graph.\n\n    - <yel>**Example of an external HLSL file**</yel> (using **\"File\"** mode):\n\n      1. **1. Create an HLSL file** named `CustomPosition.hlsl`.\n\n      2. **2. Write the custom function** inside the file. The `in` and `out` parameters should match the Shader Graph\n         inputs and outputs.\n\n      ```cpp\n      float3 CustomPosition(in float time, in float3 position, out float3 newPosition) {\n        newPosition = position + float3(sin(time), cos(time), 0.0);\n        return newPosition;\n      }\n      ```\n\n      3. **3. Save the file** in your project directory, for example, `Assets/Shaders/CustomPosition.hlsl`.\n\n      4. **4. Link the file** in Shader Graph:\n\n      - In the Custom Function Node, switch to **\"File\"** mode and reference `CustomPosition.hlsl`.\n\n- **Step 5: Use the Node in Shader Graph**\n\n  - Connect the custom function node’s input ports to other nodes, such as `Time` and `Position`, to feed data into the\n    custom function.\n  - Connect the output port to apply the function result in the Shader Graph pipeline.\n\n  - <yel>**Example Pipeline**</yel>:\n\n    - **Inputs**: `Time` (as a float) and `Position` (as a vector)\n    - **Outputs**: `Modified Position` (vector with new position)\n\n    This would make the custom node update an object's position based on time in the shader.\n\n{.marker-timeline .shortcuts}\n\n## Also see {.cols-1}\n\n- [Unity Shader Graph documentation](https://docs.unity3d.com/Manual/shader-graph-overview.html) _(docs.unity3d.com)_\n- [Tianle Yuan's Unity Visual Effect notes](https://yuantianle.github.io/11_Game_Development/Unity/) _(yuantianle.com)_\n"
  },
  {
    "path": "source/_posts/unreal-engine.md",
    "content": "---\ntitle: Unreal Engine\ndate: 2024-10-24 21:12:26\ntags:\n  - unreal\n  - engine\ncategories:\n  - Keyboard Shortcuts\nintro: A visual cheat-sheet for many keyboard shortcuts found in Unreal Engine 5\n---\n\n## Level Editor\n\n### Viewport Transformation\n\n| Shortcut    | Action                      |\n| ----------- | --------------------------- |\n| `W`         | Translate                   |\n| `E`         | Rotate                      |\n| `R`         | Scale                       |\n| `Space Bar` | Toggle Transform Mode       |\n| `[`         | Decrease Position Grid Size |\n| `]`         | Increase Position Grid Size |\n| `Shift` `[` | Decrease Rotation Grid Size |\n| `Shift` `]` | Increase Rotation Grid Size |\n\n{.shortcuts}\n\n### View Modes\n\n| Shortcut  | Action            |\n| --------- | ----------------- |\n| `Alt` `2` | Wireframe         |\n| `Alt` `3` | Unlit             |\n| `Alt` `4` | Lit               |\n| `Alt` `5` | Detail Lighting   |\n| `Alt` `6` | Lighting Only     |\n| `Alt` `7` | Light Complexity  |\n| `Alt` `8` | Shader Complexity |\n| `Alt` `0` | Lightmap Density  |\n\n{.shortcuts}\n\n### Level Editor General {.row-span-2}\n\n| Shortcut           | Action                       |\n| ------------------ | ---------------------------- |\n| `Esc`              | Deselect All                 |\n| `H`                | Hide Selected                |\n| `Ctrl` `H`         | Unhide All                   |\n| `F`                | Focus on Actor               |\n| `F9`               | Screenshot                   |\n| `F11`              | Immersive Mode               |\n| `G`                | Game View                    |\n| `T`                | Toggle Translucent Selection |\n| `(right click)`    | Asset Menu                   |\n| `Ctrl` `E`         | Edit Selected Asset          |\n| `Ctrl` `P`         | Open Asset                   |\n| `P`                | Toggle Navmesh               |\n| `Ctrl` `Shift` `,` | Profile GPU                  |\n| `Ctrl` `Shift` `H` | Toggle FPS                   |\n| `~`                | Command Console              |\n\n{.shortcuts}\n\n### Camera Navigation\n\n| Shortcut     | Action           |\n| ------------ | ---------------- |\n| `Alt` `G`    | Perspective View |\n| `Alt` `H`    | Front View       |\n| `Alt` `J`    | Top View         |\n| `Alt` `K`    | Side View        |\n| `Ctrl` `0-9` | Set Bookmark     |\n| `0-9`        | Jump to Bookmark |\n\n{.shortcuts}\n\n### Editing Modes\n\n| Shortcut    | Action             |\n| ----------- | ------------------ |\n| `Shift` `1` | Selection Mode     |\n| `Shift` `2` | Landscape Mode     |\n| `Shift` `3` | Foliage Mode       |\n| `Shift` `4` | Modeling Mode      |\n| `Shift` `5` | Brush Editing Mode |\n| `Shift` `6` | Animation Mode     |\n\n{.shortcuts}\n\n### Snapping\n\n| Shortcut      | Action               |\n| ------------- | -------------------- |\n| `End`         | Snap to Floor        |\n| `Alt` `End`   | Snap Pivot to Floor  |\n| `Shift` `End` | Snap Bounds to Floor |\n| `Ctrl` `End`  | Snap to World Grid   |\n\n{.shortcuts}\n\n### Play in Editor (PIE)\n\n| Shortcut  | Action            |\n| --------- | ----------------- |\n| `Alt` `P` | Start PIE Session |\n| `Pause`   | Pause             |\n| `F8    `  | Eject from Player |\n| `Esc`     | Stop PIE Session  |\n\n{.shortcuts}\n\n### Content Browser\n\nNote: You need to select assets first for these shortcuts to work\n\n| Shortcut          | Action           |\n| ----------------- | ---------------- |\n| `Alt` `Shift` `A` | Audit Assets     |\n| `Alt` `Shift` `R` | Reference Viewer |\n| `Alt` `Shift` `M` | Size Map         |\n\n{.shortcuts}\n\n## Asset Editors\n\n### Blueprints {.row-span-2}\n\n| Shortcut            | Action                          |\n| ------------------- | ------------------------------- |\n| `B`                 | Add Branch                      |\n| `S`                 | Add Sequence                    |\n| `D`                 | Add Delay                       |\n| `F`                 | Add For Each Loop               |\n| `G`                 | Add Gate                        |\n| `M`                 | Add Multi Gate                  |\n| `O`                 | Add Do Once                     |\n| `N`                 | Add Do N                        |\n| `C`                 | Add Comment                     |\n| `F7`                | Compile Blueprint               |\n| `F9`                | Add Breakpoint to selected node |\n| `Ctrl` `Shift` `F9` | Remove all Breakpoints          |\n| `Home`              | Zoom to selected node           |\n\n{.shortcuts}\n\n### Asset Editor Viewports\n\nUsed in the viewport for the Mesh Editor, Material Editor, Blueprint Editor, etc.\n\n| Shortcut | Action                 |\n| -------- | ---------------------- |\n| `I`      | Toggle Environment     |\n| `O`      | Toggle Floor           |\n| `P`      | Toggle Post Processing |\n\n{.shortcuts}\n\n### Static Meshes\n\n| Shortcut   | Action                    |\n| ---------- | ------------------------- |\n| `Ctrl` `N` | Show Nanite Fallback Mesh |\n| `Alt` `N`  | Toggle Normals            |\n| `Alt` `S`  | Toggle Sockets            |\n\n{.shortcuts}\n\n## Your own Shortcuts\n\n### Shortcut Settings\n\n- Click on the `Edit` Menu\n\n- Open `Editor Preferences`\n\n- Under \"General\" (the first section), find `Editor Shortcuts`\n\n- Here you can modify all of the above shortcuts, as well as many more!\n\n## Also see\n\n- [Unreal Engine Blog: Designer's Guide to Shortcuts](https://www.unrealengine.com/en-US/tech-blog/designer-s-guide-to-unreal-engine-keyboard-shortcuts)\n  _(www.unrealengine.com)_\n- [Unreal Developer Community: Unexplored Shortcuts](https://dev.epicgames.com/community/learning/tutorials/yp8j/the-unexplored-unreal-engine-keyboard-shortucts)\n  _(dev.epicgames.com)_\n- [Unreal Engine Editor Hotkey Cheat Sheet](https://uecasts.com/resources/unreal-engine-5-editor-hotkeys-cheat-sheet)\n  _(uecasts.com)_\n- [Unreal Engine Actor Snapping Shortcuts](https://unrealdirective.com/tips/actor-snapping-shortcuts)\n  _(unrealdirective.com)_\n"
  },
  {
    "path": "source/_posts/vhdl.md",
    "content": "---\ntitle: VHDL\ndate: 2025-10-01 12:00:00\nbackground: bg-[#5c4a7a]\ntags:\n  - hardware\n  - hdl\n  - synthesis\ncategories:\n  - Programming\nintro: |\n  VHDL (VHSIC Hardware Description Language) cheat sheet - A comprehensive reference for digital hardware design and simulation.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Introduction\n\nVHDL is a hardware description language used for electronic design automation to describe digital and mixed-signal systems.\n\n- [IEEE 1076 Standard](https://standards.ieee.org/ieee/1076/3636/) _(IEEE Standard)_\n- [VHDL Tutorial](https://www.nandland.com/vhdl/tutorials/tutorial-introduction-to-vhdl-for-beginners.html) _(nandland.com)_\n- [Digital Design VHDL](https://vhdl.lapinoo.net/) _(lapinoo.net)_\n\n### Basic Entity\n\n```vhdl\nentity hello_world is\nend hello_world;\n\narchitecture behavioral of hello_world is\nbegin\n  -- Simple testbench process\n  process\n  begin\n    report \"Hello, VHDL World!\";\n    wait;\n  end process;\nend behavioral;\n```\n\nA basic VHDL entity and architecture\n\n### Simple AND Gate {.row-span-2}\n\n```vhdl\nlibrary ieee;\nuse ieee.std_logic_1164.all;\n\nentity and_gate is\n  port (\n    a : in  std_logic;\n    b : in  std_logic;\n    y : out std_logic\n  );\nend and_gate;\n\narchitecture behavioral of and_gate is\nbegin\n  y <= a and b;\nend behavioral;\n```\n\nBasic two-input AND gate implementation\n\n### Libraries and Packages\n\n```vhdl\nlibrary ieee;\nuse ieee.std_logic_1164.all;\nuse ieee.numeric_std.all;\nuse ieee.std_logic_arith.all;\nuse ieee.std_logic_unsigned.all;\n\nlibrary work;\nuse work.my_package.all;\n```\n\nCommon library declarations\n\n### Comments\n\n```vhdl\n-- Single line comment\n\n/* Multi-line comment\n   spanning multiple lines\n   (VHDL-2008 feature) */\n```\n\n## Data Types\n\n### Standard Logic Types {.row-span-2}\n\n| Type | Description | Values |\n|------|-------------|---------|\n| `bit` | Binary bit | '0', '1' |\n| `std_logic` | IEEE standard | '0', '1', 'Z', 'X', 'H', 'L', 'W', 'U', '-' |\n| `boolean` | Boolean type | true, false |\n| `integer` | Integer type | -2^31 to 2^31-1 |\n| `real` | Real number | Floating point |\n| `character` | Single character | ASCII characters |\n| `string` | Character array | \"Hello World\" |\n\n### Vector Types\n\n```vhdl\n-- Bit vectors\nsignal data_bus : bit_vector(7 downto 0);\nsignal address  : bit_vector(15 downto 0);\n\n-- Standard logic vectors\nsignal data     : std_logic_vector(7 downto 0);\nsignal control  : std_logic_vector(3 downto 0);\n\n-- Signed and unsigned (numeric_std)\nsignal counter  : unsigned(7 downto 0);\nsignal offset   : signed(15 downto 0);\n```\n\n### Array Types\n\n```vhdl\n-- Array type declaration\ntype memory_type is array (0 to 255) of std_logic_vector(7 downto 0);\n\n-- Array signal declaration\nsignal memory : memory_type;\n\n-- Multi-dimensional arrays\ntype matrix_type is array (0 to 3, 0 to 3) of integer;\nsignal matrix : matrix_type;\n```\n\n### Record Types\n\n```vhdl\n-- Record type declaration\ntype cpu_interface is record\n  address : std_logic_vector(15 downto 0);\n  data    : std_logic_vector(7 downto 0);\n  read_en : std_logic;\n  write_en: std_logic;\nend record;\n\n-- Record signal\nsignal cpu_bus : cpu_interface;\n\n-- Access record fields\ncpu_bus.address <= x\"1234\";\ncpu_bus.data    <= x\"AB\";\n```\n\n## Entity and Architecture\n\n### Entity Declaration {.row-span-2}\n\n```vhdl\nentity counter is\n  generic (\n    WIDTH : integer := 8;\n    MAX_COUNT : integer := 255\n  );\n  port (\n    clk     : in  std_logic;\n    reset   : in  std_logic;\n    enable  : in  std_logic;\n    count   : out std_logic_vector(WIDTH-1 downto 0);\n    overflow: out std_logic\n  );\nend entity counter;\n```\n\nEntity with generics and ports\n\n### Architecture Styles\n\n```vhdl\n-- Behavioral Architecture\narchitecture behavioral of counter is\n  signal count_int : unsigned(WIDTH-1 downto 0);\nbegin\n  process(clk, reset)\n  begin\n    if reset = '1' then\n      count_int <= (others => '0');\n      overflow <= '0';\n    elsif rising_edge(clk) then\n      if enable = '1' then\n        if count_int = MAX_COUNT then\n          count_int <= (others => '0');\n          overflow <= '1';\n        else\n          count_int <= count_int + 1;\n          overflow <= '0';\n        end if;\n      end if;\n    end if;\n  end process;\n  \n  count <= std_logic_vector(count_int);\nend behavioral;\n```\n\n### Structural Architecture\n\n```vhdl\narchitecture structural of adder_4bit is\n  component full_adder is\n    port (\n      a, b, cin : in  std_logic;\n      sum, cout : out std_logic\n    );\n  end component;\n  \n  signal carry : std_logic_vector(3 downto 0);\nbegin\n  -- Component instantiation\n  FA0: full_adder port map (a(0), b(0), cin, sum(0), carry(0));\n  FA1: full_adder port map (a(1), b(1), carry(0), sum(1), carry(1));\n  FA2: full_adder port map (a(2), b(2), carry(1), sum(2), carry(2));\n  FA3: full_adder port map (a(3), b(3), carry(2), sum(3), cout);\nend structural;\n```\n\n### Dataflow Architecture\n\n```vhdl\narchitecture dataflow of mux_4to1 is\nbegin\n  -- Concurrent signal assignments\n  output <= input0 when sel = \"00\" else\n            input1 when sel = \"01\" else\n            input2 when sel = \"10\" else\n            input3;\n            \n  -- Conditional assignment\n  with sel select\n    output <= input0 when \"00\",\n              input1 when \"01\", \n              input2 when \"10\",\n              input3 when others;\nend dataflow;\n```\n\n## Processes and Sequential Logic\n\n### Clocked Process {.row-span-2}\n\n```vhdl\n-- Synchronous process with clock and reset\nprocess(clk, reset)\nbegin\n  if reset = '1' then\n    -- Asynchronous reset\n    output <= '0';\n    state <= IDLE;\n  elsif rising_edge(clk) then\n    -- Synchronous logic\n    case state is\n      when IDLE =>\n        if start = '1' then\n          state <= ACTIVE;\n        end if;\n      when ACTIVE =>\n        output <= '1';\n        if done = '1' then\n          state <= IDLE;\n        end if;\n    end case;\n  end if;\nend process;\n```\n\n### Combinational Process\n\n```vhdl\n-- Combinational logic process\nprocess(a, b, sel)\nbegin\n  case sel is\n    when \"00\" =>\n      result <= a and b;\n    when \"01\" =>\n      result <= a or b;\n    when \"10\" =>\n      result <= a xor b;\n    when others =>\n      result <= not a;\n  end case;\nend process;\n```\n\n### Wait Statements\n\n```vhdl\n-- Testbench process with wait statements\nprocess\nbegin\n  -- Initialize\n  reset <= '1';\n  wait for 10 ns;\n  \n  reset <= '0';\n  wait for 20 ns;\n  \n  -- Apply stimulus\n  data_in <= x\"AA\";\n  wait until rising_edge(clk);\n  \n  -- Wait for condition\n  wait until ready = '1';\n  \n  wait;  -- Wait indefinitely\nend process;\n```\n\n## Operators and Expressions\n\n### Logical Operators\n\n```vhdl\n-- Logical operators\nresult <= a and b;\nresult <= a or b;\nresult <= a nand b;\nresult <= a nor b;\nresult <= a xor b;\nresult <= a xnor b;\nresult <= not a;\n```\n\n### Arithmetic Operators {.row-span-2}\n\n```vhdl\n-- Arithmetic operators (requires numeric_std)\nsignal a, b : unsigned(7 downto 0);\nsignal result : unsigned(8 downto 0);\n\nresult <= ('0' & a) + ('0' & b);  -- Addition with carry\nresult <= a - b;                   -- Subtraction\nresult <= a * b;                   -- Multiplication\nresult <= a / b;                   -- Division (synthesis limited)\nresult <= a mod b;                 -- Modulo\nresult <= a rem b;                 -- Remainder\nresult <= a ** 2;                  -- Exponentiation\n\n-- Increment/Decrement\ncounter <= counter + 1;\ncounter <= counter - 1;\n```\n\n### Relational Operators\n\n```vhdl\n-- Comparison operators\nif a = b then         -- Equal\nif a /= b then        -- Not equal\nif a < b then         -- Less than\nif a <= b then        -- Less than or equal\nif a > b then         -- Greater than\nif a >= b then        -- Greater than or equal\n```\n\n### Shift Operators\n\n```vhdl\n-- Shift operators (VHDL-2008)\nsignal data : std_logic_vector(7 downto 0);\n\ndata <= data sll 1;   -- Shift left logical\ndata <= data srl 1;   -- Shift right logical\ndata <= data sla 1;   -- Shift left arithmetic\ndata <= data sra 1;   -- Shift right arithmetic\ndata <= data rol 1;   -- Rotate left\ndata <= data ror 1;   -- Rotate right\n```\n\n## Control Structures\n\n### If-Then-Else\n\n```vhdl\n-- Simple if statement\nif enable = '1' then\n  output <= input;\nend if;\n\n-- If-else\nif reset = '1' then\n  counter <= 0;\nelse\n  counter <= counter + 1;\nend if;\n\n-- If-elsif-else\nif sel = \"00\" then\n  output <= input0;\nelsif sel = \"01\" then\n  output <= input1;\nelsif sel = \"10\" then\n  output <= input2;\nelse\n  output <= input3;\nend if;\n```\n\n### Case Statement\n\n```vhdl\n-- Case statement\ncase state is\n  when IDLE =>\n    next_state <= START;\n    output <= '0';\n  when START =>\n    next_state <= ACTIVE;\n    output <= '1';\n  when ACTIVE =>\n    if done = '1' then\n      next_state <= IDLE;\n    else\n      next_state <= ACTIVE;\n    end if;\n  when others =>\n    next_state <= IDLE;\n    output <= '0';\nend case;\n```\n\n### For Loops\n\n```vhdl\n-- For loop in process\nprocess(clk)\nbegin\n  if rising_edge(clk) then\n    for i in 0 to 7 loop\n      shift_reg(i+1) <= shift_reg(i);\n    end loop;\n    shift_reg(0) <= serial_in;\n  end if;\nend process;\n\n-- Generate statement with for loop\ngen_mux: for i in 0 to 3 generate\n  mux_inst: entity work.mux_2to1\n    port map (\n      a => input_a(i),\n      b => input_b(i),\n      sel => sel,\n      y => output(i)\n    );\nend generate;\n```\n\n### While Loops\n\n```vhdl\n-- While loop (primarily for testbenches)\nprocess\n  variable count : integer := 0;\nbegin\n  while count < 10 loop\n    wait until rising_edge(clk);\n    count := count + 1;\n  end loop;\n  wait;\nend process;\n```\n\n## Functions and Procedures\n\n### Function Declaration {.row-span-2}\n\n```vhdl\n-- Function declaration\nfunction to_integer(input : std_logic_vector) return integer is\n  variable result : integer := 0;\nbegin\n  for i in input'range loop\n    result := result * 2;\n    if input(i) = '1' then\n      result := result + 1;\n    end if;\n  end loop;\n  return result;\nend function;\n\n-- Function usage\nsignal address : std_logic_vector(7 downto 0);\nsignal addr_int : integer;\n\naddr_int <= to_integer(address);\n```\n\n### Procedure Declaration\n\n```vhdl\n-- Procedure declaration\nprocedure write_memory(\n  signal clk : in std_logic;\n  signal addr : in std_logic_vector(7 downto 0);\n  signal data : in std_logic_vector(7 downto 0);\n  signal mem : inout memory_type\n) is\nbegin\n  wait until rising_edge(clk);\n  mem(to_integer(unsigned(addr))) <= data;\nend procedure;\n\n-- Procedure call\nwrite_memory(clk, address, data_in, memory);\n```\n\n### Package Declaration\n\n```vhdl\n-- Package declaration\npackage my_package is\n  -- Constants\n  constant DATA_WIDTH : integer := 8;\n  constant ADDR_WIDTH : integer := 16;\n  \n  -- Types\n  type state_type is (IDLE, READ, WRITE, DONE);\n  \n  -- Functions\n  function parity(data : std_logic_vector) return std_logic;\n  \n  -- Procedures\n  procedure reset_signals(signal clk : in std_logic);\nend package;\n\n-- Package body\npackage body my_package is\n  function parity(data : std_logic_vector) return std_logic is\n    variable result : std_logic := '0';\n  begin\n    for i in data'range loop\n      result := result xor data(i);\n    end loop;\n    return result;\n  end function;\nend package body;\n```\n\n## Testbenches and Simulation\n\n### Basic Testbench {.row-span-2}\n\n```vhdl\nlibrary ieee;\nuse ieee.std_logic_1164.all;\nuse ieee.numeric_std.all;\n\nentity tb_counter is\nend tb_counter;\n\narchitecture behavioral of tb_counter is\n  -- Component declaration\n  component counter is\n    port (\n      clk     : in  std_logic;\n      reset   : in  std_logic;\n      enable  : in  std_logic;\n      count   : out std_logic_vector(7 downto 0)\n    );\n  end component;\n  \n  -- Testbench signals\n  signal clk     : std_logic := '0';\n  signal reset   : std_logic := '1';\n  signal enable  : std_logic := '0';\n  signal count   : std_logic_vector(7 downto 0);\n  \n  -- Clock period\n  constant clk_period : time := 10 ns;\n\nbegin\n  -- Unit Under Test instantiation\n  uut: counter\n    port map (\n      clk    => clk,\n      reset  => reset,\n      enable => enable,\n      count  => count\n    );\n  \n  -- Clock generation\n  clk_proc: process\n  begin\n    clk <= '0';\n    wait for clk_period/2;\n    clk <= '1';\n    wait for clk_period/2;\n  end process;\n  \n  -- Stimulus process\n  stim_proc: process\n  begin\n    -- Reset phase\n    reset <= '1';\n    wait for 20 ns;\n    reset <= '0';\n    \n    -- Enable counting\n    enable <= '1';\n    wait for 100 ns;\n    \n    -- Disable counting\n    enable <= '0';\n    wait for 50 ns;\n    \n    -- End simulation\n    wait;\n  end process;\nend behavioral;\n```\n\n### Assert Statements\n\n```vhdl\n-- Assert for verification\nprocess(clk)\nbegin\n  if rising_edge(clk) then\n    -- Check counter overflow\n    assert count /= \"11111111\" \n      report \"Counter overflow detected!\" \n      severity warning;\n    \n    -- Check reset functionality\n    if reset = '1' then\n      assert count = \"00000000\"\n        report \"Reset failed!\"\n        severity error;\n    end if;\n  end if;\nend process;\n```\n\n### File I/O\n\n```vhdl\n-- File I/O for testbenches\nuse std.textio.all;\n\nprocess\n  file input_file  : text open read_mode is \"input.txt\";\n  file output_file : text open write_mode is \"output.txt\";\n  variable line_in  : line;\n  variable line_out : line;\n  variable data     : integer;\nbegin\n  while not endfile(input_file) loop\n    readline(input_file, line_in);\n    read(line_in, data);\n    \n    -- Process data\n    data := data * 2;\n    \n    write(line_out, data);\n    writeline(output_file, line_out);\n  end loop;\n  \n  wait;\nend process;\n```\n\n## Attributes and Configuration\n\n### Signal Attributes\n\n```vhdl\n-- Common signal attributes\nsignal data : std_logic_vector(7 downto 0);\n\n-- Range attributes\ndata'left      -- 7 (leftmost index)\ndata'right     -- 0 (rightmost index)\ndata'high      -- 7 (highest index)\ndata'low       -- 0 (lowest index)\ndata'range     -- 7 downto 0\ndata'length    -- 8 (number of elements)\n\n-- Event attributes\nclk'event      -- true if clk changed\nclk'last_event -- time since last event\ndata'stable(5 ns) -- true if stable for 5 ns\n```\n\n### Type Attributes\n\n```vhdl\n-- Type attributes\ntype state_type is (IDLE, ACTIVE, DONE);\n\nstate_type'left        -- IDLE\nstate_type'right       -- DONE\nstate_type'pos(ACTIVE) -- 1\nstate_type'val(2)      -- DONE\nstate_type'succ(IDLE)  -- ACTIVE\nstate_type'pred(DONE)  -- ACTIVE\n```\n\n### Generate Statements\n\n```vhdl\n-- Conditional generate\ngen_async: if ASYNC_RESET generate\n  process(clk, reset)\n  begin\n    if reset = '1' then\n      output <= '0';\n    elsif rising_edge(clk) then\n      output <= input;\n    end if;\n  end process;\nend generate;\n\ngen_sync: if not ASYNC_RESET generate\n  process(clk)\n  begin\n    if rising_edge(clk) then\n      if reset = '1' then\n        output <= '0';\n      else\n        output <= input;\n      end if;\n    end if;\n  end process;\nend generate;\n```\n\n## Advanced Concepts\n\n### State Machines {.row-span-2}\n\n```vhdl\n-- Finite State Machine\ntype state_type is (IDLE, LOAD, EXECUTE, STORE, DONE);\nsignal current_state, next_state : state_type;\n\n-- State register\nprocess(clk, reset)\nbegin\n  if reset = '1' then\n    current_state <= IDLE;\n  elsif rising_edge(clk) then\n    current_state <= next_state;\n  end if;\nend process;\n\n-- Next state logic\nprocess(current_state, start, load_done, exec_done, store_done)\nbegin\n  case current_state is\n    when IDLE =>\n      if start = '1' then\n        next_state <= LOAD;\n      else\n        next_state <= IDLE;\n      end if;\n      \n    when LOAD =>\n      if load_done = '1' then\n        next_state <= EXECUTE;\n      else\n        next_state <= LOAD;\n      end if;\n      \n    when EXECUTE =>\n      if exec_done = '1' then\n        next_state <= STORE;\n      else\n        next_state <= EXECUTE;\n      end if;\n      \n    when STORE =>\n      if store_done = '1' then\n        next_state <= DONE;\n      else\n        next_state <= STORE;\n      end if;\n      \n    when DONE =>\n      next_state <= IDLE;\n  end case;\nend process;\n\n-- Output logic\nprocess(current_state)\nbegin\n  -- Default outputs\n  load_enable <= '0';\n  exec_enable <= '0';\n  store_enable <= '0';\n  busy <= '1';\n  \n  case current_state is\n    when IDLE =>\n      busy <= '0';\n    when LOAD =>\n      load_enable <= '1';\n    when EXECUTE =>\n      exec_enable <= '1';\n    when STORE =>\n      store_enable <= '1';\n    when DONE =>\n      busy <= '0';\n  end case;\nend process;\n```\n\n### Generic Programming\n\n```vhdl\n-- Generic entity\nentity generic_counter is\n  generic (\n    WIDTH : positive := 8;\n    MAX_VALUE : positive := 255;\n    RESET_VALUE : natural := 0\n  );\n  port (\n    clk   : in  std_logic;\n    reset : in  std_logic;\n    enable: in  std_logic;\n    count : out std_logic_vector(WIDTH-1 downto 0);\n    tc    : out std_logic  -- Terminal count\n  );\nend entity;\n\n-- Generic instantiation\ncounter_8bit: entity work.generic_counter\n  generic map (\n    WIDTH => 8,\n    MAX_VALUE => 255,\n    RESET_VALUE => 0\n  )\n  port map (\n    clk => system_clk,\n    reset => system_reset,\n    enable => count_enable,\n    count => counter_value,\n    tc => counter_tc\n  );\n```\n\n### Configurations\n\n```vhdl\n-- Configuration declaration\nconfiguration counter_config of tb_counter is\n  for behavioral\n    for uut : counter\n      use entity work.counter(behavioral);\n    end for;\n  end for;\nend configuration;\n\n-- Alternative configuration\nconfiguration counter_rtl_config of tb_counter is\n  for behavioral\n    for uut : counter\n      use entity work.counter(rtl);\n    end for;\n  end for;\nend configuration;\n```\n\n## Common Patterns\n\n### Clock Domain Crossing\n\n```vhdl\n-- Double flip-flop synchronizer\nentity synchronizer is\n  port (\n    clk_dest : in  std_logic;\n    reset    : in  std_logic;\n    async_in : in  std_logic;\n    sync_out : out std_logic\n  );\nend entity;\n\narchitecture rtl of synchronizer is\n  signal ff1, ff2 : std_logic;\n  attribute ASYNC_REG : string;\n  attribute ASYNC_REG of ff1 : signal is \"TRUE\";\n  attribute ASYNC_REG of ff2 : signal is \"TRUE\";\nbegin\n  process(clk_dest, reset)\n  begin\n    if reset = '1' then\n      ff1 <= '0';\n      ff2 <= '0';\n    elsif rising_edge(clk_dest) then\n      ff1 <= async_in;\n      ff2 <= ff1;\n    end if;\n  end process;\n  \n  sync_out <= ff2;\nend rtl;\n```\n\n### Memory Inference\n\n```vhdl\n-- RAM inference\ntype ram_type is array (0 to 255) of std_logic_vector(7 downto 0);\nsignal ram : ram_type;\n\nprocess(clk)\nbegin\n  if rising_edge(clk) then\n    if write_enable = '1' then\n      ram(to_integer(unsigned(address))) <= data_in;\n    end if;\n    data_out <= ram(to_integer(unsigned(address)));\n  end if;\nend process;\n```\n\n### Reset Strategies\n\n```vhdl\n-- Asynchronous reset\nprocess(clk, async_reset)\nbegin\n  if async_reset = '1' then\n    output <= '0';\n  elsif rising_edge(clk) then\n    output <= input;\n  end if;\nend process;\n\n-- Synchronous reset\nprocess(clk)\nbegin\n  if rising_edge(clk) then\n    if sync_reset = '1' then\n      output <= '0';\n    else\n      output <= input;\n    end if;\n  end if;\nend process;\n```"
  },
  {
    "path": "source/_posts/vim.md",
    "content": "---\ntitle: Vim\ndate: 2020-11-25 18:28:43\nbackground: bg-[#46933f]\ntags:\n  - vi\n  - text\n  - editor\n  - terminal\n  - shortcut\ncategories:\n  - Toolkit\nintro: |\n  A useful collection of [Vim](http://www.vim.org/) 8.2 quick reference cheat sheets to help you learn vim editor faster.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Motion Diagrams {.row-span-2}\n\n```bash\n▼/▶ Cursor   ▽/▷ Target\n```\n\n#### Left-right motions\n\n```bash\n┌───────────── |\n├───────────── 0      $ ──────────────┐\n│  ┌────────── ^      fe ────────┐    │\n│  │  ┌─────── Fo     te ───────┐│    │\n│  │  │┌────── To     30| ───┐  ││    │\n│  │  ││ ┌──── ge     w ───┐ │  ││    │\n│  │  ││ │ ┌── b      e ─┐ │ │  ││    │\n│  │  ││ │ │  ┌h      l┐ │ │ │  ││    │\n▽  ▽  ▽▽ ▽ ▽  ▽▼      ▼▽ ▽ ▽ ▽  ▽▽    ▽\n   echo \"A cheatsheet from quickref.me\"\n```\n\n#### Up-down motions\n\n```bash\n                 - SCREEN 1 START\n   ┌─┬─────────▷ #!/usr/bin/python\n   │ │     ┌───▷\n   │ │     │     print(\"Hello\")\n   │ │     { } ▶ print(\"Vim\")\n   │ │       │   print(\"!\")\n   │ │       └─▷\n   │ │ ┌───┬───▷ print(\"Welcome\")\nG gg H M L k j ▶ print(\"to\")\n│        │   └─▷ print(\"cheatsheets.zip\")\n│        │       print(\"/vim\")\n│        │\n│        └─────▷\n│                - SCREEN 1 END\n└──────────────▷ print(\"SCREEN 2\")\n```\n\n### Motions {.row-span-2}\n\n| Shortcut                       | Description       |\n| ------------------------------ | :---------------- |\n| `h` _\\|_ `j` _\\|_ `k` _\\|_ `l` | Arrow keys        |\n| `<C-u>` _/_ `<C-d>`            | Half-page up/down |\n| `<C-b>` _/_ `<C-f>`            | Page up/down      |\n\n{.shortcuts}\n\n#### Words{.left-text}\n\n| Shortcut     | Description               |\n| ------------ | :------------------------ |\n| `b` _/_ `w`  | Previous/Next word        |\n| `ge` _/_ `e` | Previous/Next end of word |\n\n{.shortcuts}\n\n#### Line\n\n| Shortcut             | Description                 |\n| -------------------- | :-------------------------- |\n| `0` _(zero)_ _/_ `$` | Start/End of line           |\n| `^`                  | Start of line _(non-blank)_ |\n\n{.shortcuts}\n\n#### Character\n\n| Shortcut                            | Description                         |\n| ----------------------------------- | :---------------------------------- |\n| `Fe` _/_ `fe`                       | Move to previous/next `e`           |\n| `To` _/_ `to`                       | Move before/after previous/next `o` |\n| <code>\\|</code>_/_ <code>n\\|</code> | Go to first/`n`th column            |\n\n{.shortcuts}\n\n#### Document\n\n| Shortcut       | Description              |\n| -------------- | :----------------------- |\n| `gg` _/_ `G`   | First/Last line          |\n| `:n` _\\|_ `nG` | Go to line `n`           |\n| `}` _/_ `{`    | Next/Previous empty line |\n\n{.shortcuts}\n\n#### Window\n\n| Shortcut               | Description                 |\n| ---------------------- | :-------------------------- |\n| `H` _/_ `M` _/_ `L`    | Top/Middle/Bottom screen    |\n| `zt` _/_ `zz` _/_ `zb` | Top/Center/Bottom this line |\n\n{.shortcuts}\n\n### Insert Mode\n\n| Shortcut               | Description                   |\n| ---------------------- | :---------------------------- |\n| `i` _/_ `a`            | Insert before/after cursor    |\n| `I` _/_ `A`            | Insert start/end of line      |\n| `o` _/_ `O` _(letter)_ | Insert new line below/above   |\n| `s` _/_ `S`            | Delete char/line and insert   |\n| `C` _/_ `cc`           | Change to end of/current line |\n| `gi`                   | Insert at last insert point   |\n| `Esc` _\\|_ `<C-[>`     | Exit insert mode              |\n\n{.shortcuts}\n\n### Saving and Exiting\n\n| Shortcut                  | Description             |\n| ------------------------- | :---------------------- |\n| `:w`                      | Save                    |\n| `:q`                      | Close file              |\n| `:wq` _\\|_ `:x` _\\|_ `ZZ` | Save and quit           |\n| `:wqa`                    | Save and quit all files |\n| `:q!` _\\|_ `ZQ`           | Force quit              |\n| `:qa`                     | Close all files         |\n| `:qa!`                    | Force quit all files    |\n| `:w` now.txt              | Write to `now.txt`      |\n| `:sav` new.txt            | Save and edit `new.txt` |\n| `:w` !sudo tee %          | Write to readonly file  |\n\n{.shortcuts}\n\n### Normal Mode\n\n| Shortcut              | Description                  |\n| --------------------- | :--------------------------- |\n| `r`                   | Replace one character        |\n| `R`                   | Enter Replace mode           |\n| `u` _/_ `3u`          | Undo changes `1` / `3` times |\n| `U`                   | Undo changes on one line     |\n| `J`                   | Join with next line          |\n| `<C-r>` _/_ 5 `<C-r>` | Redo changes `1` / `5` times |\n\n{.shortcuts}\n\n### Cut and paste {.row-span-2}\n\n| Shortcut         | Description                   |\n| ---------------- | :---------------------------- |\n| `x`              | Delete character _(Cut)_      |\n| `p` _/_ `P`      | Paste after/before            |\n| `xp`             | Swap two characters           |\n| `D`              | Delete to end of line _(Cut)_ |\n| `dw`             | Delete word _(Cut)_           |\n| `dd`             | Delete line _(Cut)_           |\n| `ddp`            | Swap two lines                |\n| `yy`             | Yank line _(Copy)_            |\n| `\"*p` _\\|_ `\"+p` | Paste from system clipboard   |\n| `\"*y` _\\|_ `\"+y` | Paste to system clipboard     |\n\n{.shortcuts}\n\n#### In visual mode\n\n| Shortcut     | Description              |\n| ------------ | :----------------------- |\n| `d` _\\|_ `x` | Delete selection _(Cut)_ |\n| `s`          | Replace selection        |\n| `y`          | Yank selection _(Copy)_  |\n\n{.shortcuts}\n\n### Repeating\n\n| Shortcut | Description                                 |\n| -------- | :------------------------------------------ |\n| `.`      | Repeat last command                         |\n| `;`      | Repeat latest `f`, `t`, `F` or `T`          |\n| `,`      | Repeat latest `f`, `t`, `F` or `T` reversed |\n| `&`      | Repeat last `:s`                            |\n| `@:`     | Repeat a command-line command               |\n\n{.shortcuts}\n\n### Visual mode\n\n| Shortcut    | Description             |\n| ----------- | :---------------------- |\n| `v`         | Enter visual mode       |\n| `V`         | Enter visual line mode  |\n| `<C-v>`     | Enter visual block mode |\n| `ggVG`      | Select all text         |\n| `>` _/_ `<` | Shift text right/left   |\n\n{.shortcuts}\n\n### Macros\n\n| -     | -                     |\n| ----- | :-------------------- |\n| `qi`  | Record macro `i`      |\n| `q`   | Stop recording macro  |\n| `@i`  | Run macro `i`         |\n| `7@i` | Run macro `i` 7 times |\n| `@@`  | Repeat last macro     |\n\n{.shortcuts}\n\nYou can save macro for any letters not just `i`\n\n## Vim Operators\n\n### Usage {.secondary}\n\n| Shortcut | Description  |\n| -------- | :----------- |\n| `d`      | <yel>w</yel> |\n| Operator | Motion       |\n\nCombine [operators](#available-operators) with [motions](#motions) to use them\n\n### Available Operators {.row-span-2}\n\n| Shortcut | Description                     |\n| -------- | :------------------------------ |\n| `d`      | Delete                          |\n| `y`      | Yank _(copy)_                   |\n| `c`      | Change _(delete then insert)_   |\n| `p`      | Paste                           |\n| `=`      | Formats code                    |\n| `g~`     | Toggle case                     |\n| `gU`     | Uppercase                       |\n| `gu`     | Lowercase                       |\n| `>`      | Indent right                    |\n| `<`      | Indent left                     |\n| `!`      | Filter through external program |\n\n### Examples {.row-span-2}\n\n| Combination          | Description                           |\n| -------------------- | :------------------------------------ |\n| `d`<yel>d</yel>      | Delete current line                   |\n| `d`<yel>j</yel>      | Delete two lines                      |\n| `d`<yel>w</yel>      | Delete to next word                   |\n| `d`<yel>b</yel>      | Delete to beginning of word           |\n| `d`<yel>fa</yel>     | Delete until `a` char                 |\n| `d`<yel>/hello</yel> | Delete until `hello`                  |\n| `c`<yel>c</yel>      | Change current line, synonym with `S` |\n| `y`<yel>y</yel>      | Copy current line                     |\n| `>`<yel>j</yel>      | Indent 2 lines                        |\n| gg`d`<yel>G</yel>    | Delete a complete document            |\n| gg`=`<yel>G</yel>    | Indent a complete document            |\n| gg`y`<yel>G</yel>    | Copy a whole document                 |\n\n{.show-header}\n\n### Counts\n\n```\n[count] <operator> <motion>\n<operator> [count] <motion>\n```\n\n---\n\n| Combination      | Description                |\n| ---------------- | :------------------------- |\n| 2`d`<yel>d</yel> | Delete `2` lines           |\n| 6`y`<yel>y</yel> | Copy `6` lines             |\n| `d`3<yel>w</yel> | Delete `3` words           |\n| `d`5<yel>j</yel> | Delete `5` lines downwards |\n| `>`4<yel>k</yel> | Indent `4` lines upwards   |\n\n## Vim Text objects\n\n### Usage {.secondary}\n\n<!-- Confusing and should be fixed -->\n\n| Shortcut |              Description               | -            |\n| -------- | :------------------------------------: | :----------- |\n| `v`      |     <pur>i</pur> _/_ <pur>a</pur>      | <yel>p</yel> |\n| Operator | <pur>i</pur>nner _/_ <pur>a</pur>round | Text object  |\n\nOperate with an [operator](#available-operators) inner or around text blocks\n\n### Text objects {.row-span-2}\n\n| Shortcut                                             | Description                            |\n| ---------------------------------------------------- | :------------------------------------- |\n| <yel>p</yel>                                         | Paragraph                              |\n| <yel>w</yel>                                         | Word                                   |\n| <yel>W</yel>                                         | WORD <br/>_(surrounded by whitespace)_ |\n| <yel>s</yel>                                         | Sentence                               |\n| <yel>[</yel> <yel>(</yel> <yel>{</yel> <yel>\\<</yel> | A [], (), or {} block                  |\n| <yel>]</yel> <yel>)</yel> <yel>}</yel> <yel>\\></yel> | A [], (), or {} block                  |\n| <yel>'</yel> <yel>\"</yel> <yel>\\`</yel>              | A quoted string                        |\n| <yel>b</yel>                                         | A block [(                             |\n| <yel>B</yel>                                         | A block in [{                          |\n| <yel>t</yel>                                         | A HTML tag block                       |\n\nSee `:help text-objects`\n\n### Delete\n\n| Shortcut                    | Description                           |\n| --------------------------- | :------------------------------------ |\n| `d`<pur>i</pur><yel>w</yel> | Delete inner word                     |\n| `d`<pur>i</pur><yel>s</yel> | Delete inner sentence                 |\n| `d`<pur>i</pur><yel>\"</yel> | Delete in quotes                      |\n| `d`<pur>a</pur><yel>\"</yel> | Delete in quotes _(including quotes)_ |\n| `d`<pur>i</pur><yel>p</yel> | Delete a paragraph                    |\n\n### Selections\n\n| Shortcut                                            | Description                               |\n| --------------------------------------------------- | :---------------------------------------- |\n| `v`<pur>i</pur><yel>\"</yel>                         | Select inner quotes \"`...`{.underline}\"   |\n| `v`<pur>a</pur><yel>\"</yel>                         | Select quotes `\"...\"`{.underline}         |\n| `v`<pur>i</pur><yel>[</yel>                         | Select inner brackets [`...`{.underline}] |\n| `v`<pur>a</pur><yel>[</yel>                         | Select brackets `[...]`{.underline}       |\n| `v`<pur>i</pur><yel>w</yel>                         | Select inner word                         |\n| `v`<pur>i</pur><yel>p</yel>                         | Select inner paragraph                    |\n| `v`<pur>i</pur><yel>p</yel><pur>i</pur><yel>p</yel> | Select more paragraph                     |\n\n### Misc\n\n| Shortcut                    | Description                          |\n| --------------------------- | :----------------------------------- |\n| `c`<pur>i</pur><yel>w</yel> | Change inner word                    |\n| `c`<pur>i</pur><yel>\"</yel> | Change inner quotes                  |\n| `c`<pur>i</pur><yel>t</yel> | Change inner tags (HTML)             |\n| `c`<pur>i</pur><yel>p</yel> | Change inner paragraph               |\n| `y`<pur>i</pur><yel>p</yel> | Yank inner paragraph                 |\n| `y`<pur>a</pur><yel>p</yel> | Yank paragraph _(including newline)_ |\n\n## Vim Multiple files\n\n### Buffers\n\n| -          | -                                |\n| ---------- | :------------------------------- |\n| `:e file`  | Edit a file in a new buffer      |\n| `:bn`      | Go to the next buffer            |\n| `:bp`      | Go to the previous buffer        |\n| `:bd`      | Remove file from buffer list     |\n| `:b 5`     | Open buffer #5                   |\n| `:b file`  | Go to a buffer by file           |\n| `:ls`      | List all open buffers            |\n| `:sp file` | Open and split window            |\n| `:vs file` | Open and vertically split window |\n| `:hid`     | Hide this buffer                 |\n| `:wn`      | Write file and move to next      |\n| `:tab ba`  | Edit all buffers as tabs         |\n\n### Windows\n\n| -                       | -                           |\n| ----------------------- | :-------------------------- |\n| `<C-w>` `s`             | Split window                |\n| `<C-w>` `v`             | Split window vertically     |\n| `<C-w>` `w`             | Switch windows              |\n| `<C-w>` `q`             | Quit a window               |\n| `<C-w>` `T`             | Break out into a new tab    |\n| `<C-w>` `x`             | Swap current with next      |\n| `<C-w>` `-` _/_ `+`     | Decrease/Increase height    |\n| `<C-w>` `<` _/_ `>`     | Decrease/Increase width     |\n| `<C-w>` <code>\\|</code> | Max out the width           |\n| `<C-w>` `_`             | Max out the height          |\n| `<C-w>` `=`             | Equally high and wide       |\n| `<C-w>` `h` _/_ `l`     | Go to the left/right window |\n| `<C-w>` `j` _/_ `k`     | Go to the up/down window    |\n\n{.shortcuts}\n\n### Tabs\n\n| Shortcut       | Description                       |\n| -------------- | :-------------------------------- |\n| `:tabe [file]` | <yel>E</yel>dit file in a new tab |\n| `:tabf [file]` | Open if exists in new tab         |\n| `:tabc`        | <yel>C</yel>lose current tab      |\n| `:tabo`        | Close <yel>o</yel>ther tabs       |\n| `:tabs`        | List all <yel>tabs</yel>          |\n| `:tabr`        | Go to fi<yel>r</yel>st tab        |\n| `:tabl`        | Go to <yel>l</yel>ast tab         |\n| `:tabm 0`      | <yel>M</yel>ove to position `0`   |\n| `:tabn`        | Go to <yel>n</yel>ext tab         |\n| `:tabp`        | Go to <yel>p</yel>revious tab     |\n\n#### Normal mode\n\n| Shortcut | Description                   |\n| -------- | :---------------------------- |\n| `gt`     | Go to <yel>n</yel>ext tab     |\n| `gT`     | Go to <yel>p</yel>revious tab |\n| `2gt`    | Go to tab number `2`          |\n\n{.shortcuts}\n\n## Vim Search and Replace\n\n### Search\n\n| -        | -                                   |\n| -------- | :---------------------------------- |\n| `/foo`   | Search forward                      |\n| `/foo\\c` | Search forward _(case insensitive)_ |\n| `?foo`   | Search backward                     |\n| `/\\v\\d+` | Search with [regex](/regex)         |\n| `n`      | Next matching search pattern        |\n| `N`      | Previous match                      |\n| `*`      | Search for current word forward     |\n| `#`      | Search for current word backward    |\n\n{.shortcuts}\n\n### Replace LINE\n\n```vim\n:[range]s/{pattern}/{str}/[flags]\n```\n\n---\n\n|                   |                                  |\n| ----------------- | :------------------------------- |\n| `:s/old/new`      | Replace first                    |\n| `:s/old/new/g`    | Replace all                      |\n| `:s/\\vold/new/g`  | Replace all with [regex](/regex) |\n| `:s/old/new/gc`   | replace all _(Confirm)_          |\n| `:s/old/new/i`    | Ignore case replace first        |\n| `:2,6s/old/new/g` | Replace between lines `2`-`6`    |\n\n### Replace FILE\n\n```vim\n:%s/{pattern}/{str}/[flags]\n```\n\n---\n\n|                   |                                  |\n| ----------------- | :------------------------------- |\n| `:%s/old/new`     | Replace first                    |\n| `:%s/old/new/g`   | Replace all                      |\n| `:%s/old/new/gc`  | Replace all _(Confirm)_          |\n| `:%s/old/new/gi`  | Replace all _(ignore case)_      |\n| `:%s/\\vold/new/g` | Replace all with [regex](/regex) |\n\n### Ranges {.row-span-2}\n\n| -       | -                 |\n| ------- | :---------------- |\n| `%`     | Entire file       |\n| `’<,’>` | Current selection |\n| `5`     | Line `5`          |\n| `5,10`  | Lines `5` to `10` |\n| `$`     | Last line         |\n| `2,$`   | Lines `2` to Last |\n| `.`     | Current line      |\n| `,3`    | Next `3` lines    |\n| `-3,`   | Forward `3` lines |\n\n### Global command {.row-span-2}\n\n```vim\n:[range]g/{pattern}/[command]\n```\n\n---\n\n|              |                                    |\n| ------------ | :--------------------------------- |\n| `:g/foo/d`   | Delete lines containing `foo`      |\n| `:g!/foo/d`  | Delete lines not containing `foo`  |\n| `:g/^\\s*$/d` | Delete all blank lines             |\n| `:g/foo/t$`  | Copy lines containing `foo` to EOF |\n| `:g/foo/m$`  | Move lines containing `foo` to EOF |\n| `:g/^/m0`    | Reverse a file                     |\n| `:g/^/t.`    | Duplicate every line               |\n\n### Inverse :g\n\n```vim\n:[range]v/{pattern}/[command]\n```\n\n---\n\n|            |                                                            |\n| ---------- | :--------------------------------------------------------- |\n| `:v/foo/d` | Delete lines not containing `foo`<br/>_(also `:g!/foo/d`)_ |\n\n### Flags\n\n| -   | -                         |\n| --- | :------------------------ |\n| `g` | Replace all occurrences   |\n| `i` | Ignore case               |\n| `I` | Don't ignore case         |\n| `c` | Confirm each substitution |\n\n### Substitute expression (magic)\n\n| -             | -                                |\n| ------------- | :------------------------------- |\n| `&` _\\|_ `\\0` | Replace with the whole matched   |\n| `\\1`...`\\9`   | Replace with the group 0-9       |\n| `\\u`          | Uppercase next letter            |\n| `\\U`          | Uppercase following characters   |\n| `\\l`          | Lowercase next letter            |\n| `\\L`          | Lowercase following characters   |\n| `\\e`          | End of `\\u`, `\\U`, `\\l` and `\\L` |\n| `\\E`          | End of `\\u`, `\\U`, `\\l` and `\\L` |\n\n### Examples {.col-span-2}\n\n```c {.wrap}\n:s/a\\|b/xxx\\0xxx/g\t\t         # Modifies \"a b\"      to \"xxxaxxx xxxbxxx\"\n:s/test/\\U& file/                # Modifies \"test\"     to \"TEST FILE\"\n:s/\\(test\\)/\\U\\1\\e file/         # Modifies \"test\"     to \"TEST file\"\n:s/\\v([abc])([efg])/\\2\\1/g\t     # Modifies \"af fa bg\" to \"fa fa gb\"\n:s/\\v\\w+/\\u\\0/g\t\t             # Modifies \"bla bla\"  to \"Bla Bla\"\n:s/\\v([ab])|([cd])/\\1x/g         # Modifies \"a b c d\"  to \"ax bx x x\"\n:%s/.*/\\L&/                      # Modifies \"HTML\"     to \"html\"\n:s/\\v<(.)(\\w*)/\\u\\1\\L\\2/g        # Make every first letter of a word uppercase\n:%s/^\\(.*\\)\\n\\1/\\1/              # Remove duplicate lines\n:%s/<\\/\\=\\(\\w\\+\\)\\>/\\U&/g        # Convert HTML-Tags to uppercase\n:g/^pattern/s/$/mytext           # Find and append text to the end\n:g/pattern/norm! @i              # Run a macro on matching lines\n/^\\(.*\\)\\(\\r\\?\\n\\1\\)\\+$          # View the duplicates lines\n/\\v^(.*)(\\r?\\n\\1)+$              # View the duplicates lines (very magic)\n:v/./,/./-j                      # Compress blank lines into a blank line\n:g/<p1>/,/<p2>/d                 # Delete inclusively from <p1> to <p2>\n```\n\n## Vimdiff\n\n### Usage {.secondary}\n\n```shell script\n\n$ vimdiff file1 file2 [file3]\n$ vim -d file1 file2 [file3]\n```\n\n### Editing {.row-span-2}\n\n```\n:[range]diffget [bufspec]\n:[range]diffput [bufspec]\n```\n\n---\n\n| Shortcut            | Description             |\n| ------------------- | :---------------------- |\n| `do` _/_ `:diffget` | Obtain (get) difference |\n| `dp` _/_ `:diffput` | Put difference          |\n| `:dif`              | Re-scan differences     |\n| `:diffo`            | Switch off diff mode    |\n| `:1,$+1diffget`     | Get all differences     |\n| `ZQ`                | Quit without changes    |\n\n{.shortcuts}\n\nSee: [Ranges](#ranges)\n\n### Folds {.row-span-2}\n\n| Shortcut      | Description                  |\n| ------------- | :--------------------------- |\n| `zo` _/_ `zO` | Open                         |\n| `zc` _/_ `zC` | Close                        |\n| `za` _/_ `zA` | Toggle                       |\n| `zv`          | Open folds for this line     |\n| `zM`          | Close all                    |\n| `zR`          | Open all                     |\n| `zm`          | Fold more _(foldlevel += 1)_ |\n| `zr`          | Fold less _(foldlevel -= 1)_ |\n| `zx`          | Update folds                 |\n\n{.shortcuts}\n\n### Jumping\n\n<br>\n\n| Shortcut | Description         |\n| -------- | :------------------ |\n| `]c`     | Next difference     |\n| `[c`     | Previous difference |\n\n{.shortcuts}\n\n## Quickfix List (Advanced)\n\n### Usage\n\nThe Quickfix List is primarily used to navigate a list of errors/warnings (or file locations) generated by a compiler or linter.\n\n| Shortcut     | Description                                                      |\n| :----------- | :--------------------------------------------------------------- |\n| `:copen`     | Open the quickfix window                                         |\n| `:cclose`    | Close the quickfix window                                        |\n| `:cnext`     | Go to the **next** error/location (`:cn` also works)             |\n| `:cprevious` | Go to the **previous** error/location (`:cp` also works)         |\n| `:clist`     | List all errors/locations in the list                            |\n| `:cf [file]` | Populate the list with errors from a file (e.g., a compiler log) |\n\n---\n\n### Quickfix Do (`:cdo` and `:cfdo`)\n\nThe `:cdo` (quickfix do) and `:cfdo` (quickfix file do) commands execute a command in every file listed in the quickfix list. `:cdo` iterates over every _location_ in the list, while `:cfdo` iterates over every _unique file_ in the list.\n\n| Command       | Description                                                     |\n| :------------ | :-------------------------------------------------------------- |\n| `:cdo [cmd]`  | Execute `[cmd]` for every **location** in the quickfix list.    |\n| `:cfdo [cmd]` | Execute `[cmd]` for every **unique file** in the quickfix list. |\n\n---\n\n## Miscellaneous\n\n### Case {.row-span-2}\n\n| Shortcut       | Description             |\n| -------------- | :---------------------- |\n| `vU`           | _Uppercase_ character   |\n| `vu`           | _Lowercase_ character   |\n| `~`            | _Toggle case_ character |\n| `viw` `U`      | _Uppercase_ word        |\n| `viw` `u`      | _Lowercase_ word        |\n| `viw` `~`      | _Toggle case_ word      |\n| `VU` _/_ `gUU` | _Uppercase_ line        |\n| `Vu` _/_ `guu` | _Lowercase_ line        |\n| `V~` _/_ `g~~` | _Toggle case_ line      |\n| `gggUG`        | _Uppercase_ all text    |\n| `ggguG`        | _Lowercase_ all text    |\n| `ggg~G`        | _Toggle case_ all text  |\n\n{.shortcuts}\n\n### Jumping\n\n| Shortcut | Description              |\n| -------- | :----------------------- |\n| `<C-o>`  | Go back to previous      |\n| `<C-i>`  | Go forward               |\n| `gf`     | Go to file in cursor     |\n| `ga`     | Display hex, ascii value |\n\n{.shortcuts}\n\n### Misc command-lines {.row-span-2}\n\n| -              | -                                          |\n| -------------- | :----------------------------------------- |\n| `:h`           | Help open help view                        |\n| `:edit!`       | Reload current file                        |\n| `:2,8m0`       | Move lines `2`-`8` to `0`                  |\n| `:noh`         | Clear search highlights                    |\n| `:sort`        | Sort lines                                 |\n| `:ter`         | Open a terminal window                     |\n| `:set paste`   | Enable Insert Paste sub-mode               |\n| `:set nopaste` | disable Insert Paste sub-mode              |\n| `:cq`          | Exiting with an error<br/>_(aborting Git)_ |\n\n### Navigating\n\n| Shortcut       | Description               |\n| -------------- | :------------------------ |\n| `%`            | Nearest/matching `{[()]}` |\n| `[(` _\\|_ `[{` | Previous `(` or `{`       |\n| `])` _\\|_ `]{` | Next `)` or `}`           |\n| `[m`           | Previous method start     |\n| `[M`           | Previous method end       |\n\n{.shortcuts}\n\n### Counters\n\n| Shortcut | Description     |\n| -------- | :-------------- |\n| `<C-a>`  | Increase number |\n| `<C-x>`  | Decrease number |\n\n{.shortcuts}\n\n### Tags {.row-span-2 .col-span-2}\n\n| Shortcut             | Description                                     |\n| -------------------- | :---------------------------------------------- |\n| `:tag Classname`     | Jump to first definition of Classname           |\n| `<C-]>`              | Jump to definition                              |\n| `g]`                 | See all definitions                             |\n| `<C-t>`              | Go back to last tag                             |\n| `<C-o> <C-i>`        | Back/forward                                    |\n| `:tselect Classname` | Find definitions of Classname                   |\n| `:tjump Classname`   | Find definitions of Classname (auto-select 1st) |\n\n{.shortcuts}\n\n### Formatting\n\n| -       | -                                |\n| ------- | -------------------------------- |\n| `:ce 8` | Center lines between `8` columns |\n| `:ri 4` | Right-align lines at `4` columns |\n| `:le`   | Left-align lines                 |\n\nSee `:help formatting`\n\n### Marks {.col-span-2 .row-span-4}\n\n| Shortcut            | Description                                          |\n| ------------------- | :--------------------------------------------------- |\n| <code>\\`^</code>    | Last position of cursor in insert mode               |\n| <code>\\`.</code>    | Last change in current buffer                        |\n| <code>\\`\"</code>    | Last exited current buffer                           |\n| <code>\\`0</code>    | In last file edited                                  |\n| <code>''</code>     | Back to line in current buffer where jumped from     |\n| <code>\\`\\`</code>   | Back to position in current buffer where jumped from |\n| <code>\\`[</code>    | To beginning of previously changed or yanked text    |\n| <code>\\`]</code>    | To end of previously changed or yanked text          |\n| <code>\\`&lt;</code> | To beginning of last visual selection                |\n| <code>\\`&gt;</code> | To end of last visual selection                      |\n| `ma`                | Mark this cursor position as `a`                     |\n| <code>\\`a</code>    | Jump to the cursor position `a`                      |\n| `'a`                | Jump to the beginning of the line with position `a`  |\n| <code>d'a</code>    | Delete from current line to line of mark `a`         |\n| <code>d\\`a</code>   | Delete from current position to position of mark `a` |\n| <code>c'a</code>    | Change text from current line to line of `a`         |\n| <code>y\\`a</code>   | Yank text from current position to position of `a`   |\n| `:marks`            | List all current marks                               |\n| `:delm a`           | Delete mark `a`                                      |\n| `:delm a-d`         | Delete marks `a`, `b`, `c`, `d`                      |\n| `:delm abc`         | Delete marks `a`, `b`, `c`                           |\n\n{.shortcuts}\n\n### Calculator\n\n| Shortcut         | Description      |\n| ---------------- | :--------------- |\n| `<C-r>` `=` 7\\*7 | Shows the result |\n| `<C-r>` `=` 10/2 | Shows the result |\n\n{.shortcuts}\n\nDo this in INSERT mode\n\n### Shell\n\n| -            | -                              |\n| ------------ | :----------------------------- |\n| `:!<shell>`  | Interpret Shell Command        |\n| `:r!<shell>` | Read in output of shell        |\n| `:r!date`    | Insert date                    |\n| `:!!date`    | Replace current line with date |\n\n### Command line\n\n| Shortcut     | Description                               |\n| ------------ | :---------------------------------------- |\n| `<C-r><C-w>` | Insert current word into the command line |\n| `<C-r>\"`     | Paste from \" register                     |\n| `<C-x><C-f>` | Auto-completion of path in insert mode    |\n\n{.shortcuts}\n\n### Tricks\n\nRemove duplicate lines\n\n```shell script\n:sort | %!uniq -u\n```\n\nTo number the lines in the file\n\n```shell script\n:%!cat -n\n```\n\nCopy whole doc to clipboard\n\n```shell script\n:%w !pbcopy            # Mac OS X\n:%w !xclip -i -sel c   # GNU/Linux\n:%w !xsel -i -b        # GNU/Linux\n```\n\n## Also see\n\n- [Devhints](https://devhints.io/vim) _(devhints.io)_\n- [Vim cheatsheet](https://vim.rtorr.com/) _(vim.rotrr.com)_\n- [Vim documentation](http://vimdoc.sourceforge.net/htmldoc/) _(vimdoc.sourceforge.net)_\n- [Interactive Vim tutorial](http://openvim.com/) _(openvim.com)_\n"
  },
  {
    "path": "source/_posts/vivaldi.md",
    "content": "---\ntitle: Vivaldi Browser\ndate: 2022-11-23 16:23:31.694597\nbackground: bg-[#d54840]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 69 default keyboard shortcuts found in the Vivaldi browser\n---\n\n## Keyboard Shortcuts\n\n### Window\n\n| Shortcut                | Action                  |\n| ----------------------- | ----------------------- |\n| `Ctrl` `N`              | New window              |\n| `Ctrl` `Shift` `N`      | New private window      |\n| `Ctrl` `Shift` `W`      | Close window            |\n| `Ctrl` `E`              | Quick commands          |\n| `Ctrl` `,`              | Settings                |\n| `Ctrl` `Alt` `E`        | Extensions              |\n| `Ctrl` `H`              | History                 |\n| `Ctrl` `Alt` `B`        | Bookmarks               |\n| `Ctrl` `Shift` `Delete` | Delete browsing data    |\n| `Ctrl` `Q`              | Quit Vivaldi            |\n| `Ctrl` `Shift` `?`      | Help                    |\n| `Ctrl` `F1`             | Keyboard cheat sheet    |\n| `Ctrl` `P`              | Print                   |\n| `Ctrl` `U`              | View page source        |\n| `Ctrl` `Shift` `I`      | Developer tools         |\n| `Ctrl` `Shift` `J`      | Developer tools console |\n| `Ctrl` `Shift` `V`      | Paste and go            |\n| `Ctrl` `M`              | Minimize                |\n\n{.shortcuts}\n\n### View\n\n| Shortcut            | Action              |\n| ------------------- | ------------------- |\n| `Ctrl` `Shift` `F`  | Fullscreen mode     |\n| `Ctrl` `Shift` `B`  | Bookmarks bar       |\n| `Ctrl` `/`          | Status bar          |\n| `Ctrl` `F10`        | Toggle UI           |\n| `Ctrl` `+`          | Page zoom in        |\n| `Ctrl` `-`          | Page zoom out       |\n| `Ctrl` `0`          | Page zoom reset     |\n| `Ctrl` `Alt` `P`    | Panel               |\n| `F7`                | Focus panel         |\n| `Ctrl` `Alt` `Down` | Open next panel     |\n| `Ctrl` `Alt` `Up`   | Open previous panel |\n| `Ctrl` `Alt` `B`    | Bookmarks panel     |\n| `Ctrl` `Alt` `L`    | Downloads panel     |\n| `Ctrl` `Alt` `N`    | Notes panel         |\n| `Ctrl` `Alt` `Y`    | History panel       |\n\n{.shortcuts}\n\n### Tab\n\n| Shortcut              | Action                   |\n| --------------------- | ------------------------ |\n| `Ctrl` `T`            | New tab                  |\n| `Ctrl` `W`            | Close tab                |\n| `Ctrl` `Shift` `Tab`  | Tab cycler back          |\n| `Ctrl` `Tab`          | Tab cycler forward       |\n| `Ctrl` `Shift` `[`    | Previous tab (by order)  |\n| `Ctrl` `Shift` `]`    | Next tab (by order)      |\n| `Ctrl` `Shift` `Up`   | Move active tab backward |\n| `Ctrl` `Shift` `Down` | Move active tab forward  |\n| `Ctrl` `1-8`          | Switch to tab 1-8        |\n| `Ctrl` `9`            | Switch to the last tab   |\n| `Ctrl` `Shift` `T`    | Reopen last tab          |\n| `Ctrl` `F9`           | Tile vertically          |\n| `Ctrl` `F8`           | Tile horizontally        |\n| `Ctrl` `F7`           | Tile to grid             |\n| `Ctrl` `F6`           | Untile tabs              |\n| `Ctrl` `Alt` `I`      | Load images              |\n\n{.shortcuts}\n\n### Page\n\n| Shortcut           | Action                     |\n| ------------------ | -------------------------- |\n| `Ctrl` `D`         | Create bookmark            |\n| `Ctrl` `L`         | Focus address field        |\n| `Ctrl` `R`         | Reload page                |\n| `Ctrl` `Shift` `R` | Force reload page          |\n| `F9`               | Focus page                 |\n| `Ctrl` `K`         | Focus search field         |\n| `Ctrl` `F`         | Find in page               |\n| `Ctrl` `G`         | Find next in page          |\n| `Ctrl` `Shift` `G` | Find previous in page      |\n| `Ctrl` `Left`      | History back               |\n| `Ctrl` `Right`     | History forward            |\n| `Esc`              | Stop loading               |\n| `Ctrl` `O`         | Open file                  |\n| `Ctrl` `S`         | Save page as               |\n| `Ctrl` `Shift` `H` | Home                       |\n| `Ctrl` `Alt` `C`   | Copy selected text to note |\n| `Shift` `Left`     | Spatial navigation left    |\n| `Shift` `Up`       | Spatial navigation up      |\n| `Shift` `Right`    | Spatial navigation right   |\n| `Shift` `Down`     | Spatial navigation down    |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Vivaldi](https://help.vivaldi.com/article/keyboard-shortcuts/) _(help.vivaldi.com)_\n"
  },
  {
    "path": "source/_posts/vlc.md",
    "content": "---\ntitle: VLC Player\ndate: 2022-11-23 16:23:31.696412\nbackground: bg-[#e7792e]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 82 keyboard shortcuts found in VLC Player\n---\n\n## Keyboard Shortcuts\n\n### General I\n\n| Shortcut             | Action                    |\n| -------------------- | ------------------------- |\n| `F`                  | Fullscreen                |\n| `Esc`                | Leave fullscreen          |\n| `Space`              | Play/Pause                |\n| `]`                  | Pause only                |\n| `[`                  | Play only                 |\n| `+`                  | Faster                    |\n| `-`                  | Slower                    |\n| `=`                  | Normal rate               |\n| `N`                  | Next                      |\n| `P`                  | Previous                  |\n| `S`                  | Stop                      |\n| `T`                  | Position                  |\n| `Shift` `Left`       | Very short backwards jump |\n| `Shift` `Right`      | Very short forwards jump  |\n| `Alt` `Left`         | Short backwards jump      |\n| `Alt` `Right`        | Short forwards jump       |\n| `Ctrl` `Left`        | Medium backwards jump     |\n| `Ctrl` `Right`       | Medium forwards jump      |\n| `Ctrl` `Alt` `Left`  | Long backwards jump       |\n| `Ctrl` `Alt` `Right` | Long forwards jump        |\n| `E`                  | Next frame                |\n| `Enter`              | Activate                  |\n| `Up`                 | Navigate up               |\n| `Down`               | Navigate down             |\n| `Left`               | Navigate left             |\n| `Right`              | Navigate right            |\n| `Shift` `M`          | Go to the DVD menu        |\n| `Shift` `O`          | Select previous DVD title |\n\n{.shortcuts}\n\n### General II\n\n| Shortcut          | Action                         |\n| ----------------- | ------------------------------ |\n| `Shift` `B`       | Select next DVD title          |\n| `Shift` `P`       | Select previous DVD chapter    |\n| `Shift` `N`       | Select next DVD chapter        |\n| `Ctrl` `Q`        | Quit                           |\n| `Ctrl` `Up`       | Volume up                      |\n| `Ctrl` `Down`     | Volume down                    |\n| `M`               | Mute                           |\n| `H`               | Subtitle delay up              |\n| `G`               | Subtitle delay down            |\n| `K`               | Audio delay up                 |\n| `J`               | Audio delay down               |\n| `B`               | Cycle audio track              |\n| `Shift` `A`       | Cycle through audio devices    |\n| `V`               | Cycle subtitle track           |\n| `A`               | Cycle source aspect ratio      |\n| `C`               | Cycle video crop               |\n| `O`               | Toggle autoscaling             |\n| `Alt` `O`         | Increase scale factor          |\n| `Shift` `Alt` `O` | Decrease scale factor          |\n| `D`               | Cycle deinterlace modes        |\n| `I`               | Show interface                 |\n| `Shift` `I`       | Hide interface                 |\n| `Shift` `S`       | Take video snapshot            |\n| `Shift` `G`       | Go back in browsing history    |\n| `Shift` `H`       | Go forward in browsing history |\n| `Shift` `R`       | Record                         |\n| `Shift` `D`       | Dump                           |\n| `Z`               | Zoom                           |\n\n{.shortcuts}\n\n### General III\n\n| Shortcut              | Action                           |\n| --------------------- | -------------------------------- |\n| `Shift` `Z`           | Un-Zoom                          |\n| `W`                   | Toggle wallpaper mode            |\n| `Alt` `Shift` `M`     | Display OSD menu on top          |\n| `Alt` `Ctrl` `M`      | Do not display OSD menu          |\n| `Alt` `Shift` `Right` | Highlight widget on the right    |\n| `Alt` `Shift` `Left`  | Highlight widget on the left     |\n| `Alt` `Shift` `Up`    | Highlight widget on top          |\n| `Alt` `Shift` `Down`  | Highlight widget on bottom       |\n| `Alt` `Shift` `Enter` | Select current widget            |\n| `Alt` `R`             | Crop one pixel from the top      |\n| `Alt` `Shift` `R`     | Uncrop one pixel from the top    |\n| `Alt` `D`             | Crop one pixel from the left     |\n| `Alt` `Shift` `D`     | Uncrop one pixel from the left   |\n| `Alt` `C`             | Crop one pixel from the bottom   |\n| `Alt` `Shift` `C`     | Uncrop one pixel from the bottom |\n| `Alt` `F`             | Crop one pixel from the right    |\n| `Alt` `Shift` `F`     | Uncrop one pixel from the right  |\n| `R`                   | Random                           |\n| `L`                   | Normal/Repeat/Loop               |\n| `Ctrl` `1`            | 1:4 Quarter                      |\n| `Ctrl` `2`            | 1:2 Half                         |\n| `Ctrl` `3`            | 1:1 Original                     |\n| `Ctrl` `4`            | 2:1 Double                       |\n| `3`                   | Very short jump length (integer) |\n| `Ctrl` `F1-F10`       | Set playlist bookmark 1-10       |\n| `F1-F10`              | Play playlist bookmark 1-10      |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for VLC](https://wiki.videolan.org/hotkeys_table/) _(wiki.videolan.org)_\n"
  },
  {
    "path": "source/_posts/vscode.md",
    "content": "---\ntitle: VSCode\ndate: 2021-12-16 13:41:00\nbackground: bg-[#5ba3e6]\ntags:\n  - text\n  - editor\n  - shortcut\ncategories:\n  - Toolkit\nintro: |\n  This VSCode (Visual Studio Code) quick reference cheat sheet shows its keyboard shortcuts and commands.\n---\n\n## Keyboard shortcuts for Windows\n\n### General\n\n| Shortcut              | Action                    |\n| --------------------- | ------------------------- |\n| `Ctrl` `Shift` `P`    | Show Command Palette      |\n| `Ctrl` `P`            | Quick Open, Go to File... |\n| `Ctrl` `Shift` `N`    | New window/instance       |\n| `Ctrl` `Shift` `W`    | Close window/instance     |\n| `Ctrl` `,`            | User Settings             |\n| `Ctrl` `K` `Ctrl` `S` | Keyboard Shortcuts        |\n\n{.shortcuts}\n\n### Basic Editing {.row-span-2}\n\n| Shortcut                | Action                             |\n| ----------------------- | ---------------------------------- |\n| `Ctrl` `X`              | Cut line (empty selection)         |\n| `Ctrl` `C`              | Copy line (empty selection)        |\n| `Alt` `Up/Down`         | Move line up/down                  |\n| `Shift` `Alt` `Up/Down` | Copy line up/down                  |\n| `Ctrl` `Shift` `K`      | Delete line                        |\n| `Ctrl` `Enter`          | Insert line below                  |\n| `Ctrl` `Shift` `Enter`  | Insert line above                  |\n| `Ctrl` `Shift` `\\`      | Jump to matching bracket           |\n| `Ctrl` `]/[`            | Indent/outdent line                |\n| `Home/End`              | Go to beginning/end of line        |\n| `Ctrl` `Home`           | Go to beginning of file            |\n| `Ctrl` `End`            | Go to end of file                  |\n| `Ctrl` `Up/Down`        | Scroll line up/down                |\n| `Alt` `PgUp/PgDown`     | Scroll page up/down                |\n| `Ctrl` `Shift` `[`      | Fold (collapse) region             |\n| `Ctrl` `Shift` `]`      | Unfold (uncollapse) region         |\n| `Ctrl` `K` `Ctrl` `[`   | Fold (collapse) all subregions     |\n| `Ctrl` `K` `Ctrl` `]`   | Unfold (uncollapse) all subregions |\n| `Ctrl` `K` `Ctrl` `0`   | Fold (collapse) all regions        |\n| `Ctrl` `K` `Ctrl` `J`   | Unfold (uncollapse) all regions    |\n| `Ctrl` `K` `Ctrl` `C`   | Add line comment                   |\n| `Ctrl` `K` `Ctrl` `U`   | Remove line comment                |\n| `Ctrl` `/`              | Toggle line comment                |\n| `Shift` `Alt` `A`       | Toggle block comment               |\n| `Alt` `Z`               | Toggle word wrap                   |\n\n{.shortcuts}\n\n### Navigation\n\n| Shortcut             | Action                          |\n| -------------------- | ------------------------------- |\n| `Ctrl` `T`           | Show all Symbols                |\n| `Ctrl` `G`           | Go to Line...                   |\n| `Ctrl` `P`           | Go to File...                   |\n| `Ctrl` `Shift` `O`   | Go to Symbol...                 |\n| `Ctrl` `Shift` `M`   | Show Problems panel             |\n| `F8`                 | Go to next error or warning     |\n| `Shift` `F8`         | Go to previous error or warning |\n| `Ctrl` `Shift` `Tab` | Navigate editor group history   |\n| `Alt` `Left/Right`   | Go back/forward                 |\n| `Ctrl` `M`           | Toggle Tab moves focus          |\n\n{.shortcuts}\n\n### Search and replace\n\n| Shortcut              | Action                                 |\n| --------------------- | -------------------------------------- |\n| `Ctrl` `F`            | Find                                   |\n| `Ctrl` `H`            | Replace                                |\n| `F3`                  | Find next                              |\n| `Shift` `F3`          | Find previous                          |\n| `Alt` `Enter`         | Select all occurrences of Find match   |\n| `Ctrl` `D`            | Add selection to next Find match       |\n| `Ctrl` `K` `Ctrl` `D` | Move last selection to next Find match |\n| `Alt` `C/R/W`         | Toggle case-sensitive/regex/whole word |\n\n{.shortcuts}\n\n### Multi-cursor and selection\n\n| Shortcut                           | Action                                      |\n| ---------------------------------- | ------------------------------------------- |\n| `Alt` `Click`                      | Insert cursor                               |\n| `Ctrl` `Alt` `Up/Down`             | Insert cursor above/below                   |\n| `Ctrl` `U`                         | Undo last cursor operation                  |\n| `Shift` `Alt` `I`                  | Insert cursor at end of each line selected  |\n| `Ctrl` `I`                         | Select current line                         |\n| `Ctrl` `Shift` `L`                 | Select all occurrences of current selection |\n| `Ctrl` `F2`                        | Select all occurrences of current word      |\n| `Shift` `Alt` `Right`              | Expand selection                            |\n| `Shift` `Alt` `Left`               | Shrink selection                            |\n| `Shift` `Alt` `(drag mouse)`       | Column (box) selection                      |\n| `Ctrl` `Shift` `Alt` `(arrow key)` | Column (box) selection                      |\n| `Ctrl` `Shift` `Alt` `PgUp/PgDown` | Column (box) selection page up/down         |\n\n{.shortcuts}\n\n### Rich languages editing\n\n| Shortcut               | Action                      |\n| ---------------------- | --------------------------- |\n| `Ctrl` `Space`         | Trigger suggestion          |\n| `Ctrl` `Shift` `Space` | Trigger parameter hints     |\n| `Shift` `Alt` `F`      | Format document             |\n| `Ctrl` `K` `Ctrl` `F`  | Format selection            |\n| `F12`                  | Go to Definition            |\n| `Alt` `F12`            | Peek Definition             |\n| `Ctrl` `K` `F12`       | Open Definition to the side |\n| `Ctrl` `.`             | Quick Fix                   |\n| `Shift` `F12`          | Show References             |\n| `F2`                   | Rename Symbol               |\n| `Ctrl` `K` `Ctrl` `X`  | Trim trailing whitespace    |\n| `Ctrl` `K` `M`         | Change file language        |\n\n{.shortcuts}\n\n### Editor management\n\n| Shortcut                       | Action                                   |\n| ------------------------------ | ---------------------------------------- |\n| `Ctrl` `F4`                    | Close editor                             |\n| `Ctrl` `W`                     | Close editor                             |\n| `Ctrl` `K` `F`                 | Close folder                             |\n| `Ctrl` `\\`                     | Split editor                             |\n| `Ctrl` `1/2/3`                 | Focus into 1st, 2nd, or 3rd editor group |\n| `Ctrl` `K` `Ctrl` `Left/Right` | Focus into previous/next editor group    |\n| `Ctrl` `Shift` `PgUp/PgDown`   | Move editor left/right                   |\n| `Ctrl` `K` `Left/Right`        | Move active editor group                 |\n\n{.shortcuts}\n\n### File management\n\n| Shortcut              | Action                                  |\n| --------------------- | --------------------------------------- |\n| `Ctrl` `N`            | New File                                |\n| `Ctrl` `O`            | Open File...                            |\n| `Ctrl` `S`            | Save                                    |\n| `Ctrl` `Shift` `S`    | Save As...                              |\n| `Ctrl` `K` `S`        | Save All                                |\n| `Ctrl` `F4`           | Close                                   |\n| `Ctrl` `K` `Ctrl` `W` | Close All                               |\n| `Ctrl` `Shift` `T`    | Reopen closed editor                    |\n| `Ctrl` `K` `Enter`    | Keep preview mode editor open           |\n| `Ctrl` `Tab`          | Open next                               |\n| `Ctrl` `Shift` `Tab`  | Open previous                           |\n| `Ctrl` `K` `P`        | Copy path of active file                |\n| `Ctrl` `K` `R`        | Reveal active file in Explorer          |\n| `Ctrl` `K` `O`        | Show active file in new window/instance |\n\n{.shortcuts}\n\n### Display\n\n| Shortcut           | Action                                     |\n| ------------------ | ------------------------------------------ |\n| `F11`              | Toggle full screen                         |\n| `Shift` `Alt` `0`  | Toggle editor layout (horizontal/vertical) |\n| `Ctrl` `=/-`       | Zoom in/out                                |\n| `Ctrl` `B`         | Toggle Sidebar visibility                  |\n| `Ctrl` `Shift` `E` | Show Explorer/Toggle focus                 |\n| `Ctrl` `Shift` `F` | Show Search                                |\n| `Ctrl` `Shift` `G` | Show Source Control                        |\n| `Ctrl` `Shift` `D` | Show Debug                                 |\n| `Ctrl` `Shift` `X` | Show Extensions                            |\n| `Ctrl` `Shift` `H` | Replace in files                           |\n| `Ctrl` `Shift` `J` | Toggle Search details                      |\n| `Ctrl` `Shift` `U` | Show Output panel                          |\n| `Ctrl` `Shift` `V` | Open Markdown preview                      |\n| `Ctrl` `K` `V`     | Open Markdown preview to the side          |\n| `Ctrl` `K` `Z`     | Zen Mode (Esc Esc to exit)                 |\n\n{.shortcuts}\n\n### Debug\n\n| Shortcut              | Action            |\n| --------------------- | ----------------- |\n| `F9`                  | Toggle breakpoint |\n| `F5`                  | Start/Continue    |\n| `Shift` `F5`          | Stop              |\n| `F11`                 | Step into         |\n| `Shift` `F11`         | Step out          |\n| `F10`                 | Step over         |\n| `Ctrl` `K` `Ctrl` `I` | Show hover        |\n\n{.shortcuts}\n\n### Integrated terminal\n\n| Shortcut                       | Action                     |\n| ------------------------------ | -------------------------- |\n| `Ctrl` <code>\\`</code>         | Show integrated terminal   |\n| `Ctrl` `Shift` <code>\\`</code> | Create new terminal        |\n| `Ctrl` `C`                     | Copy selection             |\n| `Ctrl` `V`                     | Paste into active terminal |\n| `Ctrl` `Up/Down`               | Scroll up/down             |\n| `Shift` `PgUp/PgDown`          | Scroll page up/down        |\n| `Ctrl` `Home/End`              | Scroll to top/bottom       |\n\n{.shortcuts}\n\n## Keyboard shortcuts for MacOS\n\n### General\n\n| Shortcut     | Action                  |\n| ------------ | ----------------------- |\n| `⇧⌘P` / `F1` | Show Command Palette    |\n| `⌘P`         | Quick Open, Go to File… |\n| `⇧⌘N`        | New window/instance     |\n| `⌘W`         | Close window/instance   |\n| `⌘,`         | User Settings           |\n| `⌘K` `⌘S`    | Keyboard Shortcuts      |\n\n{.shortcuts}\n\n### Basic editing {.row-span-2}\n\n| Shortcut             | Action                      |\n| -------------------- | --------------------------- |\n| `⌘X`                 | Cut line (empty selection)  |\n| `⌘C`                 | Copy line (empty selection) |\n| `⌥↓` / `⌥↑`          | Move line down/up           |\n| `⇧⌥↓` / `⇧⌥↑`        | Copy line down/up           |\n| `⇧⌘K`                | Delete line                 |\n| `⌘Enter` / `⇧⌘Enter` | Insert line below/above     |\n| `⇧⌘\\`                | Jump to matching bracket    |\n| `⌘]` / `⌘[`          | Indent/outdent line         |\n| `Home` / `End`       | Go to beginning/end of line |\n| `⌘↑` / `⌘↓`          | Go to beginning/end of file |\n| `⌃PgUp` / `⌃PgDn`    | Scroll line up/down         |\n| `⌘PgUp` `/⌘PgDn`     | Scroll page up/down         |\n| `⌥⌘[` / `⌥⌘]`        | Fold/unfold region          |\n| `⌘K ⌘[` / `⌘K ⌘]`    | Fold/unfold all subregions  |\n| `⌘K ⌘0` / `⌘K ⌘J`    | Fold/unfold all regions     |\n| `⌘K ⌘C`              | Add line comment            |\n| `⌘K ⌘U`              | Remove line comment         |\n| `⌘/`                 | Toggle line comment         |\n| `⇧⌥A`                | Toggle block comment        |\n| `⌥Z`                 | Toggle word wrap            |\n\n{.shortcuts}\n\n### Multi-cursor and selection {.row-span-2}\n\n| Shortcut          | Action                                      |\n| ----------------- | ------------------------------------------- |\n| `⌥ +`             | click Insert cursor                         |\n| `⌥⌘↑`             | Insert cursor above                         |\n| `⌥⌘↓`             | Insert cursor below                         |\n| `⌘U`              | Undo last cursor operation                  |\n| `⇧⌥I`             | Insert cursor at end of each line selected  |\n| `⌘L`              | Select current line                         |\n| `⇧⌘L`             | Select all occurrences of current selection |\n| `⌘F2`             | Select all occurrences of current word      |\n| `⌃⇧⌘→` / ←        | Expand / shrink selection                   |\n| `⇧⌥` + drag mouse | Column (box) selection                      |\n| `⇧⌥⌘↑` / ↓        | Column (box) selection up/down              |\n| `⇧⌥⌘←` / →        | Column (box) selection left/right           |\n| `⇧⌥⌘PgUp`         | Column (box) selection page up              |\n| `⇧⌥⌘PgDn`         | Column (box) selection page down            |\n\n{.shortcuts}\n\n### Search and replace\n\n| Shortcut     | Action                                 |\n| ------------ | -------------------------------------- |\n| `⌘F`         | Find                                   |\n| `⌥⌘F`        | Replace                                |\n| `⌘G` / `⇧⌘G` | Find next/previous                     |\n| `⌥Enter`     | Select all occurrences of Find match   |\n| `⌘D`         | Add selection to next Find match       |\n| `⌘K ⌘D`      | Move last selection to next Find match |\n\n{.shortcuts}\n\n### Rich languages editing\n\n| Shortcut     | Action                      |\n| ------------ | --------------------------- |\n| `⌃Space, ⌘I` | Trigger suggestion          |\n| `⇧⌘Space`    | Trigger parameter hints     |\n| `⇧⌥F`        | Format document             |\n| `⌘K ⌘F`      | Format selection            |\n| `F12`        | Go to Definition            |\n| `⌥F12`       | Peek Definition             |\n| `⌘K F12`     | Open Definition to the side |\n| `⌘.`         | Quick Fix                   |\n| `⇧F12`       | Show References             |\n| `F2`         | Rename Symbol               |\n| `⌘K ⌘X`      | Trim trailing whitespace    |\n| `⌘K M`       | Change file language        |\n\n{.shortcuts}\n\n### Navigation\n\n| Shortcut     | Action                               |\n| ------------ | ------------------------------------ |\n| `⌘T`         | Show all Symbols                     |\n| `⌃G`         | Go to Line...                        |\n| `⌘P`         | Go to File...                        |\n| `⇧⌘O`        | Go to Symbol...                      |\n| `⇧⌘M`        | Show Problems panel                  |\n| `F8` / `⇧F8` | Go to next/previous error or warning |\n| `⌃⇧Tab`      | Navigate editor group history        |\n| `⌃-` / `⌃⇧-` | Go back/forward                      |\n| `⌃⇧M`        | Toggle Tab moves focus               |\n\n{.shortcuts}\n\n### Editor management\n\n| Shortcut            | Action                                |\n| ------------------- | ------------------------------------- |\n| `⌘W`                | Close editor                          |\n| `⌘K` `F`            | Close folder                          |\n| `⌘\\`                | Split editor                          |\n| `⌘1` / `⌘2` / `⌘3`  | Focus into 1st, 2nd, 3rd editor group |\n| `⌘K ⌘←` / `⌘K ⌘→`   | Focus into previous/next editor group |\n| `⌘K ⇧⌘←` / `⌘K ⇧⌘→` | Move editor left/right                |\n| `⌘K ←` / `⌘K →`     | Move active editor group              |\n\n{.shortcuts}\n\n### File management {.row-span-2}\n\n| Shortcut         | Action                                  |\n| ---------------- | --------------------------------------- |\n| `⌘N`             | New File                                |\n| `⌘O`             | Open File...                            |\n| `⌘S`             | Save                                    |\n| `⇧⌘S`            | Save As...                              |\n| `⌥⌘S`            | Save All                                |\n| `⌘W`             | Close                                   |\n| `⌘K ⌘W`          | Close All                               |\n| `⇧⌘T`            | Reopen closed editor                    |\n| `⌘K`             | Enter Keep preview mode editor open     |\n| `⌃Tab` / `⌃⇧Tab` | Open next / previous                    |\n| `⌘K P`           | Copy path of active file                |\n| `⌘K R`           | Reveal active file in Finder            |\n| `⌘K O`           | Show active file in new window/instance |\n\n{.shortcuts}\n\n### Display {.row-span-2}\n\n| Shortcut     | Action                                     |\n| ------------ | ------------------------------------------ |\n| `⌃⌘F`        | Toggle full screen                         |\n| `⌥⌘0`        | Toggle editor layout (horizontal/vertical) |\n| `⌘=` / `⇧⌘-` | Zoom in/out                                |\n| `⌘B`         | Toggle Sidebar visibility                  |\n| `⇧⌘E`        | Show Explorer / Toggle focus               |\n| `⇧⌘F`        | Show Search                                |\n| `⌃⇧G`        | Show Source Control                        |\n| `⇧⌘D`        | Show Debug                                 |\n| `⇧⌘X`        | Show Extensions                            |\n| `⇧⌘H`        | Replace in files                           |\n| `⇧⌘J`        | Toggle Search details                      |\n| `⇧⌘U`        | Show Output panel                          |\n| `⇧⌘V`        | Open Markdown preview                      |\n| `⌘K V`       | Open Markdown preview to the side          |\n| `⌘K Z`       | Zen Mode (Esc Esc to exit)                 |\n\n{.shortcuts}\n\n### Debug\n\n| Shortcut       | Action            |\n| -------------- | ----------------- |\n| `F9`           | Toggle breakpoint |\n| `F5`           | Start/Continue    |\n| `F11` / `⇧F11` | Step into/ out    |\n| `F10`          | Step over         |\n| `⇧F5`          | Stop              |\n| `⌘K ⌘I`        | Show hover        |\n\n{.shortcuts}\n\n### Integrated terminal\n\n| Shortcut          | Action                   |\n| ----------------- | ------------------------ |\n| <code>⌃\\`</code>  | Show integrated terminal |\n| <code>⌃⇧\\`</code> | Create new terminal      |\n| `⌘C`              | Copy selection           |\n| `⌘↑` / `↓`        | Scroll up/down           |\n| `PgUp` / `PgDn`   | Scroll page up/down      |\n| `⌘Home` / `End`   | Scroll to top/bottom     |\n\n{.shortcuts}\n\n## Also see\n\n- [VS Code Keyboard shortcuts for Windows](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf)\n  _(code.visualstudio.com)_\n- [VS Code Keyboard shortcuts for macOS](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf)\n  _(code.visualstudio.com)_\n"
  },
  {
    "path": "source/_posts/vue.md",
    "content": "---\ntitle: Vue\ndate: 2025-06-13 14:45:00\nbackground: bg-[#43CF96]\ntags:\n  - vue\n  - web\ncategories:\n  - Programming\nintro: |\n  A Vue 3 cheat sheet with the most important concepts, reactivity, component system, routing, and more. Updated for the latest version and perfect for both beginners and advanced users.\nplugins:\n  - copyCode\n  - runCode\n---\n\n## 📘 Vue.js 3 Cheatsheet – Beginner to Advanced\n\n> The ultimate reference for mastering Vue 3.\n\n\n## ⚙️ 1. Setup\n\n### CDN (Quick Start)\n\n```html\n<script src=\"https://unpkg.com/vue@3\"></script>\n<div id=\"app\">{{ message }}</div>\n<script>\n  Vue.createApp({\n    data() {\n      return { message: \"Hello Vue!\" };\n    }\n  }).mount(\"#app\");\n</script>\n```\n### Vite + Vue\n\n```bash\nnpm create vite@latest my-vue-app --template vue\ncd my-vue-app\nnpm install\nnpm run dev\n```\n\n\n## 🧠 2. App Structure\n\n```\nsrc/\n├─ components/\n├─ views/\n├─ App.vue\n├─ main.js\n```\n\n\n## 📦 3. Data, Methods, Template\n\n```js\ndata() {\n  return {\n    count: 0,\n    message: \"Welcome!\"\n  };\n},\nmethods: {\n  increment() {\n    this.count++;\n  }\n}\n```\n\n```html\n<h1>{{ message }}</h1>\n<button @click=\"increment\">+</button>\n```\n\n\n## 🧰 4. Directives\n\n| Directive       | Purpose                 |\n| --------------- | ----------------------- |\n| `v-bind` / `:`  | Bind attributes         |\n| `v-model`       | Two-way binding         |\n| `v-if / v-else` | Conditional rendering   |\n| `v-show`        | Toggle visibility       |\n| `v-for`         | List rendering          |\n| `v-on` / `@`    | Event handling          |\n| `v-slot`        | Named/Scoped slot usage |\n\n### Example\n\n```html\n<input v-model=\"name\" />\n<p v-if=\"name\">Hi, {{ name }}!</p>\n<ul>\n  <li v-for=\"item in list\" :key=\"item.id\">{{ item }}</li>\n</ul>\n```\n\n\n## 🪝 5. Lifecycle Hooks\n\n```js\ncreated() {},\nmounted() {},\nupdated() {},\nunmounted() {}\n```\n\n\n## 🎯 6. Events\n\n```html\n<button @click=\"sayHi\">Click</button>\n<input @keyup.enter=\"submit\" />\n```\n\n\n## 🔁 7. Computed & Watch\n\n```js\ncomputed: {\n  reversed() {\n    return this.message.split('').reverse().join('');\n  }\n},\nwatch: {\n  count(newVal, oldVal) {\n    console.log(`Count changed from ${oldVal} to ${newVal}`);\n  }\n}\n```\n\n\n## 🧱 8. Components\n\n### Register + Use\n\n```js\napp.component(\"Greeting\", {\n  props: [\"name\"],\n  template: `<h1>Hello, {{ name }}!</h1>`\n});\n```\n\n```html\n<Greeting name=\"Sumangal\" />\n```\n\n\n## 🔗 9. Props & Emits\n\n### Props\n\n```js\nprops: {\n  title: String,\n  age: {\n    type: Number,\n    default: 18\n  }\n}\n```\n\n### Emit\n\n```js\nthis.$emit(\"custom-event\", payload);\n```\n\n\n## 🔄 10. v-model with Components\n\n```js\nprops: ['modelValue'],\nemits: ['update:modelValue']\n```\n\n```html\n<input\n  :value=\"modelValue\"\n  @input=\"$emit('update:modelValue', $event.target.value)\"\n/>\n```\n\n\n## ⚒ 11. Composition API\n\n```js\nimport { ref, computed } from \"vue\";\n\nexport default {\n  setup() {\n    const count = ref(0);\n    const double = computed(() => count.value * 2);\n\n    const increment = () => count.value++;\n\n    return { count, double, increment };\n  }\n};\n```\n\n\n## 🌐 12. Vue Router\n\n```bash\nnpm install vue-router\n```\n\n### router.js\n\n```js\nimport { createRouter, createWebHistory } from \"vue-router\";\nimport Home from \"./views/Home.vue\";\nimport About from \"./views/About.vue\";\n\nconst routes = [\n  { path: \"/\", component: Home },\n  { path: \"/about\", component: About }\n];\n\nexport default createRouter({\n  history: createWebHistory(),\n  routes\n});\n```\n\n### main.js\n\n```js\nimport { createApp } from \"vue\";\nimport App from \"./App.vue\";\nimport router from \"./router\";\n\nconst app = createApp(App);\napp.use(router).mount(\"#app\");\n```\n\n\n## 📦 13. Pinia (Vuex Alternative)\n\n```bash\nnpm install pinia\n```\n\n### store/counter.js\n\n```js\nimport { defineStore } from \"pinia\";\n\nexport const useCounterStore = defineStore(\"counter\", {\n  state: () => ({ count: 0 }),\n  actions: {\n    increment() {\n      this.count++;\n    }\n  }\n});\n```\n\n```js\nconst counter = useCounterStore();\ncounter.increment();\n```\n\n\n## 🎨 14. Slots\n\n```html\n<!-- Default -->\n<slot></slot>\n\n<!-- Named -->\n<slot name=\"header\"></slot>\n\n<!-- Scoped -->\n<slot :user=\"user\"></slot>\n```\n\n\n## 🧪 15. Testing\n\n### Vitest + Vue Test Utils\n\n```bash\nnpm install vitest @vue/test-utils\n```\n\n```js\nimport { mount } from \"@vue/test-utils\";\nimport MyComponent from \"@/components/MyComponent.vue\";\n\ntest(\"renders\", () => {\n  const wrapper = mount(MyComponent);\n  expect(wrapper.text()).toContain(\"Hello\");\n});\n```\n\n\n## 🧼 16. Best Practices\n\n* Use `ref()` for primitives, `reactive()` for objects\n* Use `<script setup>` syntax in SFCs\n* Break UI into small, reusable components\n* Always define `key` in `v-for`\n* Use slots for flexible composition\n\n\n## 🛠 17. Dev Tools\n\n* 🧩 [Vue DevTools](https://devtools.vuejs.org/)\n* 🧠 [Volar](https://github.com/vuejs/language-tools) for VSCode\n* ⚡ [Vite](https://vitejs.dev) for fast dev environment\n\n\n## 📚 18. Official Resources\n\n* 📘 [Vue Docs](https://vuejs.org)\n* 🧭 [Router Docs](https://router.vuejs.org)\n* 📦 [Pinia Docs](https://pinia.vuejs.org)\n* 🧪 [Composition API FAQ](https://vuejs.org/guide/extras/composition-api-faq.html)\n\n"
  },
  {
    "path": "source/_posts/webflow.md",
    "content": "---\ntitle: Webflow\ndate: 2022-11-23 16:23:31.703217\nbackground: bg-[#4450ee]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 41 keyboard shortcuts found in Webflow\n---\n\n## Keyboard Shortcuts\n\n### General\n\n| Shortcut           | Action                   |\n| ------------------ | ------------------------ |\n| `Shift` `/`        | Show shortcut cheatsheet |\n| `Ctrl` `Shift` `S` | Save as a snapshot       |\n| `Esc`              | Deselect or abort        |\n| `Del`              | Delete element           |\n| `Shift` `P`        | Show publish dialog      |\n| `Shift` `E`        | Show export code dialog  |\n| `Enter`            | Edit element             |\n\n{.shortcuts}\n\n### View\n\n| Shortcut           | Action             |\n| ------------------ | ------------------ |\n| `Ctrl` `Shift` `P` | Preview mode       |\n| `Ctrl` `Shift` `G` | Guide overlay      |\n| `Ctrl` `Shift` `E` | Show element edges |\n| `Ctrl` `Shift` `X` | X-ray mode         |\n\n{.shortcuts}\n\n### Left-hand Toolbar\n\n| Shortcut           | Action                         |\n| ------------------ | ------------------------------ |\n| `A`                | Show add panel                 |\n| `Z`                | Show navigator tab             |\n| `P`                | Show pages panel               |\n| `Shift` `A`        | Show symbols panel             |\n| `Ctrl` `Shift` `A` | Make selected element a symbol |\n| `J`                | Show asset manager             |\n\n{.shortcuts}\n\n### Right-hand Tabs\n\n| Shortcut | Action                 |\n| -------- | ---------------------- |\n| `S`      | Show style tab         |\n| `D`      | Show settings tab      |\n| `G`      | Show style manager tab |\n| `H`      | Show interactions tab  |\n\n{.shortcuts}\n\n### Copy/Paste\n\n| Shortcut       | Action    |\n| -------------- | --------- |\n| `Ctrl` `C`     | Copy      |\n| `Ctrl` `X`     | Cut       |\n| `Ctrl` `V`     | Paste     |\n| `Alt` `(drag)` | Duplicate |\n\n{.shortcuts}\n\n### Undo/Redo\n\n| Shortcut           | Action |\n| ------------------ | ------ |\n| `Ctrl` `Z`         | Undo   |\n| `Ctrl` `Shift` `Z` | Redo   |\n\n{.shortcuts}\n\n### Device View\n\n| Shortcut | Action            |\n| -------- | ----------------- |\n| `1`      | Desktop           |\n| `2`      | Tablet            |\n| `3`      | Phone (landscape) |\n| `4`      | Phone (portrait)  |\n\n{.shortcuts}\n\n### Style Panel\n\n| Shortcut               | Action                                                |\n| ---------------------- | ----------------------------------------------------- |\n| `Shift` `(drag)`       | Margin or padding (on all sides)                      |\n| `Alt` `(drag)`         | Margin or padding (top and bottom, or left and right) |\n| `Ctrl` `Enter`         | Add class to selected element                         |\n| `Ctrl` `Shift` `Enter` | Rename last class on selected element                 |\n\n{.shortcuts}\n\n### Find\n\n| Shortcut   | Action     |\n| ---------- | ---------- |\n| `Ctrl` `K` | Quick find |\n\n{.shortcuts}\n\n### Other\n\n| Shortcut           | Action                                   |\n| ------------------ | ---------------------------------------- |\n| `Alt` `(click)`    | Expand or collapse panel sections        |\n| `Up/Down`          | Select parent or child element           |\n| `Left/Right`       | Select sibling element                   |\n| `Alt` `Left/Right` | Select next or previous element          |\n| `Ctrl` `Shift` `L` | Toggle collaborators on selected element |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Webflow](https://university.webflow.com/article/keyboard-shortcuts-in-the-webflow-designer)\n  _(university.webflow.com)_\n"
  },
  {
    "path": "source/_posts/webstorm.md",
    "content": "---\ntitle: WebStorm\ndate: 2020-12-17 21:51:44\nbackground: bg-gradient-to-r from-indigo-300 to-blue-400 hover:from-indigo-400 hover:to-blue-500\ntags:\n  - jetbrains\n  - web\n  - shortcut\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  This quick reference cheat sheet lists the default keyboard shortcuts for WebStorm running on Windows/Linux or Mac\n---\n\n## Webstorm Windows & Linux Keymap\n\n### Editing {.row-span-5}\n\n| shortcut             | description                                     |\n| -------------------- | ----------------------------------------------- |\n| `Ctrl` `Space`       | Basic code completion                           |\n| `Alt` `Enter`        | Show intention actions, quick fixes             |\n| `Ctrl` `P`           | Parameter info                                  |\n| `Ctrl` `Q`           | Quick documentation lookup                      |\n| `Ctrl` `mouse over`  | Brief Info                                      |\n| `Ctrl` `F1`          | Error or warning at caret                       |\n| `Alt` `Insert`       | Generate code...                                |\n| `Ctrl` `Alt` `T`     | Surround with...                                |\n| `Ctrl` `J`           | Insert Live template                            |\n| `Ctrl` `/`           | Comment/uncomment with line                     |\n| `Ctrl` `Shift` `/`   | Comment/uncomment with block                    |\n| `Ctrl` `W`           | Select successively increasing code blocks      |\n| `Ctrl` `Shift` `W`   | Decrease current selection to previous state    |\n| `Alt+Q`              | Context Info                                    |\n| `Ctrl` `Alt` `L`     | Reformat code                                   |\n| `Ctrl` `Alt` `I`     | Auto-indent line(s)                             |\n| `Tab`                | Indent selected lines                           |\n| `Shift` `Tab`        | Unindent selected lines                         |\n| `Ctrl` `Shift` `V`   | Paste from recent buffers...                    |\n| `Ctrl` `D`           | Duplicate current line or selected block        |\n| `Ctrl` `Y`           | Delete line at caret                            |\n| `Alt` `Shift` `Up`   | Move line up                                    |\n| `Alt` `Shift` `Down` | Move line down                                  |\n| `Ctrl` `Shift` `J`   | Join lines                                      |\n| `Ctrl` `Enter`       | Split lines                                     |\n| `Shift` `Enter`      | Start new line                                  |\n| `Ctrl` `Shift` `U`   | Toggle case for word at caret or selected block |\n| `Ctrl` `Shift` `]`   | Select till code block end                      |\n| `Ctrl` `Shift` `[`   | Select till code block start                    |\n| `Ctrl` `Delete`      | Delete to word end                              |\n| `Ctrl` `Backspace`   | Delete to word start                            |\n| `Ctrl` `+`           | Expand code block                               |\n| `Ctrl` `-`           | Collapse code block                             |\n| `Ctrl` `Shift` `+`   | Expand all                                      |\n| `Ctrl` `Shift` `-`   | Collapse all                                    |\n| `Ctrl` `F4`          | Close active editor tab                         |\n\n{.shortcuts}\n\n### General\n\n| shortcut             | description                    |\n| -------------------- | ------------------------------ |\n| `Double Shift`       | Search everywhere              |\n| `Ctrl` `Shift` `A`   | Find Action                    |\n| `Alt` `0...9`        | Open corresponding tool window |\n| `Ctrl` `Shift` `F12` | Toggle maximizing editor       |\n| `Alt` `Shift` `F`    | Add to Favorites               |\n| `Alt` `Shift` `I`    | Inspect current file           |\n| `Ctrl` <kbd>\\`</kbd> | Quick switch current scheme    |\n| `Ctrl` `Alt` `S`     | Open Settings dialog           |\n| `Ctrl` `Tab`         | Switch between tool and tabs   |\n\n{.shortcuts}\n\n### Navigation {.row-span-4}\n\n| shortcut                       | description                               |\n| ------------------------------ | ----------------------------------------- |\n| `Ctrl` `B` _\\|_ `Ctrl + Click` | Go to declaration                         |\n| `Ctrl` `N`                     | Go to class                               |\n| `Ctrl` `Shift` `N`             | Go to file                                |\n| `Ctrl` `Alt` `Shift` `N`       | Go to symbol                              |\n| `Alt` `Right`                  | Go to next editor tab                     |\n| `Alt` `Left`                   | Go to previous editor tab                 |\n| `F12`                          | Go back to previous tool window           |\n| `Esc`                          | Go to editor                              |\n| `Ctrl` `G`                     | Go to line                                |\n| `Ctrl` `E`                     | Recent files popup                        |\n| `Ctrl` `Alt` `Right`           | Navigate forward                          |\n| `Ctrl` `Alt` `Left`            | Navigate back                             |\n| `Ctrl` `Shift` `Backspace`     | Navigate to last edit location            |\n| `Alt` `F1`                     | Select current file or symbol in any view |\n| `Ctrl` `Alt` `B`               | Go to implementation(s)                   |\n| `Ctrl` `Shift` `I`             | Open quick definition lookup              |\n| `Ctrl` `Shift` `B`             | Go to type declaration                    |\n| `Ctrl` `U`                     | Go to super-method/super-class            |\n| `Alt` `Up`                     | Go to previous method                     |\n| `Alt` `Down`                   | Go to next method                         |\n| `Ctrl` `]` _/_ `[`             | Move to code block end/start              |\n| `Cltrl` `Shift` `M`            | Move caret to matching brace              |\n| `Ctrl` `F12`                   | File structure popup                      |\n| `Ctrl` `H`                     | Type hierarchy                            |\n| `Ctrl` `Alt` `H`               | Call hierarchy                            |\n| `F2` _/_ `Shift` `F2`          | Next/previous highlighted error           |\n| `F4` _/_ `Ctrl` `Enter`        | Jump to source                            |\n| `Alt` `Home`                   | Jump to navigation bar                    |\n| `F11`                          | Toggle bookmark                           |\n| `Ctrl` `Shift` `F11`           | Toggle bookmark with mnemonic             |\n| `Ctrl` `0...9`                 | Go to numbered bookmark                   |\n| `Shift` `F11`                  | Show bookmarks                            |\n\n{.shortcuts}\n\n### Multiple carets and selections\n\n| shortcut               | description                        |\n| ---------------------- | ---------------------------------- |\n| `Alt` `Click`          | Add or remove caret                |\n| `Shift` `Ctrl + Alt-J` | Select all occurrences             |\n| `Alt` `J`              | Select next occurrence             |\n| `Alt` `Shift` `J`      | Unselect occurrence                |\n| `Esc`                  | Unselect all occurrences or carets |\n\n{.shortcuts}\n\n### Debugging\n\n| shortcut            | description         |\n| ------------------- | ------------------- |\n| `F8`                | Step over           |\n| `F7`                | Step into           |\n| `Shift` `F7`        | Smart step into     |\n| `Shift` `F8`        | Step out            |\n| `Alt` `F9`          | Run to cursor       |\n| `Alt` `F8`          | Evaluate expression |\n| `F9`                | Resume program      |\n| `Ctrl` `F8`         | Toggle breakpoint   |\n| `Ctrl` `Shift` `F8` | View breakpoints    |\n\n{.shortcuts}\n\n### Running\n\n| shortcut             | description                           |\n| -------------------- | ------------------------------------- |\n| `Alt` `Shift` `F10`  | Select configuration and run          |\n| `Alt` `Shift` `F9`   | Select configuration and debug        |\n| `Shift` `F10`        | Run                                   |\n| `Shift` `F9`         | Debug                                 |\n| `Ctrl` `Shift` `F10` | Run context configuration from editor |\n| `Alt` `Shift` `R`    | Rerun tests                           |\n| `Alt` `F11`          | Run Gulp/Grunt/npm tasks              |\n\n{.shortcuts}\n\n### Usage Search\n\n| shortcut            | description              |\n| ------------------- | ------------------------ |\n| `Alt` `F7`          | Find usages              |\n| `Ctrl` `F7`         | Find usages in file      |\n| `Ctrl` `Shift` `F7` | Highlight usages in file |\n| `Ctrl` `Alt` `F7`   | Show usages              |\n\n{.shortcuts}\n\n### VCS/Local History\n\n| shortcut            | description             |\n| ------------------- | ----------------------- |\n| `Alt` <kbd>\\`</kbd> | VCS quick popup         |\n| `Ctrl` `K`          | Commit project to VCS   |\n| `Ctrl` `T`          | Update project from VCS |\n| `Alt` `Shift` `C`   | View recent changes     |\n\n{.shortcuts}\n\n### Search/Replace\n\n| shortcut           | description     |\n| ------------------ | --------------- |\n| `Ctrl` `F`         | Find            |\n| `F3`               | Find next       |\n| `Shift` `F3`       | Find previous   |\n| `Ctrl` `Shift` `F` | Find in path    |\n| `Ctrl` `R`         | Replace         |\n| `Ctrl` `Shift` `R` | Replace in path |\n\n{.shortcuts}\n\n### Refactoring\n\n| shortcut                | description               |\n| ----------------------- | ------------------------- |\n| `Ctrl` `Alt` `Shift +T` | Refactor this             |\n| `F5` _/_ `F6`           | Copy / Move               |\n| `Alt` `Delete`          | Safe Delete               |\n| `Shift` `F6`            | Rename                    |\n| `Ctrl` `F6`             | Change function signature |\n| `Ctrl` `Alt` `N`        | Inline Variable           |\n| `Ctrl` `Alt` `M`        | Extract Method            |\n| `Ctrl` `Alt` `V`        | Extract Variable          |\n| `Ctrl` `Alt` `C`        | Extract Constant          |\n| `Ctrl` `Alt` `P`        | Extract Parameter         |\n\n{.shortcuts}\n"
  },
  {
    "path": "source/_posts/windows-cmd.md",
    "content": "---\ntitle: Windows Cmd\ndate: 2025-06-30 18:28:43\nbackground: bg-red-500\ntags:\n  - command\ncategories:\n  - Programming\nintro: |\n  This Windows Command Cheat Sheet is a non-exhaustive list of the main Windows commands you can use.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Basic {.col-span-3}\n\n| CMD        | Description                                                 |\n| :--------- | :---------------------------------------------------------- |\n| `cls`      | Clears the content of the screen.                           |\n| `echo`     | Displays messages or enables/disables command echoing.      |\n| `help`     | Provides help information for Windows commands.             |\n| `exit`     | Exits the CMD.EXE program (command interpreter).            |\n| `date`     | Displays or sets the date.                                  |\n| `time`     | Displays or sets the system time.                           |\n| `ver`      | Displays the Windows version.                               |\n| `dir`      | Displays a list of files and subdirectories in a directory. |\n| `cd`       | Displays the name of or changes the current directory.      |\n| `copy`     | Copies one or more files to another location.               |\n| `move`     | Moves files and renames files and directories.              |\n| `del`      | Deletes one or more files.                                  |\n| `mkdir`    | Creates a directory.                                        |\n| `rmdir`    | Removes a directory.                                        |\n| `type`     | Displays the contents of a text file.                       |\n| `ren`      | Renames a file or files.                                    |\n| `start`    | Starts a separate window to run a specified program or cmd. |\n| `shutdown` | Allows you to shut down or restart the computer.            |\n| `tasklist` | Displays all currently running tasks including services.    |\n| `taskkill` | Ends one or more tasks or processes.                        |\n\n## Manage files:\n\n### File {.col-span-3}\n\n| CMD        | Description                                                       |\n| :--------- | :---------------------------------------------------------------- |\n| `attrib`   | Displays or changes file attributes.                              |\n| `fc`       | Compares two files and displays the differences between them.     |\n| `find`     | Searches for a text string in a file or files.                    |\n| `findstr`  | Searches for strings in files.                                    |\n| `xcopy`    | Copies files and directory trees.                                 |\n| `robocopy` | Robust File Copy for Windows, a more advanced version of `xcopy`. |\n| `compact`  | Displays or alters the compression of files on NTFS partitions.   |\n| `expand`   | Expands one or more compressed files.                             |\n| `replace`  | Replaces files.                                                   |\n| `tree`     | Graphically displays the folder structure of a drive or path.     |\n| `sort`     | Sorts input.                                                      |\n| `more`     | Displays output one screen at a time.                             |\n| `print`    | Prints a text file.                                               |\n| `cipher`   | Displays or alters the encryption of dir [files] on NTFS parts.   |\n| `diskcomp` | Compares the contents of two floppy disks.                        |\n| `diskcopy` | Copies the contents of one floppy disk to another.                |\n| `format`   | Formats a disk for use with Windows.                              |\n| `chkdsk`   | Checks a disk and displays a status report.                       |\n| `label`    | Creates, changes, or deletes the volume label of a disk.          |\n| `recover`  | Recovers readable information from a bad or defective disk.       |\n\n## System & Network\n\n### System {.col-span-3}\n\n| CMD           | Description                                                                               |\n| :------------ | :---------------------------------------------------------------------------------------- |\n| `systeminfo`  | Displays detailed configuration information about a computer and its operating system.    |\n| `driverquery` | Displays current device driver status and properties.                                     |\n| `msinfo32`    | Starts the System Information tool.                                                       |\n| `reg`         | Registry Console Tool, used to manage the Windows Registry.                               |\n| `sc`          | Displays or configures services (background processes).                                   |\n| `taskmgr`     | Starts the Task Manager.                                                                  |\n| `wmic`        | Windows Management Instrumentation, used for managing Windows systems.                    |\n| `sfc`         | System File Checker, scans and verifies the versions of all protected system files.       |\n| `gpupdate`    | Refreshes local and Active Directory-based Group Policy settings.                         |\n| `gpresult`    | Displays Group Policy settings and Resultant Set of Policy (RSoP) for a user or computer. |\n| `powercfg`    | Configures power settings.                                                                |\n| `dxdiag`      | Starts the DirectX Diagnostic Tool.                                                       |\n| `perfmon`     | Starts the Performance Monitor.                                                           |\n| `rsop`        | Resultant Set of Policy, used to view Group Policy settings.                              |\n| `sigverif`    | Starts the File Signature Verification tool.                                              |\n| `sysedit`     | Starts the System Configuration Editor.                                                   |\n| `syskey`      | Secures the Windows XP account database.                                                  |\n| `chgport`     | Displays or changes Com port mappings.                                                    |\n| `chgusr`      | Changes the installed user mode.                                                          |\n\n### Network {.col-span-3}\n\n| CMD              | Description                                                                                                        |\n| :--------------- | :----------------------------------------------------------------------------------------------------------------- |\n| `ipconfig`       | Displays all current TCP/IP network configuration values.                                                          |\n| `ping`           | Tests network connectivity to a specified host.                                                                    |\n| `tracert`        | Traces the route taken by packets to a specified destination.                                                      |\n| `netstat`        | Displays active TCP connections, ports on which the computer is listening.                                         |\n| `nslookup`       | Displays information that you can use to diagnose Domain Name System (DNS) infrastructure.                         |\n| `net`            | Manages network resources, services, and user accounts.                                                            |\n| `netsh`          | Network Shell, used to configure and monitor network devices.                                                      |\n| `arp`            | Displays and modifies the IP-to-Physical address translation tables used by the Address Resolution Protocol (ARP). |\n| `route`          | Displays and modifies the entries in the local IP routing table.                                                   |\n| `ftp`            | Starts the File Transfer Protocol (FTP) client.                                                                    |\n| `telnet`         | Starts the Telnet client.                                                                                          |\n| `nbtstat`        | Displays protocol statistics and current TCP/IP connections using NBT (NetBIOS over TCP/IP).                       |\n| `net use`        | Connects to, disconnects from, and displays information about network connections.                                 |\n| `net session`    | Manages server computer connections.                                                                               |\n| `net start`      | Starts a network service.                                                                                          |\n| `net stop`       | Stops a network service.                                                                                           |\n| `net view`       | Displays a list of resources being shared on a specified computer.                                                 |\n| `net user`       | Manages user accounts.                                                                                             |\n| `net localgroup` | Manages local groups.                                                                                              |\n| `net share`      | Manages shared resources.                                                                                          |\n| `net statistics` | Displays network statistics.                                                                                       |\n\n## Miscellaneous\n\n### Process Management {.col-span-1}\n\n| CMD            | Description                                                  |\n| :------------- | :----------------------------------------------------------- |\n| `wmic process` | Manages processes using Windows Management Instrumentation . |\n| `timeout`      | Waits for specified number of seconds / until a key pressed. |\n\n### Disk Management {.col-span-1}\n\n| CMD Command | Description                        |\n| :---------- | :--------------------------------- |\n| `diskpart`  | Manages disk partitions.           |\n| `defrag`    | Defragments a disk.                |\n| `convert`   | Converts a FAT volume to NTFS.     |\n| `diskperf`  | Manages disk performance counters. |\n\n### System Configuration {.col-span-1}\n\n| CMD Command | Description                                             |\n| :---------- | :------------------------------------------------------ |\n| `bcdedit`   | Manages the Boot Configuration Data (BCD) store.        |\n| `bootcfg`   | Configures, queries, or changes Boot.ini file settings. |\n| `msconfig`  | Starts the System Configuration utility.                |\n| `regedit`   | Starts the Registry Editor.                             |\n\n## Tips & Tricks\n\n### Miscellaneous Tips & Tricks {.col-span-3}\n\n| Tip or Trick                                                    | Description                                                                                                                                      |\n| :-------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------- |\n| `wmic path SoftwareLicensingService get OA3xOriginalProductKey` | Get your Windows Product key                                                                                                                     |\n| `cmd /k`                                                        | Opens the command prompt and executes a specified command, keeping the window open.                                                              |\n| `cmd /c`                                                        | Opens the command prompt, executes a specified command, and then closes the window.                                                              |\n| `&&`                                                            | Allows you to run multiple commands in sequence. For example, `command1 && command2`.                                                            |\n| `\\|\\|`                                                          | Allows you to run a second command only if the first command fails. For example, `command1 \\|\\| command2`.                                       |\n| `>`                                                             | Redirects the output of a command to a file, overwriting the file if it already exists. For example, `command > output.txt`.                     |\n| `>>`                                                            | Redirects the output of a command to a file, appending the output if the file already exists. For example, `command >> output.txt`.              |\n| `\\|`                                                            | Pipes the output of one command to another command. For example, `command1 \\| command2`.                                                         |\n| `clip`                                                          | Redirects the output of a command to the Windows clipboard. For example, `dir \\| clip`.                                                          |\n| `for %i in (*.txt) do echo %i`                                  | Loops through all `.txt` files in the current directory and echoes their names.                                                                  |\n| `pushd` and `popd`                                              | `pushd` saves the current directory and then changes to a new directory. `popd` returns to the saved directory.                                  |\n| `set`                                                           | Displays, sets, or removes environment variables. For example, `set PATH=C:\\newpath`.                                                            |\n| `start \"\" \"C:\\Path\\To\\Program\\program.exe\"`                     | Starts a program without waiting for it to finish.                                                                                               |\n| `taskkill /IM \"process.exe\" /F`                                 | Forcefully kills a process by its image name.                                                                                                    |\n| `wmic product get name`                                         | Lists all installed software on the system.                                                                                                      |\n| `wmic logicaldisk get size,freespace,caption`                   | Displays the size, free space, and caption of all logical disks.                                                                                 |\n| `systeminfo` `\\|` `findstr /B /C:\"OS Name\" /C:\"OS Version\"`     | Displays the OS name and version.                                                                                                                |\n| `schtasks /query /fo LIST /v`                                   | Lists all scheduled tasks in detail.                                                                                                             |\n| `netsh wlan show profiles`                                      | Displays a list of all saved Wi-Fi profiles.                                                                                                     |\n| `netsh wlan show profiles name=\"ProfileName\" key=clear`         | Displays the password for a specific Wi-Fi profile.                                                                                              |\n| `assoc`                                                         | Displays or modifies file extension associations.                                                                                                |\n| `ftype`                                                         | Displays or modifies file types used in file extension associations.                                                                             |\n| `driverquery /v`                                                | Lists all installed drivers with detailed information.                                                                                           |\n| `powercfg /energy`                                              | Generates a detailed energy report for the system.                                                                                               |\n| `powercfg /batteryreport`                                       | Generates a battery life report for laptops.                                                                                                     |\n| `robocopy C:\\Source D:\\Destination /MIR`                        | Mirrors a directory from one location to another, including subdirectories and files.                                                            |\n| `mklink /D \"C:\\Path\\To\\Link\" \"C:\\Path\\To\\Target\"`               | Creates a symbolic link to a directory.                                                                                                          |\n| `mklink /H \"C:\\Path\\To\\Link\" \"C:\\Path\\To\\Target\"`               | Creates a hard link to a file.                                                                                                                   |\n| `mklink /J \"C:\\Path\\To\\Link\" \"C:\\Path\\To\\Target\"`               | Creates a directory junction.                                                                                                                    |\n| `diskpart /s script.txt`                                        | Runs a DiskPart script to automate disk partitioning tasks.                                                                                      |\n| `shutdown /a`                                                   | Aborts a system shutdown.                                                                                                                        |\n| `chkdsk /f /r`                                                  | Checks a disk and fixes errors, also recovers readable information from bad sectors.                                                             |\n| `sfc /scannow`                                                  | Scans and repairs protected system files.                                                                                                        |\n| `DISM /Online /Cleanup-Image /RestoreHealth`                    | Repairs the Windows image using DISM.                                                                                                            |\n| `bcdboot C:\\Windows`                                            | Repairs the boot environment by copying boot files from the Windows directory.                                                                   |\n| `bootrec /fixmbr`                                               | Repairs the Master Boot Record (MBR).                                                                                                            |\n| `bootrec /fixboot`                                              | Writes a new boot sector to the system partition.                                                                                                |\n| `bootrec /scanos`                                               | Scans for installations compatible with Windows and displays the entries that are currently not in the Boot Configuration Data store.            |\n| `bootrec /rebuildbcd`                                           | Scans for installations compatible with Windows and allows you to select the installations you want to add to the Boot Configuration Data store. |\n\n## Other\n\n- Also see : [Windows Official Documentation](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands)\n"
  },
  {
    "path": "source/_posts/windows-shortcuts.md",
    "content": "# Best Windows Shortcuts on Your Keyboard\n\nCopy selected content (Ctrl + C can also abort commands):\n\n```\nCtrl + C\n```\n\nPaste copied content:\n\n```\nCtrl + V\n```\n\nPaste unformatted content:\n\n```\nCtrl + Shift + V\n```\n\nDelete and copy selected content (good for moving text, files, etc.):\n\n```\nCtrl + X\n```\n\nSelect all available content in focus:\n\n```\nCtrl + A\n```\n\nUndo the previous action:\n\n```\nCtrl + Z\n```\n\nRedo the previous action:\n\n```\nCtrl + Y\n```\n\nSave what you're working on:\n\n```\nCtrl + S\n```\n\nOpen a new file:\n\n```\nCtrl + O\n```\n\nOpen the print dialog box:\n\n```\nCtrl + P\n```\n\nOpen the search tool to find something on the page:\n\n```\nCtrl + F\n```\n\nRefresh the contents on the screen (only F5 works in some cases):\n\n```\nCtrl + R\n```\n\nClose the active program:\n\n```\nAlt + F4\n```\n\nEnter full-screen mode:\n\n```\nF11\n```\n\nStop or close a prompt or process:\n\n```\nEsc\n```\n\n# Keyboard Shortcuts for Navigating Windows\n\nLock your user account:\n\n```\nWin + L\n```\n\nOpen File Explorer:\n\n```\nWin + E\n```\n\nOpen Windows Settings:\n\n```\nWin + i\n```\n\nMove focus to the navigation bar to edit or copy the folder path:\n\n```\nAlt + D\n```\n\nGo to the folder the current folder is stored in:\n\n```\nAlt + Up\n```\n\nShow your password on the sign-in screen:\n\n```\nAlt + F8\n```\n\nOpen Task Manager (Ctrl + Alt + Del works, too):\n\n```\nCtrl + Shift + Esc\n```\n\nOpen the Run dialog box to run commands:\n\n```\nWin + R\n```\n\nQuickly switch to the desktop:\n\n```\nWin + D\n```\n\nOpen the selected item's Properties window:\n\n```\nAlt + [Enter or double-click]\n```\n\nAdd a Virtual Desktop:\n\n```\nWin + Ctrl + D\n```\n\nSwitch to the virtual desktop on the left or right:\n\n```\nWin + Ctrl + [Left or Right]\n```\n\nShow All Open Desktops:\n\n```\nWIN + Tab\n```\n\nClose Current Virtual Desktop:\n\n```\nWIN + Ctrl + F4\n```\n\nSelect noncontiguous items (like files or folders):\n\n```\nCtrl + Click\n```\n\nA possible fix for when your screen is black:\n\n```\nWin + Ctrl + Shift + B\n```\n\nSelect every item between the first and last select items:\n\n```\nShift + Click\n```\n\nPermanently delete a file or folder (it skips the Recycle Bin):\n\n```\nShift + Del\n```\n\nSwitch to the last used window:\n\n```\nAlt + Tab\n```\n\nSnap the active window to one side of the screen:\n\n```\nWin + [Arrow]\n```\n\nRename the selected file or folder:\n\n```\nF2\n```\n\nOpen the Power User Menu:\n\n```\nWin + X\n```\n\nOpen a new instance of that app:\n\n```\nShift + Click Taskbar Icon\n```\n\nLaunch that item from the taskbar:\n\n```\nWin + [number]\n```\n\nMake a new folder:\n\n```\nCtrl + Shift + N\n```\n\nOpen the Windows About page:\n\n```\nWin + Pause\n```\n\n# Keyboard Shortcuts for Screenshots\n\nScreenshot just the active window:\n\n```\nAlt + PrtScn\n```\n\nAuto-save full-screen screenshot to Pictures > Screenshots:\n\n```\nWin + PrtScn\n```\n\nChoose a part of the screen to make a screenshot:\n\n```\nWin + Shift + S\n```\n\n# Keyboard Shortcuts for Text Manipulation\n\nBold the selected text:\n\n```\nCtrl + B\n```\n\nItalicize the selected text:\n\n```\nCtrl + i\n```\n\nUnderline the selected text:\n\n```\nCtrl + U\n```\n\nInsert a hyperlink into the selected text:\n\n```\nCtrl + K\n```\n\nOpen the Find and Replace tool (confirmed in MS Word and Google Docs):\n\n```\nCtrl + H\n```\n\nPick an arrow key with this shortcut to quickly highlight a whole word or paragraph:\n\n```\nShift + Ctrl + [Arrow]\n```\n\nHighlight everything from the cursor to the beginning or end of the line:\n\n```\nShift + [Home or End]\n```\n\nDelete the word to the right of the cursor:\n\n```\nCtrl + Del\n```\n\n# Keyboard Shortcuts for Web Browsers\n\nOpen a new tab:\n\n```\nCtrl + T\n```\n\nReopen the most recently closed tab:\n\n```\nCtrl + Shift + T\n```\n\nClose the active tab:\n\n```\nCtrl + W\n```\n\nOpen the link in a new tab:\n\n```\nCtrl + [Link]\n```\n\nView your web browsing history:\n\n```\nCtrl + H\n```\n\nView recent or active downloads:\n\n```\nCtrl + J\n```\n\nStart a search using the default search engine:\n\n```\nCtrl + E\n```\n\nJump to the tab in that position from the left (e.g., Ctrl + 4):\n\n```\nCtrl + [number]\n```\n\nOpen the options to delete browsing data:\n\n```\nCtrl + Shift + Del\n```\n\nGo back or forward a page:\n\n```\nAlt + [Left or Right]\n```\n\nAdjust the size of the text (scroll up with the mouse to increase the size):\n\n```\nCtrl + [Zoom]\n```\n\nAdd .com to the end of the text in the address bar, and then visit the page:\n\n```\nCtrl + Enter\n```\n\nRefresh the page, but skip the cache:\n\n```\nCtrl + F5\n```\n\nOpen LinkedIn (or Teams, Word Online):\n\n```\nCtrl + Shift + Alt + Win + L\n```\n\n# Windows Shortcuts in Run Command\n\n- The quickest way to access the Run command window is to use the keyboard shortcut `Windows + R`\n\n| Command               | Description                                                                      |\n| --------------------- | -------------------------------------------------------------------------------- |\n| `sysdm.cpl`           | Windows Propertes                                                                |\n| `compmgmt.msc`        | Component Managment                                                              |\n| `winver`              | Windows Version                                                                  |\n| `appwiz.cpl`          | Programs And Fuatchers                                                           |\n| `resmon`              | The Resource Monitor window will open, displaying real-time performance d`ata    |\n| `taskmgr`             | Task Manager                                                                     |\n| `explorer`            | Windows Explorer                                                                 |\n| `ncpa.cpl`            | Network Connection                                                               |\n| `Firewall.cpl`        | Firewall                                                                         |\n| `wf.msc`              | Windows Firewall Advanced                                                        |\n| `intl.cpl`            | Time And Date Options                                                            |\n| `timedate.cpl`        | Time And Date Settings                                                           |\n| `mstsc`               | Remote Desktop                                                                   |\n| `osk`                 | Keybord Virtual                                                                  |\n| `charmap`             | Character Map                                                                    |\n| `devmgmt.msc`         | Device Managment                                                                 |\n| `desk.cpl`            | Desktop Resuliation                                                              |\n| `dfrgui`              | program for configuring the scheduled task for disk defragmentation              |\n| `diskmgmt.msc`        | Disk Managare                                                                    |\n| `fsmgmt.msc`          | Show Folders Share                                                               |\n| `inetcpl.cpl`         | Internet Explorer options                                                        |\n| `logoff`              | Log Off                                                                          |\n| `magnify`             | Show Magnifier                                                                   |\n| `mmsys.cpl`           | Sound settings                                                                   |\n| `msconfig`            | System settings                                                                  |\n| `msinfo32`            | Show system all info                                                             |\n| `systeminfo`          | Show system info                                                                 |\n| `netplwiz`            | System Users info                                                                |\n| `perfmon.msc`         | Start Windows Reliability and Performance Monitor in a specific s`tandalone mode |\n| `powercfg.cpl`        | Power options                                                                    |\n| `services.msc`        | Services                                                                         |\n| `shrpubw`             | Shared Folder Wizard                                                             |\n| `write`               | WordPad                                                                          |\n| `control`             | Control Panel                                                                    |\n| `Control Printers`    | Device And Printers                                                              |\n| `dxdiag`              | Show System Information Hardware                                                 |\n| `tracert`             | Trace Route                                                                      |\n| `printui /s /t2`      | Print Server Properties                                                          |\n| `printui /s`          | Show Printer Drivers                                                             |\n| `PrintManagement.msc` | Printers Management , show all printers with drivers                             |\n| `shell:appsfolder`    | Show App Folder                                                                  |\n| `shutdown /r /t 5`    | Restart the system after 5 seconds                                               |\n| `shutdown /s /t 5`    | System shutdown after 5 seconds                                                  |\n| `shutdown -a`         | This command will cancel the scheduled shutdown for one time                     |\n| `shutdown /r /fw`     | Bios Login from windows                                                          |\n\n# Create God Mode Folder\n\ncreate a new folder on your desktop with this exact name (copy and paste it):\n`GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}`\n\n- The folder icon will change to a Control Panel-style icon, and you will be able to jump in and change all kinds of\n  settings\n"
  },
  {
    "path": "source/_posts/wordpress.md",
    "content": "---\ntitle: WordPress\ndate: 2022-11-23 16:23:31.697854\nbackground: bg-[#434140]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 34 keyboard shortcuts found in the WordPress visual editor\n---\n\n## Keyboard Shortcuts {.cols-2}\n\n### Editor I\n\n| Shortcut          | Action                                 |\n| ----------------- | -------------------------------------- |\n| `Ctrl` `C`        | Copy                                   |\n| `Ctrl` `V`        | Paste                                  |\n| `Ctrl` `A`        | Select all                             |\n| `Ctrl` `X`        | Cut                                    |\n| `Ctrl` `Z`        | Undo                                   |\n| `Ctrl` `Y`        | Redo                                   |\n| `Ctrl` `B`        | Bold                                   |\n| `Ctrl` `I`        | Italic                                 |\n| `Ctrl` `U`        | Underline                              |\n| `Ctrl` `K`        | Insert or edit a link                  |\n| `Alt` `Shift` `N` | Check spelling, this requires a plugin |\n| `Alt` `Shift` `L` | Align text left                        |\n| `Alt` `Shift` `J` | Justify text                           |\n| `Alt` `Shift` `C` | Align text center                      |\n| `Alt` `Shift` `D` | Strikethrough                          |\n| `Alt` `Shift` `R` | Align text right                       |\n| `Alt` `Shift` `U` | Unordered list                         |\n\n{.shortcuts}\n\n### Editor II\n\n| Shortcut          | Action                        |\n| ----------------- | ----------------------------- |\n| `Alt` `Shift` `A` | Insert a link                 |\n| `Alt` `Shift` `O` | Ordered list                  |\n| `Alt` `Shift` `S` | Remove a link                 |\n| `Alt` `Shift` `Q` | Quote                         |\n| `Alt` `Shift` `M` | Insert an image               |\n| `Alt` `Shift` `W` | Distraction free writing mode |\n| `Alt` `Shift` `T` | Insert a more tag             |\n| `Alt` `Shift` `P` | Insert a page break tag       |\n| `Alt` `Shift` `H` | Help                          |\n| `Alt` `Shift` `X` | Add or remove a code tag      |\n| `Alt` `Shift` `1` | Heading one                   |\n| `Alt` `Shift` `2` | Heading two                   |\n| `Alt` `Shift` `3` | Heading three                 |\n| `Alt` `Shift` `4` | Heading four                  |\n| `Alt` `Shift` `5` | Heading five                  |\n| `Alt` `Shift` `6` | Heading six                   |\n| `Alt` `Shift` `9` | Insert an address             |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for WordPress](https://wordpress.org/support/article/keyboard-shortcuts/) _(wordpress.org)_\n"
  },
  {
    "path": "source/_posts/xpath.md",
    "content": "---\ntitle: XPath\ndate: 2020-12-19 22:15:43\nbackground: bg-[#77aeeb]\ntags:\n  - document\n  - expression\n  - select\ncategories:\n  - Toolkit\nintro: |\n  This is an [XPath](https://en.wikipedia.org/wiki/XPath) selectors cheat sheet, which lists commonly used XPath positioning methods and CSS selectors\nplugins:\n  - copyCode\n---\n\n## XPath Selectors {.cols-6}\n\n### Getting started {.col-span-2}\n\n- [Xpath test bed](http://www.whitebeam.org/library/guide/TechNotes/xpathtestbed.rhtm) _(whitebeam.org)_\n\nTest in Firefox or Chromium based browser console:\n\n```console\n$x('/html/body')\n$x('//h1')\n$x('//h1')[0].innerText\n$x('//a[text()=\"XPath\"]')[0].click()\n```\n\n### Descendant selectors {.col-span-2}\n\n| Xpath        | CSS          |\n| ------------ | ------------ |\n| `//h1`       | h1           |\n| `//div//p`   | div p        |\n| `//ul/li`    | ul > li      |\n| `//ul/li/a`  | ul > li > a  |\n| `//div/*`    | div > \\*     |\n| `/`          | :root        |\n| `/html/body` | :root > body |\n\n{.show-header}\n\n### Order selectors {.col-span-2}\n\n| Xpath               | CSS                  |\n| ------------------- | -------------------- |\n| `//ul/li[1]`        | ul > li:first-child  |\n| `//ul/li[2]`        | ul > li:nth-child(2) |\n| `//ul/li[last()]`   | ul > li:last-child   |\n| `//li[@id=\"id\"][1]` | li#id:first-child    |\n| `//a[1]`            | a:first-child        |\n| `//a[last()]`       | a:last-child         |\n\n{.show-header}\n\n### Attribute selectors {.col-span-3 .row-span-2}\n\n| Xpath                           | CSS                  |\n| ------------------------------- | -------------------- |\n| `//*[@id=\"id\"]`                 | #id                  |\n| `//*[@class=\"class\"]`           | .class               |\n| `//input[@type=\"submit\"]`       | input[type=\"submit\"] |\n| `//a[@id=\"abc\"][@for=\"xyz\"]`    | a#abc[for=\"xyz\"]     |\n| `//a[@rel]`                     | a[rel]               |\n| `//a[starts-with(@href, '/')]`  | a[href^='/']         |\n| `//a[ends-with(@href, '.pdf')]` | a[href$='pdf']       |\n| `//a[contains(@href, '://')]`   | a[href*='`:`//']     |\n| `//a[contains(@rel, 'help')]`   | a[rel~='help']       |\n\n{.show-header}\n\n### Siblings {.col-span-3}\n\n| Xpath                                | CSS      |\n| ------------------------------------ | -------- |\n| `//h1/following-sibling::ul`         | h1 ~ ul  |\n| `//h1/following-sibling::ul[1]`      | h1 + ul  |\n| `//h1/following-sibling::[@id=\"id\"]` | h1 ~ #id |\n\n{.show-header}\n\n### jQuery {.col-span-3}\n\n| Xpath                            | CSS                        |\n| -------------------------------- | -------------------------- |\n| `//ul/li/..`                     | $('ul > li').parent()      |\n| `//li/ancestor-or-self::section` | $('li').closest('section') |\n| `//a/@href`                      | $('a').attr('href')        |\n| `//span/text()`                  | $('span').text()           |\n\n{.show-header}\n\n### Misc selectors {.col-span-3}\n\n| Xpath                             | CSS                       |\n| --------------------------------- | ------------------------- | --------------------- |\n| `//h1[not(@id)]`                  | h1:not([id])              |\n| `//button[text()=\"Submit\"]`       | Text match                |\n| `//button[contains(text(),\"Go\")]` | Text contains (substring) |\n| `//product[@price > 2.50]`        | Arithmetic                |\n| `//ul[*]`                         | Has children              |\n| `//ul[li]`                        | Has children (specific)   |\n| `//a[@name or @href]`             | Or logic                  |\n| `//a                              | //div`                    | Union (joins results) |\n\n{.show-header}\n\n## XPath Expressions\n\n### Steps and axes {.secondary}\n\n<br/>\n\n| -    | -    | -    | -               |\n| ---- | ---- | ---- | --------------- |\n| `//` | `ul` | `/`  | `a[@id='link']` |\n| Axis | Step | Axis | Step            |\n\n{.left-text}\n\n### Prefixes\n\n| Prefix | Example               | Means    |\n| ------ | --------------------- | -------- |\n| `//`   | `//hr[@class='edge']` | Anywhere |\n| `/`    | `/html/body/div`      | Root     |\n| `./`   | `./div/p`             | Relative |\n\n{.show-header}\n\n### Axes\n\n| Axis | Example             | Means      |\n| ---- | ------------------- | ---------- |\n| `/`  | `//ul/li/a`         | Child      |\n| `//` | `//[@id=\"list\"]//a` | Descendant |\n\n{.show-header}\n\n## XPath Predicates\n\n### Predicates\n\n```bash\n//div[true()]\n//div[@class=\"head\"]\n//div[@class=\"head\"][@id=\"top\"]\n```\n\nRestricts a nodeset only if some condition is true. They can be chained.\n\n### Operators\n\n```bash\n# Comparison\n//a[@id = \"xyz\"]\n//a[@id != \"xyz\"]\n//a[@price > 25]\n```\n\n```bash\n# Logic (and/or)\n//div[@id=\"head\" and position()=2]\n//div[(x and y) or not(z)]\n```\n\n### Using nodes\n\n```bash\n# Use them inside functions\n//ul[count(li) > 2]\n//ul[count(li[@class='hide']) > 0]\n```\n\n```bash\n# Returns `<ul>` that has a `<li>` child\n//ul[li]\n```\n\nYou can use nodes inside predicates.\n\n### Indexing\n\n```bash\n//a[1]                # first <a>\n//a[last()]           # last <a>\n//ol/li[2]            # second <li>\n//ol/li[position()=2] # same as above\n//ol/li[position()>1] #:not(:first-child)\n```\n\nUse `[]` with a number, or `last()` or `position()`.\n\n### Chaining order\n\n```bash\na[1][@href='/']\na[@href='/'][1]\n```\n\nOrder is significant, these two are different.\n\n### Nesting predicates\n\n```\n//section[.//h1[@id='hi']]\n```\n\nThis returns `<section>` if it has an `<h1>` descendant with `id='hi'`.\n\n## XPath Functions {.cols-2}\n\n### Node functions\n\n```bash\nname()            # //[starts-with(name(), 'h')]\ntext()            # //button[text()=\"Submit\"]\n                  # //button/text()\nlang(str)\nnamespace-uri()\n```\n\n```bash\ncount()           # //table[count(tr)=1]\nposition()        # //ol/li[position()=2]\n```\n\n### String functions\n\n```bash\ncontains()        # font[contains(@class,\"head\")]\nstarts-with()     # font[starts-with(@class,\"head\")]\nends-with()       # font[ends-with(@class,\"head\")]\n```\n\n```bash\nconcat(x,y)\nsubstring(str, start, len)\nsubstring-before(\"01/02\", \"/\")  #=> 01\nsubstring-after(\"01/02\", \"/\")   #=> 02\ntranslate()\nnormalize-space()\nstring-length()\n```\n\n### Boolean functions\n\n```bash\nnot(expr)         # button[not(starts-with(text(),\"Submit\"))]\n```\n\n### Type conversion\n\n```bash\nstring()\nnumber()\nboolean()\n```\n\n## XPath Axes {.cols-2}\n\n### Using axes\n\n```bash\n//ul/li                       # ul > li\n//ul/child::li                # ul > li (same)\n//ul/following-sibling::li    # ul ~ li\n//ul/descendant-or-self::li   # ul li\n//ul/ancestor-or-self::li     # $('ul').closest('li')\n```\n\n---\n\n|      |      |            |      |\n| ---- | ---- | ---------- | ---- |\n| `//` | `ul` | `/child::` | `li` |\n| Axis | Step | Axis       | Step |\n\n{.left-text}\n\nSteps of an expression are separated by `/`, usually used to pick child nodes. That's not always true: you can specify a\ndifferent \"axis\" with `::`.\n\n### Child axis\n\n```bash\n# both the same\n//ul/li/a\n//child::ul/child::li/child::a\n```\n\n`child::` is the default axis. This makes `//a/b/c` work.\n\n```bash\n# both the same\n# this works because `child::li` is truthy\n//ul[li]\n//ul[child::li]\n```\n\n```bash\n# both the same\n//ul[count(li) > 2]\n//ul[count(child::li) > 2]\n```\n\n### Descendant-or-self axis\n\n```bash\n# both the same\n//div//h4\n//div/descendant-or-self::h4\n```\n\n`//` is short for the `descendant-or-self::` axis.\n\n```bash\n# both the same\n//ul//[last()]\n//ul/descendant-or-self::[last()]\n```\n\n### Other axes {.row-span-2}\n\n| Axis                 | Abbrev | Notes                                            |\n| -------------------- | ------ | ------------------------------------------------ |\n| `ancestor`           |        |                                                  |\n| `ancestor-or-self`   |        |                                                  |\n| `attribute`          | `@`    | `@href` is short for `attribute::href`           |\n| `child`              |        | `div` is short for `child::div`                  |\n| `descendant`         |        |                                                  |\n| `descendant-or-self` | `//`   | `//` is short for `/descendant-or-self::node()/` |\n| `namespace`          |        |                                                  |\n| `self`               | `.`    | `.` is short for `self::node()`                  |\n| `parent`             | `..`   | `..` is short for `parent::node()`               |\n| `following`          |        |                                                  |\n| `following-sibling`  |        |                                                  |\n| `preceding`          |        |                                                  |\n| `preceding-sibling`  |        |                                                  |\n\n{.headers}\n\nThere are other axes you can use.\n\n### Unions\n\n```bash\n//a | //span\n```\n\nUse `|` to join two expressions.\n\n## XPath More examples {.cols-2}\n\n### Examples\n\n```bash\n//*                 # all elements\ncount(//*)          # count all elements\n(//h1)[1]/text()    # text of the first h1 heading\n//li[span]          # find a <li> with an <span> inside it\n                    # ...expands to //li[child::span]\n//ul/li/..          # use .. to select a parent\n```\n\n### Find a parent\n\n```bash\n//section[h1[@id='section-name']]\n```\n\nFinds a `<section>` that directly contains `h1#section-name`\n\n```bash\n//section[//h1[@id='section-name']]\n```\n\nFinds a `<section>` that contains `h1#section-name`. (Same as above, but uses descendant-or-self instead of child)\n\n### Closest\n\n```bash\n./ancestor-or-self::[@class=\"box\"]\n```\n\nWorks like jQuery's `$().closest('.box')`.\n\n### Attributes\n\n```bash\n//item[@price > 2*@discount]\n```\n\nFinds `<item>` and check its attributes\n\n## Also see\n\n- [Devhints](https://devhints.io/xpath) _(devhints.io)_\n- [Xpath test bed](http://www.whitebeam.org/library/guide/TechNotes/xpathtestbed.rhtm) _(whitebeam.org)_\n"
  },
  {
    "path": "source/_posts/yaml.md",
    "content": "---\ntitle: YAML\ndate: 2020-12-29 18:26:55\nbackground: bg-[#b42e28]\ntags:\n  - config\n  - format\ncategories:\n  - Programming\nintro: |\n  This is a quick reference cheat sheet for understanding and writing YAML format configuration files.\nplugins:\n  - copyCode\n---\n\n## Getting Started\n\n### Introduction\n\n[YAML](https://yaml.org/) is a data serialization language designed to be directly writable and readable by humans\n\n- YAML does not allow the use of tabs\n- Must be space between the element parts\n- YAML is CASE sensitive\n- End your YAML file with the `.yaml` or `.yml` extension\n- YAML is a superset of JSON\n- Ansible playbooks are YAML files {.marker-round}\n\n### Scalar types {.row-span-2}\n\n<!-- prettier-ignore -->\n```yaml\nn1: 1            # integer\nn2: 1.234        # float\n\ns1: 'abc'        # string\ns2: \"abc\"        # string\ns3: abc          # string\n\nb: false         # boolean type\n\nd: 2015-04-05    # date type\n```\n\n#### ↓ Equivalent JSON\n\n```json {.wrap}\n{\n  \"n1\": 1,\n  \"n2\": 1.234,\n  \"s1\": \"abc\",\n  \"s2\": \"abc\",\n  \"s3\": \"abc\",\n  \"b\": false,\n  \"d\": \"2015-04-05\"\n}\n```\n\nUse spaces to indent. There must be space between the element parts.\n\n### Variables\n\n```yaml\nsome_thing: &VAR_NAME foobar\nother_thing: *VAR_NAME\n```\n\n#### ↓ Equivalent JSON\n\n<!-- prettier-ignore -->\n```json {.wrap}\n{\n  \"some_thing\": \"foobar\",\n  \"other_thing\": \"foobar\"\n}\n```\n\n### Comments\n\n```yaml\n# A single line comment example\n\n# block level comment example\n# comment line 1\n# comment line 2\n# comment line 3\n```\n\n### Multiline strings\n\n```yaml\ndescription: |\n  hello\n  world\n```\n\n#### ↓ Equivalent JSON\n\n```json {.wrap}\n{ \"description\": \"hello\\nworld\\n\" }\n```\n\n### Inheritance {.row-span-2}\n\n```yaml\nparent: &defaults\n  a: 2\n  b: 3\n\nchild:\n  <<: *defaults\n  b: 4\n```\n\n#### ↓ Equivalent JSON\n\n```json {.wrap}\n{\n  \"parent\": {\n    \"a\": 2,\n    \"b\": 3\n  },\n  \"child\": {\n    \"a\": 2,\n    \"b\": 4\n  }\n}\n```\n\n### Reference {.row-span-2}\n\n```yaml\nvalues: &ref\n  - Will be\n  - reused below\n\nother_values:\n  i_am_ref: *ref\n```\n\n#### ↓ Equivalent JSON\n\n<!-- prettier-ignore -->\n```json {.wrap}\n{\n  \"values\": [\n    \"Will be\",\n    \"reused below\"\n  ],\n  \"other_values\": {\n    \"i_am_ref\": [\n      \"Will be\",\n      \"reused below\"\n    ]\n  }\n}\n```\n\n### Folded strings\n\n```yaml\ndescription: >\n  hello world\n```\n\n#### ↓ Equivalent JSON\n\n```json {.wrap}\n{ \"description\": \"hello world\\n\" }\n```\n\n### Two Documents\n\n```yaml\n---\ndocument: this is doc 1\n---\ndocument: this is doc 2\n```\n\nYAML uses `---` to separate directives from document content.\n\n## YAML Collections\n\n### Sequence\n\n```yaml\n- Mark McGwire\n- Sammy Sosa\n- Ken Griffey\n```\n\n#### ↓ Equivalent JSON\n\n<!-- prettier-ignore -->\n```json {.wrap}\n[\n  \"Mark McGwire\",\n  \"Sammy Sosa\",\n  \"Ken Griffey\"\n]\n```\n\n### Mapping\n\n<!-- prettier-ignore -->\n```yaml\nhr:  65       # Home runs\navg: 0.278    # Batting average\nrbi: 147      # Runs Batted In\n```\n\n#### ↓ Equivalent JSON\n\n```json {.wrap}\n{\n  \"hr\": 65,\n  \"avg\": 0.278,\n  \"rbi\": 147\n}\n```\n\n### Mapping to Sequences\n\n```yaml\nattributes:\n  - a1\n  - a2\nmethods: [getter, setter]\n```\n\n#### ↓ Equivalent JSON\n\n```json {.wrap}\n{\n  \"attributes\": [\"a1\", \"a2\"],\n  \"methods\": [\"getter\", \"setter\"]\n}\n```\n\n### Sequence of Mappings\n\n<!-- prettier-ignore -->\n```yaml\nchildren:\n  - name: Jimmy Smith\n    age: 15\n  - name: Jimmy Smith\n    age: 15\n  -\n    name: Sammy Sosa\n    age: 12\n```\n\n#### ↓ Equivalent JSON\n\n<!-- prettier-ignore -->\n```json {.wrap}\n{\n  \"children\": [\n    {\"name\": \"Jimmy Smith\", \"age\": 15},\n    {\"name\": \"Jimmy Smith\", \"age\": 15},\n    {\"name\": \"Sammy Sosa\", \"age\": 12}\n  ]\n}\n```\n\n### Sequence of Sequences\n\n<!-- prettier-ignore -->\n```yaml\nmy_sequences:\n  - [1, 2, 3]\n  - [4, 5, 6]\n  -\n    - 7\n    - 8\n    - 9\n    - 0 \n```\n\n#### ↓ Equivalent JSON\n\n```json {.wrap}\n{\n  \"my_sequences\": [\n    [1, 2, 3],\n    [4, 5, 6],\n    [7, 8, 9, 0]\n  ]\n}\n```\n\n### Mapping of Mappings\n\n```yaml\nMark McGwire: { hr: 65, avg: 0.278 }\nSammy Sosa: { hr: 63, avg: 0.288 }\n```\n\n#### ↓ Equivalent JSON\n\n```json {.wrap}\n{\n  \"Mark McGwire\": {\n    \"hr\": 65,\n    \"avg\": 0.278\n  },\n  \"Sammy Sosa\": {\n    \"hr\": 63,\n    \"avg\": 0.288\n  }\n}\n```\n\n### Nested Collections\n\n```yaml\nJack:\n  id: 1\n  name: Franc\n  salary: 25000\n  hobby:\n    - a\n    - b\n  location: { country: 'A', city: 'A-A' }\n```\n\n#### ↓ Equivalent JSON\n\n```json {.wrap}\n{\n  \"Jack\": {\n    \"id\": 1,\n    \"name\": \"Franc\",\n    \"salary\": 25000,\n    \"hobby\": [\"a\", \"b\"],\n    \"location\": {\n      \"country\": \"A\",\n      \"city\": \"A-A\"\n    }\n  }\n}\n```\n\n### Unordered Sets\n\n```yaml\nset1: !!set\n  ? one\n  ? two\nset2: !!set { 'one', 'two' }\n```\n\n#### ↓ Equivalent JSON\n\n```json {.wrap}\n{\n  \"set1\": { \"one\": null, \"two\": null },\n  \"set2\": { \"one\": null, \"two\": null }\n}\n```\n\nSets are represented as a Mapping where each key is associated with a null value\n\n### Ordered Mappings\n\n```yaml\nordered: !!omap\n  - Mark McGwire: 65\n  - Sammy Sosa: 63\n  - Ken Griffy: 58\n```\n\n#### ↓ Equivalent JSON\n\n<!-- prettier-ignore -->\n```json {.wrap}\n{\n  \"ordered\": [\n    { \"Mark McGwire\": 65 },\n    { \"Sammy Sosa\": 63 },\n    { \"Ken Griffy\": 58 }\n  ]\n}\n```\n\n## YAML Reference\n\n### Terms\n\n- Sequences aka arrays or lists\n- Scalars aka strings or numbers\n- Mappings aka hashes or dictionaries {.marker-round}\n\nBased on the YAML.org [refcard](https://yaml.org/refcard.html).\n\n### Document indicators\n\n|       |                     |\n| ----- | ------------------- |\n| `%`   | Directive indicator |\n| `---` | Document header     |\n| `...` | Document terminator |\n\n### Collection indicators {.row-span-2}\n\n|      |                                 |\n| ---- | ------------------------------- |\n| `?`  | Key indicator                   |\n| `:`  | Value indicator                 |\n| `-`  | Nested series entry indicator   |\n| `,`  | Separate in-line branch entries |\n| `[]` | Surround in-line series branch  |\n| `{}` | Surround in-line keyed branch   |\n\n### Alias indicators\n\n|     |                 |\n| --- | --------------- |\n| `&` | Anchor property |\n| `*` | Alias indicator |\n\n### Special keys\n\n|      |                                 |\n| ---- | ------------------------------- |\n| `=`  | Default \"value\" mapping key     |\n| `<<` | Merge keys from another mapping |\n\n### Scalar indicators\n\n|       |                                   |\n| ----- | --------------------------------- | --------------------------------------------- | ----------- |\n| `''`  | Surround in-line unescaped scalar |\n| `\"`   | Surround in-line escaped scalar   |\n| `     | `                                 | Block scalar indicator                        |\n| `>`   | Folded scalar indicator           |\n| `-`   | Strip chomp modifier (`           | -`or`>-`)                                     |\n| `+`   | Keep chomp modifier (`            | +`or`>+`)                                     |\n| `1-9` | Explicit indentation modifier (`  | 1`or`>2`). <br/> Modifiers can be combined (` | 2-`, `>+1`) |\n\n### Tag Property (usually unspecified) {.col-span-2}\n\n|          |                                                             |\n| -------- | ----------------------------------------------------------- |\n| `none`   | Unspecified tag (automatically resolved by application)     |\n| `!`      | Non-specific tag (by default, `!!map`/`!!seq`/`!!str`)      |\n| `!foo`   | Primary (by convention, means a local `!foo` tag)           |\n| `!!foo`  | Secondary (by convention, means `tag:yaml.org,2002:foo`)    |\n| `!h!foo` | Requires `%TAG !h! <prefix>` (and then means `<prefix>foo`) |\n| `!<foo>` | Verbatim tag (always means `foo`)                           |\n\n### Misc indicators\n\n|                  |                              |\n| ---------------- | ---------------------------- |\n| `#`              | Throwaway comment indicator  |\n| <code>\\`@</code> | Both reserved for future use |\n\n### Core types (default automatic tags) {.row-span-2}\n\n|         |                                          |\n| ------- | ---------------------------------------- |\n| `!!map` | `{Hash table, dictionary, mapping}`      |\n| `!!seq` | `{List, array, tuple, vector, sequence}` |\n| `!!str` | Unicode string                           |\n\n### Escape Codes {.row-span-3}\n\n#### Numeric\n\n- `\\x12` (8-bit)\n- `\\u1234` (16-bit)\n- `\\U00102030` (32-bit)\n\n{.cols-2 .marker-none}\n\n#### Protective\n\n- `\\\\` (\\\\)\n- `\\\"` (\")\n- `\\ ` ( )\n- `\\<TAB>` (TAB)\n\n{.cols-3 .marker-none}\n\n#### C\n\n- `\\0` (NUL)\n- `\\a` (BEL)\n- `\\b` (BS)\n- `\\f` (FF)\n- `\\n` (LF)\n- `\\r` (CR)\n- `\\t` (TAB)\n- `\\v` (VTAB)\n\n{.cols-3 .marker-none}\n\n#### Additional\n\n- `\\e` (ESC)\n- `\\_` (NBSP)\n- `\\N` (NEL)\n- `\\L` (LS)\n- `\\P` (PS)\n\n{.cols-3 .marker-none}\n\n### More types\n\n|          |                             |\n| -------- | --------------------------- |\n| `!!set`  | `{cherries, plums, apples}` |\n| `!!omap` | `[one: 1, two: 2]`          |\n\n### Language Independent Scalar Types {.col-span-2}\n\n|                           |                                            |\n| ------------------------- | ------------------------------------------ |\n| `{~, null}`               | Null (no value).                           |\n| `[1234, 0x4D2, 02333]`    | [Decimal int, Hexadecimal int, Octal int]  |\n| `[1_230.15, 12.3015e+02]` | [Fixed float, Exponential float]           |\n| `[.inf, -.Inf, .NAN]`     | [Infinity (float), Negative, Not a number] |\n| `{Y, true, Yes, ON}`      | Boolean true                               |\n| `{n, FALSE, No, off}`     | Boolean false                              |\n\n## Also see\n\n- [YAML Reference Card](https://yaml.org/refcard.html) _(yaml.org)_\n- [Learn X in Y minutes](https://learnxinyminutes.com/docs/yaml/) _(learnxinyminutes.com)_\n- [YAML lint online](http://www.yamllint.com/) _(yamllint.com)_\n"
  },
  {
    "path": "source/_posts/youtube.md",
    "content": "---\ntitle: YouTube\ndate: 2022-11-23 16:23:31.700304\nbackground: bg-[#e6332e]\nlabel:\ntags:\n  -\n  -\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 18 keyboard shortcuts found on YouTube.com\n---\n\n## Keyboard Shortcuts {.cols-2}\n\n### General I\n\n| Shortcut     | Action                                                                            |\n| ------------ | --------------------------------------------------------------------------------- |\n| `Space`      | Play/Pause when the seek bar is selected, activate a button if a button has focus |\n| `K`          | Play/Pause in player                                                              |\n| `Left/Right` | Seek backward/forward 5 seconds                                                   |\n| `J`          | Seek backward 10 seconds in player                                                |\n| `L`          | Seek forward 10 seconds in player                                                 |\n| `Home`       | Seek to the beginning of the video                                                |\n| `End`        | Seek to the last seconds of the video                                             |\n| `Up`         | Increase volume 5%                                                                |\n| `Down`       | Decrease volume 5%                                                                |\n| `1-9`        | Seek to the 10-90% of the video                                                   |\n\n{.shortcuts}\n\n### General II\n\n| Shortcut    | Action                                                      |\n| ----------- | ----------------------------------------------------------- |\n| `0`         | Seek to the beginning of the video                          |\n| `Shift` `1` | Move between H1 headers                                     |\n| `/`         | Go to search box                                            |\n| `F`         | Activate full screen, press again (or Esc) to exit          |\n| `C`         | Activate closed captions and subtitles, press again to hide |\n| `Shift` `N` | Move to the next video                                      |\n| `Shift` `P` | Move to the previous video                                  |\n| `I`         | Launch the Miniplayer                                       |\n| `.`         | Move forward a single frame (while paused)                  |\n| `,`         | Move back a single frame (while paused)                     |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for YouTube](https://support.google.com/youtube/answer/7631406?hl=en) _(support.google.com)_\n"
  },
  {
    "path": "source/_posts/zed.md",
    "content": "---\ntitle: Zed\ndate: 2025-04-20 19:30:23.390210907\nbackground: bg-[#3e4548]\nlabel:\ntags:\n  - text\n  - editor\n  - shortcut\ncategories:\n  - Keyboard Shortcuts\nintro: A visual cheat-sheet for the 50 keyboard shortcuts found in the Zed text editor.\n---\n\n## Keyboard Shortcuts\n\n### Zed\n\n| Shortcut           | Action                |\n| ------------------ | --------------------- |\n| `Ctrl` `,`         | Open settings         |\n| `Ctrl` `Shift` `X` | Open Extensions store |\n| `Ctrl` `Q`         | Quit Zed              |\n\n{.shortcuts}\n\n### File\n\n| Shortcut                 | Action             |\n| ------------------------ | ------------------ |\n| `Ctrl` `N`               | New file           |\n| `Ctrl` `Shift` `N`       | New Window         |\n| `Ctrl` `O`               | Open folder        |\n| `Ctrl` `Alt` `Shift` `O` | Open remote folder |\n| `Ctrl` `S`               | Save               |\n| `Ctrl` `Shift` `S`       | Save As...         |\n| `Ctrl` `Alt` `S`         | Save All           |\n| `Ctrl` `Shift` `W`       | Close Window       |\n\n{.shortcuts}\n\n### Edit\n\n| Shortcut           | Action              |\n| ------------------ | ------------------- |\n| `Ctrl` `Z`         | Undo                |\n| `Ctrl` `Shift` `Z` | Redo                |\n| `Ctrl` `X`         | Cut                 |\n| `Ctrl` `C`         | Copy                |\n| `Ctrl` `V`         | Paste               |\n| `Ctrl` `Shift` `F` | Find in project     |\n| `Ctrl` `/`         | Toggle line comment |\n\n{.shortcuts}\n\n### Selection\n\n| Shortcut              | Action                 |\n| --------------------- | ---------------------- |\n| `Ctrl` `A`            | Select all             |\n| `Alt` `Shift` `Right` | Expand selection       |\n| `Alt` `Shift` `Left`  | Shrink selection       |\n| `Alt` `Shift` `Up`    | Add cursor above       |\n| `Alt` `Shift` `Down`  | Add cursor below       |\n| `Ctrl` `Shift` `Down` | Select next Occurrence |\n| `Alt` `Up`            | Move line up           |\n| `Alt` `Down`          | Move line down         |\n| `Ctrl` `Shift` `D`    | Duplicate selection    |\n\n{.shortcuts}\n\n### View\n\n| Shortcut           | Action             |\n| ------------------ | ------------------ |\n| `Ctrl` `B`         | Toggle Left Dock   |\n| `Ctrl` `Alt` `B`   | Toggle Right Dock  |\n| `Ctrl` `J`         | Toggle Bottom Dock |\n| `Ctrl` `Alt` `Y`   | Close All Docks    |\n| `Ctrl` `K` `Up`    | Split Up           |\n| `Ctrl` `K` `Down`  | Split Down         |\n| `Ctrl` `K` `Left`  | Split Left         |\n| `Ctrl` `K` `Right` | Split Right        |\n| `Ctrl` `Shift` `E` | Project Panel      |\n| `Ctrl` `Shift` `B` | Outline Panel      |\n| `Ctrl` `Shift` `C` | Collab Panel       |\n| `Ctrl` `` ` ``     | Terminal Panel     |\n| `Ctrl` `Shift` `M` | Diagnostics        |\n\n{.shortcuts}\n\n### Go\n\n| Shortcut            | Action                  |\n| ------------------- | ----------------------- |\n| `Ctrl` `Alt` `-`    | Back                    |\n| `Ctrl` `Shift` `P`  | Command Palette…        |\n| `Ctrl` `E`          | Go to File…             |\n| `Ctrl` `Shift` `O`  | Go to Symbol in Editor… |\n| `Ctrl` `G`          | Go to Line/Column…      |\n| `F12`               | Go to Definition        |\n| `Ctrl` `F12`        | Go to Type Definition   |\n| `Alt` `Shift` `F12` | Find All References     |\n| `F8`                | Next Problem            |\n| `Shift` `F8`        | Previous Problem        |\n\n{.shortcuts}\n\n## Also see\n\n- [Zed](https://zed.dev/)\n- [Zed GitHub](https://github.com/zed-industries/zed)\n- [Zed Documentation](https://zed.dev/docs)\n"
  },
  {
    "path": "source/_posts/zoom.md",
    "content": "---\ntitle: Zoom\ndate: 2022-11-23 16:23:31.704621\nbackground: bg-[#2858ee]\ntags:\n  -\n  - mac\ncategories:\n  - Keyboard Shortcuts\nintro: |\n  A visual cheat-sheet for the 32 keyboard shortcuts found in Zoom. These shortcuts are for MacOS, for Windows visit /zoom-windows.\n---\n\n## Mac Keyboard Shortcuts {.cols-2}\n\n### Meetings I\n\n| Shortcut          | Action                                                              |\n| ----------------- | ------------------------------------------------------------------- |\n| `Cmd` `J`         | Join meeting                                                        |\n| `Cmd` `Ctrl` `V`  | Start meeting                                                       |\n| `Cmd` `J`         | Schedule meeting                                                    |\n| `Cmd` `Ctrl` `S`  | Screen share via direct share                                       |\n| `Cmd` `Shift` `A` | Mute or unmute audio                                                |\n| `Cmd` `Ctrl` `U`  | Mute audio for everyone except the host, only available to the host |\n| `Space`           | Push to talk                                                        |\n| `Cmd` `Shift` `V` | Start or stop video                                                 |\n| `Cmd` `Shift` `N` | Switch camera                                                       |\n| `Cmd` `Shift` `S` | Start or stop screen share                                          |\n| `Cmd` `Shift` `T` | Pause or resume screen share                                        |\n| `Cmd` `Shift` `R` | Start local recording                                               |\n| `Cmd` `Shift` `C` | Start cloud recording                                               |\n\n{.shortcuts}\n\n### Meetings II\n\n| Shortcut               | Action                                                                   |\n| ---------------------- | ------------------------------------------------------------------------ |\n| `Cmd` `Shift` `P`      | Pause or resume recording                                                |\n| `Cmd` `Shift` `W`      | Switch to active speaker view or gallery view, depending on current view |\n| `Ctrl` `P`             | View previous 25 participants in gallery view                            |\n| `Ctrl` `N`             | View next 25 participants in gallery view                                |\n| `Cmd` `U`              | Display or hide participants panel                                       |\n| `Cmd` `Shift` `H`      | Show or hide in-meeting chat panel                                       |\n| `Cmd` `I`              | Open invite window                                                       |\n| `Opt` `Y`              | Raise hand or lower hand                                                 |\n| `Ctrl` `Shift` `R`     | Gain remote control                                                      |\n| `Ctrl` `Shift` `G`     | Stop remote control                                                      |\n| `Cmd` `Shift` `F`      | Enter or exit full screen                                                |\n| `Cmd` `Shift` `M`      | Switch to minimal window                                                 |\n| `Ctrl` `Opt` `Cmd` `H` | Show or hide meeting controls                                            |\n| `Cmd` `W`              | Prompt to end or leave meeting                                           |\n\n{.shortcuts}\n\n### Chat Shortcuts\n\n| Shortcut  | Action                    |\n| --------- | ------------------------- |\n| `Cmd` `K` | Jump to chat with someone |\n| `Cmd` `T` | Screenshot                |\n\n{.shortcuts}\n\n### General Shortcuts\n\n| Shortcut   | Action                                                          |\n| ---------- | --------------------------------------------------------------- |\n| `Cmd` `W`  | Close the current window                                        |\n| `Cmd` `L`  | Switch to portrait or landscape view, depending on current view |\n| `Ctrl` `T` | Switch from one tab to the next                                 |\n\n{.shortcuts}\n\n## Windows Keyboard Shortcuts {.cols-2}\n\n### All Shortcuts II\n\n| Shortcut             | Action                                                                            |\n| -------------------- | --------------------------------------------------------------------------------- |\n| `F6`                 | Navigate among Zoom popup windows                                                 |\n| `Ctrl` `Alt` `Shift` | Move focus to Zoom's meeting controls                                             |\n| `PgUp`               | View previous 25 video stream in gallery view                                     |\n| `PgDn`               | View next 25 video stream in gallery view                                         |\n| `Alt` `F1`           | Switch to active speaker view in video meeting                                    |\n| `Alt` `F2`           | Switch to gallery video view in video meeting                                     |\n| `Alt` `F4`           | Close the current window                                                          |\n| `Alt` `V`            | Start or stop video                                                               |\n| `Alt` `A`            | Mute or unmute audio                                                              |\n| `Alt` `M`            | Mute or unmute audio for everyone except host, available to the meeting host only |\n| `Alt` `S`            | Launch share screen window and stop screen share                                  |\n| `Alt` `Shift` `S`    | Start or stop new screen share                                                    |\n| `Alt` `T`            | Pause or resume screen share                                                      |\n| `Alt` `R`            | Start or stop local recording                                                     |\n| `Alt` `C`            | Start or stop cloud recording                                                     |\n| `Alt` `P`            | Pause or resume recording                                                         |\n| `Alt` `N`            | Switch camera                                                                     |\n| `Alt` `F`            | Enter or exit full screen                                                         |\n\n{.shortcuts}\n\n### All Shortcuts II\n\n| Shortcut                 | Action                                 |\n| ------------------------ | -------------------------------------- |\n| `Alt` `F`                | Enter or exit full screen              |\n| `Alt` `H`                | Display or hide in-meeting chat panel  |\n| `Alt` `U`                | Display or hide participants panel     |\n| `Alt` `I`                | Open invite window                     |\n| `Alt` `Y`                | Raise or lower hand                    |\n| `Alt` `Shift` `R`        | Gain remote control                    |\n| `Alt` `Shift` `G`        | Stop remote control                    |\n| `Ctrl` `2`               | Read active speaker name               |\n| `Ctrl` `Alt` `Shift` `H` | Show or hide floating meeting controls |\n| `Alt` `Shift` `T`        | Screenshot                             |\n| `Alt` `L`                | Switch to portrait or landscape view   |\n| `Ctrl` `W`               | Close current chat session             |\n| `Ctrl` `Up`              | Go to previous chat                    |\n| `Ctrl` `Down`            | Go to next chat                        |\n| `Ctrl` `T`               | Jump to chat with someone              |\n| `Ctrl` `F`               | Search                                 |\n| `Ctrl` `Tab`             | Move to the next tab                   |\n| `Ctrl` `Shift` `Tab`     | Move to the previous tab               |\n\n{.shortcuts}\n\n## Also see\n\n- [Keyboard shortcuts for Zoom on MacOS](https://support.zoom.us/hc/en-us/articles/205683899-Hot-Keys-and-Keyboard-Shortcuts-for-Zoom)\n  _(support.zoom.us)_\n- [Keyboard shortcuts for Zoom on Windows](https://support.zoom.us/hc/en-us/articles/205683899-Hot-Keys-and-Keyboard-Shortcuts-for-Zoom)\n  _(support.zoom.us)_\n"
  },
  {
    "path": "source/about/index.md",
    "content": "---\ntitle: About\ndate: 2020-03-26 20:45:53\n---\n\nWelcome to [CheatSheets] – your go-to resource for [describing content]. Designed with\n[developers/students/professionals] in mind, our quick reference provides a comprehensive collection of\n[topics/sections] to help you [solve problems/learn efficiently/etc.].\n\nOur user-friendly interface ensures rapid access to the information you need. Whether you're [coding/studying/working],\nyou'll find [specific benefits or standout features].\n\nKey Features:\n\n- Users can grasp essential concepts or instructions in a short period, making cheat sheets ideal for learning on the\n  go.\n- By offering quick access to frequently used information, cheat sheets boost productivity by reducing the need to\n  search or look up details repeatedly.\n- Cheat sheets often organize information in a structured format, making it easier for users to follow steps or\n  understand relationships between concepts.\n- Quality cheat sheets are often updated to reflect the latest information, ensuring accuracy and relevance.\n- Cheat sheets can be used as study aids, helping learners memorize key information, formulas, or concepts.\n- In programming or technical fields, cheat sheets offer quick syntax references, ensuring proper code usage.\n- By avoiding the need to seek through lengthy documentation, cheat sheets save users valuable time during tasks or\n  learning.\n- Digital cheat sheets are easily searchable, and users can quickly find what they need by using keywords or phrases.\n- Cheat sheets act as a rapid review tool, allowing users to refresh their memory on topics they've previously learned.\n\nOur team of experts has meticulously crafted this reference to provide instant information. We're committed to evolving\nour content to meet your needs and bring out fascinating upgrades in the future.\n\nStart exploring now and make [https://cheatsheets.zip] your trusted companion in [area/topic]!!\n\nHave feedback or suggestions? Reach out to us at [https://twitter.com/FechinLi].\n"
  },
  {
    "path": "source/assets/page/oops.htm",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <title>404 Page NotFound</title>\n    <link href=\"https://fonts.googleapis.com/css?family=Quicksand:700\" rel=\"stylesheet\" />\n    <style>\n      * {\n        -webkit-box-sizing: border-box;\n        box-sizing: border-box;\n      }\n\n      body {\n        padding: 0;\n        margin: 0;\n      }\n\n      #notfound {\n        position: relative;\n        height: 100vh;\n        background-color: #fafbfd;\n      }\n\n      #notfound .notfound {\n        position: absolute;\n        left: 50%;\n        top: 50%;\n        -webkit-transform: translate(-50%, -50%);\n        -ms-transform: translate(-50%, -50%);\n        transform: translate(-50%, -50%);\n      }\n\n      .notfound {\n        max-width: 520px;\n        width: 100%;\n        text-align: center;\n      }\n\n      .notfound .notfound-bg {\n        position: absolute;\n        left: 0px;\n        right: 0px;\n        top: 50%;\n        -webkit-transform: translateY(-50%);\n        -ms-transform: translateY(-50%);\n        transform: translateY(-50%);\n        z-index: -1;\n      }\n\n      .notfound .notfound-bg > div {\n        width: 100%;\n        background: #fff;\n        border-radius: 90px;\n        height: 125px;\n      }\n\n      .notfound .notfound-bg > div:nth-child(1) {\n        -webkit-box-shadow: 5px 5px 0px 0px #f3f3f3;\n        box-shadow: 5px 5px 0px 0px #f3f3f3;\n      }\n\n      .notfound .notfound-bg > div:nth-child(2) {\n        -webkit-transform: scale(1.3);\n        -ms-transform: scale(1.3);\n        transform: scale(1.3);\n        -webkit-box-shadow: 5px 5px 0px 0px #f3f3f3;\n        box-shadow: 5px 5px 0px 0px #f3f3f3;\n        position: relative;\n        z-index: 10;\n      }\n\n      .notfound .notfound-bg > div:nth-child(3) {\n        -webkit-box-shadow: 5px 5px 0px 0px #f3f3f3;\n        box-shadow: 5px 5px 0px 0px #f3f3f3;\n        position: relative;\n        z-index: 90;\n      }\n\n      .notfound h1 {\n        font-family: 'Quicksand', sans-serif;\n        font-size: 86px;\n        text-transform: uppercase;\n        font-weight: 700;\n        margin-top: 0;\n        margin-bottom: 8px;\n        color: #4d4d4d;\n      }\n\n      .notfound h2 {\n        font-family: 'Quicksand', sans-serif;\n        font-size: 26px;\n        margin: 0;\n        font-weight: 700;\n        color: #4d4d4d;\n      }\n\n      .notfound a {\n        font-family: 'Quicksand', sans-serif;\n        font-size: 14px;\n        text-decoration: none;\n        text-transform: uppercase;\n        background: #23b883;\n        display: inline-block;\n        padding: 15px 30px;\n        border-radius: 5px;\n        color: #fff;\n        font-weight: 700;\n        margin-top: 20px;\n      }\n\n      .notfound-social {\n        margin-top: 20px;\n      }\n\n      .notfound-social > a {\n        display: inline-block;\n        height: 40px;\n        line-height: 40px;\n        width: 40px;\n        font-size: 14px;\n        color: #fff;\n        background-color: #dedede;\n        margin: 3px;\n        padding: 0px;\n        -webkit-transition: 0.2s all;\n        transition: 0.2s all;\n      }\n\n      .notfound-social > a:hover {\n        background-color: #18e06f;\n      }\n\n      @media only screen and (max-width: 767px) {\n        .notfound .notfound-bg {\n          width: 287px;\n          margin: auto;\n        }\n\n        .notfound .notfound-bg > div {\n          height: 85px;\n        }\n      }\n\n      @media only screen and (max-width: 480px) {\n        .notfound h1 {\n          font-size: 68px;\n        }\n\n        .notfound h2 {\n          font-size: 18px;\n        }\n      }\n    </style>\n  </head>\n  <body>\n    <div id=\"notfound\">\n      <div class=\"notfound\">\n        <div class=\"notfound-bg\">\n          <div></div>\n          <div></div>\n          <div></div>\n        </div>\n        <h1>oops!</h1>\n        <h2>Error 404 : Page Not Found</h2>\n        <a href=\"https://cheatsheets.zip\">go back</a>\n      </div>\n    </div>\n  </body>\n</html>\n"
  },
  {
    "path": "source/ga_analytics_tops.json",
    "content": "[\n  {\n    \"icon\": \"icon-python\",\n    \"title\": \"Python\",\n    \"path\": \"python.html\",\n    \"background\": \"bg-[#436b97]\"\n  },\n  {\n    \"icon\": \"icon-vim\",\n    \"title\": \"Vim\",\n    \"path\": \"vim.html\",\n    \"background\": \"bg-[#46933f]\"\n  },\n  {\n    \"icon\": \"icon-javascript\",\n    \"title\": \"JavaScript\",\n    \"path\": \"javascript.html\",\n    \"background\": \"bg-[#ebd94e]\"\n  },\n  {\n    \"icon\": \"icon-bash\",\n    \"title\": \"Bash\",\n    \"path\": \"bash.html\",\n    \"background\": \"bg-[#3e4548]\"\n  },\n  {\n    \"icon\": \"icon-regex\",\n    \"title\": \"RegEX\",\n    \"path\": \"regex.html\",\n    \"background\": \"bg-[#e56d2d]\"\n  },\n  {\n    \"icon\": \"icon-sed\",\n    \"title\": \"Sed\",\n    \"path\": \"sed.html\",\n    \"background\": \"bg-red-400\"\n  },\n  {\n    \"icon\": \"icon-golang\",\n    \"title\": \"Golang\",\n    \"path\": \"golang.html\",\n    \"background\": \"bg-[#4ba4cc]\"\n  },\n  {\n    \"icon\": \"icon-html\",\n    \"title\": \"HTML\",\n    \"path\": \"html.html\",\n    \"background\": \"bg-[#cc5534]\"\n  },\n  {\n    \"icon\": \"icon-java\",\n    \"title\": \"Java\",\n    \"path\": \"java.html\",\n    \"background\": \"bg-[#d33731]\"\n  },\n  {\n    \"icon\": \"icon-postgres\",\n    \"title\": \"PostgreSQL\",\n    \"path\": \"postgres.html\",\n    \"background\": \"bg-[#3d6488]\"\n  },\n  {\n    \"icon\": \"icon-vhdl\",\n    \"title\": \"VHDL\",\n    \"path\": \"vhdl.html\",\n    \"background\": \"bg-[#5c4a7a]\"\n  }\n]\n"
  },
  {
    "path": "source/manifest.json",
    "content": "{\n  \"name\": \"CheatSheets.zip - Ultimate Cheat Sheets for Developers\",\n  \"short_name\": \"CheatSheets\",\n  \"description\": \"Share quick reference and cheat sheet for developers\",\n  \"start_url\": \"/\",\n  \"display\": \"standalone\",\n  \"background_color\": \"#ffffff\",\n  \"theme_color\": \"#6366f1\",\n  \"orientation\": \"portrait-primary\",\n  \"scope\": \"/\",\n  \"lang\": \"en\",\n  \"categories\": [\"productivity\", \"developer\", \"reference\"],\n  \"icons\": [\n    {\n      \"src\": \"/assets/logo/icon-72x72.png\",\n      \"sizes\": \"72x72\",\n      \"type\": \"image/png\",\n      \"purpose\": \"maskable any\"\n    },\n    {\n      \"src\": \"/assets/logo/icon-96x96.png\",\n      \"sizes\": \"96x96\",\n      \"type\": \"image/png\",\n      \"purpose\": \"maskable any\"\n    },\n    {\n      \"src\": \"/assets/logo/icon-128x128.png\",\n      \"sizes\": \"128x128\",\n      \"type\": \"image/png\",\n      \"purpose\": \"maskable any\"\n    },\n    {\n      \"src\": \"/assets/logo/icon-144x144.png\",\n      \"sizes\": \"144x144\",\n      \"type\": \"image/png\",\n      \"purpose\": \"maskable any\"\n    },\n    {\n      \"src\": \"/assets/logo/icon-152x152.png\",\n      \"sizes\": \"152x152\",\n      \"type\": \"image/png\",\n      \"purpose\": \"maskable any\"\n    },\n    {\n      \"src\": \"/assets/logo/icon-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\",\n      \"purpose\": \"maskable any\"\n    },\n    {\n      \"src\": \"/assets/logo/icon-384x384.png\",\n      \"sizes\": \"384x384\",\n      \"type\": \"image/png\",\n      \"purpose\": \"maskable any\"\n    },\n    {\n      \"src\": \"/assets/logo/icon-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\",\n      \"purpose\": \"maskable any\"\n    }\n  ],\n  \"screenshots\": [\n    {\n      \"src\": \"/assets/screenshots/desktop-1280x720.png\",\n      \"sizes\": \"1280x720\",\n      \"type\": \"image/png\",\n      \"form_factor\": \"wide\",\n      \"label\": \"Desktop view of CheatSheets.zip\"\n    },\n    {\n      \"src\": \"/assets/screenshots/mobile-390x844.png\",\n      \"sizes\": \"390x844\",\n      \"type\": \"image/png\",\n      \"form_factor\": \"narrow\",\n      \"label\": \"Mobile view of CheatSheets.zip\"\n    }\n  ],\n  \"shortcuts\": [\n    {\n      \"name\": \"Search Cheat Sheets\",\n      \"short_name\": \"Search\",\n      \"description\": \"Quickly search through all cheat sheets\",\n      \"url\": \"/?q=\",\n      \"icons\": [\n        {\n          \"src\": \"/assets/logo/icon-96x96.png\",\n          \"sizes\": \"96x96\"\n        }\n      ]\n    },\n    {\n      \"name\": \"Popular Cheat Sheets\",\n      \"short_name\": \"Popular\",\n      \"description\": \"View most popular cheat sheets\",\n      \"url\": \"/#popular\",\n      \"icons\": [\n        {\n          \"src\": \"/assets/logo/icon-96x96.png\",\n          \"sizes\": \"96x96\"\n        }\n      ]\n    }\n  ]\n}\n"
  },
  {
    "path": "source/notes/index.md",
    "content": "---\ntitle: List all notes\nlayout: notes\ndate: 2021-09-02 18:03:45\n---\n"
  },
  {
    "path": "source/privacy/index.md",
    "content": "---\ntitle: Privacy policy\ndate: 2020-03-26 20:46:04\n---\n\nComing soon~\n"
  },
  {
    "path": "source/robots.txt",
    "content": "User-agent: *\nAllow: /\n\nSitemap: https://cheatsheets.zip/sitemap.xml\n"
  },
  {
    "path": "source/sponsor/index.md",
    "content": "---\ntitle: Sponsor\ndate: 2021-12-11 14:37:13\nintro: |\n  We appreciate your help in order to pay for the hosting fees and ensuring I can spend enough time to create and optimize the cheatsheet webpage.\n---\n\n## Sponsor\n\n### Become a sponsor\n\n<div class=\"flex justify-center w-full py-5\">\n    <a class=\"flex items-center w-3/5 px-4 py-3 rounded-xl bg-[#2f6eb4]\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\" href=\"https://paypal.me/fechinmr\">\n        <svg class=\"icon\" style=\"width:26px;vertical-align:middle;fill:currentColor;overflow:hidden\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"6144\"><path d=\"M841.813333 253.269333c-.938667 5.888-2.005333 11.946667-3.2 18.176-40.576 209.749333-179.498667 282.24-356.864 282.24H391.424a43.946667 43.946667 0 0 0-43.349333 37.376l-46.250667 295.210667-13.098667 83.626667a23.338667 23.338667 0 0 0 22.784 26.88h160.213334a38.613333 38.613333 0 0 0 38.058666-32.682667l1.578667-8.192 30.165333-192.64 1.962667-10.538667a38.613333 38.613333 0 0 1 38.058667-32.768h23.936c155.221333 0 276.736-63.445333 312.234666-246.954666 14.848-76.672 7.168-140.714667-32.085333-185.728a153.301333 153.301333 0 0 0-43.861333-34.005334z\" fill=\"#179BD7\" p-id=\"6145\"></path><path d=\"M799.317333 236.202667a318.464 318.464 0 0 0-39.509333-8.789334 498.474667 498.474667 0 0 0-79.616-5.845333h-241.28a38.528 38.528 0 0 0-38.058667 32.768L349.525333 581.546667l-1.450666 9.514666a43.946667 43.946667 0 0 1 43.349333-37.376h90.325333c177.365333 0 316.288-72.533333 356.864-282.24 1.237333-6.229333 2.261333-12.288 3.157334-18.176a215.68 215.68 0 0 0-42.453334-17.066666z\" fill=\"#222D65\" p-id=\"6146\" data-spm-anchor-id=\"a313x.7781069.0.i0\" class=\"\"></path><path d=\"M400.853333 254.293333a38.442667 38.442667 0 0 1 38.058667-32.725333h241.28c28.586667 0 55.296 1.877333 79.616 5.845333 16.512 2.602667 32.768 6.528 48.64 11.690667 11.946667 3.968 23.082667 8.704 33.365333 14.165333 12.074667-77.525333-.085333-130.304-41.770666-178.133333C754.133333 22.528 671.274667 0 565.248 0H257.365333c-21.632 0-40.106667 15.872-43.477333 37.418667L85.674667 855.466667a26.752 26.752 0 0 0 5.973333 21.461333c5.034667 5.888 12.373333 9.301333 20.096 9.344h190.08l47.701333-304.725333 51.328-327.253334z\" fill=\"#253B80\" p-id=\"6147\"></path></svg>\n        <span class=\"ml-3 text-white text-xl font-semibold leading-none\">via PayPal</span>\n    </a>\n</div>\n<div class=\"flex justify-center w-full pb-5\">\n    <a href=\"https://www.buymeacoffee.com/randy8080\" class=\"flex items-center w-3/5 px-4 py-1.5 rounded-xl bg-[#90d4b7] line-through decoration-pink-500\">\n        <svg width=\"26\" viewBox=\"0 0 25 35\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M22.0672 8.1281 22.0437 8.11426 21.9893 8.09766C22.0112 8.11614 22.0386 8.12685 22.0672 8.1281Z\" fill=\"black\"></path><path d=\"M22.4111 10.5781 22.3848 10.5855 22.4111 10.5781Z\" fill=\"black\"></path><path d=\"M22.0735 8.11128C22.0708 8.11093 22.0681 8.11029 22.0655 8.10938 22.0654 8.11115 22.0654 8.11293 22.0655 8.1147 22.0685 8.11432 22.0712 8.11313 22.0735 8.11128Z\" fill=\"black\"></path><path d=\"M22.3877 10.5647 22.4274 10.5421 22.4421 10.5338 22.4555 10.5195C22.4303 10.5304 22.4074 10.5457 22.3877 10.5647Z\" fill=\"black\"></path><path d=\"M22.1334 8.1762 22.0947 8.1393 22.0684 8.125C22.0825 8.14993 22.1058 8.16832 22.1334 8.1762Z\" fill=\"black\"></path><path d=\"M12.3836 31.9453C12.3526 31.9587 12.3255 31.9796 12.3047 32.0062L12.3291 31.9905C12.3457 31.9753 12.3693 31.9573 12.3836 31.9453Z\" fill=\"black\"></path><path d=\"M18.0497 30.8309C18.0497 30.7958 18.0326 30.8023 18.0368 30.9268 18.0368 30.9167 18.0409 30.9065 18.0428 30.8969 18.0451 30.8747 18.0469 30.853 18.0497 30.8309Z\" fill=\"black\"></path><path d=\"M17.4617 31.9453C17.4307 31.9587 17.4036 31.9796 17.3828 32.0062L17.4073 31.9905C17.4239 31.9753 17.4474 31.9573 17.4617 31.9453Z\" fill=\"black\"></path><path d=\"M8.39845 32.2145C8.37496 32.1941 8.34619 32.1807 8.31543 32.1758 8.34034 32.1878 8.36524 32.1998 8.38185 32.209L8.39845 32.2145Z\" fill=\"black\"></path><path d=\"M7.50541 31.3533C7.50173 31.317 7.49058 31.2818 7.47266 31.25 7.48535 31.2831 7.49598 31.317 7.50448 31.3515L7.50541 31.3533Z\" fill=\"black\"></path><path d=\"M13.5278 15.9814C12.2963 16.5086 10.8987 17.1064 9.08736 17.1064 8.32963 17.1048 7.57558 17.0009 6.8457 16.7973L8.09845 29.6592C8.14279 30.1968 8.38769 30.698 8.78452 31.0634 9.18134 31.4288 9.70106 31.6316 10.2405 31.6315 10.2405 31.6315 12.0167 31.7237 12.6094 31.7237 13.2474 31.7237 15.1601 31.6315 15.1601 31.6315 15.6995 31.6315 16.2191 31.4286 16.6158 31.0633 17.0125 30.6979 17.2574 30.1967 17.3017 29.6592L18.6435 15.4463C18.0439 15.2415 17.4387 15.1055 16.7565 15.1055 15.5767 15.105 14.626 15.5114 13.5278 15.9814Z\" fill=\"#FFDD00\"></path><path d=\"M2.96582 10.5039 2.98704 10.5237 3.00088 10.532C2.99022 10.5215 2.97847 10.512 2.96582 10.5039Z\" fill=\"black\"></path><path d=\"M24.4376 9.31226 24.249 8.36071C24.0797 7.50694 23.6955 6.70022 22.8191 6.39164 22.5382 6.29294 22.2195 6.2505 22.0041 6.04617 21.7887 5.84184 21.725 5.5245 21.6752 5.23023 21.583 4.6901 21.4963 4.14952 21.4017 3.61033 21.3201 3.14677 21.2555 2.62602 21.0428 2.20075 20.7661 1.62973 20.1918 1.29579 19.6208 1.07485 19.3282.965622 19.0296.873222 18.7265.798101 17.2998.421723 15.7999.283349 14.3322.204476 12.5705.107269 10.8042.136556 9.04673.292113 7.73863.411114 6.36089.555024 5.11783 1.00751 4.6635 1.1731 4.19533 1.37189 3.84986 1.7229 3.42597 2.15417 3.2876 2.82113 3.5971 3.35894 3.81711 3.74086 4.1898 4.01069 4.58509 4.18919 5.09997 4.41919 5.63769 4.5942 6.18931 4.71132 7.72526 5.0508 9.3161 5.1841 10.8853 5.24083 12.6245 5.31103 14.3665 5.25414 16.0974 5.07063 16.5254 5.02359 16.9527 4.96716 17.3792 4.90136 17.8815 4.82433 18.2039 4.16751 18.0558 3.70995 17.8787 3.16292 17.4027 2.95074 16.8644 3.0333 16.7851 3.04576 16.7062 3.05729 16.6269 3.06882L16.5697 3.07712C16.3873 3.10019 16.205 3.12171 16.0226 3.1417 15.646 3.18229 15.2683 3.2155 14.8898 3.24133 14.042 3.30037 13.192 3.32758 12.3423 3.32896 11.5075 3.32896 10.6722 3.30544 9.83916 3.25055 9.45909 3.22564 9.07994 3.19397 8.70172 3.15553 8.52967 3.13755 8.35809 3.11864 8.18651 3.09742L8.02322 3.07666 7.98771 3.07159 7.81843 3.04714C7.4725 2.99502 7.12656 2.93506 6.78431 2.86264 6.74978 2.85498 6.71889 2.83577 6.69675 2.80818 6.67461 2.78059 6.66254 2.74627 6.66254 2.71089 6.66254 2.67552 6.67461 2.6412 6.69675 2.61361 6.71889 2.58602 6.74978 2.5668 6.78431 2.55914H6.79077C7.08735 2.49595 7.38624 2.44199 7.68605 2.39494 7.78599 2.37926 7.88623 2.36388 7.98679 2.34881H7.98955C8.17728 2.33636 8.36593 2.30269 8.55274 2.28055 10.178 2.11149 11.813 2.05386 13.4461 2.10804 14.239 2.13111 15.0314 2.17769 15.8206 2.25795 15.9903 2.27548 16.1592 2.29393 16.328 2.31468 16.3926 2.32252 16.4576 2.33175 16.5226 2.33959L16.6536 2.3585C17.0355 2.41539 17.4154 2.48442 17.7934 2.5656 18.3533 2.68737 19.0724 2.72704 19.3215 3.3405 19.4008 3.53514 19.4368 3.75147 19.4806 3.9558L19.5364 4.2164C19.5379 4.22108 19.5389 4.22586 19.5396 4.2307 19.6716 4.8457 19.8036 5.46069 19.9359 6.07569 19.9455 6.12112 19.9458 6.16806 19.9365 6.21359 19.9273 6.25911 19.9087 6.30224 19.8821 6.34028 19.8554 6.37832 19.8212 6.41046 19.7816 6.4347 19.7419 6.45893 19.6977 6.47474 19.6517 6.48113H19.648L19.5673 6.4922 19.4875 6.50281C19.2348 6.53571 18.9817 6.56646 18.7283 6.59506 18.2292 6.65194 17.7294 6.70114 17.2288 6.74265 16.234 6.82537 15.2373 6.87965 14.2385 6.90548 13.7296 6.919 13.2209 6.92531 12.7123 6.92439 10.6878 6.92279 8.66519 6.80513 6.65424 6.57199 6.43653 6.54616 6.21883 6.51849 6.00112 6.49035 6.16993 6.51203 5.87843 6.47375 5.81939 6.46545 5.68101 6.44607 5.54264 6.42593 5.40426 6.40502 4.93979 6.33537 4.47808 6.24958 4.01453 6.1744 3.45411 6.08215 2.91814 6.12827 2.41123 6.40502 1.99513 6.63272 1.65836 6.98188 1.44584 7.40593 1.22721 7.85795 1.16217 8.3501 1.06439 8.8358.966604 9.32149.814392 9.84408.872048 10.3427.996123 11.4188 1.74842 12.2933 2.8305 12.4889 3.84848 12.6734 4.87198 12.8228 5.89826 12.9501 9.9297 13.4439 14.0025 13.5029 18.0466 13.1263 18.3759 13.0956 18.7048 13.062 19.0332 13.0258 19.1358 13.0145 19.2396 13.0263 19.337 13.0604 19.4344 13.0944 19.523 13.1498 19.5962 13.2225 19.6694 13.2952 19.7255 13.3834 19.7602 13.4805 19.795 13.5777 19.8075 13.6814 19.797 13.7841L19.6946 14.7794C19.4883 16.7908 19.282 18.802 19.0756 20.813 18.8604 22.9249 18.6437 25.0366 18.4257 27.1482 18.3642 27.7429 18.3027 28.3375 18.2412 28.9319 18.1822 29.5172 18.1739 30.121 18.0627 30.6994 17.8875 31.609 17.2717 32.1675 16.3732 32.3719 15.55 32.5592 14.7091 32.6575 13.8649 32.6652 12.929 32.6703 11.9936 32.6288 11.0578 32.6338 10.0587 32.6394 8.83502 32.5471 8.06381 31.8036 7.38624 31.1505 7.29261 30.1279 7.20036 29.2437 7.07736 28.073 6.95544 26.9025 6.83459 25.7322L6.15656 19.2245 5.71791 15.0137C5.71053 14.9441 5.70315 14.8754 5.69623 14.8053 5.64365 14.303 5.28803 13.8113 4.72761 13.8366 4.24792 13.8579 3.70272 14.2656 3.759 14.8053L4.08417 17.927 4.75667 24.3844C4.94824 26.2187 5.13935 28.0532 5.33 29.888 5.3669 30.2395 5.40149 30.5919 5.44024 30.9434 5.65103 32.864 7.11779 33.899 8.93419 34.1906 9.99506 34.3612 11.0818 34.3963 12.1583 34.4138 13.5384 34.4359 14.9322 34.489 16.2897 34.239 18.3012 33.87 19.8104 32.5268 20.0258 30.4434 20.0873 29.8419 20.1488 29.2403 20.2103 28.6385 20.4148 26.6484 20.619 24.6581 20.8228 22.6677L21.4898 16.1641 21.7956 13.1835C21.8108 13.0357 21.8733 12.8968 21.9736 12.7872 22.0739 12.6776 22.2069 12.6033 22.3528 12.5751 22.928 12.463 23.4778 12.2716 23.8869 11.8339 24.5382 11.137 24.6678 10.2283 24.4376 9.31226ZM2.80098 9.95524C2.80975 9.95109 2.7936 10.0263 2.78669 10.0613 2.7853 10.0083 2.78807 9.96124 2.80098 9.95524ZM2.8568 10.387C2.86141 10.3837 2.87524 10.4022 2.88954 10.4243 2.86786 10.404 2.85403 10.3888 2.85633 10.387H2.8568ZM2.91168 10.4594C2.93152 10.4931 2.94213 10.5143 2.91168 10.4594V10.4594ZM3.02192 10.5489H3.02469C3.02469 10.5521 3.02976 10.5553 3.03161 10.5586 3.02855 10.555 3.02515 10.5518 3.02146 10.5489H3.02192ZM22.326 10.4151C22.1194 10.6116 21.8081 10.7029 21.5004 10.7486 18.0503 11.2606 14.5499 11.5198 11.0619 11.4054 8.56565 11.3201 6.09567 11.0429 3.62431 10.6937 3.38215 10.6596 3.11971 10.6153 2.9532 10.4368 2.63955 10.1001 2.7936 9.42204 2.87524 9.01522 2.94997 8.64253 3.09295 8.14577 3.53621 8.09272 4.22808 8.01155 5.03158 8.30352 5.71607 8.4073 6.54016 8.53306 7.36733 8.63377 8.19758 8.70941 11.7409 9.03229 15.3437 8.98201 18.8713 8.50969 19.5143 8.42329 20.1549 8.32289 20.7933 8.2085 21.362 8.10656 21.9926 7.91515 22.3362 8.50416 22.5719 8.90544 22.6033 9.44233 22.5668 9.89574 22.5556 10.0933 22.4693 10.2791 22.3256 10.4151H22.326Z\" fill=\"black\"></path></svg>\n        <span class=\"ml-3 text-white text-xl font-semibold leading-none\">Buy me a coffee</span>\n    </a>\n</div>\n\n### Support with Crypto {.col-span-2}\n\n<div class=\"row-span-3 dark:text-slate-300 p-4\">\n    <p>I'm a crypto enthusiast, and these are just a few wallet addresses. If you'd like, I can send you an address to a token or asset of your choice. I'm always happy to receive and learn about a new one!</p>\n    <div class=\"flex items-center mt-3\">\n        <svg class=\"icon mr-2\" style=\"width: 30px;vertical-align: middle;fill: currentColor;overflow: hidden;\" viewBox=\"0 0 1029 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"6488\"><path d=\"M1024.727025 511.98976c0 282.771945-229.217816 511.98976-511.98976 511.98976-282.766825 0-511.98976-229.217816-511.98976-511.98976 0-282.766825 229.222936-511.98976 511.98976-511.98976 282.771945 0 511.98976 229.222936 511.98976 511.98976\" fill=\"#F7931A\" p-id=\"6489\"></path><path d=\"M637.048379 661.623888a55.842723 55.842723 0 0 1-27.145697 33.417571 55.858083 55.858083 0 0 1-42.827943 4.444071l-144.181437-42.940581 32.122238-107.840403 144.171196 42.945701h0.00512c29.726125 8.852303 46.713946 40.242395 37.856523 69.973641m48.628787-221.00038a55.929761 55.929761 0 0 1 4.438952 42.833063c-8.857423 29.721006-40.262875 46.698586-69.973641 37.861643h-0.00512l-144.176316-42.940582 32.111998-107.840403 144.181436 42.940581a55.888802 55.888802 0 0 1 33.422691 27.145698m64.54143-34.917702c-16.48095-30.458271-43.836563-52.678626-77.01862-62.560029l-19.076738-5.677966 26.705385-89.669887-68.519589-20.407912-26.705386 89.669887-58.49995-17.423012 26.710506-89.669886-16.414392-4.889503-66.49723-19.803763-25.742845 86.434111-81.037739-24.135197-22.870583 76.798464 81.037739 24.140317-83.254655 279.536169-81.037739-24.135197-22.870583 76.803584 81.03262 24.130077-21.723726 72.953421 16.409272 4.889502 66.49723 19.803764 22.691386-76.189196 58.638188 17.463971-22.691387 76.194316 68.243116 20.325993 22.691386-76.194316 19.209856 5.718926a130.255315 130.255315 0 0 0 37.185816 5.452691c21.247575 0 42.295474-5.278614 61.51045-15.677127 30.458271-16.48095 52.673507-43.831443 62.560028-77.023739 10.393392-34.912582 5.263255-70.777464-11.268894-100.298794 30.01284-15.661767 53.927881-42.935461 64.331513-77.863403 9.886522-33.192296 6.251395-68.243115-10.224435-98.696266\" fill=\"#FFFFFF\" p-id=\"6490\"></path></svg>\n        <span>3AJidvmhz8Soe4fnMU3HV8hZRm261PraAj</span>\n    </div>\n    <div class=\"flex items-center mt-3\">\n        <svg class=\"icon mr-2\" style=\"width: 30px;vertical-align: middle;fill: currentColor;overflow: hidden;\" viewBox=\"0 0 1029 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"9557\"><path d=\"M1028.653987 511.98976c0 282.771945-229.222936 511.98976-511.98976 511.98976-282.761705 0-511.98976-229.217816-511.98976-511.98976 0-282.766825 229.228055-511.98976 511.98976-511.98976 282.766825 0 511.98976 229.222936 511.98976 511.98976\" fill=\"#497391\" p-id=\"9558\"></path><path d=\"M289.970521 575.430411l219.602648-452.358312v567.95536zM743.368173 575.430411l-220.380873 115.597048V122.918502zM289.970521 591.97792l219.602648 109.954921v176.810544zM743.368173 591.97792l-220.380873 286.765465v-176.810544z\" fill=\"#FFFFFF\" p-id=\"9559\"></path></svg>\n        <span>0x38415CEb0215b69cF67f6750cf69c2c9b609873a</span>\n    </div>\n    <div class=\"flex items-center mt-3\">\n        <a class=\"text-blue-500\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\" href=\"https://twitter.com/FechinLi\">Request more...</a>\n    </div>\n</div>\n\n### Sponsors {.col-span-3}\n\n| Name             | Amount  | Message                                                                                                                        |\n| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ |\n| Benjamin Schröer | $ 9.34  | Thanks for cheatsheets.zip!                                                                                                    |\n| Fabian Barajas   | $ 10.00 |                                                                                                                                |\n| [Anonymous]      | $ 5.00  |                                                                                                                                |\n| [Anonymous]      | $ 20.00 | Your page is the best reference I've ever come across and I'm sharing it with everyone I know. Thanks so much for creating it! |\n| Tony Qu          | $ 20.00 | Thanks Man ! This looks nice. :-)                                                                                              |\n| [Anonymous]      | $ 25.00 | As a newcomer to Python, this looks incredibly useful. Thanks for your hard work!                                              |\n| VimNewbie        | $ 10.00 | Awesome and elegant... fantastic job!                                                                                          |\n| Dave Hanson      | $ 50.00 | Nice.. great work...                                                                                                           |\n| Alexander        | $ 40.00 | -                                                                                                                              |\n| Frpsi17          | $ 10.00 | I think I just found the greatest site for cheatsheets,Thanks                                                                  |\n| [Anonymous]      | $ 5.00  | Awesome! Thank you!                                                                                                            |\n"
  },
  {
    "path": "source/support/index.md",
    "content": "---\ntitle: Buy Me a Coffee\ndescription: Support the development of CheatSheets.zip through various donation platforms\npermalink: /support/\nbackground: bg-gradient-to-r from-pink-500 to-purple-600\ntags:\n  - support\n  - donation\ncategories:\n  - Other\nintro: |\n  Thank you for considering supporting CheatSheets.zip! Your contributions help us maintain and improve this free resource for developers worldwide.\n---\n\n## Buy Me a Coffee\n\n### 💖 Why Support Us?\n\nCheatSheets.zip serves **1M+ developers** monthly with **200+ free cheat sheets**.\n\nWe believe great developer resources should be **free forever**. Your support helps us:\n\n- 🚀 Keep servers running smoothly\n- ✨ Add new cheat sheets weekly\n- 🎯 Improve user experience\n- 🔥 Maintain top-quality content\n\n_No ads, no paywalls, just pure developer goodness._\n\n### ☕ Buy Me a Coffee\n\n**Fuel our coding sessions!**\n\nBuy us a coffee and help keep the cheat sheets coming. Perfect for one-time support or when you just want to say thanks.\n\n☕ **What your coffee buys:**\n\n- Server uptime for thousands of developers\n- Motivation to create new content\n- A smile on our faces\n\n[Buy Me a Coffee](https://buymeacoffee.com/cheatsheets.zip) {.link-arrow}\n\n### 🌟 GitHub Sponsors\n\n**Join our amazing sponsors!**\n\nSupport the future of free developer resources. Every contribution, big or small, makes a real difference.\n\n✨ **Sponsor perks:**\n\n- Your name in our README\n- Early access to new features\n- Good karma for supporting open source\n\n[Sponsor on GitHub](https://github.com/sponsors/Fechin) {.link-arrow}\n"
  },
  {
    "path": "source/sw.js",
    "content": "// CheatSheets.zip Service Worker\nconst STATIC_CACHE = 'cheatsheets-static-v1';\nconst DYNAMIC_CACHE = 'cheatsheets-dynamic-v1';\n\n// Static assets to cache\nconst STATIC_ASSETS = [\n  '/',\n  '/css/style.css',\n  '/js/main.js',\n  '/js/fuse_7.1.0.js',\n  '/manifest.json',\n  '/search.json'\n];\n\n// Page patterns to cache\nconst CACHE_PATTERNS = [\n  /^\\/$/, // Home page\n  /^\\/[a-z-]+\\.html$/, // Cheat sheet pages\n  /^\\/assets\\//, // Static assets\n  /^\\/css\\//, // CSS files\n  /^\\/js\\//, // JavaScript files\n  /^\\/images\\// // Image files\n];\n\n// Service Worker installevent\nself.addEventListener('install', (event) => {\n  console.log('Service Worker: Installing...');\n\n  event.waitUntil(\n    caches\n      .open(STATIC_CACHE)\n      .then((cache) => {\n        console.log('Service Worker: Caching static assets');\n        return cache.addAll(STATIC_ASSETS);\n      })\n      .then(() => {\n        console.log('Service Worker: Static assets cached');\n        return self.skipWaiting();\n      })\n      .catch((error) => {\n        console.error('Service Worker: Cache failed', error);\n      })\n  );\n});\n\n// Service Worker activate event\nself.addEventListener('activate', (event) => {\n  console.log('Service Worker: Activating...');\n\n  event.waitUntil(\n    caches\n      .keys()\n      .then((cacheNames) => {\n        return Promise.all(\n          cacheNames.map((cacheName) => {\n            // Delete old cache versions\n            if (cacheName !== STATIC_CACHE && cacheName !== DYNAMIC_CACHE) {\n              console.log('Service Worker: Deleting old cache', cacheName);\n              return caches.delete(cacheName);\n            }\n          })\n        );\n      })\n      .then(() => {\n        console.log('Service Worker: Activated');\n        return self.clients.claim();\n      })\n  );\n});\n\n// Network request interception\nself.addEventListener('fetch', (event) => {\n  const { request } = event;\n  const url = new URL(request.url);\n\n  // Only handle same-origin requests\n  if (url.origin !== location.origin) {\n    return;\n  }\n\n  // Check if matches cache pattern\n  const shouldCache = CACHE_PATTERNS.some((pattern) => pattern.test(url.pathname));\n\n  if (shouldCache) {\n    event.respondWith(handleCacheRequest(request));\n  }\n});\n\n// Cache request handling strategy\nasync function handleCacheRequest(request) {\n  const url = new URL(request.url);\n\n  try {\n    // 1. Try to get from cache\n    const cachedResponse = await caches.match(request);\n\n    // 2. If it's a static asset and cached, return directly\n    if (cachedResponse && isStaticAsset(url.pathname)) {\n      return cachedResponse;\n    }\n\n    // 3. Try network request\n    const networkResponse = await fetch(request);\n\n    // 4. If network request succeeds, update cache\n    if (networkResponse.ok) {\n      const cache = await caches.open(DYNAMIC_CACHE);\n      cache.put(request, networkResponse.clone());\n      return networkResponse;\n    }\n\n    // 5. Network failed, return cache (if available)\n    if (cachedResponse) {\n      return cachedResponse;\n    }\n\n    // 6. Nothing available, return offline page\n    return createOfflineResponse(url.pathname);\n  } catch (error) {\n    console.error('Service Worker: Fetch failed', error);\n\n    // Network error, try to return cache\n    const cachedResponse = await caches.match(request);\n    if (cachedResponse) {\n      return cachedResponse;\n    }\n\n    // Return offline page\n    return createOfflineResponse(url.pathname);\n  }\n}\n\n// Check if it's a static asset\nfunction isStaticAsset(pathname) {\n  return /\\.(css|js|png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)$/.test(pathname);\n}\n\n// Create offline response\nfunction createOfflineResponse(pathname) {\n  const isHtmlPage = pathname.endsWith('.html') || pathname === '/';\n\n  if (isHtmlPage) {\n    return new Response(\n      `\n      <!DOCTYPE html>\n      <html lang=\"en\">\n      <head>\n        <meta charset=\"UTF-8\">\n        <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n        <title>Offline - CheatSheets.zip</title>\n        <style>\n          body { \n            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n            display: flex; \n            justify-content: center; \n            align-items: center; \n            height: 100vh; \n            margin: 0; \n            background: #f8f9fa;\n            color: #333;\n          }\n          .offline-container {\n            text-align: center;\n            max-width: 400px;\n            padding: 2rem;\n            background: white;\n            border-radius: 8px;\n            box-shadow: 0 4px 6px rgba(0,0,0,0.1);\n          }\n          .offline-icon {\n            font-size: 4rem;\n            margin-bottom: 1rem;\n          }\n          .offline-title {\n            font-size: 1.5rem;\n            margin-bottom: 1rem;\n            color: #6366f1;\n          }\n          .offline-message {\n            margin-bottom: 1.5rem;\n            line-height: 1.6;\n          }\n          .retry-button {\n            background: #6366f1;\n            color: white;\n            border: none;\n            padding: 0.75rem 1.5rem;\n            border-radius: 4px;\n            cursor: pointer;\n            font-size: 1rem;\n          }\n          .retry-button:hover {\n            background: #3730a3;\n          }\n        </style>\n      </head>\n      <body>\n        <div class=\"offline-container\">\n          <div class=\"offline-icon\">📚</div>\n          <h1 class=\"offline-title\">You're Offline</h1>\n          <p class=\"offline-message\">\n            This page isn't available offline yet. Please check your internet connection and try again.\n          </p>\n          <button class=\"retry-button\" onclick=\"window.location.reload()\">\n            Try Again\n          </button>\n        </div>\n      </body>\n      </html>\n    `,\n      {\n        status: 200,\n        headers: {\n          'Content-Type': 'text/html; charset=utf-8',\n          'Cache-Control': 'no-cache'\n        }\n      }\n    );\n  }\n\n  return new Response('Offline', {\n    status: 503,\n    statusText: 'Service Unavailable'\n  });\n}\n\n// Background sync (if supported)\nif ('sync' in self.registration) {\n  self.addEventListener('sync', (event) => {\n    if (event.tag === 'background-sync') {\n      event.waitUntil(doBackgroundSync());\n    }\n  });\n}\n\nasync function doBackgroundSync() {\n  try {\n    // Sync search data\n    const response = await fetch('/search.json');\n    if (response.ok) {\n      const cache = await caches.open(DYNAMIC_CACHE);\n      cache.put('/search.json', response);\n    }\n  } catch (error) {\n    console.error('Background sync failed:', error);\n  }\n}\n\n// Push notifications (if needed)\nself.addEventListener('push', (event) => {\n  if (event.data) {\n    const data = event.data.json();\n    const options = {\n      body: data.body,\n      icon: '/assets/icons/icon-192x192.png',\n      badge: '/assets/icons/icon-72x72.png',\n      vibrate: [100, 50, 100],\n      data: {\n        dateOfArrival: Date.now(),\n        primaryKey: data.primaryKey\n      },\n      actions: [\n        {\n          action: 'explore',\n          title: 'View Cheat Sheet',\n          icon: '/assets/icons/icon-96x96.png'\n        },\n        {\n          action: 'close',\n          title: 'Close',\n          icon: '/assets/icons/icon-96x96.png'\n        }\n      ]\n    };\n\n    event.waitUntil(self.registration.showNotification(data.title, options));\n  }\n});\n\n// Notification click handling\nself.addEventListener('notificationclick', (event) => {\n  event.notification.close();\n\n  if (event.action === 'explore') {\n    event.waitUntil(clients.openWindow('/'));\n  }\n});\n"
  },
  {
    "path": "source/widget/chmod.html",
    "content": "<div class=\"mb-3 mt-8 flex items-center justify-center\">\n  <div class=\"w-1/3 px-2\">\n    <p class=\"text-right font-medium\">Permissions:</p>\n  </div>\n  <div class=\"w-1/3 px-2\">\n    <input\n      class=\"bg-grey-lighter text-grey-darker border-red block w-full appearance-none rounded border px-3 py-2 focus:border-indigo-500 focus:outline-none dark:bg-slate-800\"\n      id=\"num\"\n      placeholder=\"777\"\n      maxlength=\"3\"\n      type=\"text\"\n    />\n  </div>\n  <div class=\"w-1/3 px-2\">\n    <input\n      class=\"bg-grey-lighter dark-bg-slate-800 text-grey-darker border-grey-lighter block w-full appearance-none rounded border px-3 py-2 focus:border-indigo-500 focus:outline-none\"\n      id=\"let\"\n      placeholder=\"rwxrwxrwx\"\n      maxlength=\"9\"\n      type=\"text\"\n    />\n  </div>\n</div>\n<table class=\"show-header center-text\">\n  <thead>\n    <tr>\n      <th></th>\n      <th>User</th>\n      <th>Group</th>\n      <th>Other</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td style=\"text-align: right\">Read</td>\n      <td><input checked=\"\" id=\"1\" type=\"checkbox\" /></td>\n      <td><input checked=\"\" id=\"4\" type=\"checkbox\" /></td>\n      <td><input checked=\"\" id=\"7\" type=\"checkbox\" /></td>\n    </tr>\n    <tr>\n      <td style=\"text-align: right\">Write</td>\n      <td><input checked=\"\" id=\"2\" type=\"checkbox\" /></td>\n      <td><input checked=\"\" id=\"5\" type=\"checkbox\" /></td>\n      <td><input checked=\"\" id=\"8\" type=\"checkbox\" /></td>\n    </tr>\n    <tr>\n      <td style=\"text-align: right\">Execute</td>\n      <td><input checked=\"\" id=\"3\" type=\"checkbox\" /></td>\n      <td><input checked=\"\" id=\"6\" type=\"checkbox\" /></td>\n      <td><input checked=\"\" id=\"9\" type=\"checkbox\" /></td>\n    </tr>\n  </tbody>\n</table>\n\n<script>\n  const reg_num = /^[0-7]{3}$/; // some regex to check the num input\n  const reg_let = /^([r\\-]{1}[w\\-]{1}[x\\-]{1}){3}$/; // some regex to check the text input\n\n  window.addEventListener('DOMContentLoaded', function () {\n    // loop over all the check boxes\n    for (let i = 1; i < 10; i++) {\n      let checkBox = document.getElementById(`${i}`);\n      checkBox.addEventListener('change', function () {\n        change_occured(true, false, false);\n\n        // get rid of bad input classes\n        document.getElementById('num').classList.remove('bad-input');\n\n        document.getElementById('let').classList.remove('bad-input');\n      });\n    }\n\n    // the octal input\n    let num_input = document.getElementById('num');\n    let num_fn = function () {\n      // check for bad input\n      if (!reg_num.test(this.value)) {\n        this.classList.add('bad-input');\n      } else {\n        this.classList.remove('bad-input');\n        change_occured(false, true, false);\n      }\n    };\n    num_input.addEventListener('change', num_fn);\n    num_input.addEventListener('keyup', num_fn);\n\n    // the let input\n    let let_input = document.getElementById('let');\n    let let_fn = function () {\n      // check for bad input\n      if (!reg_let.test(this.value)) {\n        this.classList.add('bad-input');\n      } else {\n        this.classList.remove('bad-input');\n        change_occured(false, false, true);\n      }\n    };\n    let_input.addEventListener('change', let_fn);\n    let_input.addEventListener('keyup', let_fn);\n  });\n\n  /* SETUP\n  r-4-1  r-4-4  r-4-7\n  w-2-2  w-2-5  w-2-8\n  x-1-3  x-1-6  x-1-9\n  */\n\n  // define a function that runs when a change occures\n  function change_occured(caller_was_check, caller_was_num, caller_was_let) {\n    let num1 = 0,\n      num2 = 0,\n      num3 = 0; // these are the three numbers for the octal\n    let perm_string = ''; // holds the permision string ex. rw-x--r--\n\n    if (caller_was_check) {\n      // loop over all the check boxes and get the permisions\n      for (let i = 1; i < 10; i++) {\n        let checkBox = document.getElementById(`${i}`);\n\n        if (checkBox.checked) {\n          // if checked\n          let current_perm = check_to_octal_and_text(i);\n          perm_string += `${current_perm.perm_let}`;\n\n          if (i <= 3) {\n            num1 += current_perm.perm_num;\n          } else if (i <= 6) {\n            num2 += current_perm.perm_num;\n          } else {\n            num3 += current_perm.perm_num;\n          }\n        } else {\n          // if not checked\n          perm_string += '-';\n        }\n      }\n\n      // set the permision input text\n      document.getElementById('let').value = perm_string;\n      document.getElementById('num').value = `${num1}${num2}${num3}`;\n    } else if (caller_was_num) {\n      // get the individual numbers\n      let num_input_val = document.getElementById('num').value;\n      num1 = num_input_val.substring(0, 1);\n      num2 = num_input_val.substring(1, 2);\n      num3 = num_input_val.substring(2, 3);\n\n      // set the checkboxes and get the perm string\n      perm_string += octal_to_check_and_txt(num1, 0); //Owner\n      perm_string += octal_to_check_and_txt(num2, 1); //Owner\n      perm_string += octal_to_check_and_txt(num3, 2); //Owner\n\n      // set the permision input text\n      document.getElementById('let').value = perm_string;\n    } else if (caller_was_let) {\n      // get the text input\n      let perm_text = document.getElementById('let').value;\n\n      num1 = text_to_check_and_octal(perm_text.substring(0, 3), 0);\n      num2 = text_to_check_and_octal(perm_text.substring(3, 6), 3);\n      num3 = text_to_check_and_octal(perm_text.substring(6, 9), 6);\n\n      // set the octal value\n      document.getElementById('num').value = `${num1}${num2}${num3}`;\n    }\n  }\n\n  // define a function to converts the checkbox # to the respective permissions\n  // returns perm_num, perm_let\n  function check_to_octal_and_text(check_num) {\n    let perm_num = 0;\n    let perm_let = '-';\n\n    switch (check_num) {\n      case 1:\n      case 4:\n      case 7:\n        perm_num = 4;\n        perm_let = 'r';\n\n        break;\n      case 2:\n      case 5:\n      case 8:\n        perm_num = 2;\n        perm_let = 'w';\n\n        break;\n      case 3:\n      case 6:\n      case 9:\n        perm_num = 1;\n        perm_let = 'x';\n\n        break;\n      default:\n        perm_num = 0;\n        perm_let = '-';\n    }\n    // return values\n    return {\n      perm_num,\n      perm_let\n    };\n  }\n\n  /**\n   Takes a number 1-7 and which class it is in:\n   0 = owner\n   1 = Group\n   2 = Public\n\n   Returns: perm text (ex. \"rwx\") and sets the appropriate checkboxes\n   */\n  function octal_to_check_and_txt(octal_num, class_num) {\n    let perm_text = '';\n    let offset = class_num * 3;\n\n    switch (octal_num) {\n      case '1':\n        document.getElementById(`${1 + offset}`).checked = false;\n        document.getElementById(`${2 + offset}`).checked = false;\n        document.getElementById(`${3 + offset}`).checked = true;\n        perm_text = '--x';\n        break;\n\n      case '2':\n        document.getElementById(`${1 + offset}`).checked = false;\n        document.getElementById(`${2 + offset}`).checked = true;\n        document.getElementById(`${3 + offset}`).checked = false;\n        perm_text = '-w-';\n        break;\n\n      case '3':\n        document.getElementById(`${1 + offset}`).checked = false;\n        document.getElementById(`${2 + offset}`).checked = true;\n        document.getElementById(`${3 + offset}`).checked = true;\n        perm_text = '-wx';\n        break;\n\n      case '4':\n        document.getElementById(`${1 + offset}`).checked = true;\n        document.getElementById(`${2 + offset}`).checked = false;\n        document.getElementById(`${3 + offset}`).checked = false;\n        perm_text = 'r--';\n        break;\n\n      case '5':\n        document.getElementById(`${1 + offset}`).checked = true;\n        document.getElementById(`${2 + offset}`).checked = false;\n        document.getElementById(`${3 + offset}`).checked = true;\n        perm_text = 'r-x';\n        break;\n\n      case '6':\n        document.getElementById(`${1 + offset}`).checked = true;\n        document.getElementById(`${2 + offset}`).checked = true;\n        document.getElementById(`${3 + offset}`).checked = false;\n        perm_text = 'rw-';\n        break;\n\n      case '7':\n        document.getElementById(`${1 + offset}`).checked = true;\n        document.getElementById(`${2 + offset}`).checked = true;\n        document.getElementById(`${3 + offset}`).checked = true;\n        perm_text = 'rwx';\n        break;\n\n      default:\n        document.getElementById(`${1 + offset}`).checked = false;\n        document.getElementById(`${2 + offset}`).checked = false;\n        document.getElementById(`${3 + offset}`).checked = false;\n        perm_text = '---';\n    }\n    return perm_text;\n  }\n\n  /**\n   Takes 3 letters (r, w, x, -    ex. 'rw-') and an offset (0,3,6)\n   Returns the octal num and sets the appropriate checkboxes\n   */\n  function text_to_check_and_octal(letters, offset) {\n    let perm_num = 0; // the octal number to return\n\n    // add up the oct num and set the check boxes\n    for (let i = 0; i < 3; i++) {\n      current_let = letters.substring(i, i + 1);\n      if (current_let == 'r') {\n        document.getElementById(`${i + 1 + offset}`).checked = true;\n        perm_num += 4;\n      } else if (current_let == 'w') {\n        document.getElementById(`${i + 1 + offset}`).checked = true;\n        perm_num += 2;\n      } else if (current_let == 'x') {\n        document.getElementById(`${i + 1 + offset}`).checked = true;\n        perm_num += 1;\n      } else {\n        document.getElementById(`${i + 1 + offset}`).checked = false;\n      }\n    }\n    return perm_num;\n  }\n</script>\n"
  },
  {
    "path": "source/widget/color-palette-tailwind.html",
    "content": "<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n    <meta charset=\"UTF-8\">\r\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n    <title>Color Picker</title>\r\n    <script src=\"https://cdn.tailwindcss.com\"></script>\r\n</head>\r\n<body class=\"bg-gray-100\">\r\n<div class=\"container mx-auto p-4\">\r\n    <div class=\"flex items-center justify-center flex-row space-x-4\">\r\n        <!-- Color Picker Section -->\r\n        <div class=\"me-25\">\r\n            <div class=\"flex flex-col space-y-1 me-25 \">\r\n                <!-- RED -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(255, 245, 245)', '#fff5f5','bg-red-50')\" class=\"w-14 h-10  me-2 rounded-md me-2 rounded-md bg-red-50 cursor-pointer \" title=\"Red 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(255, 230, 230)', '#ffebee', 'bg-red-100')\" class=\"w-14 h-10  me-2 rounded-md bg-red-100 cursor-pointer\" title=\"Red 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(255, 205, 205)', '#ffcdcd', 'bg-red-200')\" class=\"w-14 h-10  me-2 rounded-md bg-red-200 cursor-pointer\" title=\"Red 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(255, 180, 180)', '#ffb4b4', 'bg-red-300')\" class=\"w-14 h-10  me-2 rounded-md bg-red-300 cursor-pointer\" title=\"Red 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(255, 107, 107)', '#ff6b6b', 'bg-red-400')\" class=\"w-14 h-10  me-2 rounded-md bg-red-400 cursor-pointer\" title=\"Red 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(255, 51, 51)', '#ff3333', 'bg-red-500')\" class=\"w-14 h-10  me-2 rounded-md bg-red-500 cursor-pointer\" title=\"Red 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(220, 38, 38)', '#dc2626', 'bg-red-600')\" class=\"w-14 h-10  me-2 rounded-md bg-red-600 cursor-pointer\" title=\"Red 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(180, 25, 25)', '#b41919', 'bg-red-700')\" class=\"w-14 h-10  me-2 rounded-md bg-red-700 cursor-pointer\" title=\"Red 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(153, 27, 27)', '#991b1b', 'bg-red-800')\" class=\"w-14 h-10  me-2 rounded-md bg-red-800 cursor-pointer\" title=\"Red 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(127, 29, 29)', '#7f1d1d', 'bg-red-900')\" class=\"w-14 h-10  me-2 rounded-md bg-red-900 cursor-pointer\" title=\"Red 90%\"></div>\r\n                </div>\r\n\r\n                <!-- ORANGE -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(255, 247, 237)', '#fff7ed', 'bg-orange-50')\" class=\"w-14 h-10  me-2 rounded-md bg-orange-50 cursor-pointer\" title=\"Orange 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(255, 237, 213)', '#ffedd5', 'bg-orange-100')\" class=\"w-14 h-10  me-2 rounded-md bg-orange-100 cursor-pointer\" title=\"Orange 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(254, 215, 170)', '#fed7aa', 'bg-orange-200')\" class=\"w-14 h-10  me-2 rounded-md bg-orange-200 cursor-pointer\" title=\"Orange 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(253, 186, 116)', '#fdba74', 'bg-orange-300')\" class=\"w-14 h-10  me-2 rounded-md bg-orange-300 cursor-pointer\" title=\"Orange 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(251, 146, 60)', '#fb923c', 'bg-orange-400')\" class=\"w-14 h-10  me-2 rounded-md bg-orange-400 cursor-pointer\" title=\"Orange 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(249, 115, 22)', '#f97316', 'bg-orange-500')\" class=\"w-14 h-10  me-2 rounded-md bg-orange-500 cursor-pointer\" title=\"Orange 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(234, 88, 12)', '#ea580c', 'bg-orange-600')\" class=\"w-14 h-10  me-2 rounded-md bg-orange-600 cursor-pointer\" title=\"Orange 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(194, 65, 12)', '#c2410c', 'bg-orange-700')\" class=\"w-14 h-10  me-2 rounded-md bg-orange-700 cursor-pointer\" title=\"Orange 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(154, 52, 18)', '#9a3412', 'bg-orange-800')\" class=\"w-14 h-10  me-2 rounded-md bg-orange-800 cursor-pointer\" title=\"Orange 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(124, 45, 18)', '#7c2d12', 'bg-orange-900')\" class=\"w-14 h-10  me-2 rounded-md bg-orange-900 cursor-pointer\" title=\"Orange 90%\"></div>\r\n                </div>\r\n\r\n                <!-- AMBER -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(255, 251, 235)', '#fffbeb', 'bg-amber-50')\" class=\"w-14 h-10  me-2 rounded-md bg-amber-50 cursor-pointer\" title=\"Amber 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(254, 243, 199)', '#fef3c7', 'bg-amber-100')\" class=\"w-14 h-10  me-2 rounded-md bg-amber-100 cursor-pointer\" title=\"Amber 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(253, 230, 138)', '#fde68a', 'bg-amber-200')\" class=\"w-14 h-10  me-2 rounded-md bg-amber-200 cursor-pointer\" title=\"Amber 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(252, 211, 77)', '#fcd34d', 'bg-amber-300')\" class=\"w-14 h-10  me-2 rounded-md bg-amber-300 cursor-pointer\" title=\"Amber 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(251, 191, 36)', '#fbbf24', 'bg-amber-400')\" class=\"w-14 h-10  me-2 rounded-md bg-amber-400 cursor-pointer\" title=\"Amber 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(245, 158, 11)', '#f59e0b', 'bg-amber-500')\" class=\"w-14 h-10  me-2 rounded-md bg-amber-500 cursor-pointer\" title=\"Amber 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(217, 119, 6)', '#d97706', 'bg-amber-600')\" class=\"w-14 h-10  me-2 rounded-md bg-amber-600 cursor-pointer\" title=\"Amber 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(180, 83, 9)', '#b45309', 'bg-amber-700')\" class=\"w-14 h-10  me-2 rounded-md bg-amber-700 cursor-pointer\" title=\"Amber 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(146, 64, 14)', '#92400e', 'bg-amber-800')\" class=\"w-14 h-10  me-2 rounded-md bg-amber-800 cursor-pointer\" title=\"Amber 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(120, 53, 15)', '#78350f', 'bg-amber-900')\" class=\"w-14 h-10  me-2 rounded-md bg-amber-900 cursor-pointer\" title=\"Amber 90%\"></div>\r\n                </div>\r\n\r\n                <!-- YELLOW -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(255, 254, 239)', '#fefce8', 'bg-yellow-50')\" class=\"w-14 h-10  me-2 rounded-md bg-yellow-50 cursor-pointer\" title=\"Yellow 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(254, 252, 219)', '#fefcdb', 'bg-yellow-100')\" class=\"w-14 h-10  me-2 rounded-md bg-yellow-100 cursor-pointer\" title=\"Yellow 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(254, 249, 195)', '#fef9c3', 'bg-yellow-200')\" class=\"w-14 h-10  me-2 rounded-md bg-yellow-200 cursor-pointer\" title=\"Yellow 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(254, 240, 138)', '#fef08a', 'bg-yellow-300')\" class=\"w-14 h-10  me-2 rounded-md bg-yellow-300 cursor-pointer\" title=\"Yellow 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(253, 224, 71)', '#fde047', 'bg-yellow-400')\" class=\"w-14 h-10  me-2 rounded-md bg-yellow-400 cursor-pointer\" title=\"Yellow 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(252, 205, 38)', '#fccd26', 'bg-yellow-500')\" class=\"w-14 h-10  me-2 rounded-md bg-yellow-500 cursor-pointer\" title=\"Yellow 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(251, 191, 36)', '#fbbf24', 'bg-yellow-600')\" class=\"w-14 h-10  me-2 rounded-md bg-yellow-600 cursor-pointer\" title=\"Yellow 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(249, 168, 37)', '#f9a825', 'bg-yellow-700')\" class=\"w-14 h-10  me-2 rounded-md bg-yellow-700 cursor-pointer\" title=\"Yellow 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(245, 146, 40)', '#f59228', 'bg-yellow-800')\" class=\"w-14 h-10  me-2 rounded-md bg-yellow-800 cursor-pointer\" title=\"Yellow 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(234, 128, 38)', '#ea8026', 'bg-yellow-900')\" class=\"w-14 h-10  me-2 rounded-md bg-yellow-900 cursor-pointer\" title=\"Yellow 90%\"></div>\r\n                </div>\r\n\r\n                <!-- LIME -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(247, 254, 231)', '#f7fee7', 'bg-lime-50')\" class=\"w-14 h-10  me-2 rounded-md bg-lime-50 cursor-pointer\" title=\"Lime 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(236, 252, 203)', '#ecfccb', 'bg-lime-100')\" class=\"w-14 h-10  me-2 rounded-md bg-lime-100 cursor-pointer\" title=\"Lime 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(217, 249, 157)', '#d9f99d', 'bg-lime-200')\" class=\"w-14 h-10  me-2 rounded-md bg-lime-200 cursor-pointer\" title=\"Lime 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(190, 242, 100)', '#bef264', 'bg-lime-300')\" class=\"w-14 h-10  me-2 rounded-md bg-lime-300 cursor-pointer\" title=\"Lime 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(163, 230, 53)', '#a3e635', 'bg-lime-400')\" class=\"w-14 h-10  me-2 rounded-md bg-lime-400 cursor-pointer\" title=\"Lime 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(132, 204, 22)', '#84cc16', 'bg-lime-500')\" class=\"w-14 h-10  me-2 rounded-md bg-lime-500 cursor-pointer\" title=\"Lime 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(101, 163, 13)', '#65a30d', 'bg-lime-600')\" class=\"w-14 h-10  me-2 rounded-md bg-lime-600 cursor-pointer\" title=\"Lime 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(77, 124, 15)', '#4d7c0f', 'bg-lime-700')\" class=\"w-14 h-10  me-2 rounded-md bg-lime-700 cursor-pointer\" title=\"Lime 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(63, 98, 18)', '#3f6212', 'bg-lime-800')\" class=\"w-14 h-10  me-2 rounded-md bg-lime-800 cursor-pointer\" title=\"Lime 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(54, 83, 20)', '#365314', 'bg-lime-900')\" class=\"w-14 h-10  me-2 rounded-md bg-lime-900 cursor-pointer\" title=\"Lime 90%\"></div>\r\n                </div>\r\n\r\n                <!-- GREEN -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(240, 253, 244)', '#f0fdf4', 'bg-green-50')\" class=\"w-14 h-10  me-2 rounded-md bg-green-50 cursor-pointer\" title=\"Green 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(220, 252, 231)', '#dcfce7', 'bg-green-100')\" class=\"w-14 h-10  me-2 rounded-md bg-green-100 cursor-pointer\" title=\"Green 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(187, 247, 208)', '#bbf7d0', 'bg-green-200')\" class=\"w-14 h-10  me-2 rounded-md bg-green-200 cursor-pointer\" title=\"Green 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(134, 239, 172)', '#86efac', 'bg-green-300')\" class=\"w-14 h-10  me-2 rounded-md bg-green-300 cursor-pointer\" title=\"Green 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(74, 222, 128)', '#4ade80', 'bg-green-400')\" class=\"w-14 h-10  me-2 rounded-md bg-green-400 cursor-pointer\" title=\"Green 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(34, 197, 94)', '#22c55e', 'bg-green-500')\" class=\"w-14 h-10  me-2 rounded-md bg-green-500 cursor-pointer\" title=\"Green 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(22, 163, 74)', '#16a34a', 'bg-green-600')\" class=\"w-14 h-10  me-2 rounded-md bg-green-600 cursor-pointer\" title=\"Green 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(21, 128, 61)', '#15803d', 'bg-green-700')\" class=\"w-14 h-10  me-2 rounded-md bg-green-700 cursor-pointer\" title=\"Green 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(22, 101, 52)', '#166534', 'bg-green-800')\" class=\"w-14 h-10  me-2 rounded-md bg-green-800 cursor-pointer\" title=\"Green 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(20, 83, 45)', '#14532d', 'bg-green-900')\" class=\"w-14 h-10  me-2 rounded-md bg-green-900 cursor-pointer\" title=\"Green 90%\"></div>\r\n                </div>\r\n\r\n                <!-- EMERALD -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(236, 253, 245)', '#ecfdf5', 'bg-emerald-50')\" class=\"w-14 h-10  me-2 rounded-md bg-emerald-50 cursor-pointer\" title=\"Emerald 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(209, 250, 229)', '#d1fae5', 'bg-emerald-100')\" class=\"w-14 h-10  me-2 rounded-md bg-emerald-100 cursor-pointer\" title=\"Emerald 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(167, 243, 208)', '#a7f3d0', 'bg-emerald-200')\" class=\"w-14 h-10  me-2 rounded-md bg-emerald-200 cursor-pointer\" title=\"Emerald 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(110, 231, 183)', '#6ee7b7', 'bg-emerald-300')\" class=\"w-14 h-10  me-2 rounded-md bg-emerald-300 cursor-pointer\" title=\"Emerald 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(52, 211, 153)', '#34d399', 'bg-emerald-400')\" class=\"w-14 h-10  me-2 rounded-md bg-emerald-400 cursor-pointer\" title=\"Emerald 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(16, 185, 129)', '#10b981', 'bg-emerald-500')\" class=\"w-14 h-10  me-2 rounded-md bg-emerald-500 cursor-pointer\" title=\"Emerald 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(5, 150, 105)', '#059669', 'bg-emerald-600')\" class=\"w-14 h-10  me-2 rounded-md bg-emerald-600 cursor-pointer\" title=\"Emerald 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(4, 120, 87)', '#047857', 'bg-emerald-700')\" class=\"w-14 h-10  me-2 rounded-md bg-emerald-700 cursor-pointer\" title=\"Emerald 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(6, 95, 70)', '#065f46', 'bg-emerald-800')\" class=\"w-14 h-10  me-2 rounded-md bg-emerald-800 cursor-pointer\" title=\"Emerald 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(6, 78, 59)', '#064e3b', 'bg-emerald-900')\" class=\"w-14 h-10  me-2 rounded-md bg-emerald-900 cursor-pointer\" title=\"Emerald 90%\"></div>\r\n                </div>\r\n\r\n                <!-- TEAL -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(240, 253, 250)', '#f0fdfa', 'bg-teal-50')\" class=\"w-14 h-10  me-2 rounded-md bg-teal-50 cursor-pointer\" title=\"Teal 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(204, 251, 241)', '#ccfbf1', 'bg-teal-100')\" class=\"w-14 h-10  me-2 rounded-md bg-teal-100 cursor-pointer\" title=\"Teal 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(153, 246, 228)', '#99f6e4', 'bg-teal-200')\" class=\"w-14 h-10  me-2 rounded-md bg-teal-200 cursor-pointer\" title=\"Teal 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(94, 234, 212)', '#5eead4', 'bg-teal-300')\" class=\"w-14 h-10  me-2 rounded-md bg-teal-300 cursor-pointer\" title=\"Teal 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(45, 212, 191)', '#2dd4bf', 'bg-teal-400')\" class=\"w-14 h-10  me-2 rounded-md bg-teal-400 cursor-pointer\" title=\"Teal 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(20, 184, 166)', '#14b8a6', 'bg-teal-500')\" class=\"w-14 h-10  me-2 rounded-md bg-teal-500 cursor-pointer\" title=\"Teal 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(13, 148, 136)', '#0d9488', 'bg-teal-600')\" class=\"w-14 h-10  me-2 rounded-md bg-teal-600 cursor-pointer\" title=\"Teal 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(15, 118, 110)', '#0f766e', 'bg-teal-700')\" class=\"w-14 h-10  me-2 rounded-md bg-teal-700 cursor-pointer\" title=\"Teal 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(17, 94, 89)', '#115e59', 'bg-teal-800')\" class=\"w-14 h-10  me-2 rounded-md bg-teal-800 cursor-pointer\" title=\"Teal 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(19, 78, 74)', '#134e4a', 'bg-teal-900')\" class=\"w-14 h-10  me-2 rounded-md bg-teal-900 cursor-pointer\" title=\"Teal 90%\"></div>\r\n                </div>\r\n\r\n                <!-- CYAN -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(236, 254, 255)', '#ecfeff', 'bg-cyan-50')\" class=\"w-14 h-10  me-2 rounded-md bg-cyan-50 cursor-pointer\" title=\"Cyan 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(207, 250, 254)', '#cffafe', 'bg-cyan-100')\" class=\"w-14 h-10  me-2 rounded-md bg-cyan-100 cursor-pointer\" title=\"Cyan 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(165, 243, 252)', '#a5f3fc', 'bg-cyan-200')\" class=\"w-14 h-10  me-2 rounded-md bg-cyan-200 cursor-pointer\" title=\"Cyan 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(103, 232, 249)', '#67e8f9', 'bg-cyan-300')\" class=\"w-14 h-10  me-2 rounded-md bg-cyan-300 cursor-pointer\" title=\"Cyan 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(34, 211, 238)', '#22d3ee', 'bg-cyan-400')\" class=\"w-14 h-10  me-2 rounded-md bg-cyan-400 cursor-pointer\" title=\"Cyan 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(6, 182, 212)', '#06b6d4', 'bg-cyan-500')\" class=\"w-14 h-10  me-2 rounded-md bg-cyan-500 cursor-pointer\" title=\"Cyan 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(8, 145, 178)', '#0891b2', 'bg-cyan-600')\" class=\"w-14 h-10  me-2 rounded-md bg-cyan-600 cursor-pointer\" title=\"Cyan 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(14, 116, 144)', '#0e7490', 'bg-cyan-700')\" class=\"w-14 h-10  me-2 rounded-md bg-cyan-700 cursor-pointer\" title=\"Cyan 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(21, 94, 117)', '#155e75', 'bg-cyan-800')\" class=\"w-14 h-10  me-2 rounded-md bg-cyan-800 cursor-pointer\" title=\"Cyan 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(22, 78, 99)', '#164e63', 'bg-cyan-900')\" class=\"w-14 h-10  me-2 rounded-md bg-cyan-900 cursor-pointer\" title=\"Cyan 90%\"></div>\r\n                </div>\r\n\r\n                <!-- SKY -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(240, 249, 255)', '#f0f9ff', 'bg-sky-50')\" class=\"w-14 h-10  me-2 rounded-md bg-sky-50 cursor-pointer\" title=\"Sky 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(224, 242, 254)', '#e0f2fe', 'bg-sky-100')\" class=\"w-14 h-10  me-2 rounded-md bg-sky-100 cursor-pointer\" title=\"Sky 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(186, 230, 253)', '#bae6fd', 'bg-sky-200')\" class=\"w-14 h-10  me-2 rounded-md bg-sky-200 cursor-pointer\" title=\"Sky 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(125, 211, 252)', '#7dd3fc', 'bg-sky-300')\" class=\"w-14 h-10  me-2 rounded-md bg-sky-300 cursor-pointer\" title=\"Sky 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(56, 182, 255)', '#38bdf8', 'bg-sky-400')\" class=\"w-14 h-10  me-2 rounded-md bg-sky-400 cursor-pointer\" title=\"Sky 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(14, 165, 233)', '#0ea5e9', 'bg-sky-500')\" class=\"w-14 h-10  me-2 rounded-md bg-sky-500 cursor-pointer\" title=\"Sky 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(2, 132, 199)', '#0284c7', 'bg-sky-600')\" class=\"w-14 h-10  me-2 rounded-md bg-sky-600 cursor-pointer\" title=\"Sky 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(3, 105, 161)', '#0369a1', 'bg-sky-700')\" class=\"w-14 h-10  me-2 rounded-md bg-sky-700 cursor-pointer\" title=\"Sky 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(7, 89, 133)', '#075985', 'bg-sky-800')\" class=\"w-14 h-10  me-2 rounded-md bg-sky-800 cursor-pointer\" title=\"Sky 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(12, 74, 110)', '#0c4a6e', 'bg-sky-900')\" class=\"w-14 h-10  me-2 rounded-md bg-sky-900 cursor-pointer\" title=\"Sky 90%\"></div>\r\n                </div>\r\n\r\n                <!-- BLUE -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(239, 246, 255)', '#eff6ff', 'bg-blue-50')\" class=\"w-14 h-10  me-2 rounded-md bg-blue-50 cursor-pointer\" title=\"Blue 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(219, 234, 254)', '#dbeafe', 'bg-blue-100')\" class=\"w-14 h-10  me-2 rounded-md bg-blue-100 cursor-pointer\" title=\"Blue 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(191, 219, 254)', '#bfdbfe', 'bg-blue-200')\" class=\"w-14 h-10  me-2 rounded-md bg-blue-200 cursor-pointer\" title=\"Blue 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(147, 197, 253)', '#93c5fd', 'bg-blue-300')\" class=\"w-14 h-10  me-2 rounded-md bg-blue-300 cursor-pointer\" title=\"Blue 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(96, 165, 250)', '#60a5fa', 'bg-blue-400')\" class=\"w-14 h-10  me-2 rounded-md bg-blue-400 cursor-pointer\" title=\"Blue 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(59, 130, 246)', '#3b82f6', 'bg-blue-500')\" class=\"w-14 h-10  me-2 rounded-md bg-blue-500 cursor-pointer\" title=\"Blue 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(37, 99, 235)', '#2563eb', 'bg-blue-600')\" class=\"w-14 h-10  me-2 rounded-md bg-blue-600 cursor-pointer\" title=\"Blue 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(29, 78, 216)', '#1d4ed8', 'bg-blue-700')\" class=\"w-14 h-10  me-2 rounded-md bg-blue-700 cursor-pointer\" title=\"Blue 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(30, 64, 175)', '#1e40af', 'bg-blue-800')\" class=\"w-14 h-10  me-2 rounded-md bg-blue-800 cursor-pointer\" title=\"Blue 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(30, 58, 138)', '#1e3a8a', 'bg-blue-900')\" class=\"w-14 h-10  me-2 rounded-md bg-blue-900 cursor-pointer\" title=\"Blue 90%\"></div>\r\n                </div>\r\n\r\n                <!-- INDIGO -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(238, 242, 255)', '#eef2ff', 'bg-indigo-50')\" class=\"w-14 h-10  me-2 rounded-md bg-indigo-50 cursor-pointer\" title=\"Indigo 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(224, 231, 255)', '#e0e7ff', 'bg-indigo-100')\" class=\"w-14 h-10  me-2 rounded-md bg-indigo-100 cursor-pointer\" title=\"Indigo 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(199, 210, 254)', '#c7d2fe', 'bg-indigo-200')\" class=\"w-14 h-10  me-2 rounded-md bg-indigo-200 cursor-pointer\" title=\"Indigo 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(165, 180, 252)', '#a5b4fc', 'bg-indigo-300')\" class=\"w-14 h-10  me-2 rounded-md bg-indigo-300 cursor-pointer\" title=\"Indigo 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(129, 140, 248)', '#818cf8', 'bg-indigo-400')\" class=\"w-14 h-10  me-2 rounded-md bg-indigo-400 cursor-pointer\" title=\"Indigo 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(99, 102, 241)', '#6366f1', 'bg-indigo-500')\" class=\"w-14 h-10  me-2 rounded-md bg-indigo-500 cursor-pointer\" title=\"Indigo 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(79, 70, 229)', '#4f46e5', 'bg-indigo-600')\" class=\"w-14 h-10  me-2 rounded-md bg-indigo-600 cursor-pointer\" title=\"Indigo 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(67, 56, 202)', '#4338ca', 'bg-indigo-700')\" class=\"w-14 h-10  me-2 rounded-md bg-indigo-700 cursor-pointer\" title=\"Indigo 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(55, 48, 163)', '#3730a3', 'bg-indigo-800')\" class=\"w-14 h-10  me-2 rounded-md bg-indigo-800 cursor-pointer\" title=\"Indigo 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(49, 46, 129)', '#312e81', 'bg-indigo-900')\" class=\"w-14 h-10  me-2 rounded-md bg-indigo-900 cursor-pointer\" title=\"Indigo 90%\"></div>\r\n                </div>\r\n\r\n                <!-- VIOLET -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(245, 243, 255)', '#f5f3ff', 'bg-violet-50')\" class=\"w-14 h-10  me-2 rounded-md bg-violet-50 cursor-pointer\" title=\"Violet 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(237, 233, 254)', '#ede9fe', 'bg-violet-100')\" class=\"w-14 h-10  me-2 rounded-md bg-violet-100 cursor-pointer\" title=\"Violet 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(221, 214, 254)', '#ddd6fe', 'bg-violet-200')\" class=\"w-14 h-10  me-2 rounded-md bg-violet-200 cursor-pointer\" title=\"Violet 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(196, 181, 253)', '#c4b5fd', 'bg-violet-300')\" class=\"w-14 h-10  me-2 rounded-md bg-violet-300 cursor-pointer\" title=\"Violet 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(167, 139, 250)', '#a78bfa', 'bg-violet-400')\" class=\"w-14 h-10  me-2 rounded-md bg-violet-400 cursor-pointer\" title=\"Violet 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(139, 92, 246)', '#8b5cf6', 'bg-violet-500')\" class=\"w-14 h-10  me-2 rounded-md bg-violet-500 cursor-pointer\" title=\"Violet 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(124, 58, 237)', '#7c3aed', 'bg-violet-600')\" class=\"w-14 h-10  me-2 rounded-md bg-violet-600 cursor-pointer\" title=\"Violet 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(109, 40, 217)', '#6d28d9', 'bg-violet-700')\" class=\"w-14 h-10  me-2 rounded-md bg-violet-700 cursor-pointer\" title=\"Violet 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(91, 33, 182)', '#5b21b6', 'bg-violet-800')\" class=\"w-14 h-10  me-2 rounded-md bg-violet-800 cursor-pointer\" title=\"Violet 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(76, 29, 149)', '#4c1d95', 'bg-violet-900')\" class=\"w-14 h-10  me-2 rounded-md bg-violet-900 cursor-pointer\" title=\"Violet 90%\"></div>\r\n                </div>\r\n\r\n                <!-- PURPLE -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(245, 244, 255)', '#f5f3ff', 'bg-purple-50')\" class=\"w-14 h-10  me-2 rounded-md bg-purple-50 cursor-pointer\" title=\"Purple 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(237, 233, 254)', '#ede9fe', 'bg-purple-100')\" class=\"w-14 h-10  me-2 rounded-md bg-purple-100 cursor-pointer\" title=\"Purple 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(221, 214, 254)', '#ddd6fe', 'bg-purple-200')\" class=\"w-14 h-10  me-2 rounded-md bg-purple-200 cursor-pointer\" title=\"Purple 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(196, 181, 253)', '#c4b5fd', 'bg-purple-300')\" class=\"w-14 h-10  me-2 rounded-md bg-purple-300 cursor-pointer\" title=\"Purple 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(168, 85, 247)', '#a855f7', 'bg-purple-400')\" class=\"w-14 h-10  me-2 rounded-md bg-purple-400 cursor-pointer\" title=\"Purple 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(147, 51, 234)', '#9333ea', 'bg-purple-500')\" class=\"w-14 h-10  me-2 rounded-md bg-purple-500 cursor-pointer\" title=\"Purple 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(139, 92, 246)', '#8b5cf6', 'bg-purple-600')\" class=\"w-14 h-10  me-2 rounded-md bg-purple-600 cursor-pointer\" title=\"Purple 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(128, 49, 216)', '#8031d4', 'bg-purple-700')\" class=\"w-14 h-10  me-2 rounded-md bg-purple-700 cursor-pointer\" title=\"Purple 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(109, 40, 217)', '#6d28d9', 'bg-purple-800')\" class=\"w-14 h-10  me-2 rounded-md bg-purple-800 cursor-pointer\" title=\"Purple 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(88, 28, 135)', '#581c87', 'bg-purple-900')\" class=\"w-14 h-10  me-2 rounded-md bg-purple-900 cursor-pointer\" title=\"Purple 90%\"></div>\r\n                </div>\r\n\r\n                <!-- FUCHSIA -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(253, 244, 255)', '#fdf4ff', 'bg-fuchsia-50')\" class=\"w-14 h-10  me-2 rounded-md bg-fuchsia-50 cursor-pointer\" title=\"Fuchsia 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(250, 232, 255)', '#fae8ff', 'bg-fuchsia-100')\" class=\"w-14 h-10  me-2 rounded-md bg-fuchsia-100 cursor-pointer\" title=\"Fuchsia 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(245, 208, 254)', '#f5d0fe', 'bg-fuchsia-200')\" class=\"w-14 h-10  me-2 rounded-md bg-fuchsia-200 cursor-pointer\" title=\"Fuchsia 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(240, 171, 252)', '#f0abfc', 'bg-fuchsia-300')\" class=\"w-14 h-10  me-2 rounded-md bg-fuchsia-300 cursor-pointer\" title=\"Fuchsia 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(232, 121, 249)', '#e879f9', 'bg-fuchsia-400')\" class=\"w-14 h-10  me-2 rounded-md bg-fuchsia-400 cursor-pointer\" title=\"Fuchsia 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(217, 70, 239)', '#d946ef', 'bg-fuchsia-500')\" class=\"w-14 h-10  me-2 rounded-md bg-fuchsia-500 cursor-pointer\" title=\"Fuchsia 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(192, 38, 211)', '#c026d3', 'bg-fuchsia-600')\" class=\"w-14 h-10  me-2 rounded-md bg-fuchsia-600 cursor-pointer\" title=\"Fuchsia 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(162, 28, 175)', '#a21caf', 'bg-fuchsia-700')\" class=\"w-14 h-10  me-2 rounded-md bg-fuchsia-700 cursor-pointer\" title=\"Fuchsia 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(134, 25, 143)', '#86198f', 'bg-fuchsia-800')\" class=\"w-14 h-10  me-2 rounded-md bg-fuchsia-800 cursor-pointer\" title=\"Fuchsia 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(112, 26, 116)', '#701a75', 'bg-fuchsia-900')\" class=\"w-14 h-10  me-2 rounded-md bg-fuchsia-900 cursor-pointer\" title=\"Fuchsia 90%\"></div>\r\n                </div>\r\n\r\n                <!-- PINK -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(253, 242, 248)', '#fdf2f8', 'bg-pink-50')\" class=\"w-14 h-10  me-2 rounded-md bg-pink-50 cursor-pointer\" title=\"Pink 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(252, 231, 243)', '#fce7f3', 'bg-pink-100')\" class=\"w-14 h-10  me-2 rounded-md bg-pink-100 cursor-pointer\" title=\"Pink 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(251, 207, 232)', '#fbced0', 'bg-pink-200')\" class=\"w-14 h-10  me-2 rounded-md bg-pink-200 cursor-pointer\" title=\"Pink 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(249, 168, 212)', '#f9a8d4', 'bg-pink-300')\" class=\"w-14 h-10  me-2 rounded-md bg-pink-300 cursor-pointer\" title=\"Pink 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(244, 114, 182)', '#f472b6', 'bg-pink-400')\" class=\"w-14 h-10  me-2 rounded-md bg-pink-400 cursor-pointer\" title=\"Pink 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(236, 72, 153)', '#ec4899', 'bg-pink-500')\" class=\"w-14 h-10  me-2 rounded-md bg-pink-500 cursor-pointer\" title=\"Pink 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(219, 39, 119)', '#db2777', 'bg-pink-600')\" class=\"w-14 h-10  me-2 rounded-md bg-pink-600 cursor-pointer\" title=\"Pink 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(190, 24, 93)', '#be185d', 'bg-pink-700')\" class=\"w-14 h-10  me-2 rounded-md bg-pink-700 cursor-pointer\" title=\"Pink 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(157, 23, 77)', '#9d174d', 'bg-pink-800')\" class=\"w-14 h-10  me-2 rounded-md bg-pink-800 cursor-pointer\" title=\"Pink 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(131, 24, 67)', '#831843', 'bg-pink-900')\" class=\"w-14 h-10  me-2 rounded-md bg-pink-900 cursor-pointer\" title=\"Pink 90%\"></div>\r\n                </div>\r\n\r\n                <!-- ROSE -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(255, 241, 242)', '#fff1f2', 'bg-rose-50')\" class=\"w-14 h-10  me-2 rounded-md bg-rose-50 cursor-pointer\" title=\"Rose 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(255, 228, 230)', '#ffe4e6', 'bg-rose-100')\" class=\"w-14 h-10  me-2 rounded-md bg-rose-100 cursor-pointer\" title=\"Rose 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(254, 205, 211)', '#fecdd3', 'bg-rose-200')\" class=\"w-14 h-10  me-2 rounded-md bg-rose-200 cursor-pointer\" title=\"Rose 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(253, 164, 175)', '#fd9fa8', 'bg-rose-300')\" class=\"w-14 h-10  me-2 rounded-md bg-rose-300 cursor-pointer\" title=\"Rose 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(251, 113, 133)', '#fb7185', 'bg-rose-400')\" class=\"w-14 h-10  me-2 rounded-md bg-rose-400 cursor-pointer\" title=\"Rose 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(244, 63, 94)', '#f43f5e', 'bg-rose-500')\" class=\"w-14 h-10  me-2 rounded-md bg-rose-500 cursor-pointer\" title=\"Rose 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(225, 29, 72)', '#e11d48', 'bg-rose-600')\" class=\"w-14 h-10  me-2 rounded-md bg-rose-600 cursor-pointer\" title=\"Rose 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(190, 18, 60)', '#be123c', 'bg-rose-700')\" class=\"w-14 h-10  me-2 rounded-md bg-rose-700 cursor-pointer\" title=\"Rose 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(159, 18, 57)', '#9f1239', 'bg-rose-800')\" class=\"w-14 h-10  me-2 rounded-md bg-rose-800 cursor-pointer\" title=\"Rose 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(136, 19, 55)', '#881337', 'bg-rose-900')\" class=\"w-14 h-10  me-2 rounded-md bg-rose-900 cursor-pointer\" title=\"Rose 90%\"></div>\r\n                </div>\r\n\r\n                <!-- SLATE -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(248, 250, 252)', '#f8fafc', 'bg-slate-50')\" class=\"w-14 h-10  me-2 rounded-md bg-slate-50 cursor-pointer\" title=\"Slate 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(241, 245, 249)', '#f1f5f9', 'bg-slate-100')\" class=\"w-14 h-10  me-2 rounded-md bg-slate-100 cursor-pointer\" title=\"Slate 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(226, 232, 240)', '#e2e8f0', 'bg-slate-200')\" class=\"w-14 h-10  me-2 rounded-md bg-slate-200 cursor-pointer\" title=\"Slate 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(203, 213, 225)', '#cbd5e0', 'bg-slate-300')\" class=\"w-14 h-10  me-2 rounded-md bg-slate-300 cursor-pointer\" title=\"Slate 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(148, 163, 184)', '#94a3b8', 'bg-slate-400')\" class=\"w-14 h-10  me-2 rounded-md bg-slate-400 cursor-pointer\" title=\"Slate 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(100, 116, 139)', '#64748b', 'bg-slate-500')\" class=\"w-14 h-10  me-2 rounded-md bg-slate-500 cursor-pointer\" title=\"Slate 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(71, 85, 105)', '#475569', 'bg-slate-600')\" class=\"w-14 h-10  me-2 rounded-md bg-slate-600 cursor-pointer\" title=\"Slate 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(51, 65, 85)', '#334155', 'bg-slate-700')\" class=\"w-14 h-10  me-2 rounded-md bg-slate-700 cursor-pointer\" title=\"Slate 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(30, 41, 59)', '#1e293b', 'bg-slate-800')\" class=\"w-14 h-10  me-2 rounded-md bg-slate-800 cursor-pointer\" title=\"Slate 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(15, 23, 42)', '#0f172a', 'bg-slate-900')\" class=\"w-14 h-10  me-2 rounded-md bg-slate-900 cursor-pointer\" title=\"Slate 90%\"></div>\r\n                </div>\r\n\r\n                <!-- GRAY -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(249, 250, 251)', '#f9fafb', 'bg-gray-50')\" class=\"w-14 h-10  me-2 rounded-md bg-gray-50 cursor-pointer\" title=\"Gray 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(243, 244, 246)', '#f3f4f6', 'bg-gray-100')\" class=\"w-14 h-10  me-2 rounded-md bg-gray-100 cursor-pointer\" title=\"Gray 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(229, 231, 235)', '#e5e7eb', 'bg-gray-200')\" class=\"w-14 h-10  me-2 rounded-md bg-gray-200 cursor-pointer\" title=\"Gray 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(209, 213, 219)', '#d1d5db', 'bg-gray-300')\" class=\"w-14 h-10  me-2 rounded-md bg-gray-300 cursor-pointer\" title=\"Gray 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(156, 163, 175)', '#9ca3af', 'bg-gray-400')\" class=\"w-14 h-10  me-2 rounded-md bg-gray-400 cursor-pointer\" title=\"Gray 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(107, 114, 128)', '#6b7280', 'bg-gray-500')\" class=\"w-14 h-10  me-2 rounded-md bg-gray-500 cursor-pointer\" title=\"Gray 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(75, 85, 99)', '#4b5563', 'bg-gray-600')\" class=\"w-14 h-10  me-2 rounded-md bg-gray-600 cursor-pointer\" title=\"Gray 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(55, 65, 81)', '#374151', 'bg-gray-700')\" class=\"w-14 h-10  me-2 rounded-md bg-gray-700 cursor-pointer\" title=\"Gray 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(31, 41, 55)', '#1f2937', 'bg-gray-800')\" class=\"w-14 h-10  me-2 rounded-md bg-gray-800 cursor-pointer\" title=\"Gray 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(17, 24, 39)', '#111827', 'bg-gray-900')\" class=\"w-14 h-10  me-2 rounded-md bg-gray-900 cursor-pointer\" title=\"Gray 90%\"></div>\r\n                </div>\r\n\r\n                <!-- ZINC -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(250, 250, 250)', '#fafafa', 'bg-zinc-50')\" class=\"w-14 h-10  me-2 rounded-md bg-zinc-50 cursor-pointer\" title=\"Zinc 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(244, 244, 245)', '#f4f4f5', 'bg-zinc-100')\" class=\"w-14 h-10  me-2 rounded-md bg-zinc-100 cursor-pointer\" title=\"Zinc 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(228, 228, 231)', '#e4e4e7', 'bg-zinc-200')\" class=\"w-14 h-10  me-2 rounded-md bg-zinc-200 cursor-pointer\" title=\"Zinc 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(212, 212, 216)', '#d4d4d8', 'bg-zinc-300')\" class=\"w-14 h-10  me-2 rounded-md bg-zinc-300 cursor-pointer\" title=\"Zinc 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(161, 161, 170)', '#a1a1aa', 'bg-zinc-400')\" class=\"w-14 h-10  me-2 rounded-md bg-zinc-400 cursor-pointer\" title=\"Zinc 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(113, 113, 122)', '#71717a', 'bg-zinc-500')\" class=\"w-14 h-10  me-2 rounded-md bg-zinc-500 cursor-pointer\" title=\"Zinc 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(82, 82, 91)', '#52525b', 'bg-zinc-600')\" class=\"w-14 h-10  me-2 rounded-md bg-zinc-600 cursor-pointer\" title=\"Zinc 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(63, 63, 70)', '#3f3f46', 'bg-zinc-700')\" class=\"w-14 h-10  me-2 rounded-md bg-zinc-700 cursor-pointer\" title=\"Zinc 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(39, 39, 42)', '#27272a', 'bg-zinc-800')\" class=\"w-14 h-10  me-2 rounded-md bg-zinc-800 cursor-pointer\" title=\"Zinc 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(24, 24, 27)', '#18181b', 'bg-zinc-900')\" class=\"w-14 h-10  me-2 rounded-md bg-zinc-900 cursor-pointer\" title=\"Zinc 90%\"></div>\r\n                </div>\r\n\r\n                <!-- NEUTRAL -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(250, 250, 250)', '#fafafa', 'bg-neutral-50')\" class=\"w-14 h-10  me-2 rounded-md bg-neutral-50 cursor-pointer\" title=\"Neutral 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(245, 245, 245)', '#f5f5f5', 'bg-neutral-100')\" class=\"w-14 h-10  me-2 rounded-md bg-neutral-100 cursor-pointer\" title=\"Neutral 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(229, 229, 229)', '#e5e5e5', 'bg-neutral-200')\" class=\"w-14 h-10  me-2 rounded-md bg-neutral-200 cursor-pointer\" title=\"Neutral 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(212, 212, 212)', '#d4d4d4', 'bg-neutral-300')\" class=\"w-14 h-10  me-2 rounded-md bg-neutral-300 cursor-pointer\" title=\"Neutral 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(163, 163, 163)', '#a3a3a3', 'bg-neutral-400')\" class=\"w-14 h-10  me-2 rounded-md bg-neutral-400 cursor-pointer\" title=\"Neutral 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(115, 115, 115)', '#737373', 'bg-neutral-500')\" class=\"w-14 h-10  me-2 rounded-md bg-neutral-500 cursor-pointer\" title=\"Neutral 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(82, 82, 82)', '#525252', 'bg-neutral-600')\" class=\"w-14 h-10  me-2 rounded-md bg-neutral-600 cursor-pointer\" title=\"Neutral 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(64, 64, 64)', '#404040', 'bg-neutral-700')\" class=\"w-14 h-10  me-2 rounded-md bg-neutral-700 cursor-pointer\" title=\"Neutral 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(38, 38, 38)', '#262626', 'bg-neutral-800')\" class=\"w-14 h-10  me-2 rounded-md bg-neutral-800 cursor-pointer\" title=\"Neutral 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(23, 23, 23)', '#171717', 'bg-neutral-900')\" class=\"w-14 h-10  me-2 rounded-md bg-neutral-900 cursor-pointer\" title=\"Neutral 90%\"></div>\r\n                </div>\r\n\r\n                <!-- STONE -->\r\n                <div class=\"color-row block w-full m-0 p-0 flex\">\r\n                    <div onclick=\"getColor('rgb(250, 250, 249)', '#fafaf9', 'bg-stone-50')\" class=\"w-14 h-10  me-2 rounded-md bg-stone-50 cursor-pointer\" title=\"Stone 5%\"></div>\r\n                    <div onclick=\"getColor('rgb(245, 245, 244)', '#f5f5f4', 'bg-stone-100')\" class=\"w-14 h-10  me-2 rounded-md bg-stone-100 cursor-pointer\" title=\"Stone 10%\"></div>\r\n                    <div onclick=\"getColor('rgb(231, 229, 228)', '#e7e5e4', 'bg-stone-200')\" class=\"w-14 h-10  me-2 rounded-md bg-stone-200 cursor-pointer\" title=\"Stone 20%\"></div>\r\n                    <div onclick=\"getColor('rgb(214, 211, 209)', '#d6d3d1', 'bg-stone-300')\" class=\"w-14 h-10  me-2 rounded-md bg-stone-300 cursor-pointer\" title=\"Stone 30%\"></div>\r\n                    <div onclick=\"getColor('rgb(168, 162, 158)', '#a8a29e', 'bg-stone-400')\" class=\"w-14 h-10  me-2 rounded-md bg-stone-400 cursor-pointer\" title=\"Stone 40%\"></div>\r\n                    <div onclick=\"getColor('rgb(120, 113, 108)', '#78716c', 'bg-stone-500')\" class=\"w-14 h-10  me-2 rounded-md bg-stone-500 cursor-pointer\" title=\"Stone 50%\"></div>\r\n                    <div onclick=\"getColor('rgb(87, 83, 78)', '#57534e', 'bg-stone-600')\" class=\"w-14 h-10  me-2 rounded-md bg-stone-600 cursor-pointer\" title=\"Stone 60%\"></div>\r\n                    <div onclick=\"getColor('rgb(68, 64, 60)', '#44403c', 'bg-stone-700')\" class=\"w-14 h-10  me-2 rounded-md bg-stone-700 cursor-pointer\" title=\"Stone 70%\"></div>\r\n                    <div onclick=\"getColor('rgb(41, 37, 36)', '#292524', 'bg-stone-800')\" class=\"w-14 h-10  me-2 rounded-md bg-stone-800 cursor-pointer\" title=\"Stone 80%\"></div>\r\n                    <div onclick=\"getColor('rgb(28, 25, 23)', '#1c1917', 'bg-stone-900')\" class=\"w-14 h-10  me-2 rounded-md bg-stone-900 cursor-pointer\" title=\"Stone 90%\"></div>\r\n                </div>\r\n            </div>\r\n        </div>\r\n\r\n\r\n        <!-- Result Section -->\r\n        <div class=\" flex items-center justify-center\">\r\n            <div id=\"colorInfo\" class=\"p-4 bg-gray-500 rounded shadow w-full text-center\">\r\n                <p class=\"text-lg font-semibold text-sky-500\">Select a color to see its details</p>\r\n            </div>\r\n        </div>\r\n\r\n    </div>\r\n</div>\r\n\r\n<script>\r\n    function getColor(rgb, hex, tailwindcss) {\r\n        const colorInfo = document.getElementById('colorInfo');\r\n        colorInfo.innerHTML = `\r\n            <div class=\"flex flex-col items-center justify-center space-y-4\">\r\n                <div class=\"w-32 h-32 rounded-full border-4 border-gray-300 shadow-lg\" style=\"background-color: ${hex};\"></div>\r\n                <div class=\"flex flex-col space-y-2\">\r\n                    <p class=\"text-xl font-semibold text-gray-700\">RGB: <br> <span class=\"text-neutral-900\">${rgb}</span></p>\r\n                    <p class=\"text-xl font-semibold text-gray-700\">HEX: <br> <span class=\"text-neutral-900\">${hex}</span></p>\r\n                    <p class=\"text-xl font-semibold text-gray-700\">Tailwindcss: <br> <span class=\"text-neutral-900\">${tailwindcss}</span></p>\r\n                </div>\r\n            </div>\r\n        `;\r\n    }\r\n</script>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "source/widget/cron.html",
    "content": "<body>\r\n    <div class=\"container\">\r\n        <h1 class=\"font-bold text-center\">Simple CRON Expression Generator</h1>\r\n        <div class=\"input-section\">\r\n            <p class=\"font-medium mb-2 indent-3\">Enter Date and Time Expression:</p>\r\n            <table class=\"p-2 text-center\">\r\n                <tbody class=\"flex justify-center gap-4 mb-2\">\r\n                <tr>\r\n                    <td><input class=\"text-center rounded p-2 border border-gray-300\" id=\"from-minute\" type=\"text\"\r\n                               placeholder=\"Minute : 0-59 or *\" aria-label=\"Minute\"/></td>\r\n                    <td><input class=\"text-center rounded p-2 border border-gray-300\" id=\"from-hour\" type=\"text\"\r\n                               placeholder=\"Hour : 0-23 or *\" aria-label=\"Hour\"/></td>\r\n                    <td><input class=\"text-center rounded p-2 border border-gray-300\" id=\"from-day-of-month\" type=\"text\"\r\n                               placeholder=\"Day of Month : 1-31 or *\" aria-label=\"Day of Month\"/></td>\r\n                    <td>\r\n                        <select class=\"text-center rounded p-2 border border-gray-300\" id=\"from-month\"\r\n                                aria-label=\"Month\">\r\n                            <option value=\"*\">Any Month</option>\r\n                            <option value=\"1\">January</option>\r\n                            <option value=\"2\">February</option>\r\n                            <option value=\"3\">March</option>\r\n                            <option value=\"4\">April</option>\r\n                            <option value=\"5\">May</option>\r\n                            <option value=\"6\">June</option>\r\n                            <option value=\"7\">July</option>\r\n                            <option value=\"8\">August</option>\r\n                            <option value=\"9\">September</option>\r\n                            <option value=\"10\">October</option>\r\n                            <option value=\"11\">November</option>\r\n                            <option value=\"12\">December</option>\r\n                        </select>\r\n                    </td>\r\n                    <td>\r\n                        <select class=\"text-center rounded p-2 border border-gray-300\"\r\n                                id=\"from-day-of-week\" aria-label=\"Day of Week\">\r\n                            <option value=\"*\">Any Day</option>\r\n                            <option value=\"0\">Sunday</option>\r\n                            <option value=\"1\">Monday</option>\r\n                            <option value=\"2\">Tuesday</option>\r\n                            <option value=\"3\">Wednesday</option>\r\n                            <option value=\"4\">Thursday</option>\r\n                            <option value=\"5\">Friday</option>\r\n                            <option value=\"6\">Saturday</option>\r\n                        </select>\r\n                    </td>\r\n                </tr>\r\n                </tbody>\r\n            </table>\r\n            <div class=\"button-section flex justify-center gap-4\">\r\n                <div>\r\n                    <button id=\"generateBtn\"\r\n                            class=\"btn bg-green-500 text-white py-1 px-3 rounded hover:bg-green-600\">Generate\r\n                    </button>\r\n                </div>\r\n                <div>\r\n                    <button id=\"clearBtn\"\r\n                            class=\"btn bg-red-500 text-white py-1 px-3 rounded hover:bg-green-600\">Clear\r\n                    </button>\r\n                </div>\r\n            </div>\r\n        </div>\r\n        <hr class=\"mb-2 mt-2\">\r\n        <div class=\"result-section \">\r\n            <p class=\"font-medium mb-2 indent-3\">Generated CRON Expression:</p>\r\n            <div class=\"cron-expression text-center rounded p-2 border-gray-300 mb-2\"\r\n                 id=\"cron-expression\">* * * * *\r\n            </div>\r\n            <div class=\"flex justify-center\">\r\n                <button id=\"copyBtn\"\r\n                        class=\"btn bg-green-500 text-white py-1 px-3 rounded hover:bg-green-600\">Copy Cron\r\n                </button>\r\n            </div>\r\n        </div>\r\n        <hr class=\"mb-2 mt-2\">\r\n        <div class=\"description-section\">\r\n            <p class=\"font-medium indent-3\">Description:</p>\r\n            <p id=\"cron-description\"\r\n               class=\"text-center text-sky-500 mb-4\">Select values to generate a cron expression.</p>\r\n        </div>\r\n    </div>\r\n\r\n    <script src=\"https://unpkg.com/cronstrue@latest/dist/cronstrue.min.js\"></script>\r\n    <script>\r\n        document.addEventListener('DOMContentLoaded', () => {\r\n          const minuteInput = document.getElementById('from-minute');\r\n          const hourInput = document.getElementById('from-hour');\r\n          const domInput = document.getElementById('from-day-of-month');\r\n          const monthSelect = document.getElementById('from-month');\r\n          const dowSelect = document.getElementById('from-day-of-week');\r\n          const cronExprDiv = document.getElementById('cron-expression');\r\n          const descriptionPara = document.getElementById('cron-description');\r\n          const generateBtn = document.getElementById('generateBtn');\r\n          const clearBtn = document.getElementById('clearBtn');\r\n          const copyBtn = document.getElementById('copyBtn');\r\n\r\n          function generateCron() {\r\n            const minute = minuteInput.value.trim() || '*';\r\n            const hour = hourInput.value.trim() || '*';\r\n            const dom = domInput.value.trim() || '*';\r\n            const month = monthSelect.value;\r\n            const dow = dowSelect.value;\r\n\r\n            const cronString = `${minute} ${hour} ${dom} ${month} ${dow}`;\r\n\r\n            cronExprDiv.textContent = cronString;\r\n\r\n            try {\r\n              const description = cronstrue.toString(cronString);\r\n              descriptionPara.textContent = description;\r\n            } catch (e) {\r\n              descriptionPara.textContent = 'Invalid cron expression.';\r\n            }\r\n          }\r\n\r\n          function clearInputs() {\r\n            minuteInput.value = '';\r\n            hourInput.value = '';\r\n            domInput.value = '';\r\n            monthSelect.value = '*';\r\n            dowSelect.value = '*';\r\n            cronExprDiv.textContent = '* * * * *';\r\n            descriptionPara.textContent = 'Select values to generate a cron expression.';\r\n          }\r\n\r\n          function copyToClipboard() {\r\n            const cronText = cronExprDiv.textContent;\r\n            navigator.clipboard.writeText(cronText);\r\n          }\r\n\r\n          generateBtn.addEventListener('click', generateCron);\r\n          clearBtn.addEventListener('click', clearInputs);\r\n          copyBtn.addEventListener('click', copyToClipboard);\r\n\r\n          generateCron();\r\n        });\r\n    </script>\r\n</body>\r\n\r\n"
  },
  {
    "path": "source/widget/gradient-maker.html",
    "content": "<body class=\"bg-gray-500 flex flex-col items-center justify-center min-h-screen p-4\">\r\n  <!-- Color pickers -->\r\n  <div class=\"flex space-x-4 mb-6 items-center justify-center\">\r\n    <div class=\"flex flex-col items-center\">\r\n      <label class=\"mb-2 font-medium\" for=\"color1\">Color 1</label>\r\n      <input type=\"color\" id=\"color1\" value=\"#ff7e5f\" class=\"w-16 h-16 border-2 border-gray-300 rounded-full cursor-pointer\"/>\r\n    </div>\r\n    <div class=\"flex flex-col items-center\">\r\n      <label class=\"mb-2 font-medium\" for=\"color2\">Color 2</label>\r\n      <input type=\"color\" id=\"color2\" value=\"#feb47b\" class=\"w-16 h-16 border-2 border-gray-300 rounded-full cursor-pointer\"/>\r\n    </div>\r\n  </div>\r\n\r\n  <!-- Gradient display -->\r\n  <div class=\"flex justify-center w-full\">\r\n    <div id=\"gradientBox\" class=\"w-full max-w-xl h-64 rounded-lg shadow-lg border border-gray-300\" style=\"background: linear-gradient(to right, #ff7e5f, #8000ff);\"></div>\r\n  </div>\r\n\r\n  <!-- CSS code display -->\r\n  <div class=\"flex justify-center w-full mt-5 mb-4\">\r\n    <div class=\"mt-5 w-full max-w-xl bg-gray-500 p-4 rounded-lg shadow-inner\">\r\n      <div>\r\n        <h2 class=\"text-lg font-semibold mb-2 text-white text-center\">CSS Code</h2>\r\n        <pre id=\"cssCode\" class=\"p-2 rounded overflow-x-auto text-neutral-900 bg-gray-100\">background: linear-gradient(to right,  #ff7e5f, #8000ff);</pre>\r\n      </div>\r\n    </div>\r\n  </div>\r\n\r\n  <script>\r\n    const colorInput1 = document.getElementById('color1');\r\n    const colorInput2 = document.getElementById('color2');\r\n    const gradientBox = document.getElementById('gradientBox');\r\n    const cssCode = document.getElementById('cssCode');\r\n\r\n    function updateGradient() {\r\n      const color1 = colorInput1.value;\r\n      const color2 = colorInput2.value;\r\n      const gradientStyle = `linear-gradient(to right, ${color1}, ${color2})`;\r\n\r\n      // Update background\r\n      gradientBox.style.background = gradientStyle;\r\n\r\n      // Update CSS code display\r\n      cssCode.textContent = `background: ${gradientStyle};`;\r\n    }\r\n\r\n    // Event listeners\r\n    colorInput1.addEventListener('input', updateGradient);\r\n    colorInput2.addEventListener('input', updateGradient);\r\n\r\n    // Initialize\r\n    updateGradient();\r\n  </script>\r\n</body>\r\n"
  },
  {
    "path": "tailwind.config.js",
    "content": "module.exports = {\n  darkMode: 'class', // or 'media' or 'class'\n  plugins: [\n    // https://github.com/jamiebuilds/tailwindcss-animate\n    require('tailwindcss-animate')\n  ],\n  theme: {\n    boxShadow: {\n      /* Customized */\n      DEFAULT: '0 6px 8px rgba(102, 119, 136, 0.03), 0 1px 2px rgba(102, 119, 136, 0.3)',\n      md: '0 4px 6px -1px rgba(102, 119, 136, 0.05), 0 2px 4px -1px rgba(102, 119, 136, 0.35)',\n\n      /* Default */\n      sm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',\n      lg: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',\n      xl: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',\n      '2xl': '0 25px 50px -12px rgba(0, 0, 0, 0.25)',\n      '3xl': '0 35px 60px -15px rgba(0, 0, 0, 0.3)',\n      inner: 'inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)',\n      none: 'none'\n    }\n  },\n  content: {\n    files: [\n      'source/**/*.md',\n      'themes/coo/layout/**/*.ejs',\n      'source/widget/*.html',\n      'themes/coo/source/js/main.js'\n    ]\n  }\n};\n"
  },
  {
    "path": "themes/coo/_config.yml",
    "content": "# Limit on the number of recent articles\nrecent_posts_limits: 4\n\n# The categories and order displayed on the home page\nindex_categories:\n  - Programming\n  - Toolkit\n  - Operating System\n  - Linux Command\n  - Python\n  - Database\n  - Keyboard Shortcuts\n  - Game\n  - Other\n\n# Home recommended posts\nindex_recommends:\n  - chatgpt\n  - bash\n  - python\n  - javascript\n  - go\n  - vim\n  - regex\n  - awk\n\n# Related popular posts\n# Dependencies: https://github.com/tea3/hexo-related-popular-posts\nrelated_posts:\n  enable: true\n  title: Related\n  params:\n    maxCount: 4\n    #PPMixingRate: 0.0\n    #isDate: false\n    #isImage: false\n    #isExcerpt: false\n\ntop_posts:\n  enable: true\n  title: Top\n  params:\n    maxCount: 4\n    PPMixingRate: 1.0\n"
  },
  {
    "path": "themes/coo/languages/default.yml",
    "content": "categories: Categories\nsearch: Search\ntags: Tags\ntagcloud: Tag Cloud\nprev: \"Prev: %s\"\nnext: \"Next: %s\"\ncomment: Comments\narchive_a: Archives\narchive_b: \"Archives: %s\"\npage: Page %d\nrecent_posts: Recent Posts\nblogroll: Links\nreturntop: Return to top\nreadmore: READ MORE\nfloatmenu: Menu\n\nmenu:\n  home: Home\n  archives: Archives\n  category: Categories\n  search: Search\ncurrent_page: Current page\npage_name:\n  categories: (Categories)\n  tags: (Tags)\n  archives: (Archives)\ngo_back_home: Go back home\nno_title: No title\n"
  },
  {
    "path": "themes/coo/layout/_partial/buttons/buy-coffee.ejs",
    "content": "<%\n// Buy Me a Coffee button component\n// variant: 'hero' | 'compact' | 'inline'\n// showLabel: boolean - whether to show text label\n// className: string - additional CSS class names\n\nconst variant = locals.variant || 'inline';\nconst showLabel = locals.showLabel !== false; // show label by default\nconst className = locals.className || '';\n\n// Set styles based on variant\nconst buttonBaseClass = {\n    hero: 'group inline-flex items-center justify-center px-6 py-3 backdrop-blur-sm outline outline-1 rounded-3xl transition-all duration-300 hover:scale-105 hover:shadow-lg',\n    compact: 'group inline-flex items-center justify-center h-9 px-3 backdrop-blur-sm outline outline-1 rounded-3xl transition-colors duration-200',\n    inline: 'group inline-flex items-center justify-center h-9 px-4 backdrop-blur-sm outline outline-1 rounded-3xl transition-all duration-200 hover:scale-105'\n}[variant];\n\n// Coffee button styles\nconst coffeeClass = {\n    hero: 'bg-gradient-to-r from-orange-500/20 to-yellow-500/20 outline-orange-300/30 text-white hover:from-orange-500/30 hover:to-yellow-500/30',\n    compact: is_home() ? 'bg-white/10 outline-white/20 text-white hover:bg-white/20' : 'bg-gradient-to-r from-orange-500/10 to-yellow-500/10 outline-orange-300/30 text-slate-700 dark:text-slate-300 hover:from-orange-500/20 hover:to-yellow-500/20',\n    inline: 'bg-gradient-to-r from-orange-500/10 to-yellow-500/10 outline-orange-300/30 text-slate-700 dark:text-slate-300 hover:from-orange-500/20 hover:to-yellow-500/20'\n}[variant];\n\n// Icon size and styles\nconst iconClass = {\n    hero: 'w-5 h-5 flex-shrink-0 flex items-center justify-center',\n    compact: 'w-4 h-4 flex-shrink-0 flex items-center justify-center',\n    inline: 'w-4 h-4 flex-shrink-0 flex items-center justify-center'\n}[variant];\n\n// Actual SVG icon size\nconst svgSize = {\n    hero: '20', // w-5 h-5 = 20px\n    compact: '16', // w-4 h-4 = 16px\n    inline: '16'  // w-4 h-4 = 16px\n}[variant];\n\n// Text size\nconst textSize = {\n    hero: 'font-semibold leading-none',\n    compact: 'text-sm font-medium leading-none',\n    inline: 'text-sm font-medium leading-none'\n}[variant];\n\n// Spacing\nconst spacing = {\n    hero: 'mr-3',\n    compact: 'mr-2',\n    inline: 'mr-2'\n}[variant];\n%>\n\n<a href=\"/support/\" title=\"Buy Me a Coffee - Support cheatsheets.zip\"\n   class=\"<%= buttonBaseClass %> <%= coffeeClass %> <%= className %>\">\n    <div class=\"<%= iconClass %> <%= spacing %>\">\n        <svg width=\"<%= svgSize %>\" height=\"<%= svgSize %>\" viewBox=\"0 0 25 35\" fill=\"currentColor\">\n            <path d=\"M22.0672 8.1281 22.0437 8.11426 21.9893 8.09766C22.0112 8.11614 22.0386 8.12685 22.0672 8.1281z\" fill=\"currentColor\"></path>\n            <path d=\"M22.4111 10.5781 22.3848 10.5855 22.4111 10.5781z\" fill=\"currentColor\"></path>\n            <path d=\"M22.0735 8.11128C22.0708 8.11093 22.0681 8.11029 22.0655 8.10938 22.0654 8.11115 22.0654 8.11293 22.0655 8.1147 22.0685 8.11432 22.0712 8.11313 22.0735 8.11128z\" fill=\"currentColor\"></path>\n            <path d=\"M22.3877 10.5647 22.4274 10.5421 22.4421 10.5338 22.4555 10.5195C22.4303 10.5304 22.4074 10.5457 22.3877 10.5647z\" fill=\"currentColor\"></path>\n            <path d=\"M22.1334 8.1762 22.0947 8.1393 22.0684 8.125C22.0825 8.14993 22.1058 8.16832 22.1334 8.1762z\" fill=\"currentColor\"></path>\n            <path d=\"M12.3836 31.9453C12.3526 31.9587 12.3255 31.9796 12.3047 32.0062L12.3291 31.9905C12.3457 31.9753 12.3693 31.9573 12.3836 31.9453z\" fill=\"currentColor\"></path>\n            <path d=\"M18.0497 30.8309C18.0497 30.7958 18.0326 30.8023 18.0368 30.9268 18.0368 30.9167 18.0409 30.9065 18.0428 30.8969 18.0451 30.8747 18.0469 30.853 18.0497 30.8309z\" fill=\"currentColor\"></path>\n            <path d=\"M17.4617 31.9453C17.4307 31.9587 17.4036 31.9796 17.3828 32.0062L17.4073 31.9905C17.4239 31.9753 17.4474 31.9573 17.4617 31.9453z\" fill=\"currentColor\"></path>\n            <path d=\"M8.39845 32.2145C8.37496 32.1941 8.34619 32.1807 8.31543 32.1758 8.34034 32.1878 8.36524 32.1998 8.38185 32.209L8.39845 32.2145z\" fill=\"currentColor\"></path>\n            <path d=\"M7.50541 31.3533C7.50173 31.317 7.49058 31.2818 7.47266 31.25 7.48535 31.2831 7.49598 31.317 7.50448 31.3515L7.50541 31.3533z\" fill=\"currentColor\"></path>\n            <path d=\"M13.5278 15.9814C12.2963 16.5086 10.8987 17.1064 9.08736 17.1064 8.32963 17.1048 7.57558 17.0009 6.8457 16.7973L8.09845 29.6592C8.14279 30.1968 8.38769 30.698 8.78452 31.0634 9.18134 31.4288 9.70106 31.6316 10.2405 31.6315 10.2405 31.6315 12.0167 31.7237 12.6094 31.7237 13.2474 31.7237 15.1601 31.6315 15.1601 31.6315 15.6995 31.6315 16.2191 31.4286 16.6158 31.0633 17.0125 30.6979 17.2574 30.1967 17.3017 29.6592l1.3418-14.2129C18.0439 15.2415 17.4387 15.1055 16.7565 15.1055 15.5767 15.105 14.626 15.5114 13.5278 15.9814z\" fill=\"#FD0\"></path>\n            <path d=\"M2.96582 10.5039l.02122.0198L3.00088 10.532C2.99022 10.5215 2.97847 10.512 2.96582 10.5039z\" fill=\"currentColor\"></path>\n            <path d=\"M24.4376 9.31226 24.249 8.36071C24.0797 7.50694 23.6955 6.70022 22.8191 6.39164 22.5382 6.29294 22.2195 6.2505 22.0041 6.04617 21.7887 5.84184 21.725 5.5245 21.6752 5.23023 21.583 4.6901 21.4963 4.14952 21.4017 3.61033 21.3201 3.14677 21.2555 2.62602 21.0428 2.20075 20.7661 1.62973 20.1918 1.29579 19.6208 1.07485 19.3282.965622 19.0296.873222 18.7265.798101 17.2998.421723 15.7999.283349 14.3322.204476c-1.7617-.097207-3.528-.06792-5.28547.087637-1.3081.119001-2.68584.262911-3.9289.715397C4.6635 1.1731 4.19533 1.37189 3.84986 1.7229c-.42389.43127-.56226 1.09823-.25276 1.63604.22001.38192.5927.65175.98799.83025.51488.23 1.0526.40501 1.60422.52213 1.53595.33948 3.12679.47278 4.69599.52951C12.6245 5.31103 14.3665 5.25414 16.0974 5.07063 16.5254 5.02359 16.9527 4.96716 17.3792 4.90136 17.8815 4.82433 18.2039 4.16751 18.0558 3.70995 17.8787 3.16292 17.4027 2.95074 16.8644 3.0333 16.7851 3.04576 16.7062 3.05729 16.6269 3.06882L16.5697 3.07712C16.3873 3.10019 16.205 3.12171 16.0226 3.1417 15.646 3.18229 15.2683 3.2155 14.8898 3.24133 14.042 3.30037 13.192 3.32758 12.3423 3.32896 11.5075 3.32896 10.6722 3.30544 9.83916 3.25055 9.45909 3.22564 9.07994 3.19397 8.70172 3.15553 8.52967 3.13755 8.35809 3.11864 8.18651 3.09742L8.02322 3.07666 7.98771 3.07159 7.81843 3.04714C7.4725 2.99502 7.12656 2.93506 6.78431 2.86264 6.74978 2.85498 6.71889 2.83577 6.69675 2.80818 6.67461 2.78059 6.66254 2.74627 6.66254 2.71089 6.66254 2.67552 6.67461 2.6412 6.69675 2.61361 6.71889 2.58602 6.74978 2.5668 6.78431 2.55914H6.79077C7.08735 2.49595 7.38624 2.44199 7.68605 2.39494 7.78599 2.37926 7.88623 2.36388 7.98679 2.34881H7.98955C8.17728 2.33636 8.36593 2.30269 8.55274 2.28055c1.62526-.16906 3.26026-.22669 4.89336-.17251C14.239 2.13111 15.0314 2.17769 15.8206 2.25795 15.9903 2.27548 16.1592 2.29393 16.328 2.31468 16.3926 2.32252 16.4576 2.33175 16.5226 2.33959l.131.01891C17.0355 2.41539 17.4154 2.48442 17.7934 2.5656 18.3533 2.68737 19.0724 2.72704 19.3215 3.3405 19.4008 3.53514 19.4368 3.75147 19.4806 3.9558L19.5364 4.2164C19.5379 4.22108 19.5389 4.22586 19.5396 4.2307 19.6716 4.8457 19.8036 5.46069 19.9359 6.07569 19.9455 6.12112 19.9458 6.16806 19.9365 6.21359 19.9273 6.25911 19.9087 6.30224 19.8821 6.34028 19.8554 6.37832 19.8212 6.41046 19.7816 6.4347 19.7419 6.45893 19.6977 6.47474 19.6517 6.48113H19.648L19.5673 6.4922 19.4875 6.50281C19.2348 6.53571 18.9817 6.56646 18.7283 6.59506 18.2292 6.65194 17.7294 6.70114 17.2288 6.74265 16.234 6.82537 15.2373 6.87965 14.2385 6.90548 13.7296 6.919 13.2209 6.92531 12.7123 6.92439 10.6878 6.92279 8.66519 6.80513 6.65424 6.57199 6.43653 6.54616 6.21883 6.51849 6.00112 6.49035 6.16993 6.51203 5.87843 6.47375 5.81939 6.46545 5.68101 6.44607 5.54264 6.42593 5.40426 6.40502 4.93979 6.33537 4.47808 6.24958 4.01453 6.1744 3.45411 6.08215 2.91814 6.12827 2.41123 6.40502c-.4161.2277-.75287.57686-.96539 1.00091-.21863.45202-.28367.94417-.38145 1.42987C.966604 9.32149.814392 9.84408.872048 10.3427c.124075 1.0761.876372 1.9506 1.958452 2.1462 1.01798.1845 2.04148.3339 3.06776.4612C9.9297 13.4439 14.0025 13.5029 18.0466 13.1263 18.3759 13.0956 18.7048 13.062 19.0332 13.0258 19.1358 13.0145 19.2396 13.0263 19.337 13.0604 19.4344 13.0944 19.523 13.1498 19.5962 13.2225S19.7255 13.3834 19.7602 13.4805C19.795 13.5777 19.8075 13.6814 19.797 13.7841L19.6946 14.7794C19.4883 16.7908 19.282 18.802 19.0756 20.813 18.8604 22.9249 18.6437 25.0366 18.4257 27.1482 18.3642 27.7429 18.3027 28.3375 18.2412 28.9319 18.1822 29.5172 18.1739 30.121 18.0627 30.6994 17.8875 31.609 17.2717 32.1675 16.3732 32.3719 15.55 32.5592 14.7091 32.6575 13.8649 32.6652 12.929 32.6703 11.9936 32.6288 11.0578 32.6338 10.0587 32.6394 8.83502 32.5471 8.06381 31.8036 7.38624 31.1505 7.29261 30.1279 7.20036 29.2437c-.123-1.1707-.24492-2.3412-.36577-3.5115l-.67803-6.5077-.43865-4.2108C5.71053 14.9441 5.70315 14.8754 5.69623 14.8053 5.64365 14.303 5.28803 13.8113 4.72761 13.8366 4.24792 13.8579 3.70272 14.2656 3.759 14.8053l.32517 3.1217L4.75667 24.3844C4.94824 26.2187 5.13935 28.0532 5.33 29.888 5.3669 30.2395 5.40149 30.5919 5.44024 30.9434c.21079 1.9206 1.67755 2.9556 3.49395 3.2472C9.99506 34.3612 11.0818 34.3963 12.1583 34.4138 13.5384 34.4359 14.9322 34.489 16.2897 34.239c2.0115-.369 3.5207-1.7122 3.7361-3.7956C20.0873 29.8419 20.1488 29.2403 20.2103 28.6385 20.4148 26.6484 20.619 24.6581 20.8228 22.6677L21.4898 16.1641 21.7956 13.1835C21.8108 13.0357 21.8733 12.8968 21.9736 12.7872 22.0739 12.6776 22.2069 12.6033 22.3528 12.5751 22.928 12.463 23.4778 12.2716 23.8869 11.8339 24.5382 11.137 24.6678 10.2283 24.4376 9.31226zM2.80098 9.95524C2.80975 9.95109 2.7936 10.0263 2.78669 10.0613 2.7853 10.0083 2.78807 9.96124 2.80098 9.95524zM2.8568 10.387C2.86141 10.3837 2.87524 10.4022 2.88954 10.4243 2.86786 10.404 2.85403 10.3888 2.85633 10.387H2.8568zM2.91168 10.4594C2.93152 10.4931 2.94213 10.5143 2.91168 10.4594v0zM3.02192 10.5489H3.02469C3.02469 10.5521 3.02976 10.5553 3.03161 10.5586 3.02855 10.555 3.02515 10.5518 3.02146 10.5489H3.02192zM22.326 10.4151C22.1194 10.6116 21.8081 10.7029 21.5004 10.7486 18.0503 11.2606 14.5499 11.5198 11.0619 11.4054 8.56565 11.3201 6.09567 11.0429 3.62431 10.6937 3.38215 10.6596 3.11971 10.6153 2.9532 10.4368c-.31365-.3367-.1596-1.01476-.07796-1.42158C2.94997 8.64253 3.09295 8.14577 3.53621 8.09272 4.22808 8.01155 5.03158 8.30352 5.71607 8.4073 6.54016 8.53306 7.36733 8.63377 8.19758 8.70941 11.7409 9.03229 15.3437 8.98201 18.8713 8.50969 19.5143 8.42329 20.1549 8.32289 20.7933 8.2085 21.362 8.10656 21.9926 7.91515 22.3362 8.50416 22.5719 8.90544 22.6033 9.44233 22.5668 9.89574 22.5556 10.0933 22.4693 10.2791 22.3256 10.4151H22.326z\" fill=\"currentColor\"></path>\n        </svg>\n    </div>\n    <% if (showLabel) { %>\n        <span class=\"<%= textSize %>\">\n            <% if (variant === 'compact') { %>Coffee<% } else { %>Buy Me a Coffee<% } %>\n        </span>\n    <% } %>\n</a> "
  },
  {
    "path": "themes/coo/layout/_partial/buttons/follow-x.ejs",
    "content": "<%\n// Follow on X button component\n// variant: 'hero' | 'compact' | 'inline'\n// showLabel: boolean - whether to show text label\n// className: string - additional CSS class names\n\nconst variant = locals.variant || 'inline';\nconst showLabel = locals.showLabel !== false; // show label by default\nconst className = locals.className || '';\n\n// Set styles based on variant\nconst buttonBaseClass = {\n    hero: 'group inline-flex items-center justify-center px-6 py-3 backdrop-blur-sm outline outline-1 rounded-3xl transition-all duration-300 hover:scale-105 hover:shadow-lg',\n    compact: 'group inline-flex items-center justify-center h-9 px-3 backdrop-blur-sm outline outline-1 rounded-3xl transition-colors duration-200',\n    inline: 'group inline-flex items-center justify-center h-9 px-4 backdrop-blur-sm outline outline-1 rounded-3xl transition-all duration-200 hover:scale-105',\n    request: 'group inline-flex items-center justify-center px-6 py-3 backdrop-blur-sm outline outline-1 rounded-3xl transition-all duration-300 hover:scale-105 hover:shadow-lg'\n}[variant];\n\n// X button styles - consistent background colors with GitHub button\nconst xClass = {\n    hero: 'bg-white/10 outline-white/20 text-white hover:bg-white/20',\n    compact: is_home() ? 'bg-white/10 outline-white/20 text-white hover:bg-white/20' : 'bg-white outline-slate-200 dark:bg-slate-800 dark:outline-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-700',\n    inline: 'bg-white outline-slate-200 dark:bg-slate-800 dark:outline-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-700',\n    request: 'bg-blue-600/80 outline-blue-500/50 text-white hover:bg-blue-500/90 dark:bg-blue-500/20 dark:outline-blue-400/30 dark:text-white dark:hover:bg-blue-500/30'\n}[variant];\n\n// Icon size and styles\nconst iconClass = {\n    hero: 'w-5 h-5 flex-shrink-0 flex items-center justify-center',\n    compact: 'w-4 h-4 flex-shrink-0 flex items-center justify-center',\n    inline: 'w-4 h-4 flex-shrink-0 flex items-center justify-center',\n    request: 'w-5 h-5 flex-shrink-0 flex items-center justify-center'\n}[variant];\n\n// Text size\nconst textSize = {\n    hero: 'font-semibold leading-none',\n    compact: 'text-sm font-medium leading-none',\n    inline: 'text-sm font-medium leading-none',\n    request: 'font-semibold leading-none'\n}[variant];\n\n// Spacing\nconst spacing = {\n    hero: 'mr-3',\n    compact: 'mr-2',\n    inline: 'mr-2',\n    request: 'mr-3'\n}[variant];\n%>\n\n<% if (variant === 'request') { %>\n<a href=\"https://x.com/FechinLi\" target=\"_blank\" rel=\"noopener noreferrer\" title=\"Follow @FechinLi on X (Twitter)\"\n   class=\"<%= buttonBaseClass %> <%= xClass %> <%= className %>\">\n    <div class=\"<%= iconClass %> <%= spacing %> group-hover:scale-110 transition-transform\">\n        <%- icon(\"x\") %>\n    </div>\n    <% if (showLabel) { %>\n        <span class=\"<%= textSize %>\">\n            Follow us on X\n        </span>\n        <div class=\"ml-2 group-hover:translate-x-1 transition-transform leading-none\">\n            →\n        </div>\n    <% } %>\n</a>\n<% } else { %>\n<a href=\"https://x.com/FechinLi\" target=\"_blank\" rel=\"noopener noreferrer\" title=\"Follow @FechinLi on X (Twitter)\"\n   class=\"<%= buttonBaseClass %> <%= xClass %> <%= className %>\">\n    <div class=\"<%= iconClass %> <%= spacing %> <% if (variant === 'hero') { %>group-hover:scale-110 transition-transform<% } %>\">\n        <%- icon(\"x\") %>\n    </div>\n    <% if (showLabel) { %>\n        <span class=\"<%= textSize %>\">\n            <% if (variant === 'compact') { %>Follow<% } else { %>Follow us on X<% } %>\n        </span>\n        <% if (variant === 'hero') { %>\n            <div class=\"ml-2 group-hover:translate-x-1 transition-transform leading-none\">\n                →\n            </div>\n        <% } %>\n    <% } %>\n</a>\n<% } %> "
  },
  {
    "path": "themes/coo/layout/_partial/buttons/github-contribute.ejs",
    "content": "<%\n// GitHub Contribute button component\n// variant: 'hero' | 'compact' | 'inline' | 'request'\n// showLabel: boolean - whether to show text label\n// className: string - additional CSS class names\n\nconst variant = locals.variant || 'request';\nconst showLabel = locals.showLabel !== false; // show label by default\nconst className = locals.className || '';\n\n// Set styles based on variant\nconst buttonBaseClass = {\n    hero: 'group inline-flex items-center justify-center px-6 py-3 backdrop-blur-sm outline outline-1 rounded-3xl transition-all duration-300 hover:scale-105 hover:shadow-lg',\n    compact: 'group inline-flex items-center justify-center h-9 px-3 backdrop-blur-sm outline outline-1 rounded-3xl transition-colors duration-200',\n    inline: 'group inline-flex items-center justify-center h-9 px-4 backdrop-blur-sm outline outline-1 rounded-3xl transition-all duration-200 hover:scale-105',\n    request: 'group inline-flex items-center justify-center px-6 py-3 backdrop-blur-sm outline outline-1 rounded-3xl transition-all duration-300 hover:scale-105 hover:shadow-lg'\n}[variant];\n\n// GitHub button styles\nconst githubClass = {\n    hero: 'bg-white/10 outline-white/20 text-white hover:bg-white/20',\n    compact: is_home() ? 'bg-white/10 outline-white/20 text-white hover:bg-white/20' : 'bg-white outline-slate-200 dark:bg-slate-800 dark:outline-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-700',\n    inline: 'bg-white outline-slate-200 dark:bg-slate-800 dark:outline-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-700',\n    request: 'bg-slate-800/80 outline-slate-700/50 text-white hover:bg-slate-700/90 dark:bg-white/10 dark:outline-white/20 dark:text-white dark:hover:bg-white/20'\n}[variant];\n\n// Icon size and styles\nconst iconClass = {\n    hero: 'w-5 h-5 flex-shrink-0 flex items-center justify-center',\n    compact: 'w-4 h-4 flex-shrink-0 flex items-center justify-center',\n    inline: 'w-4 h-4 flex-shrink-0 flex items-center justify-center',\n    request: 'w-5 h-5 flex-shrink-0 flex items-center justify-center'\n}[variant];\n\n// Text size\nconst textSize = {\n    hero: 'font-semibold leading-none',\n    compact: 'text-sm font-medium leading-none',\n    inline: 'text-sm font-medium leading-none',\n    request: 'font-semibold leading-none'\n}[variant];\n\n// Spacing\nconst spacing = {\n    hero: 'mr-3',\n    compact: 'mr-2',\n    inline: 'mr-2',\n    request: 'mr-3'\n}[variant];\n%>\n\n<a href=\"<%- contributing() %>\" target=\"_blank\" rel=\"noopener noreferrer\" title=\"Contribute on GitHub\"\n   class=\"<%= className %>\">\n    <button type=\"button\" class=\"<%= buttonBaseClass %> <%= githubClass %>\">\n        <div class=\"<%= iconClass %> <%= spacing %>\">\n            <%- icon(\"github\") %>\n        </div>\n        <% if (showLabel) { %>\n            <span class=\"<%= textSize %>\">\n                <% if (variant === 'compact') { %>Contribute<% } else { %>Contribute on GitHub<% } %>\n            </span>\n        <% } %>\n    </button>\n</a> "
  },
  {
    "path": "themes/coo/layout/_partial/buttons/github-star.ejs",
    "content": "<%\n// GitHub Star button component\n// variant: 'hero' | 'compact' | 'inline'\n// showLabel: boolean - whether to show text label\n// className: string - additional CSS class names\n\nconst variant = locals.variant || 'inline';\nconst showLabel = locals.showLabel !== false; // show label by default\nconst className = locals.className || '';\n\n// Set styles based on variant\nconst buttonBaseClass = {\n    hero: 'group inline-flex items-center justify-center px-6 py-3 backdrop-blur-sm outline outline-1 rounded-3xl transition-all duration-300 hover:scale-105 hover:shadow-lg',\n    compact: 'group inline-flex items-center justify-center h-9 px-3 backdrop-blur-sm outline outline-1 rounded-3xl transition-colors duration-200',\n    inline: 'group inline-flex items-center justify-center h-9 px-4 backdrop-blur-sm outline outline-1 rounded-3xl transition-all duration-200 hover:scale-105'\n}[variant];\n\n// GitHub button styles\nconst githubClass = {\n    hero: 'bg-white/10 outline-white/20 text-white hover:bg-white/20',\n    compact: is_home() ? 'bg-white/10 outline-white/20 text-white hover:bg-white/20' : 'bg-white outline-slate-200 dark:bg-slate-800 dark:outline-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-700',\n    inline: 'bg-white outline-slate-200 dark:bg-slate-800 dark:outline-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-700'\n}[variant];\n\n// Icon size and styles\nconst iconClass = {\n    hero: 'w-5 h-5 flex-shrink-0 flex items-center justify-center',\n    compact: 'w-4 h-4 flex-shrink-0 flex items-center justify-center',\n    inline: 'w-4 h-4 flex-shrink-0 flex items-center justify-center'\n}[variant];\n\n// Text size\nconst textSize = {\n    hero: 'font-semibold leading-none',\n    compact: 'text-sm font-medium leading-none',\n    inline: 'text-sm font-medium leading-none'\n}[variant];\n\n// Spacing\nconst spacing = {\n    hero: 'mr-3',\n    compact: 'mr-2',\n    inline: 'mr-2'\n}[variant];\n%>\n\n<a href=\"<%- edit_page() %>\" target=\"_blank\" rel=\"noopener noreferrer\" title=\"Star cheatsheets.zip on GitHub\"\n   class=\"<%= buttonBaseClass %> <%= githubClass %> <%= className %>\">\n    <div class=\"<%= iconClass %> <%= spacing %>\">\n        <%- icon(\"github\") %>\n    </div>\n    <% if (showLabel) { %>\n        <span class=\"<%= textSize %>\">\n            <% if (variant === 'compact') { %>Star<% } else { %>Star on GitHub<% } %>\n        </span>\n    <% } %>\n    <!-- GitHub Stars Counter -->\n    <% if (variant === 'compact') { %>\n        <% if (is_home()) { %>\n            <div id=\"github-stars-<%= variant %>\" class=\"ml-2 px-2 py-1 bg-white/10 outline outline-1 outline-white/20 rounded-3xl text-xs font-mono leading-none\">\n                <span class=\"loading-dots\">...</span>\n            </div>\n        <% } else { %>\n            <div id=\"github-stars-<%= variant %>\" class=\"ml-2 px-2 py-1 bg-slate-100 dark:bg-slate-700 outline outline-1 outline-slate-200 dark:outline-slate-600 rounded-3xl text-xs font-mono leading-none\">\n                <span class=\"loading-dots\">...</span>\n            </div>\n        <% } %>\n    <% } else { %>\n        <div id=\"github-stars-<%= variant %>\" class=\"ml-3 px-2 py-1 bg-white/20 rounded-3xl text-xs font-mono leading-none\">\n            <span class=\"loading-dots\">...</span>\n        </div>\n    <% } %>\n</a> "
  },
  {
    "path": "themes/coo/layout/_partial/comment.ejs",
    "content": "<%\nvar pageId = page.path;\nvar pageUrl = page.permalink;\nvar pageTitle = page.title;\n%>\n\n<% if (theme.disqus_shortname && page.comments){ %>\n    <section id=\"comment\">\n        <div id=\"disqus_thread\"></div>\n        <script>\n            var disqus_config = function () {\n                this.page.url = '<%= pageUrl %>';\n                this.page.identifier = '<%= pageId %>';\n            };\n            (function () {\n                var d = document,\n                    s = d.createElement('script');\n                s.src = '//<%= theme.disqus_shortname %>.disqus.com/embed.js';\n                s.setAttribute('_data-timestamp', +new Date());\n                (d.head || d.section).appendChild(s);\n            })();\n        </script>\n        <noscript>Please enable JavaScript to view the\n            <a href=\"https://disqus.com/?ref_noscript\" rel=\"external nofollow\" title=\"Disqus - comments powered by Disqus\">comments powered by Disqus.</a>\n        </noscript>\n    </section>\n<% } %>\n"
  },
  {
    "path": "themes/coo/layout/_partial/footer.ejs",
    "content": "<footer class=\"text-slate-700 dark:text-slate-300 bg-slate-200 dark:bg-slate-800 md:mt-14\">\n    <% if (page.layout !== \"note\" && !page._isNotePagination) { %>\n        <div class=\"max-container mb-8 md:py-10 mx-auto\">\n            <div class=\"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-6 xl:gap-8\">\n                <!-- Top Cheatsheet -->\n                <div>\n                    <h3 class=\"text-lg font-semibold text-slate-900 dark:text-slate-100 mb-4 flex items-center\">\n                        Top <span class=\"text-slate-500\">&nbsp;Cheatsheet</span>\n                    </h3>\n                    <div class=\"space-y-3\">\n                        <% \n                        const topPostsData = topPosts(3);\n                        topPostsData.forEach(function(post, index) { \n                        %>\n                            <a href=\"<%- url_for(post.path) %>\" title=\"<%= post.title %> Cheatsheet - Popular Quick Reference\" class=\"group flex items-center p-3 bg-white dark:bg-slate-700 rounded-lg border border-slate-200 dark:border-slate-600 hover:border-indigo-300 dark:hover:border-indigo-500 transition-all duration-200 hover:shadow-md\">\n                                <div class=\"w-8 h-8 flex items-center justify-center flex-shrink-0 mr-3 text-indigo-600\">\n                                    <%- icon(post.slug) %>\n                                </div>\n                                <div class=\"min-w-0 flex-1\">\n                                    <h4 class=\"font-medium text-sm text-slate-900 dark:text-slate-100 group-hover:text-indigo-600 dark:group-hover:text-indigo-400 truncate\">\n                                        <%= post.title %> <span class=\"text-slate-400\">Cheatsheet</span>\n                                    </h4>\n                                    <p class=\"text-xs text-slate-500 dark:text-slate-400\">Popular Quick Reference</p>\n                                </div>\n                            </a>\n                        <% }); %>\n                    </div>\n                </div>\n\n                <!-- Recent Cheatsheet -->\n                <div>\n                    <h3 class=\"text-lg font-semibold text-slate-900 dark:text-slate-100 mb-4 flex items-center\">\n                        Recent <span class=\"text-slate-500\">&nbsp;Cheatsheet</span>\n                    </h3>\n                    <div class=\"space-y-3\">\n                        <% \n                        const recentPosts = site.posts.sort('date', -1).filter(post => post.layout !== \"note\").data.slice(0, 3);\n                        recentPosts.forEach(function(post, index) { \n                        %>\n                            <a href=\"<%- url_for(post.path) %>\" title=\"<%= post.title %> Cheatsheet - Latest Quick Reference\" class=\"group flex items-center p-3 bg-white dark:bg-slate-700 rounded-lg border border-slate-200 dark:border-slate-600 hover:border-blue-300 dark:hover:border-blue-500 transition-all duration-200 hover:shadow-md\">\n                                <div class=\"w-8 h-8 flex items-center justify-center flex-shrink-0 mr-3 text-blue-600\">\n                                    <%- icon(post.slug) %>\n                                </div>\n                                <div class=\"min-w-0 flex-1\">\n                                    <h4 class=\"font-medium text-sm text-slate-900 dark:text-slate-100 group-hover:text-blue-600 dark:group-hover:text-blue-400 truncate\">\n                                        <%= post.title %> <span class=\"text-slate-400\">Cheatsheet</span>\n                                    </h4>\n                                    <p class=\"text-xs text-slate-500 dark:text-slate-400\">Latest Quick Reference</p>\n                                </div>\n                            </a>\n                        <% }); %>\n                    </div>\n                </div>\n\n                <!-- Developer Tools -->\n                <div>\n                    <h3 class=\"text-lg font-semibold text-slate-900 dark:text-slate-100 mb-4 flex items-center\">\n                        <svg class=\"w-5 h-5 mr-2 text-purple-600\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\n                            <path d=\"M3 4a1 1 0 011-1h12a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1V4zM3 10a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H4a1 1 0 01-1-1v-6zM14 9a1 1 0 00-1 1v6a1 1 0 001 1h2a1 1 0 001-1v-6a1 1 0 00-1-1h-2z\"/>\n                        </svg>\n                        Developer <span class=\"text-slate-500\">&nbsp;Tools</span>\n                    </h3>\n                    <div class=\"space-y-3\">\n                        <a href=\"https://tableconvert.com?ref=cheatsheets\" target=\"_blank\" data-no-nofollow=\"true\" title=\"TableConvert - Convert tables between formats instantly for developers\" class=\"group flex items-center p-3 bg-white dark:bg-slate-700 rounded-lg border border-slate-200 dark:border-slate-600 hover:border-purple-300 dark:hover:border-purple-500 transition-all duration-200 hover:shadow-md\">\n                            <div class=\"w-8 h-8 flex items-center justify-center flex-shrink-0 mr-3\">\n                                <img src=\"/assets/icon/tableconvert.png\" alt=\"TableConvert logo\" class=\"w-6 h-6 rounded\">\n                            </div>\n                            <div class=\"min-w-0 flex-1\">\n                                <h4 class=\"font-medium text-sm text-slate-900 dark:text-slate-100 group-hover:text-purple-600 dark:group-hover:text-purple-400\">TableConvert</h4>\n                                <p class=\"text-xs text-slate-500 dark:text-slate-400 truncate\">Convert tables between formats</p>\n                            </div>\n                            <div class=\"opacity-0 group-hover:opacity-100 transition-opacity\">\n                                <svg class=\"w-4 h-4 text-purple-500\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n                                    <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14\"/>\n                                </svg>\n                            </div>\n                        </a>\n                        \n                        <a href=\"https://dorefer.com?ref=cheatsheets\" target=\"_blank\" data-no-nofollow=\"true\" title=\"doRefer - Find the best referral codes and signup bonuses\" class=\"group flex items-center p-3 bg-white dark:bg-slate-700 rounded-lg border border-slate-200 dark:border-slate-600 hover:border-purple-300 dark:hover:border-purple-500 transition-all duration-200 hover:shadow-md\">\n                            <div class=\"w-8 h-8 flex items-center justify-center flex-shrink-0 mr-3\">\n                                <img src=\"/assets/icon/dorefer.png\" alt=\"doRefer logo\" class=\"w-6 h-6 rounded\">\n                            </div>\n                            <div class=\"min-w-0 flex-1\">\n                                <h4 class=\"font-medium text-sm text-slate-900 dark:text-slate-100 group-hover:text-purple-600 dark:group-hover:text-purple-400\">doRefer</h4>\n                                <p class=\"text-xs text-slate-500 dark:text-slate-400 truncate\">Best referral codes & bonuses</p>\n                            </div>\n                            <div class=\"opacity-0 group-hover:opacity-100 transition-opacity\">\n                                <svg class=\"w-4 h-4 text-purple-500\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n                                    <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14\"/>\n                                </svg>\n                            </div>\n                        </a>\n                        \n                        <a href=\"https://fionaai.com?ref=cheatsheets\" target=\"_blank\" data-no-nofollow=\"true\" title=\"Fiona AI - Your intelligent Chrome AI assistant for productivity\" class=\"group flex items-center p-3 bg-white dark:bg-slate-700 rounded-lg border border-slate-200 dark:border-slate-600 hover:border-purple-300 dark:hover:border-purple-500 transition-all duration-200 hover:shadow-md\">\n                            <div class=\"w-8 h-8 flex items-center justify-center flex-shrink-0 mr-3\">\n                                <img src=\"/assets/icon/fionaai.png\" alt=\"Fiona AI logo\" class=\"w-6 h-6 rounded\">\n                            </div>\n                            <div class=\"min-w-0 flex-1\">\n                                <h4 class=\"font-medium text-sm text-slate-900 dark:text-slate-100 group-hover:text-purple-600 dark:group-hover:text-purple-400\">Fiona AI</h4>\n                                <p class=\"text-xs text-slate-500 dark:text-slate-400 truncate\">Chrome AI assistant</p>\n                            </div>\n                            <div class=\"opacity-0 group-hover:opacity-100 transition-opacity\">\n                                <svg class=\"w-4 h-4 text-purple-500\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n                                    <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14\"/>\n                                </svg>\n                            </div>\n                        </a>\n                    </div>\n                </div>\n\n                <!-- Logo Area -->\n                <div class=\"text-left\">\n                    <div class=\"mb-4\">\n                        <%- partial('_partial/index/logo', { icon: true, theme: 'light' }) %>\n                    </div>\n                    <p class=\"text-sm text-slate-600 dark:text-slate-400 mb-4\">\n                        Share quick reference and cheat sheet for developers.\n                    </p>\n                    <div class=\"space-y-2 text-sm\">\n                        <div><a href=\"/about/\" title=\"About - Learn more about cheatsheets.zip\" class=\"text-slate-600 dark:text-slate-400 hover:text-indigo-600 dark:hover:text-indigo-400\">About</a></div>\n                        <div><a href=\"/notes/\" title=\"Notes - Browse our developer notes and tutorials\" class=\"text-slate-600 dark:text-slate-400 hover:text-indigo-600 dark:hover:text-indigo-400\">Notes</a></div>\n                        <div><a href=\"/support/\" title=\"Support - Get help and support our project\" class=\"text-slate-600 dark:text-slate-400 hover:text-indigo-600 dark:hover:text-indigo-400\">Support</a></div>\n                    </div>\n                    <div class=\"mt-4\">\n                        <%- partial('share', { extra: 'justify-start' }) %>\n                    </div>\n                </div>\n            </div>\n        </div>\n    <% } %>\n    <div class=\"max-container flex flex-col sm:flex-row items-center \">\n        <p class=\"py-2 md:py-3 text-slate-500 text-sm text-center w-full\">\n            © <%= new Date().getFullYear() %> cheatsheets.zip, All rights reserved.\n        </p>\n    </div>\n</footer>\n"
  },
  {
    "path": "themes/coo/layout/_partial/head.ejs",
    "content": "<head>\n    <meta charset=\"utf-8\"/>\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge,chrome=1\"/>\n    <meta http-equiv='content-language' content='<%- config.language || 'en' %>'>\n    <meta name=\"language\" content=\"<%- config.language || 'en' %>\"/>\n    <meta name=\"renderer\" content=\"webkit\"/>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1\"/>\n    <meta name=\"app:pageurl\" content=\"/\"/>\n\n    <!-- title -->\n    <title><%- page_title() %></title>\n    <!-- keywords -->\n    <meta name=\"keywords\" content=\"<%- page_keywords() %>\"/>\n    <!-- description -->\n    <meta name=\"description\" content=\"<%- page_description() %>\"/>\n    \n    <!-- Additional SEO meta tags -->\n    <meta name=\"author\" content=\"<%- config.author %>\"/>\n    <meta name=\"robots\" content=\"index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1\"/>\n    <% if (is_post()) { %>\n    <meta name=\"article:author\" content=\"<%- config.title %>\"/>\n    <meta name=\"article:published_time\" content=\"<%- page.date.toISOString() %>\"/>\n    <meta name=\"article:modified_time\" content=\"<%- (page.updated || page.date).toISOString() %>\"/>\n    <% if (page.categories && page.categories.length > 0) { %>\n    <meta name=\"article:section\" content=\"<%- page.categories.toArray()[0].name %>\"/>\n    <% } %>\n    <% if (page.tags && page.tags.each) { %>\n    <% page.tags.each(function(tag) { %>\n    <meta name=\"article:tag\" content=\"<%- tag.name %>\"/>\n    <% }); %>\n    <% } %>\n    <% } %>\n\n    <!-- for social -->\n    <meta property=\"og:url\" content=\"<%- clean_url(url) %>\"/>\n    <meta property=\"og:title\" content=\"<%- page_title() %>\"/>\n    <meta property=\"og:site_name\" content=\"<%- config.title %>\"/>\n    <meta property=\"og:description\" content=\"<%- page_description() %>\"/>\n    <meta property=\"og:image\" content=\"<%- page_image() %>\"/>\n    <meta property=\"og:image:width\" content=\"2276\"/>\n    <meta property=\"og:image:height\" content=\"1240\"/>\n    <meta property=\"og:image:alt\" content=\"<%- page_title() %> - <%- config.title %>\"/>\n    <meta property=\"og:type\" content=\"<%= is_post() ? 'article' : 'website' %>\"/>\n    <meta property=\"og:locale\" content=\"en_US\"/>\n    <% if (is_post()) { %>\n    <meta property=\"article:published_time\" content=\"<%- page.date.toISOString() %>\"/>\n    <meta property=\"article:modified_time\" content=\"<%- (page.updated || page.date).toISOString() %>\"/>\n    <meta property=\"article:author\" content=\"<%- config.title %>\"/>\n    <% if (page.categories && page.categories.length > 0) { %>\n    <meta property=\"article:section\" content=\"<%- page.categories.toArray()[0].name %>\"/>\n    <% } %>\n    <% if (page.tags && page.tags.each) { %>\n    <% page.tags.each(function(tag) { %>\n    <meta property=\"article:tag\" content=\"<%- tag.name %>\"/>\n    <% }); %>\n    <% } %>\n    <% } %>\n\n    <!-- twitter share-->\n    <meta name=\"twitter:card\" content=\"summary_large_image\"/>\n    <meta name=\"twitter:title\" content=\"<%- page_title() %>\"/>\n    <meta name=\"twitter:site\" content=\"@<%- config.author %>\">\n    <meta name=\"twitter:creator\" content=\"@<%- config.author %>\">\n    <meta name=\"twitter:description\" content=\"<%- page_description() %>\"/>\n    <meta name=\"twitter:image\" content=\"<%- page_image() %>\"/>\n    <meta name=\"twitter:image:alt\" content=\"<%- page_title() %> - <%- config.title %>\"/>\n\n    <!-- favicon -->\n    <link rel=\"icon\" href=\"/images/favicon.png?v=1\"/>\n    <link rel=\"icon shortcut\" type=\"image/png\" href=\"/images/favicon.png?v=1\"/>\n\n    <!-- PWA -->\n    <link rel=\"manifest\" href=\"/manifest.json\"/>\n    <meta name=\"theme-color\" content=\"#6366f1\"/>\n    <meta name=\"apple-mobile-web-app-capable\" content=\"yes\"/>\n    <meta name=\"apple-mobile-web-app-status-bar-style\" content=\"default\"/>\n    <meta name=\"apple-mobile-web-app-title\" content=\"CheatSheets\"/>\n    <link rel=\"apple-touch-icon\" href=\"/assets/logo/icon-192x192.png\"/>\n    <link rel=\"apple-touch-icon\" sizes=\"152x152\" href=\"/assets/logo/icon-152x152.png\"/>\n    <link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"/assets/logo/icon-192x192.png\"/>\n    <meta name=\"msapplication-TileImage\" content=\"/assets/logo/icon-144x144.png\"/>\n    <meta name=\"msapplication-TileColor\" content=\"#6366f1\"/>\n\n    <!-- misc -->\n    <link rel=\"canonical\" href=\"<%- clean_url(url) %>\"/>\n    <link rel=\"prefetch\" href=\"<%- url_for(config.url) %>\"/>\n    <link rel=\"prerender\" href=\"<%- url_for(config.url) %>\"/>\n    <link rel=\"alternate\" href=\"/atom.xml\" title=\"<%- config.title %>\" type=\"application/atom+xml\"/>\n\n    <!-- styles -->\n    <%- css('css/style.css') %>\n    <script>\n        if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {\n            let html = document.documentElement.classList;\n            html.toggle('dark')\n        }\n    </script>\n\n    <!-- Structured Data for SEO -->\n    <%- partial('_partial/structured-data') %>\n\n</head>\n"
  },
  {
    "path": "themes/coo/layout/_partial/header.ejs",
    "content": "<% let postPage = (page['layout'] === 'post' || page._isNotePagination || page['layout'] === 'note') ? true : false; %>\n<header class=\"<% if (is_home()){ %>home<% } %> relative z-10 <% if (is_home()){ %>w-full overflow-visible<% } %>\">\n    <% if (is_home()){ %>\n    <!-- Modern Hero Background with Clean Gradient Design -->\n    <!-- Main Background Gradient Layer -->\n    <div class=\"absolute inset-0 bg-gradient-to-br from-indigo-500 via-purple-600 to-indigo-800 pointer-events-none\"></div>\n\n    <!-- Subtle Geometric Pattern Overlay -->\n    <div class=\"absolute inset-0 opacity-10 pointer-events-none\" \n         style=\"background-image: radial-gradient(circle at 20% 50%, rgba(255,255,255,0.2) 1px, transparent 1px),\n                radial-gradient(circle at 80% 50%, rgba(255,255,255,0.2) 1px, transparent 1px);\n                background-size: 60px 60px, 90px 90px;\n                background-position: 0 0, 30px 45px;\"></div>\n\n    <!-- Floating Orbs for Visual Interest -->\n    <div class=\"absolute top-20 left-1/4 w-32 h-32 bg-gradient-to-r from-pink-400/20 to-purple-400/20 rounded-full blur-xl animate-pulse\"></div>\n    <div class=\"absolute bottom-20 right-1/4 w-40 h-40 bg-gradient-to-r from-blue-400/20 to-cyan-400/20 rounded-full blur-xl animate-pulse\" style=\"animation-delay: 2s;\"></div>\n    \n    <!-- Code Elements (Simplified) -->\n    <div class=\"absolute top-24 right-12 opacity-20 font-mono text-white/60 text-sm animate-bounce\" style=\"animation-delay: 1s; animation-duration: 3s;\">\n        &lt;/&gt;\n    </div>\n    <div class=\"absolute bottom-32 left-16 opacity-20 font-mono text-white/60 text-lg animate-bounce\" style=\"animation-delay: 2s; animation-duration: 3s;\">\n        { }\n    </div>\n\n    <!-- Gradient Overlay for Better Text Readability -->\n    <div class=\"absolute inset-0 bg-gradient-to-t from-black/20 via-transparent to-black/10 pointer-events-none\"></div>\n    <% } %>\n\n    <!-- Navbar Section -->\n    <div class=\"max-container z-20 relative\">\n        <div class=\"flex flex-row justify-between md:justify-start items-center py-4\">\n            <%- partial('index/logo', {icon: true, theme: is_home() ? 'dark' : 'light'}) %>\n            <div class=\"md:ml-auto flex flex-wrap items-center text-base justify-center\">\n                <!-- Search Button -->\n                <button id=\"mysearch-trigger\" type=\"button\"\n                        class=\"inline-flex h-9 items-center backdrop-blur-sm rounded-3xl px-3 md:px-4 lg:px-6 py-2 transition-colors duration-200 group <%- is_home() ? \"bg-white/10 outline outline-1 outline-white/20 text-white hover:bg-white/20 hover:outline-white/30\" : \"bg-white outline outline-1 outline-slate-200 dark:bg-slate-800 dark:outline-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-700\" %>\">\n                    <div class=\"md:text-xl md:mr-2 <%- is_home() ? \"text-white\" : \"text-slate-700 dark:text-slate-300\" %>\">\n                        <%- icon(\"search\") %>\n                    </div>\n                    <span class=\"hidden md:inline font-medium <%- is_home() ? \"text-white\" : \"text-slate-700 dark:text-slate-300\" %>\">Search for cheatsheet</span>\n                    <span class=\"hidden md:inline dark:text-slate-300 md:ml-2 text-sm leading-5 py-0.5 px-1.5 border border-slate-300 rounded-md\"><span class=\"font-sans\">⌘</span> <span class=\"font-sans\">K</span></span>\n                </button>\n\n                <!-- Dark Mode Toggle -->\n                <button id=\"darkMode\" class=\"inline-flex items-center justify-center flex-shrink-0 h-9 w-9 rounded-3xl ml-2 lg:ml-3 backdrop-blur-sm transition-colors duration-200 group <%- is_home() ? \"bg-white/10 outline outline-1 outline-white/20 text-white hover:bg-white/20 hover:outline-white/30\" : \"bg-white outline outline-1 outline-slate-200 dark:bg-slate-800 dark:outline-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-700\" %>\">\n                    <!-- Sun icon (shown in dark mode) -->\n                    <i class=\"icon-light transition-all duration-200 <%- is_home() ? \"text-white\" : \"text-slate-600 dark:text-slate-300\" %>\">\n                        <%- icon(\"light\") %>\n                    </i>\n                    <!-- Moon icon (shown in light mode) -->\n                    <i class=\"icon-dark transition-all duration-200 <%- is_home() ? \"text-white\" : \"text-slate-600 dark:text-slate-300\" %>\">\n                        <%- icon(\"dark\") %>\n                    </i>\n                </button>\n\n                <!-- Share Dropdown -->\n                <div class=\"relative ml-2 lg:ml-3\" id=\"share-dropdown\">\n                    <button type=\"button\" id=\"share-trigger\"\n                            class=\"inline-flex h-9 items-center rounded-3xl backdrop-blur-sm ml-0 px-3 py-2 transition-colors duration-200 group <%- is_home() ? \"bg-white/10 outline outline-1 outline-white/20 text-white hover:bg-white/20 hover:outline-white/30\" : \"bg-white outline outline-1 outline-slate-200 dark:bg-slate-800 dark:outline-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-700\" %>\"\n                            aria-expanded=\"false\" aria-haspopup=\"true\">\n                        <div class=\"mr-2 <%- is_home() ? \"text-white\" : \"text-slate-700 dark:text-slate-300\" %>\">\n                            <%- icon(\"share\") %>\n                        </div>\n                        <span class=\"hidden md:inline text-sm font-medium <%- is_home() ? \"text-white\" : \"text-slate-700 dark:text-slate-300\" %>\">Share</span>\n                        <div class=\"hidden md:inline ml-2 <%- is_home() ? \"text-white\" : \"text-slate-700 dark:text-slate-300\" %>\">\n                            <%- icon(\"chevron-down\") %>\n                        </div>\n                    </button>\n\n                    <!-- Dropdown Menu Portal Target -->\n                    <div id=\"share-menu-portal\"></div>\n\n                </div>\n            </div>\n        </div>\n    </div>\n\n    <!-- Hero Section (only on home page) -->\n    <% if (is_home()){ %>\n    <%- partial('index/hero-content') %>\n    <% } %>\n\n</header>\n\n<!-- Share Dropdown Menu (Portal) - Outside header to avoid overflow issues -->\n<div id=\"share-menu\" class=\"fixed z-[9999] w-56 rounded-3xl bg-white dark:bg-slate-800 shadow-xl outline outline-1 outline-slate-200 dark:outline-slate-700 opacity-0 invisible transform scale-95 transition-all duration-200 pointer-events-none\">\n    <div class=\"py-2\">\n        <a href=\"#\" onclick=\"shareOnX()\" title=\"Share on X (Twitter)\" aria-label=\"Share this page on X (Twitter)\" role=\"button\" rel=\"nofollow\" class=\"share-item flex items-center px-4 py-3 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-100/50 dark:hover:bg-slate-700/50 transition-colors rounded-xl mx-2 my-1\">\n            <div class=\"flex-shrink-0 w-5 h-5 mr-3 text-[#000000]\">\n                <%- icon(\"x\") %>\n            </div>\n            <span class=\"font-medium\">Share on X</span>\n        </a>\n        <a href=\"#\" onclick=\"shareOnFacebook()\" title=\"Share on Facebook\" aria-label=\"Share this page on Facebook\" role=\"button\" rel=\"nofollow\" class=\"share-item flex items-center px-4 py-3 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-100/50 dark:hover:bg-slate-700/50 transition-colors rounded-xl mx-2 my-1\">\n            <div class=\"flex-shrink-0 w-5 h-5 mr-3 text-[#1877f2]\">\n                <%- icon(\"facebook\") %>\n            </div>\n            <span class=\"font-medium\">Share on Facebook</span>\n        </a>\n        <a href=\"#\" onclick=\"shareOnReddit()\" title=\"Share on Reddit\" aria-label=\"Share this page on Reddit\" role=\"button\" rel=\"nofollow\" class=\"share-item flex items-center px-4 py-3 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-100/50 dark:hover:bg-slate-700/50 transition-colors rounded-xl mx-2 my-1\">\n            <div class=\"flex-shrink-0 w-5 h-5 mr-3 text-[#ff4500]\">\n                <%- icon(\"reddit\") %>\n            </div>\n            <span class=\"font-medium\">Share on Reddit</span>\n        </a>\n        <a href=\"#\" onclick=\"shareOnPinterest()\" title=\"Share on Pinterest\" aria-label=\"Share this page on Pinterest\" role=\"button\" rel=\"nofollow\" class=\"share-item flex items-center px-4 py-3 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-100/50 dark:hover:bg-slate-700/50 transition-colors rounded-xl mx-2 my-1\">\n            <div class=\"flex-shrink-0 w-5 h-5 mr-3 text-[#bd081c]\">\n                <%- icon(\"pinterest\") %>\n            </div>\n            <span class=\"font-medium\">Share on Pinterest</span>\n        </a>\n        <a href=\"#\" onclick=\"shareOnLinkedIn()\" title=\"Share on LinkedIn\" aria-label=\"Share this page on LinkedIn\" role=\"button\" rel=\"nofollow\" class=\"share-item flex items-center px-4 py-3 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-100/50 dark:hover:bg-slate-700/50 transition-colors rounded-xl mx-2 my-1\">\n            <div class=\"flex-shrink-0 w-5 h-5 mr-3 text-[#0a66c2]\">\n                <%- icon(\"linkedin\") %>\n            </div>\n            <span class=\"font-medium\">Share on LinkedIn</span>\n        </a>\n        <a href=\"#\" onclick=\"shareOnLine()\" title=\"Share on Line\" aria-label=\"Share this page on Line\" role=\"button\" rel=\"nofollow\" class=\"share-item flex items-center px-4 py-3 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-100/50 dark:hover:bg-slate-700/50 transition-colors rounded-xl mx-2 my-1\">\n            <div class=\"flex-shrink-0 w-5 h-5 mr-3 text-[#00c300]\">\n                <%- icon(\"line\") %>\n            </div>\n            <span class=\"font-medium\">Share on Line</span>\n        </a>\n        <div class=\"border-t border-slate-200 dark:border-slate-600 my-2 mx-2\"></div>\n        <a href=\"#\" onclick=\"shareViaEmail()\" title=\"Share via Email\" aria-label=\"Share this page via Email\" role=\"button\" rel=\"nofollow\" class=\"share-item flex items-center px-4 py-3 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-100/50 dark:hover:bg-slate-700/50 transition-colors rounded-xl mx-2 my-1\">\n            <div class=\"flex-shrink-0 w-5 h-5 mr-3 text-slate-500\">\n                <%- icon(\"mail\") %>\n            </div>\n            <span class=\"font-medium\">Share via Email</span>\n        </a>\n        <a href=\"#\" onclick=\"copyToClipboard(); return false;\" title=\"Copy Link to Clipboard\" aria-label=\"Copy page link to clipboard\" role=\"button\" rel=\"nofollow\" class=\"share-item flex items-center px-4 py-3 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-100/50 dark:hover:bg-slate-700/50 transition-colors rounded-xl mx-2 my-1\">\n            <div class=\"flex-shrink-0 w-5 h-5 mr-3 text-slate-500\">\n                <%- icon(\"copy\") %>\n            </div>\n            <span class=\"font-medium\">Copy Link</span>\n        </a>\n    </div>\n</div>"
  },
  {
    "path": "themes/coo/layout/_partial/index/card.ejs",
    "content": "<a href=\"<%- url_for(url) %>\" title=\"<%- title %> Cheatsheet\">\n    <div class=\"card <%- background %>\" <% if (label) { %> data-label=\"<%- label %>\" <% }%> >\n        <%- icon(slug) %>\n        <p><%- title %></p>\n    </div>\n</a>\n"
  },
  {
    "path": "themes/coo/layout/_partial/index/hero-content.ejs",
    "content": "<!-- Hero Content Section (no background, used within header) -->\n<div class=\"w-full flex flex-col text-center pt-8 pb-10 relative z-30\">\n    <div class=\"max-container lg:w-4/5 xl:w-3/4 relative z-30\">\n        <!-- Main Heading -->\n        <h1 class=\"text-4xl md:text-5xl lg:text-6xl text-white leading-tight font-bold tracking-tight\">\n             <span class=\"relative whitespace-nowrap\">\n                <svg aria-hidden=\"true\" viewBox=\"0 0 418 42\"\n                     class=\"absolute top-2/3 left-0 h-[0.58em] w-full fill-pink-300/60\"\n                     preserveAspectRatio=\"none\">\n                    <path d=\"M203.371.916c-26.013-2.078-76.686 1.963-124.73 9.946L67.3 12.749C35.421 18.062 18.2 21.766 6.004 25.934 1.244 27.561.828 27.778.874 28.61c.07 1.214.828 1.121 9.595-1.176 9.072-2.377 17.15-3.92 39.246-7.496C123.565 7.986 157.869 4.492 195.942 5.046c7.461.108 19.25 1.696 19.17 2.582-.107 1.183-7.874 4.31-25.75 10.366-21.992 7.45-35.43 12.534-36.701 13.884-2.173 2.308-.202 4.407 4.442 4.734 2.654.187 3.263.157 15.593-.78 35.401-2.686 57.944-3.488 88.365-3.143 46.327.526 75.721 2.23 130.788 7.584 19.787 1.924 20.814 1.98 24.557 1.332l.066-.011c1.201-.203 1.53-1.825.399-2.335-2.911-1.31-4.893-1.604-22.048-3.261-57.509-5.556-87.871-7.36-132.059-7.842-23.239-.254-33.617-.116-50.627.674-11.629.54-42.371 2.494-46.696 2.967-2.359.259 8.133-3.625 26.504-9.81 23.239-7.825 27.934-10.149 28.304-14.005.417-4.348-3.529-6-16.878-7.066Z\"/>\n                </svg>\n                <span class=\"relative bg-gradient-to-r from-white via-pink-100 to-purple-100 bg-clip-text text-transparent\"> Cheat Sheets </span>\n            </span>\n            <span class=\"block mt-2\">for Developers</span>\n        </h1>\n\n        <!-- Subtitle -->\n        <h2 class=\"lg:w-3/4 xl:w-2/3 text-center mx-auto text-lg md:text-xl lg:text-2xl text-slate-300 leading-relaxed font-light tracking-wide mt-8 mb-12\">\n            Welcome to the ultimate repository of sheets and quick references meticulously crafted by the open community to\n            <span class=\"font-semibold text-pink-300\">boost your productivity</span>.\n        </h2>\n\n        <!-- CTA Buttons -->\n        <div class=\"flex flex-col lg:flex-row items-center justify-center gap-4 mb-16 max-w-4xl mx-auto\">\n            <%- partial('_partial/buttons/github-star', {variant: 'hero', showLabel: true}) %>\n            <%- partial('_partial/buttons/follow-x', {variant: 'hero', showLabel: true}) %>\n            <%- partial('_partial/buttons/buy-coffee', {variant: 'hero', showLabel: true}) %>\n        </div>\n\n        <div id=\"carbon_container\"></div>\n    </div>\n</div>\n"
  },
  {
    "path": "themes/coo/layout/_partial/index/hero.ejs",
    "content": "<!-- Hero Content Section (no background, used within header) -->\n<div class=\"w-full flex flex-col text-center pt-8 pb-24 relative z-10\">\n    <div class=\"max-container lg:w-4/5 xl:w-3/4 relative z-10\">\n        <!-- Main Heading -->\n        <h1 class=\"text-4xl md:text-5xl lg:text-6xl text-white leading-tight font-bold tracking-tight\">\n             <span class=\"relative whitespace-nowrap\">\n                <svg aria-hidden=\"true\" viewBox=\"0 0 418 42\"\n                     class=\"absolute top-2/3 left-0 h-[0.58em] w-full fill-pink-300/60\"\n                     preserveAspectRatio=\"none\">\n                    <path d=\"M203.371.916c-26.013-2.078-76.686 1.963-124.73 9.946L67.3 12.749C35.421 18.062 18.2 21.766 6.004 25.934 1.244 27.561.828 27.778.874 28.61c.07 1.214.828 1.121 9.595-1.176 9.072-2.377 17.15-3.92 39.246-7.496C123.565 7.986 157.869 4.492 195.942 5.046c7.461.108 19.25 1.696 19.17 2.582-.107 1.183-7.874 4.31-25.75 10.366-21.992 7.45-35.43 12.534-36.701 13.884-2.173 2.308-.202 4.407 4.442 4.734 2.654.187 3.263.157 15.593-.78 35.401-2.686 57.944-3.488 88.365-3.143 46.327.526 75.721 2.23 130.788 7.584 19.787 1.924 20.814 1.98 24.557 1.332l.066-.011c1.201-.203 1.53-1.825.399-2.335-2.911-1.31-4.893-1.604-22.048-3.261-57.509-5.556-87.871-7.36-132.059-7.842-23.239-.254-33.617-.116-50.627.674-11.629.54-42.371 2.494-46.696 2.967-2.359.259 8.133-3.625 26.504-9.81 23.239-7.825 27.934-10.149 28.304-14.005.417-4.348-3.529-6-16.878-7.066Z\"/>\n                </svg>\n                <span class=\"relative bg-gradient-to-r from-white via-pink-100 to-purple-100 bg-clip-text text-transparent\"> Cheat Sheets </span>\n            </span>\n            <span class=\"block mt-2\">for Developers</span>\n        </h1>\n\n        <!-- Subtitle -->\n        <h2 class=\"lg:w-3/4 xl:w-2/3 text-center mx-auto text-lg md:text-xl lg:text-2xl text-slate-300 leading-relaxed font-light tracking-wide mt-8 mb-12\">\n            Welcome to the ultimate repository of sheets and quick references meticulously crafted by the open community to\n            <span class=\"font-semibold text-pink-300\">boost your productivity</span>.\n        </h2>\n\n        <!-- CTA Buttons -->\n        <div class=\"flex flex-col lg:flex-row items-center justify-center gap-4 mb-16 max-w-4xl mx-auto\">\n            <!-- GitHub Star Button -->\n            <a href=\"<%- edit_page() %>\" target=\"_blank\" rel=\"noopener noreferrer\" title=\"Star cheatsheets.zip on GitHub\"\n               class=\"group inline-flex items-center px-6 py-3 bg-white/10 backdrop-blur-sm border border-white/20 rounded-xl text-white hover:bg-white/20 transition-all duration-300 hover:scale-105 hover:shadow-lg\">\n                <div class=\"mr-3\">\n                    <%- icon(\"github\") %>\n                </div>\n                <span class=\"font-semibold\">Star on GitHub</span>\n                <div id=\"github-stars\" class=\"ml-3 px-2 py-1 bg-white/20 rounded-md text-xs font-mono\">\n                    <span class=\"loading-dots\">...</span>\n                </div>\n            </a>\n\n            <!-- Follow on X Button -->\n            <a href=\"https://x.com/FechinLi\" target=\"_blank\" rel=\"noopener noreferrer\" title=\"Follow @FechinLi on X (Twitter)\"\n               class=\"group inline-flex items-center px-6 py-3 bg-black/20 backdrop-blur-sm border border-white/20 rounded-xl text-white hover:bg-black/30 transition-all duration-300 hover:scale-105 hover:shadow-lg\">\n                <div class=\"mr-3 group-hover:scale-110 transition-transform\">\n                    <%- icon(\"x\") %>\n                </div>\n                <span class=\"font-semibold\">Follow me on X</span>\n                <div class=\"ml-2 group-hover:translate-x-1 transition-transform\">\n                    →\n                </div>\n            </a>\n\n            <!-- Buy Me a Coffee Button -->\n            <a href=\"<%- donation_link('buymeacoffee') %>\" target=\"_blank\" rel=\"noopener noreferrer\" title=\"Buy Me a Coffee - Support cheatsheets.zip\"\n               class=\"group inline-flex items-center px-6 py-3 bg-gradient-to-r from-orange-500/20 to-yellow-500/20 backdrop-blur-sm border border-orange-300/30 rounded-xl text-white hover:from-orange-500/30 hover:to-yellow-500/30 transition-all duration-300 hover:scale-105 hover:shadow-lg\">\n                <div class=\"mr-3\">\n                    <svg style=\"display:inline\" width=\"16\" height=\"16\" viewBox=\"0 0 25 35\" fill=\"currentColor\">\n                        <path d=\"M22.0672 8.1281 22.0437 8.11426 21.9893 8.09766C22.0112 8.11614 22.0386 8.12685 22.0672 8.1281z\" fill=\"currentColor\"></path>\n                        <path d=\"M22.4111 10.5781 22.3848 10.5855 22.4111 10.5781z\" fill=\"currentColor\"></path>\n                        <path d=\"M22.0735 8.11128C22.0708 8.11093 22.0681 8.11029 22.0655 8.10938 22.0654 8.11115 22.0654 8.11293 22.0655 8.1147 22.0685 8.11432 22.0712 8.11313 22.0735 8.11128z\" fill=\"currentColor\"></path>\n                        <path d=\"M22.3877 10.5647 22.4274 10.5421 22.4421 10.5338 22.4555 10.5195C22.4303 10.5304 22.4074 10.5457 22.3877 10.5647z\" fill=\"currentColor\"></path>\n                        <path d=\"M22.1334 8.1762 22.0947 8.1393 22.0684 8.125C22.0825 8.14993 22.1058 8.16832 22.1334 8.1762z\" fill=\"currentColor\"></path>\n                        <path d=\"M12.3836 31.9453C12.3526 31.9587 12.3255 31.9796 12.3047 32.0062L12.3291 31.9905C12.3457 31.9753 12.3693 31.9573 12.3836 31.9453z\" fill=\"currentColor\"></path>\n                        <path d=\"M18.0497 30.8309C18.0497 30.7958 18.0326 30.8023 18.0368 30.9268 18.0368 30.9167 18.0409 30.9065 18.0428 30.8969 18.0451 30.8747 18.0469 30.853 18.0497 30.8309z\" fill=\"currentColor\"></path>\n                        <path d=\"M17.4617 31.9453C17.4307 31.9587 17.4036 31.9796 17.3828 32.0062L17.4073 31.9905C17.4239 31.9753 17.4474 31.9573 17.4617 31.9453z\" fill=\"currentColor\"></path>\n                        <path d=\"M8.39845 32.2145C8.37496 32.1941 8.34619 32.1807 8.31543 32.1758 8.34034 32.1878 8.36524 32.1998 8.38185 32.209L8.39845 32.2145z\" fill=\"currentColor\"></path>\n                        <path d=\"M7.50541 31.3533C7.50173 31.317 7.49058 31.2818 7.47266 31.25 7.48535 31.2831 7.49598 31.317 7.50448 31.3515L7.50541 31.3533z\" fill=\"currentColor\"></path>\n                        <path d=\"M13.5278 15.9814C12.2963 16.5086 10.8987 17.1064 9.08736 17.1064 8.32963 17.1048 7.57558 17.0009 6.8457 16.7973L8.09845 29.6592C8.14279 30.1968 8.38769 30.698 8.78452 31.0634 9.18134 31.4288 9.70106 31.6316 10.2405 31.6315 10.2405 31.6315 12.0167 31.7237 12.6094 31.7237 13.2474 31.7237 15.1601 31.6315 15.1601 31.6315 15.6995 31.6315 16.2191 31.4286 16.6158 31.0633 17.0125 30.6979 17.2574 30.1967 17.3017 29.6592l1.3418-14.2129C18.0439 15.2415 17.4387 15.1055 16.7565 15.1055 15.5767 15.105 14.626 15.5114 13.5278 15.9814z\" fill=\"#FD0\"></path>\n                        <path d=\"M2.96582 10.5039l.02122.0198L3.00088 10.532C2.99022 10.5215 2.97847 10.512 2.96582 10.5039z\" fill=\"currentColor\"></path>\n                        <path d=\"M24.4376 9.31226 24.249 8.36071C24.0797 7.50694 23.6955 6.70022 22.8191 6.39164 22.5382 6.29294 22.2195 6.2505 22.0041 6.04617 21.7887 5.84184 21.725 5.5245 21.6752 5.23023 21.583 4.6901 21.4963 4.14952 21.4017 3.61033 21.3201 3.14677 21.2555 2.62602 21.0428 2.20075 20.7661 1.62973 20.1918 1.29579 19.6208 1.07485 19.3282.965622 19.0296.873222 18.7265.798101 17.2998.421723 15.7999.283349 14.3322.204476c-1.7617-.097207-3.528-.06792-5.28547.087637-1.3081.119001-2.68584.262911-3.9289.715397C4.6635 1.1731 4.19533 1.37189 3.84986 1.7229c-.42389.43127-.56226 1.09823-.25276 1.63604.22001.38192.5927.65175.98799.83025.51488.23 1.0526.40501 1.60422.52213 1.53595.33948 3.12679.47278 4.69599.52951C12.6245 5.31103 14.3665 5.25414 16.0974 5.07063 16.5254 5.02359 16.9527 4.96716 17.3792 4.90136 17.8815 4.82433 18.2039 4.16751 18.0558 3.70995 17.8787 3.16292 17.4027 2.95074 16.8644 3.0333 16.7851 3.04576 16.7062 3.05729 16.6269 3.06882L16.5697 3.07712C16.3873 3.10019 16.205 3.12171 16.0226 3.1417 15.646 3.18229 15.2683 3.2155 14.8898 3.24133 14.042 3.30037 13.192 3.32758 12.3423 3.32896 11.5075 3.32896 10.6722 3.30544 9.83916 3.25055 9.45909 3.22564 9.07994 3.19397 8.70172 3.15553 8.52967 3.13755 8.35809 3.11864 8.18651 3.09742L8.02322 3.07666 7.98771 3.07159 7.81843 3.04714C7.4725 2.99502 7.12656 2.93506 6.78431 2.86264 6.74978 2.85498 6.71889 2.83577 6.69675 2.80818 6.67461 2.78059 6.66254 2.74627 6.66254 2.71089 6.66254 2.67552 6.67461 2.6412 6.69675 2.61361 6.71889 2.58602 6.74978 2.5668 6.78431 2.55914H6.79077C7.08735 2.49595 7.38624 2.44199 7.68605 2.39494 7.78599 2.37926 7.88623 2.36388 7.98679 2.34881H7.98955C8.17728 2.33636 8.36593 2.30269 8.55274 2.28055c1.62526-.16906 3.26026-.22669 4.89336-.17251C14.239 2.13111 15.0314 2.17769 15.8206 2.25795 15.9903 2.27548 16.1592 2.29393 16.328 2.31468 16.3926 2.32252 16.4576 2.33175 16.5226 2.33959l.131.01891C17.0355 2.41539 17.4154 2.48442 17.7934 2.5656 18.3533 2.68737 19.0724 2.72704 19.3215 3.3405 19.4008 3.53514 19.4368 3.75147 19.4806 3.9558L19.5364 4.2164C19.5379 4.22108 19.5389 4.22586 19.5396 4.2307 19.6716 4.8457 19.8036 5.46069 19.9359 6.07569 19.9455 6.12112 19.9458 6.16806 19.9365 6.21359 19.9273 6.25911 19.9087 6.30224 19.8821 6.34028 19.8554 6.37832 19.8212 6.41046 19.7816 6.4347 19.7419 6.45893 19.6977 6.47474 19.6517 6.48113H19.648L19.5673 6.4922 19.4875 6.50281C19.2348 6.53571 18.9817 6.56646 18.7283 6.59506 18.2292 6.65194 17.7294 6.70114 17.2288 6.74265 16.234 6.82537 15.2373 6.87965 14.2385 6.90548 13.7296 6.919 13.2209 6.92531 12.7123 6.92439 10.6878 6.92279 8.66519 6.80513 6.65424 6.57199 6.43653 6.54616 6.21883 6.51849 6.00112 6.49035 6.16993 6.51203 5.87843 6.47375 5.81939 6.46545 5.68101 6.44607 5.54264 6.42593 5.40426 6.40502 4.93979 6.33537 4.47808 6.24958 4.01453 6.1744 3.45411 6.08215 2.91814 6.12827 2.41123 6.40502c-.4161.2277-.75287.57686-.96539 1.00091-.21863.45202-.28367.94417-.38145 1.42987C.966604 9.32149.814392 9.84408.872048 10.3427c.124075 1.0761.876372 1.9506 1.958452 2.1462 1.01798.1845 2.04148.3339 3.06776.4612C9.9297 13.4439 14.0025 13.5029 18.0466 13.1263 18.3759 13.0956 18.7048 13.062 19.0332 13.0258 19.1358 13.0145 19.2396 13.0263 19.337 13.0604 19.4344 13.0944 19.523 13.1498 19.5962 13.2225S19.7255 13.3834 19.7602 13.4805C19.795 13.5777 19.8075 13.6814 19.797 13.7841L19.6946 14.7794C19.4883 16.7908 19.282 18.802 19.0756 20.813 18.8604 22.9249 18.6437 25.0366 18.4257 27.1482 18.3642 27.7429 18.3027 28.3375 18.2412 28.9319 18.1822 29.5172 18.1739 30.121 18.0627 30.6994 17.8875 31.609 17.2717 32.1675 16.3732 32.3719 15.55 32.5592 14.7091 32.6575 13.8649 32.6652 12.929 32.6703 11.9936 32.6288 11.0578 32.6338 10.0587 32.6394 8.83502 32.5471 8.06381 31.8036 7.38624 31.1505 7.29261 30.1279 7.20036 29.2437c-.123-1.1707-.24492-2.3412-.36577-3.5115l-.67803-6.5077-.43865-4.2108C5.71053 14.9441 5.70315 14.8754 5.69623 14.8053 5.64365 14.303 5.28803 13.8113 4.72761 13.8366 4.24792 13.8579 3.70272 14.2656 3.759 14.8053l.32517 3.1217L4.75667 24.3844C4.94824 26.2187 5.13935 28.0532 5.33 29.888 5.3669 30.2395 5.40149 30.5919 5.44024 30.9434c.21079 1.9206 1.67755 2.9556 3.49395 3.2472C9.99506 34.3612 11.0818 34.3963 12.1583 34.4138 13.5384 34.4359 14.9322 34.489 16.2897 34.239c2.0115-.369 3.5207-1.7122 3.7361-3.7956C20.0873 29.8419 20.1488 29.2403 20.2103 28.6385 20.4148 26.6484 20.619 24.6581 20.8228 22.6677L21.4898 16.1641 21.7956 13.1835C21.8108 13.0357 21.8733 12.8968 21.9736 12.7872 22.0739 12.6776 22.2069 12.6033 22.3528 12.5751 22.928 12.463 23.4778 12.2716 23.8869 11.8339 24.5382 11.137 24.6678 10.2283 24.4376 9.31226zM2.80098 9.95524C2.80975 9.95109 2.7936 10.0263 2.78669 10.0613 2.7853 10.0083 2.78807 9.96124 2.80098 9.95524zM2.8568 10.387C2.86141 10.3837 2.87524 10.4022 2.88954 10.4243 2.86786 10.404 2.85403 10.3888 2.85633 10.387H2.8568zM2.91168 10.4594C2.93152 10.4931 2.94213 10.5143 2.91168 10.4594v0zM3.02192 10.5489H3.02469C3.02469 10.5521 3.02976 10.5553 3.03161 10.5586 3.02855 10.555 3.02515 10.5518 3.02146 10.5489H3.02192zM22.326 10.4151C22.1194 10.6116 21.8081 10.7029 21.5004 10.7486 18.0503 11.2606 14.5499 11.5198 11.0619 11.4054 8.56565 11.3201 6.09567 11.0429 3.62431 10.6937 3.38215 10.6596 3.11971 10.6153 2.9532 10.4368c-.31365-.3367-.1596-1.01476-.07796-1.42158C2.94997 8.64253 3.09295 8.14577 3.53621 8.09272 4.22808 8.01155 5.03158 8.30352 5.71607 8.4073 6.54016 8.53306 7.36733 8.63377 8.19758 8.70941 11.7409 9.03229 15.3437 8.98201 18.8713 8.50969 19.5143 8.42329 20.1549 8.32289 20.7933 8.2085 21.362 8.10656 21.9926 7.91515 22.3362 8.50416 22.5719 8.90544 22.6033 9.44233 22.5668 9.89574 22.5556 10.0933 22.4693 10.2791 22.3256 10.4151H22.326z\" fill=\"currentColor\"></path>\n                    </svg>\n                </div>\n                <span class=\"font-semibold\">Buy Me a Coffee</span>\n            </a>\n        </div>\n\n\n\n        <div id=\"carbon_container\"></div>\n    </div>\n</div>\n"
  },
  {
    "path": "themes/coo/layout/_partial/index/logo.ejs",
    "content": "<%\n// Determine theme based on context\nlet logoTheme = 'light'; // default for non-home pages\nif (typeof theme !== 'undefined') {\n    logoTheme = theme; // use passed theme if provided\n} else if (is_home()) {\n    logoTheme = 'dark'; // dark theme for home page (light text on dark background)\n}\n\n// Define color classes based on theme\nlet iconColorClass, textColorClass, gradientClass, zipColorClass;\nif (logoTheme === 'dark') {\n    // For dark backgrounds (home page)\n    iconColorClass = 'text-white';\n    textColorClass = 'text-slate-100';\n    gradientClass = 'bg-gradient-to-r from-white to-cyan-100 bg-clip-text text-transparent';\n    zipColorClass = 'text-cyan-300';\n} else {\n    // For light backgrounds (detail pages, footer)\n    iconColorClass = 'text-emerald-600 dark:text-emerald-400';\n    textColorClass = 'text-slate-800 dark:text-slate-200';\n    gradientClass = 'bg-gradient-to-r from-slate-800 to-slate-600 bg-clip-text text-transparent dark:from-slate-200 dark:to-slate-400';\n    zipColorClass = 'text-emerald-600 dark:text-emerald-400';\n}\n%>\n<a href=\"/\" title=\"cheatsheets.zip - Quick Reference and Cheat Sheets for Developers\" class=\"flex font-medium items-center justify-center md:justify-start text-slate-800 dark:text-slate-300\">\n    <% if (icon) { %>\n        <div class=\"justify-center <%= iconColorClass %> mr-3 text-4xl\">\n            <div class=\"self-center\">\n                <%- icon(\"logo\") %>\n            </div>\n        </div>\n    <% } %>\n        <span class=\"hidden md:flex domain text-xl md:text-2xl lg:text-3xl font-bold tracking-tight\">\n            <span class=\"<%= gradientClass %>\">cheatsheets</span><span class=\"<%= zipColorClass %> font-black\">.zip</span>\n        </span>\n</a>\n<% if (page.layout == \"note\" || page._isNotePagination){ %>\n    <a class=\"hidden md:block\" href=\"/notes/\" title=\"Notes - Browse our developer notes and tutorials\">\n        <span class=\"flex items-center pl-2 ml-2 text-lg text-slate-300 md:border-l border-slate-400 dark:border-slate-700 hover:text-white transition-colors\">Notes</span>\n    </a>\n<% } %>\n"
  },
  {
    "path": "themes/coo/layout/_partial/index/recommend.ejs",
    "content": "<section class=\"w-full grid grid-cols-2 md:grid-cols-4 gap-6 md:gap-8\">\n    <% theme.index_recommends.forEach(function (filePath) { %>\n        <% let post = site.posts.findOne({slug: filePath}); %>\n        <a href=\"<%= url_for(post.path) %>\" title=\"<%= post.title %> Cheatsheet\">\n            <div class=\"card <%= post.background %>\">\n                <%- icon(post.slug) %>\n                <p><%= post.title %></p>\n            </div>\n        </a>\n    <% }); %>\n</section>"
  },
  {
    "path": "themes/coo/layout/_partial/index/request.ejs",
    "content": "<section class=\"text-slate-800 max-container\">\n    <div class=\" mx-auto flex py-12 items-center justify-center flex-col\">\n        <span class=\"inline-block h-1 w-10 rounded-full bg-gradient-to-r from-indigo-500 to-purple-600 mt-8 mb-6\"></span>\n        <div class=\"text-center lg:w-2/3 w-full\">\n            <h3 class=\"sm:text-4xl text-3xl mb-4 font-medium text-slate-800 dark:text-slate-300\">See something\n                missing?</h3>\n            <p class=\"mb-8 leading-relaxed dark:text-slate-300\">\n                Feel free to contribute to the code on my GitHub repository or follow me to stay updated on the latest\n                cheat sheets in real-time,  it's a best chance to do it!\n\n            </p>\n            <div class=\"flex flex-col md:flex-row justify-center space-x-4\">\n                <%- partial('_partial/buttons/github-contribute', {variant: 'request', showLabel: true}) %>\n                <%- partial('_partial/buttons/follow-x', {variant: 'request', showLabel: true}) %>\n            </div>\n        </div>\n    </div>\n</section>"
  },
  {
    "path": "themes/coo/layout/_partial/note/header.ejs",
    "content": "<header class=\"note-width z-10 mx-auto\">\n    <div class=\"flex flex-row justify-between md:justify-start items-center p-3 md:py-5\">\n        <%- partial('_partial/index/logo', {icon: true, theme: 'light'}) %>\n    </div>\n</header>"
  },
  {
    "path": "themes/coo/layout/_partial/note/tags.ejs",
    "content": "<% if (page.tags && page.tags.length){ %>\n    <ul class=\"post-tags-list\" itemprop=\"keywords\">\n        <% page.tags.each(function(tag) { %>\n            <li class=\"post-tags-list-item\">\n                <a class=\"post-tags-list-link dark:text-slate-300\" href=\"javascript:void(0)\" rel=\"tag\" title=\"<%- tag.name %> tag\"><%- tag.name %></a>\n            </li>\n        <% }) %>\n    </ul>\n<% } %>"
  },
  {
    "path": "themes/coo/layout/_partial/note/title.ejs",
    "content": "<% if (index) { %>\n    <% if (post.link) { %>\n        <a class=\"<%= class_name %>\" href=\"<%- url_for(post.link) %>\" target=\"_blank\" itemprop=\"url\"><%= post.title %></a>\n    <% } else if (post.title) { %>\n        <a class=\"<%= class_name %>\" href=\"<%- url_for(post.path) %>\"><%= post.title %></a>\n    <% } else { %>\n        <a class=\"<%= class_name %>\" href=\"<%- url_for(post.path) %>\">Untitled</a>\n    <% } %>\n<% } else { %>\n    <h1 class=\"<%= class_name %>\" itemprop=\"name headline\">\n        <%= post.title %>\n    </h1>\n<% } %>\n\n"
  },
  {
    "path": "themes/coo/layout/_partial/pagination.ejs",
    "content": "<div class=\"pagination <%- extra %> \">\n    <%- paginator({prev_text: 'Previous', next_text: 'Next', format: '%d/'}) %>\n</div>"
  },
  {
    "path": "themes/coo/layout/_partial/post/category.ejs",
    "content": "<% if (page.categories && page.categories.length > 0){ %>\n    <%\n        var cats = [];\n        page.categories.forEach(function (cat) {\n            cats.push('<a class=\"breadcrumb\" href=\"' + config.root + cat.path + '\" title=\"' + cat.name + ' category\">' + cat.name + '</a>');\n        });\n    %>\n\n    <%- cats.join('') %>\n<% } %>\n"
  },
  {
    "path": "themes/coo/layout/_partial/post/editbar.ejs",
    "content": "<div class=\"hidden flex flex-wrap justify-center gap-2 transition duration-700 transform active:scale-500 ease-in-out\">\n    <button class=\"bg-blue-500 p-2 font-semibold text-white inline-flex items-center space-x-2 rounded\">\n        <svg class=\"w-5 h-5 fill-current\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n            <path d=\"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z\"/>\n        </svg>\n    </button>\n\n    <div class=\"ml-1 inline-flex items-center group cursor-pointer relative\">\n        <svg class=\"w-5 h-5 fill-current\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n            <path d=\"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z\"/>\n        </svg>\n        <div class=\"opacity-0 min-w-max bg-black text-white text-xs rounded-lg py-2 absolute z-10 group-hover:opacity-100 bottom-full -left-2 px-3 pointer-events-none\">\n            Facebook\n            <svg class=\"absolute text-black h-2 left-0 ml-3 top-full\" x=\"0px\" y=\"0px\" viewBox=\"0 0 255 255\"\n                 xml:space=\"preserve\"><polygon class=\"fill-current\" points=\"0,0 127.5,127.5 255,0\"></polygon></svg>\n        </div>\n    </div>\n\n    <button class=\"bg-blue-400 p-2 font-semibold text-white inline-flex items-center space-x-2 rounded\">\n        <svg class=\"w-5 h-5 fill-current\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n            <path d=\"M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z\"/>\n        </svg>\n    </button>\n\n    <button class=\"bg-red-500 p-2 font-semibold text-white inline-flex items-center space-x-2 rounded\">\n        <svg class=\"w-5 h-5 fill-current\" role=\"img\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n            <path d=\"M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm5.01 4.744c.688 0 1.25.561 1.25 1.249a1.25 1.25 0 0 1-2.498.056l-2.597-.547-.8 3.747c1.824.07 3.48.632 4.674 1.488.308-.309.73-.491 1.207-.491.968 0 1.754.786 1.754 1.754 0 .716-.435 1.333-1.01 1.614a3.111 3.111 0 0 1 .042.52c0 2.694-3.13 4.87-7.004 4.87-3.874 0-7.004-2.176-7.004-4.87 0-.183.015-.366.043-.534A1.748 1.748 0 0 1 4.028 12c0-.968.786-1.754 1.754-1.754.463 0 .898.196 1.207.49 1.207-.883 2.878-1.43 4.744-1.487l.885-4.182a.342.342 0 0 1 .14-.197.35.35 0 0 1 .238-.042l2.906.617a1.214 1.214 0 0 1 1.108-.701zM9.25 12C8.561 12 8 12.562 8 13.25c0 .687.561 1.248 1.25 1.248.687 0 1.248-.561 1.248-1.249 0-.688-.561-1.249-1.249-1.249zm5.5 0c-.687 0-1.248.561-1.248 1.25 0 .687.561 1.248 1.249 1.248.688 0 1.249-.561 1.249-1.249 0-.687-.562-1.249-1.25-1.249zm-5.466 3.99a.327.327 0 0 0-.231.094.33.33 0 0 0 0 .463c.842.842 2.484.913 2.961.913.477 0 2.105-.056 2.961-.913a.361.361 0 0 0 .029-.463.33.33 0 0 0-.464 0c-.547.533-1.684.73-2.512.73-.828 0-1.979-.196-2.512-.73a.326.326 0 0 0-.232-.095z\"/>\n        </svg>\n    </button>\n\n    <button class=\"bg-pink-600 p-2 font-semibold text-white inline-flex items-center space-x-2 rounded\">\n        <svg class=\"w-5 h-5 fill-current\" role=\"img\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n            <path d=\"M12.017 0C5.396 0 .029 5.367.029 11.987c0 5.079 3.158 9.417 7.618 11.162-.105-.949-.199-2.403.041-3.439.219-.937 1.406-5.957 1.406-5.957s-.359-.72-.359-1.781c0-1.663.967-2.911 2.168-2.911 1.024 0 1.518.769 1.518 1.688 0 1.029-.653 2.567-.992 3.992-.285 1.193.6 2.165 1.775 2.165 2.128 0 3.768-2.245 3.768-5.487 0-2.861-2.063-4.869-5.008-4.869-3.41 0-5.409 2.562-5.409 5.199 0 1.033.394 2.143.889 2.741.099.12.112.225.085.345-.09.375-.293 1.199-.334 1.363-.053.225-.172.271-.401.165-1.495-.69-2.433-2.878-2.433-4.646 0-3.776 2.748-7.252 7.92-7.252 4.158 0 7.392 2.967 7.392 6.923 0 4.135-2.607 7.462-6.233 7.462-1.214 0-2.354-.629-2.758-1.379l-.749 2.848c-.269 1.045-1.004 2.352-1.498 3.146 1.123.345 2.306.535 3.55.535 6.607 0 11.985-5.365 11.985-11.987C23.97 5.39 18.592.026 11.985.026L12.017 0z\"/>\n        </svg>\n    </button>\n\n    <button class=\"bg-blue-600 p-2 font-semibold text-white inline-flex items-center space-x-2 rounded\">\n        <svg class=\"w-5 h-5 fill-current\" role=\"img\" viewBox=\"0 0 256 256\" xmlns=\"http://www.w3.org/2000/svg\">\n            <g>\n                <path d=\"M218.123122,218.127392 L180.191928,218.127392 L180.191928,158.724263 C180.191928,144.559023 179.939053,126.323993 160.463756,126.323993 C140.707926,126.323993 137.685284,141.757585 137.685284,157.692986 L137.685284,218.123441 L99.7540894,218.123441 L99.7540894,95.9665207 L136.168036,95.9665207 L136.168036,112.660562 L136.677736,112.660562 C144.102746,99.9650027 157.908637,92.3824528 172.605689,92.9280076 C211.050535,92.9280076 218.138927,118.216023 218.138927,151.114151 L218.123122,218.127392 Z M56.9550587,79.2685282 C44.7981969,79.2707099 34.9413443,69.4171797 34.9391618,57.260052 C34.93698,45.1029244 44.7902948,35.2458562 56.9471566,35.2436736 C69.1040185,35.2414916 78.9608713,45.0950217 78.963054,57.2521493 C78.9641017,63.090208 76.6459976,68.6895714 72.5186979,72.8184433 C68.3913982,76.9473153 62.7929898,79.26748 56.9550587,79.2685282 M75.9206558,218.127392 L37.94995,218.127392 L37.94995,95.9665207 L75.9206558,95.9665207 L75.9206558,218.127392 Z M237.033403,0.0182577091 L18.8895249,0.0182577091 C8.57959469,-0.0980923971 0.124827038,8.16056231 -0.001,18.4706066 L-0.001,237.524091 C0.120519052,247.839103 8.57460631,256.105934 18.8895249,255.9977 L237.033403,255.9977 C247.368728,256.125818 255.855922,247.859464 255.999,237.524091 L255.999,18.4548016 C255.851624,8.12438979 247.363742,-0.133792868 237.033403,0.000790807055\"></path>\n            </g>\n        </svg>\n    </button>\n\n    <button class=\"bg-red-600 p-2 font-semibold text-white inline-flex items-center space-x-2 rounded\">\n        <svg class=\"w-5 h-5 fill-current\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n            <path d=\"M8.051 1.999h.089c.822.003 4.987.033 6.11.335a2.01 2.01 0 0 1 1.415 1.42c.101.38.172.883.22 1.402l.01.104.022.26.008.104c.065.914.073 1.77.074 1.957v.075c-.001.194-.01 1.108-.082 2.06l-.008.105-.009.104c-.05.572-.124 1.14-.235 1.558a2.007 2.007 0 0 1-1.415 1.42c-1.16.312-5.569.334-6.18.335h-.142c-.309 0-1.587-.006-2.927-.052l-.17-.006-.087-.004-.171-.007-.171-.007c-1.11-.049-2.167-.128-2.654-.26a2.007 2.007 0 0 1-1.415-1.419c-.111-.417-.185-.986-.235-1.558L.09 9.82l-.008-.104A31.4 31.4 0 0 1 0 7.68v-.123c.002-.215.01-.958.064-1.778l.007-.103.003-.052.008-.104.022-.26.01-.104c.048-.519.119-1.023.22-1.402a2.007 2.007 0 0 1 1.415-1.42c.487-.13 1.544-.21 2.654-.26l.17-.007.172-.006.086-.003.171-.007A99.788 99.788 0 0 1 7.858 2h.193zM6.4 5.209v4.818l4.157-2.408L6.4 5.209z\"/>\n        </svg>\n    </button>\n\n    <button class=\"bg-gray-700 p-2 font-semibold text-white inline-flex items-center space-x-2 rounded\">\n        <svg xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\" role=\"img\" class=\"w-5\"\n             preserveAspectRatio=\"xMidYMid meet\" viewBox=\"0 0 24 24\">\n            <g fill=\"none\">\n                <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                      d=\"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385c.6.105.825-.255.825-.57c0-.285-.015-1.23-.015-2.235c-3.015.555-3.795-.735-4.035-1.41c-.135-.345-.72-1.41-1.23-1.695c-.42-.225-1.02-.78-.015-.795c.945-.015 1.62.87 1.845 1.23c1.08 1.815 2.805 1.305 3.495.99c.105-.78.42-1.305.765-1.605c-2.67-.3-5.46-1.335-5.46-5.925c0-1.305.465-2.385 1.23-3.225c-.12-.3-.54-1.53.12-3.18c0 0 1.005-.315 3.3 1.23c.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23c.66 1.65.24 2.88.12 3.18c.765.84 1.23 1.905 1.23 3.225c0 4.605-2.805 5.625-5.475 5.925c.435.375.81 1.095.81 2.22c0 1.605-.015 2.895-.015 3.3c0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z\"\n                      fill=\"currentColor\"/>\n            </g>\n        </svg>\n    </button>\n\n    <button class=\"bg-red-500 p-2 font-semibold text-white inline-flex items-center space-x-2 rounded\">\n        <svg xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\" role=\"img\" class=\"w-5\"\n             preserveAspectRatio=\"xMidYMid meet\" viewBox=\"0 0 24 24\">\n            <g fill=\"none\">\n                <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                      d=\"M12 0C5.372 0 0 5.373 0 12s5.372 12 12 12c6.627 0 12-5.373 12-12S18.627 0 12 0zm.14 19.018c-3.868 0-7-3.14-7-7.018c0-3.878 3.132-7.018 7-7.018c1.89 0 3.47.697 4.682 1.829l-1.974 1.978v-.004c-.735-.702-1.667-1.062-2.708-1.062c-2.31 0-4.187 1.956-4.187 4.273c0 2.315 1.877 4.277 4.187 4.277c2.096 0 3.522-1.202 3.816-2.852H12.14v-2.737h6.585c.088.47.135.96.135 1.474c0 4.01-2.677 6.86-6.72 6.86z\"\n                      fill=\"currentColor\"/>\n            </g>\n        </svg>\n    </button>\n</div>"
  },
  {
    "path": "themes/coo/layout/_partial/post/popular.ejs",
    "content": "<%\nlet posts = popular_posts_json(theme.related_posts.params, page).json;\nlet title = theme.related_posts.title;\nif (posts.length === 0) {\n    posts = topPosts();\n    title = theme.top_posts.title;\n}\n%>\n<h2 class=\"my-6 text-xl text-slate-700 dark:text-slate-300\"><%= title %> <span class=\"text-slate-400\">Cheatsheet</span></h2>\n<section class=\"w-full grid grid-cols-2 gap-2 md:gap-4\">\n    <% posts.forEach(function (post){ %>\n        <%- partial('_partial/post/popular_card', {post: post}) %>\n    <% }); %>\n</section>\n"
  },
  {
    "path": "themes/coo/layout/_partial/post/popular_card.ejs",
    "content": "<a href=\"<%= url_for(post.path) %>\" title=\"<%= post.title %> Cheatsheet - Quick Reference\"\n   class=\"group flex items-center p-3 bg-slate-50 rounded-lg hover:shadow dark:bg-slate-900 hover:bg-gradient-to-r hover:from-indigo-500 hover:to-purple-600 fadeIn\">\n    <div class=\"ml-4 truncate hover:text-clip overflow-hidden\">\n        <p class=\"mb-1 text-sm font-medium text-slate-900 dark:text-slate-300 group-hover:text-white\"><%= post.title %>\n            <span class=\"text-slate-400 group-hover:text-white\"> Cheatsheet</span>\n        </p>\n        <p class=\"text-sm font-normal text-slate-400 group-hover:text-white\">Quick Reference</p>\n    </div>\n</a>"
  },
  {
    "path": "themes/coo/layout/_partial/post/prevnext.ejs",
    "content": "<% if (page.prev) { %>\n    <p>\n        <a href=\"<%= url_for(page.prev.path) %>\" rel=\"next\" title=\"<%= page.prev.title %>\">\n            <%= __('prev', page.prev.title) %>\n        </a>\n    </p>\n<% } %>\n\n<% if (page.next) { %>\n    <p>\n        <a href=\"<%= url_for(page.next.path) %>\" rel=\"next\" title=\"<%= page.next.title %>\">\n            <%= __('next', page.next.title) %>\n        </a>\n    </p>\n<% } %>\n"
  },
  {
    "path": "themes/coo/layout/_partial/post/recent.ejs",
    "content": "<h2 class=\"my-6 text-xl text-slate-700 dark:text-slate-300\">Recent <span class=\"text-slate-400\">Cheatsheet</span></h2>\n<section class=\"w-full grid grid-cols-2 gap-2 md:gap-4\">\n    <% site.posts.sort('date', -1).filter(post => post.layout !== \"note\").limit(theme.recent_posts_limits).each(function(post){ %>\n        <%- partial('_partial/post/popular_card', {post: post}) %>\n    <% }) %>\n</section>\n"
  },
  {
    "path": "themes/coo/layout/_partial/post/tag.ejs",
    "content": "<% if (page.tags && page.tags.length > 0){ %>\n    <div class=\"tags-row\">\n        <% page.tags.forEach(function(tag) { %>\n            <a href=\"<%= config.root + tag.path %>\" title=\"<%= tag.name %> tag\"><%= tag.name %></a>\n        <% }); %>\n    </div>\n<% } %>\n"
  },
  {
    "path": "themes/coo/layout/_partial/post/title.ejs",
    "content": "<% if (page.link){ %>\n    <% if (page.title){ %>\n        <h1><a href=\"<%- page.link %>\" target=\"_blank\" title=\"<%= page.title || 'External Link' %>\"><%= page.title || __('no_title') %></a></h1>\n    <% } else { %>\n        <h1><a href=\"<%- page.link %>\" target=\"_blank\" title=\"<%= page.link || 'External Link' %>\"><%= page.link || __('no_title') %></a></h1>\n    <% } %>\n<% } else { %>\n    <% if (false){ %>\n        <h1><a href=\"<%- url_for(page.path) %>\" title=\"<%= page.title || 'Page Title' %>\"><%= page.title || __('no_title') %></a></h1>\n    <% } else { %>\n        <h1><%= page.title || __('no_title') %></h1>\n    <% } %>\n<% } %>\n"
  },
  {
    "path": "themes/coo/layout/_partial/scripts.ejs",
    "content": "<%- js('js/main.js') %>\n\n<% if (is_post() && page.plugins != undefined && page.plugins.includes(\"tooltip\") ){ %>\n    <script src=\"https://unpkg.com/@popperjs/core@2\"></script>\n    <script src=\"https://unpkg.com/tippy.js@6\"></script>\n    <script>\n        window.addEventListener('DOMContentLoaded', () => {\n            if (typeof (tippy) !== 'undefined') {\n                document.querySelectorAll(\"a[data-tooltip]\").forEach(function (x) {\n                    let content = x.getAttribute('data-tooltip');\n                    tippy(x, {content: content});\n                });\n            }\n        });\n    </script>\n<% } %>\n\n<% if (is_post() && page.plugins != undefined && page.plugins.includes(\"katex\") ){ %>\n    <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.css\" crossorigin=\"anonymous\">\n    <script src=\"https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.js\" crossorigin=\"anonymous\"></script>\n    <script>\n        document.querySelectorAll('code').forEach(function (el) {\n            const text = el.textContent;\n            if (text.startsWith('KaTeX:') || el.classList.contains(\"language-KaTeX\")) {\n                // Do stuff if text starts with `latex`\n                const renderedKatex = katex.renderToString(\n                    text.replace('KaTeX:', ''),\n                    {throwOnError: false}\n                );\n                // Populate katex and additional markup for formatting\n                el.outerHTML = `<span class=\"katex-wrap\">${renderedKatex}</span>`;\n            }\n\n        })\n    </script>\n<% } %>\n\n\n<% if (is_post() && page.plugins != undefined && page.plugins.includes(\"copyCode\") ){ %>\n    <script>\n        // Get all pre > code elements\n        const codeBlocks = document.querySelectorAll('pre > code');\n        const initInnerHTML = '<svg height=\"1em\" fill=\"currentColor\" viewBox=\"0 0 16 16\"><path fill-rule=\"evenodd\" d=\"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z\"></path><path fill-rule=\"evenodd\" d=\"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z\"></path> </svg>';\n        const successInnerHTML = '<svg height=\"1em\" fill=\"currentColor\" viewBox=\"0 0 16 16\"><path fill-rule=\"evenodd\" d=\"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z\"></path></svg>';\n        codeBlocks.forEach(function (codeBlock) {\n            // Create a copy button element\n            const copyButton = document.createElement('button');\n            copyButton.className = 'opacity-90 bg-gradient-to-r from-indigo-500 to-purple-600 hover:from-indigo-600 hover:to-purple-700 p-2 text-white shadow-xl rounded-lg flex items-center absolute top-2 right-2 transition-all duration-200 backdrop-blur-sm';\n            copyButton.innerHTML = initInnerHTML;\n            copyButton.style.opacity = \"0\";\n            const parent = codeBlock.parentNode;\n\n            parent.style = \"position: relative;\"\n            parent.insertBefore(copyButton, codeBlock);\n\n            // Add click event listener to copy button\n            copyButton.addEventListener('click', () => {\n                navigator.clipboard.writeText(codeBlock.textContent).then(() => {\n                    copyButton.innerHTML = successInnerHTML;\n                    setTimeout(() => {\n                        copyButton.innerHTML = initInnerHTML;\n                    }, 1000);\n                });\n            });\n\n            parent.addEventListener('mouseenter', () => {\n                copyButton.style.opacity = \"1\";\n            });\n            parent.addEventListener('mouseleave', () => {\n                copyButton.style.opacity = \"0\";\n            });\n        });\n    </script>\n<% } %>\n\n\n<% if (is_post() && page.plugins != undefined && page.plugins.includes(\"runCode\") ){ %>\n    <!-- see https://livecodes.io/docs/ and https://livecodes.io/docs/sdk -->\n    <script src=\"https://cdn.jsdelivr.net/npm/livecodes@0.7.2/livecodes.umd.js\"></script>\n    <script>\n        // Get all pre > code elements\n        const code_Blocks = document.querySelectorAll('pre > code');\n        const runInnerHTML = '<svg height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><g stroke-width=\"0\"></g><g stroke-linecap=\"round\" stroke-linejoin=\"round\"></g><g><path d=\"M16.6582 9.28638C18.098 10.1862 18.8178 10.6361 19.0647 11.2122C19.2803 11.7152 19.2803 12.2847 19.0647 12.7878C18.8178 13.3638 18.098 13.8137 16.6582 14.7136L9.896 18.94C8.29805 19.9387 7.49907 20.4381 6.83973 20.385C6.26501 20.3388 5.73818 20.0469 5.3944 19.584C5 19.053 5 18.1108 5 16.2264V7.77357C5 5.88919 5 4.94701 5.3944 4.41598C5.73818 3.9531 6.26501 3.66111 6.83973 3.6149C7.49907 3.5619 8.29805 4.06126 9.896 5.05998L16.6582 9.28638Z\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linejoin=\"round\"></path></g></svg>';\n        const pageHeader = (document.querySelector('h1')?.textContent || '').trim();\n        code_Blocks.forEach(function (codeBlock) {\n            let content = codeBlock.textContent || '';\n            let language = [...codeBlock.classList].find(c => c.startsWith(\"language-\"))?.replace(\"language-\", \"\") || '';\n\n            if (['', 'shell', 'bash'].includes(language)) return;\n            if (language === 'c' && content.includes('FILE ')) {\n                // file operations are not supported in the online playground\n                return;\n            }\n\n            // Create a run button element\n            const runButton = document.createElement('button');\n            runButton.className = 'opacity-90 bg-gradient-to-r from-purple-500 to-pink-500 hover:from-purple-600 hover:to-pink-600 p-2 text-white shadow-xl rounded-lg flex items-center absolute top-12 right-2 transition-all duration-200 backdrop-blur-sm';\n            runButton.innerHTML = runInnerHTML;\n            runButton.style.opacity = \"0\";\n            const parent = codeBlock.parentNode;\n\n            parent.style = \"position: relative;\"\n            parent.insertBefore(runButton, codeBlock);\n\n            // Add click event listener to run button\n            runButton.addEventListener('click', () => {\n                if (language === 'ts') {\n                    language = 'typescript';\n                }\n                if (language === 'js') {\n                    language = 'javascript';\n                }\n                \n                const editorId = ['javascript', 'typescript', 'python', 'php', 'ruby', 'go', 'perl', 'cpp', 'c'].includes(language) \n                                    ? 'script' \n                                    : ['css', 'scss'].includes(language) \n                                        ? 'style' \n                                        : 'markup';\n                const title = codeBlock.closest('.h3-wrap')?.querySelector('h3')?.textContent.replace('#', '') || '';\n\n                // see docs for configuration object: https://livecodes.io/docs/configuration/configuration-object\n                const baseConfig = {\n                    title,\n                    activeEditor: editorId,\n                    [editorId]: {\n                        language,\n                        content,\n                    },\n                    tools: {\n                        status: 'open',\n                    }\n                }\n                let config = baseConfig;\n\n                if (language === 'markdown') {\n                    config = {\n                        ...baseConfig,\n                        style: {\n                            language: 'css',\n                            content: '@import \"github-markdown-css\";\\n\\nbody {\\n  border: 1px solid #e1e4e8;\\n  border-radius: 4px;\\n  padding: 20px;\\n  margin: 20px !important;\\n}\\n',\n                        },\n                        script: {\n                            language: 'javascript',\n                            content: 'document.body.classList.add(\"markdown-body\");'\n                        },\n                        tools: {\n                            status: 'open',\n                            active: 'compiled',\n                        }\n                    }\n                }\n\n                if (['html', 'css'].includes(language)) {\n                    config = {\n                        ...baseConfig,\n                        tools: {\n                            status: 'closed',\n                        }\n                    }\n                }\n\n                if (['scss', 'typescript'].includes(language)) {\n                    config = {\n                        ...baseConfig,\n                        tools: {\n                            status: 'open',\n                            active: 'compiled',\n                        }\n                    }\n                }\n\n                if (pageHeader.startsWith('jQuery')) {\n                    config = {\n                        ...baseConfig,\n                        markup: {\n                            language: 'html',\n                            content: `<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js\"></scr` + 'ipt>\\n',\n                        },\n                        tools: {\n                            status: 'closed',\n                        }\n                    }\n                }\n\n                // see https://livecodes.io/docs/languages/ejs\n                if (language === 'html' && pageHeader.startsWith('EJS')) {\n                    config = {\n                        ...baseConfig,\n                        markup: {\n                            language: 'ejs',\n                            content,\n                        },\n                        script: {\n                            language: 'javascript',\n                            content: \"window.livecodes.templateData = {\\n  userLoggedIn: false,\\n  user: { username: 'geddy', email: 'geddy@example.com' },\\n  users: [\\n    { username: 'geddy', email: 'geddy@example.com' },\\n    { username: 'neil', email: 'neil@example.com' },\\n    { username: 'alex', email: 'alex@example.com' },\\n  ],\\n};\\n\",\n                        },\n                        tools: {\n                            status: 'open',\n                        },\n                        customSettings: {\n                            \"template\": {\n                                \"prerender\": false,\n                            },\n                        },\n                    }\n                }\n\n                if (language === 'javascript' && pageHeader.startsWith('HTML Canvas')) {\n                    if (!content.includes('const ctx =')) {\n                        content = `const canvas = document.getElementById(\"myCanvas\");\\nconst ctx = canvas.getContext(\"2d\");\\n\\n${content}`;\n                    }\n                    config = {\n                        ...baseConfig,\n                        markup: {\n                            language: 'html',\n                            content: \"<canvas id=\\\"myCanvas\\\" width=\\\"500\\\" height=\\\"400\\\" style=\\\"border:1px solid #000000;\\\"></canvas>\\n\",\n                        },\n                        script: {\n                            language,\n                            content,\n                        },\n                        tools: {\n                            status: 'closed',\n                        },\n                    }\n                }\n\n                // see https://livecodes.io/docs/languages/jsx\n                // and https://livecodes.io/docs/languages/react\n                if (language === 'javascript' && pageHeader.startsWith('React')) {\n                    config = {\n                        ...baseConfig,\n                        script: {\n                            language: 'jsx',\n                            content,\n                        },\n                        customSettings: {\n                            imports: {\n                                'axios': 'https://cdn.skypack.dev/axios',\n                            },\n                        },\n                    }\n                }\n\n                // see https://livecodes.io/docs/languages/php-wasm\n                // and https://livecodes.io/docs/languages/php\n                if (language === 'php') {\n                    config = {\n                        ...baseConfig,\n                        style: {\n                            language: 'css',\n                            content: 'body { white-space: pre-wrap; }\\n',\n                        },\n                        script: {\n                            language: 'php-wasm',\n                            content: !content.trim().startsWith('<?php') ? `<?php\\n\\n${content.trim()}\\n\\n?>` : content,\n                        },\n                        tools: {\n                            status: 'closed',\n                        }\n                    }\n                }\n\n                // see https://livecodes.io/docs/languages/python\n                // and https://livecodes.io/docs/languages/python-wasm\n                if (language === 'python') {\n                    if (content.includes('>>> ')) {\n                        content = content\n                            .trim()\n                            .split('\\n')\n                            .map(line => line.startsWith('>>> ') ? line.replace('>>> ', '') : `# ${line}`)\n                            .join('\\n');\n                    }\n                    if (content.includes('from typing import')) {\n                        language = 'python-wasm';\n                    }\n                    config = {\n                        ...baseConfig,\n                        script: {\n                            language,\n                            content,\n                        },\n                        tools: {\n                            status: 'full',\n                        }\n                    }\n                }\n\n                if (language === 'go') {\n                    if (!content.includes('func main() {') && !content.includes('import')) {\n                        if (content.includes('func ')) {\n                            const freeCode = content.split('\\n').filter(line => !line.startsWith('func ') && !line.startsWith('  ') && !line.startsWith('}')).join('\\n');\n                            content = `${content.replace(freeCode, '')}\\nfunc main() {\\n${freeCode.trim().split('\\n').map(line => `    ${line}`).join('\\n')}\\n}`;\n                        } else {\n                            content = `func main() {\\n${content.trim().split('\\n').map(line => `    ${line}`).join('\\n')}\\n}`;\n                        }\n                    }\n                    if (content.includes('fmt.') && !content.includes('import')) {\n                        content = `import \"fmt\"\\n\\n${content}`\n                    }\n                    if (!content.includes('package main')) {\n                        content = `package main\\n\\n${content}`\n                    }\n                    config = {\n                        ...baseConfig,\n                        script: {\n                            language,\n                            content,\n                        },\n                        tools: {\n                            status: 'full',\n                        }\n                    }\n                }\n\n                if (language === 'cpp') {\n                    if (!content.includes('int main()')) {\n                        if (content.includes('class ')) {\n                            const freeCode = content.split('\\n').filter(line => !line.startsWith('class ') && !line.startsWith('  ') && !line.startsWith('}')).join('\\n');\n                            content = `${content.replace(freeCode, '')}\\nint main()\\n{\\n${freeCode.trim().split('\\n').map(line => `  ${line}`).join('\\n')}\\n}`;\n                        } else {                            \n                            content = `int main()\\n{\\n${content.trim().split('\\n').map(line => `  ${line}`).join('\\n')}\\n\\n  return 0;\\n}\\n`;\n                        }\n                    }\n                    if (content.includes('std::') && !content.includes('#include')) {\n                        content = '\\n' + content;\n                        if (content.includes('std::array') && !content.includes('#include <array>')) {\n                            content = `#include <array>\\n${content}`;\n                        }\n                        if (content.includes('std::string') && !content.includes('#include <string>')) {\n                            content = `#include <string>\\n${content}`;\n                        }\n                        if (content.includes('std::cout') && !content.includes('#include <iostream>')) {\n                            content = `#include <iostream>\\n${content}`;\n                        }\n                    } else if (content.includes('cout') && !content.includes('#include <iostream>')) {\n                        content = `#include <iostream>\\nusing namespace std;\\n\\n${content}`;\n                    }\n                    config = {\n                        ...baseConfig,\n                        script: {\n                            language: 'cpp-wasm',\n                            content,\n                        },\n                        tools: {\n                            status: 'full',\n                        }\n                    }\n                }\n\n                if (language === 'c') {\n                    if (!content.includes('int main(') && !content.includes('void main(')) {\n                        content = `int main(void)\\n{\\n${content.trim().split('\\n').map(line => `  ${line}`).join('\\n')}\\n\\n  return 0;\\n}\\n`;\n                    }\n                    if ((content.includes('printf') || content.includes('scanf')) && !content.includes('#include <stdio.h>')) {\n                        content = `#include <stdio.h>\\n\\n${content}`;\n                    }\n                    if (content.includes('strcpy') && !content.includes('#include <string.h>')) {\n                        content = `#include <string.h>\\n${content}`;\n                    }\n                    config = {\n                        ...baseConfig,\n                        script: {\n                            language: 'cpp-wasm',\n                            title: 'C (Wasm)',\n                            content,\n                        },\n                        tools: {\n                            status: 'full',\n                        }\n                    }\n                }\n\n                // see https://livecodes.io/docs/sdk/js-ts#getplaygroundurl\n                const plaugroundUrl = livecodes.getPlaygroundUrl({\n                    // see https://livecodes.io/docs/features/permanent-url/\n                    appUrl: 'https://v39.livecodes.io',\n                    config,\n                });\n                window.open(plaugroundUrl, '_blank');\n            });\n\n            parent.addEventListener('mouseenter', () => {\n                runButton.style.opacity = \"1\";\n            });\n            parent.addEventListener('mouseleave', () => {\n                runButton.style.opacity = \"0\";\n            });\n        });\n    </script>\n<% } %>\n\n<!-- PWA Service Worker Registration -->\n<script>\n// Register Service Worker for PWA functionality\nif ('serviceWorker' in navigator) {\n  window.addEventListener('load', () => {\n    navigator.serviceWorker.register('/sw.js')\n      .then(registration => {\n        console.log('Service Worker registered successfully:', registration.scope);\n\n        // Check for updates\n        registration.addEventListener('updatefound', () => {\n          const newWorker = registration.installing;\n          if (newWorker) {\n            newWorker.addEventListener('statechange', () => {\n              if (newWorker.state === 'installed' && navigator.serviceWorker.controller) {\n                // New content is available, show update notification\n                showUpdateNotification();\n              }\n            });\n          }\n        });\n      })\n      .catch(error => {\n        console.log('Service Worker registration failed:', error);\n      });\n  });\n}\n\n// Show update notification\nfunction showUpdateNotification() {\n  // Create a simple notification banner\n  const notification = document.createElement('div');\n  notification.innerHTML = `\n    <div style=\"\n      position: fixed;\n      top: 0;\n      left: 0;\n      right: 0;\n                  background: #6366f1;\n      color: white;\n      padding: 12px;\n      text-align: center;\n      z-index: 9999;\n      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n    \">\n      <span>New content is available! </span>\n      <button onclick=\"window.location.reload()\" style=\"\n        background: rgba(255,255,255,0.2);\n        border: 1px solid rgba(255,255,255,0.3);\n        color: white;\n        padding: 4px 12px;\n        border-radius: 4px;\n        margin-left: 8px;\n        cursor: pointer;\n      \">Refresh</button>\n      <button onclick=\"this.parentElement.parentElement.remove()\" style=\"\n        background: transparent;\n        border: none;\n        color: white;\n        padding: 4px 8px;\n        margin-left: 8px;\n        cursor: pointer;\n        font-size: 18px;\n      \">&times;</button>\n    </div>\n  `;\n  document.body.appendChild(notification);\n}\n\n\n// Hide install button when app is installed\nwindow.addEventListener('appinstalled', () => {\n  const installBtn = document.getElementById('pwa-install-btn');\n  if (installBtn) {\n    installBtn.remove();\n  }\n  console.log('PWA was installed');\n});\n</script>\n"
  },
  {
    "path": "themes/coo/layout/_partial/search.ejs",
    "content": "<div id=\"mysearch\"\n     class=\"z-50 fixed inset-0 flex justify-center bg-slate-600/80 dark:bg-slate-900/90 items-start text-sm z-50 overflow-hidden lg:pt-16 lg:pb-20 hidden\">\n    <div id=\"mysearch-box\"\n         class=\"lg:max-w-screen-lg w-full flex flex-col justify-between bg-white dark:bg-slate-700 shadow-3xl dark:shadow-3xl lg:rounded-lg lg:max-h-832 min-h-320 h-full\">\n        <div class=\"flex items-center h-16 flex-none border-b border-slate-200 dark:border-slate-700\">\n            <div class=\"w-full h-full\">\n                <form class=\"flex items-center w-full h-full outline-none rounded-tl-lg\">\n                    <label for=\"mysearch-input\" id=\"mysearch-label\"\n                           class=\"h-full w-14 mt-1 ml-1 px-4 flex items-center justify-center transition-colors duration-200 ease-in-out text-indigo-200\">\n                        <div class=\"text-2xl text-indigo-500\">\n                            <%-icon('search')%>\n                        </div>\n                    </label>\n                    <div class=\"relative flex-1\">\n                        <input class=\"flex-1 font-light h-full bg-transparent focus:text-slate-900 text-slate-500 dark:text-slate-300 placeholder-slate-400 placeholder-opacity-80 shadow-none outline-none truncate text-lg sm:text-2xl caret-color-indigo-400 leading-normalized w-full appearance-none rounded-none transition-colors duration-200 ease-in-out\"\n                               id=\"mysearch-input\"\n                               autocomplete=\"off\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\"\n                               placeholder=\"Search for cheatsheet\" maxlength=\"128\" type=\"text\"\n                               enterkeyhint=\"go\">\n                    </div>\n                    <button id=\"mysearch-clear\" type=\"reset\"\n                            class=\"items-center justify-center h-full w-14 px-4 text-slate-600 dark:text-slate-300 hover:text-slate-800 dark:hover:text-slate-100 opacity-75 fill-current cursor-pointer transition-fast-out flex\">\n                        <i class=\"icon icon-close text-xs font-bold\"></i>\n                    </button>\n                </form>\n            </div>\n            <div class=\"w-px h-8 bg-slate-100 dark:bg-slate-400/20 flex-none\"></div>\n            <button class=\"cancel mr-1 px-4 h-full text-slate-500 dark:text-slate-300 hover:text-slate-800 dark:hover:text-slate-300\">\n                Cancel\n            </button>\n        </div>\n        <div class=\"flex flex-grow overflow-hidden lg:rounded-br-lg\">\n            <!-- Search result -->\n            <div class=\"relative w-full flex-none overflow-y-auto lg:w-1/2\">\n                <ul id=\"mysearch-list\"></ul>\n            </div>\n            <!-- Preview panel -->\n            <div class=\"preview-panel shadow-inner bg-slate-100 dark:bg-slate-800 lg:block w-1/2 flex-none overflow-y-auto\">\n\n            </div>\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "themes/coo/layout/_partial/seo.ejs",
    "content": "<script type=\"application/ld+json\">\n    {\n        \"@context\": \"https://schema.org\",\n        \"@type\": \"Book\",\n        \"name\": \"<%- config.title %> - <%- config.subtitle %>\",\n        \"description\": \"<%- config.description %>\",\n        \"review\": {\n            \"@type\": \"Review\",\n            \"reviewRating\": {\n                \"@type\": \"Rating\",\n                \"ratingValue\": \"4\",\n                \"bestRating\": \"5\"\n            },\n            \"author\": {\n                \"@type\": \"Person\",\n                \"name\": \"<%- config.author %>\"\n            }\n        },\n        \"aggregateRating\": {\n            \"@type\": \"AggregateRating\",\n            \"ratingValue\": \"5\",\n            \"reviewCount\": \"59\"\n        },\n        \"mainEntityOfPage\": {\n            \"@type\": \"WebPage\",\n            \"@id\": \"<%- config.url %>\"\n        },\n        \"headline\": \"Article headline\",\n        \"datePublished\": \"2019-06-31T08:00:00+08:00\",\n        \"dateModified\": \"2020-04-02T09:20:00+08:00\",\n        \"author\": {\n            \"@type\": \"Person\",\n            \"name\": \"<%- config.author %>\"\n        },\n        \"publisher\": {\n            \"@type\": \"Organization\",\n            \"name\": \"<%- config.author %>\",\n            \"url\": \"<%- config.url %>\",\n            \"logo\": {\n                \"@type\": \"ImageObject\",\n                \"url\": \"<%- config.url %>/images/favicon.png\"\n            },\n            \"contactPoint\": {\n                \"@type\": \"ContactPoint\",\n                \"telephone\": \"+1 401 590 9901 \",\n                \"contactType\": \"Customer service\"\n            }\n        }\n    }\n\n</script>\n\n<script type=\"application/ld+json\">\n    {\n        \"@context\": \"http://schema.org\",\n        \"@type\": \"Organization\",\n        \"name\": \"<%- config.author %>\",\n        \"url\": \"<%- config.url %>\"\n    }\n\n</script>\n\n<script type=\"application/ld+json\">\n    {\n        \"@context\": \"https://schema.org\",\n        \"@type\": \"BreadcrumbList\",\n        \"itemListElement\": [\n            {\n                \"@type\": \"ListItem\",\n                \"position\": 1,\n                \"name\": \"HOME\",\n                \"item\": \"<%- config.url %>\"\n            }\n        ]\n    }\n\n</script>"
  },
  {
    "path": "themes/coo/layout/_partial/share.ejs",
    "content": "<div class=\"inline-flex text-slate-500 sm:ml-auto sm:mt-0 mt-2 <% if (extra && extra.includes('justify-start')) { %>justify-start<% } else { %>justify-center sm:justify-start<% } %> <% if (extra && !extra.includes('justify-start')) { %><%- extra %><% } %>\">\n    <a class=\"mr-3 fadeIn hover:text-slate-700 dark:hover:text-slate-300\" href=\"<%- share_link(\"facebook\") %>\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" title=\"Share on Facebook\" aria-label=\"Share this page on Facebook\"><%-icon('facebook')%><span class=\"sr-only\">Share on Facebook</span></a>\n    <a class=\"mx-3 fadeIn hover:text-slate-700 dark:hover:text-slate-300\" href=\"<%- share_link(\"x\") %>\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" title=\"Share on X (Twitter)\" aria-label=\"Share this page on X (Twitter)\"><%-icon('x')%><span class=\"sr-only\">Share on X (Twitter)</span></a>\n    <a class=\"mx-3 fadeIn hover:text-slate-700 dark:hover:text-slate-300\" href=\"<%- share_link(\"reddit\") %>\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" title=\"Share on Reddit\" aria-label=\"Share this page on Reddit\"><%-icon('reddit')%><span class=\"sr-only\">Share on Reddit</span></a>\n    <a class=\"mx-3 fadeIn hover:text-slate-700 dark:hover:text-slate-300\" href=\"<%- share_link(\"pinterest\") %>\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" title=\"Share on Pinterest\" aria-label=\"Share this page on Pinterest\"><%-icon('pinterest')%><span class=\"sr-only\">Share on Pinterest</span></a>\n    <a class=\"mx-3 fadeIn hover:text-slate-700 dark:hover:text-slate-300\" href=\"<%- share_link(\"linkedin\") %>\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" title=\"Share on LinkedIn\" aria-label=\"Share this page on LinkedIn\"><%-icon('linkedin')%><span class=\"sr-only\">Share on LinkedIn</span></a>\n    <a class=\"ml-3 fadeIn hover:text-slate-700 dark:hover:text-slate-300\" href=\"<%- share_link(\"line\") %>\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" title=\"Share on Line\" aria-label=\"Share this page on Line\"><%-icon('line')%><span class=\"sr-only\">Share on Line</span></a>\n</div>"
  },
  {
    "path": "themes/coo/layout/_partial/sidebar.ejs",
    "content": "<!--<div class=\"md:px-0\">-->\n<!--    <div class=\"flex flex-col max-w-sm mx-auto bg-white rounded-lg shadow\">-->\n<!--        &lt;!&ndash; quickref.com_sidebar &ndash;&gt;-->\n<!--        <ins class=\"adsbygoogle\"-->\n<!--             style=\"display:block\"-->\n<!--             data-ad-client=\"ca-pub-8691406134231910\"-->\n<!--             data-ad-slot=\"3880206190\"-->\n<!--             data-ad-format=\"auto\"-->\n<!--             data-full-width-responsive=\"true\"></ins>-->\n<!--    </div>-->\n<!--</div>-->\n<div class=\"md:px-6\">\n    <div class=\"flex flex-col max-w-sm px-6 py-4 mx-auto bg-white dark:bg-slate-800 rounded-lg shadow\">\n        <div class=\"flex flex-row justify-between text-blue-dark border-b dark:border-slate-700\">\n            <h2 class=\"mb-4 text-xl font-medium text-slate-700 dark:text-slate-300\">Popular</h2>\n            <div class=\"mt-2 sm:mt-0\">\n                <a href=\"/\" title=\"More Popular Cheatsheets\"\n                   class=\"flex items-center text-white bg-blue-600  text-sm rounded px-2 py-1 hover:bg-blue-500 focus:outline-none focus:shadow-outline\">\n                    <i class=\"icon icon-placeholder mr-1\"></i>\n                    <span class=\"inline\">More</span>\n                </a>\n            </div>\n        </div>\n        <ul class=\"-mx-4\">\n            <% topPosts(8).forEach(function (post){ %>\n                <li class=\"flex items-center mt-6 ml-4\">\n                    <div class=\"flex justify-center w-10 h-10 text-white p-5 rounded-full mr-4 <%- post.background %>\">\n                        <i class=\"self-center icon <%- post.icon %> text-2xl\"></i>\n                    </div>\n                    <a href=\"<%- url_for(post.path) %>\" title=\"<%- post.title %> Cheat sheet\" class=\"underline mx-1 font-medium text-slate-700 dark:text-slate-300\">\n                        <%- post.title %> <span class=\"text-sm font-light text-slate-700 dark:text-slate-500\">Cheat sheet</span>\n                    </a>\n                </li>\n            <% }); %>\n        </ul>\n    </div>\n</div>\n<% let posts = popular_posts_json({maxCount: 10}, page).json; %>\n<% if (posts.length > 0) { %>\n    <div class=\"md:px-6 mt-10\">\n        <div class=\"flex flex-col max-w-sm px-6 py-4 mx-auto bg-white dark:bg-slate-800 rounded-lg shadow\">\n            <div class=\"flex flex-row justify-between text-blue-dark border-b dark:border-slate-700\">\n                <h2 class=\"mb-4 text-xl font-medium text-slate-700 dark:text-slate-300\">Related Posts</h2>\n                <div class=\"mt-2 sm:mt-0\">\n                    <a href=\"/notes/\" title=\"More Related Posts and Notes\"\n                       class=\"flex items-center text-white bg-blue-600  text-sm rounded px-2 py-1 hover:bg-blue-500 focus:outline-none focus:shadow-outline\">\n                        <i class=\"icon icon-placeholder mr-1\"></i>\n                        <span class=\"inline\">More</span>\n                    </a>\n                </div>\n            </div>\n            <ul>\n                <% posts.forEach(function (post){ %>\n                    <li class=\"mt-2\">\n                        <a href=\"<%- url_for(post.path) %>\" title=\"<%- post.title %>\" class=\"underline mx-1 text-sm text-slate-700 dark:text-slate-300\"><%- post.title %></a>\n                    </li>\n                <% }); %>\n            </ul>\n        </div>\n    </div>\n<% } %>\n"
  },
  {
    "path": "themes/coo/layout/_partial/social-buttons.ejs",
    "content": "<%\n// Social buttons component - compatibility wrapper, directly uses independent button components\n// variant: 'hero' | 'compact' | 'inline'\n// showLabels: boolean - whether to show text labels\n// className: string - additional CSS class names\n// buttons: array - button types to display ['github', 'x', 'coffee']\n\nconst variant = locals.variant || 'hero';\nconst showLabels = locals.showLabels !== false; // show labels by default\nconst className = locals.className || '';\nconst buttons = locals.buttons || ['github', 'x', 'coffee']; // show all buttons by default\n\n// Set container styles based on variant\nconst containerClass = {\n    hero: 'flex flex-col lg:flex-row items-center justify-center gap-4 mb-16 max-w-4xl mx-auto',\n    compact: 'hidden lg:flex items-center ml-3',\n    inline: 'flex flex-wrap items-center justify-center gap-3 mt-6 mb-8'\n}[variant];\n%>\n\n<div class=\"<%= containerClass %> <%= className %>\">\n    <% if (buttons.includes('github')) { %>\n        <%- partial('_partial/buttons/github-star', {\n            variant: variant,\n            showLabel: showLabels\n        }) %>\n    <% } %>\n\n    <% if (buttons.includes('x')) { %>\n        <%- partial('_partial/buttons/follow-x', {\n            variant: variant,\n            showLabel: showLabels\n        }) %>\n    <% } %>\n\n    <% if (buttons.includes('coffee')) { %>\n        <%- partial('_partial/buttons/buy-coffee', {\n            variant: variant,\n            showLabel: showLabels\n        }) %>\n    <% } %>\n</div>\n"
  },
  {
    "path": "themes/coo/layout/_partial/structured-data.ejs",
    "content": "<script type=\"application/ld+json\">\n<%\n// Basic Organization data\nconst orgData = {\n  \"@context\": \"https://schema.org\",\n  \"@type\": \"Organization\",\n  \"name\": config.title,\n  \"url\": config.url,\n  \"logo\": {\n    \"@type\": \"ImageObject\",\n    \"url\": config.url + \"/assets/logo/icon-192x192.png\"\n  },\n  \"description\": config.description,\n  \"sameAs\": [\n    \"https://github.com/Fechin/reference\",\n    \"https://x.com/Fechin\"\n  ]\n};\n\n// Basic Website data\nconst websiteData = {\n  \"@context\": \"https://schema.org\",\n  \"@type\": \"WebSite\", \n  \"name\": config.title,\n  \"url\": config.url,\n  \"description\": config.description,\n  \"publisher\": {\n    \"@type\": \"Organization\",\n    \"name\": config.title,\n    \"logo\": {\n      \"@type\": \"ImageObject\", \n      \"url\": config.url + \"/assets/logo/icon-192x192.png\"\n    }\n  },\n  \"potentialAction\": {\n    \"@type\": \"SearchAction\",\n    \"target\": {\n      \"@type\": \"EntryPoint\",\n      \"urlTemplate\": config.url + \"/?q={search_term_string}\"\n    },\n    \"query-input\": \"required name=search_term_string\"\n  }\n};\n\nlet schemaArray = [];\n\nif (is_home()) {\n  // Homepage: Add Organization and Website schema\n  schemaArray.push(orgData, websiteData);\n  \n  // Add ItemList for category display\n  const itemListData = {\n    \"@context\": \"https://schema.org\",\n    \"@type\": \"ItemList\", \n    \"name\": \"Developer Cheat Sheets\",\n    \"description\": \"Collection of quick reference guides for developers\",\n    \"numberOfItems\": site.posts.length,\n    \"itemListElement\": []\n  };\n  \n  let position = 1;\n  site.posts.sort('date', -1).limit(20).each(function(post) {\n    itemListData.itemListElement.push({\n      \"@type\": \"ListItem\",\n      \"position\": position++,\n      \"name\": post.title + \" Cheat Sheet\",\n      \"url\": config.url + url_for(post.path)\n    });\n  });\n  \n  schemaArray.push(itemListData);\n  \n} else if (is_post()) {\n  // Article page: Add TechArticle schema\n  const categoryNames = [];\n  if (page.categories && page.categories.each) {\n    page.categories.each(function(cat) {\n      categoryNames.push(cat.name);\n    });\n  }\n  \n  const keywords = [];\n  if (page.tags && page.tags.each) {\n    page.tags.each(function(tag) {\n      keywords.push(tag.name);\n    });\n  }\n  \n  const articleData = {\n    \"@context\": \"https://schema.org\",\n    \"@type\": \"TechArticle\",\n    \"headline\": page.title + \" Cheat Sheet & Quick Reference\",\n    \"name\": page.title + \" Cheat Sheet\", \n    \"description\": page_description(),\n    \"image\": page_image(),\n    \"url\": clean_url(url),\n    \"datePublished\": page.date.toISOString(),\n    \"dateModified\": (page.updated || page.date).toISOString(),\n    \"author\": {\n      \"@type\": \"Organization\",\n      \"name\": config.title,\n      \"url\": config.url\n    },\n    \"publisher\": {\n      \"@type\": \"Organization\", \n      \"name\": config.title,\n      \"logo\": {\n        \"@type\": \"ImageObject\",\n        \"url\": config.url + \"/assets/logo/icon-192x192.png\"\n      },\n      \"url\": config.url\n    },\n    \"mainEntityOfPage\": {\n      \"@type\": \"WebPage\",\n      \"@id\": clean_url(url)\n    },\n    \"about\": {\n      \"@type\": \"SoftwareApplication\",\n      \"name\": page.title,\n      \"applicationCategory\": \"DeveloperApplication\"\n    },\n    \"audience\": {\n      \"@type\": \"Audience\",\n      \"audienceType\": \"Developers, Programmers, System Administrators\"\n    },\n    \"educationalLevel\": \"Beginner to Advanced\",\n    \"learningResourceType\": \"Quick Reference Guide\",\n    \"typicalAgeRange\": \"18-65\",\n    \"inLanguage\": \"en\"\n  };\n  \n  if (categoryNames.length > 0) {\n    articleData.articleSection = categoryNames;\n  }\n  \n  if (keywords.length > 0) {\n    articleData.keywords = keywords.join(\", \");\n  }\n  \n  schemaArray.push(websiteData, articleData);\n  \n  // Add BreadcrumbList\n  const breadcrumbData = {\n    \"@context\": \"https://schema.org\",\n    \"@type\": \"BreadcrumbList\",\n    \"itemListElement\": [\n      {\n        \"@type\": \"ListItem\",\n        \"position\": 1,\n        \"name\": \"Home\",\n        \"item\": config.url\n      }\n    ]\n  };\n  \n  if (categoryNames.length > 0) {\n    breadcrumbData.itemListElement.push({\n      \"@type\": \"ListItem\", \n      \"position\": 2,\n      \"name\": categoryNames[0],\n      \"item\": config.url + \"/#\" + categoryNames[0].toLowerCase().replace(/\\s+/g, '-')\n    });\n    \n    breadcrumbData.itemListElement.push({\n      \"@type\": \"ListItem\",\n      \"position\": 3, \n      \"name\": page.title + \" Cheat Sheet\",\n      \"item\": clean_url(url)\n    });\n  } else {\n    breadcrumbData.itemListElement.push({\n      \"@type\": \"ListItem\",\n      \"position\": 2,\n      \"name\": page.title + \" Cheat Sheet\", \n      \"item\": clean_url(url)\n    });\n  }\n  \n  schemaArray.push(breadcrumbData);\n  \n} else if (is_page()) {\n  // Normal page\n  const pageData = {\n    \"@context\": \"https://schema.org\",\n    \"@type\": \"WebPage\",\n    \"name\": page.title,\n    \"description\": page_description(),\n    \"url\": clean_url(url),\n    \"mainEntity\": {\n      \"@type\": \"Organization\",\n      \"name\": config.title,\n      \"url\": config.url\n    },\n    \"breadcrumb\": {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Home\", \n          \"item\": config.url\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": page.title,\n          \"item\": clean_url(url)\n        }\n      ]\n    }\n  };\n  \n  schemaArray.push(websiteData, pageData);\n}\n%>\n<%- JSON.stringify(schemaArray, null, 2) %>\n</script> "
  },
  {
    "path": "themes/coo/layout/_partial/toc.ejs",
    "content": "<!-- Simple Timeline TOC -->\n<% if (is_post()) { %>\n<div id=\"toc-container\" class=\"toc-container\">\n  <nav id=\"toc-list\" class=\"toc-list\" role=\"navigation\" aria-label=\"Table of Contents\">\n    <!-- TOC items will be inserted here by JavaScript -->\n  </nav>\n</div>\n\n<script>\n// TOC functionality will be added to main.js\nwindow.addEventListener('DOMContentLoaded', function() {\n  if (typeof window.initTOC === 'function') {\n    window.initTOC();\n  }\n});\n</script>\n<% } %>\n"
  },
  {
    "path": "themes/coo/layout/archive.ejs",
    "content": ""
  },
  {
    "path": "themes/coo/layout/index.ejs",
    "content": "<section class=\"home max-container\">\n    <div class=\"w-full lg:w-4/5 flex flex-col mx-auto justify-center mt-10\">\n        <%- partial('_partial/index/recommend') %>\n        <div class=\"mt-6\">\n            <% theme.index_categories.forEach(function (category) { %>\n                <h2 class=\"sm:text-xl font-medium mt-12 mb-2 text-slate-800 dark:text-slate-300\"><%- category %></h2>\n                <div class=\"h-1 bg-slate-200 dark:bg-slate-900 ounded-full overflow-hidden mb-6\">\n                    <div class=\"w-24 h-full bg-gradient-to-r from-indigo-500 to-purple-600 dark:bg-slate-800\"></div>\n                </div>\n                <div class=\"w-full grid grid-cols-2 md:grid-cols-4 gap-6 md:gap-8 mb-6 text-slate-800\">\n                    <% site.categories.findOne({name: category}).posts.sort('date').map(function(post){ %>\n                        <%- partial('_partial/index/card', {\n                            url: url_for(post.path),\n                            title: post.title,\n                            label: post.label,\n                            slug: post.slug,\n                            background: post.background == undefined ? 'bg-gradient-to-r from-indigo-500 to-purple-600' : post.background\n                        }) %>\n                    <% }) %>\n                </div>\n            <% }); %>\n        </div>\n    </div>\n</section>\n<%- partial('_partial/index/request') %>\n"
  },
  {
    "path": "themes/coo/layout/layout.ejs",
    "content": "<!DOCTYPE HTML>\n<html class=\"<%= is_post() ? 'scrollbar' : '' %>\" lang=\"<%= config.language || 'en' %>\" translate=\"no\">\n<%- partial('_partial/head') %>\n<body class=\"bg-slate-100 dark:bg-slate-900\">\n<%- partial('_partial/header') %>\n<%- body %>\n<%- partial('_partial/toc') %>\n<%- partial('_partial/search') %>\n<%- partial('_partial/footer') %>\n</body>\n<%- partial('_partial/scripts') %>\n</html>\n"
  },
  {
    "path": "themes/coo/layout/note.ejs",
    "content": "<div class=\"max-container mx-auto flex flex-col items-center md:items-start md:flex-row md:justify-between md:mt-20\">\n    <div class=\"w-full mb-6 px-2 md:px-6 lg:w-8/12 bg-white dark:bg-slate-800 shadow rounded-lg tracking-wide\">\n        <div class=\"md:px-4 pt-4 pb-8\">\n            <h1 class=\"font-semibold text-3xl my-5 text-slate-700 dark:text-slate-300 tracking-normal\"><%- page.title %></h1>\n            <%- partial('_partial/note/tags') %>\n            <div class=\"note-content w-full dark:text-slate-300\">\n                <!--[htmlclean-protect]-->\n                <%- page.content %>\n                <!--[/htmlclean-protect]-->\n            </div>\n        </div>\n        <div class=\"border-t border-slate-100 dark:border-slate-700 w-full\"></div>\n        <div class=\"flex py-5 flex-col sm:flex-row items-center\">\n            <%- partial('_partial/share', {extra: \"mx-auto\"}) %>\n        </div>\n    </div>\n    <div class=\"py-10 w-full md:py-0 md:w-4/12 -mx-8\">\n        <%- partial('_partial/sidebar') %>\n    </div>\n</div>"
  },
  {
    "path": "themes/coo/layout/notes.ejs",
    "content": "<% if (page.posts) { %>\n    <div class=\"max-container mx-auto flex flex-col items-center md:items-start md:flex-row md:justify-between md:mt-20\">\n        <div class=\"w-full md:w-8/12\">\n            <% page.posts.each(function(post) { %>\n                <div class=\"node-item max-w-4xl mb-6 px-3 md:px-10 py-6 mx-auto bg-white dark:text-slate-300 dark:bg-slate-800 rounded-lg shadow\">\n                    <div class=\"flex items-center justify-between\">\n                        <span class=\"font-light text-slate-600\">Sep 9, 2021</span>\n                        <a href=\"#\" title=\"JavaScript Category\" class=\"px-2 py-1 text-slate-100 bg-slate-600 rounded hover:bg-slate-500\">JavaScript</a>\n                    </div>\n                    <div class=\"mt-2\">\n                        <a href=\"<%- url_for(post.path) %>\" title=\"<%= post.title %>\"\n                           class=\"text-2xl font-bold text-slate-700 dark:text-slate-300 underline\"><%= post.title %></a>\n                        <p class=\"mt-2 text-slate-600 dark:text-slate-300\"><%- post.excerpt %></p>\n                    </div>\n                    <div class=\"flex items-center justify-between mt-4\">\n                        <a href=\"<%- url_for(post.path) %>\" title=\"Read more about <%= post.title %>\" class=\"underline text-blue-500 dark:opacity-70\">Read more</a>\n                    </div>\n                </div>\n            <% }); %>\n            <%- partial('_partial/pagination', {extra: \"mt-14 mb-6 text-center\"}) %>\n        </div>\n        <div class=\"py-10 w-full md:py-0 md:w-4/12 -mx-8\">\n            <%- partial('_partial/sidebar') %>\n        </div>\n    </div>\n<% } %>\n"
  },
  {
    "path": "themes/coo/layout/page.ejs",
    "content": "<div class=\"mx-auto flex flex-wrap md:py-5 flex-col md:flex-row items-center\">\n    <div class=\"flex flex-col w-full mx-auto text-center my-8\">\n        <div class=\"max-container w-full\">\n            <h1 class=\"text-5xl mb-4\">\n                <span class=\"text-slate-700 dark:text-slate-300 font-light\"><%- page.title %></span>\n            </h1>\n            <div class=\"lg:w-3/5 mx-auto intro leading-relaxed text-slate-600 dark:text-slate-500\"><%- page.intro != null ? markdown(page.intro) : \"\" %></div>\n\n            <!-- Social Buttons (Inline) -->\n            <div class=\"flex flex-wrap items-center justify-center gap-3 mt-6 mb-8\">\n                <%- partial('_partial/buttons/github-star', {variant: 'inline', showLabel: true}) %>\n                <%- partial('_partial/buttons/follow-x', {variant: 'inline', showLabel: true}) %>\n                <%- partial('_partial/buttons/buy-coffee', {variant: 'inline', showLabel: true}) %>\n            </div>\n        </div>\n    </div>\n    <div id=\"mdLayout\" class=\"mdLayout w-full max-container\">\n        <!--[htmlclean-protect]-->\n        <%- page.content %>\n        <!--[/htmlclean-protect]-->\n    </div>\n</div>\n"
  },
  {
    "path": "themes/coo/layout/post.ejs",
    "content": "<div class=\"mx-auto flex flex-wrap md:py-5 flex-col md:flex-row items-center\">\n    <div class=\"flex flex-col w-full mx-auto items-center text-center my-8\">\n        <div class=\"max-container w-full\">\n            <h1 class=\"text-5xl mb-4\">\n                <span class=\"text-slate-700 dark:text-slate-300 font-light\"><%- page.title %></span>\n                <span class=\"text-slate-400 dark:text-slate-500 font-extralight hidden md:inline\">cheatsheet</span>\n            </h1>\n            <div class=\"lg:w-3/5 mx-auto intro leading-relaxed text-slate-600\"><%- page.intro != null ? markdown(page.intro) : \"\" %></div>\n\n            <!-- Social Buttons (Inline) -->\n            <div class=\"flex flex-wrap items-center justify-center gap-3 mt-6 mb-8\">\n                <%- partial('_partial/buttons/github-star', {variant: 'inline', showLabel: true}) %>\n                <%- partial('_partial/buttons/follow-x', {variant: 'inline', showLabel: true}) %>\n                <%- partial('_partial/buttons/buy-coffee', {variant: 'inline', showLabel: true}) %>\n            </div>\n\n            <div class=\"pt-5\" id=\"carbon_container\"></div>\n        </div>\n    </div>\n    <div id=\"mdLayout\" class=\"mdLayout w-full max-container\">\n<!--        <%- partial('_partial/post/editbar') %>-->\n        <!--[htmlclean-protect]-->\n        <%- page.content %>\n        <!--[/htmlclean-protect]-->\n    </div>\n</div>\n"
  },
  {
    "path": "themes/coo/scripts/add_field.js",
    "content": "const h2_re = /<h2 id=\".*\"><a class=\"h-anchor\" href=\"(#.*)\">#<\\/a>(.*)<\\/h2>/gm;\nconst h3_re = /<h3 id=\".*\"><a class=\"h-anchor\" href=\"(#.*)\">#<\\/a>(.*)<\\/h3>/gm;\n\nhexo.extend.filter.register('after_post_render', (data) => {\n  let h2_m;\n  const h2_list = [];\n  while ((h2_m = h2_re.exec(data.content)) !== null) {\n    h2_list.push({\n      anchor: h2_m[1].trim(),\n      title: h2_m[2].trim(),\n      start: h2_m.index\n    });\n  }\n\n  const h3_list = [];\n  for (let i = 0; i < h2_list.length; i++) {\n    const start = h2_list[i].start;\n    let end = data.content.length;\n    const next = h2_list[i + 1];\n    if (next !== undefined) {\n      end = next.start;\n    }\n    const h2_section = data.content.substring(start, end);\n    let h3_m;\n    const h3_items = [];\n    while ((h3_m = h3_re.exec(h2_section)) !== null) {\n      h3_items.push({\n        anchor: h3_m[1].trim(),\n        title: h3_m[2].trim()\n      });\n    }\n    // h2_list[i] = h2_list[i]; // Remove self-assignment\n    h3_list.push(h3_items);\n  }\n\n  const cards = [];\n  for (let i = 0; i < h2_list.length; i++) {\n    if (h3_list[i].length === 0) {\n      continue;\n    }\n    delete h2_list[i].start;\n    cards.push({\n      h2: h2_list[i],\n      h3: h3_list[i]\n    });\n  }\n\n  data.sections = cards;\n  return data;\n});\n"
  },
  {
    "path": "themes/coo/scripts/donation.js",
    "content": "// Donation configuration and helper functions\n\nconst donationConfig = {\n  github: {\n    url: 'https://github.com/sponsors/Fechin',\n    enabled: true\n  },\n  buymeacoffee: {\n    url: 'https://buymeacoffee.com/fechin',\n    enabled: true\n  },\n  kofi: {\n    url: 'https://ko-fi.com/fechin',\n    enabled: true\n  },\n  paypal: {\n    url: 'https://paypal.me/fechinli',\n    enabled: true\n  }\n};\n\n// Helper function to get donation URLs\nhexo.extend.helper.register('donation_link', function (platform) {\n  const config = donationConfig[platform];\n  if (config && config.enabled) {\n    return config.url;\n  }\n  return '#';\n});\n\n// Helper function to check if donations are enabled\nhexo.extend.helper.register('donations_enabled', function () {\n  return Object.values(donationConfig).some((config) => config.enabled);\n});\n\n// Helper function to get all enabled donation platforms\nhexo.extend.helper.register('enabled_donations', function () {\n  return Object.entries(donationConfig)\n    .filter(([platform, config]) => config.enabled)\n    .map(([platform, config]) => ({\n      platform,\n      url: config.url\n    }));\n});\n"
  },
  {
    "path": "themes/coo/scripts/github.js",
    "content": "hexo.extend.helper.register('request_cheatsheet', () => {\n  return 'https://github.com/Fechin/reference/issues/new?title=Cheatsheet+request%3A+&labels=request&template=cheatsheet-request.md&assignee=Fechin';\n});\n\nhexo.extend.helper.register('contributing', () => {\n  return 'https://github.com/Fechin/reference';\n});\n\nhexo.extend.helper.register('edit_page', function () {\n  const postPage = this.page.layout === 'post';\n  let url = 'https://github.com/Fechin/reference';\n  if (postPage) {\n    url += `/blob/main/source/_posts/${this.page.slug}.md`;\n  }\n  return url;\n});\n"
  },
  {
    "path": "themes/coo/scripts/global.js",
    "content": "const fs = require('fs');\nconst path = require('path');\n\nhexo.extend.helper.register('icon', (name) => svgIcon(name));\n\n// Register custom clean_url helper function\nhexo.extend.helper.register('clean_url', function (url) {\n  if (!url) return '';\n  // If it's an absolute URL, convert it to a relative URL first\n  const cleanedUrl = this.url_for(url);\n  // Remove .html suffix\n  return cleanedUrl.replace(/(index)?\\.html$/, '');\n});\n\n// Register enhanced url_for helper (optional)\nhexo.extend.helper.register('url_for_clean', function (path, options = {}) {\n  const url = this.url_for(path, options);\n  return url.replace(/(index)?\\.html$/, '');\n});\n\nhexo.extend.generator.register('json', (locals) => {\n  const searchName = 'search.json';\n  const datas = locals.posts.sort('date') || [];\n\n  const res = [];\n  let index = 0;\n\n  datas.each((data) => {\n    if (data.indexing !== undefined && !data.indexing) {\n      return;\n    }\n    if (data.layout === 'note') {\n      return;\n    }\n    const temp_data = {};\n\n    temp_data.index = index;\n    temp_data.title = data.title;\n    temp_data.path = data.permalink.replace(hexo.config.url, '');\n    temp_data.icon = svgIcon(data.slug);\n    temp_data.background = data.background;\n    temp_data.intro = data.intro;\n\n    // categories\n    temp_data.categories = [];\n    if (data.categories && data.categories.length > 0) {\n      data.categories.forEach((category) => {\n        temp_data.categories.push(category.name);\n      });\n    }\n\n    // tags\n    temp_data.tags = [];\n    if (data.tags && data.tags.length > 0) {\n      data.tags.forEach((tag) => {\n        temp_data.tags.push(tag.name);\n      });\n    }\n    // sections\n    temp_data.sections = data.sections;\n\n    res[index] = temp_data;\n    index += 1;\n  });\n\n  const json = JSON.stringify(res);\n  return { path: searchName, data: json };\n});\n\nhexo.extend.generator.register('list', (locals) => {\n  const themeConfig = hexo.theme.config;\n  let content = '';\n\n  themeConfig.index_categories.forEach((category) => {\n    content += `<details>\\n<summary>${category}</summary>\\n\\n`;\n    locals.categories\n      .findOne({ name: category })\n      .posts.sort('-date')\n      .map((post) => {\n        content += `- [${post.title}](https://cheatsheets.zip/${post.path}): ${post.intro.trim()}\\n`;\n      });\n    content += '\\n</details>\\n\\n';\n  });\n\n  return {\n    path: 'list.md',\n    data: content\n  };\n});\n\nfunction svgIcon(name) {\n  // Check file exists\n  const svgPath = path.resolve('./', 'source/assets/icon/', `${name}.svg`);\n  if (fs.existsSync(svgPath)) {\n    const svgContent = fs.readFileSync(svgPath, 'utf8');\n    return `<!--[htmlclean-protect]-->${svgContent}<!--[/htmlclean-protect]-->`;\n  } else {\n    const defaultSvg =\n      '<svg viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" height=\"1em\" width=\"1em\">\\n' +\n      '    <path d=\"M886.25058594 98.67324219L137.8385 98.67324219c-39.31382813 0-71.47256836 29.21941406-71.47256836 68.59713867l0 687.8025c0 39.37675781 32.15786133 71.60036133 71.47256836 71.60036133l754.3764 0c39.31382813 0 68.51162109-32.22360352 68.51162109-71.60036133L960.72652109 167.2703C960.72558594 127.89256836 925.56529297 98.67324219 886.25058594 98.67324219zM354.49103516 200.47132812c60.54662109 0 109.63617188 49.04727539 109.63617187 109.5516211 0 60.50425781-49.08867187 109.55162109-109.63617187 109.55162109s-109.63617188-49.04727539-109.63617188-109.55162109C244.85477539 249.51772461 293.94353516 200.47132812 354.49103516 200.47132812zM167.03632813 839.84574219c-8.22058594 0-16.50506836-2.83227539-23.23441407-8.62646485-14.99308594-12.86279297-16.73912109-35.45727539-3.87632812-50.47286132l164.34720703-247.7241211c12.20396484-14.26860352 33.32970703-16.65448242 48.42896484-5.47286133l145.00977539 107.69668946 259.82191407-295.15227539c12.30925781-15.44036133 77.58448242-88.16853516 115.79036132-5.68529297 0.04227539-0.12779297 0.08551758 109.06110352 0.12779297 220.54948242 0.04227539 116.28272461 0.06389648 284.78162109 0.06389649 284.78162109C872.72808594 839.54603516 167.37646484 839.84574219 167.03632813 839.84574219z\"></path>\\n' +\n      '</svg>';\n    return `<!--[htmlclean-protect]-->${defaultSvg}<!--[/htmlclean-protect]-->`;\n  }\n}\n"
  },
  {
    "path": "themes/coo/scripts/markdown_plugin.js",
    "content": "const fs = require('fs');\nconst path = require('path');\nconst hljs = require('highlight.js');\n\n// Helper function to safely require plugins that might be ES modules\nfunction safeRequire(moduleName) {\n  const plugin = require(moduleName);\n  let result = plugin.default || plugin;\n\n  // Special handling for markdown-it-emoji v3.0.0+ which exports an object with multiple functions\n  if (moduleName === 'markdown-it-emoji' && typeof result === 'object' && result.full) {\n    result = result.full; // Use the full emoji plugin\n  }\n\n  // Special handling for other ES modules with default export\n  if (typeof result === 'object' && result.default && typeof result.default === 'function') {\n    result = result.default;\n  }\n\n  return result;\n}\n\n// Create a custom highlight.js instance that handles unknown languages gracefully\nconst customHljs = {\n  highlight: function (code, options) {\n    const language = options && options.language ? options.language : '';\n\n    // If no language specified, try auto-detection\n    if (!language) {\n      try {\n        return hljs.highlightAuto(code);\n      } catch {\n        return {\n          value: hljs.util.escapeHTML(code),\n          language: 'plaintext',\n          relevance: 0\n        };\n      }\n    }\n\n    // Check if the language is supported\n    if (hljs.getLanguage(language)) {\n      try {\n        return hljs.highlight(code, {\n          language: language,\n          ignoreIllegals: true\n        });\n      } catch {\n        // If highlighting fails, fall back to plain text without warning\n        return {\n          value: hljs.util.escapeHTML(code),\n          language: 'plaintext',\n          relevance: 0\n        };\n      }\n    } else {\n      // Language not supported, try auto-detection or fall back to plain text\n      try {\n        const autoResult = hljs.highlightAuto(code);\n        // Only use auto-detection if confidence is reasonable\n        if (autoResult.relevance > 3) {\n          return autoResult;\n        }\n      } catch {\n        // Auto-detection failed, ignore\n      }\n\n      // Fall back to plain text without warning\n      return {\n        value: hljs.util.escapeHTML(code),\n        language: 'plaintext',\n        relevance: 0\n      };\n    }\n  },\n\n  // Expose other hljs methods that might be needed\n  getLanguage: hljs.getLanguage.bind(hljs),\n  listLanguages: hljs.listLanguages.bind(hljs),\n  util: hljs.util\n};\n\nhexo.extend.filter.register('markdown-it:renderer', (md) => {\n  md.use(safeRequire('markdown-it-abbr'), {});\n  md.use(safeRequire('markdown-it-footnote'), {});\n  md.use(safeRequire('markdown-it-ins'), {});\n  md.use(safeRequire('markdown-it-sub'), {});\n  md.use(safeRequire('markdown-it-sup'), {});\n  md.use(safeRequire('markdown-it-task-lists'), {});\n  md.use(safeRequire('markdown-it-emoji'), {});\n  md.use(safeRequire('markdown-it-attrs'), {});\n  md.use(safeRequire('markdown-it-highlightjs'), {\n    hljs: customHljs,\n    auto: true,\n    code: true,\n    ignoreIllegals: true\n  });\n  md.use(safeRequire('markdown-it-checkbox'), {});\n  md.use(safeRequire('markdown-it-shortcode-tag'), {\n    widget: {\n      render(attrs) {\n        const widgetPath = path.resolve(`./source/widget/${attrs.name}.html`);\n        if (fs.existsSync(widgetPath)) {\n          return fs.readFileSync(widgetPath, 'utf8').trim();\n        } else {\n          const error = `Error: ${attrs.name} widget not Found!`;\n          console.log(error);\n          return error;\n        }\n      }\n    }\n  });\n\n  headerSections(md, {\n    h2: {\n      wrapperClass: 'h2-wrap',\n      innerClass: 'h3-wrap-list'\n    },\n    h3: {\n      wrapperClass: 'h3-wrap',\n      innerClass: 'section'\n    },\n    tagName: 'div'\n  });\n});\n\nfunction headerSections(md, options) {\n  const opts = Object.assign({}, options);\n\n  // Check if the rule has already been added to prevent duplicate rules\n  // This is crucial for hexo-renderer-markdown-it v6.0.0+ where the md instance is reused\n  if (md.core.ruler.__rules__.some((rule) => rule.name === 'header_sections')) {\n    return;\n  }\n\n  function addSections(state) {\n    const tokens = []; // output\n    const Token = state.Token;\n    const sections = [];\n    let nestedLevel = 0;\n\n    function openTag(token, parser, classOptName) {\n      const t = new Token(parser, opts.tagName, 1);\n      t.block = true;\n      const cls = token && opts[token.tag] && opts[token.tag][classOptName];\n      t.attrs = appendClass(token.attrs, cls);\n      return t;\n    }\n\n    function closeTag(parser) {\n      const t = new Token(parser, opts.tagName, -1);\n      t.block = true;\n      return t;\n    }\n\n    function closeSections(section) {\n      while (last(sections) && section.header <= last(sections).header) {\n        sections.pop();\n        tokens.push(closeTag('section_inner_close'));\n        tokens.push(closeTag('section_wrapper_close'));\n      }\n    }\n\n    function closeSectionsToCurrentNesting(nesting) {\n      while (last(sections) && nesting < last(sections).nesting) {\n        sections.pop();\n        tokens.push(closeTag('section_inner_close'));\n        tokens.push(closeTag('section_wrapper_close'));\n      }\n    }\n\n    function closeAllSections() {\n      while (sections.pop()) {\n        tokens.push(closeTag('section_inner_close'));\n        tokens.push(closeTag('section_wrapper_close'));\n      }\n    }\n\n    for (let i = 0, l = state.tokens.length; i < l; i++) {\n      const token = state.tokens[i];\n\n      // record level of nesting\n      if (token.type.search('heading') !== 0) {\n        nestedLevel += token.nesting;\n      }\n      if (last(sections) && nestedLevel < last(sections).nesting) {\n        closeSectionsToCurrentNesting(nestedLevel);\n      }\n\n      // add sections before headers\n      const expect = Object.prototype.hasOwnProperty.call(opts, token.tag);\n      if (token.type === 'heading_open') {\n        const section = {\n          header: headingLevel(token.tag),\n          nesting: nestedLevel\n        };\n        if (last(sections) && section.header <= last(sections).header && expect) {\n          closeSections(section);\n        }\n        if (expect) {\n          tokens.push(openTag(token, 'section_wrapper_open', 'wrapperClass'));\n          if (token.attrIndex('id') !== -1) {\n            // remove ID from token\n            token.attrs.splice(token.attrIndex('id'), 1);\n          }\n          sections.push(section);\n\n          // The attribute has been placed in section_open,\n          // clear the attribute of the header tag\n          token.attrs = [];\n        }\n\n        tokens.push(token);\n      } else if (token.type === 'heading_close') {\n        // add inner section after headers\n        tokens.push(token);\n        if (expect) {\n          tokens.push(openTag(token, 'section_inner_open', 'innerClass'));\n        }\n      } else {\n        tokens.push(token);\n      }\n    } // end for every token\n    closeAllSections();\n\n    state.tokens = tokens;\n  }\n\n  function appendClass(attrs, cls) {\n    if (cls === null) {\n      return attrs;\n    }\n    if (attrs === null) {\n      attrs = [];\n    }\n    let appended = false;\n    attrs.forEach((x) => {\n      if (x[0] === 'class') {\n        x[1] = `${cls} ${x[1]}`;\n        appended = true;\n      }\n    });\n    if (!appended) {\n      attrs.push(['class', cls.trim()]);\n    }\n    return attrs;\n  }\n\n  function headingLevel(header) {\n    return parseInt(header.charAt(1));\n  }\n\n  function last(arr) {\n    return arr.slice(-1)[0];\n  }\n\n  md.core.ruler.push('header_sections', addSections);\n}\n"
  },
  {
    "path": "themes/coo/scripts/merge_configs.js",
    "content": "/**\n * Merge all `theme_config.*` options from main Hexo config into hexo.theme.config.\n * This fixes an issue with hexo-renderer-stylus, which otherwise ignores these\n * configuration overrides.\n */\nhexo.on('generateBefore', () => {\n  hexo.theme.config = Object.assign({}, hexo.theme.config, hexo.config.theme_config);\n});\n"
  },
  {
    "path": "themes/coo/scripts/pagination_generator.js",
    "content": "const pagination = require('hexo-pagination');\n\nhexo.extend.generator.register('notes-pagination', function (locals) {\n  const config = this.config;\n  const posts = locals.posts.filter((post) => post.layout === 'note').sort('-date');\n  return pagination('notes', posts, {\n    perPage: config.per_page,\n    layout: ['notes'],\n    format: '%d/',\n    data: {\n      _isNotePagination: true\n    }\n  });\n});\n"
  },
  {
    "path": "themes/coo/scripts/seo-enhanced.js",
    "content": "const fs = require('fs');\nconst path = require('path');\n\n// Generate more detailed page descriptions\nhexo.extend.helper.register('enhanced_page_description', function () {\n  let description = '';\n\n  if (this.is_home()) {\n    description = `${this.config.description} - Quick reference guides for developers, programmers, and system administrators. Find cheat sheets for popular programming languages, tools, and technologies.`;\n  } else if (this.page && this.page.intro && this.page.intro.trim()) {\n    description = this.strip_html(this.markdown(this.page.intro)).substring(0, 155);\n  } else if (this.is_post()) {\n    const categoryNames = [];\n    if (this.page.categories && this.page.categories.each) {\n      this.page.categories.each(function (cat) {\n        categoryNames.push(cat.name);\n      });\n    }\n\n    const categoryText = categoryNames.length > 0 ? `${categoryNames[0]} ` : '';\n    description = `${this.page.title} cheat sheet and quick reference guide. Essential ${categoryText}shortcuts, commands, and tips for developers and system administrators.`;\n  } else if (this.page && this.page.content) {\n    description = this.strip_html(this.page.content).substring(0, 155);\n  } else {\n    description = this.config.description || '';\n  }\n\n  // Clean up description text\n  description = description.replace(/[\\r\\n\\s\\s+]+/g, ' ').trim();\n\n  // Ensure description ends with a period\n  if (\n    description &&\n    !description.endsWith('.') &&\n    !description.endsWith('!') &&\n    !description.endsWith('?')\n  ) {\n    description += '.';\n  }\n\n  return description;\n});\n\n// Generate article reading time estimate\nhexo.extend.helper.register('reading_time', function (content) {\n  if (!content) return '2 min read';\n\n  const wordsPerMinute = 200;\n  const textContent = this.strip_html(content);\n  const wordCount = textContent.split(/\\s+/).length;\n  const readingTime = Math.ceil(wordCount / wordsPerMinute);\n\n  return `${readingTime} min read`;\n});\n\n// Generate related keywords\nhexo.extend.helper.register('related_keywords', function () {\n  let keywords = [];\n\n  if (this.is_post()) {\n    // Basic keywords\n    keywords.push('cheat sheet', 'quick reference', 'guide', 'tutorial');\n\n    // Add page title keywords\n    if (this.page.title) {\n      keywords.push(this.page.title.toLowerCase());\n      keywords.push(`${this.page.title.toLowerCase()} guide`);\n      keywords.push(`${this.page.title.toLowerCase()} commands`);\n    }\n\n    // Add category keywords\n    if (this.page.categories && this.page.categories.each) {\n      this.page.categories.each(function (cat) {\n        keywords.push(cat.name.toLowerCase());\n      });\n    }\n\n    // Add tag keywords\n    if (this.page.tags && this.page.tags.each) {\n      this.page.tags.each(function (tag) {\n        keywords.push(tag.name.toLowerCase());\n      });\n    }\n  }\n\n  return [...new Set(keywords)].join(', ');\n});\n\n// Generate page type\nhexo.extend.helper.register('page_type', function () {\n  if (this.is_home()) return 'homepage';\n  if (this.is_post()) return 'cheatsheet';\n  if (this.is_page()) return 'page';\n  return 'other';\n});\n\n// Generate estimated word count\nhexo.extend.helper.register('word_count', function (content) {\n  if (!content) return 0;\n  const textContent = this.strip_html(content);\n  return textContent.split(/\\s+/).length;\n});\n\n// Check if there is a table of contents\nhexo.extend.helper.register('has_toc', function (content) {\n  if (!content) return false;\n\n  // Check if there are title elements\n  const headingRegex = /<h[1-6][^>]*>/gi;\n  const headings = content.match(headingRegex);\n\n  return headings && headings.length >= 3;\n});\n\n// Generate breadcrumb data\nhexo.extend.helper.register('breadcrumb_data', function () {\n  const breadcrumbs = [];\n\n  // Homepage link\n  breadcrumbs.push({\n    name: 'Home',\n    url: this.config.url,\n    position: 1\n  });\n\n  if (this.is_post()) {\n    // Category link\n    if (this.page.categories && this.page.categories.length > 0) {\n      const mainCategory = this.page.categories.toArray()[0];\n      breadcrumbs.push({\n        name: mainCategory.name,\n        url: `${this.config.url}/#${mainCategory.name.toLowerCase().replace(/\\s+/g, '-')}`,\n        position: 2\n      });\n\n      // Current page\n      breadcrumbs.push({\n        name: `${this.page.title} Cheat Sheet`,\n        url: this.clean_url(this.url),\n        position: 3\n      });\n    } else {\n      // Current page\n      breadcrumbs.push({\n        name: `${this.page.title} Cheat Sheet`,\n        url: this.clean_url(this.url),\n        position: 2\n      });\n    }\n  } else if (this.is_page()) {\n    // Current page\n    breadcrumbs.push({\n      name: this.page.title,\n      url: this.clean_url(this.url),\n      position: 2\n    });\n  }\n\n  return breadcrumbs;\n});\n\n// Generate technical article specific meta information\nhexo.extend.helper.register('tech_article_meta', function () {\n  if (!this.is_post()) return {};\n\n  const meta = {\n    difficulty: 'Beginner to Advanced',\n    audience: 'Developers, Programmers, System Administrators',\n    type: 'Quick Reference Guide',\n    format: 'Cheat Sheet'\n  };\n\n  // Adjust difficulty based on category\n  if (this.page.categories && this.page.categories.each) {\n    this.page.categories.each(function (cat) {\n      if (cat.name.includes('Linux') || cat.name.includes('Command')) {\n        meta.difficulty = 'Intermediate to Advanced';\n        meta.audience = 'System Administrators, DevOps Engineers, Developers';\n      } else if (cat.name.includes('Programming')) {\n        meta.audience = 'Developers, Software Engineers, Programmers';\n      }\n    });\n  }\n\n  return meta;\n});\n"
  },
  {
    "path": "themes/coo/scripts/seo.js",
    "content": "const fs = require('fs');\nconst path = require('path');\n\nhexo.extend.helper.register('page_title', function () {\n  let title = '';\n  if (this.is_home()) {\n    title = `${this.config.title} - ${this.config.subtitle}`;\n  } else if (this.page.layout === 'note') {\n    title = `${this.page.title} - ${this.config.title}`;\n  } else if (this.is_page()) {\n    title = `${this.page.title} - ${this.config.title}`;\n  } else if (this.is_post()) {\n    title = this.page.title;\n    const hasCommand = this.page.categories.findOne({ name: 'Linux Command' });\n    if (hasCommand) {\n      title += ' Command';\n    }\n    title = `${title} Cheat Sheet & Quick Reference`;\n  } else if (this.page._isNotePagination) {\n    title = `Page ${this.page.current} of Notes - ${this.config.title}`;\n  }\n  return title;\n});\n\nhexo.extend.helper.register('page_description', function () {\n  let description;\n  if (this.is_home()) {\n    description = this.config.description;\n  } else if (this.page && this.page.intro && this.page.intro.trim()) {\n    description = this.strip_html(this.markdown(this.page.intro)).substring(0, 110);\n  } else if (this.page && this.page.content) {\n    description = this.strip_html(this.page.content).substring(0, 130);\n  } else {\n    description = this.config.description || '';\n  }\n  description = description.replace(/[\\r\\n\\s\\s+]+/g, ' ');\n  return description;\n});\n\nhexo.extend.helper.register('page_keywords', function () {\n  let keywords = this.config.keywords;\n  if (this.page.tags && this.page.tags.each) {\n    this.page.tags.each((tag) => {\n      keywords += `,${tag.name}`;\n    });\n  }\n  return keywords;\n});\n\nhexo.extend.helper.register('page_image', function () {\n  const homePng = 'preview.png';\n  let postPng = 'preview.png';\n  if (this.is_post()) {\n    postPng = `${this.page.slug}-preview.png`;\n  }\n\n  const version = (Math.random() + 1).toString(36).substring(7);\n  let imageURL;\n\n  // Check file exists\n  const postPath = path.resolve('./', 'source/assets/image/', postPng);\n  if (fs.existsSync(postPath)) {\n    // Generate image url\n    imageURL = `${this.config.url}/assets/image/${postPng}?v=${version}`;\n  } else {\n    // console.warn(`Warning: ${postPath} not Found!`);\n    imageURL = `${this.config.url}/assets/image/${homePng}?v=${version}`;\n  }\n  return imageURL;\n});\n"
  },
  {
    "path": "themes/coo/scripts/share.js",
    "content": "const { encodeURL } = require('hexo-util');\n\nhexo.extend.helper.register('share_link', function (type) {\n  const title = this.page_title();\n  const description = this.page_description();\n  const url = this.url_for(this.url);\n  let link = '';\n  switch (type) {\n    case 'facebook':\n      link = `https://facebook.com/sharer/sharer.php?u=${url}`;\n      break;\n    case 'twitter':\n    case 'x':\n      link = `https://x.com/intent/tweet/?text=${description}&url=${url}`;\n      break;\n    case 'linkedin':\n      link = `https://www.linkedin.com/shareArticle?url=${url}&title=${title}&summary=${description}`;\n      break;\n    case 'reddit':\n      link = `https://reddit.com/submit/?url=${url}&resubmit=true&title=${description}`;\n      break;\n    case 'pinterest':\n      link = `https://pinterest.com/pin/create/button/?url=${url}&description=${description}`;\n      break;\n    case 'mail':\n      link = `mailto:?subject=${title}&body=\\n${description}\\n\\n${url}`;\n      break;\n    case 'line':\n      link = `https://social-plugins.line.me/lineit/share?url=${url}`;\n      break;\n  }\n  return encodeURL(link);\n});\n"
  },
  {
    "path": "themes/coo/scripts/top_generator.js",
    "content": "const path = require('path');\nconst fs = require('hexo-fs');\n\nconst outputFile = path.resolve('./', 'source/ga_analytics_tops.json');\nconst cache = new Map();\n\nhexo.extend.helper.register('topPosts', (maximum = 4) => {\n  let posts = cache.get(outputFile);\n  if (!posts) {\n    const content = fs.readFileSync(outputFile);\n    posts = JSON.parse(content);\n    cache.set(outputFile, posts);\n  }\n  return posts.slice(0, maximum);\n});\n"
  },
  {
    "path": "themes/coo/source/css/components/code.css",
    "content": "code {\n  @apply text-indigo-600;\n  @apply dark:text-slate-300;\n}\n\npre {\n  line-height: 1.5;\n  word-wrap: break-word;\n  white-space: pre-wrap;\n\n  @apply overflow-hidden overflow-x-auto bg-white p-4;\n}\n\npre:is(.dark *) {\n  background-color: transparent;\n}\n\n.mdLayout pre + p:not(:last-child) {\n  @apply border-t border-slate-200;\n  @apply dark:border-slate-700/50;\n}\n\n/* When there is only one pre code block, the scroll bar is displayed at the bottom */\npre:only-child {\n  @apply h-full;\n}\n\npre > code {\n  color: #345;\n  padding: 0 !important;\n  background: transparent;\n  overflow: visible;\n}\n\npre > code.wrap {\n  @apply whitespace-pre-wrap break-words !important;\n}\n\n@media (width <= 768px) {\n  pre {\n    @apply text-sm;\n\n    max-width: 100%;\n    overflow-x: auto;\n  }\n\n  pre > code {\n    white-space: pre-wrap;\n    word-wrap: break-word;\n    overflow-wrap: break-word;\n  }\n}\n\n.mdLayout .line-highlight {\n  transform: translate3d(0, 2px, 0);\n  background: linear-gradient(to right, rgb(20 175 131 / 5%) 25%, transparent);\n}\n\n.mdLayout .line-highlight[data-end] {\n  margin-top: 0;\n}\n\n.mdLayout .line-highlight::before,\n.mdLayout .line-highlight::after {\n  display: none;\n}\n\n.mdLayout code.hljs {\n  background: transparent;\n}\n\n.note-content pre {\n  padding: 6px 0 !important;\n}\n\n.note-content pre code {\n  padding: 1rem !important;\n}\n"
  },
  {
    "path": "themes/coo/source/css/components/common.css",
    "content": "a.underline {\n  text-decoration: none;\n  background-image: linear-gradient(transparent, transparent 6px, #34495e 6px, #34495e);\n  background-position: bottom;\n  background-size: 100% 6px;\n  background-repeat: repeat-x;\n}\n\na.underline:hover {\n  background-image: linear-gradient(transparent, transparent 4px, #1d1d1d 4px, #1d1d1dff);\n}\n"
  },
  {
    "path": "themes/coo/source/css/components/custom_tag.css",
    "content": "yel {\n  @apply text-amber-600;\n}\n\nred {\n  @apply text-red-600;\n}\n\npur {\n  @apply text-purple-600;\n}\n\nblu {\n  @apply text-blue-600;\n}\n"
  },
  {
    "path": "themes/coo/source/css/components/layer.css",
    "content": "@layer components {\n  .openAnimation {\n    animation: 200ms cubic-bezier(0, 0, 0.2, 1) 0s 1 normal both running openAnimation;\n  }\n\n  .closeAnimation {\n    animation: 200ms cubic-bezier(0.4, 0, 1, 1) 0s 1 normal both running closeAnimation;\n  }\n\n  .fadeIn {\n    @apply duration-100 animate-in fade-in;\n  }\n}\n\n@keyframes openAnimation {\n  from {\n    transform: scale(0.8);\n    opacity: 0;\n  }\n\n  to {\n    transform: scale(1);\n    opacity: 1;\n  }\n}\n\n@keyframes closeAnimation {\n  from {\n    transform: scale(1);\n    opacity: 1;\n  }\n\n  to {\n    transform: scale(0.8);\n    opacity: 0;\n  }\n}\n"
  },
  {
    "path": "themes/coo/source/css/components/layout_list.css",
    "content": ".mdLayout .h3-wrap > .section ul > li {\n  padding: 9px;\n  padding-left: 26px;\n  position: relative;\n  border-bottom: solid 1px #ececec94;\n\n  @apply dark:border-slate-700/50;\n}\n\n.mdLayout .h3-wrap > .section ul > li > p {\n  margin: 0;\n  padding: 0;\n}\n\n.mdLayout .h3-wrap > .section ul:not(.marker-none, .collapsible, .marker-timeline) > li::before {\n  content: '';\n  position: absolute;\n  display: inline-block;\n  width: 5px;\n  height: 5px;\n  background: #567;\n  border-radius: 50%;\n  left: 14px;\n  top: 18px;\n}\n\n.mdLayout .h3-wrap > .section ul.marker-round > li {\n  padding-left: 30px;\n}\n\n.mdLayout .h3-wrap > .section ul.marker-round > li::before {\n  content: '';\n  top: 16px;\n\n  @apply inline-block h-2 w-2 rounded-full border border-2 border-indigo-600 bg-white;\n}\n\n.mdLayout .h3-wrap > .section > ul.collapsible > li > pre {\n  display: none;\n}\n\n.mdLayout .h3-wrap > .section > ul.collapsible > li.active > pre {\n  display: block;\n}\n\n.mdLayout .h3-wrap > .section > ul.collapsible > li > strong:hover {\n  cursor: pointer;\n}\n\n.mdLayout .h3-wrap > .section > ul.collapsible > li > strong.arrow-down::before {\n  content: '▼'; /* ▼ */\n}\n\n.mdLayout .h3-wrap > .section > ul.collapsible > li > strong::before {\n  content: '▶'; /* ▼ */\n  position: absolute;\n  left: 10px;\n  font-size: 0.825em;\n\n  @apply text-indigo-500;\n}\n\n.mdLayout .h3-wrap > .section > ul.marker-timeline {\n  counter-reset: stepCount;\n  margin-top: 1rem;\n}\n\n.mdLayout .h3-wrap > .section > ul.marker-timeline > li {\n  padding-top: 2px;\n  padding-bottom: 1.25rem;\n  border-left: 2px solid #6366f1;\n  position: relative;\n  padding-left: 22px;\n  margin-left: 30px;\n  border-bottom: 0;\n\n  @apply text-slate-900 dark:border-slate-600 dark:text-slate-50;\n}\n\n.mdLayout .h3-wrap > .section > ul.marker-timeline > li:last-child {\n  padding-bottom: 0.8rem;\n  border-image: linear-gradient(to bottom, #6366f1, rgb(0 0 0 / 0%)) 1 100%;\n}\n\n.mdLayout .h3-wrap > .section > ul.marker-timeline > li > pre {\n  padding: 0;\n  margin-top: 1rem;\n}\n\n.mdLayout .h3-wrap > .section > ul.marker-timeline > li::before {\n  counter-increment: stepCount;\n  content: counter(stepCount);\n  left: -14px;\n  border: 2px solid #6366f1;\n\n  @apply absolute top-0 h-6 w-6 rounded-full bg-white text-center text-sm;\n  @apply dark:border-indigo-600 dark:bg-indigo-800;\n}\n\n.mdLayout .h3-wrap > .section > ul.marker-timeline > li:first-child::before {\n  background: #6366f1;\n  color: white;\n}\n\n.mdLayout .h3-wrap > .section > ul.marker-timeline > li > h4 {\n  color: #2a2839;\n  font-family: Poppins, sans-serif;\n  font-weight: 500;\n\n  @apply dark:text-slate-300;\n}\n\n.mdLayout .h3-wrap > .section > ul.icon-list {\n  @apply list-inside list-none;\n}\n\n.mdLayout .h3-wrap > .section > ul.icon-list > li {\n  padding: 9px;\n}\n\n.mdLayout .h3-wrap > .section > ul.icon-list > li a {\n  @apply flex items-center rounded-lg p-3 text-slate-800 hover:bg-gray-200;\n  @apply fadeIn no-underline;\n}\n\n.mdLayout .h3-wrap > .section > ul.icon-list > li a {\n  @apply dark:text-slate-200 dark:hover:bg-slate-700;\n}\n\n.mdLayout .h3-wrap > .section > ul.icon-list > li a img {\n  @apply mr-4 h-6;\n}\n"
  },
  {
    "path": "themes/coo/source/css/components/layout_note.css",
    "content": ".note-content ul > li {\n  @apply py-2.5 md:px-2.5;\n\n  position: relative;\n}\n\n.note-content ul > li:first-child {\n  @apply pt-5;\n}\n\n.note-content {\n  color: #34495e;\n  font-display: swap;\n  font-size: 18px;\n  font-family: 'source sans pro', 'open sans', 'helvetica neue', Arial, sans-serif;\n  line-height: 1.8;\n  min-height: 100%;\n  overflow-wrap: break-word;\n\n  /* @apply dark:text-slate-300; */\n}\n\n.note-width {\n  max-width: 46rem;\n}\n\n.note-content ul,\n.note-content ol {\n  margin: 2px 0 16px;\n}\n\n.note-content p {\n  margin: 4px 0;\n  hyphens: auto;\n}\n\n.node-item pre,\n.node-item pre > code,\n.note-content pre,\n.note-content pre > code {\n  @apply mt-3 rounded-lg bg-[#f6f6f6];\n  @apply dark:bg-indigo-900;\n}\n\n.note-content a {\n  color: #0366d6;\n  text-decoration: none;\n  background-image: linear-gradient(transparent, transparent 6px, #34495e 6px, #34495e);\n  background-position: bottom;\n  background-size: 100% 6px;\n  background-repeat: repeat-x;\n}\n\n.note-content a:hover {\n  background-image: linear-gradient(transparent, transparent 4px, #6366f1 4px, #6366f1);\n}\n\n.note-content h2 {\n  font-weight: 500;\n  font-size: 1.5rem;\n  margin: 24px 0 2px;\n}\n\n.note-content h3 {\n  font-weight: 400;\n  font-size: 1.3rem;\n  margin: 24px 0 2px;\n}\n\n.note-content img,\n.note-content video {\n  display: block;\n  margin: auto;\n  max-width: 100%;\n  height: auto;\n}\n\n.note-content blockquote {\n  border-left: 3px solid #6366f1;\n  border-left-width: 6px;\n  background-color: #f8f8f8;\n  padding: 15px 20px;\n  margin-left: -1rem;\n  margin-right: -1rem;\n}\n\n.note-content blockquote p {\n  margin: 0;\n}\n\n.note-content blockquote footer {\n  margin: 0;\n  color: #8c8c8c;\n  font-size: 11px;\n}\n\n.note-content blockquote footer a {\n  background-image: linear-gradient(transparent, transparent 5px, #8c8c8c 5px, #8c8c8c);\n  color: #8c8c8c;\n}\n\n.note-content blockquote footer a:hover {\n  background-image: linear-gradient(transparent, transparent 4px, #a3a3a3 4px, #a3a3a3);\n  color: #a3a3a3;\n}\n\n.note-content blockquote footer cite::before {\n  padding: 0 0.5em;\n  content: 'â€”';\n}\n\n.note-content .h-anchor {\n  display: none;\n}\n\n.note-content ul.popular-posts > li {\n  @apply py-2.5;\n\n  position: relative;\n  border-bottom: solid 1px #ececec94;\n}\n\n.note-content ul.popular-posts > li:first-child {\n  @apply pt-5;\n}\n\n/* tags style  */\n.post-tags-list {\n  margin-top: 20px;\n  margin-bottom: 30px;\n  display: table;\n}\n\n.post-tags-list-item {\n  float: left;\n  font-size: 12px;\n  margin-right: 10px;\n  background: rgb(102 128 153 / 7.5%);\n  border-radius: 4px;\n  padding: 2px 5px;\n  color: rgb(44 63 81 / 50%);\n}\n\n.post-tags-list-link {\n  cursor: default;\n}\n"
  },
  {
    "path": "themes/coo/source/css/components/layout_paragraph.css",
    "content": ""
  },
  {
    "path": "themes/coo/source/css/components/layout_table.css",
    "content": ".mdLayout table {\n  width: 100%;\n  table-layout: fixed;\n  word-wrap: break-word;\n}\n\n.mdLayout .section > table:last-child::after {\n  content: '';\n\n  @apply block h-2;\n}\n\n.mdLayout table tr + tr {\n  border-top: solid 1px #ececec94;\n\n  @apply dark:border-slate-700/50;\n}\n\n.mdLayout table tbody + tbody {\n  border-top: solid 1px rgb(135 137 139 / 30%);\n}\n\n.mdLayout table td,\n.mdLayout table th {\n  padding: 9px 14px;\n  text-align: left;\n}\n\n.mdLayout table tr th:last-child,\n.mdLayout table tr td:last-child {\n  text-align: right;\n}\n\n.mdLayout table td[rowspan] {\n  vertical-align: middle !important;\n}\n\n.mdLayout table td[colspan] {\n  text-align: center !important;\n}\n\n.mdLayout table td:first-child {\n  white-space: nowrap;\n}\n\n@media (width <= 768px) {\n  .mdLayout table td:first-child {\n    white-space: normal;\n    word-wrap: break-word;\n  }\n}\n\n.mdLayout table td:first-child > code {\n  @apply text-indigo-600;\n}\n\n.mdLayout table a,\n.mdLayout table a:visited {\n  color: #35a;\n  text-decoration: none;\n}\n\n.mdLayout table td:first-child > code ~ em {\n  font-size: 11px;\n  font-style: normal;\n  color: #567;\n}\n\n.mdLayout table thead {\n  display: none;\n}\n\n.mdLayout table thead th {\n  font-weight: normal;\n}\n\n.mdLayout table.shortcuts td:not(:last-child) > code,\n.mdLayout ul.shortcuts > li > code,\nkbd {\n  letter-spacing: 0.075rem;\n\n  /* margin: 0px 0.1em; */\n  padding: 0.1em 0.54em;\n  border: 1px solid rgb(204 204 204);\n  line-height: 1.6;\n  font-family: Arial, Helvetica, sans-serif;\n  font-size: 12px;\n  display: inline-block;\n  background-color: rgb(247 247 247);\n  box-shadow:\n    0 1px 0 rgb(0 0 0 / 20%),\n    0 0 0 2px #fff inset;\n  border-radius: 3px;\n\n  /* text-shadow: 0 1px 0 #fff; */\n  color: #303835;\n\n  @apply dark:border-indigo-700 dark:bg-indigo-700/50 dark:text-indigo-300 dark:shadow-none dark:shadow-indigo-500;\n}\n\n.mdLayout table.left-text tr th,\n.mdLayout table.left-text tr td,\n.mdLayout table.left-text tr td:last-child {\n  text-align: left;\n}\n\n.mdLayout table.center-text tr th,\n.mdLayout table.center-text tr td,\n.mdLayout table.center-text tr td:last-child {\n  text-align: center;\n}\n\n.mdLayout table.show-header thead {\n  display: table-header-group;\n  border-bottom: solid 1px rgb(85 102 119 / 30%);\n}\n\n.mdLayout table.bold-first tr > td:first-child {\n  font-weight: bold;\n}\n\n.mdLayout table.plus-first tr > td:first-child {\n  @apply text-2xl;\n}\n\n.mdLayout table.no-wrap td,\n.mdLayout table.no-wrap th {\n  white-space: nowrap;\n}\n\n.mdLayout table td em {\n  opacity: 0.6;\n\n  @apply dark:opacity-90;\n}\n\n.mdLayout table.style-list td + td,\n.mdLayout table.style-list-arrow td + td {\n  padding-top: 0 !important;\n}\n\n.mdLayout table.style-list td,\n.mdLayout table.style-list-arrow td {\n  display: block;\n  text-align: left !important;\n}\n\n.mdLayout table.style-list-arrow td:first-child::before,\nul.style-arrow li::before {\n  content: '';\n  display: inline-block;\n  width: 0;\n  height: 0;\n  border-right: 6px solid transparent;\n  border-top: 5px solid transparent;\n  border-left: 6px solid #228e6c;\n  border-bottom: 5px solid transparent;\n}\n"
  },
  {
    "path": "themes/coo/source/css/components/navbar.css",
    "content": "/* Modern Navbar Styles */\n\n/* Share Dropdown Styles */\n.share-dropdown {\n  position: relative;\n  z-index: 1000; /* Ensure container has sufficient z-index */\n}\n\n/* Ensure navbar container doesn't clip dropdown menu */\nheader .max-container {\n  overflow: visible;\n  position: relative; /* Ensure z-index takes effect */\n}\n\n#share-menu {\n  transform-origin: top right;\n  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n\n  /* Use absolute positioning, follow button position */\n  position: absolute;\n  z-index: 99999; /* Increase z-index to ensure it's on top layer */\n  pointer-events: auto; /* Ensure it can be clicked */\n}\n\n#share-menu.opacity-0 {\n  opacity: 0;\n  visibility: hidden;\n  transform: scale(0.95) translateY(-10px);\n}\n\n#share-menu.opacity-100 {\n  opacity: 1;\n  visibility: visible;\n  transform: scale(1) translateY(0);\n}\n\n/* Share menu items - Fix alignment and overflow issues */\n.share-item {\n  transition: background-color 0.15s ease-in-out;\n  cursor: pointer;\n  pointer-events: auto; /* Ensure menu items can be clicked */\n\n  /* Fix icon and text alignment */\n  align-items: center;\n  display: flex;\n}\n\n/* Fix icon container alignment */\n.share-item .flex-shrink-0 {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  flex-shrink: 0;\n}\n\n/* Fix SVG icon alignment within container */\n.share-item .flex-shrink-0 svg {\n  width: 20px;\n  height: 20px;\n  flex-shrink: 0;\n}\n\n/* Fix hover background to not overflow container */\n.share-item:hover {\n  background-color: rgb(148 163 184 / 10%);\n  border-radius: 0.75rem; /* 12px rounded-xl */\n  margin: 0.25rem 0.5rem; /* 4px 8px - ensure margin for rounded corners */\n}\n\n.dark .share-item:hover {\n  background-color: rgb(71 85 105 / 50%);\n}\n\n/* Fix the last item specifically to prevent overflow */\n.share-item:last-child {\n  margin-bottom: 0.25rem; /* Ensure bottom margin */\n}\n\n/* Ensure dropdown menu can be interacted with when visible */\n#share-menu.opacity-100 {\n  pointer-events: auto;\n}\n\n#share-menu.opacity-0 {\n  pointer-events: none;\n}\n\n/* Debug styles - ensure dropdown menu is visible */\n#share-menu {\n  /* Temporary debug: make menu always visible */\n\n  /* opacity: 1 !important; */\n\n  /* visibility: visible !important; */\n\n  /* transform: scale(1) !important; */\n}\n\n/* Backdrop blur support */\n@supports (backdrop-filter: blur(10px)) {\n  .backdrop-blur-sm {\n    backdrop-filter: blur(4px);\n  }\n}\n\n/* Fallback for browsers without backdrop-filter */\n@supports not (backdrop-filter: blur(10px)) {\n  .backdrop-blur-sm {\n    background-color: rgb(255 255 255 / 80%);\n  }\n\n  .dark .backdrop-blur-sm {\n    background-color: rgb(0 0 0 / 80%);\n  }\n}\n\n/* Professional Flexbox Layout Solution for Home Page */\nbody {\n  padding-top: 0;\n  margin: 0;\n}\n\n/* Use modern viewport units with fallback */\nhtml {\n  height: 100%;\n}\n\nbody {\n  min-height: 100vh; /* Fallback */\n  min-height: 100dvh; /* Dynamic viewport height for mobile */\n  display: flex;\n  flex-direction: column;\n}\n\n/* Header positioning for home page - use relative instead of absolute */\nheader.home {\n  position: relative; /* Change from absolute to relative for natural flow */\n  z-index: 50;\n  flex-shrink: 0; /* Don't shrink */\n\n  /* Keep all the background styling for hero section */\n}\n\n/* Main content area takes remaining space */\nsection.home {\n  flex: 1; /* Take all available space */\n  display: flex;\n  flex-direction: column;\n  margin-top: 0;\n  position: relative;\n  z-index: 10;\n}\n\n/* Footer stays at bottom */\nfooter {\n  flex-shrink: 0; /* Don't shrink */\n  margin-top: auto; /* Push to bottom if content is short */\n}\n\n/* Content spacing - natural and responsive */\nsection.home .max-container {\n  margin-top: 0;\n  padding-top: 2rem; /* Clean visual spacing */\n  flex: 1; /* Take available space in the section */\n}\n\n/* Legacy selector for backward compatibility */\n.home .max-container:last-child {\n  margin-top: 2rem;\n}\n\n/* Mobile optimizations */\n@media (width <= 768px) {\n  /* Adjust header spacing on mobile */\n  header .max-container {\n    padding-left: 1rem;\n    padding-right: 1rem;\n  }\n\n  /* Make buttons more touch-friendly */\n  #mysearch-trigger,\n  #darkMode,\n  #share-trigger {\n    min-height: 44px;\n    min-width: 44px;\n  }\n\n  /* Adjust share dropdown position on mobile */\n  #share-menu {\n    right: 0;\n    left: auto;\n    width: 280px;\n    max-width: calc(100vw - 2rem);\n  }\n\n  /* Hero section mobile adjustments */\n  .hero-section {\n    padding-top: 2rem;\n    padding-bottom: 3rem;\n  }\n\n  .hero-section h1 {\n    font-size: 2.5rem;\n    line-height: 1.2;\n  }\n\n  .hero-section h2 {\n    font-size: 1.125rem;\n    line-height: 1.6;\n  }\n\n  /* CTA buttons stack on mobile */\n  .hero-cta-buttons {\n    flex-direction: column;\n    gap: 1rem;\n  }\n\n  .hero-cta-buttons a {\n    width: 100%;\n    justify-content: center;\n  }\n\n  /* Stats grid on mobile */\n  .hero-stats {\n    grid-template-columns: 1fr;\n    gap: 1rem;\n  }\n\n  /* Mobile grid adjustments */\n  body:has(.home) {\n    grid-template-rows: auto 1fr auto; /* Maintain grid structure */\n  }\n\n  /* Fix mobile content spacing */\n  section.home .max-container {\n    padding-top: 1.5rem; /* Responsive spacing */\n  }\n\n  .home .max-container:last-child {\n    margin-top: 1rem;\n    padding-top: 2rem;\n  }\n}\n\n/* Tablet optimizations */\n@media (width >= 769px) and (width <= 1024px) {\n  /* Adjust container width on tablet */\n  .max-container {\n    padding-left: 1.5rem;\n    padding-right: 1.5rem;\n  }\n\n  /* Hero section tablet adjustments */\n  .hero-section h1 {\n    font-size: 3.5rem;\n  }\n\n  .hero-section h2 {\n    font-size: 1.25rem;\n  }\n\n  /* Tablet grid adjustments */\n  section.home .max-container {\n    padding-top: 2rem; /* Consistent responsive spacing */\n  }\n}\n\n/* Large screen optimizations */\n@media (width >= 1280px) {\n  /* Add more spacing on large screens */\n  .hero-section {\n    padding-top: 4rem;\n    padding-bottom: 6rem;\n  }\n\n  .hero-section h1 {\n    font-size: 4rem;\n  }\n\n  .hero-section h2 {\n    font-size: 1.5rem;\n  }\n\n  /* Large screen grid adjustments */\n  section.home .max-container {\n    padding-top: 3rem; /* Slightly more spacing for large screens */\n  }\n}\n\n/* Animation improvements */\n@media (prefers-reduced-motion: no-preference) {\n  /* Add subtle animations */\n  .fadeIn {\n    animation: fadeInUp 0.6s ease-out forwards;\n  }\n\n  @keyframes fadeInUp {\n    from {\n      opacity: 0;\n      transform: translateY(20px);\n    }\n\n    to {\n      opacity: 1;\n      transform: translateY(0);\n    }\n  }\n\n  .fadeIn:nth-child(1) {\n    animation-delay: 0.1s;\n  }\n\n  .fadeIn:nth-child(2) {\n    animation-delay: 0.2s;\n  }\n\n  .fadeIn:nth-child(3) {\n    animation-delay: 0.3s;\n  }\n\n  .fadeIn:nth-child(4) {\n    animation-delay: 0.4s;\n  }\n}\n\n/* Respect user preference for reduced motion */\n@media (prefers-reduced-motion: reduce) {\n  .fadeIn,\n  * {\n    animation-duration: 0.01ms !important;\n    animation-iteration-count: 1 !important;\n    transition-duration: 0.01ms !important;\n  }\n}\n\n/* Focus states for accessibility */\n#mysearch-trigger:focus,\n#darkMode:focus,\n#share-trigger:focus {\n  outline: 2px solid rgb(99 102 241);\n  outline-offset: 2px;\n}\n\n/* High contrast mode support */\n@media (prefers-contrast: high) {\n  #share-menu {\n    border: 2px solid;\n  }\n\n  .share-item:hover {\n    border: 1px solid;\n  }\n}\n\n/* Hero section specific styles */\n.hero-section {\n  background: linear-gradient(135deg, rgb(99 102 241), rgb(139 92 246));\n  position: relative;\n  overflow: hidden;\n}\n\n/* Header background styles for home page (positioning handled above) */\nheader.home .max-container {\n  background: transparent;\n}\n\n/* Animation keyframes */\n@keyframes float {\n  0%,\n  100% {\n    transform: translateY(0);\n  }\n\n  50% {\n    transform: translateY(-10px);\n  }\n}\n\n@keyframes pulse-slow {\n  0%,\n  100% {\n    opacity: 1;\n  }\n\n  50% {\n    opacity: 0.5;\n  }\n}\n\n@keyframes drift {\n  0% {\n    transform: translateX(-50px);\n  }\n\n  50% {\n    transform: translateX(50px);\n  }\n\n  100% {\n    transform: translateX(-50px);\n  }\n}\n\n/* Apply animations */\nheader .animate-float {\n  animation: float 6s ease-in-out infinite;\n}\n\nheader .animate-pulse-slow {\n  animation: pulse-slow 4s ease-in-out infinite;\n}\n\nheader .animate-drift {\n  animation: drift 20s linear infinite;\n}\n\n/* Background effects */\n.mesh-gradient {\n  background: linear-gradient(\n    135deg,\n    rgb(99 102 241 / 80%),\n    rgb(139 92 246 / 80%),\n    rgb(168 85 247 / 80%)\n  );\n}\n\n/* Search trigger styles */\n#mysearch-trigger {\n  position: relative;\n}\n\n#mysearch-trigger .shortcut-key {\n  opacity: 0.7;\n  font-size: 0.75rem;\n  font-weight: 500;\n  margin-left: 0.5rem;\n}\n\n/* Loading animation for GitHub stars */\n.loading-dots {\n  animation: loading-dots 1.5s infinite;\n}\n\n@keyframes loading-dots {\n  0%,\n  20% {\n    color: transparent;\n    text-shadow:\n      0.25em 0 0 currentcolor,\n      0.5em 0 0 transparent;\n  }\n\n  40% {\n    color: currentcolor;\n    text-shadow:\n      0.25em 0 0 transparent,\n      0.5em 0 0 transparent;\n  }\n\n  60%,\n  80% {\n    text-shadow:\n      0.25em 0 0 currentcolor,\n      0.5em 0 0 currentcolor;\n  }\n}\n\n/* GitHub stars counter */\n#github-stars {\n  transition: all 0.2s ease-in-out;\n  min-width: 2rem;\n  text-align: center;\n}\n\n#github-stars.animate-pulse {\n  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n\n/* Donation button styles */\n.donation-button-hero {\n  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n.donation-button-hero:hover {\n  transform: translateY(-2px);\n  box-shadow:\n    0 10px 25px -3px rgb(0 0 0 / 10%),\n    0 4px 6px -2px rgb(0 0 0 / 5%);\n}\n"
  },
  {
    "path": "themes/coo/source/css/components/pagination.css",
    "content": ".pagination .prev,\n.pagination .next,\n.pagination .page-number {\n  @apply mx-1 rounded-md bg-white px-3 py-2.5 font-medium text-slate-700 shadow hover:bg-indigo-500 hover:text-white;\n  @apply dark:bg-indigo-900 dark:text-indigo-300;\n}\n\n.pagination .space {\n  @apply mx-1 px-3 py-2.5 font-medium text-slate-700;\n  @apply dark:text-slate-300;\n}\n\n.pagination .page-number.current {\n  @apply bg-indigo-500 text-white;\n}\n"
  },
  {
    "path": "themes/coo/source/css/components/search.css",
    "content": "#mysearch {\n  animation-duration: 200ms;\n  animation-name: fade-in;\n  animation-fill-mode: both;\n}\n\n@keyframes fade-in {\n  from {\n    opacity: 0;\n  }\n\n  to {\n    opacity: 1;\n  }\n}\n\n#mysearch-box {\n  animation: 200ms cubic-bezier(0, 0, 0.2, 1) 0s 1 normal both running openAnimation;\n}\n\n#mysearch em {\n  font-style: normal;\n  color: rgb(99 102 241);\n}\n\n.text-color-inherit {\n  color: inherit;\n}\n\n@media (width >= 1200px) {\n  .xl\\:max-h-832 {\n    max-height: 800px;\n  }\n}\n\n#mysearch-list li.inactive {\n  border-color: rgb(226 232 240);\n}\n\n#mysearch-list li.inactive > a.link {\n  background-color: transparent;\n  color: rgb(15 23 42);\n}\n\n#mysearch-list li.inactive .icon-enter {\n  display: none;\n}\n\n#mysearch-list li.inactive i.icon,\n#mysearch-list li.inactive .sub-intro {\n  color: rgb(148 163 184);\n}\n\n#mysearch-list li.active {\n  z-index: 10;\n  border-color: transparent;\n  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 5%);\n}\n\n#mysearch-list li.active > a {\n  background-color: rgb(99 102 241);\n  color: rgb(255 255 255);\n  box-shadow:\n    0 1px 3px 0 rgb(0 0 0 / 10%),\n    0 1px 2px -1px rgb(0 0 0 / 10%);\n}\n\n#mysearch-list li.active em {\n  color: inherit;\n  text-decoration-line: underline;\n}\n\n#mysearch-list li.active .icon-enter {\n  display: block;\n}\n\n#mysearch-list li.active i.icon,\n#mysearch-list li.active .sub-intro {\n  color: rgb(255 255 255);\n}\n\n/* Ensure search result items have no fade-in animation */\n#mysearch-list li {\n  animation: none !important;\n  transition:\n    background-color 0.1s ease-in-out,\n    border-color 0.1s ease-in-out;\n}\n"
  },
  {
    "path": "themes/coo/source/css/components/social-buttons.css",
    "content": "/* Social Buttons Component Styles */\n\n/* Base styles for all social buttons */\n.social-buttons {\n  /* Ensure proper spacing and alignment */\n}\n\n/* Fix icon and text alignment issues */\n.social-buttons a {\n  /* Ensure perfect vertical alignment */\n  align-items: center !important;\n  justify-content: center !important;\n}\n\n.social-buttons a > div,\n.social-buttons a > span {\n  /* Remove any default margins that might cause misalignment */\n  margin-top: 0 !important;\n  margin-bottom: 0 !important;\n\n  /* Ensure consistent line height */\n  line-height: 1 !important;\n\n  /* Prevent flex items from growing/shrinking unexpectedly */\n  flex-shrink: 0;\n}\n\n/* Specific fixes for SVG icons */\n.social-buttons svg {\n  /* Ensure SVG icons are properly aligned */\n  vertical-align: middle;\n  display: block;\n\n  /* Override any fixed width/height attributes to match container */\n  width: 100% !important;\n  height: 100% !important;\n}\n\n/* Ensure icon containers have consistent sizing */\n.social-buttons .w-4 {\n  width: 1rem !important;\n  height: 1rem !important;\n}\n\n.social-buttons .w-5 {\n  width: 1.25rem !important;\n  height: 1.25rem !important;\n}\n\n/* Force all SVG icons to inherit container dimensions */\n.social-buttons .w-4 svg,\n.social-buttons .w-5 svg {\n  width: 100% !important;\n  height: 100% !important;\n  max-width: 100% !important;\n  max-height: 100% !important;\n}\n\n/* Hero variant - large buttons for homepage */\n.social-buttons.hero {\n  /* Already handled by Tailwind classes in component */\n}\n\n/* Compact variant - small icons for navbar */\n.social-buttons.compact {\n  /* Hide on mobile to save space */\n  @media (width <= 1023px) {\n    display: none !important;\n  }\n}\n\n/* Inline variant - medium size for detail pages */\n.social-buttons.inline {\n  /* Responsive adjustments for inline variant */\n  @media (width <= 768px) {\n    flex-direction: column;\n    gap: 0.75rem;\n  }\n\n  @media (width <= 640px) {\n    /* Stack vertically on small screens */\n    flex-direction: column;\n    align-items: stretch;\n    gap: 0.5rem;\n  }\n}\n\n/* GitHub stars counter responsive behavior */\n[id^='github-stars'] {\n  /* Ensure stars counter is readable */\n  min-width: 2rem;\n  text-align: center;\n}\n\n/* Compact variant specific styling for navbar */\n#github-stars-compact {\n  min-width: 2.5rem;\n  font-size: 0.75rem;\n  line-height: 1;\n  text-align: center;\n  font-weight: 500;\n}\n\n/* Ensure proper text color for compact variant */\n#github-stars-compact {\n  color: inherit;\n}\n\n/* Home page compact variant */\n.home #github-stars-compact {\n  color: rgb(255 255 255 / 90%);\n}\n\n/* Non-home page compact variant */\nbody:not(.home) #github-stars-compact {\n  color: rgb(71 85 105); /* slate-600 */\n}\n\n.dark body:not(.home) #github-stars-compact {\n  color: rgb(203 213 225); /* slate-300 */\n}\n\n/* Loading animation for stars */\n.loading-dots {\n  animation: loading-dots 1.5s infinite;\n}\n\n@keyframes loading-dots {\n  0%,\n  20% {\n    opacity: 0.4;\n  }\n\n  50% {\n    opacity: 1;\n  }\n\n  80%,\n  100% {\n    opacity: 0.4;\n  }\n}\n\n/* Button hover effects - ensure they work on all variants */\n.social-buttons a {\n  /* Smooth transitions */\n  transition: all 0.2s ease-in-out;\n}\n\n/* Responsive text sizing */\n@media (width <= 640px) {\n  .social-buttons.inline a {\n    padding: 0.5rem 1rem;\n    font-size: 0.875rem;\n  }\n\n  .social-buttons.inline [id^='github-stars'] {\n    font-size: 0.75rem;\n    padding: 0.25rem 0.5rem;\n  }\n}\n\n/* Ensure proper spacing between buttons on all screen sizes */\n.social-buttons.hero {\n  @media (width <= 1024px) {\n    flex-direction: column;\n    gap: 1rem;\n  }\n}\n\n/* Dark mode adjustments */\n@media (prefers-color-scheme: dark) {\n  .social-buttons.inline a {\n    /* Ensure good contrast in dark mode */\n    border-color: rgb(51 65 85 / 70%);\n  }\n}\n\n/* Focus states for accessibility */\n.social-buttons a:focus {\n  outline: 2px solid rgb(59 130 246);\n  outline-offset: 2px;\n}\n\n/* Reduce motion for users who prefer it */\n@media (prefers-reduced-motion: reduce) {\n  .social-buttons a {\n    transition: none;\n  }\n\n  .social-buttons a:hover {\n    transform: none !important;\n  }\n\n  .loading-dots {\n    animation: none;\n  }\n}\n"
  },
  {
    "path": "themes/coo/source/css/components/toc.css",
    "content": "/* stylelint-disable at-rule-no-deprecated */\n\n/* Simple Timeline TOC */\n.toc-container {\n  @apply fixed top-1/2 z-40 -translate-y-1/2;\n  @apply block;\n\n  width: 20px;\n  opacity: 1;\n\n  /* Constrain height to viewport */\n  max-height: 80vh;\n  overflow: visible;\n\n  /* Responsive positioning */\n  right: 1rem; /* 16px on mobile */\n}\n\n/* Larger screens */\n@media (width >= 768px) {\n  .toc-container {\n    right: 1.5rem; /* 24px on tablet+ */\n  }\n}\n\n@media (width >= 1280px) {\n  .toc-container {\n    right: 1.5rem; /* 24px on desktop */\n  }\n}\n\n.toc-list {\n  @apply relative flex flex-col items-center space-y-3 py-4;\n\n  height: 100%;\n}\n\n/* Timeline line - background (unread) */\n.toc-list::before {\n  content: '';\n\n  @apply absolute bottom-0 left-1/2 top-0 w-0.5;\n  @apply bg-indigo-200 dark:bg-indigo-700;\n\n  transform: translateX(-50%);\n  z-index: 1;\n}\n\n/* Timeline line - progress (read) */\n.toc-list::after {\n  content: '';\n\n  @apply absolute left-1/2 top-0 w-0.5;\n  @apply bg-gradient-to-b from-indigo-400 via-indigo-500 to-indigo-600;\n\n  transform: translateX(-50%);\n  z-index: 1;\n\n  /* Height controlled by CSS variable */\n  height: var(--progress-height, 0%);\n  transition: height 0.3s ease-out;\n}\n\n/* Timeline dots with larger hover area */\n.toc-link {\n  @apply relative flex cursor-pointer items-center justify-center;\n  @apply transition-all duration-200;\n\n  text-decoration: none;\n  z-index: 2;\n\n  /* Responsive clickable area */\n  width: 32px;\n  height: 32px;\n  margin: 3px 0;\n\n  /* Background for hover effect */\n  border-radius: 50%;\n}\n\n/* Mobile optimizations */\n@media (width <= 767px) {\n  .toc-link {\n    width: 36px;\n    height: 36px;\n    margin: 2px 0;\n  }\n}\n\n/* Add subtle background when hovering over the list */\n.toc-list:hover .toc-link {\n  @apply bg-indigo-50 dark:bg-indigo-900;\n\n  opacity: 0.7;\n}\n\n/* Highlight the currently hovered link */\n.toc-link:hover {\n  @apply bg-indigo-100 dark:bg-indigo-800;\n\n  opacity: 1 !important;\n  transform: scale(1.1);\n}\n\n/* Actual dot using ::before */\n.toc-link::before {\n  content: '';\n\n  @apply rounded-full transition-all duration-200;\n\n  /* Default unread state - responsive size */\n  width: 12px;\n  height: 12px;\n\n  @apply bg-indigo-300 dark:bg-indigo-600;\n}\n\n/* Larger dots on mobile for better visibility */\n@media (width <= 767px) {\n  .toc-link::before {\n    width: 14px;\n    height: 14px;\n  }\n}\n\n/* Hover effects for dots */\n.toc-list:hover .toc-link::before {\n  /* Dim all dots when hovering over the list */\n  @apply bg-indigo-200 dark:bg-indigo-700;\n\n  opacity: 0.6;\n}\n\n.toc-list:hover .toc-link.read::before {\n  /* Dim read dots */\n  @apply bg-indigo-400;\n\n  opacity: 0.6;\n}\n\n.toc-list:hover .toc-link.active::before {\n  /* Dim active dots */\n  @apply bg-indigo-600;\n\n  opacity: 0.6;\n}\n\n/* Highlight the currently hovered dot */\n.toc-link:hover::before {\n  @apply bg-indigo-700 dark:bg-indigo-200;\n\n  opacity: 1 !important;\n  transform: scale(1.2);\n  box-shadow: 0 0 0 3px rgb(99 102 241 / 30%);\n}\n\n.toc-link.read:hover::before {\n  @apply bg-indigo-700;\n\n  opacity: 1 !important;\n  transform: scale(1.2);\n  box-shadow: 0 0 0 3px rgb(99 102 241 / 30%);\n}\n\n.toc-link.active:hover::before {\n  @apply bg-indigo-800;\n\n  opacity: 1 !important;\n  transform: scale(1.2);\n  box-shadow: 0 0 0 3px rgb(99 102 241 / 40%);\n}\n\n/* Active state */\n.toc-link.active::before {\n  @apply bg-indigo-700 ring-2 ring-indigo-300;\n}\n\n/* Tooltip - show all when any link is hovered */\n.toc-link::after {\n  content: attr(data-tooltip);\n\n  @apply absolute top-1/2 -translate-y-1/2;\n  @apply rounded-lg bg-indigo-600 px-3 py-2 text-xs text-white;\n  @apply whitespace-nowrap shadow-lg;\n  @apply dark:bg-indigo-700 dark:text-indigo-100;\n\n  /* Fixed position to the left of the timeline */\n  right: 44px;\n  z-index: 50;\n\n  /* Hidden by default */\n  opacity: 0;\n  pointer-events: none;\n  transition: opacity 0.2s ease-out;\n\n  /* Prevent tooltip from going off screen */\n  max-width: calc(100vw - 80px);\n  white-space: nowrap;\n  overflow: hidden;\n  text-overflow: ellipsis;\n}\n\n/* Mobile tooltip adjustments */\n@media (width <= 767px) {\n  .toc-link::after {\n    right: 48px;\n\n    @apply px-2 py-1 text-xs;\n\n    max-width: calc(100vw - 100px);\n  }\n}\n\n/* Show all tooltips when any link is hovered */\n.toc-list:hover .toc-link::after {\n  opacity: 1;\n}\n\n/* Highlight the currently hovered tooltip */\n.toc-link:hover::after {\n  @apply bg-indigo-800 text-white;\n  @apply dark:bg-indigo-600 dark:text-indigo-50;\n  @apply font-medium;\n\n  transform: translateY(-50%) scale(1.05);\n  box-shadow:\n    0 8px 25px -3px rgb(0 0 0 / 20%),\n    0 4px 6px -2px rgb(0 0 0 / 10%);\n}\n\n@keyframes tooltip-fade-in {\n  from {\n    opacity: 0;\n    transform: translateY(-50%) translateX(8px);\n  }\n\n  to {\n    opacity: 1;\n    transform: translateY(-50%) translateX(0);\n  }\n}\n\n/* Mobile touch optimizations */\n@media (width <= 767px) {\n  /* Ensure TOC doesn't interfere with content on very small screens */\n  .toc-container {\n    right: 0.5rem;\n\n    /* Semi-transparent by default on mobile */\n    opacity: 0.6;\n    transition: opacity 0.3s ease;\n  }\n\n  /* Full opacity when interacting */\n  .toc-container:active,\n  .toc-container:hover,\n  .toc-container:focus-within {\n    opacity: 1;\n  }\n\n  /* Semi-transparent timeline and dots */\n  .toc-list::before {\n    @apply bg-indigo-200/60 dark:bg-indigo-700/60;\n  }\n\n  .toc-list::after {\n    @apply bg-gradient-to-b from-indigo-400/70 via-indigo-500/70 to-indigo-600/70;\n  }\n\n  .toc-link::before {\n    @apply bg-indigo-300/70 dark:bg-indigo-600/70;\n  }\n\n  .toc-link.read::before {\n    @apply bg-indigo-500/80;\n  }\n\n  .toc-link.active::before {\n    @apply bg-indigo-700/90;\n  }\n\n  /* Full opacity when container is active */\n  .toc-container:active .toc-list::before,\n  .toc-container:hover .toc-list::before {\n    @apply bg-indigo-200 dark:bg-indigo-700;\n  }\n\n  .toc-container:active .toc-list::after,\n  .toc-container:hover .toc-list::after {\n    @apply bg-gradient-to-b from-indigo-400 via-indigo-500 to-indigo-600;\n  }\n\n  .toc-container:active .toc-link::before,\n  .toc-container:hover .toc-link::before {\n    @apply bg-indigo-300 dark:bg-indigo-600;\n  }\n\n  .toc-container:active .toc-link.read::before,\n  .toc-container:hover .toc-link.read::before {\n    @apply bg-indigo-500;\n  }\n\n  .toc-container:active .toc-link.active::before,\n  .toc-container:hover .toc-link.active::before {\n    @apply bg-indigo-700;\n  }\n\n  /* Better touch targets */\n  .toc-link {\n    -webkit-tap-highlight-color: rgb(99 102 241 / 30%);\n    /* stylelint-disable-next-line property-no-unknown */\n    tap-highlight-color: rgb(99 102 241 / 30%);\n  }\n\n  /* Show tooltips on touch for mobile */\n  .toc-link:active::after {\n    opacity: 1;\n  }\n\n  /* Reduce animation intensity on mobile for better performance */\n  .toc-link:active {\n    transform: scale(1.05);\n  }\n\n  .toc-link:active::before {\n    transform: scale(1.1);\n  }\n\n  /* Add subtle swipe indicator */\n  .toc-container::after {\n    content: '';\n    position: absolute;\n    top: -8px;\n    left: 50%;\n    transform: translateX(-50%);\n    width: 2px;\n    height: 4px;\n    background: rgb(148 163 184 / 50%);\n    border-radius: 1px;\n    animation: swipe-hint 2s ease-in-out infinite;\n  }\n\n  @keyframes swipe-hint {\n    0%,\n    100% {\n      opacity: 0.3;\n    }\n\n    50% {\n      opacity: 0.7;\n    }\n  }\n\n  /* Hide hint when interacting */\n  .toc-container:active::after,\n  .toc-container:hover::after {\n    opacity: 0;\n  }\n}\n"
  },
  {
    "path": "themes/coo/source/css/style.tailwindcss",
    "content": "@import \"tailwindcss/base\";\n@import \"tailwindcss/components\";\n@import \"tailwindcss/utilities\";\n\n\n/* Custom Components */\n@import \"components/layer.css\";\n@import \"highlightjs/stackoverflow-light.min.css\";\n@import \"components/layout_table.css\";\n@import \"components/layout_list.css\";\n@import \"components/layout_note.css\";\n@import \"components/custom_tag.css\";\n@import \"components/code.css\";\n@import \"components/search.css\";\n@import \"components/toc.css\";\n@import \"components/pagination.css\";\n@import \"components/navbar.css\";\n@import \"components/social-buttons.css\";\n@import \"components/common.css\";\n\n\nhtml {\n    /* https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-tap-highlight-color */\n    -webkit-tap-highlight-color: transparent;\n}\n\nhtml.scrollbar {\n    scroll-behavior: smooth;\n    scroll-padding-top: 20px;\n}\n\n/***Scrollbars***/\n:root.dark {\n    color-scheme: dark;\n}\n\n.max-container {\n    max-width: 1320px;\n    @apply mx-auto p-3;\n}\n\n@media (max-width: 768px) {\n    .max-container {\n        @apply px-4;\n        max-width: 100%;\n        overflow-x: hidden;\n    }\n}\n\n.header-button {\n    @apply inline-flex items-center bg-slate-200 text-slate-600 transition duration-200 rounded-full border-0 p-3 ml-1 font-medium;\n    @apply hover:bg-slate-300 hover:text-slate-700 hover:shadow-lg;\n    @apply lg:px-6 lg:py-2 focus:outline-none;\n}\n\n.header-button > i {\n    @apply text-xl leading-5;\n    @apply lg:text-base lg:mr-2;\n}\n\n.home .card {\n    @apply relative p-4 flex items-center rounded-lg shadow-sm cursor-pointer text-slate-900/90 bg-opacity-[.65] fadeIn;\n    @apply dark:text-slate-300 dark:bg-opacity-50;\n    @apply hover:text-slate-100/90 hover:bg-opacity-100 hover:shadow-xl;\n}\n\n.home .card[data-label]::before {\n    content: attr(data-label);\n    display: block;\n    position: absolute;\n    font-size: 10px;\n    right: 8px;\n    top: 8px;\n    background: rgba(255 255 255 / 0.3);\n    border-radius: 4px;\n    padding: 1px 3px 2px 3px;\n}\n\n.home .card > svg {\n    @apply text-3xl;\n}\n\n.home .card > p {\n    @apply text-sm ml-2 truncate max-w-[75%];\n}\n\n.home .domain {\n    @apply text-slate-100;\n}\n\n/*************************Cheat sheet start****************************/\n.mdLayout {\n    color: #345;\n    @apply flex flex-col space-y-14;\n}\n\n@media (max-width: 768px) {\n    .mdLayout {\n        overflow-x: hidden;\n        word-wrap: break-word;\n    }\n}\n\n/* Dark mode toggle icons */\n.icon-light {\n    display: block;\n}\n\n.icon-dark {\n    display: none;\n}\n\n.dark .icon-light {\n    display: none;\n}\n\n.dark .icon-dark {\n    display: block;\n}\n\n.mdLayout h3 a.h-anchor, .mdLayout h4 a.h-anchor, .mdLayout h5 a.h-anchor {\n    @apply hidden;\n}\n\n/** H2 Wrap **/\n.mdLayout .h2-wrap {\n    @apply rounded-lg;\n}\n\n.mdLayout .h2-wrap:first-child:not(.show) > h2 {\n    /* @apply invisible; */\n}\n\n.mdLayout .h2-wrap > h2 {\n    @apply text-indigo-600 pr-2;\n    @apply dark:text-slate-300;\n}\n\n.mdLayout .h2-wrap > h2 > a.h-anchor {\n    @apply text-indigo-600 pr-2;\n}\n\n.mdLayout .h2-wrap > h2 > a.h-anchor:hover {\n    @apply text-indigo-700 no-underline cursor-pointer;\n}\n\n/** Grid layout. */\n.mdLayout .h2-wrap > .h3-wrap-list { @apply flex flex-col lg:grid lg:grid-cols-3 lg:gap-7; }\n.mdLayout .h2-wrap.cols-1 > .h3-wrap-list { @apply lg:grid-cols-1; }\n.mdLayout .h2-wrap.cols-2 > .h3-wrap-list { @apply lg:grid-cols-2; }\n.mdLayout .h2-wrap.cols-3 > .h3-wrap-list { @apply lg:grid-cols-3; }\n.mdLayout .h2-wrap.cols-4 > .h3-wrap-list { @apply lg:grid-cols-4; }\n.mdLayout .h2-wrap.cols-5 > .h3-wrap-list { @apply lg:grid-cols-5; }\n.mdLayout .h2-wrap.cols-6 > .h3-wrap-list { @apply lg:grid-cols-6; }\n\n\n/** H3 Wrap **/\n.mdLayout .h3-wrap-list {\n    font-size: 0.925rem;\n    line-height: 1.325rem;\n}\n\n\n/** List Layout in h3-wrap **/\n.mdLayout .h3-wrap ul,.h3-wrap ol,.h3-wrap dl { @apply my-2 grid grid-cols-1 list-outside; }\n.mdLayout .h3-wrap .cols-1  { @apply grid-cols-1; }\n.mdLayout .h3-wrap .cols-2  { @apply grid-cols-2; }\n.mdLayout .h3-wrap .cols-3  { @apply grid-cols-3; }\n.mdLayout .h3-wrap .cols-4  { @apply grid-cols-4; }\n.mdLayout .h3-wrap .cols-5  { @apply grid-cols-5; }\n.mdLayout .h3-wrap .cols-6  { @apply grid-cols-6; }\n\n\n.mdLayout .h3-wrap {\n    @apply bg-white pt-6 mb-4 rounded-lg shadow flex flex-col relative overflow-hidden;\n    @apply lg:mb-0;\n    @apply dark:bg-slate-800 dark:text-slate-300;\n  grid-auto-rows: auto;\n}\n\n.mdLayout .h3-wrap hr {\n    @apply border-slate-200 !important;\n    @apply dark:border-slate-600/50 !important;\n}\n\n.mdLayout .h2-wrap.boxed, .mdLayout .h3-wrap.boxed {\n    box-shadow: 0 0 0 1.6pt #6366f1;\n    transition: box-shadow 0.4s ease-in-out;\n    padding: 4px;\n}\n\n.mdLayout .h3-wrap.primary.boxed {\n    box-shadow: 0 0 0 1.6pt #f04444;\n}\n\n.mdLayout .h3-wrap.secondary.boxed {\n    box-shadow: 0 0 0 1.6pt #eaa13b;\n}\n\n.mdLayout .h3-wrap > h3 {\n    opacity: 0.9;\n    @apply bg-gradient-to-r from-indigo-500 to-purple-600 shadow text-white px-3 py-1 tracking-wider text-xs absolute right-0 top-0 rounded-bl-lg z-10;\n    @apply dark:bg-opacity-70 dark:text-slate-200;\n}\n\n.mdLayout .h3-wrap.secondary, .h3-wrap.primary {\n    @apply shadow-md;\n}\n\n.mdLayout .h3-wrap.secondary > h3 {\n    @apply bg-amber-500;\n}\n\n.mdLayout .h3-wrap.primary > h3 {\n    @apply bg-red-500;\n}\n\n.mdLayout .h3-wrap > .section {\n    @apply flex flex-col h-full w-full z-0;\n}\n\n/* Paragraphs */\n.mdLayout .h3-wrap > .section > p {\n    background: #f8f9fa;\n    color: #345;\n    @apply w-full px-4 py-3 m-0;\n    @apply dark:bg-slate-900/30 dark:text-slate-400;\n}\n\n.mdLayout .h3-wrap > .section > p:first-child:before, .h3-wrap > .section > h4:first-child:before  {\n    content: '-';\n    color: #f8f9fa;\n    background: #f8f9fa;\n    line-height: 1.75rem;\n    top: -4px;\n    @apply w-full absolute left-0;\n    @apply dark:bg-slate-900/30 dark:text-slate-800/0;\n}\n\n.mdLayout .h3-wrap > .section > p:last-child {\n    /* https://stackoverflow.com/questions/31000885/align-an-element-to-bottom-with-flexbox */\n    margin-top: auto;\n}\n\n/* Headings in between bodies */\n.mdLayout .h3-wrap > .section > h4 {\n    @apply bg-slate-100 border-t border-slate-200 text-slate-500 m-0 px-4 py-1 text-center;\n    @apply dark:bg-slate-700/30 dark:text-slate-300 dark:border-slate-700/50;\n}\n\n/* Links */\n.mdLayout .h3-wrap > .section p a,\n.mdLayout .h3-wrap > .section p a:visited,\n.intro p a,\n.intro p a:visited {\n    color: #345;\n    text-decoration: none;\n    border-bottom: solid 1px rgba(85, 102, 119, 0.18);\n    @apply dark:text-slate-500;\n    @apply hover:underline hover:decoration-indigo-500 hover:underline-offset-2 hover:decoration-1;\n}\n\n.mdLayout .h3-wrap > .section p a:hover,\n.intro p a:hover {\n    @apply text-indigo-600;\n}\n\n\n/*******************************/\n\n/* For links with sources, eg, [Foo](foo.com) _(foo.com)_ */\n.mdLayout.mdLayout a + em {\n    opacity: 0.5;\n    @apply dark:opacity-80;\n}\n\n/* mdLayout context */\n.mdLayout h2 {\n    margin: 0;\n    padding: 0;\n    margin-bottom: 24px;\n    margin-top: 64px;\n    position: relative;\n    font-size: 30px;\n    line-height: 1.2;\n    font-weight: 200;\n    font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\n    margin-top: 0;\n}\n\n@media (max-width: 768px) {\n    .mdLayout h2 {\n        margin-bottom: 8px;\n        margin-top: 32px;\n    }\n}\n\n@media (max-width: 480px) {\n    .mdLayout h2 {\n        margin-bottom: 8px;\n        margin-top: 32px;\n    }\n}\n\n.mdLayout a, .mdLayout a:visited {\n    color: #1959a2;\n    text-decoration: none;\n    background-image: linear-gradient(transparent,transparent 6px,#34495e 6px,#34495e);\n    background-position: bottom;\n    background-size: 100% 6px;\n    background-repeat: repeat-x;\n    @apply dark:text-sky-600;\n    @apply hover:underline hover:decoration-indigo-500 hover:underline-offset-4 hover:decoration-2;\n}\n\n.mdLayout em, .mdLayout sup, .mdLayout sub {\n    font-style: normal;\n    color: #556677;\n}\n\n.mdLayout iframe {\n    border: 0;\n    margin: 0;\n    width: 100%;\n}\n\n.local-anchor {\n    margin-left: -.9em;\n    margin-right: .1em;\n    padding: 0 .1em;\n}\n\n.mdLayout .local-anchor, .mdLayout .local-anchor:visited {\n    color: #556677;\n    text-decoration: inherit;\n    opacity: .5;\n}\n\n.mdLayout .local-anchor:target, .mdLayout :target > .local-anchor {\n    opacity: 1;\n    @apply text-indigo-500;\n}\n\n.mdLayout .local-anchor:hover, .mdLayout .local-anchor:focus {\n    opacity: 1;\n    text-decoration: inherit;\n    @apply text-white bg-indigo-500;\n}\n\n/* Crosslink (eg, phoenix.md) */\n.mdLayout.mdLayout img {\n    max-width: 100%;\n}\n\n.mdLayout.mdLayout p.link-arrow > a {\n    box-shadow: none;\n    text-decoration: none;\n    @apply text-indigo-500 block -mx-5 -my-3 p-3 border-0 text-center;\n    @apply hover:text-indigo-300 hover:bg-slate-200;\n}\n\n.mdLayout.mdLayout p.link-arrow > a:visited {\n    @apply text-indigo-500;\n}\n\n.mdLayout.mdLayout p.link-arrow > a::before {\n    content: '';\n    display: inline-block;\n    vertical-align: middle;\n    background: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22512%22%20height%3D%22512%22%20viewBox%3D%220%200%20512%20512%22%3E%3Cpath%20fill%3D%22rgb(255%2C255%2C255)%22%20d%3D%22M85%20277.375h259.704L225.002%20397.077%20256%20427l171-171L256%2085l-29.922%2029.924%20118.626%20119.7H85v42.75z%22%2F%3E%3C%2Fsvg%3E\") center center/16px 16px no-repeat;\n    height: 16px;\n    width: 16px;\n    margin-right: 16px;\n    width: 32px;\n    height: 32px;\n    line-height: 32px;\n    border-radius: 50%;\n    @apply bg-indigo-500;\n}\n\n.mdLayout.mdLayout p.link-arrow > a::before, .mdLayout.mdLayout p.link-arrow > a:visited::before {\n    @apply text-indigo-400 text-white;\n}\n\n.mdLayout.mdLayout p.link-arrow > a:hover, .mdLayout.mdLayout p.link-arrow > a:focus {\n    @apply text-indigo-500;\n}\n\n.mdLayout.mdLayout p.link-arrow > a:hover::before, .mdLayout.mdLayout p.link-arrow > a:focus::before {\n    @apply bg-indigo-500;\n}\n\n/* IMPORTANT: Override any conflicting header.home styles */\nheader.home {\n    position: relative !important; /* Force relative positioning */\n    top: auto !important;\n    left: auto !important;\n    right: auto !important;\n}\n"
  },
  {
    "path": "themes/coo/source/js/fuse_7.1.0.js",
    "content": "/**\n * Fuse.js v7.1.0 - Lightweight fuzzy-search (http://fusejs.io)\n *\n * Copyright (c) 2025 Kiro Risk (http://kiro.me)\n * All Rights Reserved. Apache Software License 2.0\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n */\nvar e,t;e=this,t=function(){\"use strict\";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e){return n=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?\"symbol\":typeof e},n(e)}function r(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,\"value\"in r&&(r.writable=!0),Object.defineProperty(e,v(r.key),r)}}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,\"prototype\",{writable:!1}),e}function o(e,t,n){return(t=v(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){if(\"function\"!=typeof t&&null!==t)throw new TypeError(\"Super expression must either be null or a function\");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,\"prototype\",{writable:!1}),t&&s(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function h(e,t){if(t&&(\"object\"==typeof t||\"function\"==typeof t))return t;if(void 0!==t)throw new TypeError(\"Derived constructors may only return object or undefined\");return function(e){if(void 0===e)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return e}(e)}function l(e){var t=function(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=a(e);if(t){var i=a(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h(this,n)}}function f(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if(\"undefined\"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e[\"@@iterator\"])return Array.from(e)}(e)||function(e,t){if(e){if(\"string\"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return\"Object\"===n&&e.constructor&&(n=e.constructor.name),\"Map\"===n||\"Set\"===n?Array.from(e):\"Arguments\"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e)||function(){throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v(e){var t=function(e,t){if(\"object\"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||\"default\");if(\"object\"!=typeof r)return r;throw new TypeError(\"@@toPrimitive must return a primitive value.\")}return(\"string\"===t?String:Number)(e)}(e,\"string\");return\"symbol\"==typeof t?t:String(t)}function g(e){return Array.isArray?Array.isArray(e):\"[object Array]\"===M(e)}var y=1/0;function p(e){return null==e?\"\":function(e){if(\"string\"==typeof e)return e;var t=e+\"\";return\"0\"==t&&1/e==-y?\"-0\":t}(e)}function A(e){return\"string\"==typeof e}function m(e){return\"number\"==typeof e}function C(e){return!0===e||!1===e||function(e){return k(e)&&null!==e}(e)&&\"[object Boolean]\"==M(e)}function k(e){return\"object\"===n(e)}function E(e){return null!=e}function F(e){return!e.trim().length}function M(e){return null==e?void 0===e?\"[object Undefined]\":\"[object Null]\":Object.prototype.toString.call(e)}var b=function(e){return\"Missing \".concat(e,\" property in key\")},D=function(e){return\"Property 'weight' in key '\".concat(e,\"' must be a positive integer\")},B=Object.prototype.hasOwnProperty,x=function(){function e(t){var n=this;r(this,e),this._keys=[],this._keyMap={};var i=0;t.forEach((function(e){var t=w(e);n._keys.push(t),n._keyMap[t.id]=t,i+=t.weight})),this._keys.forEach((function(e){e.weight/=i}))}return u(e,[{key:\"get\",value:function(e){return this._keyMap[e]}},{key:\"keys\",value:function(){return this._keys}},{key:\"toJSON\",value:function(){return JSON.stringify(this._keys)}}]),e}();function w(e){var t=null,n=null,r=null,i=1,u=null;if(A(e)||g(e))r=e,t=S(e),n=L(e);else{if(!B.call(e,\"name\"))throw new Error(b(\"name\"));var o=e.name;if(r=o,B.call(e,\"weight\")&&(i=e.weight)<=0)throw new Error(D(o));t=S(o),n=L(o),u=e.getFn}return{path:t,id:n,weight:i,src:r,getFn:u}}function S(e){return g(e)?e:e.split(\".\")}function L(e){return g(e)?e.join(\".\"):e}var _={useExtendedSearch:!1,getFn:function(e,t){var n=[],r=!1;return function e(t,i,u){if(E(t))if(i[u]){var o=t[i[u]];if(!E(o))return;if(u===i.length-1&&(A(o)||m(o)||C(o)))n.push(p(o));else if(g(o)){r=!0;for(var c=0,a=o.length;c<a;c+=1)e(o[c],i,u+1)}else i.length&&e(o,i,u+1)}else n.push(t)}(e,A(t)?t.split(\".\"):t,0),r?n:n[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},O=t(t(t(t({},{isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:function(e,t){return e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1}}),{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1}),{location:0,threshold:.6,distance:100}),_),j=/[^ ]+/g,I=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.getFn,i=void 0===n?O.getFn:n,u=t.fieldNormWeight,o=void 0===u?O.fieldNormWeight:u;r(this,e),this.norm=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=new Map,r=Math.pow(10,t);return{get:function(t){var i=t.match(j).length;if(n.has(i))return n.get(i);var u=1/Math.pow(i,.5*e),o=parseFloat(Math.round(u*r)/r);return n.set(i,o),o},clear:function(){n.clear()}}}(o,3),this.getFn=i,this.isCreated=!1,this.setIndexRecords()}return u(e,[{key:\"setSources\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:\"setIndexRecords\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:\"setKeys\",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=t,this._keysMap={},t.forEach((function(t,n){e._keysMap[t.id]=n}))}},{key:\"create\",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,A(this.docs[0])?this.docs.forEach((function(t,n){e._addString(t,n)})):this.docs.forEach((function(t,n){e._addObject(t,n)})),this.norm.clear())}},{key:\"add\",value:function(e){var t=this.size();A(e)?this._addString(e,t):this._addObject(e,t)}},{key:\"removeAt\",value:function(e){this.records.splice(e,1);for(var t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}},{key:\"getValueForItemAtKeyId\",value:function(e,t){return e[this._keysMap[t]]}},{key:\"size\",value:function(){return this.records.length}},{key:\"_addString\",value:function(e,t){if(E(e)&&!F(e)){var n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}}},{key:\"_addObject\",value:function(e,t){var n=this,r={i:t,$:{}};this.keys.forEach((function(t,i){var u=t.getFn?t.getFn(e):n.getFn(e,t.path);if(E(u))if(g(u)){for(var o=[],c=[{nestedArrIndex:-1,value:u}];c.length;){var a=c.pop(),s=a.nestedArrIndex,h=a.value;if(E(h))if(A(h)&&!F(h)){var l={v:h,i:s,n:n.norm.get(h)};o.push(l)}else g(h)&&h.forEach((function(e,t){c.push({nestedArrIndex:t,value:e})}))}r.$[i]=o}else if(A(u)&&!F(u)){var f={v:u,n:n.norm.get(u)};r.$[i]=f}})),this.records.push(r)}},{key:\"toJSON\",value:function(){return{keys:this.keys,records:this.records}}}]),e}();function $(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getFn,i=void 0===r?O.getFn:r,u=n.fieldNormWeight,o=void 0===u?O.fieldNormWeight:u,c=new I({getFn:i,fieldNormWeight:o});return c.setKeys(e.map(w)),c.setSources(t),c.create(),c}function R(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.errors,r=void 0===n?0:n,i=t.currentLocation,u=void 0===i?0:i,o=t.expectedLocation,c=void 0===o?0:o,a=t.distance,s=void 0===a?O.distance:a,h=t.ignoreLocation,l=void 0===h?O.ignoreLocation:h,f=r/e.length;if(l)return f;var d=Math.abs(c-u);return s?f+d/s:d?1:f}var N=32;function P(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=r.location,u=void 0===i?O.location:i,o=r.distance,c=void 0===o?O.distance:o,a=r.threshold,s=void 0===a?O.threshold:a,h=r.findAllMatches,l=void 0===h?O.findAllMatches:h,f=r.minMatchCharLength,d=void 0===f?O.minMatchCharLength:f,v=r.includeMatches,g=void 0===v?O.includeMatches:v,y=r.ignoreLocation,p=void 0===y?O.ignoreLocation:y;if(t.length>N)throw new Error(\"Pattern length exceeds max of \".concat(N,\".\"));for(var A,m=t.length,C=e.length,k=Math.max(0,Math.min(u,C)),E=s,F=k,M=d>1||g,b=M?Array(C):[];(A=e.indexOf(t,F))>-1;){var D=R(t,{currentLocation:A,expectedLocation:k,distance:c,ignoreLocation:p});if(E=Math.min(D,E),F=A+m,M)for(var B=0;B<m;)b[A+B]=1,B+=1}F=-1;for(var x=[],w=1,S=m+C,L=1<<m-1,_=0;_<m;_+=1){for(var j=0,I=S;j<I;)R(t,{errors:_,currentLocation:k+I,expectedLocation:k,distance:c,ignoreLocation:p})<=E?j=I:S=I,I=Math.floor((S-j)/2+j);S=I;var $=Math.max(1,k-I+1),P=l?C:Math.min(k+I,C)+m,W=Array(P+2);W[P+1]=(1<<_)-1;for(var z=P;z>=$;z-=1){var T=z-1,K=n[e.charAt(T)];if(M&&(b[T]=+!!K),W[z]=(W[z+1]<<1|1)&K,_&&(W[z]|=(x[z+1]|x[z])<<1|1|x[z+1]),W[z]&L&&(w=R(t,{errors:_,currentLocation:T,expectedLocation:k,distance:c,ignoreLocation:p}))<=E){if(E=w,(F=T)<=k)break;$=Math.max(1,2*k-F)}}if(R(t,{errors:_+1,currentLocation:k,expectedLocation:k,distance:c,ignoreLocation:p})>E)break;x=W}var q={isMatch:F>=0,score:Math.max(.001,w)};if(M){var J=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:O.minMatchCharLength,n=[],r=-1,i=-1,u=0,o=e.length;u<o;u+=1){var c=e[u];c&&-1===r?r=u:c||-1===r||((i=u-1)-r+1>=t&&n.push([r,i]),r=-1)}return e[u-1]&&u-r>=t&&n.push([r,u-1]),n}(b,d);J.length?g&&(q.indices=J):q.isMatch=!1}return q}function W(e){for(var t={},n=0,r=e.length;n<r;n+=1){var i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}var z=String.prototype.normalize?function(e){return e.normalize(\"NFD\").replace(/[\\u0300-\\u036F\\u0483-\\u0489\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u08D3-\\u08E1\\u08E3-\\u0903\\u093A-\\u093C\\u093E-\\u094F\\u0951-\\u0957\\u0962\\u0963\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u09FE\\u0A01-\\u0A03\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AE2\\u0AE3\\u0AFA-\\u0AFF\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B62\\u0B63\\u0B82\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0C00-\\u0C04\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C81-\\u0C83\\u0CBC\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0D00-\\u0D03\\u0D3B\\u0D3C\\u0D3E-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4D\\u0D57\\u0D62\\u0D63\\u0D82\\u0D83\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102B-\\u103E\\u1056-\\u1059\\u105E-\\u1060\\u1062-\\u1064\\u1067-\\u106D\\u1071-\\u1074\\u1082-\\u108D\\u108F\\u109A-\\u109D\\u135D-\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4-\\u17D3\\u17DD\\u180B-\\u180D\\u1885\\u1886\\u18A9\\u1920-\\u192B\\u1930-\\u193B\\u1A17-\\u1A1B\\u1A55-\\u1A5E\\u1A60-\\u1A7C\\u1A7F\\u1AB0-\\u1ABE\\u1B00-\\u1B04\\u1B34-\\u1B44\\u1B6B-\\u1B73\\u1B80-\\u1B82\\u1BA1-\\u1BAD\\u1BE6-\\u1BF3\\u1C24-\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE8\\u1CED\\u1CF2-\\u1CF4\\u1CF7-\\u1CF9\\u1DC0-\\u1DF9\\u1DFB-\\u1DFF\\u20D0-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F-\\uA672\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA823-\\uA827\\uA880\\uA881\\uA8B4-\\uA8C5\\uA8E0-\\uA8F1\\uA8FF\\uA926-\\uA92D\\uA947-\\uA953\\uA980-\\uA983\\uA9B3-\\uA9C0\\uA9E5\\uAA29-\\uAA36\\uAA43\\uAA4C\\uAA4D\\uAA7B-\\uAA7D\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEB-\\uAAEF\\uAAF5\\uAAF6\\uABE3-\\uABEA\\uABEC\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F]/g,\"\")}:function(e){return e},T=function(){function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=i.location,o=void 0===u?O.location:u,c=i.threshold,a=void 0===c?O.threshold:c,s=i.distance,h=void 0===s?O.distance:s,l=i.includeMatches,f=void 0===l?O.includeMatches:l,d=i.findAllMatches,v=void 0===d?O.findAllMatches:d,g=i.minMatchCharLength,y=void 0===g?O.minMatchCharLength:g,p=i.isCaseSensitive,A=void 0===p?O.isCaseSensitive:p,m=i.ignoreDiacritics,C=void 0===m?O.ignoreDiacritics:m,k=i.ignoreLocation,E=void 0===k?O.ignoreLocation:k;if(r(this,e),this.options={location:o,threshold:a,distance:h,includeMatches:f,findAllMatches:v,minMatchCharLength:y,isCaseSensitive:A,ignoreDiacritics:C,ignoreLocation:E},t=A?t:t.toLowerCase(),t=C?z(t):t,this.pattern=t,this.chunks=[],this.pattern.length){var F=function(e,t){n.chunks.push({pattern:e,alphabet:W(e),startIndex:t})},M=this.pattern.length;if(M>N){for(var b=0,D=M%N,B=M-D;b<B;)F(this.pattern.substr(b,N),b),b+=N;if(D){var x=M-N;F(this.pattern.substr(x),x)}}else F(this.pattern,0)}}return u(e,[{key:\"searchIn\",value:function(e){var t=this.options,n=t.isCaseSensitive,r=t.ignoreDiacritics,i=t.includeMatches;if(e=n?e:e.toLowerCase(),e=r?z(e):e,this.pattern===e){var u={isMatch:!0,score:0};return i&&(u.indices=[[0,e.length-1]]),u}var o=this.options,c=o.location,a=o.distance,s=o.threshold,h=o.findAllMatches,l=o.minMatchCharLength,d=o.ignoreLocation,v=[],g=0,y=!1;this.chunks.forEach((function(t){var n=t.pattern,r=t.alphabet,u=t.startIndex,o=P(e,n,r,{location:c+u,distance:a,threshold:s,findAllMatches:h,minMatchCharLength:l,includeMatches:i,ignoreLocation:d}),p=o.isMatch,A=o.score,m=o.indices;p&&(y=!0),g+=A,p&&m&&(v=[].concat(f(v),f(m)))}));var p={isMatch:y,score:y?g/this.chunks.length:1};return y&&i&&(p.indices=v),p}}]),e}(),K=function(){function e(t){r(this,e),this.pattern=t}return u(e,[{key:\"search\",value:function(){}}],[{key:\"isMultiMatch\",value:function(e){return q(e,this.multiRegex)}},{key:\"isSingleMatch\",value:function(e){return q(e,this.singleRegex)}}]),e}();function q(e,t){var n=e.match(t);return n?n[1]:null}var J=function(e){c(n,e);var t=l(n);function n(e){return r(this,n),t.call(this,e)}return u(n,[{key:\"search\",value:function(e){var t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:\"type\",get:function(){return\"exact\"}},{key:\"multiRegex\",get:function(){return/^=\"(.*)\"$/}},{key:\"singleRegex\",get:function(){return/^=(.*)$/}}]),n}(K),U=function(e){c(n,e);var t=l(n);function n(e){return r(this,n),t.call(this,e)}return u(n,[{key:\"search\",value:function(e){var t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:\"type\",get:function(){return\"inverse-exact\"}},{key:\"multiRegex\",get:function(){return/^!\"(.*)\"$/}},{key:\"singleRegex\",get:function(){return/^!(.*)$/}}]),n}(K),V=function(e){c(n,e);var t=l(n);function n(e){return r(this,n),t.call(this,e)}return u(n,[{key:\"search\",value:function(e){var t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:\"type\",get:function(){return\"prefix-exact\"}},{key:\"multiRegex\",get:function(){return/^\\^\"(.*)\"$/}},{key:\"singleRegex\",get:function(){return/^\\^(.*)$/}}]),n}(K),G=function(e){c(n,e);var t=l(n);function n(e){return r(this,n),t.call(this,e)}return u(n,[{key:\"search\",value:function(e){var t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:\"type\",get:function(){return\"inverse-prefix-exact\"}},{key:\"multiRegex\",get:function(){return/^!\\^\"(.*)\"$/}},{key:\"singleRegex\",get:function(){return/^!\\^(.*)$/}}]),n}(K),H=function(e){c(n,e);var t=l(n);function n(e){return r(this,n),t.call(this,e)}return u(n,[{key:\"search\",value:function(e){var t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}],[{key:\"type\",get:function(){return\"suffix-exact\"}},{key:\"multiRegex\",get:function(){return/^\"(.*)\"\\$$/}},{key:\"singleRegex\",get:function(){return/^(.*)\\$$/}}]),n}(K),Q=function(e){c(n,e);var t=l(n);function n(e){return r(this,n),t.call(this,e)}return u(n,[{key:\"search\",value:function(e){var t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:\"type\",get:function(){return\"inverse-suffix-exact\"}},{key:\"multiRegex\",get:function(){return/^!\"(.*)\"\\$$/}},{key:\"singleRegex\",get:function(){return/^!(.*)\\$$/}}]),n}(K),X=function(e){c(n,e);var t=l(n);function n(e){var i,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=u.location,c=void 0===o?O.location:o,a=u.threshold,s=void 0===a?O.threshold:a,h=u.distance,l=void 0===h?O.distance:h,f=u.includeMatches,d=void 0===f?O.includeMatches:f,v=u.findAllMatches,g=void 0===v?O.findAllMatches:v,y=u.minMatchCharLength,p=void 0===y?O.minMatchCharLength:y,A=u.isCaseSensitive,m=void 0===A?O.isCaseSensitive:A,C=u.ignoreDiacritics,k=void 0===C?O.ignoreDiacritics:C,E=u.ignoreLocation,F=void 0===E?O.ignoreLocation:E;return r(this,n),(i=t.call(this,e))._bitapSearch=new T(e,{location:c,threshold:s,distance:l,includeMatches:d,findAllMatches:g,minMatchCharLength:p,isCaseSensitive:m,ignoreDiacritics:k,ignoreLocation:F}),i}return u(n,[{key:\"search\",value:function(e){return this._bitapSearch.searchIn(e)}}],[{key:\"type\",get:function(){return\"fuzzy\"}},{key:\"multiRegex\",get:function(){return/^\"(.*)\"$/}},{key:\"singleRegex\",get:function(){return/^(.*)$/}}]),n}(K),Y=function(e){c(n,e);var t=l(n);function n(e){return r(this,n),t.call(this,e)}return u(n,[{key:\"search\",value:function(e){for(var t,n=0,r=[],i=this.pattern.length;(t=e.indexOf(this.pattern,n))>-1;)n=t+i,r.push([t,n-1]);var u=!!r.length;return{isMatch:u,score:u?0:1,indices:r}}}],[{key:\"type\",get:function(){return\"include\"}},{key:\"multiRegex\",get:function(){return/^'\"(.*)\"$/}},{key:\"singleRegex\",get:function(){return/^'(.*)$/}}]),n}(K),Z=[J,Y,V,G,Q,H,U,X],ee=Z.length,te=/ +(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)/,ne=new Set([X.type,Y.type]),re=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.isCaseSensitive,u=void 0===i?O.isCaseSensitive:i,o=n.ignoreDiacritics,c=void 0===o?O.ignoreDiacritics:o,a=n.includeMatches,s=void 0===a?O.includeMatches:a,h=n.minMatchCharLength,l=void 0===h?O.minMatchCharLength:h,f=n.ignoreLocation,d=void 0===f?O.ignoreLocation:f,v=n.findAllMatches,g=void 0===v?O.findAllMatches:v,y=n.location,p=void 0===y?O.location:y,A=n.threshold,m=void 0===A?O.threshold:A,C=n.distance,k=void 0===C?O.distance:C;r(this,e),this.query=null,this.options={isCaseSensitive:u,ignoreDiacritics:c,includeMatches:s,minMatchCharLength:l,findAllMatches:g,ignoreLocation:d,location:p,threshold:m,distance:k},t=u?t:t.toLowerCase(),t=c?z(t):t,this.pattern=t,this.query=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.split(\"|\").map((function(e){for(var n=e.trim().split(te).filter((function(e){return e&&!!e.trim()})),r=[],i=0,u=n.length;i<u;i+=1){for(var o=n[i],c=!1,a=-1;!c&&++a<ee;){var s=Z[a],h=s.isMultiMatch(o);h&&(r.push(new s(h,t)),c=!0)}if(!c)for(a=-1;++a<ee;){var l=Z[a],f=l.isSingleMatch(o);if(f){r.push(new l(f,t));break}}}return r}))}(this.pattern,this.options)}return u(e,[{key:\"searchIn\",value:function(e){var t=this.query;if(!t)return{isMatch:!1,score:1};var n=this.options,r=n.includeMatches,i=n.isCaseSensitive,u=n.ignoreDiacritics;e=i?e:e.toLowerCase(),e=u?z(e):e;for(var o=0,c=[],a=0,s=0,h=t.length;s<h;s+=1){var l=t[s];c.length=0,o=0;for(var d=0,v=l.length;d<v;d+=1){var g=l[d],y=g.search(e),p=y.isMatch,A=y.indices,m=y.score;if(!p){a=0,o=0,c.length=0;break}if(o+=1,a+=m,r){var C=g.constructor.type;ne.has(C)?c=[].concat(f(c),f(A)):c.push(A)}}if(o){var k={isMatch:!0,score:a/o};return r&&(k.indices=c),k}}return{isMatch:!1,score:1}}}],[{key:\"condition\",value:function(e,t){return t.useExtendedSearch}}]),e}(),ie=[];function ue(e,t){for(var n=0,r=ie.length;n<r;n+=1){var i=ie[n];if(i.condition(e,t))return new i(e,t)}return new T(e,t)}var oe=\"$and\",ce=\"$or\",ae=\"$path\",se=\"$val\",he=function(e){return!(!e[oe]&&!e[ce])},le=function(e){return o({},oe,Object.keys(e).map((function(t){return o({},t,e[t])})))};function fe(e,t){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).auto,r=void 0===n||n;return he(e)||(e=le(e)),function e(n){var i=Object.keys(n),u=function(e){return!!e[ae]}(n);if(!u&&i.length>1&&!he(n))return e(le(n));if(function(e){return!g(e)&&k(e)&&!he(e)}(n)){var o=u?n[ae]:i[0],c=u?n[se]:n[o];if(!A(c))throw new Error(function(e){return\"Invalid value for key \".concat(e)}(o));var a={keyId:L(o),pattern:c};return r&&(a.searcher=ue(c,t)),a}var s={children:[],operator:i[0]};return i.forEach((function(t){var r=n[t];g(r)&&r.forEach((function(t){s.children.push(e(t))}))})),s}(e)}function de(e,t){var n=e.matches;t.matches=[],E(n)&&n.forEach((function(e){if(E(e.indices)&&e.indices.length){var n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.src),e.idx>-1&&(n.refIndex=e.idx),t.matches.push(n)}}))}function ve(e,t){t.score=e.score}var ge=function(){function e(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=arguments.length>2?arguments[2]:void 0;r(this,e),this.options=t(t({},O),i),this.options.useExtendedSearch,this._keyStore=new x(this.options.keys),this.setCollection(n,u)}return u(e,[{key:\"setCollection\",value:function(e,t){if(this._docs=e,t&&!(t instanceof I))throw new Error(\"Incorrect 'index' type\");this._myIndex=t||$(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}},{key:\"add\",value:function(e){E(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:\"remove\",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!1},t=[],n=0,r=this._docs.length;n<r;n+=1){var i=this._docs[n];e(i,n)&&(this.removeAt(n),n-=1,r-=1,t.push(i))}return t}},{key:\"removeAt\",value:function(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}},{key:\"getIndex\",value:function(){return this._myIndex}},{key:\"search\",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).limit,n=void 0===t?-1:t,r=this.options,i=r.includeMatches,u=r.includeScore,o=r.shouldSort,c=r.sortFn,a=r.ignoreFieldNorm,s=A(e)?A(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,t){var n=t.ignoreFieldNorm,r=void 0===n?O.ignoreFieldNorm:n;e.forEach((function(e){var t=1;e.matches.forEach((function(e){var n=e.key,i=e.norm,u=e.score,o=n?n.weight:null;t*=Math.pow(0===u&&o?Number.EPSILON:u,(o||1)*(r?1:i))})),e.score=t}))}(s,{ignoreFieldNorm:a}),o&&s.sort(c),m(n)&&n>-1&&(s=s.slice(0,n)),function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.includeMatches,i=void 0===r?O.includeMatches:r,u=n.includeScore,o=void 0===u?O.includeScore:u,c=[];return i&&c.push(de),o&&c.push(ve),e.map((function(e){var n=e.idx,r={item:t[n],refIndex:n};return c.length&&c.forEach((function(t){t(e,r)})),r}))}(s,this._docs,{includeMatches:i,includeScore:u})}},{key:\"_searchStringList\",value:function(e){var t=ue(e,this.options),n=this._myIndex.records,r=[];return n.forEach((function(e){var n=e.v,i=e.i,u=e.n;if(E(n)){var o=t.searchIn(n),c=o.isMatch,a=o.score,s=o.indices;c&&r.push({item:n,idx:i,matches:[{score:a,value:n,norm:u,indices:s}]})}})),r}},{key:\"_searchLogical\",value:function(e){var t=this,n=fe(e,this.options),r=function e(n,r,i){if(!n.children){var u=n.keyId,o=n.searcher,c=t._findMatches({key:t._keyStore.get(u),value:t._myIndex.getValueForItemAtKeyId(r,u),searcher:o});return c&&c.length?[{idx:i,item:r,matches:c}]:[]}for(var a=[],s=0,h=n.children.length;s<h;s+=1){var l=e(n.children[s],r,i);if(l.length)a.push.apply(a,f(l));else if(n.operator===oe)return[]}return a},i=this._myIndex.records,u={},o=[];return i.forEach((function(e){var t=e.$,i=e.i;if(E(t)){var c=r(n,t,i);c.length&&(u[i]||(u[i]={idx:i,item:t,matches:[]},o.push(u[i])),c.forEach((function(e){var t,n=e.matches;(t=u[i].matches).push.apply(t,f(n))})))}})),o}},{key:\"_searchObjectList\",value:function(e){var t=this,n=ue(e,this.options),r=this._myIndex,i=r.keys,u=r.records,o=[];return u.forEach((function(e){var r=e.$,u=e.i;if(E(r)){var c=[];i.forEach((function(e,i){c.push.apply(c,f(t._findMatches({key:e,value:r[i],searcher:n})))})),c.length&&o.push({idx:u,item:r,matches:c})}})),o}},{key:\"_findMatches\",value:function(e){var t=e.key,n=e.value,r=e.searcher;if(!E(n))return[];var i=[];if(g(n))n.forEach((function(e){var n=e.v,u=e.i,o=e.n;if(E(n)){var c=r.searchIn(n),a=c.isMatch,s=c.score,h=c.indices;a&&i.push({score:s,key:t,value:n,idx:u,norm:o,indices:h})}}));else{var u=n.v,o=n.n,c=r.searchIn(u),a=c.isMatch,s=c.score,h=c.indices;a&&i.push({score:s,key:t,value:u,norm:o,indices:h})}return i}}]),e}();return ge.version=\"7.1.0\",ge.createIndex=$,ge.parseIndex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.getFn,r=void 0===n?O.getFn:n,i=t.fieldNormWeight,u=void 0===i?O.fieldNormWeight:i,o=e.keys,c=e.records,a=new I({getFn:r,fieldNormWeight:u});return a.setKeys(o),a.setIndexRecords(c),a},ge.config=O,function(){ie.push.apply(ie,arguments)}(re),ge},\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=t():\"function\"==typeof define&&define.amd?define(t):(e=\"undefined\"!=typeof globalThis?globalThis:e||self).Fuse=t();"
  },
  {
    "path": "themes/coo/source/js/main.js",
    "content": "const Utils = (function () {\n  return {\n    LIBRARY: {\n      fuse: {\n        lib: ['/js/fuse_7.1.0.js'],\n        instance: 'Fuse',\n        attr: { async: true }\n      }\n    },\n    loadScripts(urls, callback, attr = {}, container = document.head) {\n      const scripts = [];\n      for (const i in urls) {\n        scripts[i] = document.createElement('script');\n        scripts[i].setAttribute('type', 'text/javascript');\n        scripts[i].setAttribute('src', urls[i]);\n        Object.keys(attr).forEach((key) => {\n          scripts[i].setAttribute(key, attr[key]);\n        });\n      }\n      function loadNextScript() {\n        const script = scripts.shift();\n        let loaded = false;\n        container.appendChild(script);\n        script.onload = script.onreadystatechange = function () {\n          const rs = this.readyState;\n          if (rs && rs !== 'complete' && rs !== 'loaded') {\n            return;\n          }\n          if (loaded) {\n            return;\n          }\n          loaded = true;\n          if (scripts.length) {\n            loadNextScript();\n          } else {\n            callback();\n          }\n        };\n      }\n      loadNextScript();\n    },\n    externalLibrary(library) {\n      return new Promise((resolve) => {\n        if (typeof window[library.instance] === 'undefined' || window[library.instance] === null) {\n          this.loadScripts(\n            library.lib,\n            () => {\n              resolve(window[library.instance]);\n            },\n            library.attr,\n            library.container\n          );\n        } else {\n          resolve(window[library.instance]);\n        }\n      });\n    }\n  };\n})();\n\n// Simple Timeline TOC - Direct Implementation\n(function () {\n  function initTOC() {\n    const tocContainer = document.getElementById('toc-container');\n    const tocList = document.getElementById('toc-list');\n\n    if (!tocContainer || !tocList) return;\n\n    const headings = document.querySelectorAll('.h2-wrap h2');\n\n    if (headings.length === 0) {\n      tocContainer.style.display = 'none';\n      return;\n    }\n\n    // Generate TOC\n    tocList.innerHTML = '';\n    headings.forEach((heading, index) => {\n      let text = heading.textContent.trim().replace(/^#+\\s*/, '');\n      const id = heading.id || `heading-${index}`;\n\n      if (!heading.id) {\n        heading.id = id;\n      }\n\n      const tocItem = document.createElement('a');\n      tocItem.href = `#${id}`;\n      tocItem.className = 'toc-link';\n      tocItem.setAttribute('data-tooltip', text);\n\n      tocItem.addEventListener('click', (e) => {\n        e.preventDefault();\n        const targetElement = document.getElementById(id);\n        if (targetElement) {\n          const elementTop = targetElement.getBoundingClientRect().top + window.pageYOffset;\n          const viewportHeight = window.innerHeight;\n          const centerOffset = viewportHeight / 2;\n          const scrollToPosition = elementTop - centerOffset;\n\n          window.scrollTo({\n            top: Math.max(0, scrollToPosition),\n            behavior: 'smooth'\n          });\n\n          window.location.hash = id;\n        }\n      });\n\n      tocList.appendChild(tocItem);\n    });\n\n    // Update active heading and progress\n    function updateActiveHeading() {\n      const tocLinks = document.querySelectorAll('.toc-link');\n      let activeIndex = -1;\n      const scrollTop = window.pageYOffset + 100;\n\n      for (let i = headings.length - 1; i >= 0; i--) {\n        if (headings[i].offsetTop <= scrollTop) {\n          activeIndex = i;\n          break;\n        }\n      }\n\n      tocLinks.forEach((link, index) => {\n        link.classList.remove('active');\n        if (index <= activeIndex) {\n          link.classList.add('read');\n        } else {\n          link.classList.remove('read');\n        }\n      });\n\n      if (activeIndex >= 0 && tocLinks[activeIndex]) {\n        tocLinks[activeIndex].classList.add('active');\n      }\n\n      // Update progress\n      let progressPercent = 0;\n      if (activeIndex >= 0) {\n        progressPercent = ((activeIndex + 1) / headings.length) * 100;\n      }\n\n      const scrollPercent =\n        (window.pageYOffset / (document.documentElement.scrollHeight - window.innerHeight)) * 100;\n      const finalProgress = Math.max(progressPercent, scrollPercent || 0);\n\n      tocList.style.setProperty('--progress-height', `${Math.min(finalProgress, 100)}%`);\n    }\n\n    // Swipe/drag functionality for mobile\n    let isDragging = false;\n\n    function handleTouchStart() {\n      isDragging = true;\n      tocContainer.style.transition = 'none';\n    }\n\n    function handleTouchMove(e) {\n      if (!isDragging) return;\n      e.preventDefault();\n\n      const currentY = e.touches[0].clientY;\n      const containerRect = tocContainer.getBoundingClientRect();\n      const containerHeight = containerRect.height;\n\n      // Calculate which heading should be active based on touch position\n      const relativeY = (currentY - containerRect.top) / containerHeight;\n      const targetIndex = Math.floor(relativeY * headings.length);\n      const clampedIndex = Math.max(0, Math.min(targetIndex, headings.length - 1));\n\n      // Update visual feedback\n      const tocLinks = document.querySelectorAll('.toc-link');\n      tocLinks.forEach((link, index) => {\n        link.classList.remove('active');\n        if (index <= clampedIndex) {\n          link.classList.add('read');\n        } else {\n          link.classList.remove('read');\n        }\n      });\n\n      if (tocLinks[clampedIndex]) {\n        tocLinks[clampedIndex].classList.add('active');\n      }\n    }\n\n    function handleTouchEnd(e) {\n      if (!isDragging) return;\n      isDragging = false;\n      tocContainer.style.transition = '';\n\n      const currentY = e.changedTouches[0].clientY;\n      const containerRect = tocContainer.getBoundingClientRect();\n      const containerHeight = containerRect.height;\n\n      // Calculate target heading\n      const relativeY = (currentY - containerRect.top) / containerHeight;\n      const targetIndex = Math.floor(relativeY * headings.length);\n      const clampedIndex = Math.max(0, Math.min(targetIndex, headings.length - 1));\n\n      // Navigate to the target heading\n      if (headings[clampedIndex]) {\n        const targetHeading = headings[clampedIndex];\n        const elementTop = targetHeading.getBoundingClientRect().top + window.pageYOffset;\n        const viewportHeight = window.innerHeight;\n        const centerOffset = viewportHeight / 2;\n        const scrollToPosition = elementTop - centerOffset;\n\n        window.scrollTo({\n          top: Math.max(0, scrollToPosition),\n          behavior: 'smooth'\n        });\n\n        window.location.hash = targetHeading.id;\n      }\n    }\n\n    // Add touch event listeners\n    tocContainer.addEventListener('touchstart', handleTouchStart, { passive: false });\n    tocContainer.addEventListener('touchmove', handleTouchMove, { passive: false });\n    tocContainer.addEventListener('touchend', handleTouchEnd, { passive: false });\n\n    // Event listeners\n    window.addEventListener('scroll', updateActiveHeading, { passive: true });\n    window.addEventListener('hashchange', updateActiveHeading);\n\n    // Initial update\n    updateActiveHeading();\n  }\n\n  // Run immediately if DOM is ready, otherwise wait\n  if (document.readyState === 'loading') {\n    document.addEventListener('DOMContentLoaded', initTOC);\n  } else {\n    initTOC();\n  }\n})();\n\n// Share Dropdown Functionality with Portal Positioning\nfunction initShareDropdown() {\n  const shareDropdown = document.getElementById('share-dropdown');\n  const shareTrigger = document.getElementById('share-trigger');\n  const shareMenu = document.getElementById('share-menu');\n\n  if (!shareDropdown || !shareTrigger || !shareMenu) return;\n\n  // Toggle dropdown\n  shareTrigger.addEventListener('click', (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n\n    const isOpen = shareTrigger.getAttribute('aria-expanded') === 'true';\n\n    if (isOpen) {\n      closeShareDropdown();\n    } else {\n      openShareDropdown();\n    }\n  });\n\n  // Close dropdown when clicking outside\n  document.addEventListener('click', (e) => {\n    if (!shareDropdown.contains(e.target) && !shareMenu.contains(e.target)) {\n      closeShareDropdown();\n    }\n  });\n\n  // Close dropdown on escape key\n  document.addEventListener('keydown', (e) => {\n    if (e.key === 'Escape') {\n      closeShareDropdown();\n    }\n  });\n\n  // Update position on scroll and resize\n  function updatePosition() {\n    if (shareTrigger.getAttribute('aria-expanded') === 'true') {\n      positionDropdown();\n    }\n  }\n\n  window.addEventListener('scroll', updatePosition);\n  window.addEventListener('resize', updatePosition);\n\n  function positionDropdown() {\n    const triggerRect = shareTrigger.getBoundingClientRect();\n    const menuWidth = 224; // w-56 = 14rem = 224px\n    const spacing = 8; // mt-2 = 0.5rem = 8px\n\n    // Calculate position\n    let left = triggerRect.right - menuWidth;\n    let top = triggerRect.bottom + spacing;\n\n    // Ensure menu doesn't go off screen\n    const viewportWidth = window.innerWidth;\n    const viewportHeight = window.innerHeight;\n\n    if (left < 8) {\n      left = 8;\n    }\n    if (left + menuWidth > viewportWidth - 8) {\n      left = viewportWidth - menuWidth - 8;\n    }\n\n    // Check if there's enough space below, otherwise show above\n    if (top + 300 > viewportHeight) {\n      // Approximate menu height\n      top = triggerRect.top - 300 - spacing;\n    }\n\n    shareMenu.style.left = `${left}px`;\n    shareMenu.style.top = `${top}px`;\n  }\n\n  function openShareDropdown() {\n    shareTrigger.setAttribute('aria-expanded', 'true');\n\n    // Position the dropdown\n    positionDropdown();\n\n    // Enable pointer events and show menu\n    shareMenu.style.pointerEvents = 'auto';\n    shareMenu.classList.remove('opacity-0', 'invisible', 'scale-95');\n    shareMenu.classList.add('opacity-100', 'visible', 'scale-100');\n  }\n\n  function closeShareDropdown() {\n    shareTrigger.setAttribute('aria-expanded', 'false');\n    shareMenu.style.pointerEvents = 'none';\n    shareMenu.classList.remove('opacity-100', 'visible', 'scale-100');\n    shareMenu.classList.add('opacity-0', 'invisible', 'scale-95');\n  }\n}\n\n// Share Functions\nfunction shareOnX() {\n  const url = encodeURIComponent(window.location.href);\n  const text = encodeURIComponent(document.title);\n  window.open(`https://x.com/intent/tweet?text=${text}&url=${url}`, '_blank');\n}\n\nfunction shareOnFacebook() {\n  const url = encodeURIComponent(window.location.href);\n  window.open(`https://facebook.com/sharer/sharer.php?u=${url}`, '_blank');\n}\n\nfunction shareOnReddit() {\n  const url = encodeURIComponent(window.location.href);\n  const title = encodeURIComponent(document.title);\n  window.open(`https://reddit.com/submit/?url=${url}&resubmit=true&title=${title}`, '_blank');\n}\n\nfunction shareOnPinterest() {\n  const url = encodeURIComponent(window.location.href);\n  const description = encodeURIComponent(document.title);\n  window.open(\n    `https://pinterest.com/pin/create/button/?url=${url}&description=${description}`,\n    '_blank'\n  );\n}\n\nfunction shareOnLinkedIn() {\n  const url = encodeURIComponent(window.location.href);\n  const title = encodeURIComponent(document.title);\n  window.open(`https://www.linkedin.com/shareArticle?url=${url}&title=${title}`, '_blank');\n}\n\nfunction shareOnLine() {\n  const url = encodeURIComponent(window.location.href);\n  window.open(`https://social-plugins.line.me/lineit/share?url=${url}`, '_blank');\n}\n\nfunction shareViaEmail() {\n  const url = encodeURIComponent(window.location.href);\n  const title = encodeURIComponent(document.title);\n  window.location.href = `mailto:?subject=${title}&body=${url}`;\n}\n\n// Copy to clipboard function\nfunction copyToClipboard() {\n  const url = window.location.href;\n\n  if (navigator.clipboard && window.isSecureContext) {\n    navigator.clipboard\n      .writeText(url)\n      .then(() => {\n        showCopyNotification('Link copied to clipboard!');\n      })\n      .catch(() => {\n        fallbackCopyToClipboard(url);\n      });\n  } else {\n    fallbackCopyToClipboard(url);\n  }\n}\n\nfunction fallbackCopyToClipboard(text) {\n  const textArea = document.createElement('textarea');\n  textArea.value = text;\n  textArea.style.position = 'fixed';\n  textArea.style.left = '-999999px';\n  textArea.style.top = '-999999px';\n  document.body.appendChild(textArea);\n  textArea.focus();\n  textArea.select();\n\n  try {\n    document.execCommand('copy');\n    showCopyNotification('Link copied to clipboard!');\n  } catch (err) {\n    showCopyNotification('Failed to copy link');\n  }\n\n  document.body.removeChild(textArea);\n}\n\nfunction showCopyNotification(message) {\n  // Create notification element\n  const notification = document.createElement('div');\n  notification.className =\n    'fixed top-4 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg z-50 transform translate-x-full transition-transform duration-300';\n  notification.textContent = message;\n\n  document.body.appendChild(notification);\n\n  // Animate in\n  setTimeout(() => {\n    notification.classList.remove('translate-x-full');\n  }, 100);\n\n  // Animate out and remove\n  setTimeout(() => {\n    notification.classList.add('translate-x-full');\n    setTimeout(() => {\n      document.body.removeChild(notification);\n    }, 300);\n  }, 2000);\n}\n\n// GitHub Stars Functionality\nasync function fetchGitHubStars() {\n  // Find all GitHub stars elements (support multiple variants)\n  const starsElements = document.querySelectorAll('[id^=\"github-stars\"]');\n  if (starsElements.length === 0) return;\n\n  try {\n    // Try to get from cache first\n    const cached = localStorage.getItem('github-stars');\n    const cacheTime = localStorage.getItem('github-stars-time');\n    const now = Date.now();\n\n    // Use cache if it's less than 5 minutes old\n    if (cached && cacheTime && now - parseInt(cacheTime) < 5 * 60 * 1000) {\n      starsElements.forEach((element) => {\n        element.innerHTML = formatStarCount(parseInt(cached));\n      });\n      return;\n    }\n\n    // Fetch from GitHub API\n    const response = await fetch('https://api.github.com/repos/Fechin/reference');\n    if (!response.ok) throw new Error('Failed to fetch');\n\n    const data = await response.json();\n    const stars = data.stargazers_count;\n\n    // Cache the result\n    localStorage.setItem('github-stars', stars.toString());\n    localStorage.setItem('github-stars-time', now.toString());\n\n    // Update UI with animation\n    starsElements.forEach((element) => {\n      element.innerHTML = formatStarCount(stars);\n      element.classList.add('animate-pulse');\n      setTimeout(() => {\n        element.classList.remove('animate-pulse');\n      }, 1000);\n    });\n  } catch (error) {\n    console.warn('Failed to fetch GitHub stars:', error);\n    // Fallback to cached value or default\n    const cached = localStorage.getItem('github-stars');\n    const fallbackValue = cached ? formatStarCount(parseInt(cached)) : '6.5k';\n\n    starsElements.forEach((element) => {\n      element.innerHTML = fallbackValue;\n    });\n  }\n}\n\nfunction formatStarCount(count) {\n  if (count >= 1000) {\n    return (count / 1000).toFixed(1) + 'k';\n  }\n  return count.toString();\n}\n\nwindow.addEventListener('load', () => {\n  // Initialize share dropdown\n  initShareDropdown();\n\n  // Fetch GitHub stars\n  fetchGitHubStars();\n\n  // Dark mode functionality\n  document.querySelector('#darkMode').addEventListener('click', () => {\n    const html = document.documentElement.classList;\n    html.toggle('dark');\n    const isDarkMode = html.contains('dark');\n    localStorage.theme = isDarkMode ? 'dark' : '';\n  });\n\n  /******** List Collapsible ***********/\n  document.querySelectorAll('ul.collapsible > li > strong').forEach((strong) => {\n    const li = strong.parentElement;\n    li.classList.add('active');\n    strong.classList.toggle('arrow-down');\n    strong.addEventListener('click', function () {\n      li.classList.toggle('active');\n      this.classList.toggle('arrow-down');\n    });\n  });\n\n  /******** Remove bottom border noise ********/\n  document.querySelectorAll('.h3-wrap ul').forEach((ul) => {\n    const length = ul.querySelectorAll('li').length;\n    const matches = ul.className.match('cols-([0-9]+)');\n    const cols = matches === null ? 1 : parseInt(matches[1]);\n    const no_border_length = length === 1 || length % cols === 0 ? cols : length % cols;\n    for (let j = 1; j <= no_border_length; j++) {\n      const element = ul.querySelector(`li:nth-last-child(${j})`);\n      if (element !== null) {\n        element.style.borderBottom = 'none';\n      }\n    }\n  });\n\n  /******** h3-wrap blink ***********/\n  function blinkSection() {\n    const hash = window.location.hash;\n    const anchor = document.querySelector(`a[class=\"h-anchor\"][href=\"${hash}\"]`);\n    if (anchor !== null) {\n      const anchorSection = anchor.parentElement.parentElement;\n      document.querySelectorAll('.boxed').forEach((e) => {\n        e.classList.remove('boxed');\n      });\n      const timer = setTimeout(() => {\n        anchorSection.classList.add('boxed');\n        clearTimeout(timer);\n      }, 100);\n    }\n  }\n\n  blinkSection();\n  window.addEventListener('popstate', blinkSection);\n\n  /******** Search ***********/\n  function SearchEngine(options) {\n    const settings = options ? options : {};\n    const defaultOptions = {\n      trigger: '#mysearch-trigger',\n      container: '#mysearch',\n      dbPath: `${location.protocol}//${location.host}/search.json?v=1.0`\n    };\n    this.container =\n      typeof settings.container !== 'undefined' ? settings.container : defaultOptions.container;\n    this.trigger =\n      typeof settings.trigger !== 'undefined' ? settings.trigger : defaultOptions.trigger;\n    this.dbPath = typeof settings.dbPath !== 'undefined' ? settings.dbPath : defaultOptions.dbPath;\n\n    this.lastSearch = {};\n\n    window.search = this;\n  }\n  SearchEngine.prototype = {\n    start() {\n      const _this = this;\n\n      _this.fetchData(); // Prepare search data\n      this.search = document.querySelector(this.container);\n      this.box = document.querySelector('#mysearch-box');\n      this.input = document.querySelector('#mysearch-input');\n      this.result = document.querySelector('#mysearch-list');\n      this.lastSearch.query = this.input.value;\n\n      this.detectModal();\n\n      // Cancel button\n      const cancel = document.querySelector('.cancel');\n      cancel.addEventListener('click', () => {\n        _this.closeModal(true);\n      });\n\n      // Clear button\n      const clear = document.querySelector('#mysearch-clear');\n      clear.addEventListener('click', () => {\n        _this.doSearch('', true).then();\n      });\n\n      // Search trigger\n      const trigger = document.querySelector(_this.trigger);\n      trigger.addEventListener('click', () => {\n        _this.openModal(true);\n      });\n\n      document.body.addEventListener('click', (e) => {\n        if (_this.isOpened()) {\n          if (!_this.box.contains(e.target) && !trigger.contains(e.target)) {\n            _this.closeModal();\n          }\n        }\n      });\n\n      // Search input event\n      this.input.addEventListener('keyup', () => {\n        const value = _this.input.value;\n        if (value === _this.lastSearch.query) {\n          return;\n        }\n        _this.doSearch(value, true).then();\n      });\n\n      document.body.addEventListener('keydown', (e) => {\n        if (e.key === 'ArrowDown') {\n          if (_this.isOpened()) {\n            _this.moveItem(false);\n            e.preventDefault();\n            e.stopPropagation();\n          }\n        } else if (e.key === 'ArrowUp') {\n          if (_this.isOpened()) {\n            _this.moveItem(true);\n            e.preventDefault();\n            e.stopPropagation();\n          }\n        } else if (e.key === 'Enter') {\n          if (_this.isOpened()) {\n            const active = _this.result.querySelector('li.active > a');\n            if (active !== null) {\n              window.location.href = active.getAttribute('href');\n            }\n          }\n          e.preventDefault();\n          e.stopPropagation();\n        } else if (e.key === 'Escape') {\n          _this.closeModal();\n          e.preventDefault();\n          e.stopPropagation();\n        } else if ((e.ctrlKey || e.metaKey) && e.key === 'k' && !e.shiftKey) {\n          _this.toggleModal();\n          e.preventDefault();\n          e.stopPropagation();\n        }\n      });\n    },\n\n    moveItem(up) {\n      const current = this.result.querySelector('li.active');\n      const next = up ? current.previousElementSibling : current.nextElementSibling;\n      if (next !== null) {\n        current.classList.remove('active');\n        current.classList.add('inactive');\n        next.classList.remove('inactive');\n        next.classList.add('active');\n        this.renderPreview();\n      }\n    },\n    detectModal() {\n      const url_string = window.location.href;\n      const url = new URL(url_string);\n      const query = url.searchParams.get('q');\n      if (query !== null) {\n        this.input.value = query;\n        this.openModal(false);\n      }\n    },\n    isOpened() {\n      return this.search.classList.contains('block');\n    },\n    toggleModal() {\n      if (this.isOpened()) {\n        this.closeModal();\n      } else {\n        this.openModal();\n      }\n    },\n    openModal(reset) {\n      this.search.classList.remove('hidden');\n      this.search.classList.add('block');\n      if (reset) {\n        this.input.value = '';\n      }\n      document.body.classList.add('overflow-hidden');\n      this.doSearch(this.input.value, false);\n      this.input.focus();\n    },\n    closeModal(reset) {\n      this.search.classList.remove('block');\n      this.search.classList.add('hidden');\n      if (reset) {\n        this.input.value = '';\n      }\n      document.body.classList.remove('overflow-hidden');\n      this.input.blur();\n    },\n    changeUrl(params) {\n      const baseURL = `${location.protocol}//${location.host}${location.pathname}`;\n      let newURL = baseURL;\n      if (params !== '' && params !== null) {\n        newURL = `${baseURL}?${params}`;\n      }\n      history.pushState({}, null, newURL);\n    },\n    async fetchData() {\n      const _this = this;\n      if (_this.index !== undefined) {\n        return;\n      }\n      return await fetch(_this.dbPath)\n        .then((resp) => resp.text())\n        .then((resp) => {\n          _this.db = JSON.parse(resp);\n          _this.index = new Fuse(_this.db, {\n            // isCaseSensitive: false,\n            includeScore: false,\n            shouldSort: true,\n            includeMatches: true,\n            matchEmptyQuery: true,\n            // minMatchCharLength: 1,\n            // location: 0,\n            threshold: 0.1,\n            // distance: 100,\n            // useExtendedSearch: false,\n            // ignoreLocation: true,\n            // ignoreFieldNorm: false,\n            keys: [\n              { name: 'title', weight: 12 },\n              { name: 'tags', weight: 6 },\n              { name: 'categories', weight: 6 },\n              { name: 'sections.h3.title', weight: 5 },\n              { name: 'sections.h2.title', weight: 1 },\n              { name: 'intro', weight: 1 }\n            ]\n          });\n          // default return all\n          _this.lastSearch.whole = _this.db.map((doc, idx) => ({\n            item: doc,\n            score: 1,\n            refIndex: idx\n          }));\n          return resp;\n        });\n    },\n    async doSearch(value, history) {\n      const _this = this;\n      await _this.fetchData().then(() => {\n        if (this.lastSearch.query === value && this.lastSearch.resp !== undefined) {\n          this.renderResult(this.lastSearch.resp);\n          this.renderPreview();\n        } else {\n          const results = value !== '' ? _this.index.search(`${value}`) : _this.lastSearch.whole;\n          if (history) {\n            this.changeUrl(value === '' ? null : `q=${value}`);\n          }\n          this.lastSearch.query = value;\n          this.lastSearch.resp = results;\n          this.renderResult(results);\n          this.renderPreview();\n        }\n      });\n    },\n    addEventToResult() {\n      const _this = this;\n      this.result.querySelectorAll('li').forEach((li) => {\n        li.addEventListener('mouseover', function () {\n          if (_this.isOpened()) {\n            _this.result.querySelectorAll('li').forEach((e) => {\n              e.classList.remove('active');\n              e.classList.add('inactive');\n            });\n            this.classList.remove('inactive');\n            this.classList.add('active');\n            _this.renderPreview();\n          }\n        });\n      });\n    },\n    mark(text, matches) {\n      const result = [];\n      let pair = matches.shift();\n      // Build the formatted string\n      for (let i = 0; i < text.length; i++) {\n        const char = text.charAt(i);\n        if (pair && i === pair[0]) {\n          result.push('<mark>');\n        }\n        result.push(char);\n        if (pair && i === pair[1]) {\n          result.push('</mark>');\n          pair = matches.shift();\n        }\n      }\n      return result.join('');\n    },\n    highlightMatches(result) {\n      if (result.matches === undefined || result.item.length === 0) {\n        return;\n      }\n      const _this = this;\n      result.item = JSON.parse(JSON.stringify(_this.db[result.refIndex]));\n      result.matches.forEach((m) => {\n        switch (m.key) {\n          case 'tags':\n          case 'categories':\n            result.item[m.key][m.refIndex] = _this.mark(m.value, m.indices);\n            break;\n          case 'sections.h2.title':\n            result.item.sections[m.refIndex].h2.title = _this.mark(m.value, m.indices);\n            break;\n          case 'sections.h3.title': {\n            let currLength = 0;\n            let lastLength = 0;\n            for (let i = 0; i < result.item.sections.length; i++) {\n              const subArr = result.item.sections[i].h3;\n              currLength += subArr.length;\n              if (m.refIndex >= lastLength && m.refIndex < currLength) {\n                result.item.sections[i].h3[m.refIndex - lastLength].title = _this.mark(\n                  m.value,\n                  m.indices\n                );\n                break;\n              }\n              lastLength += subArr.length;\n            }\n            break;\n          }\n          default:\n            result.item[m.key] = _this.mark(m.value, m.indices);\n            break;\n        }\n      });\n    },\n    renderResult(results) {\n      const _this = this;\n      let liHtml = '';\n      let index = 0;\n      results.forEach((result, itemIndex) => {\n        let activeStr = 'inactive';\n        if (index === 0) {\n          activeStr = 'active';\n        }\n\n        _this.highlightMatches(result);\n\n        const hit = result.item;\n        const tags = hit.tags || [];\n        const categories = hit.categories || [];\n        const tagStr = tags.join(\"<span class='text-slate-300 px-1'>•</span>\");\n        let tagsHTML = '';\n        if (tagStr !== '') {\n          tagsHTML = `<div class=\"w-px h-3 bg-indigo-300 mr-2\"></div><span class=\"mr-2\">${tagStr}</span>`;\n        }\n        liHtml += `<li class=\"group ${activeStr} m-3\" data-index=\"${itemIndex}\">\n                                <a href=\"${hit.path}\" class=\"flex justify-between items-center rounded-lg py-1 px-4 transition-colors duration-100 ease-in-out overflow-hidden\">\n                                    <div class=\"flex items-start\">\n                                        <div class=\"flex justify-center items-center w-5 mr-5 mt-2 flex-none\">\n                                            <i class=\"icon text-2xl\">${hit.icon}</i>\n                                        </div>\n                                        <div class=\"flex flex-col truncate\">\n                                            <span class=\"font-semibold dark:text-slate-300 dark:group-hover:text-white\">${hit.title}</span>\n                                            <div class=\"sub-intro flex items-center text-sm leading-tight mt-4 xl:mt-2 mb-2\">\n                                                <span class=\"mr-2\">${categories[0]}</span>\n                                                ${tagsHTML}\n                                            </div>\n                                        </div>\n                                    </div>\n                                    <i class=\"w-6 ml-8 p-2 icon icon-enter\"></i>\n                                </a>\n                            </li>`;\n        index++;\n      });\n\n      this.result.innerHTML = liHtml;\n      this.addEventToResult();\n    },\n    renderPreview() {\n      const active = this.search.querySelector('li.active');\n      if (active === null) {\n        return;\n      }\n      const _this = this;\n      const itemIndex = active.getAttribute('data-index');\n      const hit = _this.lastSearch.resp[parseInt(itemIndex)].item;\n\n      let olInnerHtml = '';\n\n      hit.sections.forEach((section) => {\n        let h3HTML = '';\n        section.h3.forEach((h3) => {\n          const anchor = hit.path + h3.anchor;\n          h3HTML += `<a href=\"${anchor}\" class=\"inline-block mr-1 px-2 p-0.5 transition duration-200 ease-in-out rounded-full hover:bg-indigo-500 text-slate-500 dark:text-slate-300 hover:text-slate-50\">${h3.title.toLowerCase()}</a>`;\n        });\n        const anchor = hit.path + section.h2.anchor;\n        olInnerHtml += `<li class=\"text-slate-700 dark:text-slate-300 hover:underline hover:text-slate-900 mt-3 mb-2\">\n                                <a href=\"${anchor}\"> ${section.h2.title}</a>\n                            </li>\n                            <span>${h3HTML}</span>`;\n      });\n\n      document.querySelector('.preview-panel').innerHTML = `<section class=\"w-full py-3 px-5\">\n                <div class=\"flex justify-center pt-1 pb-4\">\n                    <div class=\"flex justify-center items-center w-8 h-8 rounded ${hit.background === undefined ? 'bg-indigo-500' : hit.background} shadow-lg\">\n                        <i class=\"text-2xl text-slate-100\">${hit.icon}</i>\n                    </div>\n                </div>\n                <div class=\"flex justify-center items-center font-medium flex-wrap dark:text-slate-200\">${hit.title}</div>\n                <ol class=\"list-inside mt-4 pt-2 text-sm list-decimal\">${olInnerHtml}</ol>\n            </section>`;\n    }\n  };\n\n  // Start search\n  Utils.externalLibrary(Utils.LIBRARY.fuse)\n    .then((Fuse) => {\n      if (typeof Fuse === 'undefined') {\n        console.error('Fuse.js library failed to load');\n        return;\n      }\n      new SearchEngine().start();\n    })\n    .catch((error) => {\n      console.error('Failed to load search library:', error);\n    });\n});\n"
  }
]