Skip to content

Instantly share code, notes, and snippets.

View themarcelor's full-sized avatar
🎓
crescat scientia, vita excolatur

Marcelo R Costa themarcelor

🎓
crescat scientia, vita excolatur
View GitHub Profile

Keybase proof

I hereby claim:

  • I am themarcelor on github.
  • I am themarcelor (https://keybase.io/themarcelor) on keybase.
  • I have a public key whose fingerprint is 38AE 9DF4 8185 541C 726B 0ED3 08D2 8838 B224 E304

To claim this, I am signing this object:

############ User input for AWS Access key and AWS Secret key
echo "Please provide your S3 Access Key: "
read -s AWSID
echo "Please provide your S3 Secret key:"
read -s AWSSEC
calculate_signature () {
AWSSEC=$1
x_amz_date_short=$2
@themarcelor
themarcelor / docker_cleanup_notes.sh
Created June 30, 2018 10:36
cleaning up old Docker containers
# easy
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
# meh
# docker ps -a | tail -n +2 | awk '{print $1}' | xargs -I {} docker rm {}
@themarcelor
themarcelor / nginxpodchecker.go
Created July 4, 2018 00:30 — forked from yifan-gu/nginxpodchecker.go
nginx pod checker
package main
import (
"fmt"
"os"
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/api"
@themarcelor
themarcelor / DetectPrime.scala
Created January 14, 2019 20:55
Scala snippet for study purposes
import scala.util.control.Breaks._
object DetectPrime {
def isPrime(num: Int):Boolean = {
if (num == 1) {
false
} else if (num == 2) {
true
} else {
array = [[1,2,[3]],4]
def unpack(arr, flatten = []):
for i in arr:
if isinstance(i, list):
unpack(i, flatten)
else:
flatten.append(i)
return flatten
@themarcelor
themarcelor / testing_yamlfmt.txt
Created June 11, 2019 21:38
Using yamlfmt to get rid of white spaces
% cat test.yaml | grep -B1 " config_helper" | tr " " "*"
**************mountPath:*"/var/www/sheepdog/config_helper.py"
**************subPath:*config_helper.py**
% yamlfmt test.yaml -w
% cat test.yaml | grep -B1 " config_helper" | tr " " "*"
**********mountPath:*/var/www/sheepdog/config_helper.py
**********subPath:*config_helper.py
@themarcelor
themarcelor / postman-pre-request-script.js
Created November 18, 2019 22:32
Postman Pre-Request Script to constantly obtain a valid ACCESS TOKEN: Assumes a `python3 -m http.server` running against a ~/.gen3 folder that contains the target environment's `credentials.json` (with the API KEY).
function get_api_key_and_then_the_access_token() {
return new Promise(async(resolve) => {
const get_resp = await pm.sendRequest({
url: 'http://localhost:8000/credentials.json'
},
function (err, response) {
//console.log('req_resp: ' + response.json()['api_key']);
resolve(get_access_token(response.json()['api_key'],
pm.environment.get('TARGET_ENVIRONMENT')));
});
Feature('This is a just a test');
const readline = require("readline");
const fenceProps = require('../../services/apis/fence/fenceProps.js');
const chai = require('chai');
const {interactive, ifInteractive} = require('../../utils/interactive.js');
const { Gen3Response, getAccessTokenHeader } = require('../../utils/apiUtil');
const expect = chai.expect;
// this should be included in the core lib
@themarcelor
themarcelor / allure-deployment.yaml
Created November 26, 2019 18:13
allure k8s deployment & service descriptors
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: allure-deployment
labels:
app: allure
spec:
selector:
# Only select pods based on the 'app' label
matchLabels: