cli

customize sudo prompt

Intro I am writing a wrapper that executes sudo anyconnect. I am then asked for a sudo password, then asked for the password that goes with my anycnonnect destination. Doing this repeatedly, especially where it might not ask the sudo password again because you are already logged in to SUDO for this session, it can be confusing which password it really wants. The answer1 can be installed in your .bashrc:

Compress (bulk) pdf with Ghostcript

One liner with ghostscript GS to make your pdf much smaller. Options for PDFSETTINGS are (in rank of output quality): /prepress /ebook /screen gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed_PDF_file.pdf input_PDF_file.pdf En Masse Compression: 972M -> 457M I applied this with a script upon my 972M directory of hundreds of research pdfs, and the end result was less than half the size (457M). I converted each PDF to text, which is useful for most of them, and then moved each PDF to an “uncompressed” directory, then compressed that uncompressed/FILE.

Compress pdf with Ghostcript

One liner with ghostscript GS to make your pdf much smaller. Options for PDFSETTINGS are (in rank of output quality): /prepress /ebook /screen gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed_PDF_file.pdf input_PDF_file.pdf Resources https://itsfoss.com/compress-pdf-linux/

Keyboard-driven Editing in 2020

Why Keyboard Driven Editing in this age of the mouse? First of all, the mouse is easy – you don’t need to learn anything to point, drag, and click. And for many problem spaces this is ideal: I browse the web with a mouse (usually because my work as a web application engineer requires it), and I wouldn’t dream of attempting keyboard-driven image editing such as with Gimp or InkScape.

Printing from the Command Line (and emacs)

Helpful Resource: https://www.cyberciti.biz/tips/linux-unix-sets-the-page-size-to-size.html Command Note lp print with good defaults lpc status all See printer settings lprm clear print jobs export PRINTER='Sharp-MX-2700N’ Set the target printer before printing lpoptions See available options I generally print PDFs, using the excellent pdf-tools. This provides C-c C-p which will print with the $PRINTER and settings you’ve configured, but sometimes you need more customization.

Gif screencasts from Linux CLI with Byzanz

Wanting to demonstrate the power of emacs M-x butterfly, I needed to make the sort of gif-screen-capture I’ve seen others put to good work. Extra snag: I use emacs itself for a window manager, so the first online recommendation of Peek didn’t work. Instead I found the open-source byzanz to record; however, it requires knowing the screen-portion and length of the gif beforehand. Other than that, though, it worked great even on my exwm (GUI-resistant) system.