How to extract domain name from given list of urls in Google sheet

In Google sheet, you can extract domain name from given url , just by using regextract function.

This is extraction using regular expression. In simpler words, this is getting result by validating certain pattern. This is fast and useful.

You can find,replace and extract information from large piece of text using this.

How to use Google Sheet to get bulk page status check and email alerts

If your website have thousands of page and you are manually checking them for latest page status, page speed or want to get alert when page is down, Google sheet will be useful.

Core concept is simple. Using macro, you can create custom functions to fetch webpage and check for status. Using Gmail, you can send the update. Lets start this process.

Step 1:

Make a copy of this sheet or create a blank sheet. Mark a column for full URL.

Step 2: Go to tools > script editor

Step 3: Copy this script

function statuscode(url) {
return UrlFetchApp.fetch(url).getResponseCode()
}

Save the code. Now you can use formula like this. =statuscode(” https://www.servloci.com/how-to-use-google-sheet-to-get-bulk-page-status-check-and-email-alerts/”)

Flask Bootstrap quick reference

installation :

pip install flask-bootstrap  

This will install bootstrap version 3.3.7

Import Bootstrap into Flask Application

from flask_bootstrap import Bootstrap
Bootstrap(app)

Extend Basic Template

{% extends "bootstrap/base.html" %}

Available building blocks

Available blocks

Block nameOuter BlockPurpose
doc Outermost block.
htmldocContains the complete content of the <html> tag.
html_attribsdocAttributes for the HTML tag.
headdocContains the complete content of the <head> tag.
bodydocContains the complete content of the <body> tag.
body_attribsbodyAttributes for the Body Tag.
titleheadContains the complete content of the <title> tag.
stylesheadContains all CSS style <link> tags inside head.
metasheadContains all <meta> tags inside head.
navbarbodyAn empty block directly above content.
contentbodyConvenience block inside the body. Put stuff here.
scriptsbodyContains all <script> tags at the end of the body.

Usages of all blocks are self-explanatory.

Support for Navigation using Flask-nav

Support for Forms using Flask-wtf
{% import “bootstrap/wtf.html” as wtf %}

How to add a specific folder to Pythonpath and why?

pythonpath is specific bash variable used by python interpreteur and compiler to search for modules. Most of time, we need to re-use codes and for it , specific function with desired set of input/output is required.

If you need to send different type of mails( from crontasks, from celery , after login , after invocation of reports api etc) , you can simply import send_email function and reuse it without re-writing email script (import email mode, attach file, fill out sender and reciepient address). For it, neither you have to engage a alltime running api service with all functions active.

Store all scripts in separate folder and add them to pythonpath. Next time, python can find and execute them.

Functions could be rearranged according to need. Now come to main point.

For Ubuntu

edit your .bashrc file and add this line.
export PYTHONPATH=$PYTHONPATH:/mnt/sdb1/mylibs

In this example, my personal library is on another disk and is in mylibs folder.

Hope , this will make your life better.

Experience with timbl broadband

If you are looking for broadband connection and want honest review about timbl broadband, My suggestion is no. Please do not subscribe timbl broadband.

DateTicket IDNature
20-01-20192022766C002Poor quality work in Installation
08-04-20192022766C007Connection Not Working
15-04-20192022766R004Not satisfied with services

Within 3 month of service, I found that their field service worker are not serving at all. Your money will be wasted and no one come to help neither they bothered to help you again.

I made 100+ calls to rectify the connection but all in vain. Finally , I decided to discontinue the service and advise other to do same.

Do not go with it. Choose any other.

R – Plumber Error “404 – Resource Not Found” Solution

This is frequently found error while running plumber proxy ( such as nginx)

location /api/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:9977/;
}

Match settings in nginx config . Rewrite url and proxy pass have ending “/” . This is working solution , tested on nginx on ubuntu ( 18.04)

How to Install different kernal in Jupyter Notebook

Install R Kernal :

Info could be found at https://github.com/IRkernel/IRkernel

install.packages('IRkernel')
IRkernel::installspec()

# in R 3.3
IRkernel::installspec(name = 'ir33', displayname = 'R 3.3')
# in R 3.2
IRkernel::installspec(name = 'ir32', displayname = 'R 3.2')



A connection to the notebook server could not be established. The notebook will continue trying to reconnect, but until it does, you will NOT be able to run code. Check your network connection or notebook server configuration

This problem is due to incorrect configuration of torando server. You need to uninstall tornado version 6 and install tornado version 5.1.1

To uninstall run : pip uninstall tornado

Install tonado : pip install tornado==5.1.1

Generate SSH key for your cloud server

Why you need ssh key for cloud server ?

This is one time setup which enable quicker and safe login experience . Username ,password login is no longer safe and reproducible. Switch to ssh login for quicker and secured login system.

How to generate it ?

Step 1: ssh-keygen -t rsa -b 4096

ssh-keygen -t rsa -b 4096

Step 2: Read keys and print it content , so you can copy-paste it in destination ssh keys (public key)

Step 3 : Login using ssh

ssh -i /path/to/ssh username@host_ip

Top 3 Stock Broker in India

I am sharing this with my experience and this is for retail investors. According to my experience , top 3 stock brokers are :

  1. Zerodha
  2. Upstox
  3. Samco Securities

Zerodha is best due to technical superiority,clean UI, lowest brokrages.
Pros:

  1. lowest brokrages – zero brokrage for delivery . Huge savings
  2. Easy interface.. Anyone will love it. Clean,organized and beautiful
  3. Good intraday margin for quality stocks
  4. Nice Calculator
  5. Nice Backoffice Admin

Cons :

  1. On volatile days, system slows , login errors and some client report unexpected trade executions
  2. Slower response to customer query.
  3. No margin on cash-n-carry delivery trades

Upstox :

Upstox is replicating zerodha model. Backoffice is not just good as Zerodha. Two noticable advantages on Upstox compared to zerodha is –

  1. Upstox started providing 2x margin on delivery trades at rate of 20/50000 excess margin utilized.
  2. API trading and historical data cost is cheaper than zerodha. API trade through upstox is 850 vs 2000 of zerodha. Similar historical data api is 550 vs 2000 of zerodha.

Both upstox and zerodha calculate same day squareoff trades as intraday. This is saving for both. Trader have to pay less transaction tax(STT) and Brokers earn some brokrages( as their delivery model is zero brokrage). Here brokrage is huge savings .

Samco is for long term quality traders. Samco brokrage is bit higher but with Samco Plus, you get upto 4x margin on selected stocks. You need to pay interest on extra margin utilized but in most cases, it is favor of you. Samco earn interest and more brokrage. You can buy more stocks in multi-legged strategy. With investment of re 50000, buy reliance worth 200000 and upon a simple per stock profit of 50, you can earn 4000 ( simple calculation ) with investment of just 50000 and it is without huge risk . You can buy stocks at 1300 and mamage free fall upto 1100 with any worries. When price will move upward after 15-30 days, still income is good. Samco for long term trading.