Ángel Ortega III

Un naufragio personal


My preferred way of C code formatting

They mean: Kerninghan & Ritchie indentation, 4 spaces, no cuddled else, no tabs.

 indent -kr -i4 -nce -nut *.c

I previously used:

 indent -kr -i8 -nce *.c

Setting global git variables

 git config --global user.name "Angel Ortega"
 git config --global user.email angel@triptico.com

Building a point-to-point VPN (SSH tunnel) in one line

 pppd noauth \
     pty 'ssh root@REMOTE_HOST pppd notty noauth'

The remote host needs a passwordless authorized key.

Redirecting a full site to https

 <Location />
        RewriteEngine on
        RewriteRule ^/(.*)$ https://%{HTTP_HOST}/$1

Perl one-liner to know the length of an MP3 song

 perl -MMP3::Info -e '$i = get_mp3info($ARGV[0]); \
   printf "%d:%d", $i->{MM}, $i->{SS};' song.mp3