Skip to content

Instantly share code, notes, and snippets.

View Iristyle's full-sized avatar

Ethan J. Brown Iristyle

View GitHub Profile
@Iristyle
Iristyle / ruby-native-gems.md
Last active September 6, 2017 08:37
Installing gems that require Ruby DevKit on a machine that has installed Puppet from MSI
  • Install Puppet from MSI
  • Note that the Ruby install path is something like c:\program files\puppet labs\puppet\sys\ruby
  • Install Chocolatey in PowerShell with iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
  • Close / re-open PowerShell
  • Install Ruby Devkit - choco install ruby2.devkit
  • Add Ruby to the beginning of the PATH using an 8.3 style path - $Env:PATH = "C:\Progra~1\Puppet~1\Puppet\sys\ruby\bin;" + $Env:PATH (NOTE: dir /x inside cmd.exe can be helpful to find 8.3 style paths)
    • If done correctly gem env should contain a line with RUBY EXECUTABLE: C:/PROGRA~1/PUPPET~1/Puppet/sys/ruby/bin/ruby.exe
    • This part is absolutely critical, so if gem env doesn't have a bunch of 8.3 style paths, you've done something wrong
  • Configure DevKit for use with our vendored Ruby
  • cd \DevKit-2.0-x64
#!/bin/bash
# Mostly taken from http://forum.kodi.tv/showthread.php?tid=212971
###############################################################################
# Download and update latest Kodi build (nightly or stable) and install to a connected device.
# - tested using a Mac OSX and Fire TV Stick
###############################################################################
function progressbar()
{
bar="================================================================================​"
@Iristyle
Iristyle / env-reset.ps1
Last active February 25, 2016 14:51
Reset environment variables
# initial stash of process vars that will overwrite Machine / User vars
if (! $processVars)
{
# capture all variables by name, using whats currently available in-proc for values (already expanded)
$processVars = [Environment]::GetEnvironmentVariables('Process').Keys |
% -Begin { $h = @{} } -Process { $h.$_ = (Get-Item Env:\$_).Value } -End { $h }
# Write-Host "Initially captured process vars:`n`n$($processVars | Out-String)"
# eliminate Machine / User vars so that we have only process vars
@Iristyle
Iristyle / uptime.ps1
Created September 8, 2016 21:08
Windows API GetTickCount64 used to retrieve system uptime on Windows with 64-bit resolution (5000+ years)
$signature = @'
[DllImport(@"kernel32.dll", SetLastError=true)]
public static extern UInt64 GetTickCount64 ();
'@
$type = Add-Type -MemberDefinition $signature -Name SystemTime -Namespace GetTickCount64 -PassThru
[System.TimeSpan]::FromMilliseconds($type::GetTickCount64())
@Iristyle
Iristyle / crash.txt
Created September 30, 2016 18:45
Ruby crash in popen3
C:/tools/ruby23/lib/ruby/2.3.0/open3.rb:201: [BUG] w32_reset_event: The handle is invalid.
ruby 2.3.0p0 (2015-12-25 revision 53290) [x64-mingw32]
-- Control frame information -----------------------------------------------
c:0043 p:---- s:0201 e:000200 CFUNC :close
c:0042 p:0009 s:0198 e:000197 BLOCK C:/tools/ruby23/lib/ruby/2.3.0/open3.rb:201 [FINISH]
c:0041 p:---- s:0195 e:000194 CFUNC :each
c:0040 p:0084 s:0192 e:000191 METHOD C:/tools/ruby23/lib/ruby/2.3.0/open3.rb:201
c:0039 p:0143 s:0181 e:000180 METHOD C:/tools/ruby23/lib/ruby/2.3.0/open3.rb:95
@Iristyle
Iristyle / fix-rubygems.pp
Last active October 27, 2016 20:00
Fix RubyGems with Puppet
$ruby_dir = regsubst($::ruby['sitedir'],'^(.*/lib/ruby/).*$','\1')
$ruby_ver = regsubst($::ruby['sitedir'],'^.*/(.*)$','\1')
$cert_path = "${ruby_dir}${ruby_ver}/rubygems/ssl_certs/GlobalSign_Root_CA-2.11.4.0.0.0.0.1.21.75.90.195.148.pem"
file { $cert_path:
content => @(EOPEM)
# alias="GlobalSign Root CA"
# trust=CKA_TRUST_CODE_SIGNING CKA_TRUST_EMAIL_PROTECTION CKA_TRUST_SERVER_AUTH
# distrust=
# openssl-trust=codeSigning emailProtection serverAuth
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.
@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"
@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 / 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