Software developer interested into security and sustainability.

  • 0 Posts
  • 18 Comments
Joined 2 years ago
cake
Cake day: July 3rd, 2023

help-circle
  • It all makes sense when you think about the way it will be parsed. I prefer to use newlines instead of semicolons to show the blocks more clearly.

    for file in *.txt
    do
        cat "$file"
    done
    

    The do and done serve as the loop block delimiters. Such as { and } in many other languages. The shell parser couldn’t know where stuff starts/ends.

    Edit: I agree that the then/fi, do/done case/esac are very inconsistent.

    Also to fail early and raise errors on uninitialized variables, I recommend to add this to the beginning of your bash scripts:

    set -euo pipefail
    

    Or only this for regular sh scripts:

    set -eu
    

    -e: Exit on error

    -u: Error on access to undefined variable

    -o pipefail: Abort pipeline early if any part of it fails.

    There is also -x that can be very useful for debugging as it shows a trace of every command and result as it is executed.











  • Nginx is pretty easy to set up. Look up “nginx virtual hosts”. You might want to use certbot/acme if you don’t have SSL certificates for your domain names. You need either a wildcard certificate (*.example.com), a certificate with SAN (Subject Alternative Name) containing the second subdomain, or two certificates (one for each subdomain). Note that subdomains can be found more easily than path based websites, if you allow connections from the whole WAN.



  • I do not have a lot of experience with commerce but you’re supposed to optimize the customer experience. If the customer needs an account to add something to the cart, he might abandon his purchase during the account creation process.

    Only some percentage of all potential users will abandon the purchase due to something like this, but your goal is to reduce this percentage as much as possible.

    That’s why analytics are used to understand which environment leads to the most purchases and prevent users from abandoning the process.