Skip to content

Instantly share code, notes, and snippets.

View Iristyle's full-sized avatar

Ethan J. Brown Iristyle

View GitHub Profile
@Iristyle
Iristyle / wmi-queries.md
Created July 28, 2017 17:38
WMI type accelerator queries

Command

[wmi] "Win32_SID.SID='S-1-15-2-1'"

Output

__GENUS : 2
@Iristyle
Iristyle / ruby-errors.rb
Created August 8, 2017 18:04
Ruby error handling approaches
def foo
raise ArgumentError.new("bad arg yo")
end
def bar
begin
foo
# good
# rescue ArgumentError => e
# raise
@Iristyle
Iristyle / build-nssm.cmd
Last active September 3, 2017 05:43
Build NSSM toolchain
REM Install git through chocolatey
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco install git -y
REM Add Nexus as a source and install Visual Studio 2017 compilers + Windows 8.1 SDK
choco source add -n=nexus -s="http://nexus.delivery.puppetlabs.net/service/local/nuget/temp-build-tools/"
choco install choco install msvc.2017-win8.1.sdk.en-us -y --cache-location=c:\msvc
REM clone the source
@Iristyle
Iristyle / beaker-acl-test.sh
Created August 16, 2017 05:07
Beaker test modules against puppet-agent 5 packages
PUPPET_AGENT_SHA=381a34773d5857b7b26e0a8e8576b95bdb64937d PUPPET_AGENT_SUITE_VERSION=5.0.1.184.g381a347 PUPPET_INSTALL_TYPE=agent bundle exec beaker --options-file acceptance/.beaker-git.cfg --hosts hosts.yaml --tests acceptance/tests/propagation/negative/prop_file.rb
@Iristyle
Iristyle / msi-report-versioned-files.ps1
Last active September 13, 2017 22:27
Grab MSI versioned files
function Get-MSIPropertyValue
{
[CmdletBinding()]
param(
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[__ComObject]
$MSIDatabase,
[parameter(Mandatory=$true)]
@Iristyle
Iristyle / shgetfolderpath.rb
Created October 23, 2017 23:22
Fiddle vs Win32API for SHGetFolderPath
require 'fiddle/import'
require 'fiddle/types'
module Win32FiddleDirectories
extend Fiddle::Importer
include Fiddle::Win32Types # adds HWND, HANDLE, DWORD type aliases
# calling this appears to hose everything up!
# dlload "shell32", "kernel32"
@Iristyle
Iristyle / Interactive-cmd-UAC-disabled.txt
Last active January 5, 2018 21:11
Administrator winrm vs interactive perms through whoami /all
local
USER INFORMATION
----------------
User Name SID
============================= ============================================
knqh9q0wrbqcczw\administrator S-1-5-21-2754450856-868995602-2816174699-500
GROUP INFORMATION
@Iristyle
Iristyle / git-filter-for-specific-files.md
Created January 26, 2018 02:24
Demonstrate how to use Git to create a new repo with specific files from a current repo

I tried to initially do this using the perl based cj-git-filter-branch tool from https://github.com/pflanze/chj-bin (which required ensuring Perl was viable and a few CPAN packages were installed) with a CLI invocation like:

~/source/chj/chj-bin/cj-git-filter-branch --remove-all-but-those-in ../keepers.txt -f

And a keepers.txt like:

acceptance/tests/resource/scheduled_task/should_create.rb
@Iristyle
Iristyle / test-installer.ps1
Created February 12, 2018 02:12
Install Puppet via MSI using CLI parameters
$hostname = [Net.Dns]::GetHostName()
function Install-Puppet($opts)
{
$params = @('/qn', '/i', 'pkg\puppet-agent.msi', '/l*v', 'install.log')
if ($opts.Account) { $params += "PUPPET_AGENT_ACCOUNT_USER=`"$($opts.Account)`"" }
if ($opts.Domain) { $params += "PUPPET_AGENT_ACCOUNT_DOMAIN=`"$($opts.Domain)`"" }
if ($opts.Password) { $params += "PUPPET_AGENT_ACCOUNT_PASSWORD=`"$($opts.Password)`"" }
if ($opts.Startup) { $params += "PUPPET_AGENT_STARTUP_MODE=`"$($opts.Startup)`"" }
@Iristyle
Iristyle / triggers.md
Last active March 20, 2018 23:43
Scheduled Task Trigger Types

Puppet Hash Definition

  • required parameter
  • example value
Type Format Example v1
TASK_TRIGGER
v2
ITrigger
schedule string enum daily
weekly
monthly
once
TriggerType Type
start_time time string HH:MM 13:21 wStartHour
wStartMinute
StartBoundary
start_date Date string YYYY-MM-DD 2011-08-31 wBeginYearwBeginMonthwBeginDay StartBoundary