Skip to content

Instantly share code, notes, and snippets.

View matheusneder's full-sized avatar

Matheus Neder matheusneder

View GitHub Profile
#!/bin/bash
NS=$1;
if [ -z "$NS" ]
then
echo "Usage: $0 namespace" >&2
exit 1;
fi
#!/bin/bash
set -e
# Migrate VSTS release pipelines agent
function get-vsts-creedentials
{
echo -n "_:$VSTS_TOKEN" | base64 -w 0
}
#!/bin/bash
set -e
if [ -z "$HELM_APPLY_REPO" ]
then
echo "Falta a variavel de ambiente 'HELM_APPLY_REPO'." >&2
exit 1
fi
#!/bin/bash
set -e
TOKEN=xxx
AUTH="Basic $(echo -n $TOKEN: | base64)"
SONARAPI="http://sonarqube/api"
for projKey in $(curl -s -X GET $SONARAPI/projects/search -H "Authorization: $AUTH" | \
jq -r '.components[].key')
#!/bin/bash
# Required enviroment variables:
# VSTS_BASE_URL (ex: https://YOUR_ORG.visualstudio.com/)
# VSTS_TOKEN (ex: xpto...)
# VS_DEVENV (ex: "/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/devenv.exe")
set -e
function extract-branch-name
# usage: kubectl get pod THE_POD_NAME -json | dockerinfo
alias dockerinfo="jq '{ name: .metadata.name, nodeName: .spec.nodeName, containers: [ .status.containerStatuses[] | { image: .image, containerID: .containerID } ]}'"
public class OtcApiVersionActionSelector : ApiVersionActionSelector
{
public OtcApiVersionActionSelector(IActionDescriptorCollectionProvider actionDescriptorCollectionProvider, ActionConstraintCache actionConstraintCache, IOptions<ApiVersioningOptions> options, ILoggerFactory loggerFactory, IApiVersionRoutePolicy routePolicy) : base(actionDescriptorCollectionProvider, actionConstraintCache, options, loggerFactory, routePolicy)
{
}
public override ActionDescriptor SelectBestCandidate(RouteContext context, IReadOnlyList<ActionDescriptor> candidates)
{
if (context == null)
{
#!/bin/bash
NAMESPACE=$1
if [ -z $NAMESPACE ]
then
echo "Usage: $0 namespace"
exit 1
fi
@matheusneder
matheusneder / pretty-json-output
Last active July 8, 2019 11:35
Format and colorize json output
#!/bin/bash
JQ_OUTPUT=$(mktemp)
cat /dev/stdin | while read -r l;
do
if echo $l | jq -C '.' > $JQ_OUTPUT 2>&1
then
cat $JQ_OUTPUT
else