This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Description: Select .torrent file to upload to seed box. | |
# Usage: $ seedbox | |
# Author: Josué CAU <me@josuecau.com> | |
# Version: v0.1.1 | |
# Dependencies: fzf(1) | |
# Env: SEEDBOX_ADDRESS | |
set -e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Convert FLAC to MP3 using ffmpeg(1) | |
# Source: https://stackoverflow.com/a/26109838/2397516 | |
set -e | |
if [ $# -lt 1 ]; then | |
echo "Usage: $(basename "$0") /files/to/convert" | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Certbot with Docker and Cloudflare DNS Authenticator plugin | |
# https://certbot.eff.org | |
# https://github.com/certbot/certbot/tree/master/certbot-dns-cloudflare | |
docker run -it --rm --name certbot \ | |
-v '/etc/letsencrypt:/etc/letsencrypt' \ | |
-v '/etc/cloudflare.conf:/etc/cloudflare.conf' \ | |
-v '/var/lib/letsencrypt:/var/lib/letsencrypt' \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
input="${1:-/dev/stdin}" | |
awk '{s+=$1} END {print s}' "$input" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Convert JSON to CSV using jq(1) | |
# Source: https://stackoverflow.com/a/32967407 | |
[ $# -ge 1 -a -f "$1" ] && input="$1" || input="-" | |
jq -r '(.[0] | keys_unsorted) as $keys | $keys, map([.[ $keys[] ]])[] | @csv' $input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Recursive search & replace | |
# Usage: search-replace SEARCH REPLACE [/path/to/search] | |
# Author: Josué Cau <me@josuecau.com> | |
# Version: v1.0.0 | |
if [ $# -lt 2 ]; then | |
echo "Usage: $(basename "$0") SEARCH REPLACE [/path/to/search]" | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Description: convert a Markdown file to a HTML file using pandoc(1) | |
# Usage: markdown INPUT_FILE.md" | |
# Version: 1.0.2 | |
# Author: Josué Cau <me@josuecau.com> | |
set -e | |
if [ $# -eq 0 ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
sudo sntp -s 178.33.111.48 && date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Install rclone(1) binary | |
# More info: https://rclone.org/install/ | |
set -e | |
echo 'Downloading archive…' | |
wget -q -O /tmp/rclone-current-linux-amd64.zip \ | |
https://downloads.rclone.org/rclone-current-linux-amd64.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Permet d'utiliser PHP-CS-Fixer en mode stdin/stdout, | |
# par exemple dans Vim avec `equalprg` | |
# | |
cmd=php-cs-fixer | |
hash "$cmd" 2>/dev/null || exit 1 | |
tmp=$(mktemp) | |
tee > "$tmp" |