<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title>Flying Seagull</title>
        <link type="application/atom+xml" href="http://reza.jelveh.me/atom.xml" rel="self" />
        <link type="text/html" href="http://reza.jelveh.me/" rel="alternate" />
	<id>tag:flyingseagull.de,2010:/atom.xml</id>
	<updated>2014-02-28T22:49:23+01:00</updated>
	
	<entry>
		<title>A critical look at Atom.io</title>
		<author>
			<name>Reza Jelveh</name>
		</author>
                <link type="text/html" href="http://reza.jelveh.me/2014/02/28/a-critical-look-at-atom" rel="alternate" />
		<updated>2014-02-28T00:00:00-07:00</updated>
		<id>tag:flyingseagull.de,2014-02-28:/2014/02/28/a-critical-look-at-atom</id>
		<content type="html">&lt;p&gt;I&#39;m currently sitting at my Macbook Air 2013 writing this, which supposedly has a Haswell i7 ultramobile inside. According to my standards that&#39;s a pretty decent amount of computing power.&lt;/p&gt;

&lt;p&gt;If you want to read a different kind of review on Atom please take a look at the &lt;a href=&quot;http://dylanfoundry.org/2014/02/28/early-thoughts-on-atom/&quot;&gt;Dylan foundry&lt;/a&gt;, since I&#39;ll be focussing a bit on the performance aspect of the editor.&lt;/p&gt;

&lt;h3&gt;A few words of praise&lt;/h3&gt;

&lt;p&gt;Because I dive in too deep, I want to bring in a few words of praise. Github has managed to create a huge buzz around their editor even before it got launched. At the time of this writing it has 23.2k followers on &lt;a href=&quot;https://twitter.com/atomeditor&quot;&gt;Twitter&lt;/a&gt; with only 4 tweets so far. Everyone is hyped by the editor. Getting traction on an editor is actually a big factor to its&#39; success. &lt;a href=&quot;https://github.com/chrizel/Yzis&quot;&gt;Yzis&lt;/a&gt; for example died a slow, silent, and painful death.&lt;/p&gt;

&lt;p&gt;Starting it you get greeted by a nice dark theme, with a info markdown - I love dark editor themes -. When you open the preferences you get a nice package editor and theme downloader.&lt;/p&gt;

&lt;p&gt;The first thing I tried was using the fuzzy completer on a fairly big c++ project, and it was a truely pleasent experience. In fact if you don&#39;t use the &lt;a href=&quot;https://github.com/JazzCore/ctrlp-cmatcher&quot;&gt;c extension to ctrlp&lt;/a&gt; it&#39;ll be much faster than ctrlp in vim.&lt;/p&gt;

&lt;p&gt;One of the biggest fears I had already start bothering me. I don&#39;t like the font rendering in browser for text editing, this I guess is subjective.&lt;/p&gt;

&lt;p&gt;You can modify the font size by going to &lt;code&gt;Atom-&amp;gt;Open Your Config&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Furthermore you can disable Antialiasing in the editor by simply setting &lt;code&gt;-webkit-font-smoothing: none;&lt;/code&gt; in your stylesheet. But good luck using bitmap fonts in Chrome.&lt;/p&gt;

&lt;p&gt;So far, so good.&lt;/p&gt;

&lt;h3&gt;But wait&lt;/h3&gt;

&lt;p&gt;A good way to get an idea of what happens behind the scenes is playing around with bigger files. If you open a file that is above 2 megabytes big Atom throws you into the debug console saying that &gt; 2mb files are not yet supported. What about something smaller ones?&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;    528K openwns/buildlog.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;By the way,&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Javascript is not made for string manipulation&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I have &quot;reduced&quot;(hah) my vim config to about 50 plugins, so it takes ~25 megabytes of ram&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;     13248 /usr/bin/python /Users/dude/.vim/bundle/YouCompleteMe/python/ycm/server/ycmd.py --port&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;61028 --options_file&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/var/folders/gp/6p30hs7x04356bh95mtf_34m0000gn/T/tmpYTYJAH
     24848 /Applications/MacVim.app/Contents/MacOS/vim buildlog.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;25m for vim and 13m for my autocompletion daemon(which I should probably disable on text files).&lt;/p&gt;

&lt;p&gt;Compare that to same file opened in Atom.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;     42464 /Applications/Atom.app/Contents/Frameworks/Atom Helper.app/Contents/MacOS/Atom Helper --eval require&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;#39;&lt;/span&gt;/Applications/Atom.app/Contents/Resources/app/node_modules/coffee-scr
     77120 /Applications/Atom.app/Contents/MacOS/Atom
     83584 /Applications/Atom.app/Contents/Frameworks/Atom Helper.app/Contents/MacOS/Atom Helper --type&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;renderer --disable-accelerated-compositing --js-flags&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;--harmony_collections --
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Atom is the base application. Atom Helper are as far as I remember the Chromium embedded bridge.&lt;/p&gt;

&lt;h3&gt;Search speed and memory&lt;/h3&gt;

&lt;p&gt;Doing regex searches in vim on that file is instant. The memory barely moves.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;     24940 /Applications/MacVim.app/Contents/MacOS/vim buildlog.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;What about Atom?&lt;/p&gt;

&lt;p&gt;Searching for the character d takes almost 10 seconds in Atom, and significantly increases memory usage.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;    309404 /Applications/Atom.app/Contents/Frameworks/Atom Helper.app/Contents/MacOS/Atom Helper --type&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;renderer --disable-accelerated-compositing --js-flags&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;--harmony_collections --
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;When I say significantly, I&#39;m talking 200 megs. I&#39;m guessing that can probably be reduced a bit by disabling search highlights. Longer searches are not as slow, but unless you copy and paste your search term you might have a 20 to 30 second delay before you actually get to search what you want.&lt;/p&gt;

&lt;p&gt;As a little bonus you can trigger fast subsequent searches, scroll around a bit, and increase a single editor windows memory usage to multiple gigabytes in size. I&#39;m guessing this is in part related to how string processing in javascript works, and in part related to how their highlighting code works.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;    530268 /Applications/Atom.app/Contents/Frameworks/Atom Helper.app/Contents/MacOS/Atom Helper --type&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;renderer --disable-accelerated-compositing --js-flags&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;--harmony_collections --
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;A couple minutes later it actually got garbage collected a little, but I don&#39;t know how predictable this behavior is, waiting another 20 minutes yields following.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;    220196 /Applications/Atom.app/Contents/Frameworks/Atom Helper.app/Contents/MacOS/Atom Helper --type&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;renderer --disable-accelerated-compositing --js-flags&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;--harmony_collections --
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Either way, in first as big as half a megabyte you&#39;ll get choppy scrolling performance on a haswell machine.&lt;/p&gt;

