Skip to content

Instantly share code, notes, and snippets.

View unfor19's full-sized avatar
😺

Meir Gabay unfor19

😺
View GitHub Profile
@unfor19
unfor19 / multi-stage-build-good.Dockerfile
Created February 12, 2021 13:50
multi-stage-build-good-dockerfile
# GOOD
FROM python:3.9.1-slim as build
# Upgrade pip and then install build tools
RUN pip install --upgrade pip && \
pip install --upgrade wheel setuptools wheel check-wheel-contents
### Consider the comments as commands
# Copy and install requirements - better caching
@unfor19
unfor19 / multi-stage-build-bad.Dockerfile
Created February 12, 2021 13:49
multi-stage-build-bad-dockerfile
# BAD - Not that bad, but it could be better
FROM python:3.9.1-slim
# Upgrade pip and then install build tools
RUN pip install --upgrade pip && \
pip install --upgrade wheel setuptools wheel check-wheel-contents
# Copy and install requirements - better caching
COPY requirements.txt /code/
@unfor19
unfor19 / order-of-commands-good.Dockerfile
Created February 12, 2021 13:48
order-of-commands-good-dockerfile
# GOOD
# Copy and install requirements - only if requirements.txt was changed
COPY requirements.txt /code/
RUN pip install --user -r "requirements.txt"
# Copy everything from the build context
COPY . /code/
@unfor19
unfor19 / order-of-commands-bad.Dockerfile
Last active February 12, 2021 13:48
dockerfile-order-of-commands-bad
# BAD
# Copy everything from the build context
COPY . /code/
# Install packages - on any change in the source-code
RUN pip install --user -r "requirements.txt"
@unfor19
unfor19 / aws-sdk-golang-resourcegroupstaggingapi.go
Last active February 3, 2021 10:47
An example of how to use AWS SDK Resource Groups Tagging API (resourcegroupstaggingapi) in GoLang
/*
### Resource Groups Tagging API
GoLang SDK Docs: https://docs.aws.amazon.com/sdk-for-go/api/service/resourcegroupstaggingapi/
The package resourcegroupstaggingapi provides the client and types for making API requests to AWS Resource Groups Tagging API.
This example was written especially for GoLang newcomers (like me).
Scenario: Getting all resources ARNs which are tagged with "APP_NAME = api-group"
Given: There are two resources that are tagged with "APP_NAME=api-group", both are S3 buckets
###
  • Using the help flag

    bash example.sh -h
    
    Usage: bash example.sh -n Willy --gender male -a 99
    
          --person_name  |  -n  [Willy]              What is your name?
          --age          |  -a  [Required]
          --gender       |  -g  [Required]
  • Using the help flag

    bash example.sh -h
    
    Usage: bash example.sh -n Willy --gender male -a 99
    
          --person_name  |  -n  [Willy]              What is your name?
          --age          |  -a  [Required]
          --gender       |  -g  [Required]
  • Using the help flag

    bash example.sh -h
    
    Usage: bash example.sh -n Willy --gender male -a 99
    
          --person_name  |  -n  [Willy]              What is your name?
          --age          |  -a  [Required]
          --gender       |  -g  [Required]
  • Using the help flag

    bash example.sh -h
    
    Usage: bash example.sh -n Willy --gender male -a 99
    
          --person_name  |  -n  [Willy]              What is your name?
          --age          |  -a  [Required]
          --gender       |  -g  [Required]
#!/bin/bash
source bargs.sh "$@"

echo -e \
"Name:~$person_name\n"\
"Age:~$age\n"\
"Gender:~$gender\n"\
"Location:~$location" | column -t -s "~"