Skip to content

Instantly share code, notes, and snippets.

View Rodrigonavarro23's full-sized avatar
:octocat:
On fire

Rodrigo Navarro Rodrigonavarro23

:octocat:
On fire
View GitHub Profile
@jesselucas
jesselucas / changroup.go
Last active April 17, 2024 14:33
Simple solution for using a WaitGroup with select{}
package main
import (
"fmt"
"sync"
"time"
)
func main() {
// Create a wait group of any size
@mrbar42
mrbar42 / graceful.sh
Last active June 12, 2023 20:10
graceful exit for bash script with background children/subshells
#!/usr/bin/env bash
graceful_exit() {
# include this line: trap graceful_exit TERM INT HUP
echo "Exit requested..."
local timeout=${1:-4}
local list=""
for c in $(ps -o pid= --ppid $$); do
# request children shutdown
kill -0 ${c} 2>/dev/null && kill -TERM ${c} && list="$list $c" || true

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a