Skip to content

Instantly share code, notes, and snippets.

View pritul2's full-sized avatar
😉

Pritul Dave pritul2

😉
View GitHub Profile
class Monostate(object):
_shared_state = {}
def __new__(cls, *a, **kw):
obj = super(Monostate, cls).__new__(*a, **kw)
obj.__dict__ = _shared_state
return obj
class Foo(Monostate) pass
class Bar(Foo) pass
f = Foo()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Html elements not in w3 schools and important

  1. To draw the line in html :
  2. Adding the figure caption: ...
  3. Writing the shortforms in html: STFORM

Cheat sheet

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="author" content="Pritul Dave">
<meta name="description" content="About this web page">
<link rel="icon" href=".png" type="image/x-icon">
<link rel="stylesheet" href=".css" type="text/css">
<title>Index</title>
</head>
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 12 10:49:03 2022
@author: pritul
"""
import pandas as pd
import os
HTML quottation --> same as medium quotation
HTML image map --> Create the clickable areas on the image
Add icon to webpage --> HTML favicon
p and div vs when to use span --> p when we want to occupy new line vs span dont start in new line and dont add extra space
class vs id --> class can be assigned to many elements but id wont
<details> --> To provide small information in the form of widget
<figcaption> --> To provide the caption to the figure
&nbsp --> To add extra space ; &lt (less than) ; &gt (greater than) ; &amp (ampersand)
Alt + Enter --> Error, Suggestions and fixes
ctr + D ---> Duplicate the line
ctr + shift + arrow --> Change poisition of the line
ctr + X [without selecting] --> Delete whole line
ctr + / --> Adding comments
alt + shift + ctr + j ---> Multiple cursors on same occurence
shift + F6 --> refactor or rename variable with all occurence
ctr + alt + v --> convert expression to variable
ctr + alt + m --> convert expression to function
ctr + alt + l --> reformat the code
# compare different numbers of features selected using anova f-test
from numpy import mean
from numpy import std
from pandas import read_csv
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import RepeatedStratifiedKFold
from sklearn.feature_selection import SelectKBest
from sklearn.feature_selection import f_classif
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import Pipeline
1. Installation
sudo apt-get install python3.x
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.x get-pip.py
pip install --upgrade virtualenv
2. Creating the virtual environment
Go to pycharm add python interpreter in virtualenv envirnomnet
Obtain installed path of python [usually /usr/bin/python3.x]
\d : [0-9] single \D : not of \d
\w : [0-9][a-z][A-Z] single \W : not of \w
\s : whitespace or tab \S : not of \s
Special Characters:
. —> any character (including spaces)
* —> 0 or more
+ —> 1 or more
x? —> x is character and which is optional
[ ] —> referring as set of characters appearing anyone from set