Skip to content

Instantly share code, notes, and snippets.

View nicholasdille's full-sized avatar

Nicholas Dille nicholasdille

View GitHub Profile
@nicholasdille
nicholasdille / docker-distribution
Last active May 13, 2019 11:59
Docker CLI Plugin to interact with a registry
#!/usr/bin/env bash
docker_cli_plugin_metadata() {
local vendor="nicholasdille"
local version="v0.0.1"
local url="https://dille.name"
local description="Interact with a Docker registry"
cat <<-EOF
{"SchemaVersion":"0.1.0","Vendor":"${vendor}","Version":"${version}","ShortDescription":"${description}","URL":"${url}"}
EOF
@nicholasdille
nicholasdille / cloudflare.sh
Created June 25, 2019 15:45
CloudFlare using bash
get_zone_id() {
local email=$1
local token=$2
local domain=$3
curl -sLfH "X-Auth-Email: ${email}" -H "X-Auth-Key: ${token}" https://api.cloudflare.com/client/v4/zones | jq --raw-output ".result[] | select(.name == \"${domain}\") | .id"
}
get_zone_records() {
local email=$1
@nicholasdille
nicholasdille / ansible
Last active June 26, 2019 13:00
Containerized tools
alias ansible-playbook="docker container run -it --rm --mount type=bind,source=$(pwd),target=/$(basename $(pwd)) --workdir /$(basename $(pwd)) nicholasdille/ansible"
alias ansible-vault="docker container run -it --rm --mount type=bind,source=$(pwd),target=/$(basename $(pwd)) --workdir /$(basename $(pwd)) --entrypoint ansible-vault nicholasdille/ansible"
alias ansible-galaxy="docker container run -it --rm --mount type=bind,source=$(pwd),target=/$(basename $(pwd)) --workdir /$(basename $(pwd)) --entrypoint ansible-galaxy nicholasdille/ansible"
@nicholasdille
nicholasdille / Test-ShouldProcess.ps1
Created July 17, 2017 19:55
Skeleton for ShouldProcess in PowerShell functions
Function New-Something {}
Function Test-ShouldProcess {
[CmdletBinding(SupportsShouldProcess, ConfirmImpact='Medium')]
Param(
[Parameter()]
[switch]
$Force
)
@nicholasdille
nicholasdille / Handyumzug.md
Last active August 19, 2021 11:57
Handyumzug

Handyumzug

Diese Beschreibung wurde nur für zwei Samsung-Handys getestet.

Wichtig: Nichts installieren oder konfigurieren ohne Aufforderung. Die SIM-Karte und die SD-Karte verbleiben im alten Handy, bis der passende Schritt weiter unten erreicht ist.

Annahme: Fotos wurden direkt auf der SD-Karte gespeichert. Fotos im Handyspeicher werden aber übernommen.

Annahme: Kontakte befinden sich nicht im Handyspeicher. Vermutlich funktioniert die Übernahme, wurde aber nicht getestet.

@nicholasdille
nicholasdille / Show-JobProgress.ps1
Last active December 30, 2021 20:38
Retrieve progress from PowerShell job and display progress bar
function Show-JobProgress {
[CmdletBinding()]
param(
[Parameter(Mandatory,ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.Job[]]
$Job
,
[Parameter()]
[ValidateNotNullOrEmpty()]

openpgp4fpr:9AB58E301FE8EB6FB1BAB11C1FB723A707042D07

@nicholasdille
nicholasdille / Invoke-Queue.ps1
Created September 8, 2015 08:03
Process a queue of objects using PowerShell jobs
function Invoke-Queue {
[CmdletBinding()]
[OutputType([System.Management.Automation.Job[]])]
param(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[System.Object[]]
$InputObject
,
[Parameter(Mandatory)]
@nicholasdille
nicholasdille / Install-WindowsUpdate.vbs
Created September 8, 2015 08:10
Installs Windows Updates asynchronously and displays progress
Set wshShell = WScript.CreateObject("WScript.Shell")
strComputerName = wshShell.ExpandEnvironmentStrings("%ComputerName%")
Set updateSession = CreateObject("Microsoft.Update.Session")
WScript.StdOut.WriteLine "Activity=""Processing Windows Updates on " & strComputerName & """ Status=""Searching for updates"" Percentage=0"
Set SearchResult = Search
WScript.StdOut.WriteLine "Activity=""Processing Windows Updates on " & strComputerName & """ Status=""Searching for updates"" Percentage=100"
WScript.StdOut.WriteLine "SearchResultCode=" & SearchResult.ResultCode
WScript.StdOut.WriteLine "UpdatesFound=" & SearchResult.Updates.Count