Skip to content

Instantly share code, notes, and snippets.

View bdwyertech's full-sized avatar
☁️

Brian Dwyer bdwyertech

☁️
View GitHub Profile
@bdwyertech
bdwyertech / custodian_sqs_notification.go
Last active March 10, 2020 15:42
Cloud Custodian - SQS Notification Message - Go Struct
type CustodianSQSNotification struct {
Account string `json:"account"`
AccountID string `json:"account_id"`
Action struct {
To []string `json:"to"`
Transport struct {
Queue string `json:"queue"`
Type string `json:"type"`
} `json:"transport"`
Type string `json:"type"`
@bdwyertech
bdwyertech / ec2-metadata.sh
Created October 10, 2019 18:47
Amazon EC2 Metadata Helper Script
#!/bin/bash
#
#########################################################################
#This software code is made available "AS IS" without warranties of any #
#kind. You may copy, display, modify and redistribute the software #
#code either by itself or as incorporated into your code; provided that #
#you do not remove any proprietary notices. Your use of this software #
#code is at your own risk and you waive any claim against Amazon #
#Digital Services, Inc. or its affiliates with respect to your use of #
#this software code. (c) 2006-2007 Amazon Digital Services, Inc. or its #
@bdwyertech
bdwyertech / tkchefshell.sh
Created June 14, 2019 16:25
TestKitchen - Chef-Shell in Client Mode
#!/bin.bash
cd /tmp/kitchen
/opt/chef/embedded/bin/chef-zero -d
knife upload . -c client.rb
chef-shell -z --config client.rb -j dna.json
@bdwyertech
bdwyertech / proxy_disable.ps1
Last active March 3, 2023 15:24
PowerShell Script to Disable Proxy
# Filename: ProxyDisable.ps1
# Requires an Elevated PowerShell
# Disable the Proxy (Global)
Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\' -Name 'ProxyEnable' -Value 0
# Unset any Proxy Variables (Local)
$pvars=@('http_proxy','https_proxy', 'no_proxy')
foreach ($pvar in $pvars) {
Remove-Item "ENV:\${pvar}" -ErrorAction SilentlyContinue
}
@bdwyertech
bdwyertech / stuff.rb
Created September 7, 2018 22:40
Ruby'isms
# => Find Certificate CN
cn = OpenSSL::X509::Certificate.new(::File.read('kc.crt')).subject.to_a.find { |c| c[0] == 'CN' }[1]
@bdwyertech
bdwyertech / BerksFix.ps1
Last active August 23, 2018 00:00
Hotfix for Berkshelf to use latest mixlib-archive without chdir issue
# Filename: BerksFix.ps1
# Brian Dwyer - 8/22/18
$bad = 'gem "mixlib-archive", "= 0.4.6"'
$good = 'gem "mixlib-archive", "= 0.4.13"'
$berks_cache = Resolve-Path '~\.berkshelf\cookbooks' -ErrorAction SilentlyContinue
if ($berks_cache) {
'Clearing Berkshelf Cookbook Cache...'
Remove-Item -Recurse $berks_cache
@bdwyertech
bdwyertech / gist:0089a4477c17710cffebd2d18bfcfd02
Created June 30, 2018 16:15
Gitlab - Terraform Syntax Highlighting
# Until an updated Rouge is released...
cd /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/rouge-3.1.1/lib/rouge/lexers/
wget https://raw.githubusercontent.com/jneen/rouge/master/lib/rouge/lexers/hcl.rb
wget https://raw.githubusercontent.com/jneen/rouge/master/lib/rouge/lexers/terraform.rb
@bdwyertech
bdwyertech / wsl_chefdk.ps1
Last active April 21, 2022 09:52
Windows Subsystem for Linux - ChefDK
# Update to Latest Windows 10 Spring Refresh
# Install WSL
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
# Get Ubuntu installed - https://docs.microsoft.com/en-us/windows/wsl/install-on-server
wsl.exe
# Install ChefDK deb package
@bdwyertech
bdwyertech / kubectl.md
Created March 2, 2018 18:42 — forked from so0k/kubectl.md
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@bdwyertech
bdwyertech / git-crypt-sourcetree.sh
Created February 28, 2018 05:02
Add git-crypt to Sourcetree's PATH
#!/bin/bash
# Add git-crypt to SourceTree's Path
# If you use Sourcetree's embedded GIT, you may have to symlink things into its PATH to make them work.
# git-crypt
ln -s /usr/local/bin/git-crypt /Applications/SourceTree.app/Contents/Resources/bin/