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
#!/bin/bash
# from http://snippets.dzone.com/posts/show/10897
# source this file from bashrc
GOT_AGENT=0
for FILE in $(find /tmp/ssh-???*[0-9]* -type s -user ${LOGNAME} -name "agent.[0-9]*")
do
SOCK_PID=${FILE##*.}

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

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++ ) {
#!/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
Module Daikon
class Monitor
# ...
NEW_FORMAT = /^\+?\d+\.\d+[^"]+"(.*)"$/i
# ...
end
end
@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
-V-
4.
\-4
.~¢
J. ¢
, J;
\.,» , _,__|
'f -AI
-v LI;
_-. ._
<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>
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"]
)