Skip to content

Instantly share code, notes, and snippets.

View mysticBliss's full-sized avatar
🏠
Working from home

myticBliss mysticBliss

🏠
Working from home
View GitHub Profile
### Keybase proof
I hereby claim:
* I am mysticbliss on github.
* I am saqie (https://keybase.io/saqie) on keybase.
* I have a public key ASDQHOYpCBJsOvBkw6SYayonsx2ejyCJKml1BCeCPKV5Pwo
To claim this, I am signing this object:
ambari-server stop
ambari-agent stop
pkill -9 java
#################################
# Remove Packages
################################
yum -y remove ambari-\*
yum -y remove hcatalog\*
yum -y remove hive\*
@mysticBliss
mysticBliss / BasicsOf-OOPS.md
Created February 25, 2018 14:25
Basics Of-OOPS
# Library
# Abstractions-- list of books, lendbook, addbook, removebook

# Student
# - order book 
# - return book
@mysticBliss
mysticBliss / Getting unique elements from List.md
Last active February 2, 2018 10:44
Getting unique elements from List

Getting unique elements from List

mylist = [1,2,3,4,5,6,6,7,7,8,8,9,9,10]

Using Simple Logic from Sets - Sets are unique list of items

mylist=list(set(mylist))
@mysticBliss
mysticBliss / Generator.md
Last active February 2, 2018 06:33
Generator

Generator(s): python

Yield result one by one!

Generators are used to create iterators, but with a different approach. Generators are simple functions which return an iterable set of items, one at a time, in a special way.

When an iteration over a set of item starts using the for statement, the generator is run. Once the generator's function code reaches a "yield" statement, the generator yields its execution back to the for loop, returning a new value from the set. The generator function can generate as many values (possibly infinite) as it wants, yielding each one in its turn.

Fibonacci series

def fib():

Explain all the file processing modes supported by Python ?

Python allows you to open files in one of the three modes. They are: read-only mode, write-only mode, read-write mode, and append mode by specifying the flags r, w, rw, a respectively.

A text file can be opened in any one of the above said modes by specifying the option t along with r, w, rw, and a, so that the preceding modes become rt, wt, rwt, and at.

A binary file can be opened in any one of the above said modes by specifying the option b along with r, w, rw, and a so that the preceding modes become rb, wb, rwb, ab.

@mysticBliss
mysticBliss / tech-interview-guide.md
Created November 27, 2017 07:39 — forked from vicyap/tech-interview-guide.md
tech interview guide

A quick guide on getting ready for tech interviews.

Chitchat like a pro.

Before diving into code, most interviewers like to chitchat about your background. They're looking for:

  • Metacognition about coding. Do you think about how to code well?
  • Ownership/leadership. Do you see your work through to completion? Do you fix things that aren't quite right, even if you don't have to?
  • Communication. Nerd out about stuff. Show you're proud of what you've done, you're amped about what they're doing, and you have opinions about languages and workflows.
  • STAR (Situation, Task, Action, Result). It’s good to have a project in your back pocket that you can talk about in a direct and concise way.

Coding Question

Interview Sample Question

    1. why is not all memory free when Python exits?
    1. write the output of below code:
   var1 = lambda q: q * 5
   var2 = lambda q: q * 3
   x = 2
   x = var1(x)
   x = var1(x)
   x = var1(x)
@mysticBliss
mysticBliss / python-interview-tests
Created November 27, 2017 07:34 — forked from davidlu1001/python-interview-tests
python-interview-tests
http://programmers.stackexchange.com/questions/21917/python-interview-questions
https://github.com/sigmavirus24/python-interview-questions
https://gist.github.com/xiangzhuyuan/7454001522d275021b2d
https://github.com/ContinuumIO/interview-questions
https://github.com/Flowerowl/python_articles
http://marselester.com/preparation-to-python-interview.html
https://github.com/zachwill/cracking-the-coding-interview
http://www.bogotobogo.com/python/python_interview_questions.php
https://www.quora.com/What-are-good-Python-interview-questions
https://www.reddit.com/r/Python/comments/1knw7z/python_interview_questions
# Given a two dictionaries empdesig and empdet containing details about employees and managers in a key value pair - print a hierarchical tree
# empdesig = {'Simha': 'Khan', 'Khan': '', 'Vijay': 'Simha', 'Sai': 'Khan', 'Kiran': 'Kiran'}
# empdet = {'Simha': 'Khan', 'Khan': '', 'Vijay': 'Simha', 'Sai': 'Khan', 'Kiran': 'Kiran'}
# If an employee has manager null(like Khan) or has manager as himself - then they are board members and have no bosses.
for emp,mgr in empdesig.items():
new[emp] = {key:'' for key,value in empdesig.items() if value == emp}
for k,v in new.items():