Sunday 14 October 2018

Linux: permanently update your PATH.

To permanent change your PATH:

  1. Locate your profile file. This is your user-specific initialization file for your shell and you can find it in the root of your home directory (~). It can be named slightly differently depending on your distribution and the type of shell you are using (.bash_profile, .zprofile, etc.), but it's really not easy to miss. In my case (Fedora & bash), my profile file is named .bash_profile.
  2. Make desired changes to your PATH. There's a good chance the file already has some PATH changes, so just append yours.

    # .bash_profile
    
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
     . ~/.bashrc
    fi
    
    # User specific environment and startup programs
    
    PATH=$PATH:$HOME/.local/bin:$HOME/bin
    PATH=$PATH:~/Documents/rebar3
    
    export PATH
    

  3. Now for the changes to take effect you can either simply log out and log back in or run:

    source ~/.bash_profile
    

    That will basically execute the command defined in ~/.bash_profile using your current shell.
And that's it.

Thank you and happy hacking!

Piotr

Friday 13 April 2018

Haskell & Yesod - sample REST API.

Here's a sample Haskell & Yesod application demonstrating a basic REST API. It could serve as a starting point of a toy project: Haskell & Yesod - REST API.

I wrote this application as a supplement to the "RESTful Content" chapter of the "Haskell and Yesod" book. I felt the examples given in that chapter, while good, could be further developed into a working application (with IO, custom types, etc.).

Your feedback is welcome and please expect some changes to that application as time goes on.

Happy hacking,
Piotr