2 KiB
% CHEATSHEET(7) Version 1.0 | Cheatsheet for stuff Hugh forgets % Hugh Rundle
NAME
cheatsheet - tips and reminders for Hugh.
DESCRIPTION
This is a man page to remind Hugh of some basic commands and techniques he uses but forgets a lot in git, Python etc.
EXAMPLES
git
git branch -d [name of branch to delete]
-
Delete a git branch
git reset [file]
-
Unstage file but retain contents
git _reset_ [commit]
-
Undo all commits after commit, preserving changes locally
git reset HEAD --hard
-
Undo all changes to tracked files (since last commit)
git clone [url]
-
Download project and its history
git merge [branch]
-
Merge changes from branch into the current local branch
git fetch [remote] pull/[id]/head:[branchname]
-
Where remote is the remote name you want to fetch from, id is the PR id, and branchname is the name you want to give to the new LOCAL branch you will create with this command. e.g. fetch bookwyrm pull/999/head:testing
python
python -m http.server [port]
-
Spins up a web server with file root wherever you called this from, on port
venv
-
TODO
Docker
docker volume prune
-
Delete all volumes not being used by a currently-running process.
docker exec -d [container] [command]
-
Execute a command inside the running container as a daemon (background task)
hashes and random strings
openssl rand -hex [number]
-
Create a random string with number of bytes, using hex
openssl rand -base64 [number]
-
Create a random string with number of bytes, using base64
echo -n "string to hash" | md5
-
returns an md5 hash of the string
md5 big_huge_file.iso
-
returns md5 hash of the file
openssl md5 big_huge_file.iso
-
also returns md5 hash of the file
Duck Duck Go
- https://duckduckgo.com/?q=password+strong+32
-
Strong random password
- https://duckduckgo.com/?q=qr+code+your+text+here
-
Get a QR code for returning whatever text you entered
SEE ALSO
git(1) python(1) md5(1)