Skip to content

Instantly share code, notes, and snippets.

View jhsu's full-sized avatar
💀
compliant with future standards

Joe Hsu jhsu

💀
compliant with future standards
  • MineHub
  • New York, NY
  • X @jhsu
View GitHub Profile
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
require 'open-uri'
require 'openssl'
req = URI.parse("https://somedomain/file.zip")
res = req.read(
:ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE,
:http_basic_authentication => ["user", "pass"]
)
<html><head><title>WebSocket Chat</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<form action="/send_message" method="post">
<input type="text" name="message" id="message" />
<input type="submit" id="send_message" value="send" title="send message" />
</form>
<div id="messages">
</div>
-V-
4.
\-4
.~¢
J. ¢
, J;
\.,» , _,__|
'f -AI
-v LI;
_-. ._
@jhsu
jhsu / gist:975818
Created May 17, 2011 02:57
rails_3_upgrade.markdown
# useful tools for upgrading rails 2 apps
http://rubygems.org/gems/rails_xss
http://rubygems.org/gems/fake_arel
Module Daikon
class Monitor
# ...
NEW_FORMAT = /^\+?\d+\.\d+[^"]+"(.*)"$/i
# ...
end
end
#!/usr/bin/env bash
set -v
# initial setup
tc qdisc del dev eth0 root # clear eth0
tc qdisc add dev eth0 root handle 2 htb default 1 # set default class
minSAD = VALUE_MAX;
// loop through the search image
for ( int x = 0; x <= S_rows - T_rows; x++ ) {
for ( int y = 0; y <= S_cols - T_cols; y++ ) {
SAD = 0.0;
// loop through the template image
for ( int i = 0; i < T_rows; i++ )
for ( int j = 0; j < T_cols; j++ ) {

Introvert

Incoming Call -> twilio app -> voice-to-text -> irc/IM bot notification

User can than respond within a timeout period to answer the call or ignore

irc/IM user response -> text-to-voice -> twilio app -> Caller