<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[David Xia]]></title>
  <link href="http://www.davidxia.com/atom.xml" rel="self"/>
  <link href="http://www.davidxia.com/"/>
  <updated>2013-05-10T23:34:30-04:00</updated>
  <id>http://www.davidxia.com/</id>
  <author>
    <name><![CDATA[David Xia]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Notes on The Intelligent Investor by Benjamin Graham]]></title>
    <link href="http://www.davidxia.com/2013/05/notes-on-intelligent-investor/"/>
    <updated>2013-05-06T00:00:00-04:00</updated>
    <id>http://www.davidxia.com/2013/05/notes-on-intelligent-investor</id>
    <content type="html"><![CDATA[<h2 id="general-guidelines">General Guidelines</h2>

<ul>
  <li>don’t listen to Mr. Market</li>
  <li>no one’s tombstone reads “He Beat the Market”</li>
  <li>Risk depends not on age but on individual circumstances</li>
  <li>Keep stock:bonds ratio to ~25:75</li>
  <li>Max 10% speculation in sep acct</li>
  <li>If investing in gold, buy a maximum of 2% in a <del>well-diversified mutual fund specializing
in stocks of precious metals</del> ETF charging less than 1% in annual expenses</li>
  <li>Protect against inflation with REITS &amp; TIPS for long-run
    <ul>
      <li>TIPS best for tax-deferred retirement acct</li>
      <li>For retirement funds that would be held as cash 10%</li>
    </ul>
  </li>
</ul>

<!--more-->

<h2 id="equities">Equities</h2>

<ul>
  <li>keep an index fund as the foundation of portfolio</li>
  <li>ideal formula is to value an issue and compare with current price to det if it is attractive; done
by estimating avg earnings over a per or yrs in the future and multiplying by a capitalization
rate</li>
  <li>don’t buy preferred stock</li>
  <li>shareholder = owner</li>
  <li>keep a margin of safety</li>
  <li>investing is most intelligent when it’s most business-like
    <ul>
      <li>know the business</li>
      <li>do not let anyone else run your business</li>
      <li>don’t enter upon an opportunity unless a reliable calculation shows it has fair chance to
yield reasonable profit</li>
      <li>have the courage of your knowledge &amp; experience</li>
    </ul>
  </li>
  <li>find out who owns the company</li>
  <li>always ask “how much?”</li>
</ul>

<h3 id="defensive">Defensive</h3>

<ul>
  <li>mutual &amp; index funds</li>
  <li>stay away if institutions own over 60%</li>
  <li>don’t short</li>
  <li>mind your investment contract</li>
  <li>index funds are great if held for 20+ yrs w/ new money every mo</li>
  <li>keep 10-30 stocks of companies with these criteria
    <ul>
      <li>large ($2B minimum total market cap)</li>
      <li>prominent</li>
      <li>conservatively financed
        <ul>
          <li>assets:liabilities should be 2:1</li>
          <li>long-term debt not to exceed net curr assets</li>
        </ul>
      </li>
      <li>earnings stability
        <ul>
          <li>earnings growth - min inc at least 1/3 in per share earnings in past 10 yrs using 3-yr avgs</li>
        </ul>
      </li>
      <li>at least 10 yrs of continuous dividends</li>
      <li>stock price less than 25x avg of last 7 yrs earnings and less than 20x those of last 12 months</li>
      <li>moderate price/earnings ratio - not more than 15x avg earnings of past 3 yrs</li>
      <li>moderate ratio of price/assets
        <ul>
          <li>current price not more than 1.5 x book val</li>
          <li>or product of P/E and price/assets not more than 22.5</li>
        </ul>
      </li>
      <li>stock portfolio w/ overall earnings/price at least as high as current high grade bond
(eg 7.5% &lt;- -&gt; 13.3 PE)</li>
    </ul>
  </li>
  <li>check out S&amp;P’s Stock Guide
    <ul>
      <li>narrow down by current assets at least 1.5x curr liabilities</li>
      <li>debt no more than 110% of net curr assets</li>
      <li>no earnings def in 5 yrs</li>
      <li>some curr div</li>
      <li>last yr’s earnings &gt; 5 yrs ago</li>
      <li>price less than 120% net tangible assets</li>
    </ul>
  </li>
  <li>EPS often distorted, try using ROIC = owner earnings/invested capital
    <ul>
      <li>Owner earnings = operating profit + depreciation + amortization of goodwill - fed income tax
(paid at company’s avg rate) - cost of stock options - “maintenance” (or essential) capital
expenditures - any income generated by unsustainable rates of return on pension funds (anything
greater than 6.5%)</li>
      <li>Invested capital = total assets - cash (as well as short-term investments and
non-interest-bearing current liabilities) + past accounting charges that reduced invested
capital</li>
      <li>7-10% is good</li>
    </ul>
  </li>
</ul>

<h3 id="enterprising">Enterprising</h3>

<ul>
  <li>don’t buy preferred stock or inferior bonds unless they can be bought at 30% below par</li>
  <li>don’t buy gov’t bonds</li>
  <li>be wary of IPOs, eg VA Linux, FB</li>
  <li>don’t buy stock of companies expected to report increased earnings or other short term favorable
dev’t</li>
  <li>don’t buy for long-term selectivity, ie based on past record of growth expected to continue to
future</li>
  <li>rebalance portfolio every ½ yr</li>
  <li>dollar-cost average</li>
  <li>kryptonite for bear markets
    <ul>
      <li>“But note this important fact: The true investor scarcely ever is forced to sell his shares,
and at all other times he is free to disregard the current price quotation. He need pay
attention to it and act upon it only to the extent that it suits his book, and no more.
Thus the investor who permits himself to be stampeded or unduly worried by unjustified market
declines in his holdings is perversely transforming his basic advantage into a basic
disadvantage. That man would be better off if his stocks had no market quotation at all, for he
would then be spared the mental anguish caused him by other persons’ mistakes of judgment.”</li>
    </ul>
  </li>
  <li>closed-end funds discounted 10-15% from net asset value better than open-end w/ premium
(eg 9% above NAV)</li>
  <li>factors affecting cap rate
    <ul>
      <li>general long-term prospects (can’t be predicted reliably)
        <ul>
          <li>download at least 5 yrs annual and quarterly reports (10-K &amp; 10-Q) from EDGAR to answer
What makes this company grow? And Where do (and where will) its profits come from?</li>
          <li>Bad things:
            <ul>
              <li>Serial acquirers - avg more than 2-3 per yr
                <ul>
                  <li>Find in “Management’s Discussion and Analysis” in 10-K</li>
                </ul>
              </li>
              <li>Corporate bulimics - acquire and vomit back with losses</li>
              <li>OPM addict - borrowing debt, selling stock; labeled “cash from financing activities”
                <ul>
                  <li>Check “statement of cash flows” for consistently neg cash from op activities and
consistently pos cash from financing activities</li>
                </ul>
              </li>
              <li>Johnny-One-Note - relying on one customer for most of rev</li>
            </ul>
          </li>
          <li>Good things:
            <ul>
              <li>Wide moat - competitive advantage
                <ul>
                  <li>Porter’s 5 forces</li>
                </ul>
              </li>
              <li>Marathoner not sprinter - steadily growing rev and net income over last 10 yrs</li>
              <li>Sower and reaper - making money and spending it</li>
            </ul>
          </li>
        </ul>
      </li>
      <li>financial strength and capital structure
        <ul>
          <li>good business gen more money than it consumes</li>
          <li>read statement of cash flows from annual report to see if cash from ops grown steadily through
last 10 yrs</li>
          <li>check [owner earnings = net income + amortization + depreciation - normal capital
expenditures - costs of granting stock options - “unusual, nonrecurring, extraordinary”
charges - income from company’s pension fund] grows at steady avg of at least 6-7% over past
10 yrs</li>
          <li>check bal sheet for debt (including pref stock); long-term debt  should be under 50% of
total capital</li>
          <li>must have high “ratio of earnings to fixed charges”</li>
          <li>burden of proof on company to show that investor is better off if divs are retained</li>
          <li>stay away from repeated stock splits that are hyped</li>
          <li>companies should buy back stock when they are low not high; really a ploy by execs to sell
own stock options for their own multi-million $ payday</li>
        </ul>
      </li>
      <li>div record (cts payments for last 20+ yrs)</li>
      <li>cap rates for growth stocks
        <ul>
          <li>value = current (normal) earnings X (8.5 + twice expected annual growth rate)</li>
        </ul>
      </li>
    </ul>
  </li>
</ul>

<h4 id="management">Management</h4>

<ul>
  <li>Are they looking out for No. 1?
    <ul>
      <li>Stay away if they reissue or exchange stock options for insiders</li>
      <li>How large is option overhang, pot for all to be converted to stock</li>
      <li>Check Form 4 in EDGAR, repeated big sales by senior execs is big red flag</li>
    </ul>
  </li>
  <li>Are they managers or promoters?
    <ul>
      <li>Execs should not be pandering to investing public, hype-o-chondriacs spewing press releases</li>
      <li>Ideal model is 8-K of Expeditors International of Washington</li>
      <li>Are accounting practices designed to make finacial statements transparent or opaque; watch
out for recurring “nonrecurring” charges, “extraordinary” items so frequent they become
ordinary, and EBITDA appears more than net income, or “pro forma” earnings covering actual
losses</li>
    </ul>
  </li>
  <li>is management reasonably efficient?
    <ul>
      <li>Are interest of avg outside investor receiving proper recog?</li>
      <li>Judge management’s effectiveness by comp prof, size, competitiveness against sim firms</li>
      <li>Read &amp; vote on proxies
        <ul>
          <li>if against proxy, vote against directors</li>
          <li>attend &amp; speak at annual meetins</li>
          <li>post online message boards</li>
        </ul>
      </li>
      <li>Daddy-knows-best is BS
        <ul>
          <li>Vote against giving more than 3% of outstanding shares to managers and against option grants
not contingent on fair and enduring measure of superior results
            <ul>
              <li>Eg outperforming avg stock in same ind for per of at least 5 yrs</li>
            </ul>
          </li>
        </ul>
      </li>
    </ul>
  </li>
</ul>

<h4 id="trickery-with-per-share-earnings">trickery with per-share earnings</h4>

<ul>
  <li>pro forma earnings enable companies to show how well they might have done if they hadn’t done as
badly as they did</li>
  <li>read backwards</li>
  <li>read the notes labeled “summary of significant accounting policies”</li>
  <li>read more: Fridson and Alvarez’s Financial Statement Analysis, Mulford and Comiskey’s The
Financial Number’s Game, Schilit’s Financial Shenanigans, Graham’s The Interpretation of Financial
Statements</li>
</ul>

<h2 id="bonds">Bonds</h2>

<ul>
  <li>Bond funds are good</li>
  <li>Buy tax free bonds only outside retirement accts</li>
  <li>chief criterion: number of times total interest charges have been covered by available earnings
for some years in the past</li>
  <li>see Graham’s Security Analysis</li>
  <li>min std in terms of volume of business for a corp and pop for a municipality</li>
  <li>stock/equity ratio should be high - rough measure of cushion or protection</li>
  <li>high property value</li>
</ul>

<h2 id="investing-contract">Investing Contract</h2>

<p>I,        , hereby state that I am an investor who is seeking to accumulate wealth for many years
into the future.</p>

<p>I know that there will be many times when I will be tempted to invest in stocks or
bonds because they have gone (or “are going”) up in price, and other times when I will be tempted to
sell my investments because they have gone (or “are going”) down.</p>

<p>I hereby declare my refusal to let a herd of strangers make my financial decisions for me. I further
make a solemn commitment never to invest because the stock market has gone up, and never to sell
because it has gone down. Instead, I will invest $    .00 per month, every month, through an
automatic investment plan or “dollar-cost averaging program,” into the following mutual fund(s) or
diversified portfolio(s):</p>

<ul>
  <li></li>
  <li></li>
  <li></li>
</ul>

<p>I will also invest additional amounts whenever I can afford to spare the case (and can afford to
lose it in the short run).</p>

<p>I hereby declare that I will hold each of these investments continually through at least the
following date (which must be a minimum of 10 years after the date of this contact):       , 20  .</p>

<p>The only exceptions allowed under the terms of this contract are a sudden, pressing need for cash,
like a health-care emergency or the loss of my job, or a planned expenditure like a housing down
payment or a tuition bill.</p>

<p>I am, by signing below, stating my intention not only to abide by the terms of this contract, but
to re-read this document whenever I am tempted to sell any of my investments.</p>

<p>This contract is valid only when signed by at least one witness, and must be kept in a safe place
that is easily accessible for future reference.</p>

<p>Signed:</p>

<p>Date:</p>

<p>Witnesses:</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[My Personal Best Swim Times]]></title>
    <link href="http://www.davidxia.com/2013/05/my-personal-best-swim-times/"/>
    <updated>2013-05-04T00:00:00-04:00</updated>
    <id>http://www.davidxia.com/2013/05/my-personal-best-swim-times</id>
    <content type="html"><![CDATA[<p>I found these while cleaning through old drafts of blog posts. I’ll put them here before they
become lost in the shuffle.</p>

<p>100 yard freestyle personal best: 54.30 sec</p>

<p>100 yard breaststroke personal best: 1:12.34 min</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to Setup Your Personal From Scratch]]></title>
    <link href="http://www.davidxia.com/2013/05/how-to-setup-personal-website-from-scratch/"/>
    <updated>2013-05-04T00:00:00-04:00</updated>
    <id>http://www.davidxia.com/2013/05/how-to-setup-personal-website-from-scratch</id>
    <content type="html"><![CDATA[<p>You want to have your own personal website, but you don’t know where to begin. All this Internet
stuff just seems like a black box to you. You don’t want to bother with complicated technical
stuff. You just want your website to work. Is this that much to ask?</p>

<p><strong>No.</strong></p>

<p>This tutorial<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> will get your own website up and running from scratch in under 1.5 hours. At the
end you’ll be able to type “myownwebsite.com” into your browser to see a website you own and
receive e-mail at “firstname@myownwebsite.com”. You’ll learn how the Internet works on a basic
level, what domain name servers (DNS) are, and how to link your website to Google’s free apps.</p>

<ol>
  <li>
    <p>Read my explanation of <a href="http://www.davidxia.com/2012/01/how-the-internets-domain-name-system-works/">how the Internet’s Domain Name System works</a></p>
  </li>
  <li>
    <p>Register an available URL (or multiple ones) from a domain registrar like <a href="http://www.name.com">name.com</a><sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup>.</p>
  </li>
  <li>
    <p>Create a <a href="http://www.tumblr.com/">Tumblr</a> blog.</p>
  </li>
  <li>
    <p>Setup DNS records with this <a href="http://www.tumblr.com/docs/en/custom_domains">Tumblr</a> guide.</p>
  </li>
  <li>
    <p>Setup free <a href="http://www.google.com/apps/intl/en/group/index.html">Google Apps</a> to use Gmail, calendar, docs, etc with your new domain.</p>
  </li>
</ol>

<hr />

<div class="footnotes">
  <ol>
    <li id="fn:1">
      <p>There are many ways to setup a basic personal website. My method balances cost, ease, and control. You can also try out <a href="https://about.me/">about.me</a> to create a basic landing page or <a href="http://www.squarespace.com/">Squarespace</a> to create a more extensive site.<a href="#fnref:1" rel="reference">&#8617;</a></p>
    </li>
    <li id="fn:2">
      <p>I don’t take money for blog posts and wasn’t asked to write this by Tumblr or name.com. I recommend them because I they’re services I’ve personally used and like.<a href="#fnref:2" rel="reference">&#8617;</a></p>
    </li>
  </ol>
</div>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Birthday Paradox]]></title>
    <link href="http://www.davidxia.com/2013/05/birthday-paradox/"/>
    <updated>2013-05-04T00:00:00-04:00</updated>
    <id>http://www.davidxia.com/2013/05/birthday-paradox</id>
    <content type="html"><![CDATA[<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    displayAlign: "left"
  });
</script>

<script type="text/javascript" src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>

<p>What’s the probability that in a room of n people, at least two have the same birthday? It’s higher
than you think.</p>

<p>Let <script type="math/tex">p(n)</script> be the probability of at least two people having the same birthday. We’ll
find <script type="math/tex">\overline{p}(n)</script>, the probability that no two people share the same birthday.
<script type="math/tex">p(n) = 1 - \overline{p}(n)</script>.</p>

<!--more-->

<script type="math/tex; mode=display">% &lt;![CDATA[

\begin{aligned}
\overline{p}(n) &= 1 \cdot (1 - \frac{1}{365}) \cdot (1 - \frac{2}{365}) \cdot \cdots \cdot (1 - \frac{n - 1}{365}) \\
&= \frac{365 \cdot 364 \cdot \cdots \cdot (365 - n + 1)}{365^n}\\
&= \frac{365!}{365^n(365 - n)!}\\
&= \frac{n! \cdot {365 \choose n}}{365^n}
\end{aligned}
 %]]&gt;</script>

<p>So <script type="math/tex">p(n) = 1 - \frac{n! \cdot {365 \choose n}}{365^n}</script>. The table below shows that we have more
than a 50% chance when there are just 23 people. When n = 100, it’s almost certain to have two
people sharing the same birthday.</p>

<table>
  <tbody>
    <tr>
      <th>n</th>
      <th>p(n)</th>
    </tr>
    <tr>
      <td>10</td>
      <td>11.7%</td>
    </tr>
    <tr>
      <td>20</td>
      <td>41.1%</td>
    </tr>
    <tr>
      <td>23</td>
      <td>50.7%</td>
    </tr>
    <tr>
      <td>30</td>
      <td>70.6%</td>
    </tr>
    <tr>
      <td>50</td>
      <td>97.0%</td>
    </tr>
    <tr>
      <td>57</td>
      <td>99.0%</td>
    </tr>
    <tr>
      <td>100</td>
      <td>99.99997%</td>
    </tr>
    <tr>
      <td>200</td>
      <td>99.9999999999999999999999999998%</td>
    </tr>
    <tr>
      <td>300</td>
      <td>(100 − (6×10−80))%</td>
    </tr>
    <tr>
      <td>350</td>
      <td>(100 − (3×10−129))%</td>
    </tr>
    <tr>
      <td>365</td>
      <td>(100 − (1.45×10−155))%</td>
    </tr>
    <tr>
      <td>366</td>
      <td>100%</td>
    </tr>
  </tbody>
</table>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[New Spotify Top Tracks Widget]]></title>
    <link href="http://www.davidxia.com/2013/04/new-spotify-top-tracks-widget/"/>
    <updated>2013-04-12T00:00:00-04:00</updated>
    <id>http://www.davidxia.com/2013/04/new-spotify-top-tracks-widget</id>
    <content type="html"><![CDATA[<p>Check out the new Spotify Top Tracks Widget I made for Spotify.</p>

<iframe src="http://charts.spotify.com/embed/charts/most_streamed/us/latest" width="300" height="400" frameborder="0" allowtransparency="true"></iframe>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How The Big Short Inspired Me to Make a Risky Bet in Tesla]]></title>
    <link href="http://www.davidxia.com/2013/04/how-the-big-short-inspired-me-to-make-a-risky-bet-in-tesla/"/>
    <updated>2013-04-09T00:00:00-04:00</updated>
    <id>http://www.davidxia.com/2013/04/how-the-big-short-inspired-me-to-make-a-risky-bet-in-tesla</id>
    <content type="html"><![CDATA[<blockquote><p>The most difficult subjects can be explained to the slow-witted man if he has not formed any
idea of them already; but the simplest thing cannot be made clear to the most intelligent man if
he is firmly persuaded that he knows already without a shadow of a doubt, what is laid before him.</p><footer><strong>Leo Tolstoy</strong> <cite>1897</cite></footer></blockquote>

<p>In early February of this year, my roommate Ben recommended I read <a href="http://www.amazon.com/gp/product/B00ANYJ3NI/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B00ANYJ3NI&amp;linkCode=as2&amp;tag=easiamus00-20"><em>The Big Short</em></a><img src="http://www.assoc-amazon.com/e/ir?t=easiamus00-20&amp;l=as2&amp;o=1&amp;a=B00ANYJ3NI" alt="" /> by
Michael Lewis. This book tells the story of individuals who foresaw the impending 2008 financial
crisis and made off like gangbusters by betting against the housing market.</p>

<!--more-->

<p>The 10-20 people in the world to pull this off included Steve Eisman, an “offensive” and
“obnoxious” fund manager at Frontpoint Capital who was convinced the entire mortgage lending
market was a giant Ponzi scheme. Charles Ledley and Ben Hockett started a hedge fund in their
garage with $110,000 in a Schwab account. Being contrarian and using “event-based investing,” they
grew their fund to $120 million by the time the market crashed. Then there was Michael Burry an
ex-neurologist with Aspergers who discovered the absurdity of the market in isolation by looking
at data and human incentives.</p>

<p>After reading Lewis’ sober and hard-bitten prose, my reaction was the exact opposite as Ben’s.
Whereas he was indignant of our modern financial system’s unfairness and misaligned incentives, I
was excited by the prospect of getting in on a piece of the action. <em>The Big Short</em> painted a
bleak picture of the excesses of corporate greed and the horribly misguided leveraging of
middle-class America, but it also showed that silver linings exist even in catastrophic events if
you can predict them. Ben wanted to fix the system. I was more interested in figuring it out and
exploiting it for personal
gain.</p>

<p>Lewis writes that financiers are marked by an “animal impulse to see the world as it is, rather
than as it should be.” Perhaps I’ll write a future post about this darker side that we all have,
but for now I’ll summarize what Ben and I were inspired to do.</p>

<p>We researched Tesla, an electric car company, for a week and became confident in the company’s
ability to ship more cars than the market expected. Then I bought 500 shares at $38.30. After TSLA
went down to $35.10, I bought another 600 shares. This pushed me into margin by over $8,000. I
sold these 600 shares after Tesla increased to $36.43 and came away just about break-even. A few
weeks later, TSLA announced it expected to be profitable for the first time, and the market went
wild driving the stock up 22% in a couple of hours to $46.22. I cashed out the remainder of my
shares at $46 and had a total realized gain of $4,894.79. That was a good day, but if I had kept
those other 600 shares, I would’ve made almost 12 grand.</p>

<p>I’m not deluding myself by thinking this wasn’t mostly blind luck. I’ve made bad bets before, but
my track record has been slightly positive. Going forward I’ll reread the notes I took on Benjamin
Graham’s <a href="http://www.amazon.com/gp/product/0060555661/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0060555661&amp;linkCode=as2&amp;tag=easiamus00-20"><em>The Intelligent Investor</em></a><img src="http://www.assoc-amazon.com/e/ir?t=easiamus00-20&amp;l=as2&amp;o=1&amp;a=0060555661" alt="" /> and do more thoughtful fundamental analysis.</p>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Good Comedy is Serious]]></title>
    <link href="http://www.davidxia.com/2013/04/good-comedy-is-serious/"/>
    <updated>2013-04-09T00:00:00-04:00</updated>
    <id>http://www.davidxia.com/2013/04/good-comedy-is-serious</id>
    <content type="html"><![CDATA[<p>I enjoy watching good comedians perform because they often address an underlying, serious issue
and introduce me to different perspectives.</p>

<p>Dave Chappelle said he always enjoys scatological humor, but he also said, “I pride myself on
saying real shit that people don’t even realize I’m saying.” Chappelle’s parents were professors,
and he <a href="http://youtu.be/84NjYRTHpfU?t=26m">joked once</a> during <em>Inside the Actor’s Studio</em> that he was “the first person in [his]
family not to go to college who had not been a slave.” He moved at the age of 10 from the
outskirts of Washington DC to live with his father in Yellow Springs, Ohio. While he was gone the
<a href="http://en.wikipedia.org/wiki/Crack_epidemic" title="American Crack Epidemic">American crack epidemic</a> struck the city and transformed it into “murder capital.” Chappelle
said it was as if a “crack bomb” had exploded causing almost everyone he knew to get involved in
the drug trade.</p>

<p>For one job during his high school years, he wore a cookie costume with a big chocolate chip on
his head and handed out flyers to earn $3.50 an hour while other black youth were making far more
money dealing crack. Years later Chappelle filmed the HBO special “Killin’ Them Softly” in which
he joked about being chauffered in a limousine by a driver who wanted to make a detour in the
ghetto.</p>

<p>(starts at 1:36)</p>

<iframe class="fill-width" width="540" height="405" src="https://www.youtube-nocookie.com/embed/F3c_-dde-wo?rel=0" frameborder="0" allowfullscreen=""></iframe>

<!--more-->

<p>As Chappelle paints a picture of the limo’s gradual descent into the ghetto, he doesn’t preach but
makes a subtle point about class. He’s a black man in a limo who sees a baby in need but feels too
ambivalent to step out of the safety of his car.</p>

<p>Good comedy also gives me insight into others’ lives that I otherwise wouldn’t know. I feel I can
better understand my colleagues who have children after listening to Louis CK’s jokes about the
challenges of raising his two daughters. Chappelle talked about terrorists not taking black
hostages because they know they’re bad bargaining chips. The host of <em>Inside the Actor’s Studio</em>
James Lipton pointed out that this thought probably doesn’t occur to Caucasians.</p>

<p>Good comics challenge the status quo. Bill Burr ranted about “gold digging whores” and wasn’t
afraid to play devil’s advocate against the prevailing sentiment that the rich, powerful men who
committed adultery were pigs, end of story. He tells us to dig deeper and question what motivated
men like Arnold Schwarzenegger, Tiger Woods, Kobe Bryant, etc to do what they did.</p>

<iframe class="fill-width" width="540" height="304" src="https://www.youtube.com/embed/tQQZMiHQhX8?rel=0" frameborder="0" allowfullscreen=""></iframe>

<p>Although they produce laughter that’s often truthful and therapeutic, many comedians’ lives are
less than happy and healthy. Louis CK talks about how he’s getting fat and old. Burr’s greatest
fear is growing old alone with no family, but he has huge reservations about marriage. Looking
back on his rise to stardom, <a href="http://youtu.be/XsuvGbl6mao?t=5m42s">Chappelle said</a> “the higher up I go, for some reason, the less
happy I am.” Perhaps this is due to the pressures that arise from the synthesis of art and
corporate interests. Perhaps there’s something about people who make a living out of seeing the
absurd parts of life. Great artists have a powerful source of inspiration, and I can’t help but
feel conflicted when I enjoy material that probably took a lot of blood, sweat, and tears to
produce and perhaps is a packaged product funded by a corporation counting on a return on
investment.</p>

<p>At the end of his <em>Actor’s Studio</em> interview, Chappelle told the acting students in the audience a
piece of advice his father told him when he decided his passion was comedy. And that was to <a href="http://youtu.be/84NjYRTHpfU?t=27m6s">name
a price</a> for doing the job, “and if it ever gets more expensive than the price you named, get
out of there.”</p>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Modest Proposal, Let EasterCon Excuse More Public Inebriation]]></title>
    <link href="http://www.davidxia.com/2013/03/a-modest-proposal-let-eastercon-excuse-more-public-inebriation/"/>
    <updated>2013-03-31T00:00:00-04:00</updated>
    <id>http://www.davidxia.com/2013/03/a-modest-proposal-let-eastercon-excuse-more-public-inebriation</id>
    <content type="html"><![CDATA[<p>New Yorkers don’t drink enough. Sure, the weekend begins Thursday night when people get hammered
and stumble hungover into work on Friday and just phone it in until 5pm. But there’s not enough
celebrations like SantaCon and Saint Patrick’s Day to excuse dawn-to-dusk pub crawls, revealing
outfits, and public urination on Christmas trees. Therefore, I propose the addition of the
following new -cons. It’ll be tough to initiate, but I know New Yorkers can do it.</p>

<ul>
  <li>ConCon – wear orange jumpsuits and commit felonies</li>
  <li>LeperCon – dress up as lepers</li>
  <li>KongCon – dress up in gorilla suits and grab girls while climbing the Empire State Building</li>
  <li>CongaCon – the city becomes one big Conga line</li>
  <li>EasterCon – celebrate the end of Lent and Jesus’ resurrection by getting shitfaced at 11am</li>
</ul>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Remote Pair Programming with tmux in the Cloud]]></title>
    <link href="http://www.davidxia.com/2013/03/remote-pair-programming-with-tmux-in-the-cloud/"/>
    <updated>2013-03-28T00:00:00-04:00</updated>
    <id>http://www.davidxia.com/2013/03/remote-pair-programming-with-tmux-in-the-cloud</id>
    <content type="html"><![CDATA[<p>I like to pair program with my fellow engineers from time to time when I’m stuck on a problem or
want to ensure reviews for complex code changes don’t take a long time. Remote pair programming
isn’t as high bandwidth as sitting next to each other, but the experience can be improved with the
help of a telephony tool and a shared tmux session in a cloud VM.</p>

<!--more-->

<p>For telephony pick something like Skype, Google hangout, or just old-fashioned cell phones. Have a
cloud VM both people can SSH into and have one person start the session with <code>$ tmux -S
/tmp/tmux-session new -s mysession</code>. The -S flag specifies an alternate tmux server socket. Then
<code>chmod 777 /tmp/tmux-session</code> to allow others to connect to your session with <code>tmux -S
/tmp/tmux-session attach -t mysession</code>.</p>

<p>I’ve found tmux cloud pair programming is very effective in collaborating remotely. These tools do
require both people to be comfortable with the command line and a CLI text-editor. You could use
the screen sharing function in Skype or just point a camera at the screen <a href="http://remotepairprogramming.com/post/43644504373/my-remote-pair-programming-video-from-pivotal">like this guy</a>. But
being in the same machine ensures there are no environmental differences. We’ve all had headaches
with “Well, it works in my machine.”</p>

<p>No more long roundtrip times between code reviews with someone in another timezone. No more
frustration at having miscommunicated in gerrit comments. Just you, the other engineer, and the
code itself. Feel free to share your favorite remote collaboration tools or ways to improve this
process in the comments below.</p>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to Setup ircd-hybrid with SSL on Ubuntu]]></title>
    <link href="http://www.davidxia.com/2013/03/how-to-setup-ircd-hybrid-with-ssl-on-ubuntu/"/>
    <updated>2013-03-09T00:00:00-05:00</updated>
    <id>http://www.davidxia.com/2013/03/how-to-setup-ircd-hybrid-with-ssl-on-ubuntu</id>
    <content type="html"><![CDATA[<p>Spotify uses IRC (internet relay chat) for instant messaging with an SSL layer for encryption.
Everytime I logon I get a <code>(notice) *** You are connected using SSL cipher "RSA-AES-128-CBC-SHA1"</code>
banner. Here’s how I setup an encrypted IRC service on my home Ubuntu server. Installing the
vanilla ircd-hybrid package is straight forward, but the package in the official repo isn’t
compiled with SSL support. I needed to build it myself with the SSL patch.</p>

<!--more-->

<h2 id="download-ubuntu-packages">Download Ubuntu Packages</h2>

<pre><code>sudo aptitude install openssl libssl-dev
sudo mkdir hybrid &amp;&amp; cd hybrid &amp;&amp; sudo apt-get source ircd-hybrid
</code></pre>

<p>Edit ircd-hybrid-*/debian/rules and add <code>USE_OPENSSL = 1</code> so the file has</p>

<pre><code># Some useful stuff to edit here.
# Beware: TOPICLEN may not exceed 390.
NICKLEN = 15
TOPICLEN = 350
MAXCLIENTS = 200
USE_OPENSSL = 1
# ...
</code></pre>

<p>Rebuild the deb file and install it:</p>

<pre><code>sudo cd ircd-hybrid-*
sudo dpkg-buildpackage -rfakeroot -uc -b
sudo cd ../
sudo dpkg -i ircd-hybrid_*.deb
</code></pre>

<p>Edit connect, listen and operator blocks in <code>/etc/ircd-hybrid/ircd.conf</code> to be</p>

<div class="bogus-wrapper"><notextile><figure class="code"><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
<span class="line-number">13</span>
<span class="line-number">14</span>
<span class="line-number">15</span>
<span class="line-number">16</span>
<span class="line-number">17</span>
<span class="line-number">18</span>
<span class="line-number">19</span>
<span class="line-number">20</span>
<span class="line-number">21</span>
<span class="line-number">22</span>
<span class="line-number">23</span>
<span class="line-number">24</span>
<span class="line-number">25</span>
<span class="line-number">26</span>
<span class="line-number">27</span>
<span class="line-number">28</span>
<span class="line-number">29</span>
<span class="line-number">30</span>
<span class="line-number">31</span>
<span class="line-number">32</span>
<span class="line-number">33</span>
<span class="line-number">34</span>
<span class="line-number">35</span>
<span class="line-number">36</span>
</pre></td><td class="code"><pre><code class=""><span class="line">connect {
</span><span class="line">    /* name: the name of the server */
</span><span class="line">    name = "irc.example.net";
</span><span class="line">
</span><span class="line">    /* host: the host or IP to connect to.  If a hostname is used it
</span><span class="line">     * must match the reverse dns of the server.
</span><span class="line">     */
</span><span class="line">    host = "127.0.0.1";
</span><span class="line">
</span><span class="line">    /* passwords: the passwords we send (OLD C:) and accept (OLD N:).
</span><span class="line">     * The remote server will have these passwords reversed.
</span><span class="line">     */
</span><span class="line">    send_password = "password";
</span><span class="line">    accept_password = "password";
</span><span class="line">
</span><span class="line">    /* compressed: controls whether traffic is compressed via ziplinks.
</span><span class="line">     * By default this is disabled
</span><span class="line">     */
</span><span class="line">    compressed = yes;
</span><span class="line">};
</span><span class="line">
</span><span class="line">/* listen {}: contain information about the ports ircd listens on (OLD P:) */
</span><span class="line">listen {
</span><span class="line">    /* port: the specific port to listen on. if no host is specified
</span><span class="line">     * before, it will listen on all available IPs.
</span><span class="line">     *
</span><span class="line">     * ports are seperated via a comma, a range may be specified using ".."
</span><span class="line">     */
</span><span class="line">
</span><span class="line">    /* port: listen on all available IPs, ports 6665 to 6669 */
</span><span class="line">    host = "0.0.0.0"; # change this!
</span><span class="line">    port = 6665 .. 6669;
</span><span class="line">    /* sslport: ports to accept ONLY ssl connections on */
</span><span class="line">    flags = ssl;
</span><span class="line">    port = 6697 #change this!
</span><span class="line">};</span></code></pre></td></tr></table></div></figure></notextile></div>

<p>Generate a password for the IRC operator using mkpasswd tool</p>

<pre><code>mkpasswd [Password]
</code></pre>

<p>Search for operator block and change it to look like this:</p>

<div class="bogus-wrapper"><notextile><figure class="code"><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
<span class="line-number">13</span>
<span class="line-number">14</span>
<span class="line-number">15</span>
<span class="line-number">16</span>
<span class="line-number">17</span>
<span class="line-number">18</span>
<span class="line-number">19</span>
</pre></td><td class="code"><pre><code class=""><span class="line"># ...
</span><span class="line">operator {
</span><span class="line">    /* name: the name of the oper */
</span><span class="line">    name = "root";
</span><span class="line">    /* user: the user@host required for this operator. CIDR is not
</span><span class="line">     * supported. multiple user="" lines are supported.
</span><span class="line">     */
</span><span class="line">    user = "*@*";
</span><span class="line">
</span><span class="line">    /* password: the password required to oper. By default this will
</span><span class="line">     * need to be encrypted using '/usr/bin/mkpasswd'.
</span><span class="line">     * WARNING: Please do not mix up the 'mkpasswd' program from
</span><span class="line">     * /usr/sbin with this one. If you are root, typing 'mkpasswd'
</span><span class="line">     * will run that one instead and you will receive a strange error.
</span><span class="line">     *
</span><span class="line">     * MD5 is supported. If you want to use it, use mkpasswd -Hmd5.
</span><span class="line">     */
</span><span class="line">     password = "#MD5 PASSWORD HERE#";
</span><span class="line"># ...</span></code></pre></td></tr></table></div></figure></notextile></div>

<p>Restart the irc server with <code>sudo service ircd-hybrid restart</code>.</p>

<h2 id="reference">Reference</h2>

<ul>
  <li><a href="https://marvelserv.com/setting-up-ircd-hybrid-and-hybserv-services-with-ssl-on-ubuntu/">Setting Up ircd-hybrid and hybserv services with SSL on Ubuntu – MarvelServ</a></li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Temporary Email and Traffic Visualization]]></title>
    <link href="http://www.davidxia.com/2013/03/temporary-email-and-traffic-visualization/"/>
    <updated>2013-03-08T00:00:00-05:00</updated>
    <id>http://www.davidxia.com/2013/03/temporary-email-and-traffic-visualization</id>
    <content type="html"><![CDATA[<p>I recently finished <a href="http://10minutemail.davidxia.com/">10minutemail.davidxia.com</a>, a disposable email service (it even has
forward and reply functionality, I’m so proud), and <a href="http://vis.davidxia.com/">vis.davidxia.com</a>, a visualization of my
website’s traffic.</p>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to Tweet Automatically, Twitter Bot]]></title>
    <link href="http://www.davidxia.com/2013/02/how-to-tweet-automatically-twitter-bot/"/>
    <updated>2013-02-15T00:00:00-05:00</updated>
    <id>http://www.davidxia.com/2013/02/how-to-tweet-automatically-twitter-bot</id>
    <content type="html"><![CDATA[<p>A while ago, I wrote some <a href="http://www.davidxia.com/2010/11/how-to-tweet-automatically-with-a-php-oauth-twitter-bot" title="How to Tweet Automatically with a PHP-OAuth Twitter Bot">amateurish</a> <a href="http://www.davidxia.com/2011/07/how-to-write-a-program-that-tweets-automatically" title="How to Write a Program That Tweets Automatically">scripts</a> that tweeted automatically via Twitter’s
API. First I used PHP then Ruby. I’ve settled on Python and gotten rid of database dependencies by
serializing each bot’s user data. Simpler, flatter, better. <a href="https://github.com/davidxia/twitter_bots" title="twitter_bots">Check out the code here</a>.</p>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Farts and Craps with David Xia – Waterboarding]]></title>
    <link href="http://www.davidxia.com/2013/02/farts-and-craps-with-david-xia-waterboarding/"/>
    <updated>2013-02-10T00:00:00-05:00</updated>
    <id>http://www.davidxia.com/2013/02/farts-and-craps-with-david-xia-waterboarding</id>
    <content type="html"><![CDATA[<iframe class="fill-width" width="560" height="315" src="https://www.youtube-nocookie.com/embed/tOSd1W9KEHs?rel=0" frameborder="0" allowfullscreen=""></iframe>

<p>Waterboarding has been a controversial topic ever since the fall of 2007, when it was widely
reported that the CIA was using waterboarding on extrajudicial prisoners and that the Justice
Department authorized the procedure as an “enhanced interrogation technique.” Many consider
waterboarding torture and a violation of <a href="http://en.wikipedia.org/wiki/Common_Article_3_of_the_Geneva_Conventions#Common_Article_3_relating_to_Non-International_Armed_Conflict" title="Common Article 3 of the Geneva Conventions">Common Article 3 of the Geneva Conventions</a>.</p>

<p>I’m in no way trying to diminish the implications waterboarding with this personal experiment. I
wanted to experience waterboarding first-hand in order to better understand the context
surrounding the debate. I never truly feared for my life because my trusted friends administered
the waterboarding and I held a wooden block which I would drop when I couldn’t take anymore. But I
can say that when done right, I felt like I was drowning. I had no control over my spasms and
gags.</p>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Ice Climbing at Lake Placid]]></title>
    <link href="http://www.davidxia.com/2013/02/ice-climbing-at-lake-placid/"/>
    <updated>2013-02-06T00:00:00-05:00</updated>
    <id>http://www.davidxia.com/2013/02/ice-climbing-at-lake-placid</id>
    <content type="html"><![CDATA[<p>I went ice climbing with some friends last weekend at Lake Placid, NY. Although it was physically
punishing, it was a lot of fun. We learned a lot of rope and climbing skills and will definitely
be applying them to our future spelunking or climbing trips.</p>

<iframe class="fill-width" width="540" height="304" src="https://www.youtube.com/embed/UeuiadTx5KE?rel=0" frameborder="0" allowfullscreen=""></iframe>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Farts and Craps with David Xia, Potato Cannon]]></title>
    <link href="http://www.davidxia.com/2013/01/farts-and-craps-with-david-xia-potato-cannon/"/>
    <updated>2013-01-29T00:00:00-05:00</updated>
    <id>http://www.davidxia.com/2013/01/farts-and-craps-with-david-xia-potato-cannon</id>
    <content type="html"><![CDATA[<p>I am a trained professional. Do not try this at home.</p>

<iframe class="fill-width" width="540" height="304" src="https://www.youtube-nocookie.com/embed/3xwR-ZGrZ2g" frameborder="0" allowfullscreen=""></iframe>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Setting Up My New Home Server]]></title>
    <link href="http://www.davidxia.com/2013/01/setting-up-my-new-home-server/"/>
    <updated>2013-01-10T00:00:00-05:00</updated>
    <id>http://www.davidxia.com/2013/01/setting-up-my-new-home-server</id>
    <content type="html"><![CDATA[<h2 id="hardware-and-os">Hardware and OS</h2>

<p>I was inspired by this <a href="http://arstechnica.com/gadgets/2012/11/how-to-set-up-a-safe-and-secure-web-server/" title="How to set up a safe and secure Web server">Ars Technica article</a> to own hardware after renting one in the cloud
for a while. So I ordered a <a href="http://www.amazon.com/gp/product/B00556F8BU/ref=as_li_ss_tl?ie=UTF8&amp;tag=easiamus00-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B00556F8BU">Foxconn NTA350</a><img src="http://www.assoc-amazon.com/e/ir?t=easiamus00-20&amp;l=as2&amp;o=1&amp;a=B00556F8BU" alt="" />, <a href="http://www.amazon.com/gp/product/B002YU83YO/ref=as_li_ss_tl?ie=UTF8&amp;tag=easiamus00-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B002YU83YO">4GB of RAM</a>,<img src="http://www.assoc-amazon.com/e/ir?t=easiamus00-20&amp;l=as2&amp;o=1&amp;a=B002YU83YO" alt="" /> and
<a href="http://www.amazon.com/gp/product/B004W2JKWG/ref=as_li_ss_tl?ie=UTF8&amp;tag=easiamus00-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B004W2JKWG">64 GB SSD</a><img src="http://www.assoc-amazon.com/e/ir?t=easiamus00-20&amp;l=as2&amp;o=1&amp;a=B004W2JKWG" alt="" /> for $270.</p>

<p>Once my new toy arrived, I named him Jarvis and installed Ubuntu 12.04 server edition including
the DNS, OpenSSH, SMTP, and LAMP packages.</p>

<!--more-->

<h2 id="personal-environment">Personal Environment</h2>

<p>I’m picky about my personal environment. Everything from keybindings to colors has to be just
right for me to feel at home.</p>

<ul>
  <li>ran my <a href="https://github.com/davidxia/bootstrap_dotfiles/">dotfiles bootstrap script</a></li>
  <li>created the best message of the day (motd) ever with <a href="http://www.mewbies.com/how_to_customize_your_console_login_message_tutorial.htm">this tutorial</a></li>
  <li>in order to do that I needed to install hddtemp, lm-sensors (and configure it with <code>sudo
sensors-detect</code>, fortune (fortune-mod on Ubuntu), and cowsay</li>
</ul>

<p><img class="center" src="https://lh4.googleusercontent.com/-QXSuwFFOFJ0/UO95Yd3bGrI/AAAAAAAAAVg/QvgptZL2SI4/s640/motd.jpg" width="540" height="532" title="my motd" /></p>

<h2 id="dynamic-dns">Dynamic DNS</h2>

<p>I’m hosting out of my apartment with an IP that’s potentially dynamic. I went with <a href="https://help.ubuntu.com/community/DynamicDNS#ddclient" title="Ubuntu ddclient">ZoneEdit</a>
as my dynamic DNS provider ($1/mo/domain) and installed <a href="http://stephen.rees-carter.net/2012/03/encrypted-home-directories-ssh-key-authentication/"> Ubuntu’s ddclient</a> which
periodically updates ZoneEdit with its IP.</p>

<h2 id="security">Security</h2>

<p>Ubuntu 12.04 gives me the option to encrypt my home directory. For a while I didn’t understand why
I couldn’t SSH into Jarvis. Then I figured out that the machine wasn’t be able to read my
<code>.ssh/authorized_keys</code> files since they were encrypted. So I <a href="http://www.davidxia.com/2012/02/8-ways-to-defend-against-brute-force-ssh-attacks" title="8 ways to defend against brute force ssh attacks">moved my authorized_keys</a> from the
usual <code>.ssh/authorized_keys</code> path to an unencrypted area <code>/home/.ssh/david</code>.</p>

<ul>
  <li>copied over my usual .ssh/config and .ssh/authorized_keys file</li>
  <li>generated a public key pair</li>
  <li><a href="http://blog.bigdinosaur.org/securing-your-server-with-denyhosts" title="securing your server with denyhosts">modified /etc/ssh/sshd_config</a>: change default port, no root login, key only auth, etc</li>
  <li>installed denyhosts according to <a href="http://blog.bigdinosaur.org/securing-ssh-with-iptables/" title="Securing SSH with iptables">Securing Your Server with Denyhosts</a></li>
  <li>copied over my previous collection of blacklisted hosts to /etc/hosts.deny</li>
  <li>added iptable rules according to [Securing SSH with iptables][16] and installed
iptables-persistent to persist them after reboot</li>
</ul>

<p>People who’ve tried to hack me but failed.</p>

<pre><code>sshd: 106.187.52.187
sshd: 117.34.88.152
sshd: 150.101.188.250
sshd: 62.75.215.8
sshd: 223.4.88.39
sshd: 76.74.236.19
sshd: 79.189.102.226
sshd: 74.63.209.195
sshd: 189.1.162.182
sshd: 176.53.8.8
sshd: 89.238.183.188
sshd: 118.217.12.34
sshd: 202.29.95.141
sshd: 85.214.107.171
sshd: 218.201.210.215
sshd: 66.65.122.235
sshd: 91.205.189.27
sshd: 150.140.134.169
sshd: 85.219.190.10
sshd: 91.221.67.149
sshd: 221.7.11.112
sshd: 118.97.116.3
sshd: 122.255.4.178
sshd: 175.45.42.37
sshd: 99.185.86.198
sshd: 62.129.241.146
sshd: 180.148.0.163
sshd: 50.137.50.191
sshd: 173.76.29.185
sshd: 152.179.155.2
sshd: 130.132.200.149
sshd: 128.36.194.119
</code></pre>

<h2 id="web-server">Web Server</h2>

<p>I installed nginx with the commands below (also in the Ars article).</p>

<pre><code>install python-software-properties
add-apt-repository ppa:nginx/development
aptitude upgrade
add-apt-repository ppa:nginx/development
</code></pre>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Vim + tmux + Cloud Virtual Machine = Increased Productivity]]></title>
    <link href="http://www.davidxia.com/2012/12/vim-tmux-cloud-virtual-machine-increased-productivity/"/>
    <updated>2012-12-19T00:00:00-05:00</updated>
    <id>http://www.davidxia.com/2012/12/vim-tmux-cloud-virtual-machine-increased-productivity</id>
    <content type="html"><![CDATA[<p>Recently I’ve been working with a kick-ass combination of Vim, <a href="http://tmux.sourceforge.net/" title="tmux">tmux</a>, and my cloud virtual
machine that has increased my productivity.</p>

<h2 id="workflow">Workflow</h2>

<ol>
  <li>Open terminal</li>
  <li>ssh into cloud VM</li>
  <li>Create a new tmux session (<code>tmux new -s [session name]</code>) or attach to an existing one (<code>tmux
attach -t [session name]</code>)</li>
  <li>List tmux sessions with <code>tmux list-sessions</code></li>
  <li>Use Vim, open like 50 tabs, don’t care about it</li>
  <li>Lose network connection, put computer to sleep, abruptly or accidentally close terminal
application because you’re like <em>F**k this. I’m going home</em>, or intentionally detach from tmux
  session (<code>ctrl-b   d</code>)</li>
  <li>Reattach to tmux session</li>
  <li>BAM, it’s like you never left!</li>
</ol>

<!--more-->

<h2 id="advantages">Advantages</h2>

<ul>
  <li>Your cloud VM is almost always on, unlike local machine, so your tmux sessions never die</li>
  <li>Vim is installed on most machines; with most GUI editors, you’ll need to mount a filesystem if
you’re working on a remote machine</li>
  <li>If your cloud VM has a public IP or you’re inside a VPN, you can share your environment and
in-progress work with others; and if you’re developing for the web and want to test your site on
various hardware and browser combinations, just point them to one URL – no more shitty
simulators</li>
  <li>You’re not tied down to hardware. Install your ssh key on various computers and never carry
around a laptop ever! The way cloud computing should be.</li>
</ul>

<h2 id="basic-tmux-commands">Basic tmux Commands</h2>

<p>The below commands should be run within a tmux session.</p>

<ul>
  <li>New window <code>ctrl-b + c</code></li>
  <li>Switch window <code>ctrl-b + n</code></li>
  <li>Split pane vertically <code>ctrl-b + %</code></li>
  <li>Split pane horizontally <code>ctrl-b + "</code></li>
  <li>Switch pane <code>ctrl-b + o</code></li>
</ul>

<p>Post your own tips, circle-jerk comments, or contrarian drivel below.</p>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[C Stdlib IO Functions and System Call Equivalents]]></title>
    <link href="http://www.davidxia.com/2012/12/c-stdlib-io-functions-and-system-call-equivalents/"/>
    <updated>2012-12-10T00:00:00-05:00</updated>
    <id>http://www.davidxia.com/2012/12/c-stdlib-io-functions-and-system-call-equivalents</id>
    <content type="html"><![CDATA[<p>I’m reading <a href="http://www.amazon.com/gp/product/0131103628/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0131103628&amp;linkCode=as2&amp;tag=easiamus00-20"><em>The C Programming Language</em></a><img src="http://www.assoc-amazon.com/e/ir?t=easiamus00-20&amp;l=as2&amp;o=1&amp;a=0131103628" alt="" /> and trying to remember C’s standard library
functions for IO and their system call equivalents. I couldn’t find a side-by-side chart online,
so I created this to help me.</p>

<div style="overflow-x: scroll;">
  <table style="width: 75em;">
    <tbody>
      <tr>
        <th />
        <th>C stdlib</th>
        <th>return value</th>
        <th>header</th>
        <th>system call</th>
        <th>return value</th>
        <th>header</th>
      </tr>
      <tr>
        <td>files</td>
        <td>file pointer FILE *fp</td>
        <td />
        <td>stdio.h</td>
        <td>file descriptor int td</td>
        <td />
        <td />
      </tr>
      <tr>
        <td>streams</td>
        <td>stdin, stdout, stderr</td>
        <td />
        <td>stdio.h</td>
        <td>0, 1, 2</td>
        <td />
        <td />
      </tr>
      <tr>
        <td>open</td>
        <td>FILE *fopen(char *name, char *mode)</td>
        <td>file pointer on success, NULL on failure</td>
        <td>stdio.h</td>
        <td>int open(char *name, int flags, int perms)</td>
        <td>file descriptor on success, -1 on error</td>
        <td>fctnl.h</td>
      </tr>
      <tr>
        <td>create</td>
        <td>(fopen creates file if it doesn&#8217;t exist)</td>
        <td />
        <td />
        <td>int creat(char *name, int perms)</td>
        <td />
        <td>fctnl.h</td>
      </tr>
      <tr>
        <td>read</td>
        <td>int getc(FILE *fp); getchar = getc(stdin)</td>
        <td>next char, EOF on end of file or error</td>
        <td>stdio.h</td>
        <td>int read(int fd, char *buf, int n)</td>
        <td>number bytes read, 0 on EOF, -1 on error</td>
        <td>stdio.h</td>
      </tr>
      <tr>
        <td>read</td>
        <td>char *fgets(char *line, int maxline); gets = fgets(stdin)</td>
        <td>*line on success, NULL on EOF or error</td>
        <td>stdio.h</td>
        <td />
        <td />
        <td />
      </tr>
      <tr>
        <td>write</td>
        <td>int putc(int c, FILE *fp)</td>
        <td>char written on success, EOF on error</td>
        <td>stdio.h</td>
        <td>int write(int fd, char *buf, int n)</td>
        <td>number bytes written, 0 on EOF, -1 on error</td>
        <td>stdio.h</td>
      </tr>
      <tr>
        <td>write</td>
        <td>int fputs(char *line, FILE *fp); puts = fputs(stout)</td>
        <td>non-negative int on success, EOF on error</td>
        <td>stdio.h</td>
        <td />
        <td />
        <td />
      </tr>
      <tr>
        <td>close</td>
        <td>int fclose(FILE *fp)</td>
        <td>0 on success</td>
        <td>stdio.h</td>
        <td>int close(int fd)</td>
        <td>0 on success</td>
        <td>unistd.h</td>
      </tr>
      <tr>
        <td>perms</td>
        <td>r, w, a</td>
        <td />
        <td />
        <td />
        <td />
        <td />
      </tr>
      <tr>
        <td />
        <td />
        <td />
        <td />
        <td>flags</td>
        <td>O_RDONLY, O_WRONLY, O_RDWR</td>
        <td>fctnl.h</td>
      </tr>
      <tr>
        <td />
        <td />
        <td />
        <td />
        <td />
        <td>BUFSIZ</td>
        <td>stdio.h</td>
      </tr>
    </tbody>
  </table>
</div>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Stockholm and San Francisco Videos]]></title>
    <link href="http://www.davidxia.com/2012/11/stockholm-and-san-francisco-videos/"/>
    <updated>2012-11-16T00:00:00-05:00</updated>
    <id>http://www.davidxia.com/2012/11/stockholm-and-san-francisco-videos</id>
    <content type="html"><![CDATA[<p>My trips to Stockholm and San Fran in September this year.</p>

<iframe class="fill-width" width="540" height="304" src="http://www.youtube.com/embed/5zm9hSW5AX0" frameborder="0" allowfullscreen=""></iframe>

<iframe class="fill-width" width="540" height="304" src="http://www.youtube.com/embed/uNfnY2Ovc1Y" frameborder="0" allowfullscreen=""></iframe>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Living Next to Webster Hall and Building a Wardrobe Unit]]></title>
    <link href="http://www.davidxia.com/2012/10/living-next-to-webster-hall-and-building-a-wardrobe-unit/"/>
    <updated>2012-10-30T00:00:00-04:00</updated>
    <id>http://www.davidxia.com/2012/10/living-next-to-webster-hall-and-building-a-wardrobe-unit</id>
    <content type="html"><![CDATA[<iframe class="fill-width" width="540" height="405" src="http://www.youtube.com/embed/alRkauMAuQ0" frameborder="0" allowfullscreen=""></iframe>

<iframe class="fill-width" width="540" height="405" src="http://www.youtube.com/embed/liE98xmuZXQ" frameborder="0" allowfullscreen=""></iframe>
]]></content>
  </entry>
  
</feed>
