Skip to content

Instantly share code, notes, and snippets.

View marcelotmelo's full-sized avatar

Marcelo T. de Melo marcelotmelo

View GitHub Profile
@marcelotmelo
marcelotmelo / Makefile
Created January 7, 2022 17:14
Poetry Makefile
PHONY: clean requirements build setup venv lint format test
clean:
@rm -f requirements.txt
@rm -rf app/__pycache__ tests/__pycache__
build: requirements
@docker build --rm .
requirements: clean
#!/bin/bash
# needs imagemagick
set -e
help() {
echo "Adds a watermark text to an image. Generates a new image file with the given watermark."
echo "Usage: $0 <source> <destination> <watermark> [size]"
echo -e "\tsource: The original image file which the watermark text will be added to."
echo -e "\tdestination: The generated image with the watermark text added."
aws ec2 describe-instances | jq -j '.Reservations[].Instances[] | (.PrivateIpAddress), ": # ", (.Tags[] | select(.Key=="Name") | .Value), "\n"' | sort -n
#list all volumes
docker volume ls | awk '{if(NR>1) print $2}' | sort > all_volumes
#list currently used volumes
docker ps -a | awk '{if(NR>1)print $1}' | xargs docker inspect | tr -d '\n' | grep -Po '"Mounts":.*?[^\\]",' | awk '/Name/ {print $5}' | tr -d '"' | tr -d ',' > used_volumes
#remove unused volumes
diff used_volumes all_volumes --suppress-common-lines | grep '>' | awk '{print $2}' | xargs docker volume rm
@marcelotmelo
marcelotmelo / svn-helpers.md
Last active January 11, 2016 13:14
Shell SVN helpers

#####Listing the nth revision from a given repository (replace size with the desired revision number and repo_url with the actual repository url):

svn log -l size -q repo_url | tr -d '-' | cut -d"|" -f 1 | tr -d 'r' | tail -n 2 | tr -d [[:space:]]

It will output a single number.

// ==UserScript==
// @version 0.14
// @name Controle de Frequencia - Somar horas mes
// @author marcelotmelo (https://github.com/marcelotmelo)
// @namespace http://www.mec.gov.br/
// @description Calcula o saldo de horas a partir do controle de frequencia do MEC
// @updateURL https://gist.github.com/marcelotmelo/4c630378bc69e335c6c6/raw/e716c63b654f4da985f78ba625e386321b948729/intramec-saldo-horas-mes.user.js
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @match http://10.1.26.151/sistemas/SCF/listaFrequencia.asp?matricula=*&mes=*&ano=*&cpf=*
// @grant GM_addStyle
// ==UserScript==
// @version 0.14.15
// @name Verifica resultado mega-sena
// @author marcelotmelo (https://github.com/marcelotmelo)
// @updateURL https://gist.githubusercontent.com/marcelotmelo/b263e45fd298f04018f8/raw
// @namespace http://marcelotmelo.com
// @description Verifica o ultimo resultado da mega-sena de acordo com numeros pre-definidos
// @match http://loterias.caixa.gov.br/wps/portal/loterias/landing/megasena*
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @copyright marcelotmelo.com
// ==UserScript==
// @version 0.2.7
// @name CA - Atualizar Quadro
// @namespace http://www.mec.gov.br/
// @author marcelotmelo (https://github.com/marcelotmelo)
// @updateURL https://github.com/marcelotmelo/tampermonkey/raw/master/ca-atualizar-quadro.user.js
// @description Atualiza o quadro de solicitacoes do CA
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
// @include http://operacoesti.mec.gov.br*/CAisd/pdmweb.exe?SID=*+FID=*+OP=SEARCH+FACTORY=cr+KEEP.where_clause=*
// @match http://operacoesti.mec.gov.br*/CAisd/pdmweb.exe?SID=*+FID=*+OP=SEARCH+FACTORY=cr+KEEP.where_clause=*
// ==UserScript==
// @version 0.4.6
// @name CA - Atualizar Demanda
// @namespace http://www.mec.gov.br/
// @author marcelotmelo (https://github.com/marcelotmelo)
// @updateURL https://github.com/marcelotmelo/tampermonkey/raw/master/ca-atualizar-demanda.user.js
// @description Atualiza a demanda do CA
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
// @include http://operacoesti.mec.gov.br*/CAisd/pdmweb.exe?SID=*+FID=*+OP=SHOW_DETAIL+FACTORY=*
// @match http://operacoesti.mec.gov.br*/CAisd/pdmweb.exe?SID=*+FID=*+OP=SHOW_DETAIL+FACTORY=*
^([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(([Zz])|([\+|\-]([01][0-9]|2[0-3]):[0-5][0-9]))$