

Ask HN: Where do you save code snippets or cli commands - Madawar

Hi, where do you guys save code snippets and&#x2F;or cli commands that you have just learned before you memorize them?
======
pjungwir
I use the `man` system. When you invoke `man` you can pass an optional leading
argument indicating which "section" of man pages you want to see, e.g. `man 1
open` and `man 2 open` give different pages.

You can add new sections by setting $MANSECT. So I added a new section named
with my initials, pj:

    
    
        export MANSECT=1:n:l:8:3:2:3posix:3pm:3perl:5:4:9:6:7:pj
    

You can also change where the `man` command searches for manpage files using
$MANPATH:

    
    
        export MANPATH="$MANPATH:$HOME/man"
    

Now you can just `mkdir -p ~/man/manpj` and start adding files with a `.pj`
extension, like `postgres.pj` and `bash.pj`. Then it's super-fast to bring
those up by saying `man pj postgres`.

Of course you would substitute all the above with your own initials or
whatever.

You don't even have to write the files with the usual formatting macros. Most
of the time a plain text file works okay. But it's kind of fun to learn enough
of that to get by: probably less than a dozen macros for paragraph breaks,
underlining, etc.

And then you can put your collection of notes on Github like here:

[https://github.com/pjungwir/manpj](https://github.com/pjungwir/manpj)

Here is a file with a few man macros:

[https://github.com/pjungwir/manpj/blob/master/bc.pj](https://github.com/pjungwir/manpj/blob/master/bc.pj)

------
97-109-107
I'm using [https://github.com/xolox/vim-notes](https://github.com/xolox/vim-
notes) and create files for each topic. Recently I could help my colleague by
exporting my mongodb-related notes to markdown and publish it for him.

------
mrfusion
I've been using gists. Does that seem like an ok idea? My only complaint is
that they don't show up in google searches or when someone looks at my profile
in github so I don't really get to share them by default.

I also keep forgetting my password :-(

------
forgotpasswd3x
I've created a .org file that I keep with useful commands / code that I
reference pretty often. I keep it in my Dropbox folder so I can access and
update it from any of the computers I work on. Seems to do the job.

------
1781
.zsh_history with no limit has served me well for a decade

------
victorstanciu
I use a simple personal Wiki that I made:
[http://wikitten.vizuina.com](http://wikitten.vizuina.com)

------
dserodio
GitBox[1] which is a pretty web UI for Gists

[1] [https://gistboxapp.com](https://gistboxapp.com)

------
somlor
I've been using [https://snipt.net](https://snipt.net) for the last 6 years.

------
brandonlipman
I use evernote, that way I can see contextual notes and past use cases.

------
rendambathu
Notational Velocity. Using for past 4 years.

------
jhildings
many open notepad documents :D :D

------
Blackthorn
Google Keep.

~~~
TheThingie
OneNote is great especially in a shared environment.

