Skip to content

Instantly share code, notes, and snippets.

View wchrisjohnson's full-sized avatar

Chris Johnson wchrisjohnson

View GitHub Profile
@prosm
prosm / benchmark.rb
Created May 3, 2011 12:34
Proof of concept showing memory leak in em-websocket
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
}
@collin
collin / socket.rb
Created August 14, 2012 18:17
rack/websocket + rails
# 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)
@stevenharman
stevenharman / restart-network-services
Created June 16, 2020 16:25
Restart Active Network Services on your Mac. You know, for the VPN!
#! /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.