gcloud config set project [PROJECT_ID]gcloud config set compute/zone [COMPUTE_ZONE]gcloud components update
- Create a container cluster: 
gcloud container clusters create [CLUSTER_NAME] - Ensure was created: 
gcloud container clusters list 
| curl -X POST 'https://staging.ebanx.com.br/ws/direct' \ | |
| -d 'request_body={ | |
| "integration_key": "<bcredi-integration-key>", | |
| "operation": "request", | |
| "payment": { | |
| "name": "José Silva", | |
| "email": "[email protected]", | |
| "document": "853.513.468-93", | |
| "address": "Rua E", | |
| "street_number": "1040", | 
| path | |
| |> CsvParser.parse(:stream) | |
| |> Flow.from_enumerable() | |
| |> Flow.map(&cast_contract/1) # will return {:ok, %Contract{}} | {:error, changeset} | |
| |> Flow.map(&apply_blacklist/1) # will return {:ok, %Contract{}} | {:error, changeset} | {:filtered, reason} | |
| |> Flow.partition(key: {:elem, 0}) | |
| |> Flow.group_by(& elem(&1, 0)) | |
| |> Flow.filter(fn | |
| {:error, changeset} -> log_error(changeset) && false | |
| {:filtered, reason} -> log_filtered(reason) && false | 
| #!/bin/sh | |
| # based on https://gist.github.com/ipedrazas/9c622404fb41f2343a0db85b3821275d | |
| # delete all evicted pods from all namespaces | |
| kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod | |
| # delete all containers in ImagePullBackOff state from all namespaces | |
| kubectl get pods --all-namespaces | grep 'ImagePullBackOff' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod | |
| # delete all containers in ImagePullBackOff or ErrImagePull or Evicted state from all namespaces | 
| web: MIX_ENV=prod mix phx.server | 
| // https://stackoverflow.com/questions/51609922/how-to-drill-down-charts-with-chartjs | |
| // https://stackoverflow.com/questions/26257268/click-events-on-pie-charts-in-chart-js | |
| $(document).ready(function() { | |
| var canvas = document.getElementById("myChart"); | |
| var ctx = canvas.getContext("2d"); | |
| var myNewChart = new Chart(ctx, { | |
| type: 'pie', | |
| data: data | |
| }); | 
| # Check if the current cluster is right | |
| kubectl config current-context | |
| # Get the current context access token | |
| TOKEN=$(kubectl describe secret $(kubectl get secrets | grep ^default | cut -f1 -d ' ') | grep -E '^token' | cut -f2 -d':' | tr -d " ") | |
| # Print it :) | |
| echo $TOKEN | |
| # More info: https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/ | 
| def build_export_query(user, batch_size \\ 500) | |
| columns = ~w(id name amount amount_currency cycle first_bill_date type type_description) | |
| query = """ | |
| COPY ( | |
| SELECT #{Enum.join(columns, ",")} | |
| FROM subscriptions | |
| WHERE archived = false | |
| AND user_id = #{user.id} | |
| ) to STDOUT WITH CSV DELIMITER ','; | 
| var MAX_CET = 100000; | |
| var valorCET = 0; | |
| while (true) { | |
| var valorTotal = 0; | |
| for (mes = 1; mes <= gPrazoPagamento; mes++) { | |
| var valorCalculado = parcelasArray[mes - 1].valorParcela / Math.pow((1.0 + valorCET), mes); | |
| valorTotal = valorTotal + valorCalculado; |