Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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!")
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 / 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.