For linux, the scrot utility will do that.
Re:Shell scripts to improve your writing
by icebraining on Sunday January 01, 2017 @02:47PM
(#13296966)
They say it follows the UNIX philosophy, but that's clearly not right; delaying is a job for sleep(1). xwd is the true UNIX philosophy abiding screenshot tool :)
I didn't read through his third script for detecting duplicate words, but couldn't it be achieved by using PCRE regex and backreferences?
http://stackoverflow.com/questions/2823016/regular-expressio...
Off-topic, but I've been meaning to write a post on how learning the command-line made me a significantly more productive writer. I do most of my writing on sites built from static site generators, such as Jekyll and Middleman and Sphinx. For many of my tutorials, I have to describe graphical elements which require taking screenshots.
I of course know the OSX keyboard shortcut to turn on the screen grab utility and interactively make a selection. But this saves the screenshot to a default location with a generic file name. To include that image in my blog, I have to move it over to my working directory, rename it, and then write the img code and src attribute to my blog post. It's enough annoying small steps that including images in my posts was a huge chore.
Sometime ago, this blog post on OS X Terminal Utilities [0] made it to HN's front page and I learned that screencapture could be invoked from the Terminal. So I wrote a little Ruby wrapper that, when invoked from the command-line with an argument for output path, would call screencapture after a 2-second delay -- enough time for me to Cmd-Tab from a Terminal to the application I want to screensnap -- and then save the snap to the specified destination and output HTML/Markdown that I could paste into my blogpost.
Sample usage:
stderr: stdout: I've iterated the tool, converting it to Python and including the was-sdk so I could upload to S3 if I need an absolute URL. And I've written plenty of other utilities since...but it's hard to overstate how much being able to operate via CLI has smoothed my writing experience. It's not just that it saves me time, but I'll write visual-heavy posts that I would have never even tried, especially back in my Wordpress days.[0] http://www.mitchchn.me/2014/os-x-terminal/
[1] https://gist.github.com/dannguyen/bfb45408d43986eefdf83b59bc...