Skip to content

Instantly share code, notes, and snippets.

View nweddle's full-sized avatar
:octocat:

Nathan Weddle nweddle

:octocat:
View GitHub Profile
@nweddle
nweddle / XKCLOUD.ahk
Last active August 29, 2015 14:18 — forked from G33kDude/XKCLOUD.ahk
#SingleInstance, Force
#NoEnv
SetBatchLines, -1
SetMouseDelay, 2
CoordMode, Mouse, Screen
; Start gdi+
If !pToken := Gdip_Startup()
{
MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
@nweddle
nweddle / myresolve::default.rb
Last active November 3, 2015 23:49
Simple 'network_interfaces_v2' recipe to configure Test Kitchen CentOS 7.1 networking
#
# Cookbook Name:: myresolve
# Recipe:: default
#
# Copyright (c) 2015 Nathan Weddle, All Rights Reserved.
# Configure the loopback interface
network_interface 'lo' do
# We set reload equal to false, so that we are not kicked out of our TK run
reload false
{"ssl": {"verify": false}}
@nweddle
nweddle / private.xml
Created August 4, 2016 23:47
Karabiner Custom Settings
<?xml version="1.0" encoding="UTF-8"?>
<root>
<item>
<name>Karabiner private.xml settings</name>
<devicevendordef>
<vendorname>LOGITECH</vendorname>
<vendorid>0x046d</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>M510</productname>
@nweddle
nweddle / download.ps1
Created January 15, 2017 08:28
PowerShell Download Script
$url = "https://github.com/sabnzbd/sabnzbd/releases/download/1.2.0/SABnzbd-1.2.0-win32-setup.exe"
$dest = ([Environment]::GetFolderPath("Desktop") + "\SABnzbd-1.2.0-win32-setup.exe")
$client = new-object System.Net.WebClient
$client.DownloadFile($url,$dest)
@nweddle
nweddle / dotno.rb
Last active January 31, 2017 18:00
Use this recipe in your Test Kitchen run_list to skip the lengthy .NET compile times. We want these in the Packer runs to build speedy production boxes, but we should have to wait for it in our Test Kitchen runs.
delete_resource(:execute, 'DrainNGenQueue')
delete_resource(:execute, 'DrainNGenQueue64')
delete_resource(:windows_task, '\Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319')
delete_resource(:windows_task, '\Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 64')
@nweddle
nweddle / dsc-example.rb
Last active June 27, 2017 17:22
Enabling Custom PowerShell DSC Modules with Chef
# Define Attributes
# Move to ./attributes/default.rb
node.default['test']['module_name'] = 'xStorage'
node.default['test']['image_path'] = 'C:\Users\nathan'
node.default['test']['image_name'] = 'alpine-virt-3.5.1-x86_64.iso'
node.default['test']['drive_letter'] = 'S'
# Enable the PSGallery Repository, so that we can then install our DSC module
powershell_script 'Enable PSGallery Repository' do
code 'Set-PSRepository -Name PSGallery -InstallationPolicy Trusted'
@nweddle
nweddle / class.md
Last active May 29, 2018 16:11
Automate 2 Up and Running

Hostnames

Automate Server:  $cardnumberof$cardsuite.automate.e9.io
Workstation:      $cardnumberof$cardsuite.workstation.e9.io

Credentials

Username:  chef
Password: C0d3Can
@nweddle
nweddle / remove-nodes.ps1
Last active July 24, 2018 00:36
PowerShell and Bash Examples to Remove Stale Chef Nodes
$date1 = Get-Date -Date "01/01/1970"
$date2 = (Get-Date).AddDays(-3)
$time = (New-TimeSpan -Start $date1 -End $date2).TotalSeconds
$search = @"
knife search node "ohai_time:[* TO $time]" -i
"@
$results = Invoke-Expression $search 2> $null
@nweddle
nweddle / check_ansible.sh
Created February 25, 2020 22:54
Ubuntu Idempotent Ansible Install Check
#!/usr/bin/env bash
set -euo pipefail
output="$(apt-cache policy ansible)"
installed="$(echo "$output" | sed -n -r 's/^(.*)(Installed: )(.*)$/\3/p')"
candidate="$(echo "$output" | sed -n -r 's/^(.*)(Candidate: )(.*)$/\3/p')"
if [[ $installed != "$candidate" ]]; then
echo Install Ansible
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -