https://github.com/flameshine/cheatsheet
A kit of useful commands/scripts for UNIX-like systems and various concomitant tools.
https://github.com/flameshine/cheatsheet
Last synced: 29 days ago
JSON representation
A kit of useful commands/scripts for UNIX-like systems and various concomitant tools.
- Host: GitHub
- URL: https://github.com/flameshine/cheatsheet
- Owner: flameshine
- Created: 2022-08-10T16:31:18.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-04T15:50:53.000Z (11 months ago)
- Last Synced: 2025-03-04T16:41:15.676Z (11 months ago)
- Homepage:
- Size: 153 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cheatsheet
Table of contents
* [Utilities](#Utilities)
* [Unix](#Unix)
* [Helm](#Helm)
* [Kubernetes](#Kubernetes)
* [Docker](#Docker)
* [AWS](#AWS)
* [ECR](#ECR)
* [EKS](#EKS)
* [S3](#S3)
* [Secrets](#Secrets)
* [Redis](#Redis)
* [argo-workflows](#argo-workflows)
* [Git](#Git)
* [SVN](#SVN)
* [git-crypt](#git-crypt)
* [Gradle](#Gradle)
* [Maven](#Maven)
* [Python](#Python)
Utilities
UML Diagram Builder: https://app.diagrams.net
AWS Policy Generator: https://awspolicygen.s3.amazonaws.com/policygen.html
AWS Pricing Calculator: https://calculator.aws
Unicode Converter: https://www.branah.com/unicode-converter
JSON Converter: https://jsontostring.com
Difference Checker: https://www.diffchecker.com
Epoch Time Converter: https://www.epochconverter.com
Random Number Generator: https://www.random.org
TypeScript Playground: https://www.typescriptlang.org/play
RegEx Shaper: https://regexr.com
Character Remover: https://onlinecaseconvert.com/remove-characters-from-text-online.php
Case Converter: https://convertcase.net
Character Counter: https://charactercalculator.com
Unix
Change group permission of a file:
```
sudo chown :contractors
```
Kill a process on particular port:
```
sudo kill -9 $(lsof -t -i:)
```
Check what is running on the port:
```
lsof -i -P | grep "LISTEN" | grep:
```
Get SSL certificate data:
```
openssl crl2pkcs7 -nocrl -certfile | openssl pkcs7 -print_certs -noout
```
Grep all '.gz' files in directory:
```
find . -name \*.gz -print0 | xargs -0 zgrep ""
```
Generate a random string:
```
LC_ALL=C < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32; echo
```
Encode a string with Base64:
```
openssl base64 -e <<< ""
```
Decode a string with Base64:
```
openssl base64 -d <<< ""
```
Get your IP address:
```
ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}'
```
Find file and replace all occurrences of a string inside:
```
find . -name "" -print0 | xargs -0 sed -i "" 's///g'
```
Archive applying a passcode:
```
zip -er
```
Add space to the volume:
```
sudo vgdisplay rootvg
sudo growpart /dev/nvme0n1 3
sudo lvextend -L +2G /dev/mapper/rootvg-usrlv
sudo xfs_growfs /usr
```
Helm
Generate template:
```
helm template -f > ~/template.yaml
```
Kubernetes
List namespace events:
```
kc -n get events
```
Enter a specific pod:
```
kc exec --stdin --tty -- /bin/bash
```
Execute a command inside a pod:
```
kc -n exec
```
Create an ordinary job from a cronjob:
```
kc create job --from=cronjob/
```
Get resource YAML definition:
```
kc get -o yaml
```
Forward pod's requests to a local port:
```
kc -n port-forward 8080:80
```
View the exact yaml of some Kubernetes component:
```
kc get -o yaml | less
```
Apply the corresponding action to each listed pod:
```
kc -n get pods | awk '{print $1}' | grep "" | xargs kubectl -n pod
```
Scale the deployment:
```
kc -n scale deployment/ --replicas=
```
Docker
Remove all stopped containers, networks not used by at least one container, all images without at least one container and all build cache:
```
docker system prune -a
```
Build an image with tag:
```
docker build -t
```
Remove the last container:
```
docker ps -a | awk '{print $1}' | sed -n 2p | xargs docker rm
```
AWS
ECR
Login into ECR:
```
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin
```
EKS
Update EKS cluster config:
```
aws eks update-kubeconfig --profile --region --name
```
S3
Get the total number of objects in a bucket:
```
aws s3 ls s3:// --recursive --summarize | grep "Total Objects:"
```
Secrets Manager
Delete a secret immediately:
```
aws secretsmanager delete-secret --secret-id --force-delete-without-recovery
```
Redis
Connect to the cluster:
```
redis6-cli -c -h -p
```
Get N items matching a pattern:
```
scan 0 match count
```
argo-workflows
Submit a template:
```
argo -n template create
```
Submit a workflow:
```
argo -n submit
```
Delete a template:
```
argo -n template delete template
```
Delete a workflow:
```
argo -n delete workflow
```
Git
Reset the branch:
```
git reset --hard origin
```
Squash all commits on a branch:
```
git checkout
git reset $(git merge-base master $(git branch --show-current))
git add -A
git commit -m
git push --force
```
Move unpushed commit from one branch to another:
```
git reset HEAD~1
git stash
git checkout
git stash pop
```
Revert particular file:
```
git checkout HEAD^
```
Cherry-pick commit from another repository:
```
git remote add other
git fetch other
git cherry-pick
git remote remove other
```
Squash certain commit:
```
git rebase -i master
pick -> squash (for the commits you're interested in)
```
Split a certain commit:
```
git rebase -i
pick -> edit (for the commits you're interested in)
git reset HEAD~
git rebase --continue
```
Save changes from a range of commits for a single file into a patch:
```
git diff HEAD~3 HEAD~1 -- path/to/file.ext > changes.patch
```
SVN
Get the latest revision before the new branch was created:
```
svn log --stop-on-copy --verbose --limit 1 -r0:HEAD
```
Define a format a file:
```
svn propset svn:mime-type
```
git-crypt
Instructions: https://github.com/AGWA/git-crypt/tree/master
Lock repository:
```
git-crypt lock
```
Unlock repository:
```
git-crypt unlock
```
Gradle
Build refreshing dependencies:
```
./gradlew build --refresh-dependencies
```
Maven
Clean, build and refresh all dependencies:
```
mvn clean install -U
```
Display dependency tree:
```
mvn dependency:tree
```
Python
Start an HTTP server:
```
python3 -m http.server
```