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 / limit.maxfiles.plist
Last active October 20, 2022 21:34
Increase maxfiles limit on macOS Monterey 12.6
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>limit.maxfiles</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
@nweddle
nweddle / login.sh
Last active September 22, 2022 23:32
macOS Login items via Apple Script
# https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLoginItems.html
# https://stackoverflow.com/a/69404641
# Using Apple Script
# list loginitems
osascript -e 'tell application "System Events" to get the name of every login item'
# list details of login items
osascript -e 'tell application "System Events" to get the properties of every login item'
@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 -
@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 / 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 / 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 / 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 / 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 / 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>
{"ssl": {"verify": false}}