Fish shell Add a directory to the path, but only if it exists

Add a directory to the path, but only if it exists.

function add_path_maybe -d "Add a directory to the path, but only if it exists"
    # If the path exists...
    if test -d $argv[1]
        # ...and if it's not already in the PATH...
        if not contains $argv[1] $PATH
            # ...push it to the start of the path.
            set PATH $argv[1] $PATH
        end
    end
end

htaccess if the host matches

It is a hassle to have different configurations in development and production. Often it is required to protect the new webpage with user and password. Publishing that config on production on the other hand would be fatal.
With Apache 2.4 that is pretty easy done

<If "%{HTTP_HOST} == 'stage.example.com'">
    AuthType basic
    AuthName "private"
    AuthUserFile /home/example/.htpasswd
    Require valid-user
</If>

Posts Tagged config

Archives by Month: