Wednesday, March 7, 2018

Some useful software to explore

Filebeat to read line by line
Redis   for buffer
Log stash for data transforms

Kafka  for buffer
Kibana

Some handy bash script


1. Find all files with certain text
         grep -rinw   -e 
         [r] recursive, [i] case insensitive, [n] line number [w] whole word

2. Replace all the text1 with text2 in all files
        sed -i 's/old-word/new-word/g' *.txt

   

Tuesday, September 29, 2009

MEMORY IS THE MOTHER OF WISDOM

Wednesday, September 23, 2009

what is the next no in following series

Q : 12 42 48 168 1722 ?

ans: 4542

explanation: reverse the digit of numbers and then mutliply by 2.


Saturday, September 19, 2009

Problem:
Let there are two cone.one contains 1 litre milk and other contain 1 litre water.if i take one cup milk from first and droped into second.then again i took one cup mixture from seecond and droped into first one.
Is the amount of milk in first is same as amount of water in second?

Ans: yes
explanation:
let amount of liquid in cup is c.
cane 1 cane 2
step 1:
Water 0 1

milk 1 0
step2:

water 0 1

milk 1-c c

conc^n of milk in second cone is c/(1+c) and of water 1/(1+c)

in one cup amount of milk =c* c/(1+c) amount of water c/(1+c)

step3:

water c/(1+c) 1-c/(1+c)=1/(1+c)
milk 1-c+c*c/(1+c)=1/(1+c) c-c*c/(1+c)=c/(1+c)
...proved


River crossing puzzle

There are 3 couples who want to cross the river.

Raja-wife A - P
Wajir-wife B - Q
Sainik-wife C - R

Rule s
1. There is a boat of capacity 2.
2. Saink and his wife cant travel with other fours since they are of low category
3. If on any side there is a single man with either 2 or 3 wives, he will run away with them .For the sake of simplicity I assumed the characters as below and in same order –

Males - A B C

Females -P Q R

A

B

C

|




P

Q

R

|







|




A

B


|



C

P

Q


|



R




|




A

B

C

|




P

Q


|



R




|




A

B

C

|







|

P

Q

R




|




A

B

C

|






R

|

P

Q





|






C

|

A

B




R

|

P

Q





|





B

C

|

A




Q

R

|

P






|





B


|

A


C


Q


|

P


R




|




A

B


|



C

P

Q


|



R




|







|

A

B

C

P

Q


|



R




|







|

A

B

C

P

Q

R

|







|

A

B

C




|

P

Q





|






C

|

A

B




R

|

P

Q





|







|

A

B

C




|

P

Q

R