Skip to content

Instantly share code, notes, and snippets.

@m-radzikowski
m-radzikowski / script-template.sh
Last active May 4, 2024 04:13
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@bobvanderlinden
bobvanderlinden / README.md
Last active March 9, 2023 16:39
Example GraphQL call towards GitHub using curl and jq

This is an example how to do GraphQL queries in a somewhat sane way in bash using curl and jq.

The example does an query towards GitHub to fetch the commit SHAs of open pull requests for a specific repository.

The example needs the environment variables REPO_OWNER, REPO_NAME and GITHUB_TOKEN to be set.

@tjperovich
tjperovich / slack-persist-notification.js
Last active May 13, 2016 15:07
Prevents Slack Desktop Notifications from closing themselves after 5/10 seconds has passed.
// ==UserScript==
// @name Persist Slack Desktop Notification
// @version 1.0
// @author TJP
// @match https://custom-domain.slack.com/messages/*
// @description Prevents Slack notifications from closing themselves.
// @grant none
// ==/UserScript==
window.oldSetTimeout = window.setTimeout;