Posts

Kubernetes Setup : Linux

  Kubernetes Environment  Setup Note : Kubeadm is currently in strong development, hence it is not recommended in production. sudo apt-get remove docker docker-engine docker.io sudo apt-get update && sudo apt-get install  -y apt-transport-https  ca-certificates    curl      software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo apt-key fingerprint 0EBFCD88 sudo add-apt-repository  "deb [arch=amd64] https://download.docker.com/linux/ubuntu   $(lsb_release -cs)  stable" sudo apt-get update && sudo apt-get install docker-ce=17.03.0~ce-0~ubuntu-xenial cat << EOF > /etc/docker/daemon.json { "exec-opts": ["native.cgroupdriver=systemd"] } EOF systemctl enable docker && systemctl start docker                ...

Program excercise : Write a function that, using the Star Wars API (swapi.co), takes a character name, and returns a list with the names of the films that character was in.

import requests, json def get_film_details_by_url(film_url):     resp = requests.get(film_url)     return_dict = None     if resp.status_code == 200:         return_dict = json.loads(resp.text)     return return_dict       def get_film_details_by_char_name(char_name):     swapi_base_url = "https://swapi.co/api/"     get_people_url = swapi_base_url+"people"     film_url_array = []     film_name_array = []     to_continue = True     while to_continue:         resp = requests.get(get_people_url)         if resp.status_code == 200:             resp_dict =  json.loads(resp.text)             for ppl in resp_dict["results"]:                 if ppl["name"].lower() == char_name.lower():   ...

Program excercise : Write a function that takes two lists of strings as input, and returns a single list of unique strings common to both lists.

def common_strings(str_list1, str_list2):     return [str_value for str_value in str_list1 if str_value in str_list2] Another way, def get_common_strs(list1,list2):     return list(set(list1).intersection(set(list2)))

Program excercise : Write a function that takes a dictionary with numeric values and returns the keys of the top 3 highest values.

def get_top3_values_indices(input_dict, col_range=3):     all_values = list(set(input_dict.values()))     all_values.sort(reverse=True)     top_values = all_values[:col_range]     return [k for k in input_dict.keys() if input_dict[k] in top_values]

How to Install minikube in local mac machine?

Install hyperkit git clone https://github.com/moby/hyperkit cd hyperkit Make To enable qcow support in the block backend an OCaml OPAM development environment is required with the qcow module available. A suitable environment can be setup by installing opam and libev via brew and using opam to install the appropriate libraries: $ brew install opam libev $ opam init $ eval `opam config env` $ opam install uri qcow.0.10.3 conduit.1.0.0 lwt.3.1.0 qcow-tool mirage-block-unix.2.9.0 conf-libev logs fmt mirage-unix prometheus-app Download kubectl curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/darwin/amd64/kubectl chmod +x ./kubectl sudo mv ./kubectl /usr/local/bin/kubectl Or use brew brew install kubectl Install xhive driver brew install docker-machine-driver-xhyve sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xh...

.NET Web CI with jenkins

Install jenkins - https://jenkins.io/download/ Install MSBuild plugin Navigate to Manage jenkins -> Manage plugins Navigate to Available Find MSBuild Select it and install it by selecting the option “Install without restart” If MSBuild.exe doesnot exist in server, download it.   https://www.visualstudio.com/downloads/ Choose Other Tools and Frameworks-> Build Tools for Visual Studio Download it and install it. (Select Build tools and .NET Dependencies) Setup MSBuild Navigate to Manage Jenkins -> Configure System Find MSBuild If it is not there, Navigate to Manage Jenkins -> Global Tool Configuration Find MSBuild Click on Add MSBuild Create a name. It is user defined. Add MSBuild.exe path Save the settings. Setup github Navigate to Manage Jenkins ->  Global tool configuration Find Git settings / Git installations Set git.exe path Save the settings Setup Github credentials. Nav...