Blogs / Personal blogs

Peteris Krumins

catonmat.net

catonmat.net

Popular posts
57
Total points
9,150
HN comments
3,576
Rank
#90 personal

Visit catonmat.net → RSS feedOn Hacker News May 2008 – Nov 2024

Software Engineering 42Tools & Productivity 18Math & Algorithms 9Web & Frontend 7Systems & Performance 7Startups 5

1

My favorite regex of all time

I thought I'd share my favorite regex of all time. [ -~] Any idea what this regexp matches? Scroll down for the answer. . . . . . . . . It matches all ASCII characters from the space to tilde. What are these characters? These are all printable characters! Take a look at this ASCII table. Printable characters start…

5

Something about functions in Bash (2017)

Here's something you didn't know about bash functions. Usually when you write a function you do this: function name () { ... } Right? I know you do, because that's how everyone writes functions. Well, here's the thing. In bash { ... } doesn't mean "function's body" or "function's scope" as in JavaScript or C. It's...

6

A Unix Utility to Know About: lsof (2009)

This is the third post in the article series about Unix and Linux utilities that you should know about. In this post I will take you through the useful lsof tool. If netcat was called the Swiss Army Knife of Network Connections, then I'd call lsof the Swiss Army Knife of Unix debugging. Lsof follows Unix philosophy...

9

Introduction to sed

sed book This is the world's best introduction to sed - the superman of UNIX stream editing. Originally I wrote this introduction for my second e-book, however later I decided to make it a part of the free e-book preview and republish it here as this article. Introduction to sed Mastering sed can be reduced to...

14

Follow Hacker News from the Console

Here is something neat that I hacked together – a `top' like Python program called Hacker Top that allows you to follow Hacker News from a UNIX terminal! 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...

15

Python Library for Google Translate

I have extended my xgoogle library with a Python module for Google Translate. The new module is called "xgoogle.translate" and it implements two classes - "Translator" and "LanguageDetector". The "Translator" class can be used to translate text. It provides a function called "translate" that takes three arguments -...

16

Bithacks.h - bit hack macros

A part of being a great programmer is having your personal code library. With a personal code library I mean a repository of code that you have an intimate knowledge of and that you can reuse quickly. If you are a C programmer, you don't want to reimplement linked lists, trees, various utility functions, macros and...

17

Why Vim uses hjkl keys as arrow keys

I was reading about vim the other day and found out why it used `hjkl` keys as arrow keys. When Bill Joy created the vi text editor he used the ADM-3A terminal, which had the arrows on hjkl keys. Naturally he reused the same keys and the rest is history. Here is how the `hjkl` keys looked. ADM-3A keyboard's hjkl…