Skip to content

Instantly share code, notes, and snippets.

@tilakpatidar
tilakpatidar / NLP Lab workshop 17th May 2016.md
Last active May 17, 2016 12:44
Resource links for the workshop conducted by NLP lab on 17th May 2016.

#Semantic Search engine – NLP lab

###17/05/2016 Task

http://blog.aiesec.in/

Use the above blog to scrap the following information and show in terminal (ubuntu) or in a file in windows.

def value(k, degree, coefficients):
ans = 0
prev = 1
for i in xrange(degree+1):
if i != 0:
prev = prev * k
ans += coefficients[i] * prev
return ans
degree = input()
coefficients = map(int,raw_input().split())
@tilakpatidar
tilakpatidar / clojure_basics.clj
Last active January 24, 2017 11:41
clojure basics
;Clojure is compiled language but has a eval function like lisp which allows to run compiler within execution
;Visit https://learnxinyminutes.com/docs/clojure/ for more gists
5 ; ⇒ 5
"hi" ; ⇒ "hi"
[1 2 3] ; evaluates to the vector `[1 2 3]`
(+ 1 2) ; evaluates to the sum of 1 and 2
(if true "yes" "no") ; evaluates to the string "yes"
(println "hello!") ; evaluates to nil (but also prints "hello!")
@tilakpatidar
tilakpatidar / delete_by_query.py
Created April 5, 2017 05:28
Elasticsearch delete by query
import elasticsearch as es
db = es.Elasticsearch(['y-monitoring-vm2.dnspam'], port= 9200)
db.delete_by_query(index= 'lake_garda_hadoop-test', doc_type='stock_accuracy', body={})
@tilakpatidar
tilakpatidar / 0_reuse_code.js
Created April 15, 2017 07:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tilakpatidar
tilakpatidar / lazy_eval_functions.scala
Last active April 15, 2017 07:34
Describes the usage of non-strict functions in scala using lazy and => syntax.
//passing functions as params and executing them when required
def if2[A](cond: Boolean, onTrue: () => A, onFalse: () => A): A ={
if (cond) onTrue() else onFalse()
}
//=> using arrow syntax pass params as unevaluated but they will be
//evaluated once they are referenced no need to mention () to execute them
def if2[A](cond: Boolean, onTrue: => A, onFalse: => A): A ={
if (cond) onTrue else onFalse
}
@tilakpatidar
tilakpatidar / lazy_val.scala
Created April 15, 2017 07:53
From http://stackoverflow.com/questions/7484928/what-does-a-lazy-val-do Example of how lazy val does memoization. Values are evaluated on first call only.
val x = { println("x"); 15 }
//x
//x: Int = 15
lazy val y = { println("y"); 13 }
//y: Int = <lazy>
x
//res2: Int = 15
y
//y
@tilakpatidar
tilakpatidar / monit_http_monitor.conf
Created April 19, 2017 08:47
Monit monitor process without pid instead using HTTP request
check host appsrv1 with address 127.0.0.1
start program = "/sbin/start myapp"
stop program = "/sbin/stop myapp"
alert alerts@example.com on {timeout,connection}
if failed port 9009 protocol HTTP
request /
with timeout 3 seconds
then restart
if 10 restarts within 10 cycles then timeout
if 10 restarts within 10 cycles then exec "/usr/bin/monit start aws-dns-healthcheck"
@tilakpatidar
tilakpatidar / keybase.md
Created August 10, 2017 10:01
My keybase declaration

Keybase proof

I hereby claim:

  • I am tilakpatidar on github.
  • I am tilakpatidar (https://keybase.io/tilakpatidar) on keybase.
  • I have a public key ASBrc8-ucimp_8n0hPOuAsj1mFBpAf84XYHuuGuTavTTewo

To claim this, I am signing this object:

@tilakpatidar
tilakpatidar / gobblin-source-schema.md
Last active December 19, 2017 10:20
Gobblin Converters schema documentation

Source Schema and Converters

Source schema

A source schema has to be declared before extracting the data from the source. To define the source schema source.schema property is available which takes a JSON value defining the source schema. This schema is used by Converters to perform data type or data format conversions. The java class representation of a source schema can be found here Schema.java.

Converters

In Gobblin library a Converter is an interface for classes that implement data transformations, e.g., data type conversions, schema projections, data manipulations, data filtering, etc. This interface is responsible for converting both schema and data records. Classes implementing this interface are composible and can be chained together to achieve more complex data transformations.

A converter basically needs four inputs:

  • Input schema