Regex to check top domain in DNS

Today I come to a situation where I need to find if my string has .com/.edu/.au/.info/.in or similar kind of word in it or not. And while designing a regex pattern I kept following thought process.. It will have alphanumeric characters, i.e letters, numbers, underscores and periods(dot), dashes, -, followed by a period(dot) and a

read N lines at a time file python

Here requirement is that, I want to process a file from row number N to row number N+X One solution might be, use itertools.islice to get the lines from the file between the given range of start and end.e.g for row no 3 to 6 : For example purpose I have take a file with

UserWarning: Could not import the lzma module

Got following error after import turicreate /home/prod/anj/learn/ml/mlvenv/lib/python3.7/site-packages/pandas/compat/__init__.py:117: UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError. warnings.warn(msg) Fix: I have ubuntu: For it sudo apt-get install liblzma-dev Reading package lists... Done Building dependency tree Reading state information... Done Now I will go to

Add python3.7 as alternate python along with default on Ubuntu

My default python is 2.7 and I want python 3.7 along with it: Go to opt directory $ cd /opt Create a directory $ mkdir python3 Download Python 3.7 $ wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz Extract the python 3.7 tar file $ tar xzf Python-3.7.4.tgz To compile the source go to $ cd Python-3.7.4 To get release build with all

Create a Virtual environment for python 3

I have Ubuntu and it has python 2.7 as default. Along with it I have configured python3 as well. To create a virtual environment for a python 3 project I have executed following virtualenv -p /usr/bin/python3 mlvenv It created a virtual environment named mlvenv Now to activate it source mlvenv/bin/activate To confirm python --version

Explain the top command in linux

​Top command is used to check server processes in Linux. Top command shows all running processes in current host. It displays the current system information and the processes information which includes: host-up-time average load tasks running no. of users logged in no. of CPU processes RAM utilisation lists all the processes running/utilized by the users

Check directory size

# To check size of partition df -h # To check size of directory du -s -h /var/log/ #To check every directory and file sizes under a dir. du -s -h /var/log/* #To check individual size du -s -h /var/log/lastlog

c/_cffi_backend.c:2:20: fatal error: Python.h: No such file or directory

Error c/_cffi_backend.c:2:20: fatal error: Python.h: No such file or directory #include ^ compilation terminated. Traceback (most recent call last): File “”, line 17, in ———————————————————————- Here it is the problem of python devel For centos use “sudo yum install python-devel.x86_64” For Ubuntu use “sudo apt-get install python-dev”

Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0

configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+. Try the –with-gmp, –with-mpfr and/or –with-mpc options to specify their locations. Source code for these libraries can be found at their respective hosting sites as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also http://gcc.gnu.org/install/prerequisites.html for additional info. If you obtained GMP, MPFR and/or MPC from