Ver Fonte

初始化项目并添加多个功能模块的配置文件和文档

- 新增 .gitignore 文件,排除 .idea 目录
- 新增多个功能模块的 cheat 文件,包括 Android、apt、brew、cf、压缩、crontab、curl、D
tianyun há 6 meses atrás
commit
5b6bee19e2

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+/.idea/

+ 121 - 0
LICENSE

@@ -0,0 +1,121 @@
+Creative Commons Legal Code
+
+CC0 1.0 Universal
+
+    CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+    LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
+    ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+    INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+    REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
+    PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
+    THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+    HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator
+and subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for
+the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without fear
+of later claims of infringement build upon, modify, incorporate in other
+works, reuse and redistribute as freely as possible in any form whatsoever
+and for any purposes, including without limitation commercial purposes.
+These owners may contribute to the Commons to promote the ideal of a free
+culture and the further production of creative, cultural and scientific
+works, or to gain reputation or greater distribution for their Work in
+part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or she
+is an owner of Copyright and Related Rights in the Work, voluntarily
+elects to apply CC0 to the Work and publicly distribute the Work under its
+terms, with knowledge of his or her Copyright and Related Rights in the
+Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not
+limited to, the following:
+
+  i. the right to reproduce, adapt, distribute, perform, display,
+     communicate, and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+iii. publicity and privacy rights pertaining to a person's image or
+     likeness depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work,
+     subject to the limitations in paragraph 4(a), below;
+  v. rights protecting the extraction, dissemination, use and reuse of data
+     in a Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+     European Parliament and of the Council of 11 March 1996 on the legal
+     protection of databases, and under any national implementation
+     thereof, including any amended or successor version of such
+     directive); and
+vii. other similar, equivalent or corresponding rights throughout the
+     world based on applicable law or treaty, and any national
+     implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention
+of, applicable law, Affirmer hereby overtly, fully, permanently,
+irrevocably and unconditionally waives, abandons, and surrenders all of
+Affirmer's Copyright and Related Rights and associated claims and causes
+of action, whether now known or unknown (including existing as well as
+future claims and causes of action), in the Work (i) in all territories
+worldwide, (ii) for the maximum duration provided by applicable law or
+treaty (including future time extensions), (iii) in any current or future
+medium and for any number of copies, and (iv) for any purpose whatsoever,
+including without limitation commercial, advertising or promotional
+purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
+member of the public at large and to the detriment of Affirmer's heirs and
+successors, fully intending that such Waiver shall not be subject to
+revocation, rescission, cancellation, termination, or any other legal or
+equitable action to disrupt the quiet enjoyment of the Work by the public
+as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason
+be judged legally invalid or ineffective under applicable law, then the
+Waiver shall be preserved to the maximum extent permitted taking into
+account Affirmer's express Statement of Purpose. In addition, to the
+extent the Waiver is so judged Affirmer hereby grants to each affected
+person a royalty-free, non transferable, non sublicensable, non exclusive,
+irrevocable and unconditional license to exercise Affirmer's Copyright and
+Related Rights in the Work (i) in all territories worldwide, (ii) for the
+maximum duration provided by applicable law or treaty (including future
+time extensions), (iii) in any current or future medium and for any number
+of copies, and (iv) for any purpose whatsoever, including without
+limitation commercial, advertising or promotional purposes (the
+"License"). The License shall be deemed effective as of the date CC0 was
+applied by Affirmer to the Work. Should any part of the License for any
+reason be judged legally invalid or ineffective under applicable law, such
+partial invalidity or ineffectiveness shall not invalidate the remainder
+of the License, and in such case Affirmer hereby affirms that he or she
+will not (i) exercise any of his or her remaining Copyright and Related
+Rights in the Work or (ii) assert any associated claims and causes of
+action with respect to the Work, in either case contrary to Affirmer's
+express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+    surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or
+    warranties of any kind concerning the Work, express, implied,
+    statutory or otherwise, including without limitation warranties of
+    title, merchantability, fitness for a particular purpose, non
+    infringement, or the absence of latent or other defects, accuracy, or
+    the present or absence of errors, whether or not discoverable, all to
+    the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+    that may apply to the Work or any use thereof, including without
+    limitation any person's Copyright and Related Rights in the Work.
+    Further, Affirmer disclaims responsibility for obtaining any necessary
+    consents, permissions or other rights required for any use of the
+    Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+    party to this document and has no duty or obligation with respect to
+    this CC0 or use of the Work.

+ 9 - 0
README.md

