by digitalsushi · 6y ago · 0 comments
And I have a bash function called 'cheat', that will look for things in there based on the filename, or contents or however I happen to have it written.
As I learn new things I can append an existing file; I run 'cheat git' once per week and 'cheat tmux' every time I forget how to clone a session. Since this all invariable dumps to stdout, I can continue grepping when it suits.
I have another very dirty hack that will get me in trouble eventually - I'll share it because I find I can often improve my code by self shaming - ghetto secrets management:
echo '1,$'|vim --cmd "set key=${password}" ${filename} -es
This is the nugget around a lot of boilerplate, but this invokes vim and makes it decrypt a file and dump to stdout. From here I have my own little grammar and grepper for storing quasi-secure strings or even just secure texts. I'm positive it's going to get me into hot water but it's been extremely portable for me and I trust it on systems that I have the audacity to believe I am alone on.
I know there's a vimdecrypt plugin floating around that is almost definitely superior, but, mine works on stock linux, mac, and git bash.