This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int searchItem(int sist[],int item,int sizeList){ | |
int position=0; | |
while(position<(sizeList-1)){ | |
if(sist[position]==item){ | |
break; | |
}else{ | |
position++;} | |
} | |
return position; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int searchBinary(int arrayList[],int findNum,int first , int last ){ | |
while(first<=last){ | |
int middle =( last+first)/2; | |
if(arrayList[middle]==findNum) | |
return middle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""This sample code works on binary classification to generatre True Positive Rate and False Positive Rate (TPR, FPR) by class. | |
Yes denotes positive class and No denotes negative class. | |
Default value 0 and 1. | |
Created by Ahmed Shahriar Sakib @ahmedshahriar on 06.08.2020 """ | |
yes_tp = 0 | |
yes_fp = 0 | |
no_tp = 0 | |
no_fp = 0 | |
yes_instances =0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scrapy | |
class QuotesSpider(scrapy.Spider): | |
name = "quotes" | |
start_urls = [ | |
'http://quotes.toscrape.com/page/1/', | |
] | |
def parse(self, response): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import re | |
headers = { | |
'authority': 'www.amazon.com', | |
'pragma': 'no-cache', | |
'cache-control': 'no-cache', | |
'dnt': '1', | |
'upgrade-insecure-requests': '1', | |
'user-agent': 'Mozilla/5.0 (X11; CrOS x86_64 8172.45.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.64 Safari/537.36', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
@ github.com/ahmedshahriar | |
This code will remove remove non-English words from text | |
""" | |
import nltk | |
# download nltk english corpus | |
nltk.download('wordnet') | |
wordnet = set(nltk.corpus.wordnet.words()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
code snippet to add/subtract datetime object | |
https://github.com/ahmedshahriar | |
""" | |
from datetime import datetime, timedelta | |
# addition | |
d = datetime.now() + timedelta(days=1, weeks=1, hours=19,seconds=1,milliseconds=1,microseconds=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
simplify price with currency sign to number | |
""" | |
# sample | |
txt = "$5,200" | |
txt[1:].replace(',','') | |
# output | |
# 5200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
code snippet for selenium with fake user agent | |
selenium : https://selenium-python.readthedocs.io/ | |
fake user agent : https://github.com/hellysmile/fake-useragent | |
https://github.com/ahmedshahriar | |
""" | |
from time import sleep | |
from selenium import webdriver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider | |
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | |
# User-specific stuff | |
.DS_Store | |
.idea | |
.env | |
.idea/**/workspace.xml | |
.idea/**/tasks.xml | |
.idea/**/usage.statistics.xml | |
.idea/**/dictionaries |
OlderNewer