post 'good coders code, great reuse' to del.icio.us post 'good coders code, great reuse' to digg post 'good coders code, great reuse' to reddit subscribe to 'good coders code, great reuse' posts via feed
good coders code, great reuse

If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilisation.

Gerald Weinberg

I am now on Twitter! Meet me on Twitter here (my nick is pkrumins.)
Or on Google Buzz and Facebook.

Misc 08 Dec 2009 07:35 am
1 Star2 Stars3 Stars4 Stars5 Stars (17 votes, average: 4 out of 5)
Loading ... Loading ...

GitHub Social CodingHey everyone, I just pushed 30 of my projects to GitHub. I realized that all the projects were scattered across my blog and there was no central repository. So I took time to organize them, write documentation, and uploaded them to GitHub.

I did all of these projects for fun and to learn better programming. You can’t become a great programmer if you don’t program a lot. The more you program, the more language idioms and constructs you’ll learn. You’ll learn common patterns that occur frequently in programming and it will greatly improve your problem solving skills.

These were all relatively small projects and I think I am ready to move to the next level. I have several larger ideas in mind that need to be turned into code. I will post the updates to catonmat.

If you find any of my projects interesting, clone and start hacking. You can also follow my profile at github. :-)

Here they all are. Enjoy!

1. Busy Beaver

Busy beaver is a computer science problem to finding the smallest Turing Machine that outputs the most data and eventually halts. This project is an implementation of a Turing Machine in Python and C++ that runs the busy beavers. It also comes with Turing Machine’s tape visualization tool written in Perl.

2. Feedburner Graph Generator

Current Feedburner statistics graphs do not look nice. I wrote this Perl program to generate the nice graphs they had in 2008.

3. CodingHorror Keyword Analyzer

This is a Perl program that parses public statcounter data for codinghorror.com blog and stores the search keywords in an SQLite database.

4. Adns

This is a tiny Python module that does asynchronous DNS resolution with adns library. My benchmarks were 20,000 resolutions per minute on a 512kbit/s connection.

5. Winamp Music Reporter Plugin

This is a Winamp plugin that reports to digitalpoint forums the tracks you are listening to. Written in C and uses Winamp SDK. The code can be modified to make it report to Facebook or Twitter, or anywhere you wish.

6. Bithacks.h

Bithacks.h is a C header file that implements various bit operations.

7. Set Operations in Unix Shell

This is an implementation of 14 set operations by using only Unix utilities such as sort, uniq, diff, comm, cat, head, tail, awk, and others.

8. Hacker Top

Hacker top is a Unix top-like program written in Python for monitoring Hacker News from the console.

9. Reddit Top

Reddit top is a Unix top-like program written in Python for monitoring Reddit from the console.

10. GNU Awk YouTube Downloader

This is a program written in GNU Awk that downloads YouTube videos. It works well but please don’t take it too seriously. It’s a proof of concept code, written to see what can be done with GNU Awk’s networking interface.

11. VBScript YouTube Downloader

This is a program written in VBScript that downloads YouTube videos. I wrote it because when I was a child, I did a lot of programming in Visual Basic and I wanted to remember what it was like.

12. Perl One-Liner YouTube Downloader

This is a Perl one-liner that downloads YouTube videos. I wrote it because I love Perl golf.

13. YouTube Video Uploader

This is a YouTube video uploader that works without any APIs. It just simulates what a browser would do and takes all the steps to post the video and set the video info. Written in Perl.

14. Plurk Translation Tool

This is a GreaseMonkey script that translates Plurks to English.

Plurk is like Twitter but more fun and organized. Come be my friend on Plurk, my profile name is pkrumins. Written in JavaScript.

15. Command Line Plurker

Plurk from your command line. Written in Perl.

16. Find Plurks on Google

This program searches for plurks that were indexed by Google. It outputs URLs to indexed pages. It’s written in Python and uses my xgoogle library.

17. Delete Plurks

This is a GreaseMonkey script that adds a “delete” button on individual plurk pages. This way you can delete your or other people plurks (if it’s your thread) directly from the plurk page. Written in JavaScript.

18. Xgoogle

A Python library to Google services - Google Search, Google Sets, Google Translate and Sponsored Links.

19. Reddit Media

The old Reddit Media website that I created in 2007. No longer maintained. It was written in Perl.

20. Reddit River

The old Reddit River website for mobile devices. No longer maintained. It was written in Python.

21. Digpicz

This is the digpicz.com website that I created back in 2007. It got massive attention back then because Digg didn’t have picture section then. It was written in Perl.

22. Picurls

