This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Does not work if executed as sh | |
#Copy this commit script into prepare-commit-msg | |
BRANCH_NAME=$(git branch 2>/dev/null | grep -e ^* | tr -d ' *') | |
IFS='-' read -r -a array <<< "$BRANCH_NAME" | |
if [ -n "$BRANCH_NAME" ]; then | |
echo " (#$array) $(cat $1)" > $1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* groupArrayByKey | |
* @param array | |
* @param {function(object):number | string} keyExtractorCallback - function to calculate the key | |
* @returns {*} | |
*/ | |
export const groupArrayByKey = (array, keyExtractorCallback) => | |
array.reduce((accumulator, item) => { | |
const key = keyExtractorCallback(item); | |
accumulator[key] = (accumulator[key] || []).concat(item); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CONTAINER_NAME=stepfunctions | |
STATE_MACHINE_DEFINITION=/path/to/yourstatemachine.json | |
STATE_MACHINE_NAME="Name of your process" | |
ENV_FILE=path/to/your-stepfunctions-local-credentials.txt | |
INPUT="{ \"myInput\": \"hello world\"}" | |
function get_value_from_json(){ | |
VALUE="$(jq .$1 temporary.json)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Auth, AuthClass } from "aws-amplify"; | |
export interface IOptions extends RequestInit {} | |
export interface IHttpClient { | |
request(url: string, options: IOptions): Promise<any>; | |
authenticatedRequest(url: string, options: IOptions): Promise<any>; | |
} | |
export class HttpClient implements IHttpClient { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { connect } from "react-redux"; | |
/** | |
* Insert here all the roles | |
*/ | |
const roles = loggedUserId => ({ | |
rootAccount: { | |
static: ["profile:create", "profile:read", "profile:update"], | |
dynamic: { | |
"profile:delete": ownerId => !Boolean(ownerId) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import * as Sentry from "@sentry/browser"; | |
Sentry.init({ | |
dsn: process.env.REACT_APP_SENTRY_DNS | |
}); | |
export default class ErrorBoundary extends React.Component { | |
state = { | |
hasError: false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker volume rm $(docker volume ls -qf dangling=true); | |
docker volume ls -qf dangling=true | xargs -r docker volume rm; | |
docker rmi $(docker images --filter "dangling=true" -q --no-trunc); | |
docker rmi $(docker images | grep "none" | awk '/ / { print $3 }'); # docker rmi $(docker images | tr -s ' ' | cut -d ' ' -f 3) | |
docker rm $(docker ps -qa --no-trunc --filter "status=exited"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
AWS_PROFILE="${AWS_PROFILE:-default}" | |
export AWS_ACCESS_KEY_ID=$(sed -nr "/^\[${AWS_PROFILE}\]/ { :l /^aws_access_key_id[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" "$HOME"/.aws/credentials) | |
export AWS_SECRET_ACCESS_KEY=$(sed -nr "/^\[${AWS_PROFILE}\]/ { :l /^aws_secret_access_key[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" "$HOME"/.aws/credentials) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "unsetting previous aws credentials..." | |
unset AWS_ACCESS_KEY_ID | |
unset AWS_SECRET_ACCESS_KEY | |
unset AWS_SESSION_TOKEN | |
aws sso login && | |
aws sts get-caller-identity > /dev/null && # this refresh the cache | |
echo "sourcing aws credentials" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM public.ecr.aws/bitnami/golang:1.15 AS build-env | |
RUN go get github.com/go-delve/delve/cmd/dlv | |
# Copy the files here, be sure to include the go.mod file. | |
WORKDIR /app | |
RUN go build -gcflags="all=-N -l" -o /server | |
FROM debian:buster |