<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>
I’m Mustafa Paksoy and I write code for a living. I post assorted items of interest here.



I also take pictures and dabble in Twitter.
</description><title>rapid habits ❧ mustafa paksoy</title><generator>Tumblr (3.0; @paksoy)</generator><link>http://paksoy.net/</link><item><title>"The major difference between a thing that might go wrong and a thing that cannot possibly go wrong..."</title><description>“The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt; Douglas Adams, presumably talking about how distributed systems are more reliable since fault tolerance is baked into the architecture&lt;/em&gt;</description><link>http://paksoy.net/post/952944249</link><guid>http://paksoy.net/post/952944249</guid><pubDate>Sat, 14 Aug 2010 12:40:15 -0400</pubDate></item><item><title>I keep coming back to this one.</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_l6t94rp89Q1qz98l3o1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;I keep coming back to this one.&lt;/p&gt;</description><link>http://paksoy.net/post/920093654</link><guid>http://paksoy.net/post/920093654</guid><pubDate>Sat, 07 Aug 2010 21:50:00 -0400</pubDate></item><item><title>"My ability to decide how I feel about Wikileaks’ activities is totally annihilated by my ongoing..."</title><description>“My ability to decide how I feel about Wikileaks’ activities is totally annihilated by my ongoing realization that it cannot possibly be real. It’s a plot device in a near-future thriller novel. I mean, seriously, semi-stateless man with an unusual appearance uses an army of anonymous allies to expose governments’ secrets, and posts an insurance file in public with some kind of deadman switch in case he’s taken out by his enemies? That shit does not happen in real life. Julian Assange is a Neal Stephenson character who’s escaped in to the real world.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;&lt;a href="http://www.metafilter.com/94273/The-plot-thickens#3212444" target="_blank"&gt;Tomorrowful on MetaFilter&lt;/a&gt; (via &lt;a href="http://simonwillison.net/2010/Aug/1/plotdevice/" target="_blank"&gt;Simon Willison&lt;/a&gt;)&lt;/em&gt;</description><link>http://paksoy.net/post/893562236</link><guid>http://paksoy.net/post/893562236</guid><pubDate>Mon, 02 Aug 2010 11:45:00 -0400</pubDate><category>literature</category><category>journalism</category></item><item><title>Co-worker: moved files&#13;</title><description>Co-worker: moved files&lt;br /&gt;&#13;
Co-worker: scourge of p4&lt;br /&gt;&#13;
Me: more like code, the scourge of p4&lt;br /&gt;&#13;
Me: p4 would be so happy if it didn't have to deal with the contents of files&lt;br /&gt;&#13;
Me: just the metadata&lt;br /&gt;&#13;
Me: who has what opened when&lt;br /&gt;&#13;
Me: it loves that</description><link>http://paksoy.net/post/845833036</link><guid>http://paksoy.net/post/845833036</guid><pubDate>Thu, 22 Jul 2010 13:28:40 -0400</pubDate><category>perforce</category></item><item><title>Photo</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_l5ryjtjtSh1qz98l3o1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;</description><link>http://paksoy.net/post/829344473</link><guid>http://paksoy.net/post/829344473</guid><pubDate>Sun, 18 Jul 2010 18:31:05 -0400</pubDate></item><item><title>Identity crisis</title><description>&lt;p&gt;Web apps should look like great web apps. Not like 2rd rate desktop apps.&lt;/p&gt;

