<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5618008483055389858</id><updated>2012-02-16T05:48:12.331-08:00</updated><category term='feeds'/><category term='images'/><category term='launchd'/><category term='control'/><category term='spanish'/><category term='miktex'/><category term='web'/><category term='latex'/><category term='tikz'/><category term='perl'/><category term='texshop'/><category term='graphs'/><category term='regexp'/><category term='youtube'/><category term='date'/><category term='osx'/><category term='prolog'/><category term='firefox'/><category term='awk'/><category term='excel'/><category term='bibtex'/><category term='utf8'/><category term='apps'/><category term='grep'/><category term='rails'/><category term='shortcuts'/><category term='xhtml'/><category term='port'/><category term='strings'/><category term='sh'/><category term='facebook'/><category term='growl'/><category term='screen'/><category term='virtualbox'/><category term='emacs'/><category term='docs'/><category term='cpan'/><category term='parse'/><category term='random'/><category term='macros'/><category term='files'/><category term='crankd'/><category term='ssh'/><category term='readline'/><category term='pdf'/><category term='tar'/><category term='text'/><category term='unix'/><category term='twitter'/><category term='network'/><category term='statistics'/><category term='cpp'/><category term='svn'/><title type='text'>Quick Scripts</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>54</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-5959254038620669219</id><published>2011-05-16T08:32:00.000-07:00</published><updated>2011-05-16T08:32:08.962-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='port'/><category scheme='http://www.blogger.com/atom/ns#' term='apps'/><category scheme='http://www.blogger.com/atom/ns#' term='osx'/><title type='text'>Installing xmgrace on Snow Lepoard</title><content type='html'>You want to install &lt;a href="http://plasma-gate.weizmann.ac.il/Grace/"&gt;grace (xmgrace)&lt;/a&gt; on Snow Leopard, but all the information that you find online is obsolete and confusing.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Make sure you have &lt;a href="http://www.macports.org/"&gt;MacPorts&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;code&gt;&amp;gt; sudo port install grace&lt;/code&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-5959254038620669219?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/5959254038620669219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=5959254038620669219' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5959254038620669219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5959254038620669219'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2011/05/installing-xmgrace-on-snow-lepoard.html' title='Installing xmgrace on Snow Lepoard'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-8058001942169383506</id><published>2011-04-29T06:15:00.000-07:00</published><updated>2011-06-05T23:33:02.445-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='spanish'/><title type='text'>¿Se escribe con o sin acento?</title><content type='html'>&lt;table cellspacing="10"&gt;&lt;tr&gt;&lt;th&gt;Con acento&lt;/th&gt;&lt;th&gt;Sin acento&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td&gt;por qué - why, el porqué - the reason&lt;/td&gt; &lt;td&gt;porque - because&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;sí - yes, sí mismo - oneself&lt;/td&gt; &lt;td&gt;si - if&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;sólo - only&lt;/td&gt; &lt;td&gt;solo - alone&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;tú - you&lt;/td&gt; &lt;td&gt;tu - your&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-8058001942169383506?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/8058001942169383506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=8058001942169383506' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/8058001942169383506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/8058001942169383506'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2011/04/se-escribe-con-o-sin-acento.html' title='¿Se escribe con o sin acento?'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-850347871408614607</id><published>2011-03-22T12:13:00.000-07:00</published><updated>2011-03-22T12:13:42.466-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='crankd'/><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='launchd'/><category scheme='http://www.blogger.com/atom/ns#' term='osx'/><title type='text'>Run script in OS X on network connection</title><content type='html'>You want to automatically run a script in OS X every time there is an update in your network connection (e.g. going on- and offline). In particular you may want to run a script to gather information about your environment, guess your current location and execute some tasks accordingly. Also, for some weird reason, you don't want to use an application such as &lt;a href="http://www.symonds.id.au/marcopolo/"&gt;MarcoPolo&lt;/a&gt; or &lt;a href="http://www.griffintechnology.com/products/proxi"&gt;Proxi&lt;/a&gt; in order to do this.&lt;br /&gt;&lt;br /&gt;By far the most reliable way to do this is using &lt;a href="http://code.google.com/p/pymacadmin/"&gt;crankd&lt;/a&gt; that, in a very similar way to &lt;a href="http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man5/launchd.plist.5.html#//apple_ref/doc/man/5/launchd.plist"&gt;launchd&lt;/a&gt;, allows you to run scripts in response to events such as network changes, filesystem activity, and application launching. The process to get started is not terribly complicated, but you need to be careful following instructions.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Download and install &lt;a href="http://code.google.com/p/pymacadmin/"&gt;PyMacAdmin&lt;/a&gt;, this includes &lt;b&gt;crankd&lt;/b&gt;.&lt;/li&gt;&lt;li&gt;Once installed, open a terminal and run &lt;code&gt;/usr/local/sbin/crankd.py&lt;/code&gt;. For some reason on my computer it crashes with an error about an undefined &lt;code&gt;NSNotificationHandler&lt;/code&gt;, however you can safely disregard that. If it didn't crash type Ctrl+C to exit the program. The important point is that it would have created an example configuration file in:&lt;br /&gt;&lt;code&gt;~/Library/Preferences/com.googlecode.pymacadmin.crankd.plist&lt;/code&gt;.&lt;/li&gt;&lt;li&gt;Open the configuration file in a text editor and modify it so that it looks like the following:&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple Computer//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;dict&amp;gt;&lt;br /&gt;    &amp;lt;key&amp;gt;SystemConfiguration&amp;lt;/key&amp;gt;&lt;br /&gt;    &amp;lt;dict&amp;gt;&lt;br /&gt;        &amp;lt;key&amp;gt;State:/Network/Global/IPv4&amp;lt;/key&amp;gt;&lt;br /&gt;        &amp;lt;dict&amp;gt;&lt;br /&gt;            &amp;lt;key&amp;gt;command&amp;lt;/key&amp;gt;&lt;br /&gt;            &amp;lt;string&amp;gt;&lt;b&gt;/absolute/path/to/your/script&lt;/b&gt;&amp;lt;/string&amp;gt;&lt;br /&gt;        &amp;lt;/dict&amp;gt;&lt;br /&gt;    &amp;lt;/dict&amp;gt;&lt;br /&gt;&amp;lt;/dict&amp;gt;&lt;br /&gt;&amp;lt;/plist&amp;gt;&lt;/pre&gt;&lt;/code&gt;&lt;/li&gt;&lt;li&gt;This will cause your script to be called every time that there is a change in your connection, in particular when going on- and offline. If you want to test and debug your script, you can go back to your terminal and run &lt;code&gt;/usr/local/sbin/crankd.py&lt;/code&gt;. On the output you will also get sensible messages about what &lt;b&gt;crankd&lt;/b&gt; is doing. Try turning on/off your wireless connection, or plugging and unplugging your ethernet cable.&lt;/li&gt;&lt;li&gt;If everything seems to work, now you probably would like to have your system automatically run and keep alive the &lt;b&gt;crankd&lt;/b&gt; daemon. For this we use, as usual, &lt;b&gt;launchd&lt;/b&gt;. Create a new file such as &lt;code&gt;~/Library/LaunchAgents/org.crankd.plist&lt;/code&gt; with the following contents:&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;dict&amp;gt;&lt;br /&gt;    &amp;lt;key&amp;gt;KeepAlive&amp;lt;/key&amp;gt;&lt;br /&gt;    &amp;lt;true/&amp;gt;&lt;br /&gt;    &amp;lt;key&amp;gt;Label&amp;lt;/key&amp;gt;&lt;br /&gt;    &amp;lt;string&amp;gt;org.crankd.plist&amp;lt;/string&amp;gt;&lt;br /&gt;    &amp;lt;key&amp;gt;ProgramArguments&amp;lt;/key&amp;gt;&lt;br /&gt;    &amp;lt;array&amp;gt;&lt;br /&gt;        &amp;lt;string&amp;gt;/usr/local/sbin/crankd.py&amp;lt;/string&amp;gt;&lt;br /&gt;    &amp;lt;/array&amp;gt;&lt;br /&gt;    &amp;lt;key&amp;gt;RunAtLoad&amp;lt;/key&amp;gt;&lt;br /&gt;    &amp;lt;true/&amp;gt;&lt;br /&gt;&amp;lt;/dict&amp;gt;&lt;br /&gt;&amp;lt;/plist&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;To start the daemon right now, type the following on the terminal:&lt;br /&gt;&lt;code&gt;&amp;gt; launchctl load ~/Library/LaunchAgents/org.crankd.plist&lt;/code&gt;&lt;/li&gt;&lt;li&gt;That's it. Turn your connection on/off to check that your script is working properly. The daemon will also be automatically started the next time you restart your computer.&lt;/li&gt;&lt;/ol&gt;By the way, if you are reading this you probably also want to know how, within your script, to detect whether you have an active connection and, if you do have a connection, to somehow guess your current location. Some good ideas are to check the contents of the file &lt;code&gt;/etc/resolv.conf&lt;/code&gt; (the file doesn't exist if you're offline), or to have a look at the output from &lt;code&gt;ifconfig&lt;/code&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-850347871408614607?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/850347871408614607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=850347871408614607' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/850347871408614607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/850347871408614607'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2011/03/run-script-in-os-x-on-network.html' title='Run script in OS X on network connection'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-2826927717932031355</id><published>2011-02-28T06:11:00.000-08:00</published><updated>2011-11-03T10:05:49.073-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='facebook'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>Use a perl script and the Graph API to access your own Facebook account</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://shareicons.com/" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="64" src="http://navarroj.com/stuff/share-icon-128x128.png" width="64" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;You want to create a script to read messages and post status updates to your own Facebook account, but you find the official documentation confusing and you aren't sure where to start. Search no more because here you'll find the easiest way to do just this.&lt;/p&gt;The process is actually fairly simple, and recent updates to the &lt;a href="https://developers.facebook.com/tools/explorer/" target="_blank"&gt;Graph API explorer&lt;/a&gt; have made it dead easy:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;If you haven’t done so, visit &lt;a href="http://www.facebook.com/developers/apps.php" target="_blank"&gt;your applications page on Facebook&lt;/a&gt; to create a new application. The default settings are fine, so you can leave them unchanged.&lt;/li&gt;&lt;li&gt;Visit the &lt;a href="https://developers.facebook.com/tools/explorer/" target="_blank"&gt;Graph API explorer&lt;/a&gt; and on the top right corner choose your application. Click on the “Get access token” button, select the permissions you want to give to your application (depending on what you want to do you’ll probably need &lt;code&gt;offline_access&lt;/code&gt;, &lt;code&gt;read_stream&lt;/code&gt; and &lt;code&gt;publish_stream&lt;/code&gt;), then confirm to get &lt;b&gt;your access token&lt;/b&gt;. Copy and paste this value into the example code bellow.&lt;/li&gt;&lt;li&gt;That’s it! Now you can go and call any of the allowed methods from the &lt;a href="http://developers.facebook.com/docs/reference/api/" target="_blank"&gt;Facebook Graph API&lt;/a&gt;. Also make sure to &lt;a href="http://stackoverflow.com/questions/6214535/what-is-the-difference-between-feed-posts-and-statuses-in-facebook-graph-api/7983267#7983267"&gt;understand the difference between &lt;b&gt;/home&lt;/b&gt;, &lt;b&gt;/posts&lt;/b&gt;, &lt;b&gt;/feed&lt;/b&gt;, and &lt;b&gt;/statuses&lt;/b&gt;&lt;/a&gt;.&lt;/li&gt;&lt;/ol&gt;The following example code shows how to read posts from your news feed and post a new message to your own wall:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;#!/usr/bin/perl&lt;br /&gt;&lt;br /&gt;use strict;&lt;br /&gt;use warnings;&lt;br /&gt;use open qw(:std :utf8);&lt;br /&gt;use LWP::Simple;&lt;br /&gt;use YAML::Tiny;&lt;br /&gt;use JSON;&lt;br /&gt;use URI;&lt;br /&gt;use utf8;&lt;br /&gt;&lt;br /&gt;my $access_token = '&lt;b&gt;YOUR_ACCESS_TOKEN&lt;/b&gt;';&lt;br /&gt;&lt;br /&gt;# Fetch your News Feed from Facebook&lt;br /&gt;my $resp = graph_api('me/home', { access_token =&amp;gt; $access_token });&lt;br /&gt;for my $post (@{ $resp-&amp;gt;{data} }) {&lt;br /&gt;  # do something with each $post&lt;br /&gt;  print Dump($post);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;# Publish a new message to your own wall&lt;br /&gt;graph_api('me/feed', {&lt;br /&gt;  access_token =&amp;gt; $access_token,&lt;br /&gt;  message      =&amp;gt; 'Hello World! I’m posting Facebook updates from a script!',&lt;br /&gt;  link         =&amp;gt; 'http://qscripts.blogspot.com/2011/02/post-to-your-own-facebook-account-from.html',&lt;br /&gt;  picture      =&amp;gt; 'http://navarroj.com/stuff/share-icon-128x128.png',&lt;br /&gt;  name         =&amp;gt; 'Post to your own Facebook account from a script',&lt;br /&gt;  caption      =&amp;gt; 'qscripts.blogspot.com',&lt;br /&gt;  description  =&amp;gt; 'You want to create a script to read messages and post status updates to your own '&lt;br /&gt;                . 'Facebook account, but you find the official documentation confusing and '&lt;br /&gt;                . 'you aren’t sure where to start. Search no more because here you’ll find '&lt;br /&gt;                . 'the easiest way to do just this.',&lt;br /&gt;  method       =&amp;gt; 'post'&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;exit 0;&lt;br /&gt;&lt;br /&gt;sub graph_api {&lt;br /&gt;  my $uri = new URI('https://graph.facebook.com/' . shift);&lt;br /&gt;  $uri-&amp;gt;query_form(shift);&lt;br /&gt;  my $resp = get("$uri");&lt;br /&gt;  return defined $resp ? decode_json($resp) : undef;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Note that, to be able to make secure https requests, you'll also need to have installed either &lt;a href="http://search.cpan.org/perldoc?Net::SSL"&gt;Net::SSL&lt;/a&gt; or &lt;a href="http://search.cpan.org/perldoc?LWP::Protocol::https"&gt;LWP::Protocol::https&lt;/a&gt;. Finally, if everything works, you should be able to see something like this posted on your wall.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh6.googleusercontent.com/-y3tqsbl_8gE/TWu7W8-DeiI/AAAAAAAAndw/z6Ch0d2YC_c/s1600/fbpost.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://lh6.googleusercontent.com/-y3tqsbl_8gE/TWu7W8-DeiI/AAAAAAAAndw/z6Ch0d2YC_c/s1600/fbpost.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;You’re welcome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-2826927717932031355?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/2826927717932031355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=2826927717932031355' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/2826927717932031355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/2826927717932031355'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2011/02/post-to-your-own-facebook-account-from.html' title='Use a perl script and the Graph API to access your own Facebook account'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh6.googleusercontent.com/-y3tqsbl_8gE/TWu7W8-DeiI/AAAAAAAAndw/z6Ch0d2YC_c/s72-c/fbpost.png' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-4836692816492627312</id><published>2011-02-24T08:33:00.000-08:00</published><updated>2011-02-24T08:34:29.676-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='feeds'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>An Explosm RSS feed that doesn't suck</title><content type='html'>I am a huge fan of &lt;a href="http://explosm.net/"&gt;Explosm.net&lt;/a&gt; and &lt;a href="http://www.explosm.net/comics/new/"&gt;their awesome comics&lt;/a&gt;, but their RSS feed sucks so I made my own.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Feel free to subscribe to my &lt;a href="http://navarroj.com/feeds/explosm.xml"&gt;Explosm RSS feed&lt;/a&gt;.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;It basically features comic/forum content directly into the feed, and no “distracting you” comic if your reader happens to fetch the feed before the actual content is published at the site.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.explosm.net/comics/new/" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-HovhQhwiOTg/TWaHuqSCxsI/AAAAAAAAndE/Xt_aLM_h6S4/s1600/placeholder.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-4836692816492627312?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/4836692816492627312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=4836692816492627312' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/4836692816492627312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/4836692816492627312'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2011/02/explosm-rss-feed-that-doesnt-suck.html' title='An Explosm RSS feed that doesn&apos;t suck'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-HovhQhwiOTg/TWaHuqSCxsI/AAAAAAAAndE/Xt_aLM_h6S4/s72-c/placeholder.gif' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-510485440638782002</id><published>2011-02-04T09:06:00.000-08:00</published><updated>2011-02-04T09:06:20.305-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='launchd'/><category scheme='http://www.blogger.com/atom/ns#' term='osx'/><title type='text'>launchd: Start and keep alive a script in OS X</title><content type='html'>You want to start a script, and make sure it always keeps running in the background.&lt;br /&gt;&lt;br /&gt;First write a file &lt;code&gt;org.myscript.plist&lt;/code&gt; containing:&lt;br /&gt;&lt;pre style="overflow-x: scroll;"&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&amp;gt;&lt;br /&gt;&amp;lt;plist version="1.0"&amp;gt;&lt;br /&gt;&amp;lt;dict&amp;gt;&lt;br /&gt;        &amp;lt;key&amp;gt;KeepAlive&amp;lt;/key&amp;gt;&lt;br /&gt;        &amp;lt;true/&amp;gt;&lt;br /&gt;        &amp;lt;key&amp;gt;Label&amp;lt;/key&amp;gt;&lt;br /&gt;        &amp;lt;string&amp;gt;org.myscript&amp;lt;/string&amp;gt;&lt;br /&gt;        &amp;lt;key&amp;gt;ProgramArguments&amp;lt;/key&amp;gt;&lt;br /&gt;        &amp;lt;array&amp;gt;&lt;br /&gt;                &amp;lt;string&amp;gt;/path/to/my/script.sh&amp;lt;/string&amp;gt;&lt;br /&gt;        &amp;lt;/array&amp;gt;&lt;br /&gt;&amp;lt;/dict&amp;gt;&lt;br /&gt;&amp;lt;/plist&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Copy or move your file into &lt;code&gt;~/Library/LaunchAgents/&lt;/code&gt; and then run&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&amp;gt; launchctl load org.myscript&lt;/code&gt;&lt;/pre&gt;and use something like&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&amp;gt; launchctl list | grep myscript&lt;/code&gt;&lt;/pre&gt;if you want to very that it is indeed running.&lt;br /&gt;&lt;br /&gt;The script will continue to run forever, restarted if necessary, even after you login/logout of your user session.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-510485440638782002?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/510485440638782002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=510485440638782002' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/510485440638782002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/510485440638782002'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2011/02/launchd-start-and-keep-alive-script-in.html' title='launchd: Start and keep alive a script in OS X'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-5413816945136407431</id><published>2011-02-04T08:04:00.000-08:00</published><updated>2011-02-04T08:04:44.455-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='growl'/><category scheme='http://www.blogger.com/atom/ns#' term='feeds'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Perl: Growl notifications for new feed/rss items</title><content type='html'>You want to monitor a web feed and show Growl notifications on your desktop when new items are published. Further, you want to be able to click on a notification to open the relevant link on your default web browser. Also, for some rather bizarre reason, you don't want to use &lt;a href="http://edotstudios.com/products/9"&gt;RSS Menu&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In my case the reason was that I don't want to track the “read/unread” status of individual items. I found it distracting, because I was always going to click on “Mark all read” after each batch of new items arrived. This perl script gives items in the feed a one off chance to grab your attention and make you click on it. Otherwise the item is gone into oblivion and you never get to hear about it again.&lt;br /&gt;&lt;br /&gt;Using &lt;a href="http://search.cpan.org/perldoc?Cocoa::EventLoop"&gt;Cocoa::EventLoop&lt;/a&gt; and &lt;a href="http://search.cpan.org/perldoc?Cocoa::Growl"&gt;Cocoa::Growl&lt;/a&gt; it was actually rather simple. And this script can also work as a skeleton for any program where you want to post Growl notifications and do something on the click callback.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;pre&gt;#!/usr/bin/perl -w&lt;br /&gt;&lt;br /&gt;use strict;&lt;br /&gt;use Cocoa::EventLoop;&lt;br /&gt;use Cocoa::Growl ':all';&lt;br /&gt;use LWP::Simple;&lt;br /&gt;use XML::Simple;&lt;br /&gt;&lt;br /&gt;die "Growl is not running.\n" unless growl_running();&lt;br /&gt;&lt;br /&gt;my $feed  = 'http://tex.stackexchange.com/feeds';&lt;br /&gt;my $local = 'tex.se.xml';&lt;br /&gt;my $last  = '';&lt;br /&gt;&lt;br /&gt;growl_register(&lt;br /&gt;  app           =&gt; 'FeedGrowl',&lt;br /&gt;  icon          =&gt; 'http://tex.stackexchange.com/favicon.ico',&lt;br /&gt;  notifications =&gt; ['New feed item'],&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;my $timer = Cocoa::EventLoop-&gt;timer(&lt;br /&gt;  interval =&gt; 300, # every five minutes&lt;br /&gt;  cb       =&gt; \&amp;refresh_feed&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;Cocoa::EventLoop-&gt;run;&lt;br /&gt;&lt;br /&gt;exit 0;&lt;br /&gt;&lt;br /&gt;sub refresh_feed {&lt;br /&gt;  mirror($feed, $local);&lt;br /&gt;  my $data = (XMLin($local, keyattr =&gt; [], ForceArray =&gt; ['entry']))-&gt;{'entry'};&lt;br /&gt;  return unless @$data;&lt;br /&gt;  &lt;br /&gt;  my $i = 0;&lt;br /&gt;  for my $item (@$data) {&lt;br /&gt;    last if $item-&gt;{'updated'} le $last;&lt;br /&gt;    $i++;&lt;br /&gt;    notify_new_item($item-&gt;{'title'}-&gt;{'content'}, $item-&gt;{'link'}-&gt;{'href'});&lt;br /&gt;    last if $i == 5; # show at most 5 new items&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  $last = $data-&gt;[0]-&gt;{'updated'};&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sub notify_new_item {&lt;br /&gt;  my ($item, $link) = @_;&lt;br /&gt;  my $open_link = eval "sub { system('open', '$link') }";&lt;br /&gt;  growl_notify(&lt;br /&gt;    name        =&gt; 'New feed item',&lt;br /&gt;    title       =&gt; 'New item on TeX.se',&lt;br /&gt;    description =&gt; $item,&lt;br /&gt;    on_click    =&gt; $open_link&lt;br /&gt;  );  &lt;br /&gt;}&lt;/pre&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-5413816945136407431?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/5413816945136407431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=5413816945136407431' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5413816945136407431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5413816945136407431'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2011/02/perl-growl-notifications-for-new.html' title='Perl: Growl notifications for new feed/rss items'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-2113387283126482496</id><published>2011-01-29T09:07:00.000-08:00</published><updated>2011-01-29T09:07:05.613-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='screen'/><category scheme='http://www.blogger.com/atom/ns#' term='sh'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><title type='text'>Using screen to leave uninterrupted processes</title><content type='html'>You want to leave a process running (often on a remote computer), and you want the process to keep running even if you close the terminal session (often running on a local computer).&lt;br /&gt;&lt;br /&gt;First start a screen session using&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&amp;gt; screen -S [name]&lt;/pre&gt;&lt;/code&gt;where &lt;code&gt;[name]&lt;/code&gt; is any meaningful identifier for you to remember.&lt;br /&gt;&lt;br /&gt;Now you can start your processes, and close the terminal window if you want to.&lt;br /&gt;&lt;br /&gt;Later, to recover your session use&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&amp;gt; screen -d -r [name]&lt;/pre&gt;&lt;/code&gt;so that you can get your session back and monitor the processes that you left running.&lt;br /&gt;&lt;br /&gt;If you forget the name of your screen session, you can also always type&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&amp;gt; screen -ls&lt;/pre&gt;&lt;/code&gt;to see a list of all the currently active “screens”.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-2113387283126482496?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/2113387283126482496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=2113387283126482496' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/2113387283126482496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/2113387283126482496'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2011/01/using-screen-to-leave-uninterrupted.html' title='Using screen to leave uninterrupted processes'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-521026622530094429</id><published>2011-01-28T10:04:00.000-08:00</published><updated>2011-04-12T02:43:20.224-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='images'/><category scheme='http://www.blogger.com/atom/ns#' term='osx'/><title type='text'>Convert PS to PDF to JPG/PNG/etc on the command line on OSX</title><content type='html'>&lt;code&gt;&lt;pre&gt;&amp;gt; ps2pdf figure.ps&lt;br /&gt;&amp;gt; sips -s format jpeg figue.pdf --out figure.jpg&lt;/pre&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-521026622530094429?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/521026622530094429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=521026622530094429' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/521026622530094429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/521026622530094429'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2011/01/convert-ps-to-pdf-to-jpgpngetc-on.html' title='Convert PS to PDF to JPG/PNG/etc on the command line on OSX'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-1861143175921747465</id><published>2011-01-27T04:12:00.000-08:00</published><updated>2011-01-27T04:12:39.602-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Perl: die if child process is interrupted</title><content type='html'>&lt;p&gt;You are using &lt;code&gt;system&lt;/code&gt; to run a child process, and you would like your program to terminate if the process happens to be interrupted, e.g. by pressing &lt;code&gt;Ctrl+C&lt;/code&gt;.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;die "Child process terminated\n" if system($cmd) &amp;amp; 127 == 2;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In general &lt;code&gt;system($cmd) &amp;amp; 127&lt;/code&gt; is the signal number, if any, that caused the child process to terminate.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-1861143175921747465?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/1861143175921747465/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=1861143175921747465' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/1861143175921747465'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/1861143175921747465'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2011/01/perl-die-if-child-process-is.html' title='Perl: die if child process is interrupted'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-5488886719622418220</id><published>2010-06-09T06:26:00.000-07:00</published><updated>2010-06-09T06:33:35.217-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sh'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><title type='text'>Create a new rails project and add to svn (with adequate ignores)</title><content type='html'>You want to create a new rails project and add it to your svn repository, but ignoring log and temp files. &lt;br /&gt;&lt;br /&gt;What you actually have to do is first create the project with rails, then slowly add folders (e.g. using &amp;ldquo;&lt;code&gt;svn add -N myapp/log&lt;/code&gt;&amp;rdquo;) and set their appropriate ignore properties (e.g. using &amp;ldquo;&lt;code&gt;svn propset svn:ignore "*.log" myapp/log&lt;/code&gt;&amp;rdquo;). Finally you can add all the remaining unversioned files and folders before making your initial commit.&lt;br /&gt;&lt;br /&gt;For convenience, I've put all these commands into a &lt;a href="http://navarroj.com/stuff/svn-rails"&gt;svn-rails&lt;/a&gt; shell script which can then be run as&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&amp;gt; svn-rails myapp&lt;/code&gt;&lt;/pre&gt;to do all the required stuff.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-5488886719622418220?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/5488886719622418220/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=5488886719622418220' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5488886719622418220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5488886719622418220'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2010/06/create-new-rails-project-and-add-to-svn.html' title='Create a new rails project and add to svn (with adequate ignores)'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-1366460569919943226</id><published>2010-06-03T08:26:00.000-07:00</published><updated>2010-07-04T23:37:33.562-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='xhtml'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Embed YouTube video as valid XHTML 1.0</title><content type='html'>You want to embed a YouTube video in your XHTML 1.0 document, but the code that YouTube gives you does not validate. Instead, use something like&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&amp;lt;object type="application/x-shockwave-flash" width="480" height="385"&lt;br /&gt;data="http://www.youtube.com/v/_ZG8HBuDjgc"&amp;gt;&amp;lt;param name="movie"&lt;br /&gt;value="http://www.youtube.com/v/_ZG8HBuDjgc" /&amp;gt;&amp;lt;param name="wmode"&lt;br /&gt;value="transparent" /&amp;gt;&amp;lt;/object&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-1366460569919943226?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/1366460569919943226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=1366460569919943226' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/1366460569919943226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/1366460569919943226'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2010/06/embed-youtube-video-as-valid-xtml-10.html' title='Embed YouTube video as valid XHTML 1.0'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-7558362004188677343</id><published>2010-05-25T09:20:00.000-07:00</published><updated>2010-11-16T05:46:14.700-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osx'/><category scheme='http://www.blogger.com/atom/ns#' term='shortcuts'/><title type='text'>Take screenshots on OS X</title><content type='html'>To take screenshots (screen captures) on Apple Mac OS X use one of the shortcuts:&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Command-Shift-3&lt;/td&gt;&lt;td&gt;&amp;nbsp; &amp;nbsp;&lt;/td&gt;&lt;td&gt;Capture the entire screen to a file on the desktop&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Command-Shift-4&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;Capture a selection to a file on the desktop&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Control-Command-Shift-3&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;Capture the entire screen to the clipboard&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Control-Command-Shift-4&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;Capture a selection to the clipboard&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-7558362004188677343?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/7558362004188677343/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=7558362004188677343' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/7558362004188677343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/7558362004188677343'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2010/05/take-screenshots-on-os-x.html' title='Take screenshots on OS X'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-6315424075576996219</id><published>2010-05-11T06:08:00.000-07:00</published><updated>2010-05-11T06:49:47.325-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='prolog'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='parse'/><title type='text'>Parse Prolog-like terms in Perl</title><content type='html'>Use &lt;a href="http://search.cpan.org/search?query=Parse::RecDescent"&gt;Parse::RecDescent&lt;/a&gt; to parse a Prolog-like term from a string. The given example parser will read a term (and its subterms) and return a lisp-like array reference of the form: [&lt;span class="Apple-style-span" style="color: #783f04;"&gt;atom&lt;/span&gt;, &lt;span class="Apple-style-span" style="color: #783f04;"&gt;terms*&lt;/span&gt;]; where &lt;span class="Apple-style-span" style="color: #783f04;"&gt;atom&lt;/span&gt; is a string scalar and each argument (if any) is itself a term given again as a lisp-like array reference. A reverse, &lt;code&gt;term_str&lt;/code&gt;, is also provided as an example on how to recursively process such term structures.&lt;br /&gt;&lt;pre&gt;use Parse::RecDescent;&lt;br /&gt;&lt;br /&gt;my $parser = Parse::RecDescent-&gt;new(q(&lt;br /&gt;  terms  : &amp;lt;leftop: term ',' term&amp;gt;&lt;br /&gt;  term   : atom '(' terms ')' &amp;lt;commit&amp;gt;&lt;br /&gt;           { $return = $item{terms}; unshift @$return, $item{atom}; }&lt;br /&gt;         | atomic&lt;br /&gt;           { $return = [$item{atomic}] }&lt;br /&gt;  atomic : atom | num&lt;br /&gt;  atom   : /[a-zA-Z_]+/&lt;br /&gt;  num    : /\d+/&lt;br /&gt;));&lt;br /&gt;&lt;br /&gt;sub term_str {&lt;br /&gt;  my @arg = @{ shift @_ };&lt;br /&gt;  my $fun = shift @arg;&lt;br /&gt;  # here $fun and @arg hold their expected values &lt;br /&gt;  return $fun unless @arg; # nulary term&lt;br /&gt;  for my $a (@arg) { $a = term_str($a) } # process arguments recursively&lt;br /&gt;  return $fun . "[" . join (",", @arg) . "]";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;print term_str($parser-&amp;gt;term('ls(s(p),q,d(x,p))'));&lt;br /&gt;# outputs: ls[s[p],q,d[x,p]]&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-6315424075576996219?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/6315424075576996219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=6315424075576996219' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/6315424075576996219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/6315424075576996219'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2010/05/parse-prolog-like-terms-in-perl.html' title='Parse Prolog-like terms in Perl'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-829999028892415379</id><published>2010-05-07T07:12:00.000-07:00</published><updated>2010-05-31T06:05:22.622-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='virtualbox'/><title type='text'>Share a folder between a host and a virtual guest OS</title><content type='html'>Using &lt;a href="http://www.virtualbox.org/"&gt;VirtualBox&lt;/a&gt;, you want to share a folder between the host OS and a virtual guest OS. The following instructions are for a Linux guest OS. For other systems the process should be similar just RTFM (Help &amp;rarr; Contents...) for the details.&lt;br /&gt;&lt;br /&gt;First you have to install the &amp;ldquo;Guest Additions&amp;rdquo;:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Start the virtual machine, make its window active and select the menu option &amp;ldquo;Devices &amp;rarr; Install Guest Additions...&amp;rdquo;.&lt;/li&gt;&lt;li&gt;This should mount a virtual CD with the additions from where you can install them.&lt;/li&gt;&lt;li&gt;If installation didn't start automatically, try on a terminal&lt;pre&gt;&amp;gt; cd /cdrom/&lt;br /&gt;&amp;gt; ./autorun.sh&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Upon successful installation, reboot the virtual machine.&lt;/li&gt;&lt;/ol&gt;Now you can share a folder:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Crate a folder on the host OS, e.g. &lt;code&gt;host/shared/folder&lt;/code&gt;, and put some files in there.&lt;/li&gt;&lt;li&gt;Run the virtual machine with the guest OS.&lt;/li&gt;&lt;li&gt;On the menu of the virtual machine select &amp;ldquo;Devices &amp;rarr; Shared Folders...&amp;rdquo;.&lt;/li&gt;&lt;li&gt;Add a new shared folder with the path to your &lt;code&gt;host/shared/folder&lt;/code&gt; and an appropriate name like &lt;code&gt;host-shared&lt;/code&gt;.&lt;/li&gt;&lt;li&gt;On the guest OS, create a corresponding folder and mount the new device there&lt;pre&gt;&amp;gt; mkdir guest/mount/point&lt;br /&gt;&amp;gt; sudo mount -t vboxsf host-shared guest/mount/point&lt;/pre&gt;&lt;/li&gt;&lt;/ol&gt;If everything works you should be able to &lt;code&gt;cd&lt;/code&gt; to the newly mounted folder and see the files from your host.&lt;br /&gt;&lt;br /&gt;You might want the shared folder to be automatically mounted when booting the virtual machine. If so, edit the &lt;code&gt;/etc/fstab&lt;/code&gt; file (you need privileges) and add the following line to the end&lt;pre&gt;host-shared /guest/mount/point vboxsf defaults 0 0&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-829999028892415379?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/829999028892415379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=829999028892415379' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/829999028892415379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/829999028892415379'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2010/05/setup-shared-folder-between-host-and.html' title='Share a folder between a host and a virtual guest OS'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-3700747678387135025</id><published>2010-05-07T06:14:00.000-07:00</published><updated>2011-02-09T05:56:34.997-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cpan'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>CPAN as non-root user</title><content type='html'>Forget about trying to configure &lt;code&gt;cpan&lt;/code&gt; as a non-root user. The easiest solution is to &lt;a href="http://qscripts.blogspot.com/2008/09/installing-cpan-module.html"&gt;use cpanm to install your packages&lt;/a&gt; and forget about it.&lt;br /&gt;&lt;br /&gt;So go and click that link. Now.&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;Ok, for some rather bizarre reason, you insist on configuring &lt;code&gt;cpan&lt;/code&gt; as non-root and you're still reading this. So, let's do it.&lt;br /&gt;&lt;br /&gt;First, to set up the PERL5LIB environment variable, add the following to your &lt;code&gt;~/.bash_profile&lt;/code&gt; or equivalent:&lt;br /&gt;&lt;pre&gt;PERL5LIB=~/perl5lib/lib/:$PERL5LIB&lt;br /&gt;PERL5LIB=~/perl5lib/share/perl/5.8.8:$PERL5LIB&lt;br /&gt;PERL5LIB=~/perl5lib/share/perl/5.8:$PERL5LIB&lt;br /&gt;PERL5LIB=~/perl5lib/lib/perl/5.8.8:$PERL5LIB&lt;br /&gt;PERL5LIB=~/perl5lib/lib/perl/5.8:$PERL5LIB&lt;br /&gt;export PERL5LIB&lt;/pre&gt;Reboot or source the file. Then, specially if you are having troubles, you might want to make sure that you are starting with a clean user instalation.&lt;br /&gt;&lt;pre&gt;&amp;gt; cd ~&lt;br /&gt;&amp;gt; rm -rf .cpan&lt;br /&gt;&amp;gt; rm -rf perl5lib&lt;/pre&gt;Create a folder to hold the modules, and start CPAN&lt;br /&gt;&lt;pre&gt;&amp;gt; mkdir perl5lib&lt;br /&gt;&amp;gt; cpan&lt;/pre&gt;Manual configuration should start, follow the instructions on screen, until at some point &lt;b&gt;the script asks you for any extra arguments for Makefile.PL&lt;/b&gt;. You should then supply&lt;br /&gt;&lt;pre&gt;PREFIX=~/perl5lib&lt;/pre&gt;When the configuration finishes, make sure CPAN tells you it has writen the updated configuration file. If everything seems fine, type &lt;code&gt;quit&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;To install a package now type&lt;br /&gt;&lt;pre&gt;cpan "Some::Module"&lt;/pre&gt;If things keep failing, you should probably consider doing a &lt;a href="http://qscripts.blogspot.com/2008/09/installing-cpan-module.html"&gt;manual package install&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Note: if for some reason your script will run in an environment where PERL5LIB is not (or cannot) be set, then your script should also include&lt;br /&gt;&lt;pre&gt;use lib '~/perl5lib/lib/';&lt;br /&gt;use lib '~/perl5lib/share/perl/5.8.8';&lt;br /&gt;use lib '~/perl5lib/share/perl/5.8';&lt;br /&gt;use lib '~/perl5lib/lib/perl/5.8.8';&lt;br /&gt;use lib '~/perl5lib/lib/perl/5.8';&lt;/pre&gt;But then, if you need this, you might also need to expand those &lt;code&gt;~&lt;/code&gt;'s into their actual absolute paths.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-3700747678387135025?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/3700747678387135025/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=3700747678387135025' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/3700747678387135025'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/3700747678387135025'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2009/08/cpan-as-non-root-user.html' title='CPAN as non-root user'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-3254043552048423189</id><published>2010-05-06T07:10:00.000-07:00</published><updated>2011-03-02T03:17:05.127-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='utf8'/><category scheme='http://www.blogger.com/atom/ns#' term='text'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Stay away from the utf8 mess in Perl</title><content type='html'>You are writing a Perl script that uses and manipulates data and/or text files with utf8 characters. Perl gives you sometimes weird error messages, funny characters show up in your output, and by searching out there you only get confusing and contradictory advice.&lt;br /&gt;&lt;br /&gt;If you think that &lt;b&gt;everything&lt;/b&gt; should be utf8 and you don't care about anybody using any other kind of encoding, simply include the following pragmas:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;use open qw/:std :utf8/; # all your input/output is utf8&lt;br /&gt;use utf8;                # your program file is utf8&lt;/code&gt;&lt;/pre&gt;For most cases this should be enough, and you should be able to forget about this stupid encoding business.&lt;br /&gt;&lt;br /&gt;Anyway, if somehow you manage to get a &lt;code&gt;$string&lt;/code&gt; that you know &lt;i&gt;is encoded as utf8&lt;/i&gt; but perl doesn't seem to realize this, yo should call&lt;br /&gt;&lt;pre&gt;&lt;code&gt;utf8::decode($string);&lt;/code&gt;&lt;/pre&gt;so that perl stores the string in its internal utf8 representation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-3254043552048423189?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/3254043552048423189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=3254043552048423189' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/3254043552048423189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/3254043552048423189'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2010/05/stay-away-from-utf8-mess-in-perl.html' title='Stay away from the utf8 mess in Perl'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-4699113211334356329</id><published>2010-05-06T05:46:00.000-07:00</published><updated>2011-03-02T04:05:43.499-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='twitter'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>Post to Twitter from Perl using a single access token</title><content type='html'>You want to post status updates to your own Twitter account from a Perl script. Because of the new Twitter API you need to authenticate using OAuth, but you don't want (nor need, nor care) to do the &amp;ldquo;OAuth token request&amp;rdquo; or whatever dance. &lt;u&gt;It's my own account, I just want to post!&lt;/u&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Go to &lt;a href="http://dev.twitter.com"&gt;dev.twitter.com&lt;/a&gt; and register a new application. From this you will obtain a &lt;b&gt;consumer key&lt;/b&gt; and a &lt;b&gt;consumer secret&lt;/b&gt;.&lt;/li&gt;&lt;li&gt;Once your app is registered, click on &amp;ldquo;My access token&amp;rdquo; on the details page of your application. From this you will obtain an &lt;b&gt;access token&lt;/b&gt; and an &lt;b&gt;access token secret&lt;/b&gt;.&lt;/li&gt;&lt;li&gt;Go and code in Perl using &lt;a href="http://search.cpan.org/perldoc?Net::Twitter::Lite"&gt;Net::Twitter::Lite&lt;/a&gt;.&lt;/li&gt;&lt;/ol&gt;Example code:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;use Net::Twitter::Lite;&lt;br /&gt;&lt;br /&gt;my $nt = Net::Twitter::Lite-&gt;new(&lt;br /&gt;  consumer_key        =&gt; 'your consumer key',&lt;br /&gt;  consumer_secret     =&gt; 'your consumer secret',&lt;br /&gt;  access_token        =&gt; 'your access token',&lt;br /&gt;  access_token_secret =&gt; 'your access token secret'&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;my $result = eval { $nt-&gt;update('Hello, World! http://goo.gl/zAbwc') };&lt;br /&gt;&lt;br /&gt;warn "$@\n" if $@;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-4699113211334356329?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/4699113211334356329/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=4699113211334356329' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/4699113211334356329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/4699113211334356329'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2010/05/post-to-twitter-from-perl-using-single.html' title='Post to Twitter from Perl using a single access token'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-1697455229440508453</id><published>2010-04-28T08:43:00.000-07:00</published><updated>2010-04-28T08:46:00.451-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='regexp'/><category scheme='http://www.blogger.com/atom/ns#' term='text'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Unescape tab and newline escapes</title><content type='html'>You want to use regular expressions in perl to turn the literal "\t" and "\n" character sequences into the actual &lt;i&gt;tab&lt;/i&gt; and &lt;i&gt;newline&lt;/i&gt; characters.&lt;br /&gt;&lt;br /&gt;The trivial solution doesn't work if you also want to allow the use of "\\" to escape the "escape" sequence (e.g. so that "\\node" expands to "\node", but "\\\n" does expand to a &lt;i&gt;backslash&lt;/i&gt; followed by a &lt;i&gt;newline&lt;/i&gt;).&lt;br /&gt;&lt;br /&gt;What you actually need, is something like&lt;code&gt;&lt;pre&gt;  s/\\(.)/\\$1]/g;&lt;br /&gt;  s/\\n]/\n/g;&lt;br /&gt;  s/\\t]/\t/g;&lt;br /&gt;  s/\\(.)]/$1/g;&lt;/pre&gt;&lt;/code&gt;&lt;b&gt;Small discussion:&lt;/b&gt; this first encapsulates every escape sequence "\X" into "\X]" so that the escaped "X" can not interfere with the rest of the string. Then you can evaluate all the escapes you want, e.g. turn "\n]" into a &lt;i&gt;newline&lt;/i&gt;. Finally all remaining "\X]" are expanded back to "X".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-1697455229440508453?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/1697455229440508453/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=1697455229440508453' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/1697455229440508453'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/1697455229440508453'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2010/04/unescape-tab-and-newline-escapes.html' title='Unescape tab and newline escapes'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-9039047257198046855</id><published>2010-04-23T10:18:00.000-07:00</published><updated>2010-06-15T11:48:50.688-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='awk'/><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><title type='text'>Add every unversioned file to version control</title><content type='html'>You want to recursively seek every unversioned file in a directory, and add them to your svn repository.&lt;br /&gt;&lt;br /&gt;First, to list the unversioned files, you can use&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&amp;gt; svn st | grep '^?'&lt;/code&gt;&lt;/pre&gt;and to add all of them to your repository&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&amp;gt; svn st | awk '($1 == "?") { print "svn add", $2 }' | sh&lt;/code&gt;&lt;/pre&gt;As usual, you might want to check for sanity and run first without the last &lt;code&gt;sh&lt;/code&gt; pipe.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-9039047257198046855?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/9039047257198046855/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=9039047257198046855' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/9039047257198046855'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/9039047257198046855'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2010/04/add-every-unversioned-file-to-version.html' title='Add every unversioned file to version control'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-3770234901882937014</id><published>2010-04-15T05:39:00.000-07:00</published><updated>2010-04-15T05:45:12.494-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='text'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Check if a file contains special (non-ascii) characters</title><content type='html'>To check if a file contains any special (non "standard" ascii) characters, use Perl and POSIX character classes. Depending on how permissive you want to be use one of:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;# allow only whitespace and standard ascii print characters (i.e. [\x20-\x7E])&lt;br /&gt;&amp;gt; perl -nwe 'print if /[^[:space:][:print:]]/' file.txt&lt;br /&gt;&lt;br /&gt;# also allow control characters (i.e. [\x00-\x7F])&lt;br /&gt;&amp;gt; perl -nwe 'print if /[^[:ascii:]]/' file.txt&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-3770234901882937014?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/3770234901882937014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=3770234901882937014' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/3770234901882937014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/3770234901882937014'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2010/04/check-if-file-contains-special-non.html' title='Check if a file contains special (non-ascii) characters'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-2963120880077259828</id><published>2010-03-09T05:13:00.001-08:00</published><updated>2010-03-09T05:17:00.216-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Locate which path/file is loaded for a Perl module</title><content type='html'>You want to figure out which is the source file being loaded for a given Perl module. Copy the code bellow in a file &lt;code&gt;whichpm&lt;/code&gt;, make it executable, and then use, e.g.,&lt;br /&gt;&lt;pre&gt;&amp;gt; whichpm Date::Manip&lt;br /&gt;/Library/Perl/5.10.0/Date/Manip.pm&lt;br /&gt;&lt;/pre&gt;Source of &lt;code&gt;whichpm&lt;/code&gt;:&lt;br /&gt;&lt;pre&gt;#!/usr/bin/perl -w&lt;br /&gt;$M = shift @ARGV;&lt;br /&gt;die "Usage:\n  whichpm Some::Module\n" unless defined $M;&lt;br /&gt;eval("use $M; 1") or die "Can't locate module $M in \@INC\n";&lt;br /&gt;$M =~ s|::|/|g;&lt;br /&gt;print $INC{"$M.pm"}, "\n";&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-2963120880077259828?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/2963120880077259828/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=2963120880077259828' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/2963120880077259828'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/2963120880077259828'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2010/03/locate-which-pathfile-is-loaded-for.html' title='Locate which path/file is loaded for a Perl module'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-277595929436478022</id><published>2010-03-03T09:53:00.000-08:00</published><updated>2010-03-03T09:53:05.021-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='date'/><title type='text'>Timestamps using ISO8601 strings</title><content type='html'>You want to generate timestamps, be able to store them, retrieve them and do math with them; but you don't really care about parsing (i.e. you're not reading user input, just manipulating timestamps that you created yourself). Use perl's &lt;a href="http://search.cpan.org/dist/DateTime/lib/DateTime.pm#SYNOPSIS"&gt;DateTime&lt;/a&gt; module, and the functions bellow to serialize and unserialize.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;use DateTime;&lt;br /&gt;&lt;br /&gt;sub now {&lt;br /&gt;  return DateTime-&gt;now(time_zone =&gt; 'UTC');&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sub date_str {&lt;br /&gt;  return $_[0]-&gt;iso8601();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sub str_date {&lt;br /&gt;  return undef unless $_[0] =~ m/^(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)$/;&lt;br /&gt;  return DateTime-&gt;new(&lt;br /&gt;           year       =&gt; $1,&lt;br /&gt;           month      =&gt; $2,&lt;br /&gt;           day        =&gt; $3,&lt;br /&gt;           hour       =&gt; $4,&lt;br /&gt;           minute     =&gt; $5,&lt;br /&gt;           second     =&gt; $6,&lt;br /&gt;           time_zone  =&gt; 'UTC'&lt;br /&gt;         );&lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-277595929436478022?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/277595929436478022/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=277595929436478022' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/277595929436478022'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/277595929436478022'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2010/03/timestamps-using-iso8601-strings.html' title='Timestamps using ISO8601 strings'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-5427415742689889501</id><published>2010-02-26T14:04:00.000-08:00</published><updated>2010-02-26T14:04:09.254-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><title type='text'>Change executable property of files under svn</title><content type='html'>You can not &amp;lsquo;chmod&amp;rsquo; files on svn, as changes in properties are not propagated to the svn server. To set or unset the executable propery on a versioned file use:&lt;br /&gt;&lt;pre&gt;&amp;gt; svn propset svn:executable on FILE&lt;br /&gt;&amp;gt; svn propdel svn:executable FILE&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-5427415742689889501?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/5427415742689889501/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=5427415742689889501' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5427415742689889501'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5427415742689889501'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2010/02/change-executable-property-of-files.html' title='Change executable property of files under svn'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-1069286712051789279</id><published>2010-02-11T11:31:00.000-08:00</published><updated>2010-02-11T11:31:44.807-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ssh'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>Use an ssh tunnel for web browsing</title><content type='html'>You want to surf the web as if, e.g., you were at your office's network but from your computer at home. If you can access the work computer through ssh at, say, user@example.com, then set up a tunnel using:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&amp;gt; ssh -ND 9999 user@example.com&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Then configure, e.g., Firefox as follows: Preferences &amp;rarr; Advanced &amp;rarr; Network &amp;rarr; Settings. Select &amp;ldquo;Manual proxy configuration&amp;rdquo;, enter &amp;ldquo;localhost&amp;rdquo; as &amp;ldquo;SOCKS Host&amp;rdquo; and &amp;ldquo;9999&amp;rdquo; as its corresponding &amp;ldquo;Port&amp;rdquo;.&lt;br /&gt;&lt;br /&gt;Accept the new settings and browse to, e.g., &lt;a href="http://www.ip-adress.com/"&gt;www.ip-adress.com&lt;/a&gt; to check that it's working.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-1069286712051789279?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/1069286712051789279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=1069286712051789279' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/1069286712051789279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/1069286712051789279'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2010/02/use-ssh-tunnel-for-web-browsing.html' title='Use an ssh tunnel for web browsing'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-4487909709060093977</id><published>2010-02-09T05:09:00.000-08:00</published><updated>2010-02-09T05:09:15.689-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sh'/><category scheme='http://www.blogger.com/atom/ns#' term='readline'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><title type='text'>"Readline" for any command line interface</title><content type='html'>To add "readline" functionality (e.g. keyword input editing, and command history) to any &lt;i&gt;command&lt;/i&gt; simply use&lt;br /&gt;&lt;code&gt;&amp;gt; rlwrap &lt;i&gt;command&lt;/i&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-4487909709060093977?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/4487909709060093977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=4487909709060093977' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/4487909709060093977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/4487909709060093977'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2010/02/readline-for-any-command-line-interface.html' title='&quot;Readline&quot; for any command line interface'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-4166884902436486789</id><published>2009-09-28T12:21:00.000-07:00</published><updated>2011-07-01T03:04:13.652-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ssh'/><title type='text'>Passwordless ssh</title><content type='html'>&lt;b&gt;On the local computer:&lt;/b&gt; if don't have them already, generate your private/public pair of keys&lt;br /&gt;&lt;code&gt;&lt;pre&gt;$ ssh-keygen -t rsa&lt;/pre&gt;&lt;/code&gt;Accept all the default options and when asked for a passphrase just press enter.&lt;br /&gt;&lt;br /&gt;This should create the two files&lt;br /&gt;&lt;code&gt;&lt;pre&gt;~/.ssh/id_rsa     - your private key&lt;br /&gt;~/.ssh/id_rsa.pub - your public key&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;b&gt;On the remote computer:&lt;/b&gt; if it doesn't exist already, create the &lt;code&gt;~/.ssh&lt;/code&gt; directory&lt;br /&gt;&lt;code&gt;&lt;pre&gt;$ mkdir ~/.ssh&lt;br /&gt;$ chmod 700 ~/.ssh&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;Finally append the contents of the local file &lt;code&gt;~/.ssh/id_rsa.pub&lt;/code&gt; to the remote file &lt;code&gt;~/.ssh/authorized_keys&lt;/code&gt;. For example, on the &lt;b&gt;local computer&lt;/b&gt;:&lt;br /&gt;&lt;code&gt;&lt;pre&gt;scp ~/.ssh/id_rsa.pub user@remote.example.com:.ssh/my_new_key&lt;/pre&gt;&lt;/code&gt;And then on the &lt;b&gt;remote computer&lt;/b&gt;:&lt;br /&gt;&lt;code&gt;&lt;pre&gt;cat ~/.ssh/my_new_key &gt;&gt; ~/.ssh/authorized_keys&lt;br /&gt;rm ~/.ssh/my_new_key&lt;/pre&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-4166884902436486789?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/4166884902436486789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=4166884902436486789' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/4166884902436486789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/4166884902436486789'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2009/09/passwordless-ssh.html' title='Passwordless ssh'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-2771732072812942988</id><published>2009-09-03T03:52:00.000-07:00</published><updated>2009-09-03T03:55:54.696-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><title type='text'>Remove Firefox/Iceweasel lock</title><content type='html'>If Firefox/Iceweasel is "already running, but is not responding", and you are sure it's really not running (e.g. after a clean boot), remove its lock with&lt;br /&gt;&lt;br /&gt;&lt;code&gt;rm -i ~/.mozilla/firefox/*/.parentlock ~/.mozilla/firefox/*/lock&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-2771732072812942988?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/2771732072812942988/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=2771732072812942988' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/2771732072812942988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/2771732072812942988'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2009/09/remove-firefoxiceweasel-lock.html' title='Remove Firefox/Iceweasel lock'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-482672215681085754</id><published>2009-02-26T03:52:00.000-08:00</published><updated>2009-02-26T04:07:31.907-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='files'/><category scheme='http://www.blogger.com/atom/ns#' term='awk'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><title type='text'>Chop "n" lines from the beginning/end of a file</title><content type='html'>You need some sort of "inverse" for the standard behavior of the head and tail commands, i.e., print everything but the first/last &lt;i&gt;n&lt;/i&gt; lines of a file. &lt;br /&gt;&lt;br /&gt;To skip the first &lt;i&gt;n&lt;/i&gt; = 10 lines of a file&lt;br /&gt;&lt;code&gt;$ awk '(NR &gt; 10)' file&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To print everything but the last &lt;i&gt;n&lt;/i&gt; = 10 lines of a file&lt;br /&gt;&lt;code&gt;$ head -n -10 file&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-482672215681085754?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/482672215681085754/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=482672215681085754' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/482672215681085754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/482672215681085754'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2009/02/chop-n-lines-from-beginningend-of-file.html' title='Chop &quot;n&quot; lines from the beginning/end of a file'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-8461693748734637286</id><published>2009-02-18T09:57:00.000-08:00</published><updated>2009-02-26T04:09:49.709-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='text'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><title type='text'>Make "less" show utf-8 characters</title><content type='html'>To make the &lt;a href="http://en.wikipedia.org/wiki/Less_(Unix)"&gt;less&lt;/a&gt; unix command properly display utf-8 characters, you might want to add the following to your .bash_profile&lt;br /&gt;&lt;code&gt;export LESSCHARSET=utf-8&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-8461693748734637286?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/8461693748734637286/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=8461693748734637286' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/8461693748734637286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/8461693748734637286'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2009/02/make-less-show-utf-8-characters.html' title='Make &quot;less&quot; show utf-8 characters'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-200752469758644853</id><published>2009-01-28T06:12:00.000-08:00</published><updated>2009-01-28T06:17:37.694-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='latex'/><category scheme='http://www.blogger.com/atom/ns#' term='awk'/><category scheme='http://www.blogger.com/atom/ns#' term='sh'/><category scheme='http://www.blogger.com/atom/ns#' term='texshop'/><title type='text'>Create TeXShop project</title><content type='html'>Quick hack to turn a directory into a TeXShop project (i.e. make all .tex files point to a single &lt;i&gt;project root&lt;/i&gt;).&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ls -1 *.tex | awk '{ print "/bin/echo -n \"main.tex\" &gt; " $1 "shop" }' | sh&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;to check for sanity you might want to run first without the &lt;tt&gt;sh&lt;/tt&gt; pipe at the end.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-200752469758644853?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/200752469758644853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=200752469758644853' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/200752469758644853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/200752469758644853'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2009/01/create-texshop-project.html' title='Create TeXShop project'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-4001911339535609576</id><published>2009-01-07T14:05:00.000-08:00</published><updated>2009-01-07T14:08:00.791-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='files'/><category scheme='http://www.blogger.com/atom/ns#' term='awk'/><category scheme='http://www.blogger.com/atom/ns#' term='sh'/><category scheme='http://www.blogger.com/atom/ns#' term='text'/><title type='text'>Add line numbers to a file</title><content type='html'>&lt;code&gt;&lt;br /&gt;awk '{print NR "\t" $0 }' input.txt&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-4001911339535609576?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/4001911339535609576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=4001911339535609576' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/4001911339535609576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/4001911339535609576'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2009/01/add-line-numbers-to-file.html' title='Add line numbers to a file'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-1421270707074941185</id><published>2008-11-27T02:44:00.000-08:00</published><updated>2008-11-27T02:52:07.291-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='files'/><category scheme='http://www.blogger.com/atom/ns#' term='sh'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><title type='text'>Shell output redirection</title><content type='html'>&lt;ul&gt;&lt;li&gt;stdout to file&lt;br /&gt;&lt;code&gt;command &gt; output.txt&lt;/code&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;stderr to file&lt;br /&gt;&lt;code&gt;command 2&gt; output.txt&lt;/code&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;stdout to stderr&lt;br /&gt;&lt;code&gt;command 1&gt;&amp;2&lt;/code&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;stderr to stdout&lt;br /&gt;&lt;code&gt;command 2&gt;&amp;1&lt;/code&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;stdout and stderr to file&lt;br /&gt;&lt;code&gt;command &amp;&gt; output.txt&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-1421270707074941185?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/1421270707074941185/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=1421270707074941185' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/1421270707074941185'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/1421270707074941185'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2008/11/shell-output-redirection.html' title='Shell output redirection'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-1307353811220023452</id><published>2008-11-23T03:50:00.000-08:00</published><updated>2008-11-23T04:39:46.505-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='date'/><title type='text'>Produce valid dates in RFC3339</title><content type='html'>In perl, to produce valid dates according to the &lt;a href="http://www.ietf.org/rfc/rfc3339.txt"&gt;RFC3339&lt;/a&gt; standard, e.g. as required by the &lt;a href="http://www.atomenabled.org/developers/syndication/atom-format-spec.php"&gt;Atom&lt;/a&gt; specification, use UnixDate from &lt;a href="http://search.cpan.org/~sbeck/Date-Manip-5.54/lib/Date/Manip.pod"&gt;Date::Manip&lt;/a&gt;. UnixDate is magic, it parses and translates strings containing dates in pretty much any conceivable format.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;pre&gt;use Date::Manip;&lt;br /&gt;&lt;br /&gt;# normalize all dates to UTC&lt;br /&gt;Date_Init("ConvTZ=UTC");&lt;br /&gt;&lt;br /&gt;sub valid_date {&lt;br /&gt;  return UnixDate($_[0], "%OZ");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;# then you use it as&lt;br /&gt;$date = valid_date("now"); # 2008-11-23T12:22:06Z&lt;br /&gt;$date = valid_date("Sat, 07 Sep 2002 00:00:01 GMT"); # 2002-09-07T00:00:01Z&lt;/pre&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-1307353811220023452?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/1307353811220023452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=1307353811220023452' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/1307353811220023452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/1307353811220023452'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2008/11/produce-valid-dates-in-rfc3339.html' title='Produce valid dates in RFC3339'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-1984358384279331965</id><published>2008-09-25T08:36:00.000-07:00</published><updated>2008-09-25T08:40:51.687-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='latex'/><category scheme='http://www.blogger.com/atom/ns#' term='macros'/><title type='text'>Testing whether an optinal argument is supplied</title><content type='html'>In LaTeX, you want to test whether a macro was called with or without an optional argument. &lt;br /&gt;&lt;code&gt;&lt;pre&gt;\def\test@non{\@empty}&lt;br /&gt;\newcommand{\mycommand}[1][\@empty]{%&lt;br /&gt;  \def\test@opt{#1}%&lt;br /&gt;  \ifx\test@opt\test@non&lt;br /&gt;    % \mycommand was used without optional argument&lt;br /&gt;  \else&lt;br /&gt;    % \mycommand was used with optional argument #1&lt;br /&gt;  \fi&lt;br /&gt;}&lt;/pre&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-1984358384279331965?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/1984358384279331965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=1984358384279331965' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/1984358384279331965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/1984358384279331965'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2008/09/testing-whether-optinal-argument-is.html' title='Testing whether an optinal argument is supplied'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-928061948859130172</id><published>2008-09-15T02:21:00.000-07:00</published><updated>2012-02-08T10:58:32.009-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cpan'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Installing a Perl module from CPAN</title><content type='html'>The easiest way to install CPAN modules in perl is using &lt;code&gt;cpanm&lt;/code&gt; which, furthermore, allows you to install without requiring any root access.&lt;br /&gt;&lt;br /&gt;In OS X, look into your &lt;code&gt;~/.bash_profile&lt;/code&gt; and remove any references that you might have to the &lt;code&gt;PERL5LIB&lt;/code&gt; environment variable. Then run the following commands on a terminal:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&amp;gt; curl -L http://cpanmin.us | perl - -l ~/Library/perl5 App::cpanminus local::lib&lt;br /&gt;&amp;gt; perl -I ~/Library/perl5/lib/perl5 -Mlocal::lib=~/Library/perl5 &amp;gt;&amp;gt; ~/.bash_profile&lt;br /&gt;&amp;gt; eval `perl -I ~/Library/perl5/lib/perl5 -Mlocal::lib=~/Library/perl5`&lt;/code&gt;&lt;/pre&gt;If everything went right, now you can install packages using:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&amp;gt; cpanm Some::Package&lt;/code&gt;&lt;/pre&gt;Some more details and an explanation can be found on this question about &lt;a href="http://stackoverflow.com/questions/2980297/how-can-i-use-cpan-as-a-non-root-user"&gt;using CPAN as non-root user&lt;/a&gt; on Stack Overflow.&lt;br /&gt;&lt;br /&gt;Hopefully your package is now installed and you can enjoy life.&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;If for some reason the installation above didn't work and you are still reading, then you might want to try installing your module using either CPANPLUS, by typing:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&amp;gt; cpanp -i Some::Module&lt;/code&gt;&lt;/pre&gt;or the more traditional &lt;code&gt;cpan&lt;/code&gt;:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&amp;gt; cpan Some::Module&lt;/code&gt;&lt;/pre&gt;If even &lt;i&gt;that&lt;/i&gt; fails, try to look at the produced output and install any dependencies or outdated packages first. Then retry.&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;Ok, you haven't succeeded and you are still reading. You probably need to do a manual install. You may also need a manual install if you get the “Sorry, PREFIX is not supported” error when trying to use &lt;code&gt;cpan&lt;/code&gt; to install a package which has been built using &lt;a href="http://search.cpan.org/perldoc?Module::Build"&gt;Module::Build&lt;/a&gt;. Go figure.&lt;br /&gt;&lt;br /&gt;So, lookup the download url for the &lt;code&gt;.tar.gz&lt;/code&gt; package on &lt;a href="http://search.cpan.org/"&gt;CPAN&lt;/a&gt; and then type&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&amp;gt; wget http://search.cpan.org/url/to/Some-Module.tar.gz&lt;br /&gt;&amp;gt; tar -zxvf Some-Module.tar.gz&lt;br /&gt;&amp;gt; cd Some-Module/&lt;br /&gt;&amp;gt; ls&lt;/code&gt;&lt;/pre&gt;If you see a &lt;code&gt;Build.PL&lt;/code&gt; file then do&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&amp;gt; perl Build.PL&lt;br /&gt;% if dependencies or module updates are needed do those first!&lt;br /&gt;&amp;gt; ./Build&lt;br /&gt;&amp;gt; ./Build test&lt;br /&gt;&amp;gt; ./Build install &lt;span style="color: #274e13;"&gt;--install_base ~/perl5lib&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;otherwise do&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&amp;gt; perl Makefile.PL&lt;br /&gt;% if dependencies or module updates are needed do those first!&lt;br /&gt;&amp;gt; make&lt;br /&gt;&amp;gt; make test&lt;br /&gt;&amp;gt; make install &lt;span style="color: #274e13;"&gt;PREFIX=~/perl5lib&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;The &lt;span style="color: #274e13;"&gt;--install_base&lt;/span&gt; or &lt;span style="color: #274e13;"&gt;PREFIX&lt;/span&gt; options are only needed if you are running a &lt;a href="http://qscripts.blogspot.com/2009/08/cpan-as-non-root-user.html"&gt;non-root&lt;/a&gt; installation, and it should point to the proper location in your home directory. Otherwise you need to &lt;code&gt;sudo&lt;/code&gt; that last command to do a root install.&lt;br /&gt;&lt;br /&gt;Life is hard.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-928061948859130172?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/928061948859130172/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=928061948859130172' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/928061948859130172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/928061948859130172'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2008/09/installing-cpan-module.html' title='Installing a Perl module from CPAN'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-2360912007061311983</id><published>2008-08-30T13:21:00.000-07:00</published><updated>2008-08-30T13:26:33.620-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='strings'/><category scheme='http://www.blogger.com/atom/ns#' term='cpp'/><title type='text'>C++ stringify</title><content type='html'>Quick stringify hack, turn anything (printable) into a string.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;#include &amp;lt;sstream&amp;gt;&lt;br /&gt;#include &amp;lt;string&amp;gt;&lt;br /&gt;&lt;br /&gt;template&amp;lt;typename T&amp;gt;&lt;br /&gt;inline std::string stringify(const T&amp; x) {&lt;br /&gt;  std::ostringstream o;&lt;br /&gt;  o &lt;&lt; x;&lt;br /&gt;  return o.str();&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;Discussion and a more robust version at the &lt;a href="http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.3"&gt;C++ FAQ Lite&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-2360912007061311983?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/2360912007061311983/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=2360912007061311983' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/2360912007061311983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/2360912007061311983'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2008/08/c-stringify.html' title='C++ stringify'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-444525396836088712</id><published>2008-08-19T05:27:00.000-07:00</published><updated>2009-05-03T12:02:05.676-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='random'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Reservoir Sampling</title><content type='html'>Obtain a random sample of &lt;i&gt;n&lt;/i&gt; elements evenly distributed from an input stream of unknown length.&lt;br /&gt;&lt;pre&gt;my $n = shift @ARGV;&lt;br /&gt;my $i = 0;&lt;br /&gt;my @reservoir;&lt;br /&gt;&lt;br /&gt;while (&lt;&gt;) {&lt;br /&gt;  $i++;&lt;br /&gt;  push @reservoir, [$i, $_];&lt;br /&gt;  last unless $i &lt; $n;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;while (&lt;&gt;) {&lt;br /&gt;  $i++;&lt;br /&gt;  $reservoir[int(rand($n))] = [$i, $_] if int(rand($i)) &lt; $n;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;@reservoir = sort { $a-&gt;[0] &lt;=&gt; $b-&gt;[0] } @reservoir;&lt;br /&gt;&lt;br /&gt;for my $x (@reservoir) { print $x-&gt;[1]; }&lt;/pre&gt;&lt;br /&gt;Useful perl implementation: &lt;a href="http://www.navarroj.com/stuff/reservoir"&gt;reservoir&lt;/a&gt;.&lt;br /&gt;Discussion and proof: &lt;a href="http://gregable.com/2007/10/reservoir-sampling.html"&gt;Reservoir Sampling&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-444525396836088712?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/444525396836088712/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=444525396836088712' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/444525396836088712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/444525396836088712'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2008/08/reservoir-sampling.html' title='Reservoir Sampling'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-7193399975460312061</id><published>2008-08-15T02:10:00.000-07:00</published><updated>2008-08-15T02:12:37.596-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='spanish'/><category scheme='http://www.blogger.com/atom/ns#' term='text'/><title type='text'>yendo</title><content type='html'>Gerundio del verbo ir: &lt;b&gt;yendo&lt;/b&gt;.&lt;br /&gt;Están mal: &lt;s&gt;llendo&lt;/s&gt;, &lt;s&gt;iendo&lt;/s&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-7193399975460312061?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/7193399975460312061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=7193399975460312061' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/7193399975460312061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/7193399975460312061'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2008/08/yendo.html' title='yendo'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-5749402684389858183</id><published>2008-05-16T04:58:00.000-07:00</published><updated>2008-05-16T05:25:12.994-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='graphs'/><category scheme='http://www.blogger.com/atom/ns#' term='random'/><title type='text'>Generating Random Trees and Connected Graphs</title><content type='html'>To generate a random (undirected) Connected Graph you first generate a spanning tree and then add additional edges at random.&lt;br /&gt;&lt;br /&gt;To generate the random tree use the following algorithm&lt;br /&gt;&lt;pre&gt;dst := random permutation of all nodes;&lt;br /&gt;src.push(dst.pop()); % picks the root&lt;br /&gt;while (!dst.empty()) {&lt;br /&gt;    a := random element from src;&lt;br /&gt;    b := dst.pop();&lt;br /&gt;    add the edge (a, b)&lt;br /&gt;    src.push(b);&lt;br /&gt;}&lt;/pre&gt;Proof of correctness (all trees are possible and equally likely): Alexey S. Rodionov and Hyunseung Choo, &lt;i&gt;On Generating Random Network Structures: Trees&lt;/i&gt;, ICCS 2003, LNCS 2658, pp. 879-887, 2003.&lt;br /&gt;&lt;br /&gt;To generate the random permutation see Fisher-Yates shuffle, e.g. &lt;a href="http://www.unix.com.ua/orelly/perl/cookbook/ch04_18.htm"&gt;Recipe 4.17&lt;/a&gt; in the perl cookbook.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-5749402684389858183?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/5749402684389858183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=5749402684389858183' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5749402684389858183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5749402684389858183'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2008/05/generating-random-trees-and-connected.html' title='Generating Random Trees and Connected Graphs'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-1070746238319202626</id><published>2008-03-13T05:08:00.000-07:00</published><updated>2008-03-13T05:13:52.792-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tikz'/><category scheme='http://www.blogger.com/atom/ns#' term='latex'/><title type='text'>Create pdf of single picture</title><content type='html'>Use the package &lt;tt&gt;preview&lt;/tt&gt; to generate .pdf files containing single pictures. Works particularly well with &lt;tt&gt;tikz&lt;/tt&gt;. Use the following wrapper latex code, then run pdflatex on it.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;\documentclass{article}&lt;br /&gt;&lt;br /&gt;\usepackage{tikz}&lt;br /&gt;\usepackage[active,pdftex,tightpage]{preview}&lt;br /&gt;\PreviewEnvironment[{[]}]{tikzpicture}&lt;br /&gt;&lt;br /&gt;\begin{document}&lt;br /&gt;&lt;br /&gt;\begin{tikzpicture}[options]&lt;br /&gt;...&lt;br /&gt;\end{tikzpicture}&lt;br /&gt;&lt;br /&gt;\end{document}&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-1070746238319202626?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/1070746238319202626/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=1070746238319202626' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/1070746238319202626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/1070746238319202626'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2008/03/create-pdf-of-single-picture.html' title='Create pdf of single picture'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-5859891069617605447</id><published>2007-09-05T04:47:00.000-07:00</published><updated>2010-06-03T09:47:01.502-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='regexp'/><category scheme='http://www.blogger.com/atom/ns#' term='latex'/><category scheme='http://www.blogger.com/atom/ns#' term='text'/><category scheme='http://www.blogger.com/atom/ns#' term='grep'/><title type='text'>Find all hyphenated words</title><content type='html'>Finds all hyphenated words within a set of text files.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;grep -oh --perl '\b\w+(-\w+)+\b' *.tex | sort -uf&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Find possible variations of hyphenated words to check for consistency&lt;br /&gt;&lt;br /&gt;&lt;code&gt;grep -i --color -C 1 --perl 'semi[\s-]*decision' *.tex&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This will find, e.g.: semidecision, semi decision and semi-decision.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-5859891069617605447?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/5859891069617605447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=5859891069617605447' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5859891069617605447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5859891069617605447'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2007/09/find-all-hyphenated-words.html' title='Find all hyphenated words'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-899215302904561324</id><published>2007-08-27T04:54:00.000-07:00</published><updated>2007-08-27T04:55:47.717-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='latex'/><category scheme='http://www.blogger.com/atom/ns#' term='miktex'/><title type='text'>Install LaTeX Package with MPM</title><content type='html'>sudo mpm --install=&amp;lt;package&amp;gt;&lt;br /&gt;sudo texhash&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-899215302904561324?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/899215302904561324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=899215302904561324' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/899215302904561324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/899215302904561324'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2007/08/install-latex-package-with-mpm.html' title='Install LaTeX Package with MPM'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-5758273888502437930</id><published>2007-08-23T10:10:00.000-07:00</published><updated>2007-08-23T10:11:20.186-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='latex'/><category scheme='http://www.blogger.com/atom/ns#' term='bibtex'/><title type='text'>BibTeX Names</title><content type='html'>Syntax for writing BibTeX author names:&lt;br /&gt;&lt;br /&gt;"First von Last" &lt;br /&gt;&lt;br /&gt;"von Last, First"&lt;br /&gt;&lt;br /&gt;"von Last, Jr, First"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-5758273888502437930?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/5758273888502437930/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=5758273888502437930' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5758273888502437930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5758273888502437930'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2007/08/bibtex-names.html' title='BibTeX Names'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-2650748275415310876</id><published>2007-07-27T02:49:00.000-07:00</published><updated>2007-07-27T02:51:00.796-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><title type='text'>Recursive directory listing</title><content type='html'>And get one line of output per file use find&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;find . -print&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-2650748275415310876?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/2650748275415310876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=2650748275415310876' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/2650748275415310876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/2650748275415310876'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2007/07/recursive-directory-listing.html' title='Recursive directory listing'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-500831407496945161</id><published>2007-07-24T07:32:00.000-07:00</published><updated>2008-05-16T05:14:05.647-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='statistics'/><category scheme='http://www.blogger.com/atom/ns#' term='excel'/><title type='text'>Excel trendline equations</title><content type='html'>When you add a trendline to a chart, Excel provides an option to display the trendline equation in the chart. This tip describes how to create formulas that generate the trendline coefficients. You can then use these formulas to calculate predicted y values for give values of x.&lt;br /&gt;&lt;br /&gt;These equations assume that your sheet has two named ranges: x and y.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Linear Trendline&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   Equation: y = m * x + b&lt;br /&gt;   m: =SLOPE(y,x)&lt;br /&gt;   b: =INTERCEPT(y,x)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Logarithmic Trendline&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   Equation: y = (c * LN(x)) - b&lt;br /&gt;   c: =INDEX(LINEST(y,LN(x)),1)&lt;br /&gt;   b: =INDEX(LINEST(y,LN(x)),1,2)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Power Trendline&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   Equation: y=c*x^b&lt;br /&gt;   c: =EXP(INDEX(LINEST(LN(y),LN(x),,),1,2))&lt;br /&gt;   b: =INDEX(LINEST(LN(y),LN(x),,),1)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Exponential Trendline&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   Equation: y = c *e ^(b * x)&lt;br /&gt;   c: =EXP(INDEX(LINEST(LN(y),x),1,2))&lt;br /&gt;   b: =INDEX(LINEST(LN(y),x),1)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2nd Order Polynomial Trendline&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   Equation: y = (c2 * x^2) + (c1 * x ^1) + b&lt;br /&gt;   c2: =INDEX(LINEST(y,x^{1,2}),1)&lt;br /&gt;   C1: =INDEX(LINEST(y,x^{1,2}),1,2)&lt;br /&gt;   b = =INDEX(LINEST(y,x^{1,2}),1,3)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;3rd Order Polynomial Trendline&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   Equation: y = (c3 * x^3) + (c2 * x^2) + (c1 * x^1) + b&lt;br /&gt;c3: =INDEX(LINEST(y,x^{1,2,3}),1)&lt;br /&gt;c2: =INDEX(LINEST(y,x^{1,2,3}),1,2)&lt;br /&gt;C1: =INDEX(LINEST(y,x^{1,2,3}),1,3)&lt;br /&gt;b: =INDEX(LINEST(y,x^{1,2,3}),1,4)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Higher Order Polynomial Trendline&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Notice the pattern in the two preceding sets of formulas&lt;br /&gt;&lt;br /&gt;&lt;a href="http://j-walk.com/ss/excel/tips/tip101.htm"&gt;[source]&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-500831407496945161?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/500831407496945161/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=500831407496945161' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/500831407496945161'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/500831407496945161'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2007/07/excel-trendline-equations.html' title='Excel trendline equations'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-8503986866823885002</id><published>2007-07-24T01:23:00.000-07:00</published><updated>2007-07-24T03:08:09.546-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='emacs'/><title type='text'>Emacs shortcuts</title><content type='html'>Save: Ctrl-X Ctrl-S&lt;br /&gt;Quit: Ctrl-X Ctrl-C&lt;br /&gt;&lt;br /&gt;Select: Ctrl-space&lt;br /&gt;Copy: M-W&lt;br /&gt;Cut: Ctrl-W&lt;br /&gt;Paste: Ctrl-Y&lt;br /&gt;&lt;br /&gt;Go to line: M-x goto-line&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-8503986866823885002?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/8503986866823885002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=8503986866823885002' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/8503986866823885002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/8503986866823885002'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2007/07/emacs-shortcuts.html' title='Emacs shortcuts'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-5870523223605020708</id><published>2007-07-19T06:23:00.000-07:00</published><updated>2007-07-27T02:49:14.858-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pdf'/><category scheme='http://www.blogger.com/atom/ns#' term='docs'/><title type='text'>Word count a pdf file</title><content type='html'>&lt;pre&gt;ps2ascii myfile.pdf | wc -w&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-5870523223605020708?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/5870523223605020708/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=5870523223605020708' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5870523223605020708'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5870523223605020708'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2007/07/word-count-pdf-file.html' title='Word count a pdf file'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-2162398812557965216</id><published>2007-07-02T06:05:00.000-07:00</published><updated>2010-06-08T08:32:40.721-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='files'/><category scheme='http://www.blogger.com/atom/ns#' term='tar'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><title type='text'>Command line tar and untar</title><content type='html'>Untar&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;tar xvfz something.tar.gz&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Tar&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;tar cfz blah.tar.gz blah/&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-2162398812557965216?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/2162398812557965216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=2162398812557965216' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/2162398812557965216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/2162398812557965216'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2007/07/command-line-tar-and-untar.html' title='Command line tar and untar'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-3953267919841206013</id><published>2007-06-12T03:34:00.000-07:00</published><updated>2007-06-12T03:35:31.174-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='strings'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Trim strings</title><content type='html'>Remove white-space at beginning and end of strings&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;sub trim($)&lt;br /&gt;{&lt;br /&gt; my $string = shift;&lt;br /&gt; $string =~ s/^\s+//;&lt;br /&gt; $string =~ s/\s+$//;&lt;br /&gt; return $string;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-3953267919841206013?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/3953267919841206013/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=3953267919841206013' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/3953267919841206013'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/3953267919841206013'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2007/06/trim-strings.html' title='Trim strings'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-6357830179198855743</id><published>2007-06-02T12:32:00.000-07:00</published><updated>2010-02-27T07:38:33.897-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>Escape characters in URLs</title><content type='html'>&lt;pre&gt;sub escape_uri {&lt;br /&gt;  my $s = shift;&lt;br /&gt;  $s =~s/([^a-zA-Z0-9_\-. ])/uc sprintf("%%%02x",ord($1))/eg;&lt;br /&gt;  $s =~ tr/ /+/;&lt;br /&gt;  return $s;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Or even better&lt;pre&gt;use URI::Escape;&lt;br /&gt;my $uri = uri_escape($string)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;To &lt;i&gt;un&lt;/i&gt;escape use&lt;pre&gt;$string =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-6357830179198855743?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/6357830179198855743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=6357830179198855743' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/6357830179198855743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/6357830179198855743'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2007/06/escape-characters-in-urls.html' title='Escape characters in URLs'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-3767271462962061679</id><published>2007-05-31T04:16:00.000-07:00</published><updated>2011-04-07T06:27:13.479-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sh'/><category scheme='http://www.blogger.com/atom/ns#' term='control'/><title type='text'>Shell control commands</title><content type='html'>&lt;pre&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;for VAR in ITEMA ITEMB ITEMC ITEMD; do&lt;br /&gt;  # do something with $VAR&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;for VAR in {1..5}; do&lt;br /&gt;  # do something with $VAR&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;while [ condition ]; do&lt;br /&gt;  # do something&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;if [ "$str1" == "$str2" ]; then&lt;br /&gt;  # do something&lt;br /&gt;elif [ other_condition ]; then&lt;br /&gt;  # do another thing&lt;br /&gt;else&lt;br /&gt;  # do something else&lt;br /&gt;fi&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-3767271462962061679?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/3767271462962061679/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=3767271462962061679' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/3767271462962061679'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/3767271462962061679'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2007/05/shell-for-loop.html' title='Shell control commands'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-245056134845914539</id><published>2007-05-31T03:58:00.000-07:00</published><updated>2007-05-31T04:07:45.179-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sh'/><title type='text'>Parse command line options</title><content type='html'>Use the &lt;a href="http://www.google.com/search?q=getopts"&gt;getopts&lt;/a&gt; shell utility&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;while getopts d:s o&lt;br /&gt;do case "$o" in&lt;br /&gt; d) value_of_d="$OPTARG";;&lt;br /&gt; s) saw_an_s="TRUE";;&lt;br /&gt; esac&lt;br /&gt;done&lt;br /&gt;shift $OPTIND-1&lt;br /&gt;&lt;br /&gt;# the remaining arguments are in $*&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;code&gt;getopts &lt;i&gt;optstring&lt;/i&gt; &lt;i&gt;name&lt;/i&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;i&gt;optstring&lt;/i&gt;&lt;/code&gt; contains a letter for each option that the script understands, follow a letter with ":" if the option receives an argument.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-245056134845914539?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/245056134845914539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=245056134845914539' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/245056134845914539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/245056134845914539'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2007/05/parse-command-line-options.html' title='Parse command line options'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5618008483055389858.post-5701061333596454174</id><published>2007-05-31T03:33:00.000-07:00</published><updated>2007-05-31T03:40:03.453-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sh'/><title type='text'>Timing out the execution of a command</title><content type='html'>Use the &lt;a href="http://www.google.com/search?q=ulimit"&gt;ulimit&lt;/a&gt; shell command.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;ulimit -t 10&lt;br /&gt;# your command here&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5618008483055389858-5701061333596454174?l=qscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qscripts.blogspot.com/feeds/5701061333596454174/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5618008483055389858&amp;postID=5701061333596454174' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5701061333596454174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5618008483055389858/posts/default/5701061333596454174'/><link rel='alternate' type='text/html' href='http://qscripts.blogspot.com/2007/05/timing-out-execution-of-command.html' title='Timing out the execution of a command'/><author><name>Juan Antonio Navarro Pérez</name><uri>https://profiles.google.com/102489454838895294830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-UrPh6Xo08RU/AAAAAAAAAAI/AAAAAAAAnrE/TuB_RbawJwM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry></feed>
