Skip to content

Instantly share code, notes, and snippets.

View DavidS's full-sized avatar
☁️
Currently working as @DavidS-om

David Schmitt DavidS

☁️
Currently working as @DavidS-om
View GitHub Profile
@JakeTRogers
JakeTRogers / Guardfile
Last active October 24, 2017 00:50
puppet guard
notification :off
guard :shell do
watch %r{^(manifests|site\/(profile|role)\/manifests)\/(.+)\.pp$} do
system("pdk validate puppet") and system("pdk test unit")
end
watch %r{^(lib|site\/(profile|role)\/lib)\/(.+)\.rb$} do
system("pdk validate ruby") and system("pdk test unit")
end
watch %r{^spec\/(classes|defines|applications|functions|types|type_aliases|hosts)\/(.+)\.rb$} do
@chrisn
chrisn / popen3_test
Last active March 2, 2023 08:48
Ruby example of using Open3.popen3 with a select loop to read a child process's standard output and standard error streams.
#!/usr/bin/env ruby
require 'open3'
# Returns true if all files are EOF
#
def all_eof(files)
files.find { |f| !f.eof }.nil?
end