&lt;p&gt;As Rumi once said, either be as you seem, or seem as you are. Otherwise we get into this &lt;a href="http://en.wikipedia.org/wiki/Uncanny_valley" target="_blank"&gt;uncanny valley&lt;/a&gt; situation.&lt;/p&gt;</description><link>http://paksoy.net/post/631421772</link><guid>http://paksoy.net/post/631421772</guid><pubDate>Tue, 25 May 2010 10:42:15 -0400</pubDate><category>web</category><category>ui</category></item><item><title>Game of Life Implementation in Erlang</title><description>&lt;a href="http://github.com/mustpax/erlang-gameoflife"&gt;Game of Life Implementation in Erlang&lt;/a&gt;: &lt;p&gt;This is a Game of Life implementation written in Erlang. Each cell is handled by a single process and each process talks to nearby cells via message passing to figure out state. At the end of the simulation the cells send their final state back to the root node i.e. the process that spawned them. I tried to stick with Erlang conventions for recursion and whatnot, but there are some rough edges, aesthetically speaking around the array handling. Still it works, as far as I can tell.&lt;/p&gt;</description><link>http://paksoy.net/post/470191045</link><guid>http://paksoy.net/post/470191045</guid><pubDate>Wed, 24 Mar 2010 09:25:14 -0400</pubDate><category>erlang</category><category>cellular automata</category><category>programming</category></item><item><title>Find file, cd to parent directory</title><description>&lt;p&gt;For jumping around in elaborate source trees.&lt;/p&gt;

&lt;p&gt;Usage:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cdto [search root directory] [case insensitive filename]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you just want to search current directory:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cdto [case insensitive filename]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Automatically appends * to search filename.&lt;/p&gt;

&lt;script src="http://gist.github.com/327229.js?file=cdto.sh"&gt;&lt;/script&gt;</description><link>http://paksoy.net/post/437611482</link><guid>http://paksoy.net/post/437611482</guid><pubDate>Tue, 09 Mar 2010 17:48:00 -0500</pubDate><category>bash</category><category>cli</category></item><item><title>Works as intended </title><description>&lt;p&gt;&lt;a href="http://i.seemikecode.com/" title="Remote programming interview tool" target="_blank"&gt;See[Mike]Code&lt;/a&gt; is a nifty tool for conducting remote programming interviews. One of the comments on the site bemoans the potential downsides of asking real programming questions during interviews:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The problem is often with the interview questions, for example:&lt;/p&gt;
  
  &lt;p&gt;“Write a loop that counts from 1 to 10” or “What’s the number after F in hexadecimal?”&lt;/p&gt;
  
  &lt;p&gt;As a web developer who has 5 years experience and build a number of large web applications for satisfied clients, I have never had to do anything with hex and simply would not know the answer in an interview.&lt;/p&gt;
  
  &lt;p&gt;However if I needed to do it in a job I would reference the API’s and be able to answer this in less than 2 minutes….&lt;/p&gt;
  
  &lt;p&gt;— ProgrammerJ&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I don’t doubt that the commenter is a successful web developer, but no amount of API documentation would fix not knowing what hex notation is. Some basic computer science knowledge is required to capably consume technical documentation.&lt;/p&gt;</description><link>http://paksoy.net/post/405136240</link><guid>http://paksoy.net/post/405136240</guid><pubDate>Mon, 22 Feb 2010 11:53:00 -0500</pubDate><category>programming</category><category>interviewing</category></item><item><title>Highcharts: Beautiful Charts in Pure JavaScript</title><description>&lt;a href="http://www.highcharts.com/demo/"&gt;Highcharts: Beautiful Charts in Pure JavaScript&lt;/a&gt;: &lt;p&gt;Beautiful pure JavaScript HTML charts. Doesn’t even use the canvas element from what I can tell, which means better IE support. Also, plenty of DOM nodes to attach even handlers to.&lt;/p&gt;

