commit 32c180bb53df3e9ad6edf15120dd58a0bfbb2eb9 Author: Hugh Rundle Date: Sat Aug 17 17:30:02 2024 +1000 initial local commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..a030556 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# Personal man page + +This repo is for my personal man page. It uses `pandoc` to process markdown into a manpage. See https://gabmus.org/posts/man_pages_with_markdown_and_pandoc + +1. create a markdown file for the manpage. We save it in section 7: _Miscellaneous Information Manual_, so it needs to be named `[name].7.md`. + +2. create a file in man page format using pandoc: + ```sh + pandoc --standalone -t man cheatsheet.7.md -o cheatsheet.7 + ``` +3. Then symlink to the appropriate man file directory: + + ```sh + ln -s /Users/hugh/coding/man/cheatsheet.7 /usr/local/share/man/man7/ + ``` +Now you can run `man cheatsheet` and see your man page! \ No newline at end of file diff --git a/cheatsheet.7 b/cheatsheet.7 new file mode 100644 index 0000000..5069813 --- /dev/null +++ b/cheatsheet.7 @@ -0,0 +1,111 @@ +.\" 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 SYNOPSIS +.PP +\f[B]man cheatsheet\f[R] +.IP +.nf +\f[C] +pandoc --standalone -t man cheatsheet.7.md -o cheatsheet.7 +ln -s /User/hugh/coding/man/chatesheet.7 /usr/local/share/man/man7/ +\f[R] +.fi +.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] +.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 +\f[V]venv\f[R] +TODO +.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. diff --git a/cheatsheet.7.md b/cheatsheet.7.md new file mode 100644 index 0000000..3f49297 --- /dev/null +++ b/cheatsheet.7.md @@ -0,0 +1,102 @@ +% 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)