Skip to content

Instantly share code, notes, and snippets.

View Iristyle's full-sized avatar

Ethan J. Brown Iristyle

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / docker-info.md
Created December 26, 2016 20:26
Docker broken on OSX

Flush old brew formulae:

Given an old docker install, flush it from the system:

brew uninstall --force docker
brew uninstall --force docker-machine
brew unlink docker
@Iristyle
Iristyle / update.md
Created December 22, 2016 22:20
Update partitions of existing LibreElect install

So I thought that maybe this would be easy to do logged live into the system - turns out, not really

ssh root@libreelecip
pw: libreelec

Stop services once on host:

@Iristyle
Iristyle / shgetfolderpath.rb
Created December 19, 2016 22:28
Ruby SHGetFolderPath - different implementations
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"
This file has been truncated, but you can view the full file.
h9ehp233a6ly3z9.delivery.puppetlabs.net (windows2012r2-64-1) 11:09:37$ cmd.exe /c puppet help --libdir="C:/cygwin64/tmp/7316_apps_should_be_available_via_pluginsync.s4Aakg/agent_lib"
Usage: puppet <subcommand> [options] <action> [options]
Available subcommands:
agent The puppet agent daemon
apply Apply Puppet manifests locally
ca Local Puppet Certificate Authority management.