&lt;p&gt;Spending server cycles to generate raster images of charts is getting silly.&lt;/p&gt;</description><link>http://paksoy.net/post/265201516</link><guid>http://paksoy.net/post/265201516</guid><pubDate>Tue, 01 Dec 2009 14:51:00 -0500</pubDate></item><item><title>Photo</title><description>&lt;img src="http://30.media.tumblr.com/tumblr_kt3vucH9na1qz98l3o1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;</description><link>http://paksoy.net/post/243703247</link><guid>http://paksoy.net/post/243703247</guid><pubDate>Sat, 14 Nov 2009 10:47:00 -0500</pubDate></item><item><title>Honor among developers: self-assessing productivity</title><description>&lt;p&gt;There is a &lt;a href="http://news.ycombinator.com/item?id=901600" title="Hacker news thread:     What we actually know about software development, and why we believe it’s true" target="_blank"&gt;discussion brewing on HN&lt;/a&gt; today about measuring programmer productivity. Reg Braithwaite &lt;a href="http://github.com/raganwald/homoiconic/blob/master/2009-02-12/a_question.md" title="Reg Braithwaite" target="_blank"&gt;chimes in to ask a very pertinent question&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Programmers talk about productivity all the time. They say they’re more productive with static typing or without it. With Ruby or with Java. … It seems every programmer I meet has strong opinions about when they are more productive and when they are not. So, here’s my question:&lt;/p&gt;
  
  &lt;p&gt;How are all these people measuring programmer productivity?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The observation is spot-on. Most developers know exactly what makes them more, or, less productive. They may not be able to assess if something they haven’t used yet will boost their productivity; but of the tools and habits they have tried in the past, they have strong feelings about their current choice.&lt;/p&gt;

&lt;p&gt;In an intangible way, every good developer I’ve met knows when she has had a productive day. It’s mostly a feeling that comes without rational explanation. This intuition is what developers are using when they express their choice for Java or Ruby. They have used both, and they know which &lt;em&gt;felt&lt;/em&gt; right and which did not.&lt;/p&gt;

&lt;p&gt;But there is a catch: you can’t harness this intuition if there are incentives to assess your own productivity too positively. Say, like, an annual performance review that your job depends on. Yet, this isn’t because developers are crooks. Something so intangible like an intuition is susceptible to being skewed for very innocent psychological reasons. 
This is also why a good manager will allow you to freely raise the issue when you haven’t been productive. It’s the only way she can find out why and address the root cause whatever it may be.&lt;/p&gt;

&lt;p&gt;Professional assessment attaches very real consequences to being productive. You can’t let a developer search her own soul about if she should get a raise this year. She would really like to believe she should. However, if you simply want to make your team as productive as possible, let them be honest with you about it (and, by extension with themselves).&lt;/p&gt;</description><link>http://paksoy.net/post/223053466</link><guid>http://paksoy.net/post/223053466</guid><pubDate>Sun, 25 Oct 2009 16:23:00 -0400</pubDate></item><item><title>Push notifications in the age firewalls</title><description>&lt;p&gt;In the world of client-server networking, web browsers are the ultimate clients. They are always sending &lt;code&gt;SYN&lt;/code&gt; packets, but never receiving any. They are always establishing outgoing connections, but never get to listen to any ports.&lt;/p&gt;

&lt;p&gt;Due to the ubiquity of the web, we have built our networks around the need to browse. Most NATs will not let any incoming connection near the private subnet. Similarly, our corporate firewalls cull incoming connections with extreme prejudice. As a result, an outgoing SYN packet on port 80 is the X86 of network connectivity. It’s as portable a networking tool as it gets, but it’s getting kludgier by the minute.&lt;/p&gt;

&lt;p&gt;Polling is a particularly unfortunate result of this outgoing connection based architecture. Take RSS readers: imagine a website that posts 10 new items a day, if you poll this site every 5 minutes, you are wasting your time 97% of the time. Granted, you are getting &lt;code&gt;304 Not Modified&lt;/code&gt; responses without any HTTP response body. But these requests still consume threads, CPU and network resources on the server. At the end of the day we are also only getting 2.5 minutes of average latency, which in computer terms, is not very fast. In short, &lt;a href="http://code.google.com/p/pubsubhubbub/wiki/WhyPollingSucks" title="PubSub Hubbub on why polling sucks" target="_blank"&gt;polling sucks.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/p/pubsubhubbub/" title="PubSub Hubbub Project Homepage" target="_blank"&gt;The PubSub Hubbub protocol&lt;/a&gt; aims to solve this problem by allowing the server to push content to the readers directly. Unfortunately, as explained above, the server cannot establish a connection to a lot of clients out there. You would be able to connect to web based feed readers like Google Reader, because Google understands how to configure a network to allow incoming connections. But the average user either is not permitted to modify their network configuration (office) or don’t know how to do it themselves (home). As cool as PubSub is, it just does not solve the problem at hand.&lt;/p&gt;