&lt;p&gt;Let&#39;s checkout Textmate 2:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;    121160 /Applications/TextMate.app/Contents/MacOS/TextMate -disableSessionRestore 0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Compared to Atom the search is blazing fast, and the memory usage increases by 17 megs when you use the search window, and immediately decreases again when you close it.&lt;/p&gt;

&lt;p&gt;It does not however highlight all matches, so it&#39;s not a direct comparison. Either way, performancewise it beats Atom by far, why? Because it&#39;s not a frikkin webbrowser pretending to be an editor. Sorry, I lost it for a second... please let me continue.&lt;/p&gt;

&lt;h3&gt;Why big files?&lt;/h3&gt;

&lt;p&gt;So, you&#39;re reading this, and you&#39;re thinking, lol you&#39;re so biased, I never open big files in my node project. While that&#39;s true, big files give you a good idea of what&#39;s happening under the hood. People actually spend a lot of time thinking about how you can build efficient syntax highlighters.&lt;/p&gt;

&lt;h3&gt;Why is it so slow anyway?&lt;/h3&gt;

&lt;p&gt;Overhead. Take a look at this, the dom of a three liner of text in Atom:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;lines&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;
    &amp;quot;height: 54px; min-width: 913px; padding-top: 0px; padding-bottom: 0px; top: 0px;&amp;quot;&amp;gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;line&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;null-grammar text plain&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;GNU GENERAL PUBLIC LICENSE&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

      &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;line&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;text plain null-grammar&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;hello&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

      &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;line&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;text plain null-grammar&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;what&amp;#39;s up&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;underlayer&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;height: 54px; min-width: 913px; top: 0px;&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;hidden-input&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;top: 0px; left: 0px;&amp;quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;

      &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;selection&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;callattachhooks=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;true&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;region&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;top: 18px; left: 72px; height: 18px; width: 48px;&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

      &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;callattachhooks=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;true&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;bracket-matcher&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;display: none&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

        &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;bracket-matcher&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;display: none&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

      &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;spell-check&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;callattachhooks=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;true&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

      &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;wrap-guide&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;callattachhooks=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;
      &amp;quot;left: 640px; display: block;&amp;quot;&amp;gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Everything is html. While other people are thinking about how they can optimize their data stores so that highlighting doesn&#39;t take more than a byte, you have a dom element per line. Can you optimize this? Sure, but wouldn&#39;t that break the ease of extensibility, and use the chrome debugger to debug your extension promise? Quite likely.&lt;/p&gt;

&lt;h3&gt;Suggestion&lt;/h3&gt;

&lt;p&gt;Delaying search so that not every character triggers the search, would improve search behavior. Maybe though this would be inconvenient for small files. In that case this option should trigger automatically for files of a certain size.&lt;/p&gt;

&lt;p&gt;Make fonts configurable somewhere in the preferences. The stylesheet is nice, changes in the stylesheet get applied instantly, but programming font is such a basic element of code editors that it&#39;s one of the first things people touch.&lt;/p&gt;

&lt;p&gt;Atomic undo. This is a big one. Most editors do it, and most people don&#39;t even know what it is. I&#39;m guessing this might be in the works already, but I wouldn&#39;t know either way.&lt;/p&gt;

&lt;h3&gt;Atom&#39;s future?&lt;/h3&gt;

&lt;p&gt;I think that Atom is really just the first step in a different direction. Will I use it? Unlikely. But that&#39;s not the question.&lt;/p&gt;

&lt;p&gt;If you had a Chromebook this might very well be the best editor backend there is(well next to ssh to your emacs/vim machine). But it&#39;s &lt;a href=&quot;https://code.google.com/p/chromiumembedded/&quot;&gt;CEF&lt;/a&gt; isn&#39;t it? That&#39;s kinda native, and won&#39;t run on ChromeOS right? &quot;Kinda&quot; native, is the key.&lt;/p&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;Atom definitely looks like a pretty editor, and the fact that you can use coffeescript and javascript instead of ruby and python to write extensions is definitely interesting to some people, to others not so much.&lt;/p&gt;

&lt;p&gt;There have been discussions about using &lt;a href=&quot;http://citeseer.ist.psu.edu/viewdoc/download?doi=10.1.1.14.9450&amp;amp;rep=rep1&amp;amp;type=pdf&quot;&gt;ropes&lt;/a&gt; as a backend for mutable strings in node I think. A long long time ago anyway. But it&#39;s not that easy. All the string manipulation happens in the dom, and javascript in Atom, which unless my memory is playing tricks on me means, many string copies.&lt;/p&gt;

&lt;p&gt;The editor part of Atom is really a browser with a lot of markup. Theoretically it would be possible to change the backend code, and make the strings in Javascript in Atom have a different data structure backend, but that would break ECMAscript conformity I believe. There&#39;s also no guarantee it will significantly reduce memory usage on small files since a lot of the overhead comes from mark up that shouldn&#39;t be there to begin with.&lt;/p&gt;

&lt;p&gt;I&#39;m pretty certain that the performance had been much worse had I not opened a text file, but instead a big source code file. To be fair the only ones I&#39;ve seen creating 500k source code files were Microsoft.&lt;/p&gt;

&lt;p&gt;But until someone comes along with a well designed embeddable text store backend I&#39;ll keep using my crappy vim in tmux.&lt;/p&gt;

&lt;p&gt;What about you? Should you use it? I&#39;m predicting node completion modules for both coffee and javascript. You might actually become more productive using it. And if you have a fast enough workstation with enough ram, why not? I can tell you though, my CPU design prof would probably look at me, mumble something in a nostalgic tone, and walk away.&lt;/p&gt;