Picurls.com is a picture aggregator much like popurls.com but for pics. Currently down for maintenance, will be soon up again. Written in PHP.

23. Bash Vi Editing Mode Cheat Sheet

Bash has two input modes - emacs and vi. This is vi input/editing mode keyboard shortcut cheat sheet.

24. Bash Emacs Editing Mode Cheat Sheet

Bash has two input modes - emacs and vi. This is emacs input/editing mode keyboard shortcut cheat sheet.

25. Bash History Cheat Sheet

This is the bash history cheat sheet. It summarizes everything there is to know about working efficiently with command line history in bash.

26. Screen Cheat Sheet

This is the screen terminal emulator cheat sheet. It lists the default keyboard shortcuts for working with screen.

27. Perl Special Variable Cheat Sheet

This is Perl predefined variable cheat sheet. It lists all the variables from `perldoc perlvar` with a concise description and some example usages. I created it when I was mastering Perl. I enjoy Perl golf and I wanted to know all of the variables.

28. Perl pack/unpack and printf/sprintf Cheat Sheet

This is Perl pack/unpack/printf/sprintf cheat sheet. The pack/unpack cheat sheet is on page one, and it lists the pack/unpack template parameters and what they do. The printf/sprintf cheat sheet is on page two, and it lists the printf/sprintf format specifiers and format attributes.

I created this when I was mastering what could be done with pack/unpack. I added printf/sprintf as I could never remember all the format specifiers.

29. Awk Cheat Sheet

AWK programming language cheat sheet.

30. Sed Cheat Sheet

This is sed cheat sheet. Sed is the Unix stream editor. If you don’t know it, you don’t know Unix.

31. Ed Cheat Sheet

This is ed cheat sheet. Ed is The Unix Text Editor.

One day when I was learning sed, I got interested if it originated from ed, which got me interested in ed itself. I find that cheat sheets are a great way to learn new topics and therefore I created this cheat sheet.

32. The New catonmat.net Website

I just started pushing code to the new catonmat.net repository. It’s going to be a state of the art personal website from now on.

I have around 100 ideas for it, and the next big article series on catonmat is going to be “Designing the new catonmat.net together with me.” You should subscribe to my blog here if you are interested!

If you have any questions, don’t hesitate to ask in the comments!

Comments (18) Comments | Email Post Email 'I pushed 30 of my projects to GitHub' to a friend | Print Post Print 'I pushed 30 of my projects to GitHub' | Permalink Permalink to 'I pushed 30 of my projects to GitHub' | Trackback Trackback to 'I pushed 30 of my projects to GitHub'
(Popularity: 15%) 20,764 Views

Did you like this page? Subscribe to my posts!

I am now on Twitter! Meet me on Twitter here (my nick is pkrumins.)
Or on Google Buzz and Facebook.

Misc 27 Jul 2009 08:25 am
1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 3.33 out of 5)
Loading ... Loading ...

A Year of BloggingHoly smokes! It has now been two years since I started this blog. It seems almost like yesterday when I posted the “A Year of Blogging” article. And now it’s two! With this post I’d like to celebrate the 2nd birthday and share various interesting statistics that I managed to gather.

During this year (July 20, 2008 - July 26, 2009) I wrote 55 posts, which received around 1000 comments. According to StatCounter and Google Analytics my blog was visited by 1,050,000 unique people who viewed 1,700,000 pages. Wow, 1 million visitors! That’s very impressive!

Here is a Google Analytics graph of monthly page views for the last year (click for a larger version):

Catonmat.Net Page Views Per Month (Second Year of Blogging)

In the last three months I did not manage to write much and you can see how that reflected on the page views. A good lesson to be learned is to be persistent and keep writing articles consistently.

Here is the same graph with two years of data, showing a complete picture of my blog’s growth:

Catonmat.Net Page Views Per Month (Two Years of Blogging)

I like this seemingly linear growth. I hope it continues the same way the next year!

Here are the top 5 referring sites that my visitors came from:

And here are the top 5 referring blogs:

I found that just a handful of blogs had linked to me during this year. The main reason, I suspect, is that I do not link out much myself… It’s something to improve upon.

If you remember, I ended the last year’s post with the following words (I had only 1000 subscribers at that time):

I am setting myself a goal of reaching 5000 subscribers 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!

I can proudly say that I reached my ambitious goal! My blog now has almost 7000 subscribers! If you have not yet subscribed, click here to do it!

Here is the RSS subscriber graph for the whole two years:

RSS Subscriber Count, Two Years of Blogging

Several months ago I approximated the subscriber data with an exponent function and it produced a good fit. Probably if I had continued writing articles at the same pace I did three months ago, I’d have over 10,000 subscribers now.

