41 lines
1.3 KiB
Org Mode
41 lines
1.3 KiB
Org Mode
|
#+TITLE: Examples of Litorgy in Action
|
||
|
#+OPTIONS: toc:nil num:nil ^:nil
|
||
|
|
||
|
* showing directory sizes
|
||
|
|
||
|
This will work for Linux and Mac users, and could be interesting
|
||
|
especially if combined with a nice R graph.
|
||
|
|
||
|
To run place the cursor on the =#+begin_src= line of the source block
|
||
|
labeled directory-pie and press =\C-c\C-c=.
|
||
|
|
||
|
Downsides
|
||
|
- will take a while to run, especially for users with large home directories
|
||
|
- Had to employ some emacs-lisp between the shell and R to clean up
|
||
|
the data. (actually those " marks should not have been introduced
|
||
|
in the shell output, so this could be simplified somewhat)
|
||
|
|
||
|
#+srcname: directories
|
||
|
#+begin_src bash :results :replace
|
||
|
du -sc *
|
||
|
#+end_src
|
||
|
|
||
|
#+srcname: cleaner
|
||
|
#+begin_src emacs-lisp :var table=directories
|
||
|
(delq nil (mapcar (lambda (el)
|
||
|
(let ((size (car el))
|
||
|
(name (cadr el)))
|
||
|
(setq name (if (string-match "\"\\(.+\\)\"" name)
|
||
|
(match-string 1 name)
|
||
|
name))
|
||
|
(unless (or (= size 0)
|
||
|
(string= name "total"))
|
||
|
(list size name))))
|
||
|
table))
|
||
|
#+end_src
|
||
|
|
||
|
#+srcname: directory-pie
|
||
|
#+begin_src R :var dirs = cleaner
|
||
|
pie(as.vector(t(dirs[1])), labels = as.vector(t(dirs[2])))
|
||
|
#+end_src
|