Skip to content

Instantly share code, notes, and snippets.

@tonylea
tonylea / git-push-all.sh
Last active August 16, 2021 15:50
Push git repo, including branches & tags
#!/usr/bin/env bash
# The simplest way to push all branches to a remote repo:
git push --all <remote-name>
@tonylea
tonylea / sshKeyCopy.sh
Created August 22, 2021 18:25
Copy ssh key to server
cat ~/.ssh/id_rsa.pub | ssh <USER_NAME>@<SERVER_NAME> "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
@tonylea
tonylea / valiateFileExtension.ps1
Created September 11, 2021 15:41
Validate file extension in PowerShell parameter
param (
[ValidateScript({
if (-Not ($_ | Test-Path) ) { throw "File does not exist" }
if (-Not ($_ | Test-Path -PathType Leaf) ) { throw "The Path argument must be a file. Folder paths are not allowed." }
if ($_ -notmatch "\.tfplan$") { throw "The file specified in the path argument must be type tfplan" }
return $true
})]
[System.IO.FileInfo]
$FilePath
)

Brew Bundle Brewfile Tips

Copyright & License

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.

Sponsor

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.

Work MacBook Config

Update OS

softwareupdate --all --install --force

Homebrew

@tonylea
tonylea / Dockerfile.j2
Created July 6, 2023 19:05
Dockerfile.j2 template for Ansible Molecule tests
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
{% if item.env is defined %}
{% for var, value in item.env.items() %}