Friedrich Ewald My Personal Website

Posts


  • VIM cheatsheet

    A cheatsheet for vom can be found here. I find this quite useful to begin with this powerful editor. The most important keys, if you just want to edit a file are:

    • i insert
    • esc exit insert mode
    • j move cursor down
    • k move cursor up
    • h move cursor left
    • l move cursor right
    • :w write (append the filename)
    • :q quit
    • :q! quit and do not save changes

  • 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 0.0.0.0:22              0.0.0.0:*               LISTEN
    tcp        0      0 0.0.0.0:3128            0.0.0.0:*               LISTEN
    tcp6       0      0 :::22                   :::*                    LISTEN
    udp        0      0 0.0.0.0:39790           0.0.0.0:*
    udp        0      0 0.0.0.0:68              0.0.0.0:*
    udp        0      0 0.0.0.0:41121           0.0.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:
    [alias]
    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
    

Page: 24 of 26