&lt;p&gt;Ps. for all you guys worried about Atom phoning home. Install &lt;a href=&quot;http://www.obdev.at/products/littlesnitch/index.html&quot;&gt;Little Snitch&lt;/a&gt;, use your hosts file, or try pf. I&#39;m not sure if I can consider that valid criticism.&lt;/p&gt;
</content>
	</entry>
	<entry>
		<title>If it is centralized, it will Fail. The Cloud loves Emergencies</title>
		<author>
			<name>Reza Jelveh</name>
		</author>
                <link type="text/html" href="http://reza.jelveh.me/2012/12/02/the-cloud-likes-emergencies" rel="alternate" />
		<updated>2012-12-02T00:00:00-07:00</updated>
		<id>tag:flyingseagull.de,2012-12-02:/2012/12/02/the-cloud-likes-emergencies</id>
		<content type="html">&lt;p&gt;Over the past few weeks I have seen a lot about emergency response systems, but first let me speak about the internet. We have seen an interesting notion in the internet.&lt;/p&gt;
&lt;p&gt;First starting with the file sharing applications, and now even the average website, people have first built centralized systems and then moved to distributed, peer to peer, clustered, hybrid, or other architectures.&lt;/p&gt;
&lt;p&gt;The reason is quite simple, and I shall summarize it in my personal axiom:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If it is centralized, it will Fail.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;All of this is not new, some of this has been around in the distributed computing community for over a decade(I would same mid/late 90s, &lt;em&gt;I think&lt;/em&gt;). What&amp;#8217;s even more interesting is that this notion has been around the world forever, in other portions of human life too.&lt;/p&gt;
&lt;p&gt;What puzzles me is that even though this notion is well understood in the academic world, the academic world does not yet understand, that this applies just as much to the internet as it does to distributed computing.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ve been an avid cheerleader for &lt;a href=&quot;http://www.basho.com&quot;&gt;Basho technologies&lt;/a&gt;. I love Riak. I love how Basho interacts with the community. For those of you that don&amp;#8217;t know, Riak is a distributed database based on the &lt;a href=&quot;http://www.allthingsdistributed.com/2007/10/amazons_dynamo.html&quot;&gt;Amazon Dynamo&lt;/a&gt; paper. It&amp;#8217;s basically a distributed key value store, but some of their design decisions are plain gorgeous, some of them make it unusable in other scenarios. To quote Justin(not literally, but close) the simple idea is as follows:&lt;/p&gt;
&lt;p&gt;&amp;#8220;You want more performance? Add more nodes. You want more storage? Add more nodes. You want more availability? Add more nodes.&amp;#8221;&lt;/p&gt;
&lt;p&gt;But wait, meet &lt;em&gt;the Cloud&lt;/em&gt;. I&amp;#8217;m one of the biggest critics of the Cloud. The Cloud is evil. The Cloud is the mainframe, that you can no longer own. &lt;a href=&quot;https://www.eff.org/deeplinks/2012/10/governments-attack-cloud-computing&quot;&gt;The government owns all your data on the Cloud&lt;/a&gt;. But the Cloud is also nothing more than a handful of people reselling VMWare in their own data center. Those Clouds are famous as Cloudwashers. For some really weird reason corporate America loves Cloudwashers.&lt;/p&gt;
&lt;p&gt;Then why does it make sense for Emergency response if it is so evil? Because Emergency response is &lt;span class=&quot;caps&quot;&gt;ALL&lt;/span&gt; about government data. It&amp;#8217;s about giving you easy access to government data.&lt;/p&gt;
&lt;p&gt;I have been following Amazon &lt;span class=&quot;caps&quot;&gt;AWS&lt;/span&gt; developments for the past couple of years. I recently shared the re:Invent event and Riak among my coworkers. Those who watched are excited. What I found most amazing was the fact that Amazon saw the need for government applications and has been offering Govcloud for a while. For some reason I missed that.&lt;/p&gt;
&lt;p&gt;Back to the Emergency response story let&amp;#8217;s look at our requirements:&lt;/p&gt;
&lt;p&gt;We want a distributed system. Sandy takes down the east coast(I know, I know, but it&amp;#8217;s just an example right?). Well, how about one of the 2 regions on the west coast? We don&amp;#8217;t want a single point of failure ever. Check.&lt;/p&gt;
&lt;p&gt;We want to be able to scale out massively if needed. There is nothing interesting happening in an emergency response system until there is actually an Emergency, and we want variable costs. Check.&lt;/p&gt;
&lt;p&gt;We don&amp;#8217;t want to lose critical emergency response data. Check.&lt;/p&gt;
&lt;p&gt;The other question is Reliability:&lt;/p&gt;
&lt;p&gt;For example, Amazon EC2 has a reliability of 99.95% ( three nines ) and S3 has a reliability of 11 nines, since everything sent to S3 gets replicated on two other availability zones in the region. High reliability on your data center usually means extra high pricing.&lt;/p&gt;
&lt;p&gt;What does it mean? It means that in the case of EC2, &lt;strong&gt;in theory&lt;/strong&gt; it should have a yearly downtime of less than 0.1825 days.&lt;/p&gt;
&lt;p&gt;But here is the catch. Your reliability is only as good as your application, and if you&amp;#8217;re application is well designed you can get more reliability out of your data centers. Distribution is a key aspect to this. There is a notion in the US government that understands this problem. &lt;span class=&quot;caps&quot;&gt;NASA&lt;/span&gt; Curiosity data pipeline? Hello &lt;span class=&quot;caps&quot;&gt;AWS&lt;/span&gt;. On top of that Amazon is giving out grants to Universities for their research projects.&lt;/p&gt;
&lt;p&gt;The flipside of it is that if your application is poorly designed, all the data center reliability in the world is not going to save you.&lt;/p&gt;
&lt;p&gt;We have reliability, scalability, but what about security?&lt;/p&gt;
&lt;p&gt;The software security folks United States government understand that security is not perfect. Breaches can happen. The standards do not only state how you protect yourself from breaches, but also from losing data once a breach happens. The &lt;a href=&quot;http://www.ama-assn.org/resources/doc/psa/hipaa-phi-encryption.pdf&quot;&gt;&lt;span class=&quot;caps&quot;&gt;HIPAA&lt;/span&gt; Standard&lt;/a&gt; tells us, that if we encrypt our data properly we don&amp;#8217;t have to notify clients if patient records are lost. Why? Because they&amp;#8217;re encrypted.&lt;/p&gt;
&lt;p&gt;So what about the Cloud? Amazon supports all the security standards that your local data center supports and more. Want to become a payment gateway? Amazon won&amp;#8217;t be the one that&amp;#8217;s keeping you from doing so, but you as a developer have to keep your part of the bargain too.&lt;/p&gt;


</content>
	</entry>
	<entry>
		<title>moo moo moo, business cards done right</title>
		<author>
			<name>Reza Jelveh</name>
		</author>
                <link type="text/html" href="http://reza.jelveh.me/2012/11/27/moo-moo-moo-business-cards-done-right" rel="alternate" />
		<updated>2012-11-27T00:00:00-07:00</updated>
		<id>tag:flyingseagull.de,2012-11-27:/2012/11/27/moo-moo-moo-business-cards-done-right</id>
		<content type="html">&lt;p&gt;I just received my new batch of &lt;a href=&quot;http://www.moo.com&quot;&gt;moo&lt;/a&gt; mini cards&amp;#8230;&lt;/p&gt;
&lt;p&gt;I don&amp;#8217;t remember when I got my first one, but I still clearly remember the last batch I got about a year ago when I started pitchme. Simply put, they&amp;#8217;re beautiful. I was shuddering at the thought of having to get business cards that feel like the cheapest cardboard you ever felt, and look like paper in general.&lt;/p&gt;
&lt;p&gt;For some reason, they were roughly cut this time though, I&amp;#8217;m still in the process of figuring out what went wrong.&lt;/p&gt;
&lt;p&gt;Nonetheless, I&amp;#8217;m currently in the process of redefining corporate identity at my work place. It&amp;#8217;s not hard to get your colleagues excited about moo cards. A nice case, solid quality, beautiful print. Sooner rather than later, you might actually see more and more people at the University of Lousiana at Lafayette run around with moo cards.&lt;/p&gt;
&lt;p&gt;Who knows, maybe we&amp;#8217;ll get out some nice moo stickers to whoever is attending the CajunCodeFest this year.&lt;/p&gt;</content>
	</entry>
	<entry>
		<title>The funny little feedback loops in life</title>
		<author>
			<name>Reza Jelveh</name>
		</author>
                <link type="text/html" href="http://reza.jelveh.me/2012/11/26/the-funny-little-feedback-loops" rel="alternate" />
		<updated>2012-11-26T00:00:00-07:00</updated>
		<id>tag:flyingseagull.de,2012-11-26:/2012/11/26/the-funny-little-feedback-loops</id>
		<content type="html">&lt;p&gt;It&amp;#8217;s been a while since I last blogged, some of you know that I&amp;#8217;m now in sunny Lafayette.&lt;/p&gt;
&lt;p&gt;A couple of weeks back I went to my new Boss and said:&lt;/p&gt;
&lt;p&gt;&amp;#8220;How about we do once a week off and everyone can work on anything they want provided they present it to the whole team afterwards?&amp;#8221; &amp;#8211; You know, a la Atlassian, Google, (Apple just jumped on the bandwagon), and all the other folks out there.&lt;/p&gt;
&lt;p&gt;He looks at me and says: &amp;#8220;I think that&amp;#8217;s a great idea, let me see what we can do&amp;#8221;.&lt;/p&gt;
&lt;p&gt;I say: &amp;#8220;I see a few guys on the team that are very frustrated.&amp;#8221; &amp;#8211; A while back they were about to make him build something in Access, and I burst out laughing when I heard that. I don&amp;#8217;t think it was as funny for him as it was for me.&lt;/p&gt;
&lt;p&gt;Funnily enough, on an unrelated note the following weekend, some girl was talking about Yoga and all sorts of magical stuff in life and I decided to send her a youtube link, the classic &lt;a href=&quot;http://www.thersa.org/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;RSA&lt;/span&gt;&lt;/a&gt; Animate with the author of &lt;a href=&quot;http://www.amazon.com/Drive-Surprising-Truth-About-Motivates/dp/1594484805&quot;&gt;Drive&lt;/a&gt; an interesting book about the psychology of what motivates us. She puts it on her wall, and I think to myself:&lt;/p&gt;
&lt;p&gt;&amp;#8220;Damn, I should&amp;#8217;ve done that, would&amp;#8217;ve gotten me some extra Karma points&amp;#8221;.&lt;/p&gt;
&lt;p&gt;&lt;iframe width=&quot;560&quot; height=&quot;420&quot; src=&quot;http://www.youtube.com/embed/u6XAPnuFjJc?color=white&amp;theme=light&quot;&gt;&lt;/iframe&gt;&lt;/p&gt;
&lt;p&gt;So, let&amp;#8217;s fast forward a couple of weeks.&lt;/p&gt;
&lt;p&gt;Today, I walked in the office, and I saw the Director of Research(yes, you heard right. I&amp;#8217;m now working for a University) watching the video I sent a week ago.&lt;/p&gt;
&lt;p&gt;The video itself is about 2 years old, but apparently Lafayette didn&amp;#8217;t get the message, which is not really surprising, since rsa is like the british version of Ted, and the only reason I knew about &lt;span class=&quot;caps&quot;&gt;RSA&lt;/span&gt; was because in one of the older startups I worked at the Founder watched all sorts of crazy podcasts(Hi Rene).&lt;/p&gt;
&lt;p&gt;He asks me if I&amp;#8217;ve seen it before, apparently the second new Boss told him about it and I say yes, long time ago.&lt;/p&gt;
&lt;p&gt;Anyway, couple of hours later my new Boss runs down the floor and gathers all the engineers, and he says:&lt;/p&gt;
&lt;p&gt;&amp;#8220;Guys, I just had this Idea&amp;#8230;&amp;#8221; We nod. &amp;#8220;Wouldn&amp;#8217;t it be nice&amp;#8221; he goes on, &amp;#8220;If we did like a mini CajunCodeFest every quarter? A mini hackathon, and you guys can work on anything you want, and we have Pizza and Booze at the end?&amp;#8221;.&lt;/p&gt;
&lt;p&gt;And he goes on: &amp;#8220;I was just thinking how we could keep people happing working here, apart from money&amp;#8221;&lt;/p&gt;
&lt;p&gt;My coworker jumps in and says: &amp;#8220;I wouldn&amp;#8217;t mind working on some non Microsoft stuff every now and then&amp;#8221;.&lt;/p&gt;
&lt;p&gt;&amp;#8220;Reza what do you think?&amp;#8221; he asks, &amp;#8220;I think it&amp;#8217;s a good idea.&amp;#8221;&lt;/p&gt;
&lt;p&gt;Feel free to now imagine me with my broadest Alice in Wonderland cat grin and nodding, not saying anything.&lt;/p&gt;
&lt;p&gt;So that&amp;#8217;s it, two seemingly unrelated events, I get what I want, and management getting new ideas. What I found most amazing though, is that noone knows or remembers where the spark came from, well except the coworkers that I told it. But it&amp;#8217;s ok they&amp;#8217;ll forget in time.&lt;/p&gt;
&lt;p&gt;Ps. if you tell me one more time, that the great Edison invented the lightbulb, I&amp;#8217;ll setup your firewall to rickroll you on random intervals so you&amp;#8217;ll never find out it&amp;#8217;s not a virus.&lt;/p&gt;</content>
	</entry>
	<entry>
		<title>Fixing the hard lockup caused by bluetooth in linux during sleep</title>
		<author>
			<name>Reza Jelveh</name>
		</author>
                <link type="text/html" href="http://reza.jelveh.me/2012/05/24/bluetooth-hard-lockup-linux-3.3-sleep" rel="alternate" />
		<updated>2012-05-24T00:00:00-07:00</updated>
		<id>tag:flyingseagull.de,2012-05-24:/2012/05/24/bluetooth-hard-lockup-linux-3.3-sleep</id>
		<content type="html">&lt;p&gt;I basically stopped using the bluetooth subsystem on my machine for a while, since it would lockup my system during sleep. Today I decided to investigate a little, here&amp;#8217;s what I found out:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Stopping the bluetooth daemon will bring down the bluetooth subsystem. You can check it&amp;#8217;s state as follows:&lt;br /&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;cat /sys/module/btusb/refcnt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
anything besides 0 means it&amp;#8217;s doing something.&lt;/li&gt;
	&lt;li&gt;The freeze occurs when bluetooth is paired with a device and someone trys to bring down bluetooth. Subsequently playing music through A2DP and then stopping the bluetooth daemon results in a hard freeze.&lt;/li&gt;
	&lt;li&gt;To fix all these issues you need to disconnect all connected bluetooth devices before going to sleep.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Copy &amp;amp; paste the following script (or &lt;a href=&quot;http://reza.jelveh.me/assets/49bluetooth&quot;&gt;simply download&lt;/a&gt; ) in your /etc/pm/sleep.d folder to fix the freeze. Feel free to adapt it to your distribution.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/sh&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# generic bluetooth hack based on the IBM specific hack&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Reza Jelveh&lt;/span&gt;

. &lt;span class=&quot;s2&quot;&gt;&amp;quot;${PM_FUNCTIONS}&amp;quot;&lt;/span&gt;

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; -f /sys/module/btusb/refcnt &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$NA&lt;/span&gt;

disconnect_devices&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;c&quot;&gt;# sorry not that good with bash scripting,&lt;/span&gt;
	&lt;span class=&quot;c&quot;&gt;# so i&amp;#39;ll use a space as string terminator&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;`hcitool con` &amp;quot;&lt;/span&gt;

	&lt;span class=&quot;k&quot;&gt;while &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt; -n &lt;span class=&quot;s2&quot;&gt;&amp;quot;$var&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;		&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;${var%% *}&amp;quot;&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;${var#* }&amp;quot;&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$res&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;~ &lt;span class=&quot;o&quot;&gt;([[&lt;/span&gt;:alnum:&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;:&lt;span class=&quot;o&quot;&gt;]{&lt;/span&gt;17&lt;span class=&quot;o&quot;&gt;})&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then &lt;/span&gt;sudo hcitool dc &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;BASH_REMATCH&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[0]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;	done&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

suspend_bluetooth&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;grep -q 0 /sys/module/btusb/refcnt&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;		&lt;/span&gt;savestate bluetooth_generic disable
	&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;		&lt;/span&gt;savestate bluetooth_generic &lt;span class=&quot;nb&quot;&gt;enable&lt;/span&gt;
		&lt;span class=&quot;c&quot;&gt;# if we run stop while some bluetooth device is running&lt;/span&gt;
		&lt;span class=&quot;c&quot;&gt;# the system will freeze, disconnect all devices first&lt;/span&gt;
		disconnect_devices
		/usr/sbin/rc.d stop bluetooth

		&lt;span class=&quot;c&quot;&gt;# wait for up to 2 seconds for the module to actually get&lt;/span&gt;
		&lt;span class=&quot;c&quot;&gt;# unused&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;TIMEOUT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;20
		&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$TIMEOUT&lt;/span&gt; -ge 0 &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
		    &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;cat /sys/module/btusb/refcnt&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 0 &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;break&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;		    &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;TIMEOUT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$((&lt;/span&gt;TIMEOUT-1&lt;span class=&quot;k&quot;&gt;))&lt;/span&gt;
		    sleep 0.1
		&lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;
		/sbin/modprobe -r btusb
	&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

resume_bluetooth&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	state_exists bluetooth_generic &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;	if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;restorestate bluetooth_generic&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;enable&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
		/sbin/modprobe btusb
		/usr/sbin/rc.d start bluetooth
	&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;$1&amp;quot;&lt;/span&gt; in
	hibernate&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;suspend&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
		suspend_bluetooth
		&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
	thaw&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;resume&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
		resume_bluetooth
		&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
	*&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$NA&lt;/span&gt;
		&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;esac&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
	</entry>
	<entry>
		<title>A minimalistic rfkill gtk gui for toggling your bluetooth and wireless</title>
		<author>
			<name>Reza Jelveh</name>
		</author>
                <link type="text/html" href="http://reza.jelveh.me/2012/01/07/minimalistic-rfkill-gtk-gui" rel="alternate" />
		<updated>2012-01-07T00:00:00-07:00</updated>
		<id>tag:flyingseagull.de,2012-01-07:/2012/01/07/minimalistic-rfkill-gtk-gui</id>
		<content type="html">&lt;p&gt;I just wrote a little rfkill frontend with gtk+. If you use an acer laptop you should load acer-wmi, make sure you have acpi_osi=Linux in your kernel boot.&lt;/p&gt;
&lt;p&gt;The following will bind the rfkill key to XF86WLAN&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;setkeycodes e013 246
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here&amp;#8217;s the obligatory screenshot:&lt;br /&gt;
&lt;img src=&quot;http://cloud.github.com/downloads/fishman/grfkill/screenshot.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;If you don&amp;#8217;t have an acer device you should launch the app as:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;grfkill -w wlandevice -b bluetoothdevice
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Use rfkill list to find out the right names.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://github.com/fishman/grfkill&quot;&gt;source is available github&lt;/a&gt; It&amp;#8217;s based on &lt;a href=&quot;https://github.com/lcp&quot;&gt;Gary&amp;#8217;s&lt;/a&gt; gtk experiments(the author of urfkilld)&lt;/p&gt;
&lt;p&gt;Arch users can use the following:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;sudo packer -S grfkill
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
	</entry>
	<entry>
		<title>Changing the cursor color within tmux based on vi mode</title>
		<author>
			<name>Reza Jelveh</name>
		</author>
                <link type="text/html" href="http://reza.jelveh.me/2011/09/18/zsh-tmux-vi-mode-cursor" rel="alternate" />
		<updated>2011-09-18T00:00:00-07:00</updated>
		<id>tag:flyingseagull.de,2011-09-18:/2011/09/18/zsh-tmux-vi-mode-cursor</id>
		<content type="html">&lt;p&gt;As outlined on &lt;a href=&quot;http://unix.stackexchange.com/questions/547/make-my-zsh-prompt-show-mode-in-vi-mode&quot;&gt;SE&lt;/a&gt; and &lt;a href=&quot;http://superuser.com/questions/151803/how-do-i-customize-zshs-vim-mode&quot;&gt;SU&lt;/a&gt; you can execute actions in zsh when you change between normal and insert mode in a vi mode zsh session.&lt;/p&gt;
&lt;p&gt;For changing the cursor color see the snippet below.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# use cursor as indicator of vi mode&lt;/span&gt;
zle-keymap-select &lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$KEYMAP&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; vicmd &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;    if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$TMUX&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; -ne &lt;span class=&quot;s2&quot;&gt;&amp;quot;\033]12;Red\007&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;printf&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;\033Ptmux;\033\033]12;red\007\033\\&amp;#39;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;  else&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;    if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$TMUX&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; -ne &lt;span class=&quot;s2&quot;&gt;&amp;quot;\033]12;Grey\007&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;printf&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;\033Ptmux;\033\033]12;grey\007\033\\&amp;#39;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;  fi&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
zle-line-init &lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  zle -K viins
  &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; -ne &lt;span class=&quot;s2&quot;&gt;&amp;quot;\033]12;Grey\007&amp;quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
zle -N zle-keymap-select
zle -N zle-line-init
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Put it somewhere in your zshrc and your cursor should switch to red when you enter normal mode and become grey again when you leave it.&lt;/p&gt;</content>
	</entry>
	<entry>
		<title>launching firefox with text/html entry in mutt 1.5,21</title>
		<author>
			<name>Reza Jelveh</name>
		</author>
                <link type="text/html" href="http://reza.jelveh.me/2011/09/17/mutt-html-autoview-firefox" rel="alternate" />
		<updated>2011-09-17T00:00:00-07:00</updated>
		<id>tag:flyingseagull.de,2011-09-17:/2011/09/17/mutt-html-autoview-firefox</id>
		<content type="html">&lt;p&gt;I recently decided that I might want to see some html mails in a real browser instead of a w3m dump.  For example when I need to click on the stupid reset password link, which is sent in the html only mail from easyjet.&lt;/p&gt;
&lt;p&gt;Figured it would be the easiest thing in the world to do, just change the mailcap entry for text/html and you&amp;#8217;re set. But instead I get this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;mailcap entry for type text/html not found&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The bad part:&lt;/strong&gt; It obviously doesn&amp;#8217;t work that way. Turns out certain changes in the auto_view behaviour of mutt 1.5.21 cause this. There&amp;#8217;s even &lt;a href=&quot;http://dev.mutt.org/trac/ticket/3496&quot;&gt;a bugreport on the matter&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The good part:&lt;/strong&gt; You can now have 2 mailcap entries for text/html. One will be used to display the message &lt;em&gt;inside&lt;/em&gt; of mutt. The other will run firefox by pressing m (view-mailcap) in the file list.&lt;/p&gt;
&lt;p&gt;My mailcap thus starts as follows:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;text/html&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; firefox %s &lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
text/html&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; w3m -T text/html -dump %s&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; copiousoutput
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note that the order of the entries is important. Should you switch it both m and the pager will only show the dump.&lt;/p&gt;</content>
	</entry>
	<entry>
		<title>ruby-enterprise/ruby-1.8.7 in fedora 15 or archlinux</title>
		<author>
			<name>Reza Jelveh</name>
		</author>
                <link type="text/html" href="http://reza.jelveh.me/2011/09/15/ree-ruby-1.8.7-archlinux-fedora" rel="alternate" />
		<updated>2011-09-15T00:00:00-07:00</updated>
		<id>tag:flyingseagull.de,2011-09-15:/2011/09/15/ree-ruby-1.8.7-archlinux-fedora</id>
		<content type="html">&lt;p&gt;The following bugs occur when trying to install ruby enterprise on distros like fedora 15 or archlinux:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;/bin/sh ./libtool --tag&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;CXX --mode&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;compile g++ -DHAVE_CONFIG_H -I. -I. -I./src  -I./src   -DNO_TCMALLOC_SAMPLES -pthread -DNDEBUG -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -fno-builtin-calloc -fno-builtin-cfree -fno-builtin-memalign -fno-builtin-posix_memalign -fno-builtin-valloc -fno-builtin-pvalloc  -DNO_FRAME_POINTER -g -O2 -c -o libtcmalloc_minimal_la-tcmalloc.lo &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt; -f &lt;span class=&quot;s1&quot;&gt;&amp;#39;src/tcmalloc.cc&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt;
&lt;span class=&quot;s1&quot;&gt;&amp;#39;./&amp;#39;&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;src/tcmalloc.cc
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I. -I./src -I./src -DNO_TCMALLOC_SAMPLES -pthread -DNDEBUG -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -fno-builtin-calloc -fno-builtin-cfree -fno-builtin-memalign -fno-builtin-posix_memalign -fno-builtin-valloc -fno-builtin-pvalloc -DNO_FRAME_POINTER -g -O2 -c src/tcmalloc.cc  -fPIC -DPIC -o .libs/libtcmalloc_minimal_la-tcmalloc.o
src/tcmalloc.cc:1672:54: error: conflicting declaration ‘void* &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;* __memalign_hook&lt;span class=&quot;o&quot;&gt;)(&lt;/span&gt;size_t, size_t, const void*&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;’
/usr/include/malloc.h:183:39: error: ‘__memalign_hook’ has a previous declaration as ‘void* &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;* volatile __memalign_hook&lt;span class=&quot;o&quot;&gt;)(&lt;/span&gt;size_t, size_t, const void*&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;’
make: *** &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;libtcmalloc_minimal_la-tcmalloc.lo&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Error 1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;and&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;gcc -I/opt/local/include -I. -I/opt/local/include -I../.. -I../../. -I../.././ext/dl -DHAVE_DLFCN_H -DHAVE_DLOPEN -DHAVE_DLCLOSE -DHAVE_DLSYM -DHAVE_DLERROR    -I. -fPIC -g -O2   -fno-defer-pop -fno-omit-frame-pointer  -c dl.c
In file included from dl.c:104:0:
callback.func:1:1: warning: data definition has no &lt;span class=&quot;nb&quot;&gt;type &lt;/span&gt;or storage class &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;enabled by default&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
callback.func:1:7: error: expected identifier or ‘&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;’ before ‘long’
In file included from dl.c:104:0:
callback.func:78:33: error: expected ‘&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;’ before ‘&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;’ token
callback.func:79:3: warning: data definition has no &lt;span class=&quot;nb&quot;&gt;type &lt;/span&gt;or storage class &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;enabled by default&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
callback.func:79:24: error: ‘proc’ undeclared here &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;not in a &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
callback.func:79:39: error: ‘argc’ undeclared here &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;not in a &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
callback.func:79:45: error: ‘argv’ undeclared here &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;not in a &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
callback.func:82:1: error: expected identifier or ‘&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;’ before ‘&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;’ token
dl.c:106:1: error: expected ‘&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;’, ‘,’ or ‘&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;’ before ‘static’
make&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;: *** &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;dl.o&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Error 1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The fix is outlined in &lt;a href=&quot;http://stackoverflow.com/questions/6134456/error-while-installing-ruby-1-8-7-on-fedora-15&quot;&gt;this stackoverflow post&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Download &lt;a href=&quot;/assets/0001-archlinux.patch&quot;&gt;my patch&lt;/a&gt; and use it with:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;rvm install --force --patch 0001-archlinux.patch ree
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
	</entry>
	<entry>
		<title>using mutt, mu, offlineimap</title>
		<author>
			<name>Reza Jelveh</name>
		</author>
                <link type="text/html" href="http://reza.jelveh.me/2011/08/26/mutt-mu-networkmanager" rel="alternate" />
		<updated>2011-08-26T00:00:00-07:00</updated>
		<id>tag:flyingseagull.de,2011-08-26:/2011/08/26/mutt-mu-networkmanager</id>
		<content type="html">&lt;p&gt;I have long experimented with an optimal mail setup. As some readers may be aware there are a lot of &lt;a href=&quot;http://linsec.ca/Using_mutt_on_OS_X&quot;&gt;tutorials&lt;/a&gt; on how how to use mutt and offlineimap. I have had a mutt and offlineimap setup for quite a long time, however I decided to tune it a bit lately.&lt;/p&gt;
&lt;p&gt;Why mutt? There are numerous articles out there referencing more efficient email handling.  &lt;a href=&quot;http://inboxzero.com/&quot;&gt;Merlin Mann&amp;#8217;s InboxZero&lt;/a&gt; is quite popular.  The basic idea is to never let any mail unprocessed, don&amp;#8217;t show notifications and only check mails in certain intervals. If you use Apple Mail, you can use &lt;a href=&quot;http://www.indev.ca/MailActOn.html&quot;&gt;Mail Act-On&lt;/a&gt; which is quite nice as well. However mutt is much more efficient and flexible in it&amp;#8217;s mail processing capabilities. At the same time it&amp;#8217;s much faster than thunderbird.&lt;/p&gt;
&lt;p&gt;I had switched to thunderbird when I discarded my old hackintosh netbook, with it&amp;#8217;s slow Atom &lt;span class=&quot;caps&quot;&gt;CPU&lt;/span&gt;. The most annoying part to me it seemed, was the fact that it would always bug me with nagscreens when my laptops connection dropped. (and the power consumption)&lt;/p&gt;
&lt;p&gt;The offlineimap setup I use thus makes some use of NetworkManager to start and stop offlineimap and msmtpq when an internet connection exists.  First of all I have two offlineimap setups, both offlineimap setups create the mailbox folders for mutt automatically as described in the offlineimap manual.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;general&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;accounts&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; Gmail
&lt;span class=&quot;nv&quot;&gt;maxsyncaccounts&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 1
&lt;span class=&quot;c&quot;&gt;# This will suppress anything but errors&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;ui&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; Noninteractive.Quiet

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;mbnames&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;enabled&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; yes
&lt;span class=&quot;nv&quot;&gt;filename&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; ~/.mutt/mailboxes
&lt;span class=&quot;nv&quot;&gt;header&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;mailboxes &amp;quot;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;peritem&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;+%(accountname)s/%(foldername)s&amp;quot;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;sep&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;footer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;


&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Account Gmail&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;localrepository&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; GmailLocal
&lt;span class=&quot;nv&quot;&gt;remoterepository&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; GmailRemote
&lt;span class=&quot;nv&quot;&gt;autorefresh&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 10
&lt;span class=&quot;nv&quot;&gt;quick&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 5

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Repository GmailLocal&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; Maildir
&lt;span class=&quot;nv&quot;&gt;localfolders&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; ~/Mail/GMAIL
&lt;span class=&quot;nv&quot;&gt;restoreatime&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; no

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Repository GmailRemote&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; IMAP
&lt;span class=&quot;nv&quot;&gt;ssl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; yes
&lt;span class=&quot;nv&quot;&gt;remotehost&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; imap.gmail.com
&lt;span class=&quot;nv&quot;&gt;remoteuser&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; fubar@gmail.com

&lt;span class=&quot;nv&quot;&gt;nametrans&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; lambda foldername: re.sub &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;.*Drafts.*&amp;#39;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&amp;#39;drafts&amp;#39;&lt;/span&gt;,
                               re.sub &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;.*Sent Mail.*&amp;#39;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&amp;#39;sent&amp;#39;&lt;/span&gt;,
                               re.sub &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;.*Starred.*&amp;#39;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&amp;#39;flagged&amp;#39;&lt;/span&gt;, folder&lt;span class=&quot;o&quot;&gt;)))&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;folderfilter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; lambda foldername: foldername in &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;.*INBOX.*&amp;#39;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&amp;#39;archives&amp;#39;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&amp;#39;pending&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Since I use the same hotkey for drafts and sent mail, I use nametrans to have these folders have a consistent name across all my mail accounts. The password for foobar@gmail.com is set in the .netrc file. Also this is the minimal sync setting for whenever I&amp;#8217;m on 3G or similar. Since my laptop has an internal wireless and ethernet device eth0 and wlan0 are what I use to assume that there is proper internet existing. NetworkManager will thus call my dispatch.d script which will in turn launch&lt;br /&gt;
offlineimap and msmtpq.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/sh -e&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;INTERFACE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# The interface which is brought up or down&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;STATUS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$2&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# The new state of the interface&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;USER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;misterfoo
&lt;span class=&quot;nv&quot;&gt;HOME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/home/&lt;span class=&quot;nv&quot;&gt;$USER&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;CACHE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;/.cache/daemonize
&lt;span class=&quot;nv&quot;&gt;DAEMONIZE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/usr/sbin/daemonize
&lt;span class=&quot;nv&quot;&gt;OFFLINEIMAP&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/usr/bin/offlineimap
&lt;span class=&quot;nv&quot;&gt;NOTIFY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/usr/bin/notify-send

&lt;span class=&quot;c&quot;&gt;# If the display variable is unset, find the correct display number&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# and set the variable.&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; -z &lt;span class=&quot;s2&quot;&gt;&amp;quot;$DISPLAY&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;fgconsole&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;dispnum&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;ps t tty&lt;span class=&quot;nv&quot;&gt;$console&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; sed -n -re &lt;span class=&quot;s1&quot;&gt;&amp;#39;s,.*/X(org)? .*:([0-9]+).*,\2,p&amp;#39;&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;DISPLAY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;:$dispnum&amp;quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;


&lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;$STATUS&amp;quot;&lt;/span&gt; in
	&lt;span class=&quot;s1&quot;&gt;&amp;#39;up&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# $INTERFACE is up&lt;/span&gt;
		su - &lt;span class=&quot;nv&quot;&gt;$USER&lt;/span&gt; -c &lt;span class=&quot;s2&quot;&gt;&amp;quot;$NOTIFY -i info &amp;#39;Network action&amp;#39; &amp;#39;Starting offlineimap&amp;#39;&amp;quot;&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;$INTERFACE&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;eth0&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;$INTERFACE&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;wlan0&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
			&lt;span class=&quot;nv&quot;&gt;$DAEMONIZE&lt;/span&gt; -u &lt;span class=&quot;nv&quot;&gt;$USER&lt;/span&gt; -l &lt;span class=&quot;nv&quot;&gt;$CACHE&lt;/span&gt;/offline_lock -p &lt;span class=&quot;nv&quot;&gt;$CACHE&lt;/span&gt;/offline_pid &lt;span class=&quot;nv&quot;&gt;$OFFLINEIMAP&lt;/span&gt; -c &lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;/.offlineimaprc_full
		&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
			&lt;span class=&quot;nv&quot;&gt;$DAEMONIZE&lt;/span&gt; -u &lt;span class=&quot;nv&quot;&gt;$USER&lt;/span&gt; -l &lt;span class=&quot;nv&quot;&gt;$CACHE&lt;/span&gt;/offline_lock -p &lt;span class=&quot;nv&quot;&gt;$CACHE&lt;/span&gt;/offline_pid &lt;span class=&quot;nv&quot;&gt;$OFFLINEIMAP&lt;/span&gt; -c &lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;/.offlineimaprc
		&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$DAEMONIZE&lt;/span&gt; -u &lt;span class=&quot;nv&quot;&gt;$USER&lt;/span&gt; -l &lt;span class=&quot;nv&quot;&gt;$CACHE&lt;/span&gt;/msmtp_lock   -p &lt;span class=&quot;nv&quot;&gt;$CACHE&lt;/span&gt;/msmtp_pid   &lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;/bin/msmtprun
		&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;&amp;#39;down&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# $INTERFACE is down&lt;/span&gt;
		&lt;span class=&quot;c&quot;&gt;# Check for active interface and down if no one active&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; ! &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;nm-tool&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;grep State&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;cut -f2 -d&lt;span class=&quot;s1&quot;&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;connected&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;			&lt;/span&gt;su - &lt;span class=&quot;nv&quot;&gt;$USER&lt;/span&gt; -c &lt;span class=&quot;s2&quot;&gt;&amp;quot;$NOTIFY -i info &amp;#39;Network action&amp;#39; &amp;#39;Stopping offlineimap&amp;#39;&amp;quot;&lt;/span&gt;
			&lt;span class=&quot;nb&quot;&gt;kill&lt;/span&gt; -TERM &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;cat &lt;span class=&quot;nv&quot;&gt;$CACHE&lt;/span&gt;/offline_pid&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
			&lt;span class=&quot;nb&quot;&gt;kill&lt;/span&gt; -TERM &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;cat &lt;span class=&quot;nv&quot;&gt;$CACHE&lt;/span&gt;/msmtp_pid&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
		&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;esac&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;a href=&quot;http://software.clapper.org/daemonize/&quot;&gt;daemonize&lt;/a&gt; is a little tool for running any command as daemon. With pid- and lockfile support.  Since I use msmtp-queue to send mails and I may or may not want to send mails when I&amp;#8217;m offline msmtpq -r needs to be run whenever I connect to the internet. Msmtprun is just that, a script that tries to run msmtq -r once every 5 minutes.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/sh&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; 1 &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    /usr/bin/msmtpq -r &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt;
    sleep 300
&lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;trap&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;echo -n exiting... ;kill $!;exit&amp;quot;&lt;/span&gt; INT TERM
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A mutt config that should work in both linux and osx(with minor adjustments) can be found on &lt;a href=&quot;https://github.com/fishman/dot_files/tree/master/mutt&quot;&gt;my github page&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I also recently switch to using mu instead of mairix, it&amp;#8217;s much faster and more stable than mairix,&lt;/p&gt;
&lt;p&gt;You basically do&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;mu index --quiet --maildir ~/Mail
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;once and then add something like&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;31 */2 * * * /usr/bin/mu index --quiet --maildir ~/Mail
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;to your crontab. The reindexing is very fast in my experience. You can find the hotkeys I use in my hooks and &lt;a href=&quot;https://github.com/fishman/dot_files/blob/master/mutt/.mutt/macros&quot;&gt;macros&lt;/a&gt; and &lt;a href=&quot;https://github.com/fishman/dot_files/blob/master/mutt/.mutt/macros_static&quot;&gt;macros_static&lt;/a&gt; files on github.&lt;/p&gt;</content>
	</entry>
</feed>
