Skip to content

Instantly share code, notes, and snippets.

View gowrishankarin's full-sized avatar
🎯
Focusing

Gowri Shankar gowrishankarin

🎯
Focusing
View GitHub Profile
@gowrishankarin
gowrishankarin / KarplusStrong.py
Created May 17, 2014 17:52
Karplus Strong Algorithm, y[n] = ay[n-M] + x[n]
class KarplusStrong:
def ks_loop(self, x, alpha, D):
import numpy as np
if D < 1:
print('Duration D must be greater than 1')
if x.ndim != 1:
print('The array entered is of the wrong size')
return None
@gowrishankarin
gowrishankarin / gist:390e53cc64d934330bb4
Created August 14, 2014 10:13
MVEL Expression Samples
Map vars = new HashMap();
vars.put("foobar", new Integer(120));
Boolean result = (Boolean) MVEL.eval("foobar > 99", vars);
if (result.booleanValue()) {
System.out.println("Hurrah");
}
@gowrishankarin
gowrishankarin / Application.java
Created August 18, 2014 15:34
JAXB Schema Generator
package com.tribe21.domain;
import java.io.IOException;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.SchemaOutputResolver;
public class Application {
@gowrishankarin
gowrishankarin / KnowledgeBuilder.java
Created August 19, 2014 17:49
Drools Knowledge Base and Builder
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newFileResource("/home/shankar/Public/licenseApplication.drl"), ResourceType.DRL);
if( kbuilder.hasErrors() ) {
System.err.println(kbuilder.getErrors().toString());
}
org.kie.internal.KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
@gowrishankarin
gowrishankarin / PIPError.java
Created November 4, 2014 11:08
Code Snippet for Receiving Rules Error
package com.prodapt.m2m.rest.domain;
public class PIPError {
private String type;
private String message;
private String ruleId;
private String contentInstanceId;
private String content;
@gowrishankarin
gowrishankarin / first_program
Created January 6, 2015 16:58
My first program in Apple Swift
// 1. Structure declaration
// 2. Enum declartion
// 3. Structure variables declaration
struct HTTPRequest {
enum Method {
case GET
case POST
}
@gowrishankarin
gowrishankarin / FindSimple.java
Last active August 29, 2015 14:14
Pronet find-simple API - Sample Program
@RequestMapping(method = RequestMethod.GET, value = {"/meters"})
public ResponseEntity<Object> getMetersInfo(
@RequestParam(value = "containerId", required = true)
String meterInfoContainerId,
@RequestParam(value = "resourceType", required = true)String resourceType,
@RequestParam(value = "key", required = true)String key,
@RequestParam(value = "value", required = true)String name,
@RequestParam(value = "type" , required = true)String type) {
# Course Project
# Coursera Getting and Cleaning Data
# Johns Hopkins University
# Author: Ben McKibben
# 2015-04-24
# https://github.com/bmckibben/Tidy_Data_Project/blob/master/run_analysis.R
# Requirements
#
# 1. Merges the training and the test sets to create one data set.
# 2. Extracts only the measurements on the mean and standard deviation for each measurement.
const fs = require('fs');
const http = require('http');
const crypto = require('crypto');
const image_location = 'some-image-in-current-folder.jpg';
const config = {
recognizeIm: {
clientId: '',
apiKey: '',
@gowrishankarin
gowrishankarin / ampq.js
Created November 27, 2016 10:00
NodeJS AMQP Connector and Receiver
function startAMQPReceiver() {
amqp.connect('amqp://' + CustomConfig.CC.aims.domain).then(function(conn) {
process.once('SIGNT', function() {
conn.close();
});
return conn.createChannel().then(function(ch) {
var ok = ch.assertQueue('heartspots', {
durable: true
});