This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'eventmachine' | |
require 'open-uri' | |
require 'em-http-request' | |
def connect_to_ws | |
http = EventMachine::HttpRequest.new("ws://127.0.0.1:8081/websocket").get :timeout => 0 | |
http.errback { |msg| | |
puts msg | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gem 'websocket-rack' | |
# gem 'thin' | |
# config.threadsafe! == true | |
# or whatever Rails4 wants me to do. | |
require "rack/websocket" | |
class MyApp < Rack::WebSocket::Application | |
def on_message(env, msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# shellcheck disable=SC2059 | |
set -euo pipefail | |
# Toggle all currently 'Active' network servcies (e.g., Wi-Fi, Ethernet | |
# connections, etc...) to "restart" them. We'll ignore any already 'Disabled' | |
# services, and toggle all of the others to 'Disabled' and then back to | |
# 'Enabled'. This has been found helpful when your VPN won't re-connect after | |
# undocking and re-docking your MacBook, for example. |