Anyway, let’s now turn to the top 10 most viewed posts:

The article that I liked the most myself but which didn’t make it to top ten was the “Set Operations in Unix Shell“. I just love this Unix stuff I did there.

I am also very proud for the following three article series that I wrote:

  • 1. Review of MIT’s Introduction to Algorithms course (14 parts).
  • 2. Famous Awk One-Liners Explained (4 parts: 1, 2, 3, 4).
  • 3. Famous Sed One-Liners Explained (3 parts: 1, 2, 3)

Finally, here is a list of ideas that I have thought for the third year of blogging:

  • Publish three e-books on Awk One-Liners, Sed One-Liners and Perl One-Liners.
  • Launch mathematics, physics and general science blog.
  • Write about mathematical foundations of cryptography and try to implement various cryptosystems and cryptography protocols.
  • Publish my review of MIT’s Linear Algebra course (in math blog, so the main topic of catonmat stays computing).
  • Publish my review of MIT’s Physics courses on Mechanics, Electromagnetism, and Waves (in physics blog).
  • Publish my notes on how I learned the C++ language.
  • Write more about computer security and ethical hacking.
  • Write several book reviews.
  • Create a bunch of various fun utilities and programs.
  • Create at least one useful web project.
  • Add a knowledge database to catonmat, create software to allow easy publishing to it.
  • If time allows, publish reviews of important computer science publications.

I’ll document everything here as I go, so if you are interested in these topics stay with me by subscribing to my rss feed!

And to make things more challenging again, I am setting a new goal for the next year of blogging. The goal is to reach 20,000 subscribers by July 2010!

Hope to see you all on my blog again! Now it’s time for this delicious cake:

Second Birthday Portal Game Cake
Comments (31) Comments | Email Post Email 'Two Years of Blogging' to a friend | Print Post Print 'Two Years of Blogging' | Permalink Permalink to 'Two Years of Blogging' | Trackback Trackback to 'Two Years of Blogging'
(Popularity: 16%) 12,522 Views

Did you like this page? Subscribe to my posts!

I am now on Twitter! Meet me on Twitter here (my nick is pkrumins.)
Or on Google Buzz and Facebook.

Misc 24 Nov 2008 07:20 am
1 Star2 Stars3 Stars4 Stars5 Stars (116 votes, average: 4.4 out of 5)
Loading ... Loading ...

My Job Interview at GoogleTwo weeks ago I had an on-site interview at Google in Mountain View, California! The job interview with Google was an interesting experience and I want to tell you about it. (I got the green light from Google to publish this article.)

The position I was interviewing for was a Google SRE. SRE stands for Site Reliability Engineering. Site reliability engineers (SREs) are both software engineers and systems administrators, responsible for Google’s production services from end-to-end.

There were eight separate interviews total. The first three were over the phone (phone interviews) and the remaining five were on-site. The first interview was with the recruiter and was not very technical but the other seven were very technical.

All interviews went very well but I was just notified that I did not get hired. Oh well… I personally think that I did really well. I answered all the questions but it seems they were not satisfied. The recruiter did not tell me the precise reason, just that the morning interviews were not that great and I should get more experience to work in their mission critical team.

Update: This article has been translated to Japanese.
Update: This article has been translated to German.

Here is how it all happened.

Shortly after I published the “Code Reuse in Google Chrome” post I was contacted by a recruiter at Google. The email said:

I recruit top notch Software Engineering talent at Google. I recently came across your name as a possible world class Engineer and am intrigued to know more about you. I promise to exchange some detailed info about us as well.

Interested to hear more? Want to be an impact player at Google? Then please respond with a current (English) copy of your resume and I’ll be happy to call you and discuss.

At first I thought I would be applying for a software developer position, but after we went through my skillset, the recruiter concluded that I would better fit as an SRE. I agreed with him. This seemed like a perfect position for me. I love systems administration as much as I love programming.

First Interview (phone)

The first interview was on the 10th of September with the recruiter. He explained the Google recruitment process to me and we went through my skill set. I had to rank myself from 0 - 10 in a bunch of areas such as C programming, C++ programming, Python programming, networking, algorithms and data structures, distributed systems, Linux systems administration, and others.

As I said, based on my answers we concluded that SRE was the best position for me. An SRE basically has to know everything: algorithms, data structures, programming, networking, distributed systems, scalable architecture, troubleshooting. It’s a great hacker position!

After these questions he asked me where I would like to work - Google office in Ireland, Zurich, Mountain View or Australia. I said Mountain View as it’s the Googleplex! He explained that if the interviews went OK, I’d have to get an H-1B visa that allows non-US citizens to work in the US.

The second half of the interview had some basic technical questions, just to make sure I knew something. The questions were about Linux systems administration, algorithms, computer architecture and C programming. I can’t go into any details because I signed a non-disclosure agreement and my recruiter kindly asked me not to post the questions!

I made some factual mistakes but he was satisfied and we scheduled the next phone interview. He warned me that it will be very technical and I should do really good preps. I asked him to give me a plenty of time for the preparation and we scheduled the next interview on 22nd of September.

He also told me that each phone interview is going to be 45 minutes to 1 hour long.

I started preparing like crazy. I found three presentations on what SRE is all about:

Then I found all the other blog posts about interviews and interview questions at Google:

I printed and read four Google research papers:

I also went through several books:

As I did not know if I might get specific programming language questions, I went through a few tens of receipts in C++ Cookbook, Python Cookbook, and Perl Cookbook.

Second Interview (phone)

The second phone interview was with an engineer from Google. He worked on the Ads team which is responsible for running AdSense, AdWords and other advertisement stuff.

The interview was very technical and started with an algorithmic problem which was too large to fit in computer memory. I had to tell him precisely how I would get around this problem and what data structures and algorithms I would use. He also asked me to think out loudly. The interview continued with questions about data structures, DNS, TCP protocol, a security vulnerability associated with TCP, networking in general, and Google itself. Sorry, but I can’t disclose anything in more details.

After the interview the engineer had to write feedback on me. It was positive and I could move on with the interviews.

Third Interview (phone)

I gave myself more time to prepare and the third interview was on the 1st of October. It was with an engineer from the Google traffic team.

In this interview I had a very simple programming question and I had to do coding over phone. I was free to choose the language and I chose Perl as it is my most favorite programming language. It was impossible to dictate Perl syntax over phone “for my dollar sign element open paren at data close paren open curly brace … close curly brace” so I submitted my Perl program over the email.

Then the same problem was taken to the next level, what if the data we are working on is gigabytes in size, terabytes in size. How would my program/solution change?

Finally I had a question about DNS again, then HTTP protocol, routing, and TCP data transfer.

The feedback was positive and I could prepare for the on-site interviews. In my conversation with my recruiter I got to know that there will be five on-site interviews, each exactly 45 minutes long. One on my previous work experience, one on algorithms and data structures, one on troubleshooting and networking, and two on software development with focus on C and C++.

My recruiter suggested that I read a few more documents:

I flew out to USA on 24th of October at 1pm from Latvia and arrived in California at 8pm. The flight was actually 14 hours but it was nice that I flew in the same direction as the time flows. This saved me 7 hours. The on-site interview was scheduled on 27th of October so I had a good rest before the interview. It was also nice that Google paid for my trip, hotel, cab and food. I had zero expenses!

Fourth Interview (on-site)

The fourth interview was finally at Googleplex! At 10am I met my recruiter and we had a 15 minute discussion about the interviews. He told me I would have two interviews now, then one of Google engineers would take me to lunch to one of Google’s restaurants and then I would have three other interviews.

At 10:15am the first on-site interview began. It was about my previous job experience. I have had a lot of job experience in the past and I decided to tell about a physical security notification system that I coded in C on Linux a few years ago. The system would receive messages through the serial port and send out emails and SMS’es.

In the last minutes of the interview he asked me some basic Unix filesystem questions.

In all the on-site interviews I was writing and drawing on two big whiteboards. Fun!

Fifth Interview (on-site)

The fifth interview began at 11am. It was a coding session and began with a trick question and not a real coding problem. I was asked to implement the solution in C. The solution was a mathematical expression that was a one-line return statement. No big coding there. Then I was asked to write an implementation of a very well known data structure. While coding I made a mistake and forgot to initialize part of a data structure that I had malloc()’ed! The program would have segfault’ed in real life and I would have noticed the error, but Google engineers are very serious about it! If you have an interview don’t ever make any mistakes!

After this interview I was taken to lunch by the engineer who interviewed me on the second (phone) interview. She told me she was working at Google for two years and was very happy about it. We went to Asian food restaurant (located in Googleplex) and I had all kinds of delicious foods. All free!

Then she showed me around Googleplex. It was all amazing. Free drinks and candy everywhere, some arcade machines, a beach volleyball outside, and many other surprising things.

Sixth Interview (on-site)

The sixth interview began at 12:45pm. It was a troubleshooting and networking interview. The interviewer drew a network diagram on the whiteboard and had imagined a problem in there. I had to ask a bunch of specific networking questions to locate the problem. He was satisfied and in the last few minutes of the interview he asked me some specific networking device questions.

