mirror of
https://github.com/LeCoupa/awesome-cheatsheets.git
synced 2025-11-08 22:11:35 +00:00
Merge branch 'master' of github.com:LeCoupa/awesome-cheatsheets
This commit is contained in:
178
tools/gcp.md
Normal file
178
tools/gcp.md
Normal file
@@ -0,0 +1,178 @@
|
||||
# GCLOUD SDK AND TOOLBELT CHEATSHEET
|
||||
|
||||
## GCP BASICS
|
||||
|
||||
- `Check Version and Settings`: gcloud version, gcloud info, gcloud components list
|
||||
|
||||
- `Init Profile`: gcloud init This will ask you to open an OpenID URL
|
||||
|
||||
- `List all zones`: gcloud compute zones list
|
||||
|
||||
- `Upgrade local SDK`: gcloud components update, gcloud components update --version 219.0.1
|
||||
|
||||
|
||||
## BUCKET BASICS
|
||||
|
||||
- `List all buckets and files`: gsutil ls, gsutil ls -lh gs://<bucket-name>
|
||||
|
||||
- `Download file`: gsutil cp gs://<bucket-name>/<dir-path>/package-1.1.tgz .
|
||||
|
||||
- `Upload file`: gsutil cp <filename> gs://<bucket-name>/<directory>/
|
||||
|
||||
- `Cat file`: gsutil cat gs://<bucket-name>/<filepath>/
|
||||
|
||||
- `Delete file`: gsutil rm gs://<bucket-name>/<filepath>
|
||||
|
||||
- `Move file`: gsutil mv <src-filepath> gs://<bucket-name>/<directory>/<dest-filepath>
|
||||
|
||||
- `Copy folder`: gsutil cp -r ./conf gs://<bucket-name>/
|
||||
|
||||
- `Show disk usage`: gsutil du -h gs://<bucket-name>/<directory>/
|
||||
|
||||
- `Create bucket`: gsutil mb gs://<bucket-name>
|
||||
|
||||
- `Caculate file sha1sum`: gsha1sum syslog-migration-10.0.2.tgz, shasum syslog-migration-10.0.2.tgz
|
||||
|
||||
- `Gsutil help`: gsutil help, gsutil help cp, gsutil help options
|
||||
|
||||
|
||||
## GCP PROJECT
|
||||
|
||||
- `List projects `: gcloud config list, gcloud config list project
|
||||
|
||||
- `Show project info `: gcloud compute project-info describe
|
||||
|
||||
- `Switch project `: gcloud config set project <project-id>
|
||||
|
||||
|
||||
## GKE
|
||||
|
||||
- `Display a list of credentialed accounts `: gcloud auth list
|
||||
|
||||
- `Set the active account `: gcloud config set account <ACCOUNT>
|
||||
|
||||
- `Set kubectl context `: gcloud container clusters get-credentials <cluster-name>
|
||||
|
||||
- `Change region `: gcloud config set compute/region us-west
|
||||
|
||||
- `Change zone `: gcloud config set compute/zone us-west1-b
|
||||
|
||||
- `List all container clusters `: gcloud container clusters list
|
||||
|
||||
|
||||
## IAM
|
||||
|
||||
- `Authenticate client `: gcloud auth activate-service-account --key-file <key-file>
|
||||
|
||||
- `Display a list of credentialed accounts `: gcloud auth list
|
||||
|
||||
- `Set the active account `: gcloud config set account <ACCOUNT>
|
||||
|
||||
- `Auth to GCP Container Registry `: gcloud auth configure-docker
|
||||
|
||||
- `Print token for active account `: gcloud auth print-access-token, gcloud auth print-refresh-token
|
||||
|
||||
- `Revoke previous generated credential `: gcloud auth <application-default> revoke
|
||||
|
||||
|
||||
## BUCKET SECURITY
|
||||
|
||||
- `Make all files readable `: gsutil -m acl set -R -a public-read gs://<bucket-name>/
|
||||
|
||||
- `Config auth `: gsutil config -a
|
||||
|
||||
- `Grant bucket access `: gsutil iam ch user:denny@gmail.com:objectCreator,objectViewer gs://<bucket-name>
|
||||
|
||||
- `Remove bucket access `: gsutil iam ch -d user:denny@gmail.com:objectCreator,objectViewer gs://<bucket-name>
|
||||
|
||||
|
||||
## VM
|
||||
|
||||
- `List all instances `: gcloud compute instances list, gcloud compute instance-templates list
|
||||
|
||||
- `Show instance info `: gcloud compute instances describe "<instance-name>" --project "<project-name>" --zone "us-west2-a"
|
||||
|
||||
- `Stop an instance `: gcloud compute instances stop instance-2
|
||||
|
||||
- `Start an instance `: gcloud compute instances start instance-2
|
||||
|
||||
- `Create an instance `: gcloud compute instances create vm1 --image image-1 --tags test --zone "<zone>" --machine-type f1-micro
|
||||
|
||||
- `SSH to instance `: gcloud compute ssh --project "<project-name>" --zone "<zone-name>" "<instance-name>"
|
||||
|
||||
- `Download files `: gcloud compute copy-files example-instance:~/REMOTE-DIR ~/LOCAL-DIR --zone us-central1-a
|
||||
|
||||
- `Upload files `: gcloud compute copy-files ~/LOCAL-FILE-1 example-instance:~/REMOTE-DIR --zone us-central1-a
|
||||
|
||||
|
||||
## DISKS & VOLUMES
|
||||
|
||||
- `List all disks `: gcloud compute disks list
|
||||
|
||||
- `List all disk types `: gcloud compute disk-types list
|
||||
|
||||
- `List all snapshots `: gcloud compute snapshots list
|
||||
|
||||
- `Create snapshot `: gcloud compute disks snapshot <diskname> --snapshotname <name1> --zone $zone
|
||||
|
||||
|
||||
## NETWORK
|
||||
|
||||
- `List all networks `: gcloud compute networks list
|
||||
|
||||
- `Detail of one network `: gcloud compute networks describe <network-name> --format json
|
||||
|
||||
- `Create network `: gcloud compute networks create <network-name>
|
||||
|
||||
- `Create subnet `: gcloud compute networks subnets create subnet1 --network net1 --range 10.5.4.0/24
|
||||
|
||||
- `Get a static ip `: gcloud compute addresses create --region us-west2-a vpn-1-static-ip
|
||||
|
||||
- `List all ip addresses `: gcloud compute addresses list
|
||||
|
||||
- `Describe ip address `: gcloud compute addresses describe <ip-name> --region us-central1
|
||||
|
||||
- `List all routes `: gcloud compute routes list
|
||||
|
||||
|
||||
## DNS
|
||||
|
||||
- `List of all record-sets in my zone `: gcloud dns record-sets list --zone my_zone
|
||||
|
||||
- `List first 10 DNS records `: gcloud dns record-sets list --zone my_zone --limit=10
|
||||
|
||||
|
||||
## FIREWALL
|
||||
|
||||
- `List all firewall rules `: gcloud compute firewall-rules list
|
||||
|
||||
- `List all forwarding rules `: gcloud compute forwarding-rules list
|
||||
|
||||
- `Describe one firewall rule `: gcloud compute firewall-rules describe <rule-name>
|
||||
|
||||
- `Create one firewall rule `: gcloud compute firewall-rules create my-rule --network default --allow tcp:9200 tcp:3306
|
||||
|
||||
- `Update one firewall rule `: gcloud compute firewall-rules update default --network default --allow tcp:9200 tcp:9300
|
||||
|
||||
|
||||
## IMAGES & CONTAINERS
|
||||
|
||||
- `List all images `: gcloud compute images list
|
||||
|
||||
- `List all container clusters `: gcloud container clusters list
|
||||
|
||||
- `Set kubectl context `: gcloud container clusters get-credentials <cluster-name>
|
||||
|
||||
|
||||
## RDS
|
||||
|
||||
- `List all sql instances `: gcloud sql instances list
|
||||
|
||||
|
||||
## SERVICES
|
||||
|
||||
- `List my backend services `: gcloud compute backend-services list
|
||||
|
||||
- `List all my health check endpoints `: gcloud compute http-health-checks list
|
||||
|
||||
- `List all URL maps `: gcloud compute url-maps list
|
||||
114
tools/heroku.sh
Normal file
114
tools/heroku.sh
Normal file
@@ -0,0 +1,114 @@
|
||||
# ##############################################################################
|
||||
##### HEROKU TOOLBELT COMPLETE GUIDE ###########################################
|
||||
################################################################################
|
||||
|
||||
|
||||
|
||||
# Installing Heroku toolbelt using command line
|
||||
|
||||
# For MacOS...
|
||||
brew tap heroku/brew && brew install heroku
|
||||
|
||||
# For Ubuntu...
|
||||
sudo snap install --classic heroku
|
||||
|
||||
# Other installation methods are
|
||||
|
||||
curl https://cli-assets.heroku.com/install.sh | sh # only for unix based systems, windows incompatible as it needs sudo
|
||||
|
||||
curl https://cli-assets.heroku.com/install-ubuntu.sh | sh # Ubuntu/Debian apt-get
|
||||
|
||||
yay -S heroku-cli # Arch linux, Note: This package is community maintained not by heroku
|
||||
|
||||
npm install -g heroku # This installation method is required for users on ARM and BSD...
|
||||
|
||||
|
||||
############
|
||||
|
||||
# Verifying your installation
|
||||
|
||||
heroku --version
|
||||
|
||||
|
||||
# Let's get started with heroku
|
||||
|
||||
heroku login # To login into the heroku toolbelt with your heroku account, this will open browser for you.
|
||||
|
||||
heroku login -i # If you prefer to stay in the command line environment, then you can execute this command
|
||||
|
||||
|
||||
# Now navigate to your desired directory and create a blank heroku application
|
||||
|
||||
cd ~/myapp
|
||||
heorku create
|
||||
|
||||
|
||||
# If you are facing login issues, try to execute the following command
|
||||
|
||||
mv ~/.netrc ~/.netrc.backup
|
||||
heroku login
|
||||
|
||||
|
||||
# Uninstalling the heroku CLI
|
||||
|
||||
# For macOS
|
||||
rm -rf /usr/local/heroku /usr/local/lib/heroku /usr/local/bin/heroku ~/.local/share/heroku ~/Library/Caches/heroku
|
||||
|
||||
# or you can try the below command also on macOS
|
||||
brew uninstall heroku
|
||||
rm -rf ~/.local/share/heroku ~/Library/Caches/heroku
|
||||
|
||||
# For Linux (Standalone installs)
|
||||
rm /usr/local/bin/heroku
|
||||
rm -rf /usr/local/lib/heroku /usr/local/heroku
|
||||
rm -rf ~/.local/share/heroku ~/.cache/heroku
|
||||
|
||||
# For Linux (Debian and Ubuntu installs)
|
||||
sudo apt-get remove heroku heroku-toolbelt
|
||||
sudo rm /etc/apt/sources.list.d/heroku.list
|
||||
|
||||
|
||||
|
||||
|
||||
#####################################################################################################
|
||||
### Managing and deploying applications on Heroku (Using Git) ###################################
|
||||
#####################################################################################################
|
||||
|
||||
|
||||
cd myapp # Changing into the project directory
|
||||
git init # Initializing the project into a git repository
|
||||
git add . # Adding all the contents of the project into the repository excluding .gitignore content
|
||||
git commit -m "My first commit" # Commiting the content to the repository
|
||||
|
||||
heroku create # Creating a new empty application on Heroku
|
||||
git remote -v # verifying that the remote is set to the heroku
|
||||
|
||||
heroku git:remote -a thawing-inlet-61413 # For an existing heroku app, you can add remote to the application
|
||||
git remote rename heroku heroku-staging # renaming remotes
|
||||
|
||||
git push heroku master # Deploying code to the heroku application
|
||||
git push heroku testbranch:master # Deploying code from a non-master branch to the heroku application
|
||||
|
||||
heroku create --ssh-git # ssh git transport for the application instead of https
|
||||
git config --global url.ssh://git@heroku.com/.insteadOf https://git.heroku.com/ # For using ssh always
|
||||
git config --global --remove-section url.ssh://git@heroku.com/ # To remove this rewrite setting run the command
|
||||
|
||||
|
||||
|
||||
|
||||
#####################################################################################################
|
||||
### Managing and deploying applications on Heroku (Using Docker) ###################################
|
||||
#####################################################################################################
|
||||
|
||||
|
||||
heroku container:login # Login to the container resistry
|
||||
git clone https://github.com/heroku/alpinehelloworld.git # Get sample code by cloning into the following repository
|
||||
heroku create # Creating a blank heroku application
|
||||
|
||||
heroku container:push web # Build the image and push to Container Registry
|
||||
heroku container:push --recursive # Pushing from the root directory of the project in recursive manner
|
||||
heroku container:push web worker --recursive # Building the image and pushing to container resistry in recursive manner
|
||||
heroku container:release web # Releasing the image to your application
|
||||
|
||||
heroku open # Open the application in the browser
|
||||
|
||||
141
tools/sublime_text.md
Normal file
141
tools/sublime_text.md
Normal file
@@ -0,0 +1,141 @@
|
||||
# SUBLIME TEXT 3 CHEATSHEET
|
||||
|
||||
## Access every command with the command palette
|
||||
|
||||
- `shift + cmd + P `: Command palette
|
||||
|
||||
|
||||
## Goto anything
|
||||
|
||||
- `cmd + P `: Goto file
|
||||
|
||||
- `ctrl + G `: Goto line
|
||||
|
||||
- `cmd + P and # `: Fuzzy search
|
||||
|
||||
- `cmd + R `: Goto symbol
|
||||
|
||||
|
||||
## Quick selections
|
||||
|
||||
- `cmd + D `: Select word
|
||||
|
||||
- `cmd + K D `: Skip and add next
|
||||
|
||||
- `cmd + U `: Undo quick select
|
||||
|
||||
- `cmd + L `: Select line
|
||||
|
||||
- `ctrl + cmd + G `: Select all in file
|
||||
|
||||
- `shift + cmd + space `: Expand selection to scope
|
||||
|
||||
- `shift + cmd + L `: Split into lines
|
||||
|
||||
|
||||
## Edit code
|
||||
|
||||
- `cmd + J `: Join 2 lines
|
||||
|
||||
- `cmd + shift + D `: Duplicate line
|
||||
|
||||
- `cmd + shift + R `: Reindent
|
||||
|
||||
- `cmd + shift + K `: Delete line
|
||||
|
||||
- `ctrl + cmd + up/down `: Move line/selection up/down
|
||||
|
||||
- `alt + cmd + V `: Paste from history
|
||||
|
||||
- `shift + cmd + / `: Comment/uncomment line
|
||||
|
||||
- `alt + backspace `: Delete word by word
|
||||
|
||||
- `alt + fn + backspace `: Forward delete word by word
|
||||
|
||||
- `cmd + shift + enter `: Insert line before
|
||||
|
||||
- `cmd + enter `: Insert line after
|
||||
|
||||
|
||||
## Searching
|
||||
|
||||
- `cmd + F `: Search in file
|
||||
|
||||
- `shift + cmd + F `: Search in all files
|
||||
|
||||
- `<open files> `: where filter
|
||||
|
||||
|
||||
## Miscelaneous
|
||||
|
||||
- `alt + cmd + right/left `: Switch open tab
|
||||
|
||||
- `Indent selection `: Indent selection
|
||||
|
||||
- `Unindent selection `: Unindent selection
|
||||
|
||||
- `Go to previous cursor position `: Go to previous cursor position
|
||||
|
||||
- `Go to next previous cursor position `: Go to next previous cursor position
|
||||
|
||||
- `Build and execute file `: Build and execute file
|
||||
|
||||
|
||||
## Must have packages
|
||||
|
||||
`A file icon, BracketHighlighter, Color Highlighter, Comment-Snippets, DevDocs, EditorConfig, Emmet, File Rename, Git, Git blame, GitGutter, HTML-CSS-JS Prettify, JavaScript Completions, JavaScript Patterns, JavaScript Snippets, LESS, Nodejs, Package Control, Pretty JSON, SideBarEnhancements, SublimeLinter, SublimeLinter-contrib-eslint, Terminal`
|
||||
|
||||
|
||||
## Preferences
|
||||
|
||||
```javascript
|
||||
{
|
||||
"color_scheme": "Packages/User/Color Highlighter/themes/Boxy Ocean.tmTheme",
|
||||
"detect_indentation": false,
|
||||
"folder_exclude_patterns":
|
||||
[
|
||||
"node_modules",
|
||||
".svn",
|
||||
".git",
|
||||
".meteor/local"
|
||||
],
|
||||
"ignored_packages":
|
||||
[
|
||||
"Vintage"
|
||||
],
|
||||
"show_definitions": true,
|
||||
"theme": "Adaptive.sublime-theme"
|
||||
}
|
||||
```
|
||||
|
||||
## Keymap
|
||||
|
||||
```javascript
|
||||
[
|
||||
{ "keys": ["super+v"], "command": "paste_and_indent" },
|
||||
{ "keys": ["super+shift+v"], "command": "paste" },
|
||||
{ "keys": ["super+shift+r"], "command": "reindent" },
|
||||
{ "keys": ["super+h"], "command": "dev_docs_search_selection" }
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
## Syncing settings with iCloud
|
||||
|
||||
- `cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages`
|
||||
|
||||
- `mkdir -p ~/Library/Mobile\ Documents/com\~apple\~CloudDocs/WebDev/ST3/Plugins`
|
||||
|
||||
- `mv User ~/Library/Mobile\ Documents/com\~apple\~CloudDocs/WebDev/ST3/Plugins`
|
||||
|
||||
- `ln -s ~/Library/Mobile\ Documents/com\~apple\~CloudDocs/WebDev/ST3/Plugins/User`
|
||||
|
||||
|
||||
## Restore settings from iCloud
|
||||
|
||||
- `cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages`
|
||||
|
||||
- `rm -rf User`
|
||||
|
||||
- `ln -s ~/Library/Mobile\ Documents/com\~apple\~CloudDocs/WebDev/ST3/Plugins/User`
|
||||
Reference in New Issue
Block a user