Skip to content

Instantly share code, notes, and snippets.

View Iristyle's full-sized avatar

Ethan J. Brown Iristyle

View GitHub Profile
@Iristyle
Iristyle / results.md
Last active January 5, 2017 22:11
Determine Windows codepage -> Ruby Encoding map

This chart has things broken down by Rubys response after calling chcp locally.

  • Invalid codepage means trying to change active codepage on English Windows 2008R2 is broken
  • Ruby failure indicates the inability of Ruby to even load given a codepage (though it did still properly identify the Ruby Encoding)
  • In most cases, Ruby considers the codepage ASCII-8BIT / BINARY
Name Value
710 Invalid codepage
12001 Invalid codepage
@Iristyle
Iristyle / Ruby 2.1.8.txt
Last active March 22, 2017 18:38
YAMLTree dispatch_cache contents for manifest using ACL module
visit_Hash
visit_String
visit_Array
visit_Symbol
visit_Puppet_Type_Acl_Ace
visit_Hash
visit_String
visit_Symbol
visit_Time
Notice: Applied catalog in 0.67 seconds
@Iristyle
Iristyle / AIO-Ruby-2.1.9-rbconfig.rb
Last active April 19, 2017 18:53
rbconfig.rb differences pre-AIO and post-AIO
rbconfig-AIO
# This file was created by mkconfig.rb when ruby was built. Any
# changes made to this file will be lost the next time ruby is built.
module RbConfig
RUBY_VERSION == "2.1.9" or
raise "ruby lib version (2.1.9) doesn't match executable version (#{RUBY_VERSION})"
TOPDIR = File.dirname(__FILE__).chomp!("/lib/ruby/2.1.0/x64-mingw32")
@Iristyle
Iristyle / client.ps1
Last active April 21, 2017 23:53
PowerShell module interactive testing
$namedPipeName = 'dceb7903-d338-4207-938b-f5a1384dcfe8PuppetPsHost'
$client = New-Object System.IO.Pipes.NamedPipeClientStream($namedPipeName)
$client.Connect()
$code = @"
`$params = @{
Code = @'
Start-Process powershell.exe
if (schtasks /query /fo csv 2> $null | ConvertFrom-Csv | Where-Object { $_.TaskName -eq "\wm\DSC\DSC Fact Collector" }) { exit 0;} else { exit 1; }
'@
@Iristyle
Iristyle / info.md
Created May 8, 2017 18:15
Launching puppet via bundle exec with a different encoding / testing scrubbing
  • modify bin/puppet wrapper

    • change #!/usr/bin/env ruby to #!/usr/bin/env ruby -E ISO-8859-1
  • To test the Etc provider on OSX

    • change lib/puppet/provider/user/directoryservice.rb, commenting the line defaultfor :operatingsystem => :darwin
    • change lib/puppet/provider/user/useradd.rb, commenting the line commands :add => "useradd", :delete => "userdel", :modify => "usermod", :password => "chage"
  • To perform some checks, mod lib/puppet/util/character_encoding.rb like:

@Iristyle
Iristyle / dotnet-versions.ps1
Created May 15, 2017 17:03
Enumerate .NET Versions using PowerShell
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse |
Get-ItemProperty -name Version,Release -EA 0 |
Where { $_.PSChildName -match '^(?!S)\p{L}'} |
Select PSChildName, Version, Release, @{
name="Product"
expression={
switch -regex ($_.Release) {
"378389" { [Version]"4.5" }
"378675|378758" { [Version]"4.5.1" }
"379893" { [Version]"4.5.2" }
@Iristyle
Iristyle / encoding.md
Last active April 1, 2022 14:04
Encoding in Puppet

Basic encoding info

  • ASCII is 0 - 7F (128 total characters) - ASCII is a subset of UTF-8
  • UTF-8 - variable width 1 to 4 bytes
Numberof bytes Bits forcode point Firstcode point Lastcode point Byte 1 Byte 2 Byte 3 Byte 4
1 7 U+0000 U+007F 0xxxxxxx      
2 11 U+0080 U+07FF 110xxxxx 10xxxxxx    
3 16 U+0800 U+FFFF 1110xxxx 10xxxxxx 10xxxxxx  
@Iristyle
Iristyle / log.txt
Created July 11, 2017 16:43
Module source workflow changes to --modulepath
[root@flk17t5mqrky7o0 puppet]# bundle install --path .bundle/gems --without development extra
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing
your bundle as root will break this application for all non-root users on this
machine.
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.1.1
Using CFPropertyList 2.2.8
Using facter 2.4.6
@Iristyle
Iristyle / notes.md
Last active July 11, 2017 23:54
Comparing ACL on Puppet 4 / Puppet 5

Need to collect

  • Output of puppet resource acl c:\windows
  • Output of test.pp manifest run (make sure c:\test directory is not present prior)
    • What's up with initial application always showing an empty []? (This appears to be a separate bug in all Puppet versions)
file { 'c:/test': ensure => 'directory' } ~>
acl { 'c:/test':
 purge => 'true',
@Iristyle
Iristyle / samples.txt
Created July 19, 2017 00:37
Sample Puppet SSL files / types
### ca_setting
# Puppet::SSL::Certificate::Ca
-----BEGIN CERTIFICATE-----
MIICEjCCAbygAwIBAgIBATANBgkqhkiG9w0BAQsFADAwMS4wLAYDVQQDDCVQdXBw
ZXQgQ0E6IG5paWhhdS5jb3JwLnB1cHBldGxhYnMubmV0MB4XDTE3MDExNzIxNDIx
OVoXDTIyMDExNzIxNDIxOVowMDEuMCwGA1UEAwwlUHVwcGV0IENBOiBuaWloYXUu
Y29ycC5wdXBwZXRsYWJzLm5ldDBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDNrPP2
Nf/8GbMqrjvX0+PlarOREgW7zPLPsNh0mICU03ZQeiNcIHQ1j3iBmluPlFqHe1VQ
gJbgrYQyqJMzg01fAgMBAAGjgcAwgb0wNwYJYIZIAYb4QgENBCoMKFB1cHBldCBS