I guess mechanized warfare should be scary.DARPA's autonomous hellgoatyoutube.com/watch?v=xY42w1…
— William Gibson (@GreatDismal) February 11, 2012
the web log of peter sabaini
I guess mechanized warfare should be scary.DARPA's autonomous hellgoatyoutube.com/watch?v=xY42w1…
— William Gibson (@GreatDismal) February 11, 2012
I’m a lazy/impatient typist and therefore a big fan of shell completion. There’s a lot of good completion support for common programs, but what if I want to have shell completion for a custom program or shell function? A quick and easy way is to bind one of the pre-defined completion functions, as I learned today.
Eg. I have a shell function “sshr” to log me into a remote host as root:
sshr() { /usr/bin/ssh "root@$@" ;}To have the shell use the same expansion rules as regular ssh, bind it like this:
complete -F _ssh sshr
To get a list of predefined completion rules, run “complete -p”
This and more from
So I spent the last week in Amsterdam for training. Amsterdam is a great city, so it's unfortunate that I didn't have all that much time for exploration. Luckily I at least managed a small trip to the Rijksmuseum; while most of the museum is closed for restoration, they have a small selection with truly great pieces on display.
Training was also very enjoyable however. Topic of the training was the IT automation toolkit Puppet, and, since Puppet is written in Ruby, also a little of that was covered. Mr Haugen from Puppetlabs did an excellent job as an instructor; with just the right mix of theory presentation and exercises (and in between answering lots of questions). I have a bit of a love/hate relationship with Puppet. I've been using Puppet before; it sure is a very useful tool but on the other hand... It does have some warts. For one the terminology of the DSL. For someone who has done OO programming the word "class" carries very specifc meaning. Puppet also has classes, but the are almost entirely unlike those from OOP. For example, all Puppet classes are singletons and may not be instantiated more than once. Also, there is some inheritance but overriding parameters is not supported; so the advice is to avoid inheritance and use includes. Include is not at all like someone with a C (or Erlang) background might expect it to be; it's not a simple literal file include but actually a kind of import + instantiate function. And so on. On the other hand, I much like the declarative model and the fact that it is very open and extensible. For instance, configuration parameters need not be held in static files but may also reside in an external repository; all that is needed is a glue script to fetch said parameters. Also Puppets approach is refreshingly pragmatic; it's all about getting stuff done. One can easily see that there are actual sysadmins using this stuff in production. It has decent support for testing and dry runs, for example -- good to have if you're not that confident about a system change you're going to roll out to a few thousand hosts. It actually reminded me a little bit of the earlier days of Zope2 -- lots of magic and little documenation; for someone who knows how to push the right buttons a lot can be done with little effort but to get there you have a not so friendly learning curve. Puppet is written in Ruby, and for many types of extensions you have to get down to the Ruby level. I haven't done much with Ruby before, so I'd like to take up the opportuniy write up some thoughts about the language and platform. My reference here is mainly Python, a) because these languages are in a pretty similar niche and b) Python is what I know best. For this Python programmer, Ruby tends to feel a little "Perlish" from time to time. In cases where Python might choose to focus on "one right way" to do something, Ruby would rather provide several ways (in different flavors) to accomplish the same thing. This sometimes can be quite useful, sometimes rather confusing. For me, this makes Python more intuitively useful, but admittedly sometimes more verbose. One of the Perlish features of Ruby that I quite like are built-in regular expressions. For Sysadmins who constantly have to wrangle output of other tools to their own end regular expressions are a must have. While Python of course has an excellent library for RE's it is still not the same level of integration as a native datatype with accompanying operators etc. On the other hand Ruby has Perls habit of setting tons of special global variables for RE matches -- not trying to be dogmatic here but can we maybe just try to avoid automatic global vars? Please? People get hurt by that stuff! This, to be fair, is entirely possible because Ruby _also_ provides other ways of accessing these values, without resorting to globals. One of the Perlish things in Ruby that I wish they just had left out is the postfix conditional, ie. one can write "if x then foobar()" but also "foobar() if x". Larry Wall has stressed how that helps make Perl like writing English but in all honesty I'd like to have my software a little more regular than the English language with its abundance of corner cases and special rules for all kinds of occasions. Speaking of conditionals -- many things which would be statements in other languages are actually expressions in Ruby, ie. they have a value; also including if-conditions. Eg. this function would add 2 to numbers smaller than 23 (since functions return the value of their last expression): def foo(a)Excellent street art by Mark Jenkins -- http://xmarkjenkinsx.com/outside.html
That is, Go the programming language, not the board game.