Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Fairchild fairchild

  • Procore
  • California
View GitHub Profile
View gist:210507
#!/bin/bash
##CURL Request Directly to WATSON
WATSON_SERVER=
MINERVA_SERVER="ec2-174-129-82-133.compute-1.amazonaws.com"
PORT=80
W_PORT=9000
AUDIO_TEST_FILE="./files/india.au"
View gist:210506
##CURL Request Directly to WATSON
curl -i --header 'Transfer-Encoding: Chunked' "http://<WATSON_SERVER:PORT>/smm/watson?imei=hemant&grammar=business.search.lm&resultFormat=json&metrics=1&audioFormat=amr" --data-binary @<path_to_audio_amr_file>
##CURL Request to Minerva
curl -i --header 'Transfer-Encoding: Chunked' "http://<MINERVA_SERVER:PORT>/asr?imei=hemant&grammar=qme.lm&resultFormat=json&audioFormat=au" --data-binary @<path_to_audio_au_file>
## if you have a au audio file instead of the amr, change the audioFormat in the urls above. (applies to both minerva and watson)
## the grammar parameter is the one that points to a directory name under /mnt/grammars/lm, in case you want to change that to chacha
View gist:179418
#!/usr/bin/env ruby
require 'rubygems'
require 'thor'
require 'chef'
require 'chef/node'
require 'chef/rest'
# Please see the readme for overview documentation.
#
View clouds.rb
pool :sandbox do
cloud :hello_world do
instances 1..1
# Update with the path to your EC2 keypair
# If you don't have one, create with:
# $ ec2-create-keypair NAME > /path/to/your/keypairs/<NAME>
keypair "/path/to/your/keypairs/<NAME>"
View ec2-switch-context.sh
export JAVA_HOME=/Library/Java/Home #/usr on ubuntu
#export EC2_HOME=~/opt/ec2
export PATH=$EC2_HOME/bin:$PATH
export EC2_CONTEXTS_DIR=~/.ec2
export EC2_CONFIG_DIR=$EC2_CONTEXTS_DIR/current
ec2-switch-context() {
unset EC2_URL
unset S3_URL
unset EC2_PRIVATE_KEY
View ec2_manager.rb
require 'sinatra'
EC2_HOME = '~/.ec2'
use Rack::Auth::Basic do |username, password|
[username, password] == ['some_user', 'some_pass']
end
get "/" do
@links = %w{describe_ec2s restart_all_ec2s shutdown_all_ec2s}.map { |cmd|
@fairchild
fairchild / gist:150855
Created Jul 20, 2009 — forked from retr0h/gist:98308
content_type filter for sinatra
View gist:150855
CONTENT_TYPES = {:html => 'text/html', :css => 'text/css', :js => 'application/javascript'}
before do
request_uri = case request.env['REQUEST_URI']
when /\.css$/ : :css
when /\.js$/ : :js
else :html
end
content_type CONTENT_TYPES[request_uri], :charset => 'utf-8'
end
View bash_input.sh
#!/bin/bash
echo -n "Pick a color (blue, yellow, red ): "
read -e COLOR
echo It is a $COLOR day
View gist:121671
require 'rubygems'
$:.unshift "#{File.dirname(__FILE__)}/../lib"
require "poolparty"
pool :ap do
instances 1
access_key "XXXXXX"
secret_access_key "XXXXXXX"
cloud :app_stack do
View gist:118706
cloud-start -s config/clouds.rb
Starting cloud app (/home/yann/.ec2/testpoolparty)
0 running instances (1 - 1)
/usr/lib/ruby/gems/1.8/gems/grempe-amazon-ec2-0.3.8/lib/EC2.rb:261:in `ec2_error?': The key pair 'testpoolparty' does not exist (EC2::InvalidKeyPairNotFound)
from /usr/lib/ruby/gems/1.8/gems/grempe-amazon-ec2-0.3.8/lib/EC2.rb:199:in `make_request'
from /usr/lib/ruby/1.8/net/http.rb:543:in `start'
from /usr/lib/ruby/gems/1.8/gems/grempe-amazon-ec2-0.3.8/lib/EC2.rb:173:in `make_request'
from /usr/lib/ruby/gems/1.8/gems/grempe-amazon-ec2-0.3.8/lib/EC2.rb:224:in `response_generator'
from /usr/lib/rub
You can’t perform that action at this time.