Skip to content

Instantly share code, notes, and snippets.

View tvishwa107's full-sized avatar

Visvanathan Thothathri tvishwa107

View GitHub Profile
me = File.read("myfile.txt")
dataHash = JSON.parse(me)
require 'json'
require 'fuzzystringmatch'
require 'decisiontree'
#what are you returning??
# process inputs into some form and feed them into classifier
$training = Array.new
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <vector>
{
"data": [
{
"id": "244944385603396_829368210494341",
"from": {
"name": "Candy Crush Saga",
"category": "App Page",
"id": "244944385603396"
},
"message": "Remember you have until the end of July to participate in our #CandyCrushMakeUpChallenge for a chance to win amazing Candy Crush goodies! Info here: ttp://to.king.com/uoZg ",
arc(m,p,8).
arc(q,p,11).
arc(m,q,5).
arc(k,q,3).
arc(p,r,7).
arc(p,n,3).
arc(q,r,2).
arc(n,r,2).
distanced(X,Y,Z):-arc(X,Y,A),Z is A.
@tvishwa107
tvishwa107 / gist:6817406b930a879cc901
Created August 19, 2014 16:44
processor.conf - line 137
%{MONTH} ( )?%{MONTHDAY} %{TIME} %{HOST:server} %{YEAR:year}-%{MONTHNUM}-%{MONTHDAY} %{TIME:time} %{NUMBER:process_id} %{LOGLEVEL:log_level} %{NOTSPACE:msg} \[(-|%{GREEDYDATA})?\] (\(%{NUMBER:proc_id}\))?( )?%{IPV4:ip1}(,)?(%{IPV4:ip2})? - - \[%{MONTHDAY:junk_day}/%{MONTH:junk_month}/%{YEAR:junk_year} %{TIME:junk_time}\] \"(?<http_word>GET|PUT|POST|DELETE) /(?<api_version>v\d\.\d)/%{WORD:resource}(/(?<uuid>[a-fA-F0-9\-]+))?%{DATA:more_junk}\" (?<http_code>\d{3}) %{NUMBER:size} %{NUMBER:response_time}
Aug 19 11:30:18 10.23.81.53 2014-08-19 11:30:17.033 19171 INFO neutron.wsgi [req-e93ad2f6-0b42-4fa4-82a3-a70bf50c394a None] 10.13.135.227,10.13.143.140 - - [19/Aug/2014 11:30:17] "GET /v2.0/ports.json?device_id=ba8cedd7-0b94-471a-9c25-cb9a2cd0e338 HTTP/1.1" 200 1146 0.052790
Oops! QueryPhaseExecutionException[[logstash-2014.08.18][1]: query[filtered((_all:tags _all:neutron))->BooleanFilter(+no_cache(@timestamp:[1405784727673 TO 1408376727673]) -cache(BooleanFilter(_field_names:resource.raw)) -cache(BooleanFilter(_field_names:http_response)) -cache(BooleanFilter(_field_names:resource.raw)) -cache(BooleanFilter(_field_names:resource.raw)))],from[0],size[500],sort[<custom:"@timestamp": org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@4dc5e7e6>!,<custom:"@timestamp": org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@7bfbd4ed>!]: Query Failed [Failed to execute main query]]
@tvishwa107
tvishwa107 / gist:0d8c5efb0e3c3700e04f
Created August 15, 2014 16:38
Line 144 in processor.conf. Replace the message matching term with this
%{MONTH} ( )?%{MONTHDAY} %{TIME} %{HOST:server} %{YEAR:year}-%{MONTHNUM}-%{MONTHDAY} %{TIME:time} %{NUMBER:process_id} %{LOGLEVEL:log_level} %{NOTSPACE:msg} \[-\] (\(%{NUMBER:proc_id}\))?( )?(?<function>[a-z\_]+)( %{UUID:uuid})? for tenant (?<tenant>\d+|None)( (with )?filters {u'%{DATA:filter_1}': \[u'%{DATA:filter1_value1}'(\])?(, u'%{DATA:filter_2}': \[u'%{DATA:filter2_value}'])?(, u'%{DATA:filter1_value2}'\])?})? fields (\[\]|None)
Aug 14 21:28:15 neutron-api06.global.dfw.ohthree.com 2014-08-14 21:28:15.439 22560 INFO neutron.wsgi [-] 10.24.146.209,10.190.244.55 - - [14/Aug/2014 21:28:15] "GET /v2.0/subnets.json?id=eb491d5c-518b-4ac8-85cb-cff726a02582 HTTP/1.1" 200 1416 0.064948