Skip to content

Instantly share code, notes, and snippets.

View apremalal's full-sized avatar

Anuruddha apremalal

View GitHub Profile
@apremalal
apremalal / Dockerfile
Created February 9, 2021 10:49
golang sql-migrate
FROM golang:1.15.8
WORKDIR /app
RUN mkdir -p /app/resources/db/mysql
RUN go get -v github.com/rubenv/sql-migrate/...
RUN git clone https://github.com/vishnubob/wait-for-it.git
RUN chmod -R 777 /app/wait-for-it
RUN chmod +x /app/wait-for-it/wait-for-it.sh
EXPOSE 9090
@apremalal
apremalal / build.sh
Created August 17, 2016 01:26
Exclude vendor directory from goimports, go fmt,go install, go test ...
echo 'Formatting the code base...'
godep go fmt $(go list ./... | grep -v /vendor/)
echo 'Optimizing the imports...'
goimports -w $(go list -f {{.Dir}} ./... | grep -v /vendor/)
echo 'Installing dependencies. This might take some time...'
godep go install $(go list ./... | grep -v /vendor/)
echo "Executing test"
package main
import (
"encoding/json"
"os"
"database/sql"
"gopkg.in/gorp.v1"
"log"
_ "github.com/go-sql-driver/mysql"
)
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
templatedir=$confdir/templates
[master]
# These are needed when the puppetmaster is run by passenger
<executionPlan xmlns="http://wso2.org/carbon/eventprocessor" name="isWithinCheckExePlan" statistics="enable" trace="enable">
<description />
<siddhiConfiguration>
<property name="siddhi.persistence.snapshot.time.interval.minutes">0</property>
<property name="siddhi.enable.distributed.processing">false</property>
</siddhiConfiguration>
<importedStreams>
<stream as="locationdatastream" name="locationDataInputStream" version="1.0.0" />
</importedStreams>
<queryExpressions><![CDATA[from locationdatastream[geo:iswithin(lattitude,longitude,"{'type':'Polygon','coordinates':[[[79.85173402706208,6.909744100877063],[79.85442696491334,6.91094765233452],[79.85471664348692,6.9097654026993816],[79.85173402706208,6.908796168811299],[79.85173402706208,6.909744100877063]]]}")==true] select correlation_timeStamp,deviceId,lattitude,longitude, true as iswithin insert into iswithinstream;]]></queryExpressions>
<eventFormatter xmlns="http://wso2.org/carbon/eventformatter" name="gpsOutputEventFormatter" statistics="enable" trace="enable">
<from streamName="isWithinOutputStream" version="1.0.0" />
<mapping customMapping="enable" type="json">
<inline>
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
{{lattitude}},
<eventBuilder>
<from eventAdaptorName="httpInputAdaptor" eventAdaptorType="http">
<property name="topic">locationInStream</property>
</from>
<mapping customMapping="enable" type="json">
<property>
<from jsonPath="$.properties.timestamp" />
<to default="0" name="correlation_timeStamp" type="string" />
</property>
<property>
<streamDefinitions>
<streamDefinition>
{
"name": "locationDataInputStream",
"version": "1.0.0",
"nickName": "",
"description": "",
"correlationData": [
{
"name": "timeStamp",
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
79.852452,
6.909472
]
},
"properties": {
@apremalal
apremalal / detector.cpp
Created October 19, 2013 03:21
Microfilari detection based on Canny edge detection.
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace cv;
using namespace std;
Mat src; Mat src_gray;