@@ -0,0 +1,9 @@
+Cheatsheets for [navi](https://github.com/denisidoro/navi).
+
+When the user runs navi for the first time, navi prompts to download `.cheat`s from this repository.
+
+If you want to add a cheatsheet for a new command, it's worth checking out [navi-tldr-pages](https://github.com/denisidoro/navi-tldr-pages). You can copy a cheatsheet from there, enhance it —with argument suggestions, for example—, then add it to this repo.
+
+In order to add your own repository as a featured cheatsheet repo, please [edit this file](https://github.com/denisidoro/cheats/edit/master/featured_repos.txt). This list will be displayed when `navi repo browse` is run.
+
+自定义仓库

+ 154 - 0
ci_cd/fly.cheat

@@ -0,0 +1,154 @@
+% fly, concourse, pipeline, ci-cd
+
+# Show Concourse help
+fly --help
+
+
+
+# List all Concourse target aliases
+fly targets
+
+# Delete saved configuration for a target
+fly --target <target> delete-target
+
+# Sync concourse version with target
+fly --target <target> sync
+
+# Login to a selected target
+fly --target <target> login
+
+
+
+# List all teams within a Concourse target
+fly --target <target> teams
+
+# Show the configuration for a given team
+fly --target <target> get-team --team-name <team>
+
+# Delete a team from Concourse installation
+fly --target <target> destroy-team -n <team>
+
+
+
+# list all pipelines
+fly --target <target> pipelines
+
+# Make pipeline public
+fly --target <target> expose-pipeline --pipeline <pipeline>
+
+# Make pipeline private
+fly --target <target> hide-pipeline --pipeline <pipeline>
+
+# Get pipeline / show pipeline
+fly --target <target> get-pipeline --pipeline <pipeline>
+
+# Pause a pipeline
+fly --target <target> pause-pipeline --pipeline <pipeline>
+
+# Unpause a pipeline
+fly --target <target> unpause-pipeline --pipeline <pipeline>
+
+# Rename a pipeline
+fly --target <target> rename-pipeline --old-name <pipeline> \
+--new-name <new_pipeline>
+
+# Create pipeline without variables
+fly --target <target> set-pipeline --pipeline <new_pipeline> \
+--config <pipeline_yaml>
+
+# Create pipeline with variables
+fly --target <target> set-pipeline --pipeline <new_pipeline> \
+--config <pipeline_yaml> --load-vars-from <pipeline_vars>
+
+# Update pipeline without variables
+fly --target <target> set-pipeline --pipeline <pipeline> \
+--config <pipeline_yaml>
+
+# Update pipeline with variables
+fly --target <target> set-pipeline --pipeline <new_pipeline> \
+--config <pipeline_yaml> --load-vars-from <pipeline_vars>
+
+# Validate pipeline without variables
+fly validate-pipeline --config <pipeline_yaml>
+
+# Validate pipeline with variables
+fly validate-pipeline --config <pipeline_yaml> \
+--load-vars-from <pipeline_vars>
+
+# Delete a pipeline
+fly --target <target> destroy-pipeline --pipeline <pipeline>
+
+
+
+# List the jobs of a pipeline
+fly --target <target> jobs --pipeline <pipeline>
+
+# Pause a job on a pipeline
+fly --target <target> pause-job --job=<pipeline>/<job>
+
+# Unpause a job on a pipeline
+fly --target <target> unpause-job --job=<pipeline>/<job>
+
+# Trigger a job on a pipeline
+fly --target <target> trigger-job --job=<pipeline>/<job>
+
+
+
+# List the latest builds for a job
+fly --target <target> builds --job=<pipeline>/<job> \
+--count=<amount>
+
+# Hijack a pipeline job for debugging
+fly --target <target> hijack --job=<pipeline>/<job> \
+--build <build>
+
+# Watch the log output from a running job
+fly --target <target> watch --job=<pipeline>/<job> \
+--build <build>
+
+# Abort a running build
+fly --target <target> abort-build --job=<pipeline>/<job> \
+--build <build>
+
+
+
+# List the users who have been active for the past 2 months
+fly --target <target> active-users
+
+# List the access of the current user
+fly --target <target> userinfo
+
+
+
+# List the resources for a pipeline
+fly --target <target> resources --pipeline <pipeline>
+
+# Check a resource
+fly --target <target> check-resource --resource=<pipeline>/<resource>
+
+# List the versions of a resource
+fly --target <target> resource-versions --resource=<pipeline>/<resource>
+
+# Pin a resource version
+fly --target <target> pin-resource --resource=<pipeline>/<resource> \
+--version <version>
+
+# Unpin a resource version
+fly --target <target> unpin-resource --resource=<pipeline>/<resource>
+
+
+
+
+
+$ target:   fly targets --- --column 1
+$ team:     fly -t "$target" teams
+$ job:      fly -t "$target" jobs --pipeline "$pipeline" --- --column 1
+$ build:    fly -t "$target" builds --job="$pipeline"/"$job" --- --column 3
+$ resource: fly -t "$target" resources --pipeline "$pipeline" --- --column 1
+$ version:  fly -t "$target" resource-versions --resource="$pipeline"/"$resource" --- --column 2
+$ pipeline: fly -t "$target" pipelines --- --column 1
+$ pipeline_yaml: ls *.yml || ls
+$ pipeline_vars: ls *.yml || ls
+
+
+

+ 130 - 0
cloud/cf.cheat

@@ -0,0 +1,130 @@
+% cf, pcf, pivotal cloud foundry, paas
+
+
+### Information
+# Get the extended list of help
+cf help -a
+
+# Get current version of cf
+cf version
+
+# Get information about current org
+cf org
+
+# Get information about current space
+cf space
+
+# Get information about current target
+cf target
+
+# Get list of all apps
+cf apps
+
+# Get list of all services
+cf services
+
+# Get list of all routes
+cf routes
+
+# Get list of all network policies
+cf network-policies
+
+
+
+### Login
+# Login to your CF/PCF instance
+cf login -a <API_URL>
+
+# Login to your CF/PCF instance with username and password
+cf login -a <API_URL> -u <USERNAME> -p <PASSWORD>
+
+# Login and specify target directly
+cf login -a <API_URL> -u <USERNAME> -p <PASSWORD> -o <ORG> -s <SPACE>
+
+
+
+### Target
+# Set target org
+cf target -o <org>
+
+# Set target space
+cf target -o <org> -s <space>
+
+
+### Application manipulation
+## Information
+# Get the guid of an app
+cf app <app> --guid
+
+# Get the status of an app
+cf app <app>
+
+## Status
+# Start an app
+cf start <app>
+
+# Stop an app
+cf stop <app>
+
+# Restart an app
+cf restart <app>
+
+# Rebuild the application package and restart
+cf restage <app>
+
+## Deletion
+# Delete an app
+cf delete <app>
+
+# Delete an app no prompt
+cf delete <app> -f
+
+# Delete an app and routes
+cf delete <app> -r
+
+
+
+### Networking - A bit slow due to filtering
+# Add network policy
+cf add-network-policy <add_network_source> \
+--destination-app <add_network_destination> \
+--protocol <add_network_protocol> \
+--port <add_network_port>
+
+# Remove network-policy
+cf remove-network-policy <remove_network_source> \
+--destination-app <remove_network_destination> \
+--protocol <remove_network_protocol> \
+--port <remove_network_port>
+
+
+### Services
+# Bind a service to an application
+cf bind-service <app> <service>
+
+# Unbind a service from an application
+cf unbind-service <app> <service>
+
+# Share a service between spaces
+cf share-service <service> -o <org> -s <space>
+
+# Unshare a service from a spaces
+cf unshare-service <service> -o <org> -s <space>
+
+
+
+# Autocomplete variables
+$ org: 		cf orgs | awk 'NR>3 {print}'
+$ space: 	cf target -o "$org" > /dev/null && cf spaces | awk 'NR>3 {print $1}'
+$ service: 	cf services | awk 'NR>3 {print $1}' | sed '/TIP:/d'
+$ route: 	cf routes | awk 'NR>3 {if ($4 ~ /^\//){ print $2 "." $3 $4} else {print $2 "." $3}}'
+$ app: 		cf apps | awk 'NR>4 {print $1}'
+
+$ add_network_source: 		cf apps | awk 'NR>4 {print $1}'
+$ add_network_destination:  	cf apps | awk 'NR>4 {print $1}' | sed "/$add_network_source/d"
+$ add_network_protocol: 	printf "tcp \nudp"
+
+$ remove_network_source: 	cf network-policies | awk 'NR>3 {print $1}' | uniq
+$ remove_network_destination: 	cf network-policies | grep "^$remove_network_source" | awk '{print $2}' | uniq
+$ remove_network_protocol: 	cf network-policies | grep "^$remove_network_source" | grep "$remove_network_destination" | awk '{print $3}' | uniq
+$ remove_network_port: 		cf network-policies | grep "^$remove_network_source" | grep "$remove_network_destination" | awk '{print $4}' | uniq

+ 47 - 0
cloud/firebase.cheat

@@ -0,0 +1,47 @@
+% firebase, account
+
+# Login
+firebase login
+
+# Logout
+firebase logout
+
+% firebase, local
+
+# Init a new project 
+firebase init [feature]
+
+# List of projects you have access to
+firebase projects:list
+
+# Set current project
+firebase use [options] [alias_or_project_id]
+
+# Serve all allowed content
+firebase serve
+
+# Serve specific feature
+firebase serve --only <feature>
+
+# Serve specific content for feature
+firebase serve --only <feature>:<content_folder>
+
+% firebase, remote
+
+# Deploy projects
+firebase deploy 
+
+# Deploy specific feature
+firebase deploy --only <feature>
+
+# Deploy specific content for feature
+firebase deploy --only <feature>:<content_folder>
+
+% firebase, ci
+
+# Generate a token for CI
+firebase login:ci
+
+# Deploy from CI
+firebase deploy --token <token_for_ci> 
+

+ 134 - 0
code/git.cheat

@@ -0,0 +1,134 @@
+% git
+
+# Set global git user name
+git config --global user.name <name>
+
+# Set global git user email
+git config --global user.email <email>
+
+# Initializes a git repository
+git init
+
+# Clone a git repository
+git clone -b <branch_name> <repository> <clone_directory>
+
+# Shallow clone with depth 1 with all branches and submodules
+git clone --depth=1 --no-single-branch --recurse-submodules <repository> <clone_directory>
+
+# Rebase upstream master into local/origin master (use if people don't clone your repository)
+git fetch <remote_name>
+git checkout master
+git rebase <remote_name>/master
+git fetch --unshallow origin
+git push -f origin master
+
+# Merge upstream master into local/origin master (use if people clone your repository)
+git fetch <remote_name>
+git checkout master
+git merge <remote_name>/master
+git fetch --unshallow origin
+git push -f origin master
+
+# View all available remote for a git repository
+git remote --verbose
+
+# Adds a remote for a git repository
+git remote add <remote_name> <remote_url>
+
+# Renames a remote for a git repository
+git remote rename <old_remote_name> <new_remote_name>
+
+# Remove a remote for a git repository
+git remote remove <remote_name>
+
+# Checkout to branch
+git checkout <branch>
+
+# Displays the current status of a git repository
+git status
+
+# Displays unstaged changes for file
+cd <toplevel_directory>; \
+    git diff <unstaged_files>
+
+# Stage single or multiple files
+cd <toplevel_directory>; \
+    git add <changed_files>;
+
+# Stage all files in project
+git add -A
+
+# Create commit for staged files
+git commit -m "<commit_description>"
+
+# Create backdated commit for staged files
+git commit --date="<number_of_days_ago> days ago" -m "<commit_description>"
+
+# Pushes committed changes to remote repository
+git push -u <remote_name> <branch_name>
+
+# Pushes changes to a remote repository overwriting another branch
+git push <remote_name> <branch>:<branch_to_overwrite>
+
+# Overwrites remote branch with local branch changes
+git push <remote_name> <branch_name> -f
+
+# Pulls changes to a remote repo to the local repo
+git pull --ff-only
+
+# Merges changes on one branch into current branch
+git merge <branch_name>
+
+# Abort the current conflict resolution process, and try to reconstruct the pre-merge state.
+git merge --abort
+
+# Displays log of commits for a repo
+git log
+
+# Displays formatted log of commits for a repo
+git log --all --decorate --oneline --graph
+
+# Clear everything
+git clean -dxf
+
+# Sign all commits in a branch based on master
+git rebase master -S -f
+
+# See all open pull requests of a user on Github
+navi fn url::open 'https://github.com/pulls?&q=author:<user>+is:open+is:pr'
+
+# Checkout a branch from a fork
+git fetch origin pull/<pr_number>/head:pr/<pr_number> \
+   && git checkout pr/<pr_number>
+
+# Add a new module
+git submodule add <repository> <path>
+
+# Update module
+git submodule update --init
+
+# Update module without init
+git submodule update
+
+# Pull all submodules
+git submodule foreach git pull origin master
+
+# Update all submodules
+git submodule update --init --recursive
+
+# Skip git hooks
+git commit --no-verify
+
+# Create new branch from current HEAD
+git checkout -b <new_branch_name>
+
+# Remove commits from local repository (destroy changes)
+git reset --hard HEAD~<number_of_commits>
+
+# Remove commits from local repository (keep changes)
+git reset --soft HEAD~<number_of_commits>
+
+$ branch: git branch | awk '{print $NF}'
+$ toplevel_directory: git rev-parse --show-toplevel
+$ unstaged_files: git status --untracked-files=no -s --porcelain | awk '{print $NF}' --- --multi true
+$ changed_files: git status --untracked-files=all -s --porcelain | awk '{print $NF}' --- --multi true

+ 77 - 0
container/docker.cheat

@@ -0,0 +1,77 @@
+% docker
+
+# Remove an image
+docker image rm <image_id>
+
+# Delete an image from the local image store
+docker rmi <image_id>
+
+# Clean none/dangling images
+docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
+
+# Force clean none/dangling images
+docker rmi $(docker images --filter "dangling=true" -q --no-trunc) -f
+
+# List all images that are locally stored with the Docker engine
+docker images
+
+# Build an image from the Dockerfile in the current directory and tag the image
+docker build -t <image>:<version> .
+
+# Pull an image from a registry
+docker pull <image>:<version>
+
+# Stop a running container through SIGTERM
+docker stop <container_id>
+
+# Stop a running container through SIGKILL
+docker kill <container_id>
+
+# List the networks
+docker network ls
+
+# List the running containers
+docker ps
+
+# Delete all running and stopped containers
+docker rm -f $(docker ps -aq)
+
+# Create a new bash process inside the container and connect it to the terminal
+docker exec -it <container_id> bash
+
+# Print the last lines of a container's logs
+docker logs --tail 100 <container_id> | less
+
+# Print the last lines of a container's logs and following its logs
+docker logs --tail 100 <container_id> -f
+
+# Create new network
+docker network create <network_name>
+
+$ image_id: docker images --- --headers 1 --column 3
+$ container_id: docker ps --- --headers 1 --column 1
+
+
+
+% docker-compose
+
+# Builds, (re)creates, starts, and attaches to containers for all services
+docker-compose up
+
+# Builds, (re)creates, starts, and dettaches to containers for all services
+docker-compose up -d
+
+# Builds, (re)creates, starts, and attaches to containers for a service
+docker-compose up -d <service_name>
+
+# Builds, (re)creates, starts, and dettaches to containers for a service
+docker-compose up -d <service_name>
+
+# Print the last lines of a service’s logs
+docker-compose logs --tail 100 <service_name> | less
+
+# Print the last lines of a service's logs and following its logs
+docker-compose logs -f --tail 100 <service_name>
+
+# Stops containers and removes containers, networks created by up
+docker-compose down

+ 36 - 0
container/k3d.cheat

@@ -0,0 +1,36 @@
+% k3d
+
+# Check if docker is running
+k3d check-tools
+
+# Start a subshell for a cluster
+k3d shell
+
+# Create a single k3s cluster in docker containers
+k3d create --name <cluster_name>
+
+# Create a multi-node k3s cluster in docker containers
+k3d create --name <name> --workers <worker_count>
+
+# Delete cluster
+k3d delete --name <cluster_name>
+
+# Stop cluster
+k3d stop --name <cluster_name>
+
+# Start a stopped cluster
+k3d start --name <cluster_name>
+
+# List all clusters
+k3d list
+
+# Get kubeconfig location for cluster
+k3d get-kubeconfig --name <cluster_name>
+
+# Import a comma- or space-separated list of container images from your local docker daemon into the cluster
+k3d import-images
+
+# Show a list of commands or help for one command
+k3d help
+
+$ cluster_name: k3d list |awk '{print $2}' | awk 'NF {print $0}' | tail -n +2

+ 66 - 0
container/kubernetes.cheat

@@ -0,0 +1,66 @@
+% kubernetes, k8s
+
+# Print all contexts
+kubectl config get-contexts
+
+# Print current context of kubeconfig
+kubectl config current-context
+
+# Set context of kubeconfig
+kubectl config use-context <context>
+
+# Print resource documentation
+kubectl explain <resource>
+
+# Get nodes (add option '-o wide' for details)
+kubectl get nodes
+
+# Get namespaces
+kubectl get namespaces
+
+# Get pods from namespace (add option '-o wide' for details)
+kubectl get pods -n <namespace>
+
+# Get pods from all namespace (add option '-o wide' for details)
+kubectl get pods --all-namespaces
+
+# Get services from namespace
+kubectl get services -n <namespace>
+
+# Get details from resource on namespace
+kubectl describe <resource>/<name> -n <namespace>
+
+# Print logs from namespace
+kubectl logs -f pods/<name> -n <namespace>
+
+# Get deployments
+kubectl get deployments -n <namespace>
+
+# Edit deployments
+kubectl edit deployment/<name> -n <namespace>
+
+# Drain node in preparation for maintenance
+kubectl drain <name>
+
+# Mark node as schedulable
+kubectl uncordon <name>
+
+# Mark node as unschedulable
+kubectl cordon <name>
+
+# Display resource (cpu/memory/storage) usage
+kubectl top <type>
+
+# List the namespaces in the current context
+kubens
+
+# Change the active namespace of current context
+kubens <namespaces>
+
+# Switch to the previous namespace in this context
+kubens -
+
+# Show the current namespace
+kubens -c
+
+$ namespaces: kubens --- --headers 1 --column 3

+ 10 - 0
db/mysql.cheat

@@ -0,0 +1,10 @@
+% mysql, database, db
+
+# Create database
+mysql -u <user> -p -e "create database <database> character set UTF8mb4 collate utf8mb4_bin"
+
+# Export databse
+mysqldump -u <user> -p <database> > <path>
+
+# Import database
+mysql -u <user> -p <database> <path>

+ 12 - 0
featured_repos.txt

@@ -0,0 +1,12 @@
+denisidoro/cheats
+denisidoro/navi-tldr-pages
+denisidoro/dotfiles
+mrVanDalo/navi-cheats
+chazeon/my-navi-cheats
+caojianhua/MyCheat
+Kidman1670/cheats
+isene/cheats
+m42martin/navi-cheats
+infosecstreams/cheat.sheets
+prx2090/cheatsheets-for-navi
+papanito/cheats

+ 24 - 0
misc/compression.cheat

@@ -0,0 +1,24 @@
+% compression
+
+# Create a tar containing files
+tar cf <name>.tar <files>
+
+# Extract the files from a tar
+tar xf <tar_file>
+
+# Create a tar with Gzip compression
+tar czf <name>.tar.gz <files> 
+
+# Extract a tar using Gzip
+tar xzf <targz_file>
+
+# Compress file and appends .gz to its name
+gzip <path>
+
+# Decompress compressed file
+gzip -d <gz_file>
+
+$ path: ls
+$ tar_file: ls *.tar
+$ targz_file: ls *.tar.gz
+$ gz_file: ls *.gz

+ 7 - 0
misc/crontab.cheat

@@ -0,0 +1,7 @@
+% crontab, schedule
+
+# List cron jobs
+crontab -l
+
+# Edit cron job
+crontab -e

+ 6 - 0
misc/json.cheat

@@ -0,0 +1,6 @@
+% json
+
+# convert JSON to YAML
+cat <json_file> | ruby -ryaml -rjson -e 'puts YAML.dump(JSON.load(ARGF))'
+
+$ json_file: find . -name '*.json'

+ 4 - 0
misc/qr.cheat

@@ -0,0 +1,4 @@
+% qr code
+
+# Create a QR code with some content
+echo <content> | curl -F-=\<- qrenco.de

+ 216 - 0
misc/shell.cheat

@@ -0,0 +1,216 @@
+
+% Shell Usage 
+
+# Re-call last input with sudo
+sudo !!
+
+# Help
+help cd / help dir (...)
+
+# Finding Help
+apropos directory / apropos search (...)
+
+# Define custom startup screen
+sudo nano /etc/motd
+
+# Run a script as background process
+<process> &
+
+#List all running processes
+ps -A
+
+# Kill a running process
+killall <Process-name>
+
+% Shell System
+
+# Get the current path
+pwd
+
+# Get the current hostname
+hostname
+
+# Get the current users
+users
+
+# Show calendar
+cal
+
+# Show today's date
+date
+
+# Exit terminal
+exit
+
+% Shell Permissions
+
+# Use -R option to change permissions recursively.
+ps -ef | grep apache | grep -v grep
+
+# Change group
+chgrp <group-name-from> <group-name-to>
+
+% Shell Directories
+
+# List directory contents
+ls
+
+# List all directory contents
+ll
+
+# List all directory contents sorted by time edited
+ls -alt
+
+# List directory (wildcard matching)
+ls *.<txt>
+
+# List all files of type
+find . -name '*.<txt>' -print
+
+# Go back to previous directory
+cd -
+
+# Make (empty) directory
+mkdir <dirname>
+
+# Remove (empty) directory
+rmdir <dirname>
+
+# Remove directory with all contents without prompt
+rm -rf <dirname>
+
+# Remove directory contents and keep directory
+rm -rf *
+
+# Change directory
+cd <dirname>
+
+% shell Symlinks
+
+# Create symlink
+ln -s <source-dirname> <destination-dirname>
+
+# Update symlink
+ln -sfn <source-dirname> <destination-dirname>
+
+# Remove symlink
+unlink <sample-dirname>
+
+% Shell Files
+
+# Make (empty) file
+touch <filename-txt>
+
+# Duplicate file
+cp <filename> <file-copyname>
+
+# Copy/Page folder with content
+cp -a <old-folder>/ <new-folder>
+
+# Move/Rename file
+mv <current-filename-path> <new-filename-path>
+
+# Move/Rename file and prompt before overwriting an existing file
+mv -i <current-filename> <new-filename>
+
+# Remove file
+rm <filename-txt>
+
+# Write to file (will overwrite existing content)
+cat > <filename-txt> 
+
+# Search for a filename-(not content!) in the current directory
+find <filename-txt>
+
+# Search for a string inside all files in the current directory and subdrectories
+grep -r <string> *
+
+# Search and replace within file
+sed -i s/<original-text>/<new-text>/g <filename-txt>
+
+# MD5 hash for files
+md5 <filename-txt>
+
+# MD5 hash for folders
+tar c <folder> | md5sum
+
+# Encrypt file
+openssl enc -aes-256-cbc -e -in <sample-filename-txt> -out <sample-encrypted-txt>
+
+# Decrypt file
+openssl enc -aes-256-cbc -d -in <sample-encrypted> -out <sample-filename>
+
+% Shell Server
+
+# Access via ssh
+ssh <username_remote>
+
+# Copy file from server to local
+scp <username_remote>:<file-to-send-path> <path-to-recieve> 
+
+# Copy file from local to server
+scp <file-to-send> <username_remote>:<where-to-put>
+
+# Escape files with spaces in name like this
+<path-to-file>\\\ <name-png>
+
+$ username_remote: cat ~/.ssh/config | grep -i "host "|sed 's/^[ \t]*//g' | awk '{print $2}'
+
+% Shell System
+
+# Show disc space
+df -h
+
+# Show disc space (inodes)
+df -i
+
+# Show disc space for current directory
+du -hs
+
+# Current processes (also CPS usage)
+top or htop
+
+# Show running php processes
+ps aux | grep php
+
+# Monitor error log (stream as file grows)
+tail error.log -f -n 0
+
+% Shell Apps
+
+# Start appliction
+xdg-open <programme> 
+
+# Open finder with current folder
+open .
+
+% Shell Variables
+
+# Register variable
+export <TESTING>=<Variable-text>
+
+# Echo variable
+echo $<Variable>
+
+# Unset variable
+unset <Variable>
+
+% Shell Output & Redirects
+
+# Write to file
+echo <Hello> > <hello-txt>
+
+# Append content from a file to another file
+cat <file1-txt> >> <file2-txt>
+
+# Add the amount of lines, words, and characters to <file2-txt>
+cat <file1-txt> | <word-count> | cat > <file2-txt>
+
+# Sort the content of a file (like cat)
+sort <hello-txt>
+
+# Save to sorted content to a new file
+cat <file1-txt> | sort > <sorted-file1-txt>
+
+# Sort and remove duplicates and save to a new file
+sort <file1-txt> | uniq > <uniq-file1-txt>

+ 37 - 0
misc/systemctl.cheat

@@ -0,0 +1,37 @@
+% systemctl, service
+
+# Start service
+systemctl start <service_inactive>
+
+# Stop service
+systemctl stop <service_active>
+
+# Enable service
+systemctl enable <service_disabled>
+
+# Disable service
+systemctl disable <service_enabled>
+
+# Restart service
+systemctl restart <service>
+
+# Reload service
+systemctl reload <service_active>
+
+# Service status
+systemctl status <service>
+
+# List running services
+systemctl list-units --type=service --state=running
+
+# List enabled services
+systemctl list-unit-files --type=service --state=enabled
+
+# List disabled services
+systemctl list-unit-files --type=service --state=disabled
+
+$ service_inactive: systemctl list-units --type=service --state=inactive | awk '{print $1}' | grep .service | sed 's/.service$//'
+$ service_active: systemctl list-units --type=service --state=active | awk '{print $1}' | grep .service | sed 's/.service$//'
+$ service_enabled: systemctl list-unit-files --type=service --state=enabled | awk '{print $1}' | grep .service | sed 's/.service$//'
+$ service_disabled: systemctl list-unit-files --type=service --state=disabled | awk '{print $1}' | grep .service | sed 's/.service$//'
+$ service: systemctl list-units --type=service --all | awk '{print $1}' | grep .service | sed 's/.service$//'

+ 11 - 0
misc/weather.cheat

@@ -0,0 +1,11 @@
+% weather
+
+# Show weather info for current location
+curl -s "wttr.in" \
+   | grep -v "New feature" \
+   | grep -v Follow
+
+# Show weather info for a specific location
+curl -s "wttr.in/<location>" \
+   | grep -v "New feature" \
+   | grep -v Follow

+ 45 - 0
mobile/android.cheat

@@ -0,0 +1,45 @@
+% android, device
+
+# Logcat
+adb -s <device> logcat -v time
+
+# Get property
+adb -s <device> shell getprop <property>
+
+# Install APK
+adb -s <device> install -r <path>
+
+# Uninstall package
+adb -s <device> uninstall -r <package>
+
+# Clear user data for package
+adb -s <device> shell pm clear <package>
+
+# Dispatch a deep-link / open URI
+adb -s <device> shell am start <uri>
+
+$ device: adb devices | grep -v devices | grep device | cut -f 1
+
+
+
+% android, emulator
+
+# Start emulator
+"$ANDROID_HOME/tools/emulator" -avd <emulator> -netdelay none -netspeed full
+
+$ emulator: "$ANDROID_HOME/tools/emulator" -list-avds
+
+
+
+% android, Firebase Crashlytics Test
+
+# Enable debug logging on your device
+adb -s <device> shell setprop log.tag.CrashlyticsCore DEBUG
+
+# View the logs in the device logs
+adb -s <device> logcat -s Fabric CrashlyticsCore
+
+# Disable debug mode
+adb -s <device> shell setprop log.tag.CrashlyticsCore INFO
+
+$ device: adb devices | grep -v devices | grep device | cut -f 1

+ 37 - 0
network/curl.cheat

@@ -0,0 +1,37 @@
+% curl, http
+
+# send a get http request
+curl <url>
+
+# send a http request
+curl -X <method> <url>
+
+# send a http request and write the output to a file
+curl -X <method> <url> -o <filename>
+
+# send a get http request and follow redirects
+curl -L <url>
+
+# send a get http request exit with a non-zero status code on failure
+curl --fail <url>
+
+# send an authenticated http request
+curl -u <username>:<password> -X <method> <url>
+
+# send a http request with a json body
+curl -X <method> <url>  -H 'Content-Type: application/json' -d '<json>'
+
+# send a http request with a form body
+curl <url> -d <bodykey>=<bodyvalue>
+
+# send a http request and see the request as well as the response
+curl -v <url>
+
+# send a http request with a body from a file
+curl -X <method> <url> --data-binary "@<file>"
+
+# send a http request with a custom header
+curl -X <method> <url> -H "<headername>: <headervalue>"
+
+$ file: ls
+$ method: echo -e 'GET\nPOST\nPUT\nDELETE\nPATCH'

+ 28 - 0
network/httpie.cheat

@@ -0,0 +1,28 @@
+% httpie, http
+
+# send a get http request
+http <url>
+
+# send a http request
+http <method> <url>
+
+# send an authenticated http request
+http -a <username>:<password> <method> <url>
+
+# send a http request with a json body
+http <method> <url> <bodykey>=<bodyvalue>
+
+# send a http request with a form body
+http -f POST <url> <bodykey>=<bodyvalue>
+
+# send a http request and see the request as well as the response
+http -v <url>
+
+# send a post http request wih a body from a file
+http <method> <url> < <file>
+
+# send a http request wih a custom header
+http <method> <url> <headername>:<headervalue>
+
+$ file: ls
+$ method: echo -e 'GET\nPOST\nPUT\nDELETE\nPATCH'

+ 27 - 0
network/network.cheat

@@ -0,0 +1,27 @@
+% network
+
+# Kill a process running on a given port
+lsof -i :<port> \
+   | awk '{l=$2} END {print l}' \
+   | xargs kill
+
+# List IP addresses connected on a given port
+netstat -tn 2>/dev/null \
+   | grep :<port> \
+   | awk '{print $5}' \
+   | cut -d: -f1 \
+   | sort \
+   | uniq -c \
+   | sort -nr \
+   | head
+
+# Find primary, local IP address
+ifconfig \
+  | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' \
+  | grep -Eo '([0-9]*\.){3}[0-9]*' \
+  | grep -v '127.0.0.1' \
+  | tail -n1
+
+
+# Find external, public IP address
+dig +short myip.opendns.com @resolver1.opendns.com

+ 43 - 0
os/osx.cheat

@@ -0,0 +1,43 @@
+% osx, mac os
+
+# Copy <file_or_dir> to <target_path>, and remove all target files and directories `@` attribute
+cp -RX <file_or_dir> <target_path>
+
+# Remove <file_or_dir>'s `@` attribute
+xattr -rc <file_or_dir>
+
+# Lock system
+pmset displaysleepnow
+
+# Eject volume
+diskutil eject '<eject_vol>'
+
+# Show disk info
+diskutil list
+
+# Show partition info
+diskutil info '<disk_dev>'
+
+# Show hidden files in Finder
+defaults write com.apple.finder AppleShowAllFiles -bool true; \
+   killall Finder
+
+# Hide hidden files in Finder
+defaults write com.apple.finder AppleShowAllFiles -bool false; \
+   killall Finder
+
+# Show items in desktop
+defaults write com.apple.finder CreateDesktop -bool true; \
+   killall Finder
+
+# Hide items in desktop
+defaults write com.apple.finder CreateDesktop -bool false; \
+   killall Finder
+
+# Set wallpaper
+osascript -e 'tell application "Finder" to set desktop picture to POSIX file "<image_path>"'
+
+$ file_or_dir: ls
+$ image_path: find $HOME -maxdepth 3 -name "*.jpg" -o -name "*.jpeg" -o -name "*.png"
+$ disk_dev: find /dev -maxdepth 1 -name "disk*s*"
+$ eject_vol: find /Volumes ! -path /Volumes -maxdepth 1 -type d  -name "*"

+ 55 - 0
pkg_mgr/apt.cheat

@@ -0,0 +1,55 @@
+% apt
+
+# Update content listings from package repositories
+apt update
+
+# List all available packages
+apt list
+
+# List all installed packages
+apt list --installed
+
+# Info about package (including description)
+apt show -a <package-name>
+
+# Show versions and archive areas of available package
+apt list -a <package-name>
+
+# Search in repository (packages and description)
+apt search <query>
+
+# Check updates for installed packages
+apt list --upgradeable
+
+# Update all installed packages
+apt upgrade
+
+# Upgrade all installed packages (add/remove dependencies)
+apt full-upgrade
+
+# Update specific/individual package
+apt install --only-upgrade <package-name>
+
+# Downgrade package to a specific version
+apt install <package-name>=<package-version>
+
+# Install a package from repository
+apt install <package-name>
+
+# Remove/delete package
+apt remove <package-name>
+
+# Remove/delete package (with config files)
+apt purge <package-name>
+
+# Install local dpkg package
+apt install <filepath-deb>
+
+# List dependencies of package
+apt depends <package-name>
+
+# List reverse dependencies of package
+apt rdepends <package-name>
+
+# Remove un-needed packages and dependencies
+apt autoremove

+ 97 - 0
pkg_mgr/brew.cheat

@@ -0,0 +1,97 @@
+% brew, cask
+
+# update brew
+brew update
+
+# upgrade brew
+brew upgrade
+
+# get info for a package
+brew info <package>
+
+# get info for a cask
+brew cask info <casks>
+
+# install a package
+brew install <package>
+
+# install a cask
+brew cask install <casks>
+
+# reinstall a package
+brew reinstall <package>
+
+# reinstall a cask
+brew reinstall <caskinstalled>
+
+# uninstall a package
+brew uninstall <installed>
+
+# uninstall a cask
+brew cask uninstall <caskinstalled>
+
+# edit package
+brew edit <package>
+
+# edit cask
+brew cask edit <casks>
+
+# list all services installed by brew for the current user
+brew services list
+
+# for root, list all services installed by brew
+sudo brew services list
+
+# run the service formula without registering to launch at login
+brew services run <brewservice>
+
+# as root, run the service formula without registering to launch at login
+sudo brew services run <brewservice>
+
+# start the service formula immediately and register it to launch at login
+brew services start <brewservice>
+
+# as root, start the service formula immediately and register it to launch at login
+sudo brew services start <brewservice>
+
+# stop the service formula immediately and unregister it from launching at login
+brew services stop <brewservice>
+
+# as root, stop the service formula immediately and unregister it from launching at login
+sudo brew services stop <brewservice>
+
+# stop (if necessary) and start the service formula immediately and register it to launch at login
+brew services restart <brewservice>
+
+# as root, stop (if necessary) and start the service formula immediately and register it to launch at login
+sudo brew services restart <brewservice>
+
+# remove all unused services
+brew services cleanup
+
+# as root, remove all unused services
+sudo brew services cleanup
+
+# auto cleanup
+brew cleanup
+
+# link formula
+brew link <installed>
+
+# delete files that already exist in the prefix while linking
+brew link --overwrite <installed>
+
+# allow keg-only formulae to be linked
+brew link --force <installed>
+
+# health check
+brew doctor
+
+# fix permissions
+sudo chown -R $(whoami):admin /usr/local
+
+$ package: brew search
+$ casks: brew search --casks
+$ installed: brew list
+$ caskinstalled: brew cask list
+$ brewservice: brew services list | awk '{if (NR>1){printf "%s\n", $1}}'

+ 118 - 0
pkg_mgr/eopkg.cheat

@@ -0,0 +1,118 @@
+% eopkg
+
+# Add a repository for installing packages (<repo>: name of repository to add, <indexuri>: address or repository)
+eopkg ar <repo> <indexuri>
+
+# Remove eopkg packages
+eopkg rmf [<package1> <package2> ... <packagen>]
+
+# Information about the package owner and release
+eopkg bl
+
+# Build an eopkg
+eopkg bi
+
+# Verify all installations
+eopkg check
+
+# Clean stale locks
+eopkg clean
+
+# Configure pending packages
+eopkg cp
+
+# Delete cached packages
+eopkg dc
+
+# Creates a delta package
+eopkg dt
+
+# Disable a repository
+eopkg dr [<repo1 <repo2> ... <repon>]
+
+# Build and install eopkg source packages from repository
+eopkg em <sourcename>
+
+# Enable a repository
+eopkg er [<repo1 <repo2> ... <repon>]
+
+# Fetch a package
+eopkg fc [<package1> <package2> ... <packagen>]
+
+# Display all avalible eopkg commands
+eopkg help
+
+# Display help for a specific command
+eopkg help <command>
+
+# View package transaction history
+eopkg hs
+
+# Index eopkg files in a given directory
+eopkg ix <directory>
+
+# Display package Information
+eopkg info [<package1> <package2> ... <packagen>]
+
+# Install an eopkg
+eopkg it [<package1> <package2> ... <packagen>]
+
+# List all available packages in the repositories
+eopkg la
+
+# List all available packages in a specific repository
+eopkg la [<repo1 <repo2> ... <repon>]
+
+# List available components
+eopkg lc
+
+# Print a list of all installed packages
+eopkg li
+
+# List newest packages in all repositories
+eopkg ln
+
+# List newest packages in specific repository
+eopkg ln [<repo1 <repo2> ... <repon>]
+
+# List pending packages
+eopkg lp
+
+# List repositories
+eopkg lr
+
+# List avalible sources
+eopkg ls
+
+# List packages that can be upgraded
+eopkg lu
+
+# Rebuild eopkg databases
+eopkg rdb
+
+# Remove eopkg packages
+eopkg rm [<package1> <package2> ... <packagen>]
+
+# Remove orphaned packages
+eopkg rmo
+
+# Remove repositories
+eopkg rr [<repo1 <repo2> ... <repon>]
+
+# Search for a package in repositories
+eopkg sr <query>
+
+# Search for the installed package which contains the specified file
+eopkg sf [<path1> <path2> ... <pathn>]
+
+# Update all repository databases
+eopkg ur
+
+# Update specific repository database
+eopkg ur [<repo1 <repo2> ... <repon>]
+
+# Update all installed eopkg packages
+eopkg up
+
+# Update a specific eopkg package
+eopkg up [<package1> <package2> ... <packagen>]

+ 41 - 0
pkg_mgr/flatpak.cheat

@@ -0,0 +1,41 @@
+% flatpak
+
+# Run an installed application
+flatpak run <installed_app_name>
+
+# Search for an application
+flatpak search <app_name>
+
+# Install an application from a remote source
+flatpak install <remote_name> <app_name>
+
+# Uninstall an application
+flatpak uninstall <installed_app_name>
+
+# List all installed applications and runtimes
+flatpak list
+
+# List all installed applications
+flatpak list --app
+
+# Add a remote source
+flatpak remote-add --if-not-exists <remote_name> <remote_url>
+
+# List all applications available in a remote source
+flatpak remote-ls <installed_remotes>
+
+# Show the commit log for a specific application
+flatpak remote-info --log <installed_remotes> <installed_app_name>
+
+# Update installed applications
+flatpak update
+
+# Show running applications
+flatpak ps
+
+# Kill a running application
+flatpak kill <running_app>
+
+$ installed_app_name: flatpak list --app | awk -F"\t" '{ print $2 }'
+$ installed_remotes: flatpak remote-list | awk '{ print $1 }'
+$ running_app: flatpak ps | awk '{ print $3 }'

+ 85 - 0
pkg_mgr/javascript.cheat

@@ -0,0 +1,85 @@
+% npm, node, js
+
+# initial new package
+npm init
+
+# initial immediately a new package
+npm init -y
+
+# install all dependencies packages
+npm install
+
+# install all dependencies packages for specific folder
+npm install --prefix <folder>
+
+# install all dev dependencies packages
+npm install --save-dev
+
+# install all dev dependencies for a specific folder
+npm install --save-dev --prefix <folder>
+
+# install a specified package
+npm install <package_name>
+
+# install a specified dev package
+npm install <package_name> --save-dev
+
+# install globally a specified package
+npm install <package_name> -g
+
+# install for a specific folder
+npm install <package_name> --prefix <folder>
+
+# install a specified dev package for a specific folder
+npm install <package_name> --save-dev --prefix <folder>
+
+# run a script
+npm run <script>
+
+# run a script for a specific folder
+npm run <script> --prefix <folder>
+
+$ script: node -p "Object.keys(require('./package.json').scripts).join('\n')"
+
+
+
+% yarn, node, js
+
+# initial new package
+yarn init
+
+# install all dependencies packages
+yarn install
+
+# install all dev dependencies packages
+yarn install --save-dev
+
+# install a specified package
+yarn add <package_name>
+
+# install a specified dev package
+yarn add <package_name> --dev
+
+# install globally a specified package
+yarn global add <package_name>
+
+# run a script
+yarn run <script>
+
+$ script: node -p "Object.keys(require('./package.json').scripts).join('\n')"
+
+
+
+% nvm, node, js
+
+# install a specified version of node
+nvm install <version>
+
+# list available versions
+nvm ls-remote
+
+# use installed node's version
+nvm use <version>
+
+# set a node's version as default
+nvm alias default <version>

+ 189 - 0
pkg_mgr/pacman.cheat

@@ -0,0 +1,189 @@
+% pacman compares with apt, ArchLinux
+
+# Install a package(s) by name, equal to `apt install <pkg_name>`
+sudo pacman -S <pkg_name>
+
+# Remove a package(s) by name, equal to `apt remove <pkg_name>`
+sudo pacman -Rs <pkg_name_installed>
+
+# Search for package(s), equal to `apt search <keyword>`
+sudo pacman -Ss <keyword>
+
+# Upgrade Packages, equal to `apt update` and then `apt upgrade <pkg_name>`
+sudo pacman -Syu <pkg_name>
+
+# Clean up all local caches, equal to `apt autoclean` or `apt clean`
+sudo pacman -Sc
+
+# Clean up all local caches, equal to `apt autoclean` or `apt clean`
+sudo pacman -Scc
+
+# Remove dependencies that are no longer needed, equal to `apt autoremove`
+sudo pacman -Qdtq | pacman -Rs -
+
+# Remove packages no longer included in any repositories, equal to `aptitude purge ~o`
+sudo pacman -Qmq | pacman -Rs -
+
+# Mark a package previously installed as a dependency as explicitly required, equal to `apt-mark manual <pkg_name>`
+sudo pacman -D --asexplicit <pkg_name>
+
+# Install package(s) as dependency / without marking as explicitly required, equal to `apt-mark auto <pkg_name>`
+sudo pacman -S --asdeps <pkg_name>
+
+# Only downloads the given package(s) without unpacking or installing them, equal to `apt install --download-only <pkg_name>` or `apt download <pkg_name>`
+sudo pacman -Sw <pkg_name>
+
+# Show a log of actions taken by the software management, equal to `less /var/log/dpkg.log`
+sudo less /var/log/pacman.log
+
+# Get a dump of the whole system information, equal to `apt-cache stats`
+sudo less /var/lib/pacman/local
+
+# Show all or most information about a package, equal to `apt show <pkg_name>` or `apt-cache policy <pkg_name>`
+sudo pacman -Si <pkg_name>
+
+# Show all or most information about a package, equal to `apt show <pkg_name>` or `apt-cache policy <pkg_name>`
+sudo pacman -Qi <pkg_name>
+
+# Display local package information, equal to `dpkg -s <pkg_name>` or `aptitude show <pkg_name>`
+sudo pacman -Qi <pkg_name>
+
+# Display remote package information, equal to `apt-cache show <pkg_name>` or `aptitude show <pkg_name>`
+sudo pacman -Si <pkg_name>
+
+# Display files provided by local package, equal to `dpkg -L <pkg_name>`
+sudo pacman -Ql <pkg_name>
+
+# Display files provided by a remote package, equal to `apt-file list <pkg_name>`
+sudo pacman -Fl <pkg_name>
+
+# Query the package which provides file, equal to `dpkg -S <file_name>` or `dlocate <file_name>`
+sudo pacman -Qo <file_name>
+
+# List the files that the package holds, equal to `dpkg-query -L <pkg_name>`
+sudo pacman -Ql <pkg_name>
+
+# List the files that the package holds, equal to `dpkg-query -L <pkg_name>`
+sudo pacman -Fl <pkg_name>
+
+# Displays packages which provide the given exp. aka reverse provides, equal to `apt-file search <pkg_name>`
+sudo pacman -F <pkg_name>
+
+# Search all packages to find the one which holds the specified file, equal to `apt-file search <file_name>`
+sudo pacman -F <file_name>
+
+# Show the changelog of a package, equal to `apt-get changelog <pkg_name>`
+sudo pacman -Qc <pkg_name>
+
+# Lists packages which have an update available, equal to `apt-get upgrade <- N`
+sudo pacman -Qu
+
+# Display a list of all packages in all installation sources that are handled by the packages management, equal to `apt-cache dumpavail` or `apt-cache dump`(Cache only) or `apt-cache pkgnames`
+sudo pacman -Sl
+
+# Generates a list of installed packages, equal to `dpkg --list | grep ^i`
+sudo pacman -Q
+
+# List packages that are installed but are not available in any installation source (anymore), equal to `deborphan`
+sudo pacman -Qm
+
+# List installed local packages along with version, equal to `dpkg -l`
+sudo pacman -Q
+
+# Search locally installed package for names or descriptions, equal to `aptitude search ~i(~n $name|~d $description)`
+sudo pacman -Qs <keyword>
+
+# List packages not required by any other package, equal to `deborphan -anp1`
+sudo pacman -Qt
+
+# List packages installed explicitly (not as dependencies), equal to `apt-mark showmanual`
+sudo pacman -Qe
+
+# List packages installed automatically (as dependencies), equal to `apt-mark showauto`
+sudo pacman -Qd
+
+# Display packages which require X to be installed, equal to `apt-cache rdepends <pkg_name>` or `aptitude search ~D$pattern`
+sudo pacman -Sii <pkg_name>
+
+# List all packages which are required for the given package, equal to `apt-cache depends <pkg_name>` or `apt-cache show <pkg_name>`
+sudo pacman -Qi <pkg_name>
+
+# List all packages which are required for the given package, equal to `apt-cache depends <pkg_name>` or `apt-cache show <pkg_name>`
+sudo pacman -Si <pkg_name>
+
+# Installation sources management, equal to `$EDITOR /etc/apt/sources.list`
+sudo $EDITOR /etc/pacman.conf
+
+# Add an installation source to the system, equal to `apt-cdrom add`
+sudo $EDITOR /etc/pacman.conf
+
+# Refresh the information about installation sources, equal to `apt-get update`
+sudo pacman -Sy
+
+# Prints a list of all installation sources, equal to `apt-cache policy`
+less /etc/pacman.d/mirrorlist
+
+# List all packages from a certain repo
+paclist <repo>
+
+# Add a package lock rule to keep its current state from being changed, modifying IgnorePkg array in the file, equal to `apt-mark hold <pkg_name>`
+sudo $EDITOR /etc/pacman.conf
+
+# Delete a package lock rule, modifying IgnorePkg array in the file, equal to `apt-mark unhold <pkg_name>`
+sudo $EDITOR /etc/pacman.conf
+
+# Show a listing of all lock rules, equal to `less /etc/apt/preferences`
+less /etc/pacman.conf
+
+# Set the priority of the given package to avoid upgrade, force downgrade or to overwrite any default behavior, modifying HoldPkg and/or IgnorePkg arrays, equal to `$EDITOR /etc/apt/preferences` or `apt-cache policy`
+sudo $EDITOR /etc/pacman.conf
+
+# Verify package(s), equal to `debsums`
+sudo pacman -Qk
+
+# Reinstall given package, equal to `apt install --reinstall <pkg_name_installed>`
+sudo pacman -S <pkg_name_installed>
+
+# Verify dependencies of the complete system, equal to `apt-get check`
+sudo pacman -Dk
+
+# Use some magic to fix broken dependencies in a system for pacman dependency level, equal to `apt-get --fix-broken && aptitude install`
+sudo pacman -Dk
+
+# Use some magic to fix broken dependencies in a system for shared library level, equal to `apt-get --fix-broken && aptitude install`
+findbrokenpkgs # from AUR
+
+# Use some magic to fix broken dependencies in a system for shared library level, equal to `apt-get --fix-broken && aptitude install`
+lddd # from devtools
+
+# Query a package supplied on the command line rather than an entry in the package management database, equal to `dpkg -I <pkg_name>`
+sudo pacman -Qp <pkg_name>
+
+# List the contents of a package file, equal to `dpkg -c <pkg_name>`
+sudo pacman -Qpl <pkg_name>
+
+# Install local package file, equal to `apt install <pkg_file>`
+sudo pacman -U <pkg_file>
+
+# Updates package(s) with local packages and uses the installation sources to resolve dependencies, equal to `debi <pkg_file>`
+sudo pacman -U <pkg_file>
+
+# Add a local package to the local package cache mostly for debugging purposes, equal to `apt-cache add <pkg_file>`
+sudo cp <pkg_file> /var/cache/pacman/pkg/
+
+# Extract a package, equal to `dpkg-deb -x <pkg_file>`
+tar -xf <pkg_file>
+
+# Install/Remove packages to satisfy build-dependencies. Uses information in the source package, equal to `apt-get build-dep`
+makepkg -seoc # Please use this with [ABS](https://wiki.archlinux.org/index.php/Arch_Build_System)
+
+# Download the corresponding source package(s) to the given package name(s), equal to `apt-get source` or `debcheckout`
+makepkg -o # Please use this with [ABS](https://wiki.archlinux.org/index.php/Arch_Build_System)
+
+# Build a package, equal to `debuild`
+makepkg -s
+
+# Check for possible packaging issues, equal to `lintian`
+namcap
+
+$ pkg_name_installed: sudo pacman -Qe

+ 52 - 0
pkg_mgr/yum.cheat

@@ -0,0 +1,52 @@
+% yum
+
+# List all available packages
+yum list available
+
+# List all installed packages
+yum list installed
+
+# Info about package
+yum info <package-name>
+
+# Search in repository (packages and descriptions)
+yum search <query>
+
+# List all history actions (install, update and erase)
+yum history list
+
+# Check updates for installed packages
+yum check-update
+
+# Update all packages
+yum update
+
+# Update spesific/individual package
+yum update <package-name>
+
+# Downgrade package
+yum downgrade <package-name>
+
+# Install a package from repository
+yum install <package-name>
+
+# Remove/delete package
+yum remove <package-name>
+
+# Install local rpm package
+yum localinstall <filepath-rpm>
+
+# Install security updates
+yum update --security
+
+# List dependencies of package
+yum deplist <package-name>
+
+# Remove un-needed packages and dependencies
+yum autoremove
+
+# Whatprovides package/file/binary
+yum whatprovides <query>
+
+# List currently enabled repositories
+yum repolist

+ 81 - 0
pkg_mgr/zypper.cheat

@@ -0,0 +1,81 @@
+% zypper
+
+# Install packages
+zypper install <package-name>
+
+# Install local rpm package
+zypper install <filepath-rpm>
+
+# Download package without installing
+zypper install --download-only <package-name>
+
+# Downgrade or install a package with a specific version
+zypper install --force <package-name>-<package-version>
+
+# Install a package and remove a package in one go
+zypper install <package-name-1> -<package-name-2>
+
+# Remove package
+zypper remove <package-name>
+
+# Automatically remove unneeded dependencies
+zypper remove --clean-deps <package-name>
+
+# Update packages
+zypper update
+
+# Only download the packages, do not install
+zypper update --download-only 
+
+# List available updates
+zypper list-updates
+
+# Update specific package
+zypper update <package-name>
+
+# Perform a distribution upgrade
+zypper dist-upgrade
+
+# Search packages
+zypper search <query>
+
+# Search in the file list of packages 
+zypper search --file-list <query>
+
+# list all packages depended on the package
+zypper search --requires <package-name>
+
+# List all packages providing the specified capability
+zypper what-provides <query>
+
+# Show full information for specified packages
+zypper info <package-name>
+
+# List dependencies of package
+zypper info --requires <package-name>
+
+# List what the current package provides
+zypper info --provides <package-name>
+
+# List all available packages
+zypper packages
+
+# List all installed packages
+zypper packages --installed-only
+
+# Clean up all local caches
+zypper clean
+
+# Clean both metadata and package caches
+zypper clean --all
+
+# Start a shell to enter multiple commands in one session
+zypper shell
+
+
+
+
+
+
+
+

+ 79 - 0
rice/rsfetch.cheat

@@ -0,0 +1,79 @@
+% rsfetch, information, unixporn
+
+# Disable text bolding
+rsfetch -b
+
+# Disable borders
+rsfetch -B
+
+# Disable caps (TEXT -> text)
+rsfetch -c
+
+# Specify the character for the corners of the borders
+rsfetch -C <CHARACTER>
+
+# Display name of distro
+rsfetch -d
+
+# Display your $EDITOR
+rsfetch -e
+
+# Display help message
+rsfetch --help
+
+# Display name of host (the actual device's name, not to be confused with hostname)
+rsfetch -h
+
+# Display hostname
+rsfetch -H
+
+# Display IP Address
+rsfetch -i
+
+# Display kernel version
+rsfetch -k
+
+# Enable ascii art (defaults to rsfetch logo, or a penguin with neofetch-style output)
+rsfetch -l
+
+# Specify the ascii art to use
+rsfetch -L <FILE>
+
+# Display memory info
+rsfetch -r
+
+# Display music info (currently only support mpd)
+rsfetch -m mpd
+
+# Enable minimal-style output (no borders, no logo, no text effects, no category names)
+rsfetch -M
+
+# Enable neofetch-style output
+rsfetch -N
+
+# Display package count
+rsfetch -p <PKG MNGR>
+
+# Display CPU info
+rsfetch -P
+
+# Display the current shell
+rsfetch -s
+
+# Display the current terminal
+rsfetch -t
+
+# Display the current uptime
+rsfetch -u
+
+# Display the username for the current account
+rsfetch -U
+
+# Display rsfetch version
+rsfetch -V
+
+# Display current WM or DE
+rsfetch -w
+
+# Enable user@host output-style (requires -H and -U to be enabled)
+rsfetch -@

+ 37 - 0
security/gpg.cheat

@@ -0,0 +1,37 @@
+% gpg
+
+# gpg version
+gpg --version
+
+# gpg generate key
+gpg --gen-key
+
+# list keys
+gpg --list-keys
+
+# distribute public key to key server
+gpg --keyserver <key_server> --send-keys <public_key>
+
+# export public key
+gpg --output <filename_gpg> --export <key_name>
+
+# import public key
+gpg --import <filename_gpg>
+
+# encrypt document
+gpg --output <output_filename_gpg> --encrypt --recipient <public_key> <input_filename>
+
+# decrypt document
+gpg --output <filename> --decrypt <filename_gpg>
+
+# make a signature
+gpg --output <filename_sig> --sign <filename>
+
+# verify signature
+gpg --output <filename> <filename> --decrypt <filename_sig>
+
+# clearsign documents
+gpg --clearsign <filename>
+
+# detach signature
+gpg --output <filename_sig> --detach-sig <filename>

+ 58 - 0
security/keytool.cheat

@@ -0,0 +1,58 @@
+% java keytool, certificate, encryption
+
+## Creating
+# Generate a Java keystore and key pair
+keytool -genkey -alias <ALIAS> -keyalg RSA -keystore <OUTPUT_JKS> -keysize <RSA_LENGTH>
+
+# Generate a certificate signing request (CSR) for an existing Java keystore
+keytool -certreq -alias <ALIAS> -keystore <INPUT_JKS> -file <OUTPUT_CSR>
+
+# Import a root or intermediate CA certificate to an existing Java keystore
+keytool -import -trustcacerts -alias root -file <INPUT_CRT> -keystore <INPUT_JKS>
+
+# Import a signed primary certificate to an existing Java keystore
+keytool -import -trustcacerts -alias <ALIAS> -file <INPUT_CRT> -keystore <INPUT_JKS>
+
+# Generate a keystore and self-signed certificate
+keytool -genkey -keyalg RSA -alias <ALIAS> -keystore <OUTPUT_JKS> -storepass <PASSWORD> -validity <VALIDITY> -keysize <RSA_LENGTH>
+
+
+
+## Verifying
+# Check a stand-alone certificate
+keytool -printcert -v -file <INPUT_CRT>
+
+# Check which certificates are in a Java keystore
+keytool -list -v -keystore <INPUT_JKS>
+
+# Check a particular keystore entry using an alias
+keytool -list -v -keystore <INPUT_JKS> -alias <ALIAS>
+
+
+
+## Other
+# Remove a certificate from a keystore
+keytool -delete -alias <ALIAS> -keystore <INPUT_JKS>
+
+# Change the password of a keystore
+keytool -storepasswd -keystore <INPUT_JKS> -new <NEW_PASSWORD>
+
+# Export a certificate from a keystore
+keytool -export -alias <ALIAS> -file <OUTPUT_CRT> -keystore <INPUT_JKS>
+
+# List the trusted CA Certs from the default Java Trusted Certs Keystore
+keytool -list -v -keystore $JAVA_HOME/jre/lib/security/cacerts
+
+# Import New Certificate Authority into the default Java Trusted Certs Keystore
+keytool -import -trustcacerts -file <INPUT_PEM> -alias <ALIAS> -keystore $JAVA_HOME/jre/lib/security/cacerts
+
+
+
+# Sensible/common default alternatives
+$ VALIDITY: printf "DAYS\tCOMMENT\n1\ta day\n30\ta month\n365\ta year\n730\ttwo years" --- --column 1 --headers 1
+$ RSA_LENGTH: printf "KEY LENGTH\tCOMMENT\n2048\t\tDefault\n4096\t\tBetter\n8192\t\tSlow?" --- --column 1 --headers 1
+
+# Attempt to find files with the appropriate endings, default to everything.
+$ INPUT_CRT:    ls -a | grep -e "\(.crt\|.cer\|.der\)" || ls -a
+$ INPUT_PEM:    ls -a | grep -e "\(.pem\)"             || ls -a
+$ INPUT_JKS:    ls -a | grep -e "\(.jks\)"             || ls -a

+ 81 - 0
security/openssl.cheat

@@ -0,0 +1,81 @@
+% openssl, certificate, encryption
+
+## General OpenSSL Commands
+# Create a new signing request and key
+openssl req -new -newkey rsa:<RSA_LENGTH> -nodes -out <OUTPUT_CSR> -keyout <OUTPUT_KEY>
+
+# Create a new self-signed certificate
+openssl req -x509 -sha256 -nodes -days <VALIDITY> -newkey rsa:<RSA_LENGTH> -out <OUTPUT_CRT> -keyout <OUTPUT_KEY>
+
+# Create a signing request from existing key
+openssl req -out <OUTPUT_CSR> -key <INPUT_KEY> -new
+
+# Create a signing request from existing certificate and key
+openssl x509 -x509toreq -out <OUTPUT_CSR> -in <INPUT_CRT> -signkey <INPUT_KEY>
+
+# Remove a passphrase from a private key
+openssl rsa -in <INPUT_KEY> -out <OUTPUT_PLAINTEXT_KEY>
+
+
+
+## Converting between the different encoding
+# Convert a DER encoded file to a PEM encoded file
+openssl x509 -inform der -in <INPUT_CRT> -out <OUTPUT_PEM>
+
+# Convert a PEM encoded file to a DER encoded file
+openssl x509 -outform der -in <INPUT_PEM> -out <OUTPUT_CRT>
+
+# Convert a PKCS12 encoded file containing a private key and certificates to PEM
+openssl pkcs12 -in <INPUT_PKCS12> -out <OUTPUT_PEM> -nodes
+
+# Extract the private key from a PKCS12 encoded file
+openssl pkcs12 -in <INPUT_PKCS12> -out <OUTPUT_PEM> -nodes -nocerts
+
+# Extract the certificate from a PKCS12 encoded file
+openssl pkcs12 -in <INPUT_PKCS12> -out <OUTPUT_PEM> -nodes -nokeys
+
+# Convert a PEM certificate file and a private key to PKCS12 encoded file
+openssl pkcs12 -export -out <OUTPUT_PKCS12> -inkey <INPUT_KEY> -in <INPUT_CRT> -certfile <INPUT_CRT>
+
+
+
+## Validating certificates and keys using OpenSSL
+# Validate a certificate signing request
+openssl req -text -noout -verify -in <OUTPUT_CSR>
+
+# Validate a private key
+openssl rsa -in <INPUT_KEY> -check
+
+# Validate a certificate
+openssl x509 -in <INPUT_CRT> -text -noout
+
+# Validate a PKCS12 file (.pfx or .p12)
+openssl pkcs12 -info -in <INPUT_PKCS12>
+
+
+
+## Debugging using OpenSSL
+# Compare the MD5 hash of a certificate
+openssl x509 -noout -modulus -in <INPUT_CRT> | openssl md5
+
+# Compare the MD5 hash of a private key
+openssl rsa -noout -modulus -in <INPUT_KEY> | openssl md5
+
+# Compare the MD5 hash of a certificate signing request
+openssl req -noout -modulus -in <INPUT_CSR> | openssl md5
+
+# Display the server certificate chain
+openssl s_client -connect <URL>:<PORT>
+
+
+
+# Sensible/common default alternatives
+$ VALIDITY: printf "DAYS\tCOMMENT\n1\ta day\n30\ta month\n365\ta year\n730\ttwo years" --- --column 1 --headers 1
+$ RSA_LENGTH: printf "KEY LENGTH\tCOMMENT\n2048\t\tDefault\n4096\t\tBetter\n8192\t\tSlow?" --- --column 1 --headers 1
+
+# Attempt to find files with the appropriate endings, default to everything.
+$ INPUT_PKCS12: ls -a | grep -e "\(.pfx\|.p12\)"       || ls -a
+$ INPUT_CSR:    ls -a | grep -e "\(.csr\)"             || ls -a
+$ INPUT_KEY:    ls -a | grep -e "\(.key\|.pem\)"       || ls -a
+$ INPUT_CRT:    ls -a | grep -e "\(.crt\|.cer\|.der\)" || ls -a
+$ INPUT_PEM:    ls -a | grep -e "\(.pem\)"             || ls -a

+ 4 - 0
security/ssh.cheat

@@ -0,0 +1,4 @@
+% ssh
+
+# Start ssh agent
+eval "$(ssh-agent -s)"; ssh-add