System monitor in Emacs mode-line

Resistance is futile…

As we all know Emacs is a great operating system and a decent editor, and as such it has been serving me really well – I find myself assimilating more and more of my tools and daily activities into the Emacs collective. Recently I realised that Conky just wouldn’t cut it anymore…

First of all, I barely look at my desktop. There’s just no reason to do that other than checking some of the system stats such as memory usage or CPU load when I’m hacking arround and testing stuff.

For this particular use-case I figured the Emacs mode-line would be perfect to display all the relevant statistics directly in Emacs in such a way that I could glance through them without interrupting my workflow – giving me real-time feedback with minimal distraction.
Continue reading

Instant docs in StumpWM

Here’s a cool hack I use to optimize my docs searching.

Let’s start off with DuckDuckGo search engine.
By itself it’s a pretty powerful tool thanks to its numerous features like the !bang syntax. For example searching for:

!cpp std::string::clear

…takes me exactly where I want.

Let’s use it to our advantage, shall we?

StumpWM is a tailing window manager that allows you to define system-wide key bindings that work and feel pretty much like Emacs ones. Combining that with DuckDuckGo’es !bang syntax makes you just a few clicks away from anything out there:

(defcommand duckduckgo (phrase) ((:string "Search: "))
  "Searches for something on DuckDuckGo."
  (run-shell-command
    (concatenate 'string
                 *your-fav-webbrowser*
                 " http://duckduckgo.com/?q="
                 (substitute #\+ #\Space phrase))))
(define-key *root-map* (kbd "d") "duckduckgo")

Now, if you want to find out if I used substitute correctly all you have to do is:

C-t d !lisp substitute

…what will take you directly there. Turns out I did.

But wait, there’s more!
Continue reading