Intrvw: Difference between revisions
→Google GCP Workspaces
(20 intermediate revisions by the same user not shown) | |||
Line 1:
= Google GCP Workspaces =
* Code:
<syntaxhighlight lang='python'>
with open('tab.txt','r') as tab, open('csv.txt','r') as csv, open('data.txt','w') as data:
for line in tab.readlines():
data.write(' '.join(line.strip().split('\t'))+'\n')
for line2 in csv.readlines():
data.write(' '.join(line2.strip().split(','))+'\n')
data.close()
with open('data.txt','r') as file:
for line in file.readlines():
print(line)
</syntaxhighlight>
* Code2:
<pre>
def analyze(numbers):
result = []
index = {}
min = None
max = None
for n in numbers:
index[n] = True
if not max or n > max:
max = n 9
if not min or n < min:
min = n 0
for n in range(min + 1, max):
if not n in index:
result.append(n)
return result
analyze()
4,5,6,7,8
3rd
0—-
analyze([5,9])
(6,9)
result = [6,7,8]
analyze([3,0,5,9])
4,3
Result = [1,2,4,6,7,8]
</pre>
* Equivalent Code:
<pre>
def analyze(numbers):
min = None
max = None
for n in numbers:
print(n)
if not max or n > max:
max = n
if not min or n < min:
min = n
print("max: ",max," min: ",min)
</pre>
* Results:
<pre>
>>> analyze([3,0,5,9])
3
max: 3 min: 3
0
max: 3 min: 0
5
max: 5 min: 5
9
max: 9 min: 5
</pre>
* Logic:
<pre>
>>> min = None
>>> not min
True
>>> min = 0
>>> not min
True
</pre>
* Working code for Min & Max:
<pre>
def analyze(numbers):
min = 0
max = 0
for n in numbers:
print(n)
if n > max:
max = n
if n < min:
min = n
print("max: ",max," min: ",min)
</pre>
= Amzn SysDE II =
* Recover from below issue:
chmod -x /bin/chmod
# Copy
# tar -file
# ld
* Coding
<syntaxhighlight lang='python'>
## Write a function that gives you the average latency in a log file with the following format
#
# timestamp requestid operation latency
# 2021-01-20T08:19:18+00:00 123e4567-e89b-12d3-a456-426614174000 getresults 175
# 2021-01-20T08:19:20+00:00 123e4567-e89b-12d3-a456-426614174100 submitquery 100
# 2021-01-20T08:19:21+00:00 123e4567-e89b-12d3-a456-426614174200 getquerystatus 60
# 2021-01-20T08:20:03+00:00 123e4567-e89b-12d3-a456-426614174300 getresults 150
# 2021-01-20T08:22:09+00:00 123e4567-e89b-12d3-a456-426614174400 cancelquery 20
}
path = input('')
#path = '/var/log/messages'
r = []
with open(path,'r') as file:
for line in file:
r.append(line.split()[-1])
avg_Latency = sum(r)/len(r)
print(avg_Latency)
--------------------------------------
#path = input('')
def avg_lat(path):
#a = 0
#rr = 0
latency = {}
occurrence = {}
with open(path,'r') as file:
for line in file:
try:
c = line.split()[-1]
if int(c):
#a += 1
#rr = rr + int(c)
latency['getresults']
oper.update({line.split()[-2]:line.split()[-1]})
except:
pass
latency = {
'getresults': 455,
'submitquery': 678
...
}
occurrences = {
'getresults': 4,
'submitquery': 9
}
latency.get('getresults')
#return (rr/a)
avg_lat('/var/log/syslog')
</syntaxhighlight>
;Debrief
<pre>
feedback - team liked, pleasure in interview
strong NW
stron linux
LP fine
L4 is not good for you
System design not good
DB using indexing, Queues, scalable, parallel approach, LB using, indexing DBs, instead of storage.
Coding was also OK, difficulty with dictionary
Should know Datastructures not algorithms
Try again in 6 months, ask HR & try to get exception.
</pre>
* Correct Code:
<pre>
latency ={}
occurrance = {}
with open('latency2.logs','r') as file:
for line in file:
lat = int(line.split()[-1])
oper = line.split()[-2]
if oper in latency.keys():
add_latency = latency.get(oper) + lat
occurrance.update({oper:occurrance.get(oper)+1})
else:
add_latency = lat
occurrance.update({oper:1})
latency.update({oper:add_latency})
print(latency)
print(occurrance)
for k,v in latency.items():
print(k,int(v/occurrance.get(k)))
</pre>
= MasterCard =
* SSL Handshake
* TCP 3-Way Handshake
* TLS 1.0 vs TLS 3.0
* curl -kv (meaning of k)
* HTTP
= Microsoft =
;HM Round:
Line 383 ⟶ 620:
<pre>
# Read the file
f = open('/var/log/apache2/access.log','r')
lines = f.readlines()
Line 1,446 ⟶ 1,683:
= TechM (Chd) =
= ZScalar (Chd) =
;2nd Level
= Convergys (JTAC L2) =
* VPN traffic is not reaching other gateway device? How to prove?
* What filters to use for VPN Traffic?
* 4 VPNs between 2 devices, how to identify which packet is for which VPN?
* ESP has Port no?
* IMP:What is NAT-T? Why packet will drop without NAT-T? at which packet exchange will it drop?
*Scenario 1:
Line 1,540 ⟶ 1,776:
= TechM (Chd) =
= Akamai =
= Iopex =
= Arcesium =
Line 1,593 ⟶ 1,828:
* Which cmd sets max size of core dumps? ulimit
* Which cmd used to inspect system call made by running proces?
* In bash which cmd used to execute a shel script in current shel context?
* Print top 5 lines
* Redirect error stream to file errors? foo2>errors?
* Command used to create a new process? fork()
Line 1,609 ⟶ 1,844:
* init was replace by which default service manager in RHEL? systemd
* Check env variables of a running process?
* Web Server can do what?
* HTTP/2 was inspired by what? SPDY
* Most commonly used compression in response from server to client in HTTP? gzip
Line 1,623 ⟶ 1,858:
= Interview Questionaire =
* Benefit of using Transparent mode?
* Basic difference between IDS & IPS?
* SSL VPN
* Phase 1,2 no of packets? encryption starts at which packet in VPN?
* PFS
* VPN Troubleshooting
* Stateful Inspection
* Aggressive mode / Main mode more secure?
* Task/Flow CPU High
* Reasons for High Memory?
;ScreenOS
* Flow in Netsreen firewall
* MIP vs VIP
* Multi-Cell policy
* Traffic Shapping is config where?
* 100 VPNs terminating on the Juniper firewall? Filter
* Pseudo session ?
* Snoop Detail?
* Debug flow basic
* Precautions while debugging
* Sync NSRP devices manually
* NSRP non-propagating parameters
* How to avoid Split-Brain scenario?
* How to avoid No Brain scenario?
* Secondary path in NSRP
= Achievements =
* Rockman Cyberoam ARP script
* Rockman Nagios Monitoring
* Wipro BP SRX & NSM Repro
* Citrix SDWAN VoIP repro
* Citrix CodeRed - PHP/Laravel
* AVI Case Alert script
* AVI config Parser
* AWS VPN Log Parser
* Endian Firewall Deployments
* NIC Snort IDS
* NIC Nessus Vulnerability
* Citrix SDWAN SME/Dev Deployment
* Cloudwatch Alarm S3 Bucket Objects Lambda function
|