<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><!-- generator="wordpress/2.2.1" --><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>good coders code, great reuse</title>
	<link>http://www.catonmat.net</link>
	<description>Peteris Krumins' blog about programming, hacking, software reuse, software ideas, computer security, google and technology.</description>
	<pubDate>Thu, 24 Jul 2008 15:24:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/catonmat" type="application/rss+xml" /><feedburner:emailServiceId>1038287</feedburner:emailServiceId><feedburner:feedburnerHostname>http://www.feedburner.com</feedburner:feedburnerHostname><item>
		<title>How Reddit Top and Hacker Top Programs Were Made</title>
		<link>http://feeds.feedburner.com/~r/catonmat/~3/344283851/</link>
		<comments>http://www.catonmat.net/blog/how-reddit-top-and-hacker-top-programs-were-made/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 20:30:56 +0000</pubDate>
		<dc:creator>Peteris Krumins</dc:creator>
		
		<category><![CDATA[Programming]]></category>
<category>cdk</category><category>console</category><category>curses</category><category>get stories</category><category>hacker news</category><category>howto</category><category>ncurses</category><category>programming</category><category>python</category><category>queue</category><category>reddit</category><category>threads</category><category>top</category><category>ycombinator</category>
		<guid isPermaLink="false">http://www.catonmat.net/blog/how-reddit-top-and-hacker-top-programs-were-made/</guid>
		<description><![CDATA[Over the last fortnight I have released two top-like applications to follow Reddit and Hacker News from the console. I called these applications Reddit Top and Hacker Top. I received a few emails and comments asking me to explain how the applications were made. I&#8217;ll explain it in this article.
A few months ago, while I [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/reddit-hacker-top-logo.gif' alt='reddit hacker top' class="post-icon" align="left" />Over the last fortnight I have released two top-like applications to follow <a href="http://www.reddit.com">Reddit</a> and <a href="http://news.ycombinator.com">Hacker News</a> from the console. I called these applications <a href="http://www.catonmat.net/blog/follow-reddit-from-the-console/">Reddit Top</a> and <a href="http://www.catonmat.net/blog/follow-hacker-news-from-the-console/">Hacker Top</a>. I received a few emails and comments asking me to explain how the applications were made. I&#8217;ll explain it in this article.</p>
<p>A few months ago, while I was creating the <a href="http://www.catonmat.net/blog/designing-redditriver-dot-com-website/">Reddit River</a> website, I noticed that Python&#8217;s standard library included a <a href="http://docs.python.org/lib/module-curses.html">curses module</a>. Having worked with curses and <a href="http://invisible-island.net/cdk/">Curses Development Kit</a> in C, I decided to refresh my curses skills, this time in Python.</p>
<p>Coding the application started with creating two separate Python modules for retrieving stories from Hacker News and Reddit.</p>
<p>If you look at the source code of <a href="http://www.catonmat.net/download/hacker-top.tgz">Hacker Top</a> and <a href="http://www.catonmat.net/download/reddit-top.tgz">Reddit Top</a> programs, you&#8217;ll notice two Python modules called &#8220;<strong>pyhackerstories.py</strong>&#8221; and &#8220;<strong>pyredditstories.py</strong>&#8220;. </p>
<p>Both of these modules follow the same interface and provide function <strong>get_stories</strong>(). The core functionality of this function can be easily understood from this code fragment:</p>
<pre>
stories = []
for i in range(pages):
    content = _get_page(url)
    entries = _extract_stories(content)
    stories.extend(entries)
    url = _get_next_page(content)
    if not url:
        break
</pre>
<p>The function iterates over the given number of Reddit or Hacker News pages and creates a list of objects (of type Story) containing information about stories on each page.</p>
<p>This function takes two optional parameters &#8216;<strong>pages</strong>&#8216; and &#8216;<strong>new</strong>&#8216; (pyredditstories.py also takes an optional &#8216;<strong>subreddit</strong>&#8216; parameter). These parameters control how many pages of (new) stories to scrape.</p>
<p>Here is an example of using pyhackerstories.py module to get the titles and scores of the first five most popular stories on Hacker News:</p>
<pre>
>>> from pyhackerstories import get_stories
>>> stories = get_stories()
>>> for story in stories[:5]:
...     print "%-3d - %s" % (story.score, story.title)
...
30  - Rutgers Graduate Student Finds New Prime-Generating Formula
59  - Xobni VP Engineering leaves for own startup
69  - The Pooled-Risk Company Management Company
14  - Jeff Bonforte, CEO of Xobni, explains why Gabor left
52  - Google's Wikipedia clone Knol launches.
</pre>
<p>Each Story object contains the following properties:</p>
<ul>
<li><strong>position</strong> - story position</li>
<li><strong>id</strong> - identifier used by Hacker News or Reddit to identify the story</li>
<li><strong>title</strong> - title of the story</li>
<li><strong>url</strong> - web address of the story</li>
<li><strong>user</strong> - username of the user who submitted the story</li>
<li><strong>score</strong> - number of upvotes the story has received</li>
<li><strong>human_time</strong> - time the story was submitted</li>
<li><strong>unix_time</strong> - unix time the story was submitted</li>
<li><strong>comments</strong> - number of comments the story has received</li>
</ul>
<p>Here is another example of retrieving most active Reddit users on <a href="http://programming.reddit.com">Programming Subreddit</a> (based on 5 pages of stories):</p>
<pre>
>>> from pyredditstories import get_stories
>>> stories = get_stories(subreddit='programming', pages=5)
>>> userdict = {}
>>> for story in stories:
...     userdict[story.user] = userdict.setdefault(story.user, 0) + 1
>>> users = [(userdict[u], u) for u in userdict]
>>> users.sort()
>>> users.reverse()
>>> for user in users[:5]:
...  print "%s: %d" % (user[1], user[0])
...
<a href="http://www.reddit.com/user/gst/">gst</a>: 19
<a href="http://www.reddit.com/user/dons/">dons</a>: 6
<a href="http://www.reddit.com/user/llimllib/">llimllib</a>: 4
<a href="http://www.reddit.com/user/synthespian/">synthespian</a>: 3
<a href="http://www.reddit.com/user/gthank/">gthank</a>: 3
</pre>
<p>The pyhackerstories.py and pyredditstories.py Python modules can also be used as standalone applications.</p>
<p>Executing pyredditstories.py with &#8216;<strong>&#8211;help</strong>&#8216; command line argument tells that:</p>
<pre>
$ ./pyredditstories.py  --help
usage: pyredditstories.py [options]

options:
  -h, --help   show this help message and exit
  -sSUBREDDIT  Subreddit to retrieve stories from. Default:
               front_page.
  -pPAGES      How many pages of stories to output. Default: 1.
  -n           Retrieve new stories. Default: nope.
</pre>
<p>Here is an example of executing pyredditstories.py to get five most popular programming stories:</p>
<pre>
$ ./pyredditstories.py -s programming | grep '^title' | head -5

title: "Turns out my nephew is really good with computers, so we're going to give him the job!"
title: Sun Microsystems funding Haskell on multicore OpenSPARC!
title: I love parser combinators [Haskell]
title: 2D collision detection for SVG - demo of intersection routines with SVG/Javascript
title: Priorities: Solaris vs Linux
</pre>
<p>That&#8217;s about enough information about these modules to create all kinds of wonderful things! Just play around a little! <img src='http://www.catonmat.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Download pyhackerstories.py: <a href="http://www.catonmat.net/download/pyhackerstories.py" title="Version 1.0 downloaded 22 times" rel="enclosure">pyhackerstories.py</a><br />
Download pyredditstories.py: <a href="http://www.catonmat.net/download/pyredditstories.py" title="Version 1.0 downloaded 31 times" rel="enclosure">pyredditstories.py</a></p>
<p>Now I&#8217;ll briefly explain how the curses user interface was made. I&#8217;ll cover only the ideas and will not go deeply into code.</p>
<div class="center-aligner">
<a href='http://www.catonmat.net/blog/wp-content/uploads/2008/07/hacker-top-detailed-mode-full.gif' title='hacker top, detailed mode'><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/hacker-top-detailed-mode.gif' alt='hacker top, detailed mode' /></a>
</div>
<p>I started with reading <a href="http://www.amk.ca/python/howto/curses/">Curses Programming with Python</a> howto. This howto explained how to do all the basic curses operations in Python - how to get into curses mode, how to create windows, print colorful text and how to handle user input.</p>
<p>The user interface had two requirements - it had to be responsive while the new stories were being retrieved from the sites, and it had to be independent from the website, meaning that it should be easy to display data from a different website with minor (or no) modifications to the interface code.</p>
<p>The first requirement was satisfied by creating a separate thread (see Retriever class) which periodically called get_stories() and passed the stories to the interface via a <a href="http://www.python.org/doc/current/lib/module-Queue.html">queue</a>.</p>
<p>The second requirement was already satisfied when I created the pyredditstories.py and pyhackerstories.py modules. As I mentioned, these modules provided the same interface for retrieving stories and could be used almost interchangeably.</p>
<p>That&#8217;s basically it! If you have any specific questions, feel free to ask them in the comments!</p>
<p>Ps. I am thinking of releasing <strong>Dzone Top</strong> and <strong>Digg Top</strong>, and then merge all these Top programs into a single social news console program. <strong>Are there any volunteers who would like to help me?</strong></p>
<div class="download">
<div class="download-title">Download Hacker Top and Reddit Top Programs</div>
<p><strong>Hacker Top</strong></p>
<p>Download link: <a href="http://www.catonmat.net/download/hacker-top.tgz" title="Version 1.0 downloaded 537 times" rel="enclosure">hacker top program</a> (537 downloads)</p>
<p><strong>Reddit Top</strong></p>
<p>Download link: <a href="http://www.catonmat.net/download/reddit-top.tgz" title="Version 1.0 downloaded 595 times" rel="enclosure">reddit top program</a> (595 downloads)</p>
<p>These programs are released under GNU General Public License.</p>
</div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/catonmat?a=On98gJ"><img src="http://feeds.feedburner.com/~f/catonmat?i=On98gJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=7Fx1Bj"><img src="http://feeds.feedburner.com/~f/catonmat?i=7Fx1Bj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=lzZ0jj"><img src="http://feeds.feedburner.com/~f/catonmat?i=lzZ0jj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=tzEmVj"><img src="http://feeds.feedburner.com/~f/catonmat?i=tzEmVj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/catonmat/~4/344283851" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.catonmat.net/blog/how-reddit-top-and-hacker-top-programs-were-made/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.catonmat.net/blog/how-reddit-top-and-hacker-top-programs-were-made/</feedburner:origLink></item>
		<item>
		<title>How to Read Reddit the Fanatic Programmer Way</title>
		<link>http://feeds.feedburner.com/~r/catonmat/~3/343012561/</link>
		<comments>http://www.catonmat.net/blog/how-to-read-reddit-the-fanatic-programmer-way/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 16:50:36 +0000</pubDate>
		<dc:creator>Peteris Krumins</dc:creator>
		
		<category><![CDATA[Programming]]></category>
<category>fanatic</category><category>programming</category><category>radical</category><category>reddit</category>
		<guid isPermaLink="false">http://www.catonmat.net/blog/how-to-read-reddit-the-fanatic-programmer-way/</guid>
		<description><![CDATA[Yes, I admit it, I am fanatic about programming! Being fanatic means that I am always staying current with programming news, I am doing a lot of experimentation, and I am being very playful with various programming languages.
Reddit has long been my favorite site for news but very frequently I found myself reading nonsense which [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/reddit.gif' alt='reddit' class="post-icon" align="left" />Yes, I admit it, I am fanatic about programming! Being fanatic means that I am always staying current with programming news, I am doing a lot of experimentation, and I am being very playful with various programming languages.</p>
<p><a href="http://www.reddit.com">Reddit</a> has long been my favorite site for news but very frequently I found myself reading nonsense which had nothing to do with my real passion. I decided to take a radical step and turn Reddit into the definitive source for programming news, or the way I like to say, <strong>I decided to read Reddit the fanatic programmer way</strong>.</p>
<p>Here is how I did it.</p>
<p>I said no to all the default Reddit communities.</p>
<div class="center-aligner">
<img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/default-reddit-communities.gif' alt='default reddit communities' />
</div>
<p>And subscribed to various programming subreddits!</p>
<div class="center-aligner">
<img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/programming-reddit-communities.gif' alt='programming reddit communities' /><br />
<small>Note: I am also subscribed to <strong>math</strong> and <strong>physics</strong> subreddits as those subjects are my hobbies.</small>
</div>
<p>This picture includes only a fraction of the programming subreddits I subscribed to! Here is the full list:</p>
<ul>
<li><a href="http://www.reddit.com/r/programming/">Programming</a></li>
<li><a href="http://www.reddit.com/r/Python/">Python</a></li>
<li><a href="http://www.reddit.com/r/compsci/">Computer Science</a></li>
<li><a href="http://www.reddit.com/r/ruby/">Ruby</a></li>
<li><a href="http://www.reddit.com/r/javascript/">Javascript</a></li>
<li><a href="http://www.reddit.com/r/cpp/">C++</a></li>
<li><a href="http://www.reddit.com/r/lisp/">Lisp</a></li>
<li><a href="http://www.reddit.com/r/PHP/">PHP</a></li>
<li><a href="http://www.reddit.com/r/functional/">Functional</a></li>
<li><a href="http://www.reddit.com/r/perl/">Perl</a></li>
<li><a href="http://www.reddit.com/r/erlang/">Erlang</a></li>
<li><a href="http://www.reddit.com/r/types/">Types</a></li>
<li><a href="http://www.reddit.com/r/haskell/">Haksell</a></li>
<li><a href="http://www.reddit.com/r/asm/">Assembly Programming</a></li>
<li><a href="http://www.reddit.com/r/C_Programming/">C Programming</a></li>
<li><a href="http://www.reddit.com/r/c_language/">C Language</a></li>
<li><a href="http://www.reddit.com/r/scheme/">Scheme</a></li>
<li><a href="http://www.reddit.com/r/prolog/">Prolog</a></li>
</ul>
<p>I am also subscribed to some related communities:</p>
<ul>
<li><a href="http://www.reddit.com/r/linux/">Linux</a></li>
<li><a href="http://www.reddit.com/r/netsec/">Network Security</a> </li>
<li><a href="http://www.reddit.com/r/math/">Math</a></li>
<li><a href="http://www.reddit.com/r/lectures/">Video Lectures</a></li>
<li><a href="http://www.reddit.com/r/Physics/">Physics</a></li>
<li><a href="http://www.reddit.com/r/hacking/">Hacking</a></li>
<li><a href="http://www.reddit.com/r/cheats/">Cheat Sheets</a></li>
<li><a href="http://www.reddit.com/r/unix/">Unix</a></li>
<li><a href="http://www.reddit.com/r/geekmusic/">Geek Music</a></li>
<li><a href="http://www.reddit.com/r/catonmat/">Catonmat</a></li>
</ul>
<p>Doing so turned Reddit&#8217;s front page into a definitive source for programming news.</p>
<div class="center-aligner">
<a href='http://www.catonmat.net/blog/wp-content/uploads/2008/07/reddit-page-big.gif' title='reddit’s front page (big)'><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/reddit-page-smaller.gif' alt='reddit’s front page (small)' /></a>
</div>
<p>I invite you to share your methods for following the latest programming buzz in the comments!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/catonmat?a=Hs3V7J"><img src="http://feeds.feedburner.com/~f/catonmat?i=Hs3V7J" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=17TyUj"><img src="http://feeds.feedburner.com/~f/catonmat?i=17TyUj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=q8MTwj"><img src="http://feeds.feedburner.com/~f/catonmat?i=q8MTwj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=ixVNZj"><img src="http://feeds.feedburner.com/~f/catonmat?i=ixVNZj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/catonmat/~4/343012561" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.catonmat.net/blog/how-to-read-reddit-the-fanatic-programmer-way/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.catonmat.net/blog/how-to-read-reddit-the-fanatic-programmer-way/</feedburner:origLink></item>
		<item>
		<title>A Year of Blogging</title>
		<link>http://feeds.feedburner.com/~r/catonmat/~3/342176310/</link>
		<comments>http://www.catonmat.net/blog/a-year-of-blogging/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 20:50:28 +0000</pubDate>
		<dc:creator>Peteris Krumins</dc:creator>
		
		<category><![CDATA[Misc]]></category>
<category>blogging</category><category>feedburner</category><category>google analytics</category><category>statcounter</category><category>statistics</category><category>technorati</category><category>traffic</category>
		<guid isPermaLink="false">http://www.catonmat.net/blog/a-year-of-blogging/</guid>
		<description><![CDATA[My dear readers, it has been a year since I have been blogging here! With this post I want to share my blog statistics with you.
During this year (July 14, 2007 - July 20, 2008) I managed to write 58 posts, which received 808 comments. Based on statistics from Statcounter and Google Analytics, these posts [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/year-of-blogging.jpg' alt='A Year of Blogging' class="post-icon" align="left" />My dear readers, it has been a year since I have been blogging here! With this post I want to share my blog statistics with you.</p>
<p>During this year (July 14, 2007 - July 20, 2008) I managed to write <strong>58 posts</strong>, which received <strong>808 comments</strong>. Based on statistics from <a href="http://www.statcounter.com">Statcounter</a> and <a href="http://www.google.com/analytics/">Google Analytics</a>, these posts received <strong>574,874 views</strong> by <strong>424,292 unique visitors</strong>.</p>
<p>Here is a Google Analytics graph showing monthly page views for this period (click for a larger version):</p>
<div class="center-aligner">
<a href='http://www.catonmat.net/blog/wp-content/uploads/2008/07/page-views-big.gif' title='catonmat.net page views graph (big)'><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/page-views-small.gif' alt='catonmat.net page views graph (small)' /></a>
</div>
<p>Here are the <strong>top 5 countries</strong> my blog readers came from:</p>
<ul>
<li>United States (195,076 visitors) </li>
<li>United Kingdom (25,988 visitors) </li>
<li>Canda (25,335 visitors)</li>
<li>India (13,753 visitors)</li>
<li>Germany (13,670 visitors)</li>
</ul>
<p>Not surprisingly, the <strong>top 5 referring sites</strong> were all social media and bookmarking sites:</p>
<ul>
<li><a href="http://www.reddit.com">reddit.com</a> (84,391 visitors)</li>
<li><a href="http://www.digg.com">digg.com</a> (43,903 visitors)</li>
<li><a href="http://www.stumbleupon.com">stumbleupon.com</a> (20,234 visitors)</li>
<li><a href="http://del.icio.us">del.icio.us</a> (13,146 visitors)</li>
<li><a href="http://news.ycombinator.com">news.ycombinator.com</a> (10,757 visitors)</li>
</ul>
<p>From all the visitors <strong>48,386</strong> went to my site directly and <strong>82,502</strong> were sent here by my darling Google.</p>
<p>During the first year, approximately <strong>1000 people subscribed to my blog</strong>. Here is the <a href="http://www.feedburner.com">Feedburner</a> subscriber graph for the year:</p>
<div class="center-aligner">
<img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/catonmat-feedburner-first-year.png' alt='feedburner statistics for one year of blogging' /></p>
<p><small>If you are interested in my blog, you may subscribe here: <a href="http://feeds.feedburner.com/catonmat">catonmat rss feed</a>.</small>
</div>
<p>According to <a href="http://www.technorati.com">Technorati</a>, my blog has received <strong>476 blog reactions</strong> and <strong>ranks 29,521-st out of 112.8 million blogs</strong>!</p>
<p>Many of my posts have been submitted to Reddit, Digg and have been Stumbled. Here are the <strong>top 5 most visited posts</strong>:</p>
<ul>
<li><a href="http://www.catonmat.net/blog/learning-javascript-programming-language-through-video-lectures/">Learning JavaScript through Video Lectures</a> (44,548 views)</li>
<li><a href="http://www.catonmat.net/blog/designing-digg-picture-website/">Designing Digg Picture Website in a Matter of Hours</a> (43,962 views)</li>
<li><a href="http://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line-history/">The Definitive Guide to Bash Command Line History</a> (31,568 views)</li>
<li><a href="http://www.catonmat.net/blog/bash-vi-editing-mode-cheat-sheet/">Working Productively in Bash&#8217;s Vi Command Line Editing Mode</a> (23,508 views)</li>
<li><a href="http://www.catonmat.net/blog/how-to-extract-audio-tracks-from-youtube-videos/">How to Extract Audio Tracks from YouTube Videos</a> (22,588 views)</li>
</ul>
<p>Some of my how-to posts came with downloadable cheat sheets. Here are the <strong>top 5 cheat sheets</strong>:</p>
<ul>
<li><a href="http://www.catonmat.net/blog/sed-stream-editor-cheat-sheet/">Sed, UNIX Stream Editor, Cheat Sheet</a> (downloaded 12,162 times)</li>
<li><a href="http://www.catonmat.net/blog/perl-pack-unpack-printf-cheat-sheet/">Perl&#8217;s pack()/unpack() and printf() Cheat Sheet</a> (downloaded 10,849 times)</li>
<li><a href="http://www.catonmat.net/blog/awk-nawk-and-gawk-cheat-sheet/">AWK Programming Language Cheat Sheet</a> (downloaded 10,303 times)</li>
<li><a href="http://www.catonmat.net/blog/screen-terminal-emulator-cheat-sheet/">Screen Terminal Emulator Cheat Sheet</a> (downloaded 6,706 times)</li>
<li><a href="http://www.catonmat.net/blog/bash-vi-editing-mode-cheat-sheet/">Bash VI Editing Mode Cheat Sheet</a> (downloaded 5,452 times)</li>
</ul>
<p>During the last year I also did several web projects. As I was busy with <a href="http://www.catonmat.net/blog/graduated-with-bsc-degree-in-physics/">physics studies</a>, I created only four <strong>web projects</strong> (all of these projects are open source):</p>
<ul>
<li><a href="http://www.catonmat.net/blog/designing-reddit-media-website/">Reddit Media: intelligent fun online!</a></li>
<li><a href="http://www.catonmat.net/blog/designing-digg-picture-website/">Digpicz: the missing digg picture section!</a></li>
<li><a href="http://www.catonmat.net/blog/making-of-picurls-popurls-for-pictures-part-one/">Picurls: buzziest pictures on the net!</a></li>
<li><a href="http://www.catonmat.net/blog/designing-redditriver-dot-com-website/">Reddit River: what flows online!</a></li>
</ul>
<p>In March 2008 I started posting geek music on Fridays. Here are the <strong>top 5 geek songs</strong>:</p>
<ul>
<li><a href="http://www.catonmat.net/blog/musical-geek-friday-crypto/">Crypt-o</a> (played 5,153 times)</li>
<li><a href="http://www.catonmat.net/blog/musical-geek-friday-model-view-controller-song/">Model-View-Controller Song</a> (played 4,700 times)</li>
<li><a href="http://www.catonmat.net/blog/musical-geek-friday-code-monkey/">Code Monkey</a> (played 2,186 times)</li>
<li><a href="http://www.catonmat.net/blog/musical-geek-friday-god-wrote-in-lisp-eternal-flame/">God Wrote in Lisp</a> (played 1,952 times)</li>
<li><a href="http://www.catonmat.net/blog/musical-geek-friday-the-day-the-routers-died/">The Day the Routers Died</a> (played 1,462 times)</li>
</ul>
<p>I am satisfied with where this blog is heading. I&#8217;d like to thank all my fans and all the visitors who regularly return to the site!</p>
<p>To make things more challenging, I am setting myself a goal of reaching <strong>5000 subscribers</strong> by the end of the next year of blogging (July 2009)! I know that this is very ambitious goal but I am ready to take the challenge!</p>
<div class="center-aligner">
<img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/birthday-portal-cake.jpg' alt='birthday portal cake' />
</div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/catonmat?a=BGjaNJ"><img src="http://feeds.feedburner.com/~f/catonmat?i=BGjaNJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=SDXBnj"><img src="http://feeds.feedburner.com/~f/catonmat?i=SDXBnj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=L9Hs8j"><img src="http://feeds.feedburner.com/~f/catonmat?i=L9Hs8j" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=GxuNXj"><img src="http://feeds.feedburner.com/~f/catonmat?i=GxuNXj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/catonmat/~4/342176310" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.catonmat.net/blog/a-year-of-blogging/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.catonmat.net/blog/a-year-of-blogging/</feedburner:origLink></item>
		<item>
		<title>Musical Geek Friday #11: The BitTorrent Song</title>
		<link>http://feeds.feedburner.com/~r/catonmat/~3/339565252/</link>
		<comments>http://www.catonmat.net/blog/musical-geek-friday-the-bittorrent-song/#comments</comments>
		<pubDate>Fri, 18 Jul 2008 20:15:44 +0000</pubDate>
		<dc:creator>Peteris Krumins</dc:creator>
		
		<category><![CDATA[Musical Geek Friday]]></category>
<category>bittorrent</category><category>brent simon</category><category>geek</category><category>iso</category><category>mininova</category><category>mp3</category><category>music</category><category>nerd</category><category>nerdpunk</category><category>song</category><category>torrent</category>
		<guid isPermaLink="false">http://www.catonmat.net/blog/musical-geek-friday-the-bittorrent-song/</guid>
		<description><![CDATA[This week on Musical Geek Friday - the famous BitTorrent Song!
The song is written and performed by Brent Simon. Brent describes himself as a super nerd who plays the synth and makes original music that&#8217;s honest and from the heart. He keeps composing and his latest music can be found on his MySpace page - [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/bittorrent-song.jpg' alt='the bittorrent song' class="post-icon" align="left" />This week on Musical Geek Friday - the famous <strong>BitTorrent Song</strong>!</p>
<p>The song is written and performed by <a href="http://www.nerdpunk.com/">Brent Simon</a>. Brent describes himself as a super nerd who plays the synth and makes original music that&#8217;s honest and from the heart. He keeps composing and his latest music can be found on his MySpace page - <a href="http://www.myspace.com/brentsimon">brentsimon</a>.</p>
<p>The song, when I first downloaded it, was actually called &#8220;Mininova&#8221;, in honor of one of the largest BitTorrent sites on the net - <a href="http://www.mininova.org/">Mininova.org.<br />
</a></p>
<p>Here it is! <strong>The BitTorrent Song</strong>!</p>
<p></p>
<p>Download this song: <a href="http://www.catonmat.net/download/brent_simon-the_bittorrent_song.mp3" title="Version 1.0 downloaded 329 times" rel="enclosure">the bittorrent song (musical geek friday #11)</a><br />
Downloaded: 329 times</p>
<p>Download lyrics: <a href="http://www.catonmat.net/download/brent_simon-the_bittorrent_song-lyrics.txt" title="Version 1.0 downloaded 45 times" rel="enclosure">the bittorrent song lyrics (musical geek friday #11)</a><br />
Downloaded: 45 times</p>
<p>Here is the lyrics of The BitTorrent Song:</p>
<blockquote><p>
-Verse 1-<br />
Gather &#8217;round and hear my story<br />
&#8216;Bout the new old west<br />
I sought torrents, rips, and ISO&#8217;s<br />
Logged in under guest</p>
<p>Movies, music, games and porno,<br />
Warez and killer apps,<br />
Compressors, CODECs and keygens<br />
Compilers, hacks and cracks</p>
<p>-Chorus-<br />
Data&#8217;s streamin&#8217; my hard drive&#8217;s screamin&#8217;<br />
Fragmenting the night<br />
Bit&#8217;s are flowin&#8217; corruption&#8217;s growin&#8217;<br />
Into every last byte</p>
<p>-Verse 2-<br />
Bad command or file name<br />
OK, now what&#8217;s next<br />
D-I-R where is my brain<br />
It&#8217;s coded in base hex</p>
<p>Alright now you&#8217;ll feel my wrath<br />
Don&#8217;t ever mess with me<br />
Cram this up your Gigabyte<br />
So long Format C:</p>
<p>-Chorus-<br />
Data&#8217;s streamin&#8217; my hard drive&#8217;s screamin&#8217;<br />
Fragmenting the night<br />
Bit&#8217;s are flowin&#8217; corruption&#8217;s growin&#8217;<br />
Into every last byte</p>
<p>-Bonus Verse-<br />
If you watch my lips real closely<br />
You&#8217;ll see they don&#8217;t match what I&#8217;m saying<br />
My typewriter emits fluids<br />
All of which are intoxicating</p>
<p>Staring at my shoes all after-<br />
Noon on heroin isn&#8217;t boring<br />
Just to poop I need the surgical<br />
Equivalent of apple coring</p>
<p>-Chorus-<br />
Naked Lunch<br />
Naked Lunch<br />
Naked Lunch<br />
Naked Lunch
</p></blockquote>
<p>Here is Brent Simon performing The Bittorrent Song:</p>
<div class="center-aligner">
<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/v/vN1D5jJAHTs&#038;hl=en&#038;fs=1"></param>
<param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/vN1D5jJAHTs&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object><br />
Original link: <a href="http://www.youtube.com/watch?v=vN1D5jJAHTs">http://www.youtube.com/watch?v=vN1D5jJAHTs</a>
</div>
<div class="download">
<div class="download-title">Download &#8220;The Bittorrent Song&#8221;</div>
<p>Download this song: <a href="http://www.catonmat.net/download/brent_simon-the_bittorrent_song.mp3" title="Version 1.0 downloaded 329 times" rel="enclosure">the bittorrent song (musical geek friday #11)</a><br />
Downloaded: 329 times</p>
<p>Download lyrics: <a href="http://www.catonmat.net/download/brent_simon-the_bittorrent_song-lyrics.txt" title="Version 1.0 downloaded 45 times" rel="enclosure">the bittorrent song lyrics (musical geek friday #11)</a><br />
Downloaded: 45 times</p>
<p>Click to listen:<br />
</p>
<p>Have fun and until next geeky Friday! <img src='http://www.catonmat.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</div>
<div class="ads-aad">
<script type="text/javascript"><!--
google_ad_client = "pub-0433925538517663";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
//2007-07-12: catonmat after download
google_ad_channel = "9549065335";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "753206";
google_color_text = "4C4C4C";
google_color_url = "E6E6E6";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/catonmat?a=AdpfiJ"><img src="http://feeds.feedburner.com/~f/catonmat?i=AdpfiJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=NXd8nj"><img src="http://feeds.feedburner.com/~f/catonmat?i=NXd8nj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=Gs7t3j"><img src="http://feeds.feedburner.com/~f/catonmat?i=Gs7t3j" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=rOJsqj"><img src="http://feeds.feedburner.com/~f/catonmat?i=rOJsqj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/catonmat/~4/339565252" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.catonmat.net/blog/musical-geek-friday-the-bittorrent-song/feed/</wfw:commentRss>
<enclosure url="http://www.catonmat.net/download/brent_simon-the_bittorrent_song.mp3" length="5482496" type="audio/mpeg" />
		<feedburner:origLink>http://www.catonmat.net/blog/musical-geek-friday-the-bittorrent-song/</feedburner:origLink></item>
		<item>
		<title>How Cybercriminals Steal Money</title>
		<link>http://feeds.feedburner.com/~r/catonmat/~3/338598179/</link>
		<comments>http://www.catonmat.net/blog/how-cybercriminals-steal-money/#comments</comments>
		<pubDate>Thu, 17 Jul 2008 19:25:23 +0000</pubDate>
		<dc:creator>Peteris Krumins</dc:creator>
		
		<category><![CDATA[Video Lectures]]></category>
<category>cybercriminal</category><category>hacker</category><category>lecture</category><category>neil daswani</category><category>owasp</category><category>sql injection</category><category>techtalk</category><category>video</category><category>xsrf</category><category>xssi</category>
		<guid isPermaLink="false">http://www.catonmat.net/blog/how-cybercriminals-steal-money/</guid>
		<description><![CDATA[Another great lecture from Google TechTalks.
This lecture is given by Neil Daswani, who has a Ph.D. from Stanford and currently works at Google as a security engineer. He is also an author of a book entitled &#8220;Foundations of Security: What Every Programmer Needs to Know&#8220;, which teaches you state-of-the-art software security design principles, methodology, and [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/hackers-steal-money.jpg' alt='hackers steal money' class="post-icon" align="left" />Another great lecture from <a href="http://www.youtube.com/user/googletechtalks">Google TechTalks</a>.</p>
<p>This lecture is given by <a href="http://www.neildaswani.com/">Neil Daswani</a>, who has a Ph.D. from Stanford and currently works at Google as a security engineer. He is also an author of a book entitled &#8220;<a href="http://www.amazon.com/Foundations-Security-Every-Programmer-Experts/dp/1590597842/freesciencand-20">Foundations of Security: What Every Programmer Needs to Know</a>&#8220;, which teaches you state-of-the-art software security design principles, methodology, and concrete programming techniques you need to build secure software systems.</p>
<p>Neil talks about top three web application vulnerabilities that cybercriminals use to steal money. These three vulnerabilities are:</p>
<ul>
<li>SQL Injection attacks,</li>
<li>Cross-Site Request Forgery (XSRF) attacks, and</li>
<li>Cross-Site Script Inclusion (XSSI) attacks.</li>
</ul>
<p>I was surprised that he did not cover plain, old Cross-Site Scripting (XSS) attacks, but jumped right to dynamic XSS. You&#8217;ll have to get familiar with this type attack on your own. See the <a href="http://www.cgisecurity.com/articles/xss-faq.shtml">XSS Faq</a> and <a href="http://ha.ckers.org/xss.html">XSS Cheat Sheet</a> for more information!</p>
<div class="center-aligner">
<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/v/jC6Q1uCnbMo&#038;hl=en&#038;fs=1"></param>
<param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/jC6Q1uCnbMo&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object><br />
Direct URL: <a href="http://www.youtube.com/watch?v=jC6Q1uCnbMo">http://www.youtube.com/watch?v=jC6Q1uCnbMo</a>
</div>
<p>Interesting points from the lecture:</p>
<ul>
<li>[01:48] Years ago cybercriminals were teenagers writing viruses and worms, today they are organized crime looking for stealing money.</li>
<li>[03:19] Intermediate goals to stealing money are data theft, extortion and malware distribution.</li>
<li>[04:02] Russian Business Network (RBN) is an example of organized cybercrime.</li>
<li>[09:00] Attack #1: SQL Injection.</li>
<li>[16:30] Preventing SQL injections.</li>
<li>[17:00] Don&#8217;t blacklist (filter) characters in queries. Whitelist (allow) well-defined set of safe values for each field.</li>
<li>[18:30] Take a look at <a href="http://www.modsecurity.org/">mod_security</a> if you use Apache web server. Mod_security is a Web Application Firewall. It allows you to define a set of rules the web application must follow.</li>
<li>[19:30] Prepared statements and bind variables help to avoid SQL injections.</li>
<li>[23:00] Other mitigations strategies include - limiting web application user&#8217;s privileges on the sql server, hardenining database server and host operating system.</li>
<li>[23:45] <a href="http://www.catonmat.net/blog/wp-content/uploads/2008/07/second-order-sql-injection-attacks.pdf" title="second order sql injection attacks">Second order SQL injections</a> (link to pdf) abuse data that is already in the database.</li>
<li>[23:55] <a href='http://www.catonmat.net/blog/wp-content/uploads/2008/07/blind-sql-injection-attacks.pdf' title='blind sql injection attacks'>Blind SQL injection</a> (link to pdf) is a technique to reverse engineer the structure of the database.</li>
<li>[24:25] Attack #2: Cross-Site Request Forgery (XSRF).</li>
<li>[26:00] How XSRF Works.</li>
<li>[31:30] <a href='http://www.catonmat.net/blog/wp-content/uploads/2008/07/drive-by-pharming.pdf' title='drive-by-pharming'>Drive-By-Pharming</a> (pdf) is an XSRF technique where the attacker changes DNS settings of a users broadband router (fact - 50% of home users do not change default router password).</li>
<li>[34:00] Preventing XSRF.</li>
<li>[34:20] Check Referer HTTP header. That doesn&#8217;t always work because the user might be using a proxy.</li>
<li>[36:15] Validate the user by asking him to provide his password or any other token only the user has knowledge of.</li>
<li>[37:15] Validate requests via &#8220;Action Tokens&#8221; which add special tokens to forms to distinguish them from forged forms.</li>
<li>[38:30] Attack #3: Cross-Site Script Inclusion (XSSI).</li>
<li>[39:10] How XSSI works.</li>
<li>[41:20] Dynamic script inclusion example.</li>
<li>[47:25] Trends.</li>
<li>[50:12] Open Web Application Security Project (OWASP) Top 10 vulnerabilities in 2007 (<a href="http://www.owasp.org/index.php/Top_10_2007">link</a>).</li>
<li>[53:55] Google has some material on Web Security at <a href="http://code.google.com/edu/">code.google.com/edu</a>.</li>
</ul>
<p>Happy hacking! (just kidding <img src='http://www.catonmat.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> )</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/catonmat?a=d2fueJ"><img src="http://feeds.feedburner.com/~f/catonmat?i=d2fueJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=Oo1DPj"><img src="http://feeds.feedburner.com/~f/catonmat?i=Oo1DPj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=3R8Clj"><img src="http://feeds.feedburner.com/~f/catonmat?i=3R8Clj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=VmpIfj"><img src="http://feeds.feedburner.com/~f/catonmat?i=VmpIfj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/catonmat/~4/338598179" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.catonmat.net/blog/how-cybercriminals-steal-money/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.catonmat.net/blog/how-cybercriminals-steal-money/</feedburner:origLink></item>
		<item>
		<title>Searching and Mining Open Source Code from the Web</title>
		<link>http://feeds.feedburner.com/~r/catonmat/~3/337468821/</link>
		<comments>http://www.catonmat.net/blog/searching-and-mining-open-source-code-from-the-web/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 15:08:50 +0000</pubDate>
		<dc:creator>Peteris Krumins</dc:creator>
		
		<category><![CDATA[Video Lectures]]></category>
<category>api</category><category>codase</category><category>data mining</category><category>education</category><category>google code search</category><category>koders</category><category>krugle</category><category>negweb</category><category>parseweb</category><category>tao xie</category><category>video lectures</category><category>xweb</category>
		<guid isPermaLink="false">http://www.catonmat.net/blog/searching-and-mining-open-source-code-from-the-web/</guid>
		<description><![CDATA[I found a Google Talk on a topic that&#8217;s related to the motto of my blog - &#8220;good coders code, great reuse&#8220;.
In this talk, professor Tao Xie speaks about his research on using public code repositories together with code search engines for finding common API usage patterns and anti-patterns.
His research software uses the following four [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/krugle-koders-codase-google-code-search.jpg' alt='Koders, Krugle, Codase, Google Code Search' class="post-icon" align="left" />I found a Google Talk on a topic that&#8217;s related to the motto of my blog - &#8220;<em>good coders code, great reuse</em>&#8220;.</p>
<p>In this talk, professor <a href="http://people.engr.ncsu.edu/txie/">Tao Xie</a> speaks about his research on using public code repositories together with code search engines for finding common API usage patterns and anti-patterns.</p>
<p>His research software uses the following four code search engines.</p>
<ul>
<li><a href="http://www.google.com/codesearch">Google Code Search</a> with billions of lines of code.</li>
<li><a href="http://www.krugle.org/">Krugle</a> with 2.5 billion LOC.</li>
<li><a href="http://www.koders.com">Koders</a> with 760 million LOC.</li>
<li><a href="http://www.codase.com">Codase</a> with 250 million LOC.</li>
</ul>
<p>He suggests to view Raphael Volz&#8217;s <a href="http://raphaelvolz.de/blog/?p=5">analysis</a> for more information about these search engines. </p>
<p>Tao has developed three tools, which use the aforementioned search engines:</p>
<ul>
<li>PARSEWeb for finding API usage patterns,</li>
<li>XWeb for finding forgotten exception handlers, and</li>
<li>NEGWeb for finding misuses of API calls.</li>
</ul>
<p>See the <a href="http://ase.csc.ncsu.edu/projects/minecode/">code mining project</a> website for more information.</p>
<p>The lecture is done in a very academic manner and it&#8217;s very hard to follow. Be sure that you are really interested in this topic before watching it.</p>
<div class="center-aligner">
<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/v/18ZCKl9NySs&#038;hl=en&#038;fs=1"></param>
<param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/18ZCKl9NySs&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object><br />
Direct URL: <a href="http://www.youtube.com/watch?v=18ZCKl9NySs">http://www.youtube.com/watch?v=18ZCKl9NySs</a>
</div>
<p>Some excerpts from the lecture:</p>
<ul>
<li>[04:26] A problem with data mining on source code is that it might not have enough data points (usages of API) to discover common patterns.</li>
<li>[04:58] It is crucial to have a lot of data points to get good results out of data mining</li>
<li>[08:37] Google Code Search indexes publicly hosted SVN and CVS repositories.</li>
<li>[09:20] Example of searching for C stdlib&#8217;s fopen usage on Google Code Search (query: &#8220;<a href="http://www.google.com/codesearch?q=lang%3AC+file%3A.c%24+fopen%5Cs*%5C%28">lang:C file:.c$ fopen\s*\(</a>&#8221; </li>
<li>[11:08] Example of <a href="http://www.krugle.org/kse/files?query=fopen&#038;lang=c&#038;findin=functioncall">the same search</a> on Krugle.</li>
<li>[16:40] Code search engines return partial code samples. Various heuristics are used for type inference.</li>
<li>[22:05] Example of integrating Tao&#8217;s PARSEWeb into Eclipse.</li>
<li>[28:15] Interesting idea of constructing and issuing multiple queries to find more code samples.</li>
<li>[36:20] A study showed that a proper deallocation of resources after an exception resulted in 17% performance increase.</li>
</ul>
<p>I&#8217;d like to hear some comments on websites that you use for finding code examples!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/catonmat?a=q8UlSJ"><img src="http://feeds.feedburner.com/~f/catonmat?i=q8UlSJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=mw49pj"><img src="http://feeds.feedburner.com/~f/catonmat?i=mw49pj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=9Moccj"><img src="http://feeds.feedburner.com/~f/catonmat?i=9Moccj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=hOOXyj"><img src="http://feeds.feedburner.com/~f/catonmat?i=hOOXyj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/catonmat/~4/337468821" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.catonmat.net/blog/searching-and-mining-open-source-code-from-the-web/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.catonmat.net/blog/searching-and-mining-open-source-code-from-the-web/</feedburner:origLink></item>
		<item>
		<title>Follow Reddit from the Console</title>
		<link>http://feeds.feedburner.com/~r/catonmat/~3/335446062/</link>
		<comments>http://www.catonmat.net/blog/follow-reddit-from-the-console/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 14:25:43 +0000</pubDate>
		<dc:creator>Peteris Krumins</dc:creator>
		
		<category><![CDATA[Programming]]></category>
<category>beautifulsoup</category><category>console</category><category>curses</category><category>ncurses</category><category>programming</category><category>python</category><category>reddit</category><category>terminal</category><category>top</category>
		<guid isPermaLink="false">http://www.catonmat.net/blog/follow-reddit-from-the-console/</guid>
		<description><![CDATA[Last week I published the Hacker Top program and promised to explain how it was made. Before I do that, let me publish another similar program for Reddit. It&#8217;s the Reddit Top program.
As I mentioned in the Hacker Top post, Reddit is my favorite source for news because of the great programmer community it has. [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/reddit-top-logo.gif' alt='reddit top' class='post-icon' align='left' />Last week I published the <a href="http://www.catonmat.net/blog/follow-hacker-news-from-the-console/">Hacker Top</a> program and promised to explain how it was made. Before I do that, let me publish another similar program for <a href="http://www.reddit.com">Reddit</a>. It&#8217;s the <strong>Reddit Top</strong> program.</p>
<p>As I mentioned in the <a href="http://www.catonmat.net/blog/follow-hacker-news-from-the-console/">Hacker Top post</a>, Reddit is my favorite source for news because of the great programmer community it has. I actually unsubscribed from all the default subreddits (politics, pics, etc.) and subscribed to some 20 - 30 programming subreddits (like python, erlang, compsci and many others).</p>
<p>Reddit Top was actually derived from Hacker Top. Hacker Top was made in such a manner that it required me just to write a new parser for Reddit to create the new program. The program is written in Python programming language and uses ncurses interface for displaying the stories.</p>
<div class="center-aligner">
<a href='http://www.catonmat.net/blog/wp-content/uploads/2008/07/reddit-top-big.gif' title='reddit top, follow reddit from console/shell'><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/reddit-top-small.gif' alt='reddit top, follow reddit from console/shell' /></a><br />
<small>Try the &#8216;<strong>m</strong>&#8216; keyboard shortcut to switch to other display modes</small>
</div>
<h2>Download</h2>
<div style="margin-top: 10px"></div>
<p>Download link: <a href="http://www.catonmat.net/download/reddit-top.tgz" title="Version 1.0 downloaded 595 times" rel="enclosure">reddit top program</a><br />
Downloaded: 595 times</p>
<p><script>reddit_url="http://www.catonmat.net/blog/follow-reddit-from-the-console/"</script><br />
<script>reddit_title="Follow Reddit from the Console"</script><br />
<script type="text/javascript" src="http://www.reddit.com/button.js?t=1"></script></p>
<p>I&#8217;ll describe the process of creating the program in one of the next posts.<br />
If you want to read about that, I suggest you <a href="http://feeds.feedburner.com/catonmat">subscribe to my rss feed</a>.</p>
<p>Note - this program is released under GNU GPL.</p>
<h2>How to run the program?</h2>
<div style="margin-top: 10px"></div>
<p>1) Make sure you are running a Unix type operating system.</p>
<p>2) Make sure you have Python installed. Any recent version will do.</p>
<p>3) Download and unpack the hacker top program archive.</p>
<pre>
$ wget 'http://www.catonmat.net/download/reddit-top.tgz'
$ tar -xvzf reddit-top.tgz
</pre>
<p>4) Change to &#39;reddit-top&#39; directory which was created by unpacking the archive.</p>
<pre>
$ cd reddit-top
</pre>
<p>5) Give the &#8216;reddit_top.py&#8217; program execute permissions.</p>
<pre>
$ chmod u+x reddit_top.py
</pre>
<p>6) Run the reddit_top.py program.</p>
<pre>
$ ./reddit_top.py
</pre>
<p>(If that does not work out, try running &#39;python ./reddit_top.py&#39;)</p>
<p>Make sure that your terminal is at least 80 columns wide, otherwise the program won&#8217;t be able to display the results nicely.</p>
<h2>Command Line Options</h2>
<div style="margin-top: 10px"></div>
<p>If you run the program with &#39;&#45;&#45;help&#39; argument, it will display the possible command line options:</p>
<pre>
Usage: ./reddit_top.py [-h|--help] - displays this
Usage: ./reddit_top.py [-s|--subreddit subreddit]
          [-i|--interval interval] [-n|--new]
          [-u|--utf8 <on|off>]
</pre>
<p>As the help message suggests, the four main options are:</p>
<ul>
<li>
<strong>-s</strong> or <strong>&#8211;subreddit</strong>, which specifies the subreddit to monitor.<br />
The default is reddit&#8217;s front page (<a href="http://www.reddit.com">http://www.reddit.com</a>).<br />
At the moment it is not possible to specify multiple subreddits. I&#8217;ll add the feature in the future. Here are a few examples of valid subreddits - &#8216;programming&#8217;, &#8216;wtf&#8217;, &#8216;python&#8217;, &#8216;politics&#8217;, and others.
	</li>
<li>
<strong>-i</strong> or <strong>&#8211;interval</strong>, which specifies refresh interval.<br />
The default refresh interval is 1 minutes. Here are a few examples:  10s (10 seconds), 12m (12 minutes), 2h (2 hours).
	</li>
<li>
<strong>-u</strong> or <strong>&#8211;utf8</strong>, turns on utf8 output mode.<br />
Default: off. Use this if you know for sure that your terminal supports it, otherwise you might get gibberish.
	</li>
<li>
<strong>-n</strong> or <strong>&#8211;new</strong>, which follows only the newest reddit stories on a given subreddit or front page.<br />
Default: follow front page stories.
	</li>
</ul>
<h2>Keyboard Shortcuts</h2>
<div style="margin-top: 10px"></div>
<p>There are several keyboard shortcuts which you should know about when using the Reddit Top program:</p>
<ul>
<li><strong>q</strong> - quits the program.</li>
<li><strong>u</strong> - forces an update of the news.</li>
<li><strong>up arrow</strong>/<strong>down arrow</strong> (or alternatively <strong>j</strong>/<strong>k</strong> keys) - scrolls the news list up or down.</li>
<li><strong>m</strong> - changes the display mode. There are 5 different display modes for your taste.</li>
</ul>
<p>Enjoy the program! I&#8217;ll write some details how I created it in one of the next posts. Stay tuned - subscribe to my <a href="http://feeds.feedburner.com/catonmat">rss feed</a>! <img src='http://www.catonmat.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="download">
<div class="download-title">Download Reddit Top Program</div>
<p>Download link: <a href="http://www.catonmat.net/download/reddit-top.tgz" title="Version 1.0 downloaded 595 times" rel="enclosure">reddit top program</a></p>
<p>Downloaded: 595 times</p>
<p>The program is released under GNU General Public License.</p>
<div class="center-aligner">
<strong>Do you want to have a broader discussion on this topic?</strong><br />
Discuss it on <a href="http://wearetech.us/cool-ideas/35596-reddit-top.html">catonmat forums</a>!
</div>
</div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/catonmat?a=bEaYTJ"><img src="http://feeds.feedburner.com/~f/catonmat?i=bEaYTJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=Z6Wswj"><img src="http://feeds.feedburner.com/~f/catonmat?i=Z6Wswj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=NTBhQj"><img src="http://feeds.feedburner.com/~f/catonmat?i=NTBhQj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=j7apKj"><img src="http://feeds.feedburner.com/~f/catonmat?i=j7apKj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/catonmat/~4/335446062" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.catonmat.net/blog/follow-reddit-from-the-console/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.catonmat.net/blog/follow-reddit-from-the-console/</feedburner:origLink></item>
		<item>
		<title>Musical Geek Friday #10: TECO and DDT</title>
		<link>http://feeds.feedburner.com/~r/catonmat/~3/333121061/</link>
		<comments>http://www.catonmat.net/blog/musical-geek-friday-teco-and-ddt/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 17:05:04 +0000</pubDate>
		<dc:creator>Peteris Krumins</dc:creator>
		
		<category><![CDATA[Musical Geek Friday]]></category>
<category>ddt</category><category>debugger</category><category>dec</category><category>emacs</category><category>geek</category><category>hack</category><category>mit</category><category>mp3</category><category>music</category><category>pdp</category><category>song</category><category>teco</category><category>text editor</category>
		<guid isPermaLink="false">http://www.catonmat.net/blog/musical-geek-friday-teco-and-ddt/</guid>
		<description><![CDATA[Remember the song from Musical Geek Friday #7 - Just One More Hack? I said that it was the only song ever about a debugger. I must admit that I was wrong! This week I bring to you another song about a debugger - the DDT debugger (and the ancient TECO text editor).
TECO stands for [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/pdp-11-teco-tdd-users-guide.jpg' alt='teco user’s guide'  class='post-icon' align='left' />Remember the song from Musical Geek Friday #7 - <a href="http://www.catonmat.net/blog/musical-geek-friday-just-one-more-hack/">Just One More Hack</a>? I said that it was the only song ever about a debugger. I must admit that I was wrong! This week I bring to you another song about a debugger - <strong>the DDT debugger</strong> (and the ancient <strong>TECO</strong> text editor).</p>
<p>TECO stands for Text Editor and COrrector. It was developed at Massachusetts Institute of Technology (MIT) and was one of the first text editors ever written. It grew over the years, gaining popularity and features. Along the way, it also became a <a href="http://en.wikipedia.org/wiki/Turing_completeness">Turing-complete</a> programming language. Several sets of editor macros were developed and used. I was surprised to find that around 1975 Richard Stallman organized these <strong>E</strong>ditor <strong>MAC</strong>ro<strong>S</strong> into the first Emacs-like text editor. <a href="http://scienceblogs.com/goodmath/2006/09/worlds_greatest_pathological_l_1.php">Here</a> is an article about the history of TECO.</p>
<p>DDT, on the other hand, was a collection of several debugger programs. These debugging programs included a command shell from which TECO was also used interchangeably with DDT. DDT stands for Dynamic Debugging Technique (initially known as DEC Debugging Tape).</p>
<p>Talking about the 10th geek song, it&#8217;s written and performed by a band called &#8220;<a href="http://redmartian.com/">red martian</a>&#8220;. </p>
<p>Enough of facts, here is the <strong>TECO and DDT song</strong>:</p>
<p></p>
<p>Download this song: <a href="http://www.catonmat.net/download/red_martian-teco_and_ddt.mp3" title="Version 1.0 downloaded 284 times" rel="enclosure">teco and ddt (musical geek friday #10)</a><br />
Downloaded: 284 times</p>
<p>Download lyrics: <a href="http://www.catonmat.net/download/red_martian-teco_and_ddt-lyrics.txt" title="Version 1.0 downloaded 51 times" rel="enclosure">teco and ddt lyrics (musical geek friday #10)</a><br />
Downloaded: 51 times</p>
<p>TECO and DDT Lyrics:</p>
<blockquote><p>
Oh, you can hack anything that you want with just TECO and DDT.<br />
You can hack anything that you want with just TECO and DDT!</p>
<p>Oh, no, you don&#8217;t have to tell me what would I need because it&#8217;s simply plain to see&#8230;<br />
That I can hack anything that I want with just TECO and DDT!</p>
<p>Yeaha!</p>
<p>Oh, you can hack anything that you want with just TECO and DDT.<br />
Oh, you can hack anything that you want with just TECO and DDT!</p>
<p>Oh, no, you don&#8217;t have to tell me what would I need because it&#8217;s simply plain to see&#8230;<br />
That I can hack anything that I want with just TECO, just TECO, just TECO and DDT!
</p></blockquote>
<p>I&#8217;d like to thank <a href="http://adnam.motd.org/">Adam</a> for letting me know about this song.</p>
<div class="download">
<div class="download-title">Download &#8220;TECO and DDT&#8221; Song</div>
<p>Download this song: <a href="http://www.catonmat.net/download/red_martian-teco_and_ddt.mp3" title="Version 1.0 downloaded 284 times" rel="enclosure">teco and ddt (musical geek friday #10)</a><br />
Downloaded: 284 times</p>
<p>Download lyrics: <a href="http://www.catonmat.net/download/red_martian-teco_and_ddt-lyrics.txt" title="Version 1.0 downloaded 51 times" rel="enclosure">teco and ddt lyrics (musical geek friday #10)</a><br />
Downloaded: 51 times</p>
<p>Click to listen:<br />
</p>
<p>Have fun and until next geeky Friday! <img src='http://www.catonmat.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</div>
<div class="ads-aad">
<script type="text/javascript"><!--
google_ad_client = "pub-0433925538517663";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
//2007-07-12: catonmat after download
google_ad_channel = "9549065335";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "753206";
google_color_text = "4C4C4C";
google_color_url = "E6E6E6";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/catonmat?a=33uUhJ"><img src="http://feeds.feedburner.com/~f/catonmat?i=33uUhJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=IHVXEj"><img src="http://feeds.feedburner.com/~f/catonmat?i=IHVXEj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=BuRlWj"><img src="http://feeds.feedburner.com/~f/catonmat?i=BuRlWj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=Cn8ZCj"><img src="http://feeds.feedburner.com/~f/catonmat?i=Cn8ZCj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/catonmat/~4/333121061" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.catonmat.net/blog/musical-geek-friday-teco-and-ddt/feed/</wfw:commentRss>
<enclosure url="http://www.catonmat.net/download/red_martian-teco_and_ddt.mp3" length="1392640" type="audio/mpeg" />
		<feedburner:origLink>http://www.catonmat.net/blog/musical-geek-friday-teco-and-ddt/</feedburner:origLink></item>
		<item>
		<title>Three Beautiful Quicksorts</title>
		<link>http://feeds.feedburner.com/~r/catonmat/~3/332148669/</link>
		<comments>http://www.catonmat.net/blog/three-beautiful-quicksorts/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 16:00:36 +0000</pubDate>
		<dc:creator>Peteris Krumins</dc:creator>
		
		<category><![CDATA[Video Lectures]]></category>
<category>algorithm</category><category>code</category><category>douglas mcilroy</category><category>jon bentley</category><category>lecture</category><category>partition</category><category>programming</category><category>qsort</category><category>quicksort</category><category>video</category>
		<guid isPermaLink="false">http://www.catonmat.net/blog/three-beautiful-quicksorts/</guid>
		<description><![CDATA[Have you heard about a book called Beautiful Code? This book is composed of 33 essays by well-known computer scientists and software engineers on the same question - &#8220;What is the most beautiful piece of code you know?&#8221;.
Chapter 3 of this book is written by Jon Bentley. The chapter is curiously entitled &#8220;The Most Beautiful [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/beautiful-quicksort-algorithm.jpg' alt='Three Beautiful Quicksorts' class='post-icon' align='left' />Have you heard about a book called <a href="http://www.amazon.com/Beautiful-Code-Leading-Programmers-Practice/dp/0596510047/freesciencand-20">Beautiful Code</a><img src="http://www.assoc-amazon.com/e/ir?t=freesciencand-20&#038;l=ur2&#038;o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />? This book is composed of 33 essays by well-known computer scientists and software engineers on the same question - &#8220;What is the most beautiful piece of code you know?&#8221;.</p>
<p>Chapter 3 of this book is written by <a href="http://www.research.avayalabs.com/gcm/usa/en-us/people/all/bentley.htm">Jon Bentley</a>. The chapter is curiously entitled &#8220;The Most Beautiful Code I Never Wrote&#8221; and it talks about a beautiful implementation and experimental analysis of the most widely used sorting algorithm in the world called <strong>Quicksort</strong>.</p>
<p>Jon also decided to give a talk at Google on the same topic. In this techtalk, he talks about three Quicksort topics. In the first part Jon discusses an elegant and tiny implementation of Quicksort. In the next part he analyzes the Quick sort algorithm by instrumenting this elegant implementation. Finally, he talks about a production quality Quicksort implementation which has been included in C standard library (qsort function).</p>
<p>What I learned the most from this lecture is the experimental part of counting number of comparsions of an algorithm. I had never read about experimental analysis of algorithms.</p>
<div class="center-aligner">
<embed id="VideoPlayback" style="width:400px;height:326px" allowFullScreen="true" flashvars="fs=true" src="http://video.google.com/googleplayer.swf?docid=-1031789501179533828&#038;hl=en" type="application/x-shockwave-flash"> </embed><br />
Direct link: <a href="http://video.google.com/videoplay?docid=-1031789501179533828">http://video.google.com/videoplay?docid=-1031789501179533828</a>
</div>
<p>Interesting ideas from the lecture:</p>
<ul>
<li>[02:30] What&#8217;s the most beautiful code you&#8217;ve ever written?</li>
<li>[04:58] The classical Quicksort algorithm.</li>
<li>[05:32] Best case (nlog(n)), worst (n<sup>2</sup>) and average case (nlog(n)) analysis results of Quicksort.</li>
<li>[08:00] Randomization in Quicksort.</li>
<li>[09:08] Lomuto&#8217;s idea of partitioning.</li>
<li>[10:48] Partitioning algorithm implementation pseudocode.</li>
<li>[11:10] Beautiful Quicksort code.</li>
<li>[12:13] Strengths of Quicksort: simple to implement and explain, pretty fast. Weaknesses of Quicksort: quadratic time for increasing elements (fix by randomization), quadratic time for equal elements, not stable.</li>
<li>[13:55] &#8220;vigorous writing is concise&#8221; /William Strunk Jr.&#8217;s/</li>
<li>[14:49] Simplest semi-production C Quicksort implementation.</li>
<li>[15:35] How much time will Quicksort take on average on indistinct elements?</li>
<li>[17:00] Graph of (runtime/N, logN) for Quicksort and Heapsort.</li>
<li>[18:31-32:00] Finding number of comparisons for Quicksort experimentally.</li>
<li>[23:08] Doing various tricks the time to count comparisons reduced from nlog(n) to n and space reduced from n to log(n).</li>
<li>[24:25] The Inventor&#8217;s Paradox: &#8220;The more ambitious plan may have more chance of success.&#8221;</li>
<li>[30:13] Perlis: &#8220;Simplicity does not precede complexity, but follows it.&#8221;</li>
<li>[30:45] Mathematical solution to Quicksort&#8217;s comparison complexity.</li>
<li>[31:35] The solution is ~ 1.386nlog(n)</li>
<li>[32:10] Analysis of comparisons in Quicksort is isomorphic to time taken to insert an element in a Binary Search Tree.</li>
<li>[36:25] A beautiful bug report on the original implementation of C library&#8217;s qsort</li>
<li>[39:31] Engineering qsort together with <a href="http://www.cs.dartmouth.edu/~doug/">Doug McIlroy</a>. Goals and strategy.</li>
<li>[41:23] With equal elements, some Quicksorts go quadratic, some go nlog(n), some go linear.</li>
<li>[41:46] Is there a quick algorithm for ternary (<, = , >) partitioning?</li>
<li>[46:00] <a href="http://www-cs-faculty.stanford.edu/~knuth/">Knuth</a> said that the overheard and comparisons took the same amount of time but the swaps really killed you, where as Jon and Doug found that time(overhead) < time(swaps) < time(comparisons), if swaps are done properly.</li>
<li>[46:30] Choosing effective partitioning element was important. First, middle or random gave runtime aproximately 1.386nlog(n), where as median of three or median and three medians gave run times of 1.188nlog(n) and 1.09nlog(n), respectivey.</li>
<li>[46:50] The final qsort had ternary partitioning, fast swap, adaptive sample for partition element, insertion sort for small files.</li>
<li>[47:40] The complete code of C library&#8217;s qsort.</li>
<li>[48:15] Beauties of qsort (beautiful algorithm, beautiful interface, beautiful bug report, beautiful cost models, beautiful tests)</li>
<li>[50:40] Three beautiful Quicksorts - 1) a simple teaching tool, 2) an anaysis of Quicksort, 3) An industrial-strength Quicksort.</li>
<li>[51:35] Q and A.</li>
</ul>
<p>Here is a working C program which runs Quicksort algorithm (in bold) from the Chapter 3 of the book. The algorithm sorts the global array of integers <strong>x</strong>.</p>
<pre class='lotsocode'>
<code>
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;time.h&gt;

#define S(a) (sizeof(a)/sizeof(a[0]))

int x[] = { 56, 10, 39, 15, 20, 62, 14, 39, 77, 17 };

void swap(int i, int j) {
    int t = x[i];
    x[i] = x[j];
    x[j] = t;
}

int randint(int l, int u) {
    return rand()%(u-l+1)+l;
}

<strong>void quicksort(int l, int u) {
    int i, m;
    if (l &gt;= u) return;
    swap(l, randint(l, u));
    m = l;
    for (i = l+1; i &lt;= u; i++)
        if (x[i] &lt; x[l])
            swap(++m, i);
    swap(l, m);
    quicksort(l, m-1);
    quicksort(m+1, u);
}</strong>

int main() {
    int i;
    srand(time(NULL));
    quicksort(0, S(x)-1);
    for (i = 0; i &lt; S(x); i++) {
        printf(&#34;%d &#34;, x[i]);
    }
    printf(&#34;\n&#34;);
    return 0;
}
</code>
</pre>
<p>In a functional programming language, Quicksort can be written even more elegantly. Check out this Quicksort written in Haskell (thanks to <a href="http://news.ycombinator.com/item?id=243177">bayareaguy</a>.</p>
<pre>
<code>
  quicksort (x:xs) =
      quicksort [ i | i <- xs, i < x ]
      ++ [x] ++
      quicksort [ i | i <- xs, i >= x ]

  quicksort [] = []
</code>
</pre>
<p><strong>And what&#8217;s the most beautiful code you&#8217;ve ever written?</strong></p>
<p>Ps. If you got interested, I suggest you get the Beautiful Code book. Jon Bentley carefully explains the ticks used for doing the experimental part of analysis in his chapter.</p>
<div class="center-aligner">
<iframe src="http://rcm.amazon.com/e/cm?t=freesciencand-20&#038;o=1&#038;p=8&#038;l=as1&#038;asins=0596510047&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
</div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/catonmat?a=yGCx8J"><img src="http://feeds.feedburner.com/~f/catonmat?i=yGCx8J" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=9OEgVj"><img src="http://feeds.feedburner.com/~f/catonmat?i=9OEgVj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=2PCMyj"><img src="http://feeds.feedburner.com/~f/catonmat?i=2PCMyj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=jTUeTj"><img src="http://feeds.feedburner.com/~f/catonmat?i=jTUeTj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/catonmat/~4/332148669" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.catonmat.net/blog/three-beautiful-quicksorts/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.catonmat.net/blog/three-beautiful-quicksorts/</feedburner:origLink></item>
		<item>
		<title>Follow Hacker News from the Console</title>
		<link>http://feeds.feedburner.com/~r/catonmat/~3/329412591/</link>
		<comments>http://www.catonmat.net/blog/follow-hacker-news-from-the-console/#comments</comments>
		<pubDate>Mon, 07 Jul 2008 19:25:37 +0000</pubDate>
		<dc:creator>Peteris Krumins</dc:creator>
		
		<category><![CDATA[Programming]]></category>
<category>beautifulsoup</category><category>console</category><category>curses</category><category>hacker news</category><category>hacker top</category><category>ncurses</category><category>paul graham</category><category>programming</category><category>python</category><category>ycombinator</category>
		<guid isPermaLink="false">http://www.catonmat.net/blog/follow-hacker-news-from-the-console/</guid>
		<description><![CDATA[Here is something neat that I hacked together - a `top&#8217; like Python program (called Hacker Top) to follow the Hacker News from the console!
Hacker News has become the 2nd source for news after programming.reddit for me. I have a couple of ideas for a startup myself and the tips I get from Hacker News [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/06/hacker-news-y-combinator-ycombinator.gif' alt='hacker news, ycombinator logo' align="left" class="post-icon" />Here is something neat that I hacked together - a `top&#8217; like Python program (called <strong>Hacker Top</strong>) to follow the <a href="http://news.ycombinator.com/">Hacker News</a> from the console!</p>
<p>Hacker News has become the 2nd source for news after <a href="http://www.reddit.com/r/programming">programming.reddit</a> for me. I have a couple of ideas for a startup myself and the tips I get from Hacker News are priceless.</p>
<p>If you have never heard of Hacker News, I suggest you visit the site (<a href="http://news.ycombinator.com/">http://news.ycombinator.com/</a>). It&#8217;s a Digg/Reddit like social news site for startup founders and hackers created by <a href="http://www.paulgraham.com/articles.html">Paul Graham</a>. </p>
<p>This program works ideally for me. I spend lots of hours hacking away at my shell and all I have to do is switch the terminals to the one running the Hacker Top program to get the latest stories!</p>
<p>Here is a screenshot of the program running:</p>
<div class="center-aligner">
<a href='http://www.catonmat.net/blog/wp-content/uploads/2008/07/hacker-top-detailed-mode-full.gif' title='hacker top, detailed mode'><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/hacker-top-detailed-mode.gif' alt='hacker top, detailed mode' /></a><br />
<small>Try the &#39;<strong>m</strong>&#39; keyboard shortcut to change display modes</small>!
</div>
<h2>Download</h2>
<div style="margin-top: 10px"></div>
<p>Download link: <a href="http://www.catonmat.net/download/hacker-top.tgz" title="Version 1.0 downloaded 537 times" rel="enclosure">hacker top program</a><br />
Downloaded: 537 times</p>
<p>Note - this program is released under GNU GPL.</p>
<h2>How to run the program?</h2>
<div style="margin-top: 10px"></div>
<p>1) Make sure you are running a Unix type operating system.</p>
<p>2) Make sure you have Python installed. Any recent version will do.</p>
<p>3) Download and unpack the hacker top program archive.</p>
<pre>
$ wget 'http://www.catonmat.net/download/hacker-top.tgz'
$ tar -xvzf hacker-top.tgz
</pre>
<p>4) Change to &#39;hacker-top&#39; directory which was created by unpacking the archive.</p>
<pre>
$ cd hacker-top
</pre>
<p>5) Give the &#8216;hacker_top.py&#8217; program execute permissions.</p>
<pre>
$ chmod u+x hacker_top.py
</pre>
<p>6) Run the hacker_top.py program.</p>
<pre>
$ ./hacker_top.py
</pre>
<p>(If that does not work out, try running &#39;python ./hacker_top.py&#39;)</p>
<p>Also make sure your terminal is at least 80 columns wide, otherwise the program won&#8217;t be able to display the results nicely.</p>
<h2>Command Line Options</h2>
<div style="margin-top: 10px"></div>
<p>If you run the program with &#39;&#45;&#45;help&#39; argument, it will display the possible command line options:</p>
<pre>
Usage: ./hacker_top.py [-h|--help] - displays this
Usage: ./hacker_top.py [-i|--interval interval]
          [-u|--utf8 <on|off>] [-n|&#8211;new]
</pre>
<p>As the help message suggests, the three main options are:</p>
<ul>
<li>
<strong>-i</strong> or <strong>&#8211;interval</strong>, which specifies refresh interval.<br />
The default refresh interval is 3 minutes. Here are a few examples:  10s (10 seconds), 12m (12 minutes), 2h (2 hours).
	</li>
<li>
<strong>-u</strong> or <strong>&#8211;utf8</strong>, turns on utf8 output mode.<br />
Default: off. Use this if you know for sure that your terminal supports it, otherwise you might get gibberish.
	</li>
<li>
<strong>-n</strong> or <strong>&#8211;new</strong>, which follows only the <a href="http://news.ycombinator.com/newest">newest</a> hacker stories.<br />
Default: follow front page stories.
	</li>
</ul>
<h2>Keyboard Shortcuts</h2>
<div style="margin-top: 10px"></div>
<p>There are several keyboard shortcuts which you should know about when using the Hacker Top program:</p>
<ul>
<li><strong>q</strong> - quits the program.</li>
<li><strong>u</strong> - forces an update of the news.</li>
<li><strong>up arrow</strong>/<strong>down arrow</strong> (or alternatively <strong>j</strong>/<strong>k</strong> keys) - scrolls the news list up or down.</li>
<li><strong>m</strong> - changes the display mode. There are 5 different display modes for your taste.</li>
</ul>
<p>Enjoy the program! I&#8217;ll write some details how I created it in one of the next posts. Stay tuned - subscribe to my <a href="http://feeds.feedburner.com/catonmat">rss feed</a>! <img src='http://www.catonmat.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="download">
<div class="download-title">Download Hacker Top Program</div>
<p>Download link: <a href="http://www.catonmat.net/download/hacker-top.tgz" title="Version 1.0 downloaded 537 times" rel="enclosure">hacker top program</a></p>
<p>Downloaded: 537 times</p>
<p>The program is released under GNU General Public License.</p>
<div class="center-aligner">
<strong>Do you want to have a broader discussion on this topic?</strong><br />
Discuss it on <a href="http://wearetech.us/cool-ideas/34439-hacker-top.html">catonmat forums</a>!
</div>
</div>
<div style="margin-top: 10px"></div>
<p>ps. Be sure to read Hacker News <a href="http://ycombinator.com/newsguidelines.html">Guidelines</a> and <a href="http://ycombinator.com/newsfaq.html">FAQ</a> if you decide to join the hacker community and star submitting interesting hacker news.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/catonmat?a=s7IOTJ"><img src="http://feeds.feedburner.com/~f/catonmat?i=s7IOTJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=Za6tpj"><img src="http://feeds.feedburner.com/~f/catonmat?i=Za6tpj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=lLVzHj"><img src="http://feeds.feedburner.com/~f/catonmat?i=lLVzHj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=WzfzDj"><img src="http://feeds.feedburner.com/~f/catonmat?i=WzfzDj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/catonmat/~4/329412591" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.catonmat.net/blog/follow-hacker-news-from-the-console/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.catonmat.net/blog/follow-hacker-news-from-the-console/</feedburner:origLink></item>
		<item>
		<title>Graduated with a B.Sc. Degree in Physics</title>
		<link>http://feeds.feedburner.com/~r/catonmat/~3/325254000/</link>
		<comments>http://www.catonmat.net/blog/graduated-with-bsc-degree-in-physics/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 15:30:16 +0000</pubDate>
		<dc:creator>Peteris Krumins</dc:creator>
		
		<category><![CDATA[Misc]]></category>
<category>2008</category><category>bachelor degree</category><category>bsc</category><category>graduation</category><category>peteris krumins</category><category>physics</category>
		<guid isPermaLink="false">http://www.catonmat.net/blog/graduated-with-bsc-degree-in-physics/</guid>
		<description><![CDATA[I just graduated with a Bachelor of Science degree in Physics from the University of Latvia!
It took me 4 years to complete the studies. During these years I took more than 50 courses from physics, mathematics and computer science departments and my average grade was 9.1/10 (students in Latvia are graded from 1 up to [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/graduate-hat-post-icon.jpg' alt='graduate hat' class='post-icon' align='left' />I just graduated with a Bachelor of Science degree in Physics from the <a href="http://www.lu.lv/">University of Latvia</a>!</p>
<p>It took me 4 years to complete the studies. During these years I took more than 50 courses from physics, mathematics and computer science departments and my average grade was 9.1/10 (students in Latvia are graded from 1 up to 10, 10 being excellent, 9 being very good, &#8230;, 4 being the lowest grade for passing a course. Anything below 4 means failure).</p>
<p>As I already mentioned in the <a href="http://www.catonmat.net/about/">about me</a> page, I chose to study physics because I already had a broad understanding of various topics of computer science. Now I can proudly say that I understand a lot of physics as well.</p>
<p>Here is a picture of me with a diploma in my hands. <img src='http://www.catonmat.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="center-aligner">
<img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/peteris-krumins-latvijas-universitate-lu.jpg' alt='peteris krumins with a diploma at university of latvia' />
</div>
<p>Here is another picture with all of us who graduated from University of Latvia with a B.Sc. degree in Physics in 2008. I&#8217;m right in the middle of the front row!</p>
<div class="center-aligner">
<img src='http://www.catonmat.net/blog/wp-content/uploads/2008/07/university-of-latvia-physics-graduates-2008.jpg' alt='university of latvia physics graduates 2008' />
</div>
<p>Talking about my future plans, I decided not to go to a graduate school just yet. I&#8217;ll spend the next year or two hacking on whatever interests me the most and learn exactly what I have wanted (more mathematics and more computer science). It also means that I will be able to post more frequently here. <img src='http://www.catonmat.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Thanks for reading my blog!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/catonmat?a=fbuWrJ"><img src="http://feeds.feedburner.com/~f/catonmat?i=fbuWrJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=qHoWIj"><img src="http://feeds.feedburner.com/~f/catonmat?i=qHoWIj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=ee0exj"><img src="http://feeds.feedburner.com/~f/catonmat?i=ee0exj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=GC5Qtj"><img src="http://feeds.feedburner.com/~f/catonmat?i=GC5Qtj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/catonmat/~4/325254000" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.catonmat.net/blog/graduated-with-bsc-degree-in-physics/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.catonmat.net/blog/graduated-with-bsc-degree-in-physics/</feedburner:origLink></item>
		<item>
		<title>Musical Geek Friday #9: The Free Software Song</title>
		<link>http://feeds.feedburner.com/~r/catonmat/~3/321389887/</link>
		<comments>http://www.catonmat.net/blog/musical-geek-friday-free-software-song/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 08:10:42 +0000</pubDate>
		<dc:creator>Peteris Krumins</dc:creator>
		
		<category><![CDATA[Musical Geek Friday]]></category>
<category>free</category><category>geek</category><category>gnu</category><category>mp3</category><category>music</category><category>richard stallman</category><category>sadi moma</category><category>software</category><category>song</category><category>stallmans</category>
		<guid isPermaLink="false">http://www.catonmat.net/blog/musical-geek-friday-9-the-free-software-song/</guid>
		<description><![CDATA[This week on Musical Geek Friday - The Free Software Song!
The song is written and performed by the founder of Free Software Foundation and the most active free software advocate Richard Stallman (scroll down for a video of Mr. Stallman performing it himself).
Richard wrote this song at a filksinging session at a science fiction convention. [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/06/gnu-fsf-free-software-song.jpg' alt='richard stallman - gnu free software foundation - the free software song' class='post-icon' align='left' />This week on Musical Geek Friday - <strong>The Free Software Song</strong>!</p>
<p>The song is written and performed by the founder of Free Software Foundation and the most active free software advocate <a href="http://en.wikipedia.org/wiki/Richard_Stallman">Richard Stallman</a> (scroll down for a video of Mr. Stallman performing it himself).</p>
<p>Richard wrote this song at a filksinging session at a science fiction convention. He realized he had never written a filksong relating to free software, so he figured it was time he did. He remembered that he had never written a filksong using Bulgarian dance music, so he figured that would be a good thing to do for once. He chose <a href="http://www.youtube.com/watch?v=O95_p135zj8">Sadi Moma</a> because it is not too fast or complicated, and is easy to sing.</p>
<p>Here it is - <strong>The Free Software Song</strong>!</p>
<p></p>
<p>Download this song: <a href="http://www.catonmat.net/download/richard_stallman-free_software_song.mp3" title="Version 1.0 downloaded 331 times" rel="enclosure">the free software song (musical geek friday #9)</a><br />
Downloaded: 331 times</p>
<p>Download lyrics: <a href="http://www.catonmat.net/download/richard_stallman-free_software_song-lyrics.txt" title="Version 1.0 downloaded 82 times" rel="enclosure">the free software song lyrics (musical geek friday #9)</a><br />
Downloaded: 82 times</p>
<p>Here is the lyrics of The Free Software Song:</p>
<blockquote><p>
Join us now and share the software;<br />
You&#8217;ll be free, hackers, you&#8217;ll be free.<br />
Join us now and share the software;<br />
You&#8217;ll be free, hackers, you&#8217;ll be free.</p>
<p>Hoarders may get piles of money,<br />
That is true, hackers, that is true.<br />
But they cannot help their neighbors;<br />
That&#8217;s not good, hackers, that&#8217;s not good.</p>
<p>When we have enough free software<br />
At our call, hackers, at our call,<br />
We&#8217;ll throw out those dirty licenses<br />
Ever more, hackers, ever more.</p>
<p>Join us now and share the software;<br />
You&#8217;ll be free, hackers, you&#8217;ll be free.<br />
Join us now and share the software;<br />
You&#8217;ll be free, hackers, you&#8217;ll be free.
</p></blockquote>
<p>Here is Richard Stallman himself performing The Free Software Song:</p>
<div class="center-aligner">
<object width="425" height="350">
<param name="movie" value="http://www.youtube.com/v/iW87vxM11tw"> </param> <embed src="http://www.youtube.com/v/iW87vxM11tw" type="application/x-shockwave-flash" width="425" height="350"> </embed> </object><br />
Original link: <a href="http://www.youtube.com/watch?v=iW87vxM11tw">http://www.youtube.com/watch?v=iW87vxM11tw</a>
</div>
<p>The audio quality of this video is poor. Here is a much better version by a band with a hilarious title &#8220;The GNU/Stallmans&#8221;:</p>
<div class="center-aligner">
<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/v/xSkCny-HtTw&#038;hl=en"></param><embed src="http://www.youtube.com/v/xSkCny-HtTw&#038;hl=en" type="application/x-shockwave-flash" width="425" height="344"></embed></object><br />
Original link: <a href="http://www.youtube.com/watch?v=xSkCny-HtTw">http://www.youtube.com/watch?v=xSkCny-HtTw</a>
</div>
<div class="download">
<div class="download-title">Download &#8220;The Free Software Song&#8221;</div>
<p>Download this song: <a href="http://www.catonmat.net/download/richard_stallman-free_software_song.mp3" title="Version 1.0 downloaded 331 times" rel="enclosure">the free software song (musical geek friday #9)</a><br />
Downloaded: 331 times</p>
<p>Download lyrics: <a href="http://www.catonmat.net/download/richard_stallman-free_software_song-lyrics.txt" title="Version 1.0 downloaded 82 times" rel="enclosure">the free software song lyrics (musical geek friday #9)</a><br />
Downloaded: 82 times</p>
<p>Click to listen:<br />
</p>
<p>Have fun and until next geeky Friday! <img src='http://www.catonmat.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</div>
<div class="ads-aad">
<!--adsense#aad-->
</div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/catonmat?a=KQ4BhI"><img src="http://feeds.feedburner.com/~f/catonmat?i=KQ4BhI" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=XM9JRi"><img src="http://feeds.feedburner.com/~f/catonmat?i=XM9JRi" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=gmMjRi"><img src="http://feeds.feedburner.com/~f/catonmat?i=gmMjRi" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=HlbsUi"><img src="http://feeds.feedburner.com/~f/catonmat?i=HlbsUi" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/catonmat/~4/321389887" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.catonmat.net/blog/musical-geek-friday-free-software-song/feed/</wfw:commentRss>
<enclosure url="http://www.catonmat.net/download/richard_stallman-free_software_song.mp3" length="802944" type="audio/mpeg" />
		<feedburner:origLink>http://www.catonmat.net/blog/musical-geek-friday-free-software-song/</feedburner:origLink></item>
		<item>
		<title>Hacking Videos from Shmoocon</title>
		<link>http://feeds.feedburner.com/~r/catonmat/~3/318746688/</link>
		<comments>http://www.catonmat.net/blog/shmoocon-hacking-videos/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 05:00:07 +0000</pubDate>
		<dc:creator>Peteris Krumins</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[Video Lectures]]></category>
<category>conference</category><category>hack</category><category>hacker</category><category>hacking</category><category>shmoocon</category><category>videos</category>
		<guid isPermaLink="false">http://www.catonmat.net/blog/shmoocon-hacking-videos/</guid>
		<description><![CDATA[Here are more hacker videos (previous post was on Defcon videos). This time they are from Shmoocon hacker conference. They put out videos from 2006, 2007 and they are putting out videos from 2008 pretty soon.
Shmoocon, as they describe themselves, is an annual East coast hacker convention hell-bent on offering three days of an interesting [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/05/shmoocon-hacker-conference-videos.gif' alt='shmoocon hacker hacking videos' class='post-icon' align='left' />Here are more hacker videos (previous post was on <a href="http://www.catonmat.net/blog/videos-from-defcon-15-hacker-conference/">Defcon videos</a>). This time they are from <a href="http://www.shmoocon.org/">Shmoocon</a> hacker conference. They put out videos from <a href="http://www.shmoocon.org/2006/">2006</a>, <a href="http://www.shmoocon.org/2007/">2007</a> and they are putting out videos from <a href="http://www.shmoocon.org/2008/">2008</a> pretty soon.</p>
<p>Shmoocon, as they describe themselves, is an annual East coast hacker convention hell-bent on offering three days of an interesting atmosphere for demonstrating technology exploitation, inventive software &#038; hardware solutions, and open discussions of critical infosec issues.</p>
<p>Here are the videos from Shmoocon 2006:</p>
<ul>
<li><a href="http://www.shmoocon.org/2006/videos/Stewart-Malware.mp4">Behavioral Malware Analysis Using Sandnets</a> by Joe Stewart</li>
<li><a href="http://www.shmoocon.org/2006/videos/Damin-Asterisk.mp4">Asterisk: VoIP for the Masses</a> by Damin [<a href="http://www.shmoocon.org/2006/presentations/ShmooCon%202006%20Asterisk%20Presentation.ppt">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2006/videos/Kaminsky-BlackOps.mp4">Black Ops Of TCP/IP 2005.5</a> by Dan Kaminsky</li>
<li><a href="http://www.shmoocon.org/2006/videos/Moniz-LANMAN.mp4">Breaking LanMan Forever</a> by Dan Moniz and  Patrick Stach</li>
<li><a href="http://www.shmoocon.org/2006/videos/Acidus-Covert.mp4">Covert Crawling: a wolf among lambs</a> by Acidus</li>
<li><a href="http://www.shmoocon.org/2006/videos/ChurchOfWiFi.mp4">The Church of Wi-Fi presents: An Evil Bastard, A Rainbow and a Great Dane!</a> by Renderman, Thorn, Dutch, and Joshua Wright [<a href="http://www.shmoocon.org/2006/presentations/SHMOOCON.odp">presentation</a> and <a href="http://wirelessdefence.org/Contents/coWPAttyMain.htm">coWPAtty tool</a>]</li>
<li><a href="http://www.shmoocon.org/2006/videos/Manzuk-Policy.mp4">Network Policy Enforcement / Network Quarantine - Latest Security Gimmick or Good Idea?</a> by Steve Manzuik</li>
<li><a href="http://www.shmoocon.org/2006/videos/Callas-Disclosure.mp4">Responding to Responsible (or Not) Disclosure</a> by Jon Callas and Special Guests</li>
<li><a href="http://www.shmoocon.org/2006/videos/Scott-ConCon.mp4">ConCon: A History of Hacker Conferences</a> by Jason Scott</li>
<li><a href="http://www.shmoocon.org/2006/videos/Fyodor-nmap.mp4">Advanced Network Reconnaissance with Nmap</a> by Fyodor</li>
<li><a href="http://www.shmoocon.org/2006/videos/Ike-Jail.mp4">FreeBSD jail(8), A Secure Virtual Machine</a> by Ike</li>
<li><a href="http://www.shmoocon.org/2006/videos/Wilbanks-Surveillance.mp4">Do it yourself: Building an Enterprise Class Surveillance System</a> by Joel Wilbanks [<a href="http://www.shmoocon.org/2006/presentations/Building%20an%20Enterprise%20Class%20Surveillance%20System%20ver%203.2.ppt">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2006/videos/Rash-SinglePacket.mp4">Advances in Single Packet Authorization</a> by Michael Rash [<a href="http://www.shmoocon.org/2006/presentations/shmoocon_fwknop.pdf">presentation</a>, and <a href="http://www.cipherdyne.org/fwknop/">fwknop tool</a>]</li>
<li><a href="http://www.shmoocon.org/2006/videos/Bejtlich-Squil.mp4">Network Security Monitoring with Sguil</a> by Richard Bejtlich and David Bianco [<a href="http://www.shmoocon.org/2006/presentations/bejtlich_bianco_nsm-sguil_shmoocon06_13jan06.ppt">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2006/videos/Smith-Layer2.mp4">Countering Attacks at Layer 2</a> by Eric Smith [<a href="http://www.shmoocon.org/2006/presentations/shmoocon_2k6_ejsmith_layer2.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2006/videos/Nomad-Sky.mp4">&#8220;Hacking the Friendly Skies&#8221;</a> by Simple Nomad [<a href="http://www.shmoocon.org/2006/presentations/shmoocon-2006-sn.ppt">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2006/videos/Abend-MagCards.mp4">A Young Gentleman&#8217;s Primer on the Reading and Emulation of Magnetic Cards</a> by Abend</li>
<li><a href="http://www.shmoocon.org/2006/videos/Anonym.os.mp4">Anonym.OS: Security and Privacy, Everywhere You Go</a> by dr.kaos, digunix, atlas and beth</li>
<li><a href="http://www.shmoocon.org/2006/videos/Sprickerhoff-WIDS.mp4">Bitchslapping Wireless IDS/IPS appliances</a> by Eldon Sprickerhoff [<a href="http://www.shmoocon.org/2006/presentations/bitchslapping.wids.ppt">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2006/videos/Fisher-Web.mp4">Web Application Vulnerabilities and Exploits</a> by Matt Fisher [<a href="http://www.shmoocon.org/2006/presentations/webapphack.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2006/videos/Butti-WiFi.mp4">Wi-Fi trickery, or how to secure, break and have fun with Wi-Fi</a> by Laurent Butti and Franck Veysset [<a href="http://www.shmoocon.org/2006/presentations/Shmoo2006-Butti-Veysset-WiFi-1.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2006/videos/Dunin-Kryptos.mp4">Kryptos and the Cyrillic Projector Ciphers</a> by Elonka Dunin</li>
<li><a href="http://www.shmoocon.org/2006/videos/AminiEagle-RE.mp4">Reverse Engineering for Fun and BoF It! - 2006</a> by Pedram Amini, Chris Eagle [<a href="http://www.shmoocon.org/2006/presentations/ShmooCon%202006%20Amini-Eagle.ppt">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2006/videos/James-Trojans.mp4">Trojans and Botnets and Malware, Oh My!</a> by Lance James [<a href="http://www.shmoocon.org/2006/presentations/shmoocon_LanceJames.ppt">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2006/videos/Cazz-snort.mp4">Snort BoF</a> by Cazz</li>
<li><a href="http://www.shmoocon.org/2006/videos/Marinescu-Heap.mp4">Windows Vista Heap</a> by Adrian Marinescu</li>
<li><a href="http://www.shmoocon.org/2006/videos/Noble-Outbound.mp4">Outbound Content Compliance</a> by Jim Noble [<a href="http://www.shmoocon.org/2006/presentations/shmoocon_Jim%20Noble.pps">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2006/videos/Ollam-Lockpicking.mp4">Lockpicking and Physical Security Fundamentals</a> by Deviant Ollam</li>
<li><a href="http://www.shmoocon.org/2006/videos/Long-HollywoodANDClosing.mp4">j0hnny&#8217;s Greatest Hits: The Best of Johnny Long</a> by Johnny Long</li>
<li><a href="http://www.shmoocon.org/2006/videos/Granick-Liberties.mp4">Securing Civil Liberties - Or Why Hackers Should Run the Government</a> by Jennifer Granick</li>
</ul>
<p>Here are the videos from Shmoocon 2007:</p>
<ul>
<li><a href="http://www.shmoocon.org/2007/videos/Hacking%20the%20Airwaves%20with%20FPGAs%20-%20h1kari.mp4">Hacking the Airwaves with FPGA&#8217;s</a> by H1kari</li>
<li><a href="http://www.shmoocon.org/2007/videos/Auditing%20Cached%20Credentials%20with%20Cachedump%20-%20Eoin%20Miller%20and%20Adair%20Collins.mp4">Auditing Cached Credentials with Cachedump</a> by Eoin Miller and Adair Collins</li>
<li><a href="http://www.shmoocon.org/2007/videos/Security%20Breaches%20are%20Good%20for%20You%20-%20Adam%20Shostack.mp4">Security Breaches are Good for You</a> by Adam Shostack</li>
<li><a href="http://www.shmoocon.org/2007/videos/No-Tech%20Hacking%20-%20Johnny%20Long.mp4">No-Tech Hacking</a> by Johnny Long</li>
<li><a href="http://www.shmoocon.org/2007/videos/Boomstick-Fu%20The%20Fundamentals%20of%20Physical%20Security%20at%20its%20Most%20Basic%20Level-%20Deviant%20Ollam,%20Noid%20and%20Thorn.mp4">Boomstick-Fu: The Fundamentals of Physical Security at its Most Basic Level</a> by Deviant Ollam, Noid and Thorn</li>
<li><a href="http://www.shmoocon.org/2007/videos/Hacker%20Potpourri%20-%20Simple%20Nomad.mp4">Hacker Potpourri</a> by Simple Nomad</li>
<li><a href="http://www.shmoocon.org/2007/videos/Extend%20Your%20Code%20Into%20the%20Real%20World%20-%20Ryan%20Clarke.mp4">Extend your Code into the Real World</a> by Ryan Clarke</li>
<li><a href="http://www.shmoocon.org/2007/videos/Weaponizing%20Noam%20Chomsky,%20or%20Hacking%20with%20Pattern%20Languages%20-%20Dan%20Kaminsky.mp4">Weaponizing Noam Chomsky, or Hacking with Pattern Languages</a> by Dan Kaminsky</li>
<li><a href="http://www.shmoocon.org/2007/videos/Bypassing%20NAC%20Systems%20(Part%20II)%20-%20Ofir%20Arkin.mp4">Bypassing NAC Systems</a> by Ofir Arkin [<a href="http://www.shmoocon.org/2007/presentations/OA_Bypassing_NAC_Shmoocon.ppt.zip">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2007/videos/Web%20Application%20Incident%20Preparation%20-%20Matt%20Fisher,%20Cygnus%20and%20PresMike.mp4">Web Application Incident Preparation</a> by Matt Fisher, Cygnus and PresMike</li>
<li><a href="http://www.shmoocon.org/2007/videos/JavaScript%20Malware%20for%20a%20Grey%20Goo%20Tomorrow%20-%20Billy%20Hoffman.mp4">JavaScript Malware for a Grey Goo Tomorrow</a> by Billy Hoffman</li>
<li><a href="http://www.shmoocon.org/2007/videos/Backbone%20Fuzzing%20-%20Raven.mp4">Backbone Fuzzing</a> by Raven</li>
<li><a href="http://www.shmoocon.org/2007/videos/Windows%20Mobile%20Software%20Raw%20and%20Exposed%20-%20Seth%20Fogie.mp4">Windows Mobile Software: Raw and Exposed</a> by Seth Fogie [<a href="http://www.shmoocon.org/2007/presentations/Seth_Fogie.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2007/videos/Hacking%20Digital%20Cameras%20-%20John%20Maushammer.mp4">Hacking Disposable Digital Cameras</a> by John Maushammer</li>
<li><a href="http://www.shmoocon.org/2007/videos/WPAD%20-%20Proxy%20Attack%20-%20Chris%20Paget.mp4">WPAD: Proxy Attack</a> by Chris Paget</li>
<li><a href="http://www.shmoocon.org/2007/videos/Vulnerability%20Disclosure%20Panel%20Palaver%20(or%200-day%20OK,%20No%20Way,%20or%20For%20Pay)%20-%20Katie%20Moussouris.mp4">Vulnerability Disclosure Panel Palaver (or 0-day: OK, No Way, or For Pay)</a> by Katie Moussouris</li>
<li><a href="http://www.shmoocon.org/2007/videos/A%20Hacker%20Looks%20at%2050%20-%20G.%20Mark%20Hardy.mp4">A Hacker Looks at 50</a> by G. Mark Hardy [<a href="http://www.shmoocon.org/2008/presentations/Shmoocon%202008%20Hardy.ppt">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2007/videos/The%20Church%20of%20WiFi%20presents%20A%20Hacker%20in%20Iraq%20-%20Michael%20Schearer.mp4">The Church of WiFi presents: A Hacker in Iraq</a> by Michael Schearer [<a href="http://www.shmoocon.org/2007/presentations/iraq-shmoo.zip">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2007/videos/Wireless%20(and%20Wired)%20Networks%20at%20Security%20Cons%20-%20Luiz%20Eduardo.mp4">Wireless (and Wired) Networks @ Security Cons</a> by Luiz Eduardo</li>
<li><a href="http://www.shmoocon.org/2007/videos/The%20Hacker%20Foundation%20-%20The%20Ethic%20in%20Action%20-%20Jesse%20Krembs%20and%20Nick%20Farr.mp4">The Hacker Foundation: The Ethic in Action</a> by Jesse Krembs and Nick Farr</li>
<li><a href="http://www.shmoocon.org/2007/videos/Dissecting%20ShmooCon%20Labs%20-%20The%20Shmoo%20Group.mp4">Dissecting ShmooCon Labs</a> by The Shmoo Group</li>
<li><a href="http://www.shmoocon.org/2007/videos/VOIP,%20Vonage,%20and%20Why%20I%20Hate%20Asterisk%20-%20Joel%20Bruno%20and%20Eric%20Smith.mp4">VOIP, Vonage, and Why I Hate Asterisk</a> by Joel Bruno and Eric Smith</li>
<li><a href="http://www.shmoocon.org/2007/videos/Attack%20Detection%20and%20Response%20with%20Linux%20Firewalls%20-%20Michael%20Rash.mp4">Attack Detection and Response with Linux Firewalls</a> by Michael Rash [<a href="http://www.shmoocon.org/2007/presentations/shmoocon2007_iptables_IDS_slides.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2007/videos/Assess%20the%20security%20of%20your%20online%20back%20without%20going%20to%20jail%20-%20Chuck%20Willis.mp4">Assess the Security of Your Online Bank (Without Going to Jail)</a> by Chuck Willis</li>
<li><a href="http://www.shmoocon.org/2007/videos/RFIDiots%20-%20Major%20Malfunction.mp4">RFIDiots</a> by Major Malfunction</li>
<li><a href="http://www.shmoocon.org/2007/videos/Encrypted%20Protocol%20Identification%20via%20Statistical%20Analysis%20-%20Rob%20King%20and%20Rohlt%20Dhamankar.mp4">Encrypted Protocol Identification via Statistical Analysis</a> by Rob King and Rohlt Dhamankar [<a href="http://www.shmoocon.org/2007/presentations/PISA.ppt">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2007/videos/Three%20Crypto%20Geeks%20on%20the%20Current%20State%20of%20Cryptography%20and%20the%20Internet%20-%20Rodney%20Thayer,%20Jon%20Callas%20and%20Ben%20Laurie.mp4">Three Crypto Geeks on the Current State of Cryptography and the Internet</a> by Rodney Thayer, Jon Callas and Ben Laurie</li>
<li><a href="http://www.shmoocon.org/2007/videos/Standard%20Bodies%20-%20What%20are%20these%20Guys%20Drinking%20-%20Al%20Potter,%20Renderman,%20and%20Russ%20Housley.mp4">Standard Bodies - What are these Guys Drinking?</a> by Al Potter, Renderman, and Russ Housley</li>
<li><a href="http://www.shmoocon.org/2007/videos/0wn%20the%20Con%20-%20The%20Shmoo%20Group.mp4">0wn the Con</a> by The Shmoo Group</li>
</ul>
<p>Here are the videos from Shmoocon 2008:</p>
<ul>
<li><a href="http://www.shmoocon.org/2008/videos/21st%20Century%20Shellcode%20for%20Solaris%20-%20Tim%20Vidas.mp4">21st Century Shellcode for Solaris</a> by Tim Vidas [<a href="http://www.shmoocon.org/2008/presentations/Vidas-Shellcode-Solaris-Shmoocon2008.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/Advanced%20Protocol%20Fuzzing%20-%20What%20We%20Learned%20when%20Bringing%20Layer2%20Logic%20to%20SPIKE%20Land%20-%20Enno%20Rey%20and%20Daniel%20Mende.mp4">Advanced Protocol Fuzzying - What We Learned When Bringing Layer2 Logic to SPIKE Land</a> by Enno Rey and Daniel Mende</li>
<li><a href="http://www.shmoocon.org/2008/videos/Baked%20not%20Fried%20Performing%20an%20Unauthorized%20Phishing%20Awareness%20Exercise%20-%20Syn%20Phishus.mp4">Baked not Fried Performing an Unauthorized Phishing Awareness Exercise</a> by Syn Phishus [<a href="http://www.shmoocon.org/2008/presentations/Baked%20not%20Fired.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/Forced%20Internet%20Condom%20-%20Aaron%20Higbee%20and%20Jaime%20Fuentes.mp4">Forced Internet Condom</a> by Aaron Higbee and Jaime Fuentes [<a href="http://www.shmoocon.org/2008/presentations/Forced%20Internet%20Condom%20-%20Shmoocon%202008.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/Forensic%20Image%20Analysis%20to%20Recover%20Passwords%20-%20David%20Smith.mp4">Forensic Image Analysis to Recover Passwords</a> by David Smith [<a href="http://www.shmoocon.org/2008/presentations/Forensic%20Image%20Analysis%20for%20Password%20Recovery.ppt">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/Got%20Citrix%20Hack%20It!%20-%20Shanit%20Gupta.mp4">Got Citrix Hack It!</a> by Shanit Gupta [<a href="http://www.shmoocon.org/2008/presentations/Got%20Citrix%20Hack%20IT.ppt">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/Hacking%20Windows%20Vista%20Security%20-%20Dan%20Griffin.mp4">Hacking Windows Vista Security</a> by Dan Griffin [<a href="http://www.shmoocon.org/2008/presentations/ShmooCon_Slides_Online.ppt">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/Hacking%20the%20Samurai%20Spirit%20-%20Isaac%20Mathis.mp4">Hacking the Samurai Spirit</a> by Isaac Mathis [<a href="http://www.shmoocon.org/2008/presentations/HackingSamuraiSpirit-short-final.odp">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/How%20do%20I%20Pwn%20Thee%20Let%20Me%20Count%20the%20Ways%20-%20RenderMan.mp4">How do I Pwn Thee Let Me Count the Ways</a> by RenderMan</li>
<li><a href="http://www.shmoocon.org/2008/videos/Intercepting%20Mobile%20PhoneGSM%20Traffic%20-%20H1kari.mp4">Intercepting Mobile PhoneGSM Traffic</a> by H1kari</li>
<li><a href="http://www.shmoocon.org/2008/videos/Keynote%20Address%20-%20Alex%20Halberman.mp4">Electronic Voting - Risks and Opportunities</a> by Alex Halberman</li>
<li><a href="http://www.shmoocon.org/2008/videos/Legal%20Issues%20for%20Bot-net%20Researchers%20and%20Mitigators%20-%20Alexander%20Muentz.mp4">Legal Issues for Bot-net Researchers and Mitigators</a> by Alexander Muentz [<a href="http://www.shmoocon.org/2008/presentations/Bot_net.zip">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/Malware%20Software%20Armoring%20Circumvention%20-%20Danny%20Quist.mp4">Malware Software Armoring Circumvention</a> by Danny Quist [<a href="http://www.shmoocon.org/2008/presentations/shmoo-2008-saffron.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/PEAP%20Pwned%20Extensible%20Authentication%20Protocol%20-%20Josh%20Wright%20and%20Brad%20Antoniewicz.mp4">PEAP Pwned Extensible Authentication Protocol</a> by Josh Wright and Brad Antoniewicz [<a href="http://www.shmoocon.org/2008/presentations/PEAP_Antoniewicz.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/Path%20X%20Explosive%20Security%20Testing%20Tools%20using%20XPath%20-%20Andre%20Gironda,%20Marcin%20Wielgoszewski%20and%20Tom%20Stracener.mp4">Path X Explosive Security Testing Tools using XPath</a> by Andre Gironda, Marcin Wielgoszewski and Tom Stracener [<a href="http://www.shmoocon.org/2008/presentations/2008_ShmooCon_DC-Gironda-Wielgoszewski-Path_X.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/Practical%20Hacker%20Crypto%20-%20Simple%20Nomad.mp4">Practical Hacker Crypto</a> by Simple Nomad</li>
<li><a href="http://www.shmoocon.org/2008/videos/SIPing%20Your%20Network%20-%20Radu%20State,%20Humberto%20Abdelnur,%20and%20Olivier%20Festor.mp4">SIPing Your Network</a> by Radu State, Humberto Abdelnur, and Olivier Festor [<a href="http://www.shmoocon.org/2008/presentations/SIPping-your-Network_Shmoocon2008.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/TL1%20Device%20Security%20-%20Rachel%20Bicknell.mp4">TL1 Device Security</a> by Rachel Bicknell</li>
<li><a href="http://www.shmoocon.org/2008/videos/The%20Geek%20and%20the%20Gumshoe%20or%20Can%20Mathematics%20and%20Computers%20Really%20Solve%20Crimes%20-%20Michael%20Schearer%20and%20Frank.mp4">The Geek and the Gumshoe or Can Mathematics and Computers Really Solve Crimes</a> by Michael Schearer and Frank [<a href="http://www.shmoocon.org/2008/presentations/Math.ppt">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/They're%20Hacking%20Our%20Clients!%20Why%20are%20We%20Focusing%20Only%20on%20the%20Servers%20-%20Jay%20Beale.mp4">They&#8217;re Hacking Our Clients! Why are We Focusing Only on the Servers</a> by Jay Beale [<a href="http://www.shmoocon.org/2008/presentations/Clientside-VulnAssessment-and-IPS-Shmoocon2008.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/Using%20Aspect%20Oriented%20Programming%20to%20Prevent%20Application%20Attacks%20-%20Rohit%20Sethi%20and%20Nish%20Bhalla.mp4">Using Aspect Oriented Programming to Prevent Application Attacks</a> by Rohit Sethi and Nish Bhalla [<a href="http://www.shmoocon.org/2008/presentations/AOP%20Talk.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/Virtual%20Worlds%20-%20Real%20Exploits%20-%20Charlie%20Miller%20and%20Dino%20Dai%20Zovi.mp4">Virtual Worlds</a> by Charlie Miller and Dino Dai Zovi [<a href="http://www.shmoocon.org/2008/presentations/Miller_DaiZovi.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/VoIP%20Penetration%20Testing%20Lessons%20Learned%20-%20John%20Kindervag%20and%20Jason%20Ostrom.mp4">VoIP Penetration Testing Lessons Learned</a> by John Kindervag and Jason Ostrom [<a href="http://www.shmoocon.org/2008/presentations/Vigilar_VoIP_Hopper_ShmooCon.ppt">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/Web%20Portals%20Gateway%20to%20Information%20or%20a%20Hole%20in%20our%20Perimeter%20Defenses%20-%20Deral%20Heiland.mp4">Web Portals Gateway to Information or a Hole in our Perimeter Defenses</a> by Deral Heiland [<a href="http://www.shmoocon.org/2008/presentations/Web%20portals,%20gateway%20to%20information.ppt">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/When%20Lawyers%20Attack!%20Dealing%20with%20the%20New%20Rules%20of%20Electronic%20Discovery%20-%20John%20Benson,%20Esq.mp4">When Lawyers Attack! Dealing with the New Rules of Electronic Discovery</a> by John Benson, Esq [<a href="http://www.shmoocon.org/2008/presentations/jur1st-shmoocon.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/Why%20are%20Databases%20so%20Hard%20to%20Secure%20-%20Sheeri%20Cabral.mp4">Why are Databases so Hard to Secure</a> by Sheeri Cabral [<a href="http://www.shmoocon.org/2008/presentations/2008_02_SecuringDBs.pdf">presentation</a>]</li>
<li><a href="http://www.shmoocon.org/2008/videos/On%20the%20Social%20Respnsbility%20of%20Hackers%20Panel%20Bruce%20Potter%20(moderator),%20Simple%20Nomad,%20Johnny%20Long,%20Rick%20Dakan.mp4">On the Social Responsibility of Hackers</a> Panel by Bruce Potter (moderator), Simple Nomad, Johnny Long, Rick Dakan [<a href="http://www.shmoocon.org/2008/presentations/ShmooCon08-HackerPanel.ppt">info on panel</a>]</li>
</ul>
<p>Enjoy and don&#8217;t forget to comment on which videos you liked the best!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/catonmat?a=xrkLmI"><img src="http://feeds.feedburner.com/~f/catonmat?i=xrkLmI" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=C02aBi"><img src="http://feeds.feedburner.com/~f/catonmat?i=C02aBi" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=Z8u3ai"><img src="http://feeds.feedburner.com/~f/catonmat?i=Z8u3ai" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=SkAixi"><img src="http://feeds.feedburner.com/~f/catonmat?i=SkAixi" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/catonmat/~4/318746688" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.catonmat.net/blog/shmoocon-hacking-videos/feed/</wfw:commentRss>
<enclosure url="http://www.shmoocon.org/2006/videos/Stewart-Malware.mp4" length="87914156" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Damin-Asterisk.mp4" length="85265835" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Kaminsky-BlackOps.mp4" length="83233870" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Moniz-LANMAN.mp4" length="84682365" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Acidus-Covert.mp4" length="85061849" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/ChurchOfWiFi.mp4" length="88954545" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Manzuk-Policy.mp4" length="88344862" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Callas-Disclosure.mp4" length="87992234" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Scott-ConCon.mp4" length="82354523" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Fyodor-nmap.mp4" length="88221671" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Ike-Jail.mp4" length="80147496" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Wilbanks-Surveillance.mp4" length="85815541" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Rash-SinglePacket.mp4" length="85913451" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Bejtlich-Squil.mp4" length="88098056" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Smith-Layer2.mp4" length="85958202" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Nomad-Sky.mp4" length="85158378" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Abend-MagCards.mp4" length="89168270" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Anonym.os.mp4" length="86358618" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Sprickerhoff-WIDS.mp4" length="85929037" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Fisher-Web.mp4" length="86400109" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Butti-WiFi.mp4" length="85803406" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Dunin-Kryptos.mp4" length="79581928" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/AminiEagle-RE.mp4" length="88358214" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/James-Trojans.mp4" length="88813426" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Cazz-snort.mp4" length="87809563" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Marinescu-Heap.mp4" length="85785693" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Noble-Outbound.mp4" length="85268005" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Ollam-Lockpicking.mp4" length="169685751" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Long-HollywoodANDClosing.mp4" length="198961389" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2006/videos/Granick-Liberties.mp4" length="97438536" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/Hacking%20the%20Airwaves%20with%20FPGAs%20-%20h1kari.mp4" length="67109620" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/Auditing%20Cached%20Credentials%20with%20Cachedump%20-%20Eoin%20Miller%20and%20Adair%20Collins.mp4" length="64319837" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/Security%20Breaches%20are%20Good%20for%20You%20-%20Adam%20Shostack.mp4" length="76774571" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/No-Tech%20Hacking%20-%20Johnny%20Long.mp4" length="82065178" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/Hacker%20Potpourri%20-%20Simple%20Nomad.mp4" length="141246128" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/Extend%20Your%20Code%20Into%20the%20Real%20World%20-%20Ryan%20Clarke.mp4" length="136515035" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/JavaScript%20Malware%20for%20a%20Grey%20Goo%20Tomorrow%20-%20Billy%20Hoffman.mp4" length="142721287" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/Backbone%20Fuzzing%20-%20Raven.mp4" length="108077755" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/Windows%20Mobile%20Software%20Raw%20and%20Exposed%20-%20Seth%20Fogie.mp4" length="134968185" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/Hacking%20Digital%20Cameras%20-%20John%20Maushammer.mp4" length="142070741" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/WPAD%20-%20Proxy%20Attack%20-%20Chris%20Paget.mp4" length="144448819" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/A%20Hacker%20Looks%20at%2050%20-%20G.%20Mark%20Hardy.mp4" length="156022184" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/The%20Church%20of%20WiFi%20presents%20A%20Hacker%20in%20Iraq%20-%20Michael%20Schearer.mp4" length="120604346" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/The%20Hacker%20Foundation%20-%20The%20Ethic%20in%20Action%20-%20Jesse%20Krembs%20and%20Nick%20Farr.mp4" length="129610395" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/Dissecting%20ShmooCon%20Labs%20-%20The%20Shmoo%20Group.mp4" length="151316166" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/Attack%20Detection%20and%20Response%20with%20Linux%20Firewalls%20-%20Michael%20Rash.mp4" length="144250585" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/Assess%20the%20security%20of%20your%20online%20back%20without%20going%20to%20jail%20-%20Chuck%20Willis.mp4" length="137968742" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/RFIDiots%20-%20Major%20Malfunction.mp4" length="152538267" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/Encrypted%20Protocol%20Identification%20via%20Statistical%20Analysis%20-%20Rob%20King%20and%20Rohlt%20Dhamankar.mp4" length="111177499" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2007/videos/0wn%20the%20Con%20-%20The%20Shmoo%20Group.mp4" length="146518502" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/21st%20Century%20Shellcode%20for%20Solaris%20-%20Tim%20Vidas.mp4" length="139182206" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/Advanced%20Protocol%20Fuzzing%20-%20What%20We%20Learned%20when%20Bringing%20Layer2%20Logic%20to%20SPIKE%20Land%20-%20Enno%20Rey%20and%20Daniel%20Mende.mp4" length="152946014" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/Baked%20not%20Fried%20Performing%20an%20Unauthorized%20Phishing%20Awareness%20Exercise%20-%20Syn%20Phishus.mp4" length="73269261" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/Forced%20Internet%20Condom%20-%20Aaron%20Higbee%20and%20Jaime%20Fuentes.mp4" length="133845066" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/Forensic%20Image%20Analysis%20to%20Recover%20Passwords%20-%20David%20Smith.mp4" length="136620660" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/Got%20Citrix%20Hack%20It!%20-%20Shanit%20Gupta.mp4" length="105053953" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/Hacking%20Windows%20Vista%20Security%20-%20Dan%20Griffin.mp4" length="125156547" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/Hacking%20the%20Samurai%20Spirit%20-%20Isaac%20Mathis.mp4" length="68253319" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/How%20do%20I%20Pwn%20Thee%20Let%20Me%20Count%20the%20Ways%20-%20RenderMan.mp4" length="122604421" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/Intercepting%20Mobile%20PhoneGSM%20Traffic%20-%20H1kari.mp4" length="68521770" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/Keynote%20Address%20-%20Alex%20Halberman.mp4" length="172220332" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/Legal%20Issues%20for%20Bot-net%20Researchers%20and%20Mitigators%20-%20Alexander%20Muentz.mp4" length="155830095" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/Malware%20Software%20Armoring%20Circumvention%20-%20Danny%20Quist.mp4" length="120245553" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/PEAP%20Pwned%20Extensible%20Authentication%20Protocol%20-%20Josh%20Wright%20and%20Brad%20Antoniewicz.mp4" length="118702317" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/Practical%20Hacker%20Crypto%20-%20Simple%20Nomad.mp4" length="166490379" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/TL1%20Device%20Security%20-%20Rachel%20Bicknell.mp4" length="74458894" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/The%20Geek%20and%20the%20Gumshoe%20or%20Can%20Mathematics%20and%20Computers%20Really%20Solve%20Crimes%20-%20Michael%20Schearer%20and%20Frank.mp4" length="135106297" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/Using%20Aspect%20Oriented%20Programming%20to%20Prevent%20Application%20Attacks%20-%20Rohit%20Sethi%20and%20Nish%20Bhalla.mp4" length="131626132" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/Virtual%20Worlds%20-%20Real%20Exploits%20-%20Charlie%20Miller%20and%20Dino%20Dai%20Zovi.mp4" length="143989769" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/VoIP%20Penetration%20Testing%20Lessons%20Learned%20-%20John%20Kindervag%20and%20Jason%20Ostrom.mp4" length="111413298" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/Web%20Portals%20Gateway%20to%20Information%20or%20a%20Hole%20in%20our%20Perimeter%20Defenses%20-%20Deral%20Heiland.mp4" length="76110249" type="video/mpeg" />
<enclosure url="http://www.shmoocon.org/2008/videos/Why%20are%20Databases%20so%20Hard%20to%20Secure%20-%20Sheeri%20Cabral.mp4" length="135308300" type="video/mpeg" />
		<feedburner:origLink>http://www.catonmat.net/blog/shmoocon-hacking-videos/</feedburner:origLink></item>
		<item>
		<title>Solving Google Treasure Hunt Puzzle 4: Prime Numbers</title>
		<link>http://feeds.feedburner.com/~r/catonmat/~3/306462687/</link>
		<comments>http://www.catonmat.net/blog/solving-google-treasure-hunt-prime-number-problem-four/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 17:30:54 +0000</pubDate>
		<dc:creator>Peteris Krumins</dc:creator>
		
		<category><![CDATA[Hacker's Approach]]></category>
<category>awk</category><category>google</category><category>grep</category><category>prime numbers</category><category>primes</category><category>sort</category><category>tail</category><category>treasure hunt</category><category>unix</category><category>wc</category>
		<guid isPermaLink="false">http://www.catonmat.net/blog/solving-google-treasure-hunt-prime-number-problem-four/</guid>
		<description><![CDATA[I just found out about Google&#8217;s Treasure Hunt 2008. They say that &#8220;it&#8217;s a puzzle contest designed to test yer problem-solving skills in computer science, networking, and low-level UNIX trivia.&#8221;
Apparently I have missed the first three puzzles (first, second and third) but I&#8217;ll give the fourth puzzle a shot.
The fourth problem is about prime numbers [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.catonmat.net/blog/wp-content/uploads/2008/06/google-treasure-hunt-2008-prime-numbers.jpg' alt='prime number problem of google treasure hunt 2008' class="post-icon" align="left" />I just found out about Google&#8217;s Treasure Hunt 2008. <a href="http://googleblog.blogspot.com/2008/05/google-treasure-hunt-update.html">They say</a> that &#8220;it&#8217;s a puzzle contest designed to test yer problem-solving skills in computer science, networking, and low-level UNIX trivia.&#8221;</p>
<p>Apparently I have missed the first three puzzles (<a href="http://decoding.wordpress.com/2008/05/16/google-treasure-hunt-2008-first-puzzles-solution/">first</a>, <a href="http://www.fsharp.it/2008/05/21/google-treasure-hunt-2008-second-puzzle-in-f/">second</a> and <a href="http://aburad.com/blog/2008/05/google-treasure-hunt-puzzle-3.html">third</a>) but I&#8217;ll give the fourth puzzle a shot.</p>
<p>The fourth problem is about prime numbers and it&#8217;s formulated as following:</p>
<blockquote><p>Find the smallest number that can be expressed as<br />
the sum of 7 consecutive prime numbers,<br />
the sum of 17 consecutive prime numbers,<br />
the sum of 41 consecutive prime numbers,<br />
the sum of 541 consecutive prime numbers,<br />
and is itself a prime number.</p>
<p>For example, 41 is the smallest prime number that can be expressed as<br />
the sum of 3 consecutive primes (11 + 13 + 17 = 41) and<br />
the sum of 6 consecutive primes (2 + 3 + 5 + 7 + 11 + 13 = 41). </p></blockquote>
<h2>The Solution</h2>
<div style="padding-bottom:1em"></div>
<p>I&#8217;ll write how I got the solution as I go, so I&#8217;ll mix the past and present tenses in this post. Sometimes I&#8217;ll write what I am going to do and sometimes I&#8217;ll write what I just did.</p>
<p>I have no desire to generate lists of prime numbers myself as it has been done <a href="http://www.google.com/search?q=prime+number+algorithm">infinitely many</a> times already. I&#8217;ll just use a publicly available list of prime numbers! <a href="http://primes.utm.edu/lists/small/millions/">Here</a> is a list of first fifty million primes.</p>
<p>I&#8217;ll use my Unix-fu to find the solution.</p>
<p>First I noticed that the primes are zipped and split into chunks of million primes per file. The file names are like &#8220;primes1.zip&#8221;, &#8230; &#8220;primes50.zip&#8221;.</p>
<p>A quick loop from 1 to 50 and wget gets all these files to my hard drive:</p>
<pre>
$ for i in $(seq 50); do wget &#34;http://primes.utm.edu/lists/small/millions/primes$i.zip&#34;; done
</pre>
<p>Next, I unzip all these files, and remove those zips to save space:</p>
<pre>
$ for i in $(seq 50); do unzip &#34;primes$i.zip&#34; &#038;&#038; rm -f &#34;primes$i.zip&#34;; done
</pre>
<p>After doing that and looking at what I got, I realized that they were in some strange format, 8 primes per line, space padded and with some text on the first two lines. Here is an example how the first five lines look in primes1.txt file:</p>
<pre>
                 The First 1,000,000 Primes (from primes.utm.edu)

         2         3         5         7        11        13        17        19
        23        29        31        37        41        43        47        53
        59        61        67        71        73        79        83        89
</pre>
<p>I want all my primes to be in one file and one prime per line so I can extract N-th prime by looking at that line.<br />
I used the following command to merge all the files into a single file:</p>
<pre>
for i in $(seq 50); do (awk &#39;BEGIN { OFS=&#34;\n&#34; } NR &gt; 2 {print $1,$2,$3,$4,$5,$6,$7,$8}&#39; primes$i.txt &gt;&gt; primes.txt) &#038;&#038; rm -f primes$i.txt; done
</pre>
<p>A quick verification that I did not lose any primes:</p>
<pre>
$ wc -l primes.txt
50000000 primes.txt
</pre>
<p>Now I&#8217;ll create four files which contain sums of 7, 17, 41 and 541 consecutive primes, not exceeding the biggest prime in primes.txt file. I did that with the following AWK one-liner:</p>
<pre>
$ last=$(tail -1 primes.txt)
$ for N in 7 17 41 541
  do
   awk &#39;BEGIN { prev[0] = 0 } NR &lt; &#39;$N&#39; {prev[NR] = $1; sum += $1 } NR &gt;= &#39;$N&#39; { psum += prev[NR-&#39;$N&#39;]; delete prev[NR-&#39;$N&#39;]; prev[NR] = $1; sum += $1; if (sum - psum &gt; &#39;$last&#39;) { exit } printf &#34;%d\n&#34;, sum - psum }&#39; primes.txt &gt; primes$N.txt
  done
</pre>
<p>The command created primes7.txt, primes17.txt, primes 41.txt and primes541.txt files. These files contain sums of prime numbers and just some of them are primes.</p>
<p>The solution, if it exists in the given data set, is the intersect of all these files. If there are multiple items in the intersect, the smallest should be chosen and checked if it really was a prime.</p>
<pre>
$ sort -nm primes541.txt primes41.txt | uniq -d | sort -nm primes17.txt - | uniq -d | sort -nm primes7.txt - | uniq -d
7830239
$ grep -m1 7830239 primes.txt
7830239
</pre>
<p>We have found the solution! It&#8217;s <strong>7830239</strong>!</p>
<p>I submitted the answer and after a few minutes it was confirmed to be correct! Awesome!</p>
<blockquote><p>
Your question: [7, 17, 41, 541]<br />
Your answer: 7830239<br />
Time received: 2008-06-06 23:33:26.268414 UTC</p>
<p>Correct answer: 7830239<br />
<strong>Your answer was: Correct</strong>
</p></blockquote>
<p>Now leave a comment and tell me how you solved this problem!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/catonmat?a=9WizdI"><img src="http://feeds.feedburner.com/~f/catonmat?i=9WizdI" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=vSK7wi"><img src="http://feeds.feedburner.com/~f/catonmat?i=vSK7wi" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=BgkVxi"><img src="http://feeds.feedburner.com/~f/catonmat?i=BgkVxi" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/catonmat?a=nS1GKi"><img src="http://feeds.feedburner.com/~f/catonmat?i=nS1GKi" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/catonmat/~4/306462687" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.c