Seventh Interview (on-site)

The seventh interview began at 1:30pm. It was a coding session. I was asked to implement a simple string manipulation subroutine in either C or C++. I chose C. Unfortunately I made an off-by-one mistake there - the most common programming mistake in the history of mankind. The whole interview focused on this one problem.

Eighth Interview (on-site)

The last, eight, interview began at 2:15pm. It was algorithms and data structures interview. The problem presented here was similar to the problem in the 2nd interview. Not only was it a problem too large to fit in computer memory but it also was distributed. So I had to do all kinds of trickery to solve it. The interview was very free-style and we talked back and forth about the problem. I arrived at the correct solution near the end of the interview and he said that not many candidates get that far in the solution. I was happy.

After the interview the engineer escorted me out to the lobby and I took a cab back to my hotel. That’s it! :)

The End

Overall the Google interviews were pure fun for me. The interview questions were technical but not very challenging or difficult.

Thanks for the opportunity Google! :)

Comments (209) Comments | Email Post Email 'My Job Interview at Google' to a friend | Print Post Print 'My Job Interview at Google' | Permalink Permalink to 'My Job Interview at Google' | Trackback Trackback to 'My Job Interview at Google'
(Popularity: 100%) 231,507 Views

Did you like this page? Subscribe to my posts!

I am now on Twitter! Meet me on Twitter here (my nick is pkrumins.)
Or on Google Buzz and Facebook.

Misc 21 Jul 2008 11:50 pm
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

A Year of BloggingMy 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 received 574,874 views by 424,292 unique visitors.

Here is a Google Analytics graph showing monthly page views for this period (click for a larger version):

catonmat.net page views graph (small)

Here are the top 5 countries my blog readers came from:

  • United States (195,076 visitors)
  • United Kingdom (25,988 visitors)
  • Canda (25,335 visitors)
  • India (13,753 visitors)
  • Germany (13,670 visitors)

Not surprisingly, the top 5 referring sites were all social media and bookmarking sites:

From all the visitors 48,386 went to my site directly and 82,502 were sent here by my darling Google.

During the first year, approximately 1000 people subscribed to my blog. Here is the Feedburner subscriber graph for the year:

feedburner statistics for one year of blogging

If you are interested in my blog, you may subscribe here: catonmat rss feed.

According to Technorati, my blog has received 476 blog reactions and ranks 29,521-st out of 112.8 million blogs!

Many of my posts have been submitted to Reddit, Digg and have been Stumbled. Here are the top 5 most visited posts:

Some of my how-to posts came with downloadable cheat sheets. Here are the top 5 cheat sheets:

During the last year I also did several web projects. As I was busy with physics studies, I created only four web projects (all of these projects are open source):

In March 2008 I started posting geek music on Fridays. Here are the top 5 geek songs:

I am satisfied with where this blog is heading. I’d like to thank all my fans and all the visitors who regularly return to the site!

To make things more challenging, I am setting myself a goal of reaching 5000 subscribers 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!

birthday portal cake
Comments (14) Comments | Email Post Email 'A Year of Blogging' to a friend | Print Post Print 'A Year of Blogging' | Permalink Permalink to 'A Year of Blogging' | Trackback Trackback to 'A Year of Blogging'
(Popularity: 8%) 7,910 Views

Did you like this page? Subscribe to my posts!

I am now on Twitter! Meet me on Twitter here (my nick is pkrumins.)
Or on Google Buzz and Facebook.

Misc 02 Jul 2008 06:30 pm
1 Star2 Stars3 Stars4 Stars5 Stars (7 votes, average: 3.57 out of 5)
Loading ... Loading ...

graduate hatI 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 10, 10 being excellent, 9 being very good, …, 4 being the lowest grade for passing a course. Anything below 4 means failure).

As I already mentioned in the about me 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.

Here is a picture of me with a diploma in my hands. :)

peteris krumins with a diploma at university of latvia

Here is another picture with all of us who graduated from University of Latvia with a B.Sc. degree in Physics in 2008. I’m right in the middle of the front row!

university of latvia physics graduates 2008

Talking about my future plans, I decided not to go to a graduate school just yet. I’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. :)

Thanks for reading my blog!

Comments (25) Comments | Email Post Email 'Graduated with a B.Sc. Degree in Physics' to a friend | Print Post Print 'Graduated with a B.Sc. Degree in Physics' | Permalink Permalink to 'Graduated with a B.Sc. Degree in Physics' | Trackback Trackback to 'Graduated with a B.Sc. Degree in Physics'
(Popularity: 8%) 7,274 Views

Did you like this page? Subscribe to my posts!

Page 1 of 212»