Skip to content

Instantly share code, notes, and snippets.

View mariuscucuruz's full-sized avatar
💭
typing...

Marius Cucuruz mariuscucuruz

💭
typing...
View GitHub Profile
@mariuscucuruz
mariuscucuruz / docker-build-push.sh
Created February 15, 2024 15:33
Docker: build & push images for given environment
#!/bin/bash
## This program accepts an environment name (local, staging, prod) and
## expects respective Dockerfiles (for these suported environments) to
## exist in specific directory (i.e. `docker/$environment.Dockerfile`).
## It will then copy the respective Dockerfile to the root directory,
## and build with the Docker images with it, bofore prompting to push
## to your account on Docker Hub.
ImageName='app-service'
@mariuscucuruz
mariuscucuruz / .env
Last active February 15, 2024 15:41
Run Wordpress website behind nGinx, on Docker, with SSL via Lets Encrypt
# normally (on Linux) your user / group has the ID 1000
UID=1000
GID=1000
WEBUSER=host-user
WEBGROUP=host-group
APP_PORT=9000
APP_NAME="My WordPress Website"
APP_SERVER_PORT=3000
APP_PREFIX=my-website
@mariuscucuruz
mariuscucuruz / shell-can-take-three-arguments.sh
Created February 15, 2024 15:03
BASH: assign CLI positional argument to local variables
#!/bin/bash
### assign variables from CLI (posibional arguments)
first_user_arg="$1"
second_user_arg="$2"
third_user_arg="$3"
### have a default value to fallback on:
first_user_arg=${first_user_arg:-"default 1st value"}
@mariuscucuruz
mariuscucuruz / git-shortcuts.sh
Last active February 15, 2024 15:42
Shell Git aliases: Fetch Pull Update Rebase Stash
#!/bin/bash
# run `gupdate` to safely update your local branch
alias gfetch="git fetch origin && git pull origin --ff-only"
alias gpull="git pull origin --ff-only"
alias grebase="git pull origin --rebase"
alias gupdate="gfetch && gpull || grebase || git stash && grebase || echo \"encountered issues\" && git pop"
function gstash() {
if [[ -n $1 ]]; then