4 ms·
Something I crave in the worst way is a sensible story for accumulating a “toolbox” of snippets and scripts and commands. They don’t need to be ready to go, bu
by Waterluvian 5y ago
Something I crave in the worst way is a sensible story for accumulating a “toolbox” of snippets and scripts and commands.
They don’t need to be ready to go, but ideally:
- natural language searchable
- add a small description
- CLI to search, examine, and copy
- not a <favourite text editor> plugin
- sync with a GitHub repo.
- f0e4c2f7 5y agoOne of the best hackers I ever worked with turned me onto this method. Use a flat text in the editor of your choice. Search as needed. Tags work because you can seach them. You delimit each section as a note. I do it like this --- Next note --- It seems limited and primative, you don't get any markup or fun stuff. But it's soooo good. There is nothing to break or update. Seach is the method I use most anyway in my other note taking apps. And you wind up putting everything in there, including commands that you're staging to run. Those staged commands become snippets later.
- imiric 5y agoI keep a commands.org file for exactly this purpose. Whenever a command is useful to maintain outside of my shell history, it gets documented and placed there, along with variations, things to look out for, etc. Eventually I'd like to publish it as a microblog for such snippets ala commandlinefu.com, but priorities and laziness get in the way. :/
- notatoad 5y agoText files are good, but even more primitive and also awesome: I find a sheet of paper taped to the wall in my office is really underrated. Being able to just look up and see it is awesome, as well as the natural limitation to only as much stuff as will fit on a sheet of paper. Every now and then I start a new sheet, dropping off the stuff I've memorized.
- sen 5y agoI still use flat text files for 90% of my daily note taking. Have done since the early 90s, and the same notes I took then are still working in the same folder I use today. I sync it to my various devices (every device and platform has a text editor), and it’s never failed me. I have txt files for commands I want to remember for each OS I daily use (linuxcmds.txt, windowscmds.txt, maccmds.txt) and split them the same way you said but 5 dashes. Also keep txt files for install/setup notes for each os, links to every program I want to install in fresh installs, etc etc. Text files work on every single OS/device, the format is stable, it’s easily searchable, easily shareable, and my entire 30 years of notes is measured in megabytes.
- agys 5y agoI use .txt files for most of my tasks: all sort of lists, notes, snippets, even organized bookmarks (with comments). I use them also with some indentation and simple geometries for structured information (table-like or hierarchies). Some of them are shared via DropBox and despite the risk of simultaneous edits we had basically no incidents: the simplicity and efficacy justifies it for us.
- sergiosgc 5y agoMany people maintain those in a text file, somewhere. My approach is slightly different. I keep them in my shell history file itself. First, set your HISTSIZE to 1 trillion. Then, tag the relevant commands in the history file with a comment after the command (e.g. sed -n '5,10p' some.log # print selected lines). It gets searchable within the shell, either by the comment or the start of the command. Always at my fingertips.
- barbuk 5y agoI had the same craving. My linux only snippet manager: https://github.com/barbuk/snippy https://github.com/barbuk/snippy
- Arcuru 5y agoI stumbled on this lately, which I've borrowed myself and I'm finding it pretty convenient: https://ianthehenry.com/posts/sd-my-script-directory/ https://ianthehenry.com/posts/sd-my-script-directory/ Shell completions are essential for it, so I had to stumble through writing my own for Fish, but now that it's setup it's quite nice.
- mschrage 5y agoWriting shell completions is such a pain (and fish is still way ahead of zsh or bash). Btw if you like fish autocomplete, you might be interested in fig.io. We've spent a bunch of time making is super easy to add your own completions for scripts or custom CLI tools. :)
- ZeroGravitas 5y agoI find tldr is good for rarely used commands: https://tldr.ostera.io/sed https://tldr.ostera.io/sed (That's a web version but I usually access it on the cli or in my editor)
- throwamon 5y agotldr is great! I personally use this faster implementation in Rust: https://github.com/dbrgn/tealdeer https://github.com/dbrgn/tealdeer And I just became aware from reading the README that there's an even faster one written in Zig.
- TheCondor 5y agoI think you could just use a text file and then let chezmoi manage the distribution via git. Or a personal wiki, I know people that run their own wikis for just this sort of thing