2024-08-17 17:30:02 +10:00
|
|
|
.\" Automatically generated by Pandoc 3.1.5
|
|
|
|
.\"
|
|
|
|
.\" Define V font for inline verbatim, using C font in formats
|
|
|
|
.\" that render this, and otherwise B font.
|
|
|
|
.ie "\f[CB]x\f[]"x" \{\
|
|
|
|
. ftr V B
|
|
|
|
. ftr VI BI
|
|
|
|
. ftr VB B
|
|
|
|
. ftr VBI BI
|
|
|
|
.\}
|
|
|
|
.el \{\
|
|
|
|
. ftr V CR
|
|
|
|
. ftr VI CI
|
|
|
|
. ftr VB CB
|
|
|
|
. ftr VBI CBI
|
|
|
|
.\}
|
|
|
|
.TH "CHEATSHEET" "7" "" "Version 1.0" "Cheatsheet for stuff Hugh forgets"
|
|
|
|
.hy
|
|
|
|
.SH NAME
|
|
|
|
.PP
|
|
|
|
\f[B]cheatsheet\f[R] - tips and reminders for Hugh.
|
|
|
|
.SH DESCRIPTION
|
|
|
|
.PP
|
|
|
|
This is a man page to remind Hugh of some basic commands and techniques
|
|
|
|
he uses but forgets a lot in git, Python etc.
|
|
|
|
.SH EXAMPLES
|
|
|
|
.PP
|
|
|
|
\f[B]git\f[R]
|
|
|
|
.TP
|
|
|
|
\f[V]git branch -d [name of branch to delete]\f[R]
|
|
|
|
Delete a git branch
|
|
|
|
.TP
|
|
|
|
\f[V]git reset [file]\f[R]
|
|
|
|
\f[I]Unstage\f[R] file but retain contents
|
|
|
|
.TP
|
|
|
|
\f[V]git _reset_ [commit]\f[R]
|
|
|
|
\f[I]Undo\f[R] all commits after \f[I]commit\f[R], preserving changes
|
|
|
|
locally
|
|
|
|
.TP
|
|
|
|
\f[V]git reset HEAD --hard\f[R]
|
|
|
|
\f[I]Undo\f[R] all changes to tracked files (since last commit)
|
|
|
|
.TP
|
|
|
|
\f[V]git clone [url]\f[R]
|
|
|
|
Download project and its history
|
|
|
|
.TP
|
|
|
|
\f[V]git merge [branch]\f[R]
|
|
|
|
Merge changes from \f[I]branch\f[R] into the current local branch
|
|
|
|
.TP
|
|
|
|
\f[V]git fetch [remote] pull/[id]/head:[branchname]\f[R]
|
|
|
|
Where \f[I]remote\f[R] is the remote name you want to fetch from,
|
|
|
|
\f[I]id\f[R] is the PR id, and \f[I]branchname\f[R] is the name you want
|
|
|
|
to give to the new LOCAL branch you will create with this command.
|
|
|
|
e.g.\ \f[I]fetch bookwyrm pull/999/head:testing\f[R]
|
2024-09-21 07:55:05 +10:00
|
|
|
.TP
|
|
|
|
\f[V]git push git\[at]github.com:remoteUser/remoteRepo localBranch:remoteBranch\f[R]
|
|
|
|
Push a change to someone else\[cq]s pull request.
|
|
|
|
Where \f[I]localBranch\f[R] is the branch name in your local repository,
|
|
|
|
and \f[I]remoteBranch\f[R] is \f[B]their\f[R] branch name.
|
|
|
|
More info at
|
|
|
|
https://codinhood.com/micro/add-commits-persons-pr-on-your-repo/
|
2024-08-17 17:30:02 +10:00
|
|
|
.PP
|
|
|
|
\f[B]python\f[R]
|
|
|
|
.TP
|
|
|
|
\f[V]python -m http.server [port]\f[R]
|
|
|
|
Spins up a web server with file root wherever you called this from, on
|
|
|
|
\f[I]port\f[R]
|
|
|
|
.TP
|
2024-09-21 07:55:05 +10:00
|
|
|
\f[V]python -m venv /path/to/new/virtual/environment\f[R]
|
|
|
|
Create a virtual environment.
|
|
|
|
For example:
|
|
|
|
.RS
|
|
|
|
.PP
|
|
|
|
\f[V]python -m venv venv\f[R] - creates a directory \f[V]venv\f[R].
|
|
|
|
.PD 0
|
|
|
|
.P
|
|
|
|
.PD
|
|
|
|
To activate: \f[V]source <venv>/bin/activate\f[R]
|
|
|
|
.PD 0
|
|
|
|
.P
|
|
|
|
.PD
|
|
|
|
To deactivate: \f[V]deactivate\f[R]
|
|
|
|
.RE
|
2024-08-17 17:30:02 +10:00
|
|
|
.PP
|
|
|
|
\f[B]Docker\f[R]
|
|
|
|
.TP
|
|
|
|
\f[V]docker volume prune\f[R]
|
|
|
|
Delete all volumes not being used by a currently-running process.
|
|
|
|
.TP
|
|
|
|
\f[V]docker exec -d [container] [command]\f[R]
|
|
|
|
Execute a \f[I]command\f[R] inside the running \f[I]container\f[R] as a
|
|
|
|
daemon (background task)
|
|
|
|
.PP
|
|
|
|
\f[B]hashes and random strings\f[R]
|
|
|
|
.TP
|
|
|
|
\f[V]openssl rand -hex [number]\f[R]
|
|
|
|
Create a random string with \f[I]number\f[R] of bytes, using hex
|
|
|
|
.TP
|
|
|
|
\f[V]openssl rand -base64 [number]\f[R]
|
|
|
|
Create a random string with \f[I]number\f[R] of bytes, using base64
|
|
|
|
.TP
|
|
|
|
\f[V]echo -n \[dq]string to hash\[dq] | md5\f[R]
|
|
|
|
returns an md5 hash of the string
|
|
|
|
.TP
|
|
|
|
\f[V]md5 big_huge_file.iso\f[R]
|
|
|
|
returns md5 hash of the file
|
|
|
|
.TP
|
|
|
|
\f[V]openssl md5 big_huge_file.iso\f[R]
|
|
|
|
also returns md5 hash of the file
|
|
|
|
.PP
|
|
|
|
\f[B]Duck Duck Go\f[R]
|
|
|
|
.TP
|
|
|
|
\f[I]https://duckduckgo.com/?q=password+strong+32\f[R]
|
|
|
|
Strong random password
|
|
|
|
.TP
|
|
|
|
\f[I]https://duckduckgo.com/?q=qr+code+your+text+here\f[R]
|
|
|
|
Get a QR code for returning whatever text you entered
|
|
|
|
.SH SEE ALSO
|
|
|
|
.PP
|
|
|
|
git(1) python(1) md5(1)
|
|
|
|
.SH AUTHORS
|
|
|
|
Hugh Rundle.
|