Skip to content

Instantly share code, notes, and snippets.

View allanpedroni's full-sized avatar
🎯
Focusing

Allan Barros allanpedroni

🎯
Focusing
View GitHub Profile
@allanpedroni
allanpedroni / pr-length
Created March 4, 2020 16:26
get length of lines changed between local and master. there is some conditions with exclusions.
#!/bin/bash
diff_shortstat=$(git diff --shortstat master -- ":*.cs" ":(exclude)*Tests/*")
insertions=$(echo $diff_shortstat | grep -Po '\K[0-9]+(?= insertions?)' || echo "0")
deletions=$(echo $diff_shortstat | grep -Po '\K[0-9]+(?= deletions?)' || echo "0")
total_lines=$(( insertions + deletions ))
ignored_lines=$(git diff master -- ":*.cs" ":(exclude)*Tests/*" | egrep -c "^[+-]\s*(\/\/.*|)$")
total=$(( $total_lines - $ignored_lines ))
echo "$total linha(s) adiciona(s) e removida(s)"
@allanpedroni
allanpedroni / pr-trello
Last active November 1, 2019 13:43
#install colorama, urllib
#!/usr/bin/env python
# TODO: search
# - https://docs.python.org/3/library/json.html
# - https://docs.python.org/3/library/urllib.request.html#module-urllib.request
import json
import os
import sys
import urllib.parse as parse
@allanpedroni
allanpedroni / reply-email-pr
Last active November 1, 2019 13:43
#install colorama, urllib and Template
#!/usr/bin/env python
# Get your Key and Token from trello here -> https://developers.trello.com/page/authorization.
# Ps: First You need to logged in trello to get key and token.
import json
import os
import sys
import urllib.parse as parse
import urllib.request as req
@allanpedroni
allanpedroni / extract.py
Created September 3, 2019 19:20 — forked from briglx/extract.py
Extract Email from Outlook with Python
import win32com.client
items = []
def encodeit(s):
if isinstance(s, str):
return unicode(s, 'utf-8')
else:
return s
#!/usr/bin/env bash
GIST_ID=${1}
# Check if the GIST_ID param has a value
if [ -z "$GIST_ID" ];
then
echo 'GIST_ID is a required parameter';
else
#!/bin/bash
# PRE-REQ
# - INSTALL JQ
# - Required enviroment variables:
# export VSTS_BASE_URL = "(ex: https://YOUR_ORG.visualstudio.com/)"
# export VSTS_TOKEN = "(ex: xpto...)"
# export VS_DEVENV = "(ex: "/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/devenv.exe")"
set -e
@allanpedroni
allanpedroni / pretty-json-output
Created July 8, 2019 11:35 — forked from matheusneder/pretty-json-output
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