Skip to content

Instantly share code, notes, and snippets.

View run-tasks-in-parallel.bash
#!/usr/bin/env bash
set -euo pipefail
declare -r IFS=$'\n'
declare -r SPAWNED_LIST=$(mktemp)
declare -r SPAWNED_LIMIT=20
task() {
View how-to-facilitate-a-retrospective.md

How to facilitate a retrospective

The role of Facilitator is fundamental for almost every meeting. The Facilitator ensures that the whole group is empowered to make decisions and that every individual has their voice heard.

During a retrospective, the Facilitator role is crucial. In a retrospective, it is ideal that everyone has at least some degree of participation, and it is the Facilitator that helps the participants with that.

@henriquemoody
henriquemoody / see-also.bash
Created December 11, 2018 12:41
Updates "See also" section for the Respect\Validation rules.
View see-also.bash
declare -A REFERENCES
while read filename; do
declare rule=$(cut -d '/' -f 2 <<< "${filename}" | cut -d '.' -f 1)
declare related_rules=$(
egrep '\[.+\]\(.+\.md\)' "${filename}" |
sed -E 's,.*\[.+\]\((.+)\.md\).*,\1,' |
egrep -v '(ComparableValues|BaseAccount|Vxdigit)'
)
for related_rule in ${related_rules}; do
View convertObject.php
<?php
// Based on https://stackoverflow.com/questions/965611/forcing-access-to-php-incomplete-class-object-properties
function convertObject($object, string $from, string $to)
{
// Serialize
$serialized = serialize($object);
// Replace the object-type
$objectReplaced = preg_replace(
@henriquemoody
henriquemoody / add-authors
Last active November 30, 2018 08:18
Example: list-authors name/of/file
View add-authors
#!/usr/bin/env bash
# Usage: {script} FILENAME
# Add the list of authors to a PHP or PHPT file.
# The list of authors is generated by the `git blame` command.
#
# --help, -h Displays this help
#
# Report bugs to Henrique Moody <henriquemoody@gmail.com>.
#
View git-fixup
#!/usr/bin/env bash
# Usage: {script} PATH
# Construct a commit message for use with rebase --autosquash.
#
# The commit message will be the subject line from the specified commit with a
# prefix of "fixup! " and will contain the changes on the PATH.
#
# --help, -h Displays this help
#
# Report bugs to Henrique Moody <henriquemoody@gmail.com>
@henriquemoody
henriquemoody / restbash
Last active October 8, 2015 19:23
A REST client written in Bash
View restbash
#!/usr/bin/env bash
# Usage: {script} SCRIPT
#
# --dry-run Displays the request but doesn't not perform it.
#
# Report bugs to Henrique Moody <henriquemoody@gmail.com>
#
if [[ -z "${1}" ]] || [[ ! -f "${1}" ]]; then
sed -E 's/^#\s?(.*)/\1/g' "${0}" |
@henriquemoody
henriquemoody / br-cities.php
Last active June 1, 2020 12:50
Lista de cidades brasileiras com base nos dados o IBGE
View br-cities.php
<?php
return [
// http://www.cidades.ibge.gov.br/download/mapa_e_municipios.php?uf=ac (Thu May 14 16:30:15 BRT 2015)
'AC' => [
1200013 => 'Acrelândia',
1200054 => 'Assis Brasil',
1200104 => 'Brasiléia',
1200138 => 'Bujari',
1200179 => 'Capixaba',
View country-subdivision.bash
#!/usr/bin/env bash
set -e
declare DIRECTORY=$(dirname "${BASH_SOURCE}")
declare URL="${1}"
declare ENTRY=$(echo "${1}" | cut -d '/' -f 4)
declare FILE_HTML="${DIRECTORY}/html/${ENTRY}.html"
declare FILE_TEXT="${DIRECTORY}/text/${ENTRY}.text"
View mysql_backup.bash
#!/usr/bin/env bash
set -e
DATE_FORMAT="%Y-%m-%d"
DATE_CREATION=$(date "+${DATE_FORMAT}")
DATE_REMOVAL=$(date -d "20 day ago" "+${DATE_FORMAT}")
DIRECTORY_BASE="/backup/mysql"
DIRECTORY_CREATION="${DIRECTORY_BASE}/${DATE_CREATION}"