Naming Things is Hard

Today I Learned

...that, yes, it’s possible to make life easier on yourself, more often than not

Once upon a time I learned a bit about enscript (because sometimes I like to print things out) and I learned a bit about bash functions and today I finally put two and two together and made myself a little bash function for spitting code files out to pdfs:

# Make a pdf of a textfile

pdfIt() {
        enscript --line-numbers -p - -f SourceCodePro-Light8 --word-wrap $1 | pstopdf -i -o ./$1.pdf;
        mv ./$1.pdf ~/temp;
}

This gets dumped into my .aliases.sh file (which is an "oh, duh" technique I think I stole from Una Kravets) which gets source'd into my .bash_profile file. And then, PDF'ing all the things!

Worth pointing out that you may need to change the font declaration. Also the "mv" command is there mostly because I realized I'm generally checking files deep in repos and I won't need them cluttering up the works. I dump stuff into ~/temp all the time, pick your target of choice.

Mileage may vary, warranty not included.

tags

Home & About & Micro.blog & Feed (Atom)