Skip to content

Instantly share code, notes, and snippets.

View Iristyle's full-sized avatar

Ethan J. Brown Iristyle

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / 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
@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 / 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 / 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