<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Alexandre Vassalotti &#187; Ubuntu</title>
	<atom:link href="http://peadrop.com/blog/category/computers/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://peadrop.com/blog</link>
	<description>Random Computer Musings</description>
	<lastBuildDate>Tue, 18 Oct 2011 06:31:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Shell tricks: shorthands</title>
		<link>http://peadrop.com/blog/2007/10/18/shell-tricks-shorthands/</link>
		<comments>http://peadrop.com/blog/2007/10/18/shell-tricks-shorthands/#comments</comments>
		<pubDate>Thu, 18 Oct 2007 16:20:55 +0000</pubDate>
		<dc:creator>Alexandre</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://peadrop.com/blog/2007/10/18/shell-tricks-shorthands/</guid>
		<description><![CDATA[Even with tab completion, typing long commands is tedious. But, there&#8217;s something even worst: typing the same long commands again, and again, and again&#8230; So how do you solve that? It&#8217;s simple: you shorten them. Surprising, uh? Okay enough theory, let me show you some examples. Here&#8217;s a tedious command of Type-A: % sudo aptitude [...]]]></description>
			<content:encoded><![CDATA[<p>Even with tab completion, typing long commands is tedious. But,
there&#8217;s something even worst: typing the same long commands again, and
again, and again&#8230; So how do you solve that? It&#8217;s simple: you shorten
them. Surprising, uh? Okay enough theory, let me show you some
examples.</p>

<p>Here&#8217;s a tedious command of Type-A:</p>

<pre><code>% sudo aptitude install zsh
</code></pre>

<p>Look at it carefully since you will need to hunt these long commands
down until none remains. Now, let me explain how you execute a such
command. Open up your personal shell initialization file
(e.g. <code>~/.bashrc</code> for Bash, <code>~/.zshrc</code> for Zsh, etc). Then, add the
following:</p>

<pre><code class="prettyprint">alias spkgi="sudo aptitude install"</code></pre>

<p>Reload your shell and finally, enjoy:</p>

<pre><code>% spkgi zsh
</code></pre>

<p>Now I can introduce, as you can deduce, other shorten commands that
you can produce and reproduce:</p>

<pre><code class="prettyprint"># Package Management
alias pkg="aptitude"
alias spkg="sudo aptitude"
alias spkgi="sudo aptitude install"
alias spkgu="sudo aptitude safe-upgrade"
alias spkgr="sudo aptitude remove"
alias spkgd="sudo apt-get build-dep"

# Miscellaneous Helpers
alias nc="rlwrap nc"
alias e=$EDITOR
alias se=sudoedit
alias reload="source ~/.zshrc"
alias g=egrep</code></pre>

<p>Next after Type-A tedious commands, we have the Type-S ones. To
execute these, you will you need some sort of special shell
support. So, here&#8217;s some examples of the Type-S monstrosity:</p>

<pre><code>% find Lib/ -name '*.c' -print0 | xargs -0 grep ^PyErr
% find -name '*.html' -print0 | xargs -0 rename 's/\.html$/.var/'
% find -name '*.patch' -print0 | xargs -0 -I {} cp {} patches/
</code></pre>

<p>I hope you start to see some patterns (if you don&#8217;t, then try
harder). The first one could (and should) be rewritten as:</p>

<pre><code>% rgrep --include='*.c' ^PyErr Lib/
</code></pre>

<p>But that isn&#8217;t short enough for me, so I have a short helper:</p>

<pre><code class="prettyprint">rg()
{
    filepat="$1"
    pat="$2"
    shift 2
    grep -Er --include=$filepat $pat ${@:-.}
}
# In Zsh, 'noglob' turns off globing.
# (e.g, "noglob echo *" outputs "*")
alias rg='noglob rg'</code></pre>

<p>It is lovely to use:</p>

<pre><code>% rg *.c ^PyErr Lib/
% rg *.c PyErr_Restore . -C 10 | less
% rg *.[ch] stringlib
% rg *.c ^[a-zA-Z]*_dealloc Modules/ Objects/
</code></pre>

<p>The second example is quite similar to the previous one. However, the
find/rename combination is much less common (at least for me) than the
find/grep one. This one needs to be broken in pieces. One obvious thing
to factor out is the <code>find -name</code> with an alias:</p>

<pre><code class="prettyprint">alias fname="noglob find -name"</code></pre>

<p>Using this alias, you can rewrite the second example as:</p>

<pre><code>% fname *.html -print0 | xargs -0 rename 's/\.html$/.var/'
</code></pre>

<p>It&#8217;s better, but it&#8217;s not short enough yet. The ugly part of this
command is the <code>-print0 | xargs -0</code>. I hate to type that. Wouldn&#8217;t
it be nice if we could define an alias for it? How about:</p>

<pre><code class="prettyprint">alias each="-print0 | xargs -0"</code></pre>

<p>Unfortunately, that doesn&#8217;t work since aliases are only expanded if
they are in the command position. Luckly, Zsh has that neat feature
called global aliases, which does exactly what we want.</p>

<pre><code class="prettyprint">alias -g each="-print0 | xargs -0"</code></pre>

<p>With this feature of Zsh, the second example become:</p>

<pre><code>% fname *.html each rename 's/\.html$/.var/'
</code></pre>

<p>Now, we can also attack the third one:</p>

<pre><code>% fname *.patch each -I {} cp {} patches/
</code></pre>

<p>It is possible to shorten a bit by defining another alias combining
<code>each</code> and <code>-I {}</code>, but that won&#8217;t make a big difference.</p>

<p>Finally, there are the Type-R tedious commands. These are hard to
avoid, unless you&#8217;re careful. Here&#8217;s again some ridiculous examples to
help you recognize these redundant commands:</p>

<pre><code>% gcc -o stackgrow stackgrow.c
% pkg show emacs-snapshot-bin-common emacs-snapshot-common emacs-snapshot-gtk emacs-snapshot
% cat ../lispref.patch ../lwlib.patch ../etc.patch | patch -p1
</code></pre>

<p>To reduce these, you don&#8217;t need change your shell configuration; you
change your habits instead. Using alternations (which are
non-standard, but supported by most shells), you can rewrite the two
first example as:</p>

<pre><code>% gcc -o stackgrow{,.c}
% pkg show emacs-snapshot{{-bin,}-common,-gtk,}
</code></pre>

<p>Now, you are surely asking yourself: &#8220;what is different about the
third one?&#8221; Well, think about it. Got it? No? Ah, come on, it is
easy. Here&#8217;s a hint:</p>

<pre><code>% echo 'cat ../{lispref,lwlib,etc}.patch | patch -p1' | wc -c
45
% echo 'cat ../lispref.patch ../lwlib.patch ../etc.patch | patch -p1' | wc -c
61
</code></pre>

<p>You like my hint, don&#8217;t you? Here&#8217;s the answer:</p>

<pre><code>% echo 'cat ../li\t ../lw\t ../et\t | patch -p1' | wc -c
37
</code></pre>

<p>Tab completion doesn&#8217;t work well with prefix alternations. Even if the
command using alternation is shorter, it still doesn&#8217;t beat good old
tab completion.</p>

<p>And that&#8217;s all folks. I surely have plenty of other tricks to show,
but that will be for the other posts of this short series.</p>
]]></content:encoded>
			<wfw:commentRss>http://peadrop.com/blog/2007/10/18/shell-tricks-shorthands/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Pretty Emacs Reloaded</title>
		<link>http://peadrop.com/blog/2007/09/17/pretty-emacs-reloaded/</link>
		<comments>http://peadrop.com/blog/2007/09/17/pretty-emacs-reloaded/#comments</comments>
		<pubDate>Mon, 17 Sep 2007 05:08:47 +0000</pubDate>
		<dc:creator>Alexandre</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://peadrop.com/blog/2007/09/17/pretty-emacs-reloaded/</guid>
		<description><![CDATA[Update: If you are using Ubuntu 8.04 LTS &#8220;Hardy Heron&#8221; or Ubuntu 8.10 &#8220;Intrepid Ibex&#8221;, use the packages in the PPA of the Ubuntu Emacs Lisp team, instead of the packages referenced here. For Ubuntu 9.04 &#8220;Jaunty Jackalope&#8221; and newer, use the packages in Ubuntu repositories. My popular1 Pretty Emacs package just got a tad [...]]]></description>
			<content:encoded><![CDATA[<div style="background-color: #FFCCCC; border: 1px solid #663333">
<b>Update:</b> If you are using Ubuntu 8.04 LTS &#8220;Hardy Heron&#8221; or Ubuntu 8.10 &#8220;Intrepid Ibex&#8221;, use the packages in the <a href="https://launchpad.net/~ubuntu-elisp/+archive/ppa">PPA of the Ubuntu Emacs Lisp team</a>, instead of the packages referenced here. For Ubuntu 9.04 &#8220;Jaunty Jackalope&#8221; and newer, use the packages in Ubuntu repositories.
</div>

<p>My popular<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> <a href="http://peadrop.com/blog/2007/01/06/pretty-emacs/">Pretty Emacs</a> package just got a tad better. I
transferred the package to the brand new <a href="https://help.launchpad.net/PPAQuickStart">PPA service</a> provided by
Launchpad. So, what&#8217;s new about the package? First, I glad to announce
the long-awaited amd64 support. Also, I am adding Gutsy Gibbon to the
list of supported distributions.</p>

<p>To use the updated package on Ubuntu 6.10 &#8220;Edgy Eft&#8221;, add the</p>

<p>following lines to your <code>/etc/apt/sources.list</code> file:</p>

<pre><code>deb http://ppa.launchpad.net/avassalotti/ubuntu edgy main
deb-src http://ppa.launchpad.net/avassalotti/ubuntu edgy main</code></pre>

<p>To use the package on Ubuntu 7.04 &#8220;Feisty Fawn&#8221;, add the following
lines to your <code>/etc/apt/sources.list</code> file:</p>

<pre><code>deb http://ppa.launchpad.net/avassalotti/ubuntu feisty main
deb-src http://ppa.launchpad.net/avassalotti/ubuntu feisty main</code></pre>

<p>To use the package on the development version of Ubuntu &#8220;Gutsy
Gibbon&#8221;, add the following lines to your <code>/etc/apt/sources.list</code> file:</p>

<pre><code>deb http://ppa.launchpad.net/avassalotti/ubuntu gutsy main
deb-src http://ppa.launchpad.net/avassalotti/ubuntu gutsy main</pre>

<p></code></p>

<p>Unfortunately, if you still use Ubuntu 6.06 "Dapper Drake", you will
have to keep using the older package release from my orignal
repository. I still support Ubuntu 6.06, but I won't update the
package with newer snapshots.</p>

<p>After adding the repository to your software source list, upgrade your
version of the package with:</p>

<pre><code>sudo aptitude upgrade</code></pre>

<p>If you do not have a previous version of the package already installed
and you desire to install it, do this instead:</p>

<pre><code>sudo aptitude install emacs-snapshot emacs-snapshot-el</code></pre>

<p>When upgrading the package you might get the following warning
message:</p>

<p>WARNING: untrusted versions of the following packages will be installed!</p>

<p>Untrusted packages could compromise your system's security.
You should only proceed with the installation if you are certain that
this is what you want to do.</p>

<p>This is due to <a href="https://bugs.launchpad.net/soyuz/+bug/125103">a bug</a> in the PPA system. I believe that it will be
resolved quickly. So, you can safely ignore the warning message for
the moment.</p>

<p>Final note, thank you everyone for trusting me and giving me some
great feedback about the package. I like to give special thanks to
<a href="http://orebokech.com/">Romain Francoise</a> and <a href="http://mwolson.org/">Michael Olson</a> for their work respectively on
emacs-snapshot and emacs22, during this summer.</p>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>A rough estimate tell me there is over 30 000 people using my
package, where 88% of them are Feisty Fawn users and 11% are Edgy Eft
users.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://peadrop.com/blog/2007/09/17/pretty-emacs-reloaded/feed/</wfw:commentRss>
		<slash:comments>55</slash:comments>
		</item>
		<item>
		<title>Minor annoyance with Planet</title>
		<link>http://peadrop.com/blog/2007/07/06/minor-annoyance-with-planet/</link>
		<comments>http://peadrop.com/blog/2007/07/06/minor-annoyance-with-planet/#comments</comments>
		<pubDate>Fri, 06 Jul 2007 21:31:44 +0000</pubDate>
		<dc:creator>Alexandre</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://peadrop.com/blog/2007/07/06/minor-annoyance-with-planet/</guid>
		<description><![CDATA[Do you know how to fix Planet or WordPress, so when I edit an old post it does not pop back on Planet? I do edit some of my posts, in particular the Pretty Emacs one, fairly often. I love to have my blog aggregated, but I would hate spamming Planet Ubuntu readers with my [...]]]></description>
			<content:encoded><![CDATA[<div></div>

<p>Do you know how to fix Planet or WordPress, so when I edit an old post it does not pop back on Planet?</p>

<p>I do edit some of my posts,  in particular the <a href="http://peadrop.com/blog/2007/01/06/pretty-emacs/">Pretty Emacs</a> one, fairly often. I love to have my blog aggregated, but I would hate spamming Planet Ubuntu readers with my old posts. Therefore if I cannot fix this little annoyance, I will have no other choice to remove myself from Planet Ubuntu.</p>
]]></content:encoded>
			<wfw:commentRss>http://peadrop.com/blog/2007/07/06/minor-annoyance-with-planet/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Am I dreaming?</title>
		<link>http://peadrop.com/blog/2007/05/10/am-i-dreaming/</link>
		<comments>http://peadrop.com/blog/2007/05/10/am-i-dreaming/#comments</comments>
		<pubDate>Fri, 11 May 2007 00:38:06 +0000</pubDate>
		<dc:creator>Alexandre</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://peadrop.com/blog/2007/05/10/am-i-dreaming/</guid>
		<description><![CDATA[AMD is announcing plans to deliver open graphics drivers, at Red Hat Summit. Dell to offer Ubuntu on some of their machines, in the United States. Intel partners with Ubuntu to create an open source platform for mobile devices. Sun Microsystems completes the release of Java under the GPLv2.]]></description>
			<content:encoded><![CDATA[<ul>
<li><a href="http://techreport.com/onearticle.x/12440">AMD is announcing plans to deliver open graphics drivers</a>, at Red
Hat Summit.</li>
<li><a href="http://direct2dell.com/one2one/archive/2007/05/01/13147.aspx">Dell to offer Ubuntu</a> on some of their machines, in the United States.</li>
<li><a href="http://news.bbc.co.uk/2/hi/technology/6634195.stm">Intel partners with Ubuntu</a> to create an open source platform for mobile devices.</li>
<li><a href="http://www.sun.com/aboutsun/pr/2007-05/sunflash.20070508.3.xml">Sun Microsystems completes the release of Java</a> under the GPLv2.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://peadrop.com/blog/2007/05/10/am-i-dreaming/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Smoked brains for dinner</title>
		<link>http://peadrop.com/blog/2007/04/21/smoked-brains-for-dinner/</link>
		<comments>http://peadrop.com/blog/2007/04/21/smoked-brains-for-dinner/#comments</comments>
		<pubDate>Sat, 21 Apr 2007 16:33:30 +0000</pubDate>
		<dc:creator>Alexandre</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://peadrop.com/blog/2007/04/21/smoked-brains-for-dinner/</guid>
		<description><![CDATA[Today, there will be a special quiz on Python hosted by me, in &#35;ubuntu-trivia on FreeNode, at 20:00 UTC. Most of the quiz will be to write some simple procedures, faster than your opponents. The winner will, of course, get a superb prize &#8212; 5 Ubuntu stickers! Obviously, the real prize is the fun that [...]]]></description>
			<content:encoded><![CDATA[<p>Today, there will be a special quiz on Python hosted by me, in
<a href="https://wiki.ubuntu.com/UbuntuTrivia">&#35;ubuntu-trivia</a> on FreeNode, at <a href="http://www.timeanddate.com/worldclock/fixedtime.html?month=4&amp;day=21&amp;year=2007&amp;hour=20&amp;min=0&amp;sec=0&amp;p1=0">20:00 UTC</a>. Most of the quiz will be to
write some simple procedures, faster than your opponents. The winner
will, of course, get a superb prize &#8212; 5 Ubuntu stickers! Obviously,
the real prize is the fun that will get during the quiz. And who knows, maybe
you will learn a few neat tricks. So, see you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://peadrop.com/blog/2007/04/21/smoked-brains-for-dinner/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flipping bits this summer</title>
		<link>http://peadrop.com/blog/2007/04/12/flipping-bits-this-summer/</link>
		<comments>http://peadrop.com/blog/2007/04/12/flipping-bits-this-summer/#comments</comments>
		<pubDate>Thu, 12 Apr 2007 14:36:03 +0000</pubDate>
		<dc:creator>Alexandre</dc:creator>
				<category><![CDATA[Me]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://peadrop.com/blog/2007/04/12/flipping-bits-this-summer/</guid>
		<description><![CDATA[Dear Applicant, Congratulations! This email is being sent to inform you that your application was accepted to take part in the Summer of Code. Today, I am truly happy. I wasn&#8217;t expecting to be accepted, really, and perhaps no other candidate did. My accepted project is to merge C and Python implementations of the same [...]]]></description>
			<content:encoded><![CDATA[<blockquote>Dear Applicant,

Congratulations! This email is being sent to inform you that your
application was accepted to take part in the Summer of Code.</blockquote>

<p>Today, I am truly happy. I wasn&#8217;t expecting to be accepted, really,
and perhaps no other candidate did. My accepted project is to merge C
and Python implementations of the same interface (i.e.,
StringIO/cStringIO, Pickle/cPickle, etc), and my mentor is the Python
star developer, <a href="http://sayspy.blogspot.com/">Brett Cannon</a>. This will be a
challenging project; I will have to work hard and efficiently to be
successful. But one thing is sure, I will have some great fun.</p>

<p>I would like to congrats everyone who have been accepted. A special
thanks to students who will be working on Ubuntu, this summer. There
is surely <a href="http://code.google.com/soc/ubuntu/about.html">some great projects for
Ubuntu</a>. And also,
another special thanks to the mentors, who will be helping us this
summer.</p>
]]></content:encoded>
			<wfw:commentRss>http://peadrop.com/blog/2007/04/12/flipping-bits-this-summer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Welcome to Mr. Crystal Ball</title>
		<link>http://peadrop.com/blog/2007/04/07/welcome-to-mr-crystal-ball/</link>
		<comments>http://peadrop.com/blog/2007/04/07/welcome-to-mr-crystal-ball/#comments</comments>
		<pubDate>Sat, 07 Apr 2007 20:54:45 +0000</pubDate>
		<dc:creator>Alexandre</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://peadrop.com/blog/2007/04/07/welcome-to-mr-crystal-ball/</guid>
		<description><![CDATA[As some of you may already know, I am a die-hard fan of productive editing. That is probably because I don&#8217;t find myself very fast, on a keyboard. So, I am always trying to find ways to improve my editing speed. And when I ain&#8217;t surfing on the web, I am either typing stuff in [...]]]></description>
			<content:encoded><![CDATA[<p>As some of you may already know, I am a die-hard fan of productive
editing. That is probably because I don&#8217;t find myself very fast, on a
keyboard. So, I am always trying to find ways to improve my editing
speed. And when I ain&#8217;t surfing on the web, I am either typing stuff in my
shell or my editor. So today, I would like to share a few tricks I uses
in my default shell, <a href="http://zsh.sunsite.dk/">Z Shell</a>.</p>

<p>The shell history can be a powerful tool. If you find yourself typing
commands again, and again, and again, you probably can use it at your
advantage. You probably already know about <code>Ctrl+R</code>, which is bound
to <code>history-incremental-search-backward</code> command in most shells.
Personally, I don&#8217;t find it very useful since it tries to find a match
everywhere, but it&#8217;s better than cycling through the history with the
Up/Down keys. In fact, anything is better than the Up/Down keys. So,
why not rebind them to something more useful, like
<code>history-search-backward</code>? Well, that is easy. With Zsh, you need to
add these two line to your <code>.zshrc</code>:</p>

<pre><code class="pretty-print"><span class="builtin">bindkey</span> <span class="string">'\e[A'</span> history-search-backward
<span class="builtin">bindkey</span> <span class="string">'\e[B'</span> history-search-forward</code></pre>

<p>In fact, if you&#8217;re using Emacs key-bindings, you don&#8217;t even need to do
anything, because <code>Meta+P</code> and <code>Meta+N</code> are already bound to these
two functions. Incidentally, <a href="http://www.sharms.org/blog/?p=83">Steven Harms is advocating to enable
this feature</a> by default in Ubuntu,
for Bash&#8217;s users. Personally, I am not sure if it&#8217;s really necessary
to make it a default. I am not a fan of modifications in <code>.inputrc</code>,
either. But, I will leave that discussion for another blog post.</p>

<p>Now, that we have functional Up/Down arrow keys, can we do more? Yes,
we can! Let me introduce one of my favorite features of Zsh,
preemptive auto-completion. If you&#8217;re tired typing <code>TAB</code> a zillion
times a day, you will love this one. This feature implements
predictive typing using history search and auto-completion. Again, to
enable it, just copy these lines to your configuration file:</p>

<pre><code><span class="builtin">autoload</span> predict-on
zle -N predict-on
zle -N predict-off
<span class="builtin">bindkey</span> <span class="string">'^Z'</span>   predict-on
<span class="builtin">bindkey</span> <span class="string">'^X^Z'</span> predict-off
zstyle <span class="string">':predict'</span> verbose true</code></pre>

<p>Here, note that <code>predict-on</code> and <code>predict-off</code>, are bounded to
<code>Ctrl+Z</code> and <code>Ctrl+X Z</code> respectively. That means you can turn it
on/off, whenever you need to. You will find useful to turn it off when
you edit the middle of a command, since it can confuse the prediction.
But other than that, it&#8217;s great.</p>

<p>Sometime, the shell editor is not enough for me &#8212; I need something
more powerful when I edit long commands. So, I use another cool
built in function of Zsh, called <code>edit-command-line</code>. With this feature, I can
edit the current command with an external editor, defined by the
environment variable <code>$EDITOR</code>. To enable it, just copy-and-paste
this:</p>

<pre><code><span class="builtin">autoload</span> edit-command-line
zle -N edit-command-line
<span class="builtin">bindkey</span> <span class="string">'^Xe'</span> edit-command-line</code></pre>

<p>So, when I think the command will be long, like a for-loop. I just
press <code>Ctrl+X e</code>, which launches, on my system, <code>emacsclient</code>. I
am always running Emacs with <a href="http://www.gnu.org/software/emacs/manual/html_node/Emacs-Server.html">its server</a>,
therefore the shell command is instantaneously loaded into a Emacs
buffer. Then when I am done, I close the Emacs session with <code>Ctrl+x #</code>
and the command appears in my shell. It is just sweet.</p>

<p>Even if you&#8217;re a master with your editor, nothing beats a short alias,
or a shell script. I keep a full directory of useful scripts, to
automate my daily tasks. At first, writing scripts feels a bit
awkward. If you&#8217;re like me, you will always worry that your scripts
might go terribly wrong, and eat your data. That&#8217;s totally normal, but
don&#8217;t be a fool. Automating your tasks, even the most trivial ones,
will save some of your precious time. Unlike scripts, which can really do
some heavy automation, aliases are just a shell convenience, like
auto-completion. Personally, I am not a big fan of fancy aliases. (I
tend to use functions for the more fancy things.) Anyway, here some of
my favourite aliases:</p>

<pre><code><span class="comment-delimiter"># </span><span class="comment">Set up aliases
</span><strike><span class="builtin">alias</span> <span class="variable-name">c</span>=clear</strike>
<span class="builtin">alias</span> <span class="variable-name">d</span>=<span class="string">'dirs -v'</span>
<span class="builtin">alias</span> <span class="variable-name">e</span>=$<span class="variable-name">EDITOR</span>
<span class="builtin">alias</span> <span class="variable-name">grep</span>=egrep
<span class="builtin">alias</span> <span class="variable-name">h</span>=history
<span class="builtin">alias</span> <span class="variable-name">j</span>=jobs
<span class="builtin">alias</span> <span class="variable-name">po</span>=popd
<span class="builtin">alias</span> <span class="variable-name">pu</span>=pushd
<span class="builtin">alias</span> <span class="variable-name">ss</span>=<span class="string">'screen -Rx'</span>

<span class="comment-delimiter"># </span><span class="comment">Global aliases -- These do not have to be
</span><span class="comment-delimiter"># </span><span class="comment">at the beginning of the command line.
</span><span class="builtin">alias</span> -g <span class="variable-name">M</span>=<span class="string">'|more'</span>
<span class="builtin">alias</span> -g <span class="variable-name">L</span>=<span class="string">'|less'</span>
<span class="builtin">alias</span> -g <span class="variable-name">H</span>=<span class="string">'|head'</span>
<span class="builtin">alias</span> -g <span class="variable-name">T</span>=<span class="string">'|tail'</span>

<span class="comment-delimiter"># </span><span class="comment">Go to parent directories without `cd'
</span><span class="builtin">setopt</span> autocd
<span class="builtin">alias</span> -g ...=<span class="string">'../..'</span>
<span class="builtin">alias</span> -g ....=<span class="string">'../../..'</span>
<span class="builtin">alias</span> -g .....=<span class="string">'../../../..'</span></code></pre>

<p>I certainly have a ton of shell tricks, but I will keep them for my other blog
posts. So, that&#8217;s all folks!</p>
]]></content:encoded>
			<wfw:commentRss>http://peadrop.com/blog/2007/04/07/welcome-to-mr-crystal-ball/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Back in Business</title>
		<link>http://peadrop.com/blog/2007/04/06/back-in-business/</link>
		<comments>http://peadrop.com/blog/2007/04/06/back-in-business/#comments</comments>
		<pubDate>Fri, 06 Apr 2007 21:13:02 +0000</pubDate>
		<dc:creator>Alexandre</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[Me]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://peadrop.com/blog/2007/04/06/back-in-business/</guid>
		<description><![CDATA[A burned video, a zapped hard drive and a corrupt RAM module later , I have now, finally, got my system running again (and no, my computer was not struck by a lightning). For the fans of my Emacs package, I just uploaded a new release, and I will continue to provide weekly releases. Unfortunately, [...]]]></description>
			<content:encoded><![CDATA[<p>A burned video, a zapped hard drive and a corrupt RAM module later , I
have now, finally, got my system running again (and no, my computer
was not struck by a lightning).</p>

<p>For the fans of <a href="http://peadrop.com/blog/2007/01/06/pretty-emacs/">my Emacs package</a>,
I just uploaded a new release, and I will continue to provide
weekly releases. Unfortunately, it seems, due to a licensing issue,
<a href="http://article.gmane.org/gmane.linux.debian.devel.emacsen/2292">Romain Francoise orphaned emacs-snapshot</a>
and its related packages. Therefore, this means I will have to work
harder and fix packaging bugs myself, instead of relying on his bug
fixes.</p>

<p>A week before I lost my system, I had promised a special Python quiz,
in the <a href="https://wiki.ubuntu.com/UbuntuWeeklyNewsletter/Issue31">issue #31</a>
of Ubuntu Weekly News. I have not forgotten my promise. So if you&#8217;re one of the
lovers my twisted <a href="https://wiki.ubuntu.com/UbuntuTrivia">Ubuntu quizzes</a>,
get ready for an awesome quiz. Date and time, when the quiz will be
held, will be announced, as usual, in the #ubuntu-trivia channel on
FreeNode.</p>

<p>On the final note, I would like to mention that will start posting
more frequently on my blog. My current roadmap includes some cool
tips-and-tricks, fun script recipes, more stuff about Ubuntu. So, stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://peadrop.com/blog/2007/04/06/back-in-business/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Debian Packaging 101 (Part 1)</title>
		<link>http://peadrop.com/blog/2007/01/30/debian-packaging-101-part-1/</link>
		<comments>http://peadrop.com/blog/2007/01/30/debian-packaging-101-part-1/#comments</comments>
		<pubDate>Wed, 31 Jan 2007 01:46:58 +0000</pubDate>
		<dc:creator>Alexandre</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://peadrop.com/blog/2007/01/30/debian-packaging-101-part-1/</guid>
		<description><![CDATA[Making packages for Debian derivatives (like Ubuntu) isn&#8217;t really hard. It just required some dedication to learn how the packaging system work. Yet, most users don&#8217;t know how to make packages for their distribution. In this series, I will try to give a brief introduction packaging. First, I would like to tell you that, if [...]]]></description>
			<content:encoded><![CDATA[<p>Making packages for Debian derivatives (like Ubuntu) isn&#8217;t really
hard. It just required some dedication to learn how the packaging
system work. Yet, most users don&#8217;t know how to make packages for
their distribution. In this series, I will try to give a brief
introduction packaging.</p>

<p>First, I would like to tell you that, if you never compiled a program
before, this short guide will be useless for you. Therefore, I assume
that you know and that you did compile a program before. Also, I will
use the term &#8220;package&#8221; to refer to the compiled program package ready
to installed on Debian or its derivatives. And, I will use the term
&#8220;program&#8221; to refer to the software, like &#8220;GNU Emacs&#8221;.</p>

<p>A package consists of two things: the source code of a program and a
<code>debian/</code> directory which contains information how to build the
program. There is different methods to specify the packaging
information. The most common one, and the one I will discuss here, is
using a tool called <code>debhelper</code>. This tool makes the packaging process
easier by abstracting the common packaging tasks into little scripts,
run at the build time. The typical directory structure of a package
looks like this:</p>

<pre><code>gnu-hello/
  debian/
    changelog
    compat
    control
    copyright
    postinst
    prerm
    rules
  doc/
  man/
  src/
  AUTHORS
  ChangeLog
  configure
  COPYING
  INSTALL
  README
</code></pre>

<p>Obviously, this example is simplified, but you get the idea. That are
the interesting things for a packager. By the way, GNU Hello a good
example of package to study. You get it with:</p>

<pre><code>$ apt-get source hello-debhelper
</code></pre>

<p>Here, a quick description of the files in the <code>debian/</code> directory:</p>

<ul>
<li><code>changelog</code>: The history of the package&#8217;s changes.</li>
<li><code>compat</code>: A file that contains the debhelper version that is used.</li>
<li><code>control</code>: The description of the package and the list of
dependencies.</li>
<li><code>copyright</code>: A copy of the licence the program uses.</li>
<li><code>postinst</code>: A post-installation script used to setup things after
the package has been unpacked.</li>
<li><code>prerm</code>: Another script that is run before the removal of the
package. It usually used to undo the things <code>postinst</code> has done.</li>
<li><code>rules</code>: The instructions how to build the package. This is simply
a Makefile.</li>
</ul>

<p>In more complicated programs, there is usually other files. However, I
won&#8217;t talk about them in this introduction. Anyway, I am out of time.
In the second part of this series, I will explain the tools used to
build packages.</p>
]]></content:encoded>
			<wfw:commentRss>http://peadrop.com/blog/2007/01/30/debian-packaging-101-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pretty Emacs</title>
		<link>http://peadrop.com/blog/2007/01/06/pretty-emacs/</link>
		<comments>http://peadrop.com/blog/2007/01/06/pretty-emacs/#comments</comments>
		<pubDate>Sun, 07 Jan 2007 04:56:56 +0000</pubDate>
		<dc:creator>Alexandre</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://peadrop.com/blog/2007/01/06/pretty-emacs/</guid>
		<description><![CDATA[Update: If you are using Ubuntu 8.04 LTS &#8220;Hardy Heron&#8221; or Ubuntu 8.10 &#8220;Intrepid Ibex&#8221;, use the packages in the PPA of the Ubuntu Emacs Lisp team, instead of the packages referenced here. For Ubuntu 9.04 &#8220;Jaunty Jackalope&#8221; and newer, use the packages in Ubuntu repositories. Emacs is my editor of choice. In fact, I [...]]]></description>
			<content:encoded><![CDATA[<div style="background-color: #FFCCCC; border: 1px solid #663333">
<b>Update:</b> If you are using Ubuntu 8.04 LTS &#8220;Hardy Heron&#8221; or Ubuntu 8.10 &#8220;Intrepid Ibex&#8221;, use the packages in the <a href="https://launchpad.net/~ubuntu-elisp/+archive/ppa">PPA of the Ubuntu Emacs Lisp team</a>, instead of the packages referenced here. For Ubuntu 9.04 &#8220;Jaunty Jackalope&#8221; and newer, use the packages in Ubuntu repositories.
</div>

<p>Emacs is my editor of choice. In fact, I should say it&#8217;s my framework
of choice, but that&#8217;s for <a href="http://peadrop.com/blog/2007/03/03/tips-on-emacs/">another post</a>.
Until recently, I disliked the poor font backend of Emacs. So, I was always using Emacs within a
terminal window to get a decent looking interface. However, this grungy font era is over, since Emacs&#8217;s
 hackers added recently to my favorite editor a XFont backend, thus making possible to use good looking
fonts, like Bitstream Vera Sans Mono.</p>

<div class="imagecenter">
<img src="http://peadrop.com/blog/images/emacs.png" alt="Screenshot of Emacs with XFT support" />
</div>

<p>I made a package that makes the installation, as painless as
possible. So, feel free to use it. However, please note that this is
an alpha release of Emacs, therefore it should only be used for
testing. (From my experience, it&#8217;s rock solid.)</p>

<p>Still interested? Then, here the instructions. First, add my repository into
your software source list, by adding the following lines to <code>/etc/apt/sources.list</code>:</p>

<pre><code>deb     http://ppa.launchpad.net/avassalotti/ubuntu feisty main
deb-src http://ppa.launchpad.net/avassalotti/ubuntu feisty main
</code></pre>

<p>If you are running Ubuntu 6.10 (Edgy Eft) or the current development version of
Ubuntu (Gutsy Gibbon), change <code>feisty</code> for <code>edgy</code> or <code>gutsy</code>.</p>

<p>Finally, run either <code>apt-get</code> or <code>aptitude</code> to fetch and install the
packages:</p>

<pre><code>sudo aptitude update
sudo aptitude install emacs-snapshot emacs-snapshot-el
</code></pre>

<p>Now, you need to specify the font you want to use in your <code>Xresources</code>
file.</p>

<pre><code>echo "Emacs.font: Monospace-10" &gt;&gt; ~/.Xresources
xrdb -merge ~/.Xresources
</code></pre>

<p>Here, I use the default <code>monospace</code> font, but any other monospaced
font should work too. For example, if you want to use Lucida Sans
Typewriter instead, change <code>Monospace-10</code> for <code>Lucida Sans
Typewriter-10</code> in the above command.</p>

<p>And that&#8217;s it! Now, launch Emacs and enjoy the good looking fonts.</p>

<p>If you need support with the package, just email me at
 &#97;&#108;&#101;&#120;&#97;&#110;&#100;&#114;&#101;&#64;&#112;&#101;&#97;&#100;&#114;&#111;&#112;&#46;&#99;&#111;&#109;.</p>

<p><em>Update:</em> Il y a, maintenant, une <a href="http://doc.ubuntu-fr.org/emacs">version en français</a> de ce guide sur le wiki de
  Ubuntu-fr.</p>
]]></content:encoded>
			<wfw:commentRss>http://peadrop.com/blog/2007/01/06/pretty-emacs/feed/</wfw:commentRss>
		<slash:comments>78</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc
Database Caching 1/56 queries in 0.016 seconds using apc
Object Caching 529/653 objects using apc

Served from: peadrop.com @ 2013-05-19 21:20:47 -->