tNew article: under wendy's dress - monochromatic - monochromatic blog: http://blog.z3bra.org
(HTM) git clone git://z3bra.org/monochromatic
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit 48d975af77ac4e03acc5d504088af9166c778c4b
(DIR) parent f456c716360226c645a81c6ff3b8497766db2ba4
(HTM) Author: z3bra <willy@mailoo.org>
Date: Tue, 31 Mar 2015 23:07:47 +0200
New article: under wendy's dress
Diffstat:
A 2015/03/under-wendys-dress.txt | 82 +++++++++++++++++++++++++++++++
M config.mk | 3 ++-
M index.txt | 1 +
3 files changed, 85 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/2015/03/under-wendys-dress.txt b/2015/03/under-wendys-dress.txt
t@@ -0,0 +1,82 @@
+# [under wendy's dress](#)
+## — 31 March, 2015
+
+I've been meaning to write this post for a long time.
+
+### who's that chick?
+
+[`wendy`](http://git.z3bra.org/cgit.cgi/wendy) is an inotify based directory and
+file watch. It is by far the project I'm the most proud of.
+Back in the days, I discovered this awesome feature in the kernel: `inotify`.
+It's a feature that will make the kernel raise events whenever a file or
+directory (let's call them "nodes") will change.
+It could be the creation, deletion, move, open, close of this node, and even
+more.
+
+After seeing there was a C library to interface with the inotify watch/events, I
+immediately started writing a small program that would do one simple thing:
+notify me when I received an email, and I named my creation **wendy**.
+
+At first, all it did was the following:
+
+ $ wendy ~/var/mail/INBOX/new -e beep
+ watching directory ~/var/mail/INBOX/new
+
+And my motherboard's speaker would beep everytime a new file was created in the
+specified directory.
+
+Now that it was working, I finally decided to make it more and more general, and
+it finally reached its current state: a _general purpose node watcher_.
+
+
+### how does it work?
+
+ wendy -m 768 -f $HOME/directory -e popup "~/directory content updated"
+
+The above command will create a popup each time a file is created or deleted in
+`~/directory`.
+
+`wendy` takes node names, masks, and an optionnal command, mix it up and will
+then watch them up with the specified mask, and launch a command upon each event
+triggered.
+
+Wendy can also read filenames from stdin, to add to its awesomeness ;)
+
+
+### play with her!
+
+Get a popup when you receive a new e-mail
+
+ wendy -m 256 -f ~/var/mail/inbox/new -e popup "you have a new mail"
+
+Automatically recompile a C project whenever a source file is changed
+
+ find -name "*.c" | wendy -m 8 -e make
+
+Send an email to your admin whenever your webserver get an error
+
+ wendy -m 8 -f /var/log/httpd/error.log -e sh -c 'tail /var/log/httpd/error.log | mail -s "[ERROR] httpd on $(hostname)" sysadmin@domain.tld'
+
+Make an "upload directory" on your system, using ssh and a passphrase-less private key
+
+ wendy -v -m 264 -f ~/var/uploads | while read mask file; {
+ extension=$(echo $file | sed 's/^.*\.\?//')
+ newname=$(tr -cd '[a-z0-9]' < /dev/urandom | fold -w 8i | sed 1q).${extension:-txt}
+ scp -i ~/.ssh/id_rsa $file user@domain.tld:/var/www/http/downloads/$newname
+ }
+
+View manpages on the fly, as you write them
+
+ PAGER=cat wendy -m 8 -f wendy.1 -e sh -c "clear; man ./wendy.1"
+
+
+the only limit.. Wait, there is no limit! Just let it go (I know you hate me for
+saying that...)
+
+### contribution
+
+If you find any bug, or weird behavior, or anything else, do not hesitate to
+drop me an e-mail (willy at mailoo dot org).
+
+Keep tweaking !
+<!-- vim: set ft=markdown ts=4 et tw=80: -->
(DIR) diff --git a/config.mk b/config.mk
t@@ -24,7 +24,8 @@ PAGES = index.html \
2014/11/avoid-workspaces.html \
2014/12/so-tox-me-maybe.html \
2015/01/you-are-the-wm.html \
- 2015/02/do-you-gopher.html
+ 2015/02/do-you-gopher.html \
+ 2015/03/under-wendys-dress.html
FEEDS = rss/feed.xml
EXTRA = css img vid data errors favicon.ico
(DIR) diff --git a/index.txt b/index.txt
t@@ -1,3 +1,4 @@
+* 0x0015 - [under wendy's dress](/2015/03/under-wendys-dress.html)
* 0x0014 - [Do you gopher ?](/2015/02/do-you-gopher.html)
* 0x0013 - [You are the WM](/2015/01/you-are-the-wm.html)
* 0x0012 - [So tox me maybe](/2014/12/so-tox-me-maybe.html)