&lt;p&gt;Which brings me to the actual solution to the HTTP push problem: long polling. With long polling, instead of promptly responding with a 304, the server lets the connection go idle as long as there is no content to send. The client on the other hand, reinitiates a new request as soon as it gets a response. The server also does not need to allocate threads to each incoming request, a single thread can wait on multiple incoming requests and respond to them as new data becomes available. The client gets an almost immediate notification, the server does not have to waste time handing out 304s. Everybody is happy.&lt;/p&gt;

&lt;p&gt;With that we have implemented yet another version reverse-tunneling to deal with NAT. Honestly, for the near future, we are going to have to fit the square peg of push notification into the round hole of browser acting as a client.&lt;/p&gt;</description><link>http://paksoy.net/post/215597761</link><guid>http://paksoy.net/post/215597761</guid><pubDate>Sat, 17 Oct 2009 12:59:00 -0400</pubDate><category>http</category><category>push</category><category>networking</category></item><item><title>Come on Neo, Ctrl-C sends SIGTERM, not CTRL-X.

(From the...</title><description>&lt;img src="http://27.media.tumblr.com/tumblr_kojzloKRIn1qz98l3o1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Come on Neo, &lt;code&gt;Ctrl-C&lt;/code&gt; sends &lt;a href="http://en.wikipedia.org/wiki/SIGTERM" title="Wikipedia article on SIGTERM" target="_blank"&gt;SIGTERM&lt;/a&gt;, not &lt;code&gt;CTRL-X&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;(From the beginning of first movie of course.)&lt;/p&gt;</description><link>http://paksoy.net/post/165400959</link><guid>http://paksoy.net/post/165400959</guid><pubDate>Mon, 17 Aug 2009 23:41:00 -0400</pubDate></item><item><title>Only Twitter can save us from URL shorteners</title><description>&lt;p&gt;Twitter should make URL shortening moot by allowing a link to be included with each Tweet at a fixed character cost of 5-10 characters.&lt;/p&gt;

&lt;p&gt;Everybody hates URL shorteners. They slow down page loads, can frame your content, steal your PageRank and even &lt;a href="http://www.techcrunch.com/2009/08/09/trim-throws-in-the-towel/" title="TechCrunch article: tr.im throws in the towel" target="_blank"&gt;drop dead without notice&lt;/a&gt; (&lt;a href="http://blog.tr.im/post/160697842/tr-im-resurrected" title="tr.im declares they are back in business" target="_blank"&gt;and come back alive in a similarly suprising fashion&lt;/a&gt;). I mean, even &lt;a href="http://www.codinghorror.com/blog/archives/001276.html" title="Jeff Atwood on URL Shorteners" target="_blank"&gt;Jeff Atwood thinks they are hack&lt;/a&gt;, and he’s a very practical fellow.&lt;/p&gt;

&lt;p&gt;To remedy these issues, some well-intentioned people are putting together &lt;a href="http://code.google.com/p/shortlink/wiki/Specification" target="_blank"&gt;a spec for webmasters to declare their own short URLs&lt;/a&gt;. The thinking goes, other short URL services would first check the target page and use the webmaster specified short URL if one exists. The difficulty of getting URL shorteners to cooperate aside, there is a more fundamental problem here: we should not need short URLs in the first place.&lt;/p&gt;

&lt;p&gt;Let me be more direct: Twitter is the only reason URL shorteners are rearing their collective head again. This, at the end of the day, is simply a design defect. While the 140 character limit is what makes Twitter special, the interaction between this limit and URLs at large has the harmful side-effect of requiring third parties to build applications for the sole-purpose of providing 301 redirects. See above for potential issues with such applications.&lt;/p&gt;

&lt;p&gt;As new usage patterns emerge for their platform, Twitter do a great job improving their API to provide the smooth, seamless experience that their users have come to expect. Even better, their developer community does a great job including such improvements in their apps. This, after all, is exactly what is happening with &lt;a href="http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses-retweet" title="Twitter's new retweet API" target="_blank"&gt;the Re-tweet API&lt;/a&gt; right now.&lt;/p&gt;

&lt;p&gt;The solution to the URL shortening problem is for Twitter to allow one URL to be included with each Tweet for a negligible character cost (say, 5-10 characters). They could then use their default short URL provider for SMS updates, which do have technical character count limit. More importantly, Twitter could sell the click-through stats of all URLs, shortened or not. Power users of all stripes might be willing to pay for this functionality.&lt;/p&gt;

&lt;p&gt;Any experienced developer can tell you that there are a million ways of implementing any piece of functionality. Some are just better than others. They cause less exposure to bugs, implementation issues, or even attack surface. Sure, you could try to implement &lt;a href="http://www.jcryption.org/" title="jCryption: JavaScript date encryption" target="_blank"&gt;transport-layer encryption with JavaScript&lt;/a&gt; but it’s just &lt;a href="http://news.ycombinator.com/item?id=748430" title="Hacker News discussion thread on jCryption" target="_blank"&gt;not the right place to do it&lt;/a&gt;. Similarly, making long URLs play nice with the character limit is a task best handled within Twitter’s API by Twitter themselves.&lt;/p&gt;</description><link>http://paksoy.net/post/164888805</link><guid>http://paksoy.net/post/164888805</guid><pubDate>Mon, 17 Aug 2009 10:01:00 -0400</pubDate><category>twitter</category><category>web</category><category>opinion</category></item><item><title>How Dropbox saved my command line</title><description>&lt;p&gt;I live in the command line across many Unix-like platforms and networks. I have two Mac laptops, two Linux workstations, shell logins scattered across the multiverse, and even a couple Windows VMs to boot. I’ve tried versioning my shell configuration files, but that requires me to check in/check out my changes across all environments. This turned out to be less than ideal. More manual effort, more hassle.&lt;/p&gt;

&lt;p&gt;Enter &lt;a href="http://www.getdropbox.com" target="_blank"&gt;Dropbox&lt;/a&gt; that syncs the files across multiple machines seamlessly and even gives you a bit of revision history. I concocted a system on top of Dropbox that allows me to have global, per OS, and per machine shell configs. For example, here are all the Bash config files I keep in sync via Dropbox (machine names changed to protect the innocent):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ ls ~/Dropbox/shell/bash
bashbootstrap  bashrc
bashrc-Darwin  bashrc-Darwin-laptopname  bashrc-Darwin-mininame
bashrc-Linux  bashrc-Linux-machineone  bashrc-Linux-machinetwo
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Let’s ignore the &lt;code&gt;bashbootstrap&lt;/code&gt; file for the moment. You will notice that we have a globally-applied config file, &lt;code&gt;bashrc&lt;/code&gt;, two OS specific config files, &lt;code&gt;bashrc-Linux&lt;/code&gt;, &lt;code&gt;bashrc-Darwin&lt;/code&gt;, and several machine specific ones. (By the way, Darwin is the name of OS X’s BSD-like kernel.)&lt;/p&gt;

&lt;p&gt;What ties it all together is the &lt;code&gt;bashbootstrap&lt;/code&gt; file. It loads each applicable config file in order of increasing specificity, this allows per OS and per machine overrides to have higher precedence. Additionally, we silently skip missing config files; you need not create empty config files for each of your machines to keep the script happy.&lt;/p&gt;

&lt;p&gt;On a new machine, after installing Dropbox on &lt;code&gt;~/Dropbox&lt;/code&gt;, I move away the default &lt;code&gt;.bashrc&lt;/code&gt; and just symlink the bootstrap file in its place instead:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ mv ~/.bashrc ~/.bashrc.bak
$ ln -s ~/Dropbox/shell/bash/bashbootstrap  ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Oh, and here are the contents of the &lt;code&gt;bashbootstrap&lt;/code&gt; file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;if [ -z "$PS1" ]; then
   return
fi

dropboxshelldir=~/Dropbox/shell
dropboxdir=$dropboxshelldir/bash
masterbashrc=$dropboxdir/bashrc
osbashrc=$masterbashrc-`uname`
localbashrc=$osbashrc-`hostname | cut -d. -f1`

echo -n "Applicable shell configs: "
for bashfile in "$masterbashrc" "$osbashrc" "$localbashrc"; do
  if [ -r $bashfile ]; then
    . $bashfile
    echo -n "`basename $bashfile` "
  fi
done
echo

# Set convenience aliases
myed=${VISUAL:-${EDITOR:-vim}}
alias editbashrc="$myed $masterbashrc"
alias editosbashrc="$myed $osbashrc"
alias editlocalbashrc="$myed $localbashrc"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;One final note, this script also provides three convenience aliases for editing your Bash config files without having to remember where they are stored.&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;&lt;strong&gt;&lt;code&gt;editbashrc&lt;/code&gt;:&lt;/strong&gt; Edit the global config file.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;editosbashrc&lt;/code&gt;:&lt;/strong&gt; Edit the OS-specific config file.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;editlocalbashrc&lt;/code&gt;:&lt;/strong&gt; Edit the machine-specific config file.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;I only tested this on Bash, but it could work on other Bash like shells. But, as they say, your mileage may vary.&lt;/p&gt;

&lt;p&gt;Did I mention that if you &lt;a href="https://www.getdropbox.com/referrals/NTY0Mjg3NDk" title="Dropbox referral signup" target="_blank"&gt;sign up to Dropbox with my referral&lt;/a&gt; we both get 250 megs of additional storage? Neat!&lt;/p&gt;</description><link>http://paksoy.net/post/159917345</link><guid>http://paksoy.net/post/159917345</guid><pubDate>Mon, 10 Aug 2009 13:32:28 -0400</pubDate><category>bash</category><category>dropbox</category><category>howto</category></item><item><title>The poor man’s Bash Tab-completion</title><description>&lt;p&gt;Bash has a built-in tab completion utility that sports an impressive array features and the ability to generate suggestions using complex logic. But what if you just want to add a static list of suggestions to a command? It took a little digging around the &lt;a href="http://www.gnu.org/software/bash/manual/bashref.html#Programmable-Completion" title="Bash Manual: Programmable Completion" target="_blank"&gt;Bash manual&lt;/a&gt; but I finally found the magic words you need to add to you &lt;code&gt;.bashrc&lt;/code&gt; file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;complete -o default -W "list of space separated words" [command]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Obviously, you need to replace &lt;code&gt;list of space separated words&lt;/code&gt; and &lt;code&gt;[command]&lt;/code&gt; with values of your choice.  For the curious, let’s take this command apart and see what’s going on:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;&lt;strong&gt;complete&lt;/strong&gt;: Built in Bash command for controlling built-in tab completion behavior&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;-o default&lt;/strong&gt;: Tell Bash to fall back on the default filename completion if no matches are found.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;-W “list of space separated words”&lt;/strong&gt;: This is where the magic happens. &lt;code&gt;-W&lt;/code&gt; allows us to just provide a static list of suggestions. There are other flags that will dynamically evaluate suggestions at runtime, but we’ll leave that to a future post.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;[command]&lt;/strong&gt;: The command that tab-completion will apply to.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Say I want to just add the suggestions “all” and “clean” to the command &lt;code&gt;make&lt;/code&gt;. The line I need to append to my &lt;code&gt;.bashrc&lt;/code&gt; becomes:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;complete -o default -W "all clean" make
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Bonus: get a little dynamic&lt;/h2&gt;

&lt;p&gt;Using &lt;a href="http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_04.html#sect_03_04_04" title="Bash manual on command substitution" target="_blank"&gt;command substitution&lt;/a&gt;
we can also generate the list of suggestions at Bash start time. This is very useful for completing names that can be found in other configuration files (like, say, &lt;a href="http://www.commandlinefu.com/commands/view/2759/ssh-autocomplete" title="Command-line Fu discussion about SSH auto-completion" target="_blank"&gt;SSH host-name completion&lt;/a&gt;).&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;complete -o default -W "`echo $(cat /path/to/file | grep 'lines i want')`" \
    [command]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;(You might notice that we are using command substitution twice in the example above, once with back-ticks the other time using &lt;code&gt;$(command)&lt;/code&gt;. This is necessary because the &lt;code&gt;-W&lt;/code&gt; argument does not accept new-line characters as delimiters. &lt;code&gt;echo&lt;/code&gt;ing will convert these new-lines in to spaces.)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Update:&lt;/em&gt; The friendly folks over at &lt;a href="http://news.ycombinator.com/item?id=751068" title="Hacker News discussion thread on this post" target="_blank"&gt;HN&lt;/a&gt; have pointed out that there non-stupid ways of putting together the aforementioned command substitution. Thanks for the correction folks! Here’s a better way to do it:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;complete -o default -W "$(grep 'lines i want' /path/to/file | tr '\n' ' ')" \
    [command]
&lt;/code&gt;&lt;/pre&gt;</description><link>http://paksoy.net/post/158766842</link><guid>http://paksoy.net/post/158766842</guid><pubDate>Sat, 08 Aug 2009 18:14:00 -0400</pubDate><category>bash</category><category>cli</category><category>howto</category></item><item><title>Add ellipses (…) to overflowing text content</title><description>&lt;a href="http://msdn.microsoft.com/en-us/library/ms531174(VS.85).aspx"&gt;Add ellipses (…) to overflowing text content&lt;/a&gt;: &lt;p&gt;This is one of those rare moments when IE has a neat bit of CSS functionality that other browsers don’t have. Sure you could try emulating this behavior in other browsers with the &lt;code&gt;onoverflow&lt;/code&gt; event handler, but it would be a hackish and fragile implementation.&lt;/p&gt;

&lt;p&gt;Minimalist standards documents aside, some pieces of functionality are best supported by the browser, like &lt;code&gt;contentEditable&lt;/code&gt;.&lt;/p&gt;</description><link>http://paksoy.net/post/83613054</link><guid>http://paksoy.net/post/83613054</guid><pubDate>Wed, 04 Mar 2009 19:32:00 -0500</pubDate><category>web development</category><category>css</category><category>internet explorer</category></item><item><title>"Participants seeking to dodge troubles [related to derivatives] face the same problem as someone..."</title><description>“Participants seeking to dodge troubles [related to derivatives] face the same problem as someone seeking to avoid venereal disease. It’s not just whom you sleep with, but also whom they are sleeping with.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Warren Buffet as quoted in the &lt;a href="http://www.nytimes.com/2009/03/01/business/01buffett.html" target="_blank"&gt;NY Times&lt;/a&gt;.&lt;/em&gt;</description><link>http://paksoy.net/post/82384805</link><guid>http://paksoy.net/post/82384805</guid><pubDate>Sat, 28 Feb 2009 19:25:03 -0500</pubDate></item><item><title>Sita Sings the Blues</title><description>&lt;a href="http://www.thirteen.org/sites/reel13/indies/indie-sita-sings-the-blues/241/"&gt;Sita Sings the Blues&lt;/a&gt;: &lt;p&gt;Lovely animated film about &lt;a href="http://en.wikipedia.org/wiki/Ramayana" target="_blank"&gt;Ramayana&lt;/a&gt; by Nina Paley, the complete thing is available online for free. via &lt;a href="http://www.kottke.org/09/02/sita-sings-the-blues" target="_blank"&gt;kottke.org&lt;/a&gt;.&lt;/p&gt;</description><link>http://paksoy.net/post/82214354</link><guid>http://paksoy.net/post/82214354</guid><pubDate>Sat, 28 Feb 2009 02:07:00 -0500</pubDate></item></channel></rss>
