-
Abstract: This guide provides best practices for writing clear, maintainable, and robust Zsh scripts. Aimed at helping developers transition from Bash to Zsh, particularly on macOS, this guide offers practical advice and examples for creating standardized and efficient scripts.
-
Copyright This text of this guide is Copyright ©️2024 by Christopher Allen, and is shared under spdx:CC-BY-SA-4.0 open-source license. All the example code is relenquished to the public domain under spx:CC0-1.0.
-
Tags: #zsh #scripting #cli #opinionated
Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.
If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.
| --- | |
| apiVersion: apps/v1 | |
| kind: DaemonSet | |
| metadata: | |
| name: netshoot | |
| labels: | |
| app: netshoot | |
| spec: | |
| updateStrategy: | |
| type: RollingUpdate |
| #!/bin/bash | |
| set -e | |
| bail() { | |
| printf "${RED}$1${NC}\n" 1>&2 | |
| exit 1 | |
| } | |
| function registry_pki_secret() { |
| docker run -p 39013:39013 \ | |
| -p 39017:39017 \ | |
| -p 39041-39045:39041-39045 \ | |
| -p 1128-1129:1128-1129 \ | |
| -p 59013-59014:59013-59014 \ | |
| -v /hana/:/hana/mounts \ | |
| --ulimit nofile=1048576:1048576 \ | |
| --sysctl kernel.shmmax=1073741824 \ | |
| --sysctl net.ipv4.ip_local_port_range='40000 60999' \ | |
| --sysctl kernel.shmmni=524288 \ |
| sudo tee /etc/sudoers.d/vagrant > /dev/null << EOL | |
| # | |
| # Arch Linux, Fedora sudoers entries | |
| # | |
| # Allow passwordless startup of Vagrant with vagrant-hostsupdater. | |
| Cmnd_Alias VAGRANT_HOSTS_ADD = /bin/sh -c echo "*" >> /etc/hosts | |
| Cmnd_Alias VAGRANT_HOSTS_REMOVE = /usr/bin/sed -i -e /*/ d /etc/hosts | |
| %sudo ALL=(root) NOPASSWD: VAGRANT_HOSTS_ADD, VAGRANT_HOSTS_REMOVE |
| #!/bin/bash | |
| #run anywhere with curl and jq installed. | |
| # 11/17 - clemenko@docker.com | |
| set -e | |
| RED=$(tput setaf 1) | |
| GREEN=$(tput setaf 2) | |
| NORMAL=$(tput sgr0) | |
| password=Pa22word |
Sometimes it may be necessary to extract the images from a DTR volume backup. In the absence of a functioning DTR cluster, it's possible to extract these images using the open-source registry image.
First, identify the registry volume that needs to be extracted:
root@dtr-node1:~# docker volume ls --filter=name=dtr
DRIVER VOLUME NAME
local dtr-ca-a2382528a00b
local dtr-postgres-a2382528a00b
local dtr-registry-a2382528a00b
| version: '2' | |
| services: | |
| wekandb: | |
| image: mongo:3.2.16 | |
| container_name: wekan-db | |
| restart: always | |
| command: mongod --smallfiles --oplogSize 128 | |
| networks: |