Posts

Showing posts from February, 2022

Interview Question

Image
  Code: # Parse https://metacritic.com/game/playstation-4 import json import re from bs4 import BeautifulSoup; import requests; from flask import Flask; from flask import jsonify; # Webserver IP and port. host = "127.0.0.1" ; port = 5001 ; # Initialize Flask app app = Flask(__name__); url= "https://www.metacritic.com/game/playstation-4" ; #response = requests.get(url); #print (response); # If the response code is 403 then use user_agent = {'User-agent': 'Mozilla/5.0'} user_agent = { 'User-agent' : 'Mozilla/5.0' }; def webscrapper (): response = requests.get(url, headers = user_agent); #print(response); # This would return 200 # Parse the html file and save the objects #print(response.text); soup = BeautifulSoup(response.text, 'html.parser' ); #print (soup); # Create a dictionary to save the title and score. title = []; score = []; for i in soup.findAll( 'a' ,{ "class" :...

GitHub Server Upgrade

Image
  Post shows how to upgrade a single instance GitHub server.  Before starting the upgrade make sure the GitHub is put on to the Maintenance mode. Here, We are going to upgrade from version 3.0 to 3.2. I always recommend to check the compatibility matrix before doing any upgrade. Steps are pretty straightforward: 1) Take a backup/snapshot of your existing GitHub instance. 2) Do a clean reboot. 3) Make sure / (root) and /var filesystem has enough free space. 4) Download the package. 5) Upgrade using # ghe-upgrade <Package Name> During the upgrade process, your a new virtual root partition would be created (/dev/sda2) and the server will be rebooted once completed. Once the server rebooted, verify the upgrade completed using # ghe-version Finally. Login to the UI and wait for the service to be reloaded and remove the maintenance mode. Upgrade should not affect your existing license. We are done with the upgrade.

Collections - Part I

Image
Collection framework - Starting from Java 1.2  Earlier is was called java.utils package. From Java 1.5 its called collection and generics framework. Collection : Group of objects. Eg: Classroom is a group and students are objects. Library is a group and books are objects. In Java - Collection is a container object.  Container object: - Object inside object and access them as unique object. - Used for storing multiple homogeneous and heterogeneous, unique, duplicate objects without size limitation. Why collection ? - Ability to pass muliple values via single variable. Like variable a can hoold multiple variables. - Collection -> Container objects -> And can be represented by single name/variable. There are 4 ways to store value in Java: - Using variable  - Variable can store only one value. - If you want to store 100 values then we need to create 100 variables. - This will result in performance degrade while reading values and execution time. - So we ...

Redis Server Installation and Operations

Image
  Redis is an in-memory key-value store known for its flexibility, performance, and wide language support. Redis (for REmote DIctionary Server)is an open source, in-memory, NoSQL key/value store that is used primarily as an application cache or quick-response database.  Because it stores data in memory, rather than on a disk or solid-state drive (SSD), Redis delivers unparalleled speed, reliability, and performance. Installation steps: 1) Update the repository. root@docker:~# apt-get update 2) Install redis server. root@docker:~# apt-get install redis-server 3) Update /etc/redis/redis.conf - supervised to enable redis service to start on boot. #   supervised no      - no supervision interaction #   supervised upstart - signal upstart by putting Redis into SIGSTOP mode #   supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET #   supervised auto    - detect upstart or systemd method based on #...

Kubernetes - Tenant

Image
Kubernetes supports multiple virtual clusters backed by the same physical cluster. These virtual clusters are called namespaces. Namespaces are intended for use in environments with many users spread across multiple teams, or projects. Namespaces are a way to divide cluster resources between multiple users. root@kubemaster:/# kubectl get namespace NAME              STATUS   AGE default           Active   5d22h kube-node-lease   Active   5d22h kube-public       Active   5d22h kube-system       Active   5d22h root@kubemaster:/# kubectl create namespace production namespace/production created root@kubemaster:/# kubectl create namespace development namespace/development created root@kubemaster:/# kubectl get namespace NAME              STATUS   AGE default        ...

GitHub - API

Image
What is a GitHub ? GitHub is a website and cloud-based service that helps developers store and manage their code, as well as track and control changes to their code.  Version control helps developers track and manage changes to a software project’s code. Most of Git operations can be performed by GUI. But, GitHub also provides API's to integrate its functionality in CI/CD pipepline. https://docs.github.com/en/get-started Before using GitHub API, You should be generating a token for authentication. Token can be generated from https://github.com/settings/tokens. Make sure the token has proper scope (permissions) to perform required operations. Below is the code to perform list all the repositories, create a repository, delete a repository. import json; import requests; baseurl= "https://api.github.com" ; token= "token" ; username= "rsinfominds" ; orgname= "RSInfoMindss" ; # I created a github organization called "RSInfoMindss" # https...