5 Ways to Security Harden Your Linux System

|

1. Don’t Use FTP or Telnet

I only use SSH to interact with my remote machine. Your Linux distribution should come with SSH tools already installed, but in case it doesn’t, use OpenSSH.

2. Keep Kernel and Software Up to Date

If you use apt:

# apt-get update && apt-get upgrade

Apticron is a package that emails you when security updates are available.

# apt-get install apticron


Proof of the Irrationality of √2

|

The Pythagoreans, a wacky bunch of integer-worshipping Greeks, were so against the notion of irrational numbers that they supposedly murdered the poor soul who leaked their existence. In honor of Hippasus, we’ll prove that $$\sqrt{2}$$ is irrational, ie $$\sqrt{2}$$ can’t be expressed $$\frac{p}{q}$$ for some $$p, q \in \mathbb{Z}$$. We’ll do a proof by contradiction.

Let’s assume $$\sqrt{2}$$ is rational. Then $$\exists a, b, \in \mathbb{Z}: \sqrt{2} = \frac{a}{b}$$. $$a$$ and $$b$$ have a greatest common divisor and by dividing each by the gcd, we obtain an equivalent fraction $$\frac{p}{q}$$ that’s in lowest terms, i.e. $$p, q \in \mathbb{Z}$$, $$q \neq 0$$, $$\gcd{p, q} = 1$$.


Euclid’s Algorithm

|

What’s the greatest common divisor (gcd) of X and Y? It turns out there’s a nice algorithm for calculating this – the Euclidean Algorithm.

Common Divisor Divides Integer Combination

Let $$(D, +, \cdot)$$ be an integral domain.

Let $$c$$ be a common divisor of two elements $$a$$ and $$b$$ of $$D$$, i.e.:

$$ a, b, c \in D: c|a \wedge c|b $$

Then:

$$ \forall p, q \in D: c|(pa + qb) $$

Proof:

$$ \begin{aligned} c|a \implies & \exists x \in D: a = xc\ c|b \implies & \exists y \in D: b = yc\ & \forall p, q \in D: pq + qb = pxc + qyc = (px + qy)c\ \implies & \exists z \in D: pa + qb = zc\ \implies & c | pa + qb \end{aligned} $$


Dieter Rams – Less but Better

|

I just finished reading the monograph Dieter Rams: As Little Design as Possible. The book covers the life and work of the influential German industrial designer whose hundreds of products are still manufactured and whose principles are still practiced.

This was my first introduction to Rams, but I recognized his work in the 606 Universal Shelving System, Braun shavers, and the SK4 record player. These products were so successful they set the standard design for whole classes of products to follow. For example, I’ve never seen a record player without a clear case.


How to Install Vim 7.3 on Ubuntu 10.04 With Ruby and Python Support

|

I wanted to use Vim’s Command-T plugin (via this awesome Vim config) for fast file navigation. But this plugin needs Vim to be compiled with Ruby support since it’s is written in Ruby. You can check with

vim --version

Unfortunately, I saw “-ruby” which means it lacks Ruby support. I was previously using Vim 7.2 on Ubuntu 10.04 Lucid. First I uninstalled my old Vim and installed dependencies required to compile a new one:

sudo apt-get remove vim-common vim-runtime vim-gtk vim-gui-common
sudo apt-get build-dep vim

Then I compiled the latest version of Vim (7.3 as of this writing) from source:

hg clone https://vim.googlecode.com/hg/ vim
cd vim
./configure --enable-pythoninterp --enable-rubyinterp
make
sudo make install

If you don’t have Mercurial hg run:

sudo apt-get install mercurial

Don’t Call Me Smart

|

People often tell me, I’m a “smart” guy. I have two beefs with this statement. It implies that there’s one type of intelligence, usually the logical, analytical kind, and that my smarts are an innate quality rather than an achievement.


David Foster Wallace on American Consumer Culture

|

I recently watched some interviews of David Foster Wallace. It’s fascinating to hear him speak. He’s a deeply intelligent, neurotic, and sentimental man.

My favorite parts are when DFW talks about American consumer culture. He describes the US as “one enormous engine and temple of self-gratification,” which works very well in growing the economy but doesn’t nourish other parts of people.

For young people in America, there are very mixed messages from the culture. There’s a streak of moralism in American life that extols the virtues of being grown up and having a family and being a responsible citizen. But there’s also the sense of do what you want, gratify your appetite because when I’m a corporation, appealing to the parts of you that are selfish and self-centered and want to have fun all the time, is the best way to sell you things…[This is one more example of] the American economic and cultural systems that work very well in terms of selling people products and keeping the economy thriving do not work as well when it comes to educating children or helping us help each other know how to live and to be happy.


How I Increased My WordPress Site’s Speed

|

I spent yesterday optimizing the performance of this site. I love fast page loads and have little patience for sluggish performance. Here’s what I did.

1. Leverage browser caching

Tell your web server to set expiration headers for static resources so browsers know to store them in local disk. This will keep requests off the network altogether. I use Apache:

1
2
3
4
5
6
7
8
9
10
11
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 300 seconds"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType text/javascript "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    ExpiresByType application/x-javascript "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
</IfModule>