This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* decrypt s3 object using the secret key | |
* @param objectSummary s3 file summary reference to decrypt | |
* @param kmsCmkOld kms key obtained from objects userMetadata | |
* @return (String, String, Array[Byte]) tuple containing | |
* md5 hash of contents of the s3 object | |
* kmsKeyId kms key id for kms encryption on server side for the s3 object. | |
* data bytes in the decrypted s3 object | |
*/ | |
def decryptS3Object( objectSummary : S3ObjectSummary, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TabMI < ActiveRecord::Base | |
establish_connection MyDB | |
set_table_name 'tab' | |
set_primary_key 'tabid' | |
def taber(tabid) | |
tabinfo = TabMI.where(:tabid => tabid).first | |
puts "=============== Existing attr text #{tabinfo['ATTR_TEXT']}===============" ## Works perfect. | |
puts "=============== setting attr text to new attr===============" | |
tabinfo['ATTR_TEXT'] = "New Attr" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.net.URL; | |
import java.net.URLConnection; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Map; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<stdlib.h> | |
#include<string.h> | |
#define MAX 1024 | |
int main() { | |
int i =0; | |
char env[][MAX] = {"one", "two", "three" }; | |
char **newenv = NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PoolParty core loadtime: 0.146382 | |
No autoscalers defined | |
Launching new nodes and then shutting down original nodes | |
Starting node: 0... | |
Waiting for node to launch............. OK | |
Terminating node: 0... | |
running on CloudProviders::Ec2 | |
for cloud: monitor | |
minimum_instances: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BASE_DIR="/mnt/grammars" | |
curl="curl --retry 3 --silent --show-error --fail" | |
instance_data_url=http://169.254.169.254/latest/user-data | |
# Starting an instance | |
# ec2-run-instance --user-data-file "http://s3_url" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'java' | |
require '"#{File.dirname(__FILE__)}/<relative_path>/lib.jar" | |
include_class your.classname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
log = File.open('thread.log','w') ## logging to see threads flow. | |
TIMEOUT = 3 | |
t1 = Time.now | |
## Start a timer thread | |
timer = Thread.start { | |
log.puts 'Started.. ' |