Friedrich Ewald My Personal Website


  • Big O notation for many datatypes

    An interesting site which shows the Big O notation for all many commonly used datatypes is the Big O Cheatsheet.

  • Show open ports on the linux shell

    If you want to show all the currently open ports on linux, just use the following command:

    netstat -lntu

    This gives you the following output:

    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State
    tcp        0      0    *               LISTEN
    tcp        0      0  *               LISTEN
    tcp6       0      0 :::22                   :::*                    LISTEN
    udp        0      0 *
    udp        0      0    *
    udp        0      0 *
    udp6       0      0 :::57063                :::*
    udp6       0      0 :::42147                :::*

    Found here

  • Using git efficiently on the console

    I was looking for ways to visualize the progress of a project and also I wanted to do this with on-board tools. After a quick search I found the following command.

    git log --graph --decorate --oneline

    This gives a nice and colorful overview when what branch was touched and how it was merged. To display the results in a nicer way, a alias in the ~/.giconfig helps:

    lg = !"git lg1"
    lg1 = !"git lg1-specific --all"
    lg2 = !"git lg2-specific --all"
    lg3 = !"git lg3-specific --all"
    lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
    lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
    lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%

    The last speed trick is, to set an alias in the ~/.bashrc. This saves 2/3 of the letters.

    alias g='git'

  • Combining multiple CSV files to one

    If you have multiple CSV files with the same format and you want to combine them to just a single file, just do

    cat file1.csv file2.csv > output.csv

    Or even simpler

    cat *.csv > output.csv

  • Counting lines of a text file

    To count lines of one or many files on the shell I use wc (Wordcount). If you want to count all lines of all CSV files in a dictionary, just type:

    wc -l *.csv

Page: 16 of 18