Skip to content

Instantly share code, notes, and snippets.

View ms-ati's full-sized avatar

Marc Siegel ms-ati

  • American Technology Innovations
  • Boston, MA
  • X @ms_ati
View GitHub Profile
@ms-ati
ms-ati / test_inotify.rb
Last active July 11, 2018 14:58 — forked from e2/test_inotify.rb
Script for testing inotify and listen on Linux
gem "rb-inotify"
require 'rb-inotify'
gem "listen"
require "listen"
# BEGIN MONKEY PATCH OF LISTEN GEM
Listen::Adapter::Linux::DEFAULTS.tap do |defaults|
# Add :modify to the inotify events monitored by the Linux adapter
new_defaults = defaults.merge(events: defaults[:events] + [:modify])
@ms-ati
ms-ati / selectable_queue.rb
Created September 28, 2017 17:00 — forked from garybernhardt/selectable_queue.rb
A queue that you can pass to IO.select.
# A queue that you can pass to IO.select.
#
# NOT THREAD SAFE: Only one thread should write; only one thread should read.
#
# Purpose:
# Allow easy integration of data-producing threads into event loops. The
# queue will be readable from select's perspective as long as there are
# objects in the queue.
#
# Implementation: