mirror of
https://github.com/agresdominik/cheat_sheet.git
synced 2026-04-21 18:05:51 +00:00
87 lines
2.5 KiB
JSON
87 lines
2.5 KiB
JSON
{
|
|
"linux": [
|
|
{
|
|
"command": "du -sh --block-size=1M /path/to/directory",
|
|
"desc": "Show size of directory in MB (Change M to G for GB)"
|
|
},
|
|
{
|
|
"command": "df -h /path/to/mount",
|
|
"desc": "Show statistics about a drive (remove path for all)"
|
|
},
|
|
{
|
|
"command": "find /path/to/directory -type f | wc -l",
|
|
"desc": "Show amount of files in directory and its sub-directories"
|
|
},
|
|
{
|
|
"command": "find /path/to/directory -type f -exec grep -n 'search' {} +",
|
|
"desc": "Print all rows together with the filenames and rows a string is found in"
|
|
},
|
|
{
|
|
"command": "ss -tuln",
|
|
"desc": "Show open ports on current host (linux)"
|
|
},
|
|
{
|
|
"command": "echo Hostname: $(hostname); echo Local_IP: $(hostname -I | awk '{print $1}'); echo Default_Gateway: $(ip route | awk '/default/ {print $3}')",
|
|
"desc": "Print IP Address, Hostname, Default Route"
|
|
}
|
|
],
|
|
"python": [
|
|
{
|
|
"command": "python3 -m venv .venv && source .venv/bin/activate",
|
|
"desc": "Initialise a (simple) .venv and activate it"
|
|
}
|
|
],
|
|
"go": [
|
|
{
|
|
"command": "go mod init github.com/username/projectname",
|
|
"desc": "Initialise a go project and create a mod file"
|
|
},
|
|
{
|
|
"command": "go get github.com/some/package@latest",
|
|
"desc": "Add dependencies"
|
|
},
|
|
{
|
|
"command": "go mod tidy",
|
|
"desc": "Tidy up unused dependencies"
|
|
},
|
|
{
|
|
"command": "go mod verify",
|
|
"desc": "Verify Integrity"
|
|
},
|
|
{
|
|
"command": "go run <target_file_or_folder>",
|
|
"desc": "Run a main.go file"
|
|
},
|
|
{
|
|
"command": "go build -o bin/<bin_name> <target_file_or_folder>",
|
|
"desc": "Build an executable"
|
|
},
|
|
{
|
|
"command": "GOOS=linux GOARCH=amd64 go build -o bin/myprogram.exe main.go",
|
|
"desc": "Cross-compile for Linux (alt. windows, darwin (arm64 / amd64))"
|
|
}
|
|
],
|
|
"git": [
|
|
{
|
|
"command": "git checkout -b branch_name",
|
|
"desc": "Create and checkout a new branch"
|
|
},
|
|
{
|
|
"command": "git rebase <target_branch>",
|
|
"desc": "Rebase commits from source branch to target branch"
|
|
},
|
|
{
|
|
"command": "git stash",
|
|
"desc": "Stash changes without commiting"
|
|
},
|
|
{
|
|
"command": "git reflog",
|
|
"desc": "Show history of all changes"
|
|
},
|
|
{
|
|
"command": "git remote set-url origin git@github.com:username/repo.git",
|
|
"desc": "Change origin url (example from https to ssh)"
|
|
}
|
|
]
|
|
}
|