New lines before prompt (Bash, Fish)

Fish_Shell_new_linesThe following script adds two empty lines before every new command line prompt using fish shell.

mkdir -p ~/.config/fish/functions
echo 'function fish_prompt 
    set_color $fish_color_cwd 
    echo "" 
    echo "" 
    echo "" 
    echo -n (prompt_pwd) 
    set_color normal 
    echo -n " > " 
end' > ~/.config/fish/functions/fish_prompt.fish

 

The following command adds the leading empty lines in bash:

echo "export PS1='\n\n$ '" >> ~/.bashrc

SSH Public/Private-Key Login Generator 2.0

SSH_Public_Private_Key_Loin_GeneratorThis little script offers the following functionalities:

  • Install new public/private ssh key to log in without username / password
  • Install existing public key on multiple remote server
  • Register private key locally

After installation of your (new) keys you will be able to login to your server without user / password credentials.

Download (or contribute) on gitHub

„SSH Public/Private-Key Login Generator 2.0“ weiterlesen

Programming Languages – Simple Speed Test

swift-heroI wrote a very basic speed test in SwiftJavaJavaScript, C / C++, PythonRuby, and Perl. Awesome is the speed of Swift. It’s up to two times faster than Java und up to 3 times faster than C / C++ depending which function will be used. For this test I implemented the following simple function:

    long sum = 0;
    for (Integer n = max; n > 0;  n--) {
        double foo = n / 17;
        sum = sum + n ;
    }

I published the test on gitHub. If you want to implement more complex / meaningful tests or found a bug please please contribute some code. ?

https://github.com/AndreasPrang/Programming-Languages-Speed-Test

 

Language wiime Elapsed
Swift 232ms
Java 518ms
JavaScript 606ms
C 1016ms
Objective-C 1062ms
C++ 1065ms
Python 7796ms
Ruby 8666ms
Perl 19673ms

HowTo: Remove all Docker Images and Containers (disk full)

Docker_(container_engine)_logoIf you’re developing docker containers, after a while you might notice one very big file:

/var/lib/docker/devicemapper/devicemapper/data

The get ride off old unused docker images and containers and refuce the data-file use this two commands:

#!/bin/bash

# Delete all containers
docker rm $(docker ps -a -q)

# Delete all images
docker rmi $(docker images -q)