Skip to content

Instantly share code, notes, and snippets.

View Iristyle's full-sized avatar

Ethan J. Brown Iristyle

View GitHub Profile
@Iristyle
Iristyle / docker-helpers.ps1
Last active September 14, 2018 21:29
Docker / LCOW helpers for Windows
function Get-DockerConfigFilePath
{
$path = "${ENV:ALLUSERSPROFILE}\docker\config\daemon.json"
# retrieve the path to daemon.json from docker service config, if present
sc.exe qc docker |
? { $_ -match 'BINARY_PATH_NAME\s*:\s*(.*)' } |
? { $_ -match '--config-file\s*(.*daemon\.json)' }
# found BINARY_PATH_NAME which contains --config-file *AND* file exists
@Iristyle
Iristyle / Pluginsync as Administrator.txt
Created August 1, 2018 01:09
Pluginsyc as admin vs pluginsync as SYSTEM permission differences
Path : Microsoft.PowerShell.Core\FileSystem::C:\ProgramData\PuppetLabs\code
Owner : NT AUTHORITY\SYSTEM
Group : NT AUTHORITY\SYSTEM
Sddl : O:SYG:SYD:P(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)
Path : Microsoft.PowerShell.Core\FileSystem::C:\ProgramData\PuppetLabs\facter
Owner : NT AUTHORITY\SYSTEM
Group : NT AUTHORITY\SYSTEM
@Iristyle
Iristyle / notes.md
Created July 13, 2018 18:45
Puppet::Util::Platform.windows? vs Puppet.features.microsoft_windows?

So we have 2 mechanisms that we use to check whether or not we're on Windows.

In this particular instance, I think we'd prefer to use Puppet::Util::Platform.windows? as I wouldn't expect any cross-platform stubbing to occur in tests.

@Iristyle
Iristyle / get-tasks-with-compat.ps1
Created March 28, 2018 06:26
Get scheduled tasks with compat
Get-ScheduledTask | % {
$props = [ordered]@{
TaskName = $psitem.TaskName
# note ErrorAction Ignore needed to prevent conversion problems
Compatibility = $psitem | Select -ExpandProperty Settings | Select -ExpandProperty Compatibility -ErrorAction Ignore
}
New-Object -TypeName PSObject -Property $props
}
@Iristyle
Iristyle / appv-notes.md
Last active March 24, 2018 01:00
Fun times with Bundler + AppVeyor!

While documenting Bundler behavior to make the chart at https://gist.github.com/Iristyle/8a2214a6dd5aa709ba2a1abd32b4eacd, an interesting scenario was uncovered.

The following diff is a result of running the same code a day apart in AppVeyor. All dependencies downloaded / installed are exactly the same, except:

@Iristyle
Iristyle / bundler-results.md
Last active March 26, 2018 18:52
Windows Bundler 1.16.1 behavior when transitive dependency aws-sdk-v1 is present (that has json ~> 1.4)
Gemfile gem fetched /
native ext built
--path specified Gemfile.lock system json bundled json gem list bundle exec gem list bundle show json
Ruby 2.1 /
json 1.8.1
gem 'json', '>= 0' fetched 1.8.6
built 1.8.6
json (1.8.6) 1.8.6 1.8.6 (1.8.6, default: 1.8.1) (1.8.6) C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/json-1.8.6
Ruby 2.4 /
json 2.0.4
gem 'json', '>= 0' fetched 1.8.6
built 1.8.6
json (1.8.6) 2.0.4 1.8.6 (default: 2.0.4, 1.8.6) (1.8.6) C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/json-1.8.6
Ruby 2.1 /
@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
@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 / 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 / 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