Skip to content

Instantly share code, notes, and snippets.

View dargmuesli's full-sized avatar
🎧
https://creal.jonas-thelemann.de/player

Jonas Thelemann dargmuesli

🎧
https://creal.jonas-thelemann.de/player
View GitHub Profile
@kwonghung-YIP
kwonghung-YIP / backup-docker-secrets.sh
Created October 15, 2019 03:26
Shell script for export all secrets defined in docker swarm
#!/bin/bash
service_name="backup-all-secrets"
secret_list=( `docker secret ls --format "{{ .Name }}"` )
cmd="docker service create \
--name $service_name \
--constraint node.hostname==`hostname` "
for secret in "${secret_list[@]}"
@mklement0
mklement0 / Out-FileUtf8NoBom.ps1
Last active December 23, 2022 15:30
PowerShell function that emulates Out-File for creating UTF-8-encoded files *without a BOM* (byte-order mark).
<#
Prerequisites: PowerShell version 3 or above.
License: MIT
Author: Michael Klement <mklement0@gmail.com>
DOWNLOAD and DEFINITION OF THE FUNCTION:
irm https://gist.github.com/mklement0/8689b9b5123a9ba11df7214f82a673be/raw/Out-FileUtf8NoBom.ps1 | iex
The above directly defines the function below in your session and offers guidance for making it available in future
@wpsmith
wpsmith / New-ErrorRecord.ps1
Created April 16, 2015 14:16
PowerShell: Creates an custom ErrorRecord that can be used to report a terminating or non-terminating error.
<#
.Synopsis
Creates an custom ErrorRecord that can be used to report a terminating or non-terminating error.
.Description
Creates an custom ErrorRecord that can be used to report a terminating or non-terminating error.
.Parameter Exception
The Exception that will be associated with the ErrorRecord.