This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:
- Hulu / HuluPlus
- CBS
- ABC
- MTV
- theWB
- CW TV
- Crackle
- NBC
| # coding: binary | |
| # IRC <-> Campfire bridge, set IRC password to SUBDOMAIN:TOKEN and connect to localhost:6667 | |
| # Remove special chars/spaces from channel names (ie "Foo Bar" becomes #FooBar). Only tested with LimeChat. | |
| # gem install excon && gem install yajl-ruby -v "< 2.0" | |
| %w[socket thread uri excon yajl yajl/http_stream].each { |lib| require lib } | |
| Thread.abort_on_exception = true | |
| [:INT, :TERM].each { |sig| trap(sig) { exit } } | |
| server = TCPServer.new('127.0.0.1', 6667) | |
| loop do |
| # coding: utf-8 | |
| require 'sinatra' | |
| set server: 'thin', connections: [] | |
| get '/' do | |
| halt erb(:login) unless params[:user] | |
| erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
| end | |
| get '/stream', provides: 'text/event-stream' do |
| require 'delegate' | |
| module Support | |
| class WarningFilter < DelegateClass(IO) | |
| def write(line) | |
| super if line !~ /^\S+gems\/ruby\-\S+:\d+: warning:/ | |
| end | |
| end | |
| end |
| ######################################### | |
| # Very basic rack application showing how to use a router based on the uri | |
| # and how to process requests based on the HTTP method used. | |
| # | |
| # Usage: | |
| # $ rackup rack_example.ru | |
| # | |
| # $ curl -X POST -d 'title=retire&body=I should retire in a nice island' localhost:9292/ideas | |
| # $ curl -X POST -d 'title=ask Satish for a gift&body=Find a way to get Satish to send me a gift' localhost:9292/ideas | |
| # $ curl localhost:9292/ideas |
This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:
| require 'thread' | |
| class Worker | |
| def initialize(count = 1) | |
| @queue, @closing, @threads, @mutex = Queue.new, false, [], Mutex.new | |
| add_worker(count) | |
| end | |
| def add_worker(count = 1) | |
| @mutex.synchronize do |
| #define STRING char * | |
| #define IF if( | |
| #define THEN ){ | |
| #define ELSE } else { | |
| #define FI ;} | |
| #define WHILE while ( | |
| #define DO ){ | |
| #define OD ;} | |
| #define INT int | |
| #define BEGIN { |
| source "http://rubygems.org/" | |
| gem "sinatra", "~> 1.3.0" | |
| gem "thin" |
| require 'eventmachine' | |
| require 'socket' | |
| require 'kgio' | |
| server = Kgio::TCPServer.new('0.0.0.0', 4242) | |
| module Dispatch | |
| def notify_readable | |
| io = @io.kgio_tryaccept or return | |
| EventMachine.attach(io, Server) |