Poor man's IFTTT in 3 lines of code
blog.lagentz.com
Poor man's IFTTT in 3 lines of code
1–10 of 36 posts
Re: Poor man's IFTTT in 3 lines of code
#2Re: Poor man's IFTTT in 3 lines of code
#3Great use-case for lnotify, haven't thought about that. Feels much cleaner than having cron jobs for conversions like these.
Re: Poor man's IFTTT in 3 lines of code
#4Re: Poor man's IFTTT in 3 lines of code
#5I found this a very intrusive site - I really dislike these animated slide in fade in distractions.
Re: Poor man's IFTTT in 3 lines of code
#6I found this a very intrusive site - I really dislike these animated slide in fade in distractions.
Re: Poor man's IFTTT in 3 lines of code
#7Great use-case for lnotify, haven't thought about that. Feels much cleaner than having cron jobs for conversions like these.
With the listen gem you can write crossplatform scripts ( http://rubygems.org/gems/listen ).
Re: Poor man's IFTTT in 3 lines of code
#8So I used inotifywait...
It would check for any modifications to my "CSS" folders recursively, and it would then run my custom less compilation script [1] ...
#!/bin/bash
while inotifywait -e modify -r /var/www/site/public/static/css/base; do
cd /var/www/site/public/static/css; node compile;
done
(I also hooked this up to Fab [2], and used a "start"/"stop" script [3] to pause the watch, so that I could manually control when inotify wait would be watching.[1] https://gist.github.com/3497304 (My Custom LESS compile Script)
[2] http://docs.fabfile.org/en/1.4.3/index.html ( Fabric Command Line Tool )
[3] https://gist.github.com/3497308 (Sample Fab Command )
If it would benefit anyone to know in greater details, I'd be happy to write a blog post about automating compilation using these tools.
Re: Poor man's IFTTT in 3 lines of code
#9I found this a very intrusive site - I really dislike these animated slide in fade in distractions.
(Having said that, I went back afterwards and filled out the feedback form pointing out the annoying bits. It was a good article, and I wanted to repay the favour; I recommend you do the same if you agree.)
Re: Poor man's IFTTT in 3 lines of code
#10 all: watermark
done:=$(wildcard *-BD.pdf)
src:=$(filter-out $(done),$(wildcard *.pdf))
marked:=$(patsubst %.pdf,%-BD.pdf,$(src))
watermark: $(marked)
%-BD.pdf: %.pdf
./watermark_script.sh $
The done+filter-out mumbo jumbo is there just because without it, -BD.pdf would be matched by .pdf, and therefore would generate -BD-BD.pdf... and so on (this is a loophole that the original bash script has, if parallel runs are timed correctly). Putting the output files in another directory is left ans an exercise for the reader.The inotify script becomes:
inotifywait -e create /home/user/pdfs && make -C /home/user/pdfs
There is another loophole here, in that the -BD.pdf are created in that directory, so the script gets run again. It doesn't matter for our makefile, which will do nothing on the second run, but there is the 'parallel runs if timed correctly' issue of the original bash script.Generally, GNU make has a bunch of very interesting facilities, making it much, much more powerful than its ancestors (BTW, people interested may want to take a look at an implementation of non-recursive make[0], which — while being awesome — also shows up some useful make tricks).
Now, regarding the filesystem events and userland tools (which are awesome), I wish there was a unified front-end for this kind of things (inotify on Linux, fsevents on OSX...)
PS: I wish the comment form supported something like markdown, so that I could escape those wildcards, and more.
[0] http://stackoverflow.com/questions/559216/what-is-your-exper...