I use this to compile my LESS scripts already. I was always getting really frustrated with the options with LESS... either compile in the browser, or compile manually. Both were actually a bit of a pain, (caching being the biggest annoyance for browser compilation). So 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…
Poor man's IFTTT in 3 lines of code
21–30 of 36 posts
Re: Poor man's IFTTT in 3 lines of code
#22Great 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 ).
* File::ChangeNotify (https://www.metacpan.org/module/File::ChangeNotify)
* Filesys::Notify::Simple (https://www.metacpan.org/module/Filesys::Notify::Simple)Re: Poor man's IFTTT in 3 lines of code
#23Re: Poor man's IFTTT in 3 lines of code
#24Someone please tell me what IFTTT is.
Re: Poor man's IFTTT in 3 lines of code
#25Re: Poor man's IFTTT in 3 lines of code
#26The inotify script likely has a race condition; if the directory is modified while an update is running, it won't pick up the second modification, and will wait in a dirty state until it is modified again. If anyone wants a race-free solution, you should check out my NCD scripting language [1] which has an integrated command to receive directory change notifications (last example in Blockers section is a race-free so…
Re: Poor man's IFTTT in 3 lines of code
#27Earlier quoted context omitted.
I'm sorry if I missed this, but why would you use make instead of bash?
make figures out which files need updating make allows to write pattern rules (.c.o:, or %.o: %.c) you don't need to move files out of the 'inbox' to ignore them regenerating a file is a touch(1) away make is descriptive, not imperative (invaluable readability when you're coming back on it years later) should you ever need a second transformative step or a new dependency, it's trivial to insert, and make will figure…
Make calls the shell in order to run programs, correct?
(IOW, does make call execve directly, as the shell does?)
Re: Poor man's IFTTT in 3 lines of code
#28The inotify script likely has a race condition; if the directory is modified while an update is running, it won't pick up the second modification, and will wait in a dirty state until it is modified again. If anyone wants a race-free solution, you should check out my NCD scripting language [1] which has an integrated command to receive directory change notifications (last example in Blockers section is a race-free so…
After a very brief look, NCD looks very cool. I'm curious about the first complete example. Is it possible to implement a delay of a few seconds before the IP address is reset when the link is lost?
[1] http://code.google.com/p/badvpn/source/browse/trunk/ncd/modu... [2] http://code.google.com/p/badvpn/source/browse/trunk/ncd/modu...
Re: Poor man's IFTTT in 3 lines of code
#29Earlier quoted context omitted.
After a very brief look, NCD looks very cool. I'm curious about the first complete example. Is it possible to implement a delay of a few seconds before the IP address is reset when the link is lost?
I've never seen why that would be useful. Switches and Ethernet cards aren't that unreliable in my experience, and I've plugged cables into a different switch in less than a few seconds :) I think if you really needed that, the nicest way would be to add it as a feature to net.backend.waitlink(). See source [1] of this command, and source of sleep() [2] to see how to use a timer. It may also be possible to hack it up…
Also, thanks for the pointers into the source code. It looks like I would want to make the change around line 67 of net_backend_waitlink.c. I highly doubt I'll actually get around to doing it though :).
Re: Poor man's IFTTT in 3 lines of code
#30Earlier quoted context omitted.
I've never seen why that would be useful. Switches and Ethernet cards aren't that unreliable in my experience, and I've plugged cables into a different switch in less than a few seconds :) I think if you really needed that, the nicest way would be to add it as a feature to net.backend.waitlink(). See source [1] of this command, and source of sleep() [2] to see how to use a timer. It may also be possible to hack it up…
I've had a situation where an Ethernet connection would occasionally drop link for a very small fraction of a second, which unnecessarily shut down the interface and reset all TCP connections. Maybe a few second delay is too long, but 500ms seems reasonable. Also, maybe I wouldn't want to keep the old address blindly, but trigger a DCHP request if the link is dropped and restored before the timeout. Also, thanks for…