TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

8 pointsby Madawarover 10 years ago
Hi, where do you guys save code snippets and/or cli commands that you have just learned before you memorize them?

12 comments

pjungwirover 10 years ago
I use the `man` system. When you invoke `man` you can pass an optional leading argument indicating which &quot;section&quot; of man pages you want to see, e.g. `man 1 open` and `man 2 open` give different pages.<p>You can add new sections by setting $MANSECT. So I added a new section named with my initials, pj:<p><pre><code> export MANSECT=1:n:l:8:3:2:3posix:3pm:3perl:5:4:9:6:7:pj </code></pre> You can also change where the `man` command searches for manpage files using $MANPATH:<p><pre><code> export MANPATH=&quot;$MANPATH:$HOME&#x2F;man&quot; </code></pre> Now you can just `mkdir -p ~&#x2F;man&#x2F;manpj` and start adding files with a `.pj` extension, like `postgres.pj` and `bash.pj`. Then it&#x27;s super-fast to bring those up by saying `man pj postgres`.<p>Of course you would substitute all the above with your own initials or whatever.<p>You don&#x27;t even have to write the files with the usual formatting macros. Most of the time a plain text file works okay. But it&#x27;s kind of fun to learn enough of that to get by: probably less than a dozen macros for paragraph breaks, underlining, etc.<p>And then you can put your collection of notes on Github like here:<p><a href="https://github.com/pjungwir/manpj" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pjungwir&#x2F;manpj</a><p>Here is a file with a few man macros:<p><a href="https://github.com/pjungwir/manpj/blob/master/bc.pj" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pjungwir&#x2F;manpj&#x2F;blob&#x2F;master&#x2F;bc.pj</a>
97-109-107over 10 years ago
I&#x27;m using <a href="https://github.com/xolox/vim-notes" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;xolox&#x2F;vim-notes</a> 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.
mrfusionover 10 years ago
I&#x27;ve been using gists. Does that seem like an ok idea? My only complaint is that they don&#x27;t show up in google searches or when someone looks at my profile in github so I don&#x27;t really get to share them by default.<p>I also keep forgetting my password :-(
forgotpasswd3xover 10 years ago
I&#x27;ve created a .org file that I keep with useful commands &#x2F; 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.
1781over 10 years ago
.zsh_history with no limit has served me well for a decade
victorstanciuover 10 years ago
I use a simple personal Wiki that I made: <a href="http://wikitten.vizuina.com" rel="nofollow">http:&#x2F;&#x2F;wikitten.vizuina.com</a>
dserodioover 10 years ago
GitBox[1] which is a pretty web UI for Gists<p>[1] <a href="https://gistboxapp.com" rel="nofollow">https:&#x2F;&#x2F;gistboxapp.com</a>
somlorover 10 years ago
I&#x27;ve been using <a href="https://snipt.net" rel="nofollow">https:&#x2F;&#x2F;snipt.net</a> for the last 6 years.
brandonlipmanover 10 years ago
I use evernote, that way I can see contextual notes and past use cases.
rendambathuover 10 years ago
Notational Velocity. Using for past 4 years.
jhildingsover 10 years ago
many open notepad documents :D :D
Blackthornover 10 years ago
Google Keep.
评论 #9017103 未加载