Skip to content

Instantly share code, notes, and snippets.

View ahmedshahriar's full-sized avatar
🏠
Working from home

Ahmed Shahriar Sakib ahmedshahriar

🏠
Working from home
View GitHub Profile
@ahmedshahriar
ahmedshahriar / Top-1000-Celebrity-Twitter-Accounts.csv
Created February 28, 2022 23:52 — forked from mbejda/Top-1000-Celebrity-Twitter-Accounts.csv
Top 1000 Celebrity Twitter Accounts (twitter,domain,name,type)
twitter domain name type
katyperry katyperry.com KATY PERRY celebrity
justinbieber smarturl.it Justin Bieber celebrity
taylorswift13 grmypro.co Taylor Swift celebrity
rihanna rihannanow.com Rihanna celebrity
ladygaga The Countess celebrity
jtimberlake justintimberlake.com Justin Timberlake celebrity
TheEllenShow ellentube.com Ellen DeGeneres celebrity
britneyspears britney.lk Britney Spears celebrity
Cristiano Cristiano Ronaldo celebrity
@ahmedshahriar
ahmedshahriar / 4956984.py
Created February 19, 2022 11:47 — forked from miku/4956984.py
How do you split a csv file into evenly sized chunks in Python?
#!/usr/bin/env python
# import csv
# reader = csv.reader(open('4956984.csv', 'rb'))
def gen_chunks(reader, chunksize=100):
"""
Chunk generator. Take a CSV `reader` and yield
`chunksize` sized slices.
"""
@ahmedshahriar
ahmedshahriar / icon-scholar.html
Last active September 21, 2021 16:55 — forked from epignatelli/icon-scholar.html
Fontawesome icon for Google Scholar
// google-scholar.svg
<svg height="2500" width="2500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<g fill="none" fill-rule="evenodd"><path d="M256 411.12L0 202.667 256 0z" fill="#4285f4"/>
<path d="M256 411.12l256-208.453L256 0z" fill="#356ac3"/>
<circle cx="256" cy="362.667" fill="#a0c3ff" r="149.333"/>
<path d="M121.037 298.667c23.968-50.453 75.392-85.334 134.963-85.334s110.995 34.881 134.963 85.334H121.037z" fill="#76a7fa"/>
</g>
</svg>
// style.css
@ahmedshahriar
ahmedshahriar / hyperparameter_tuning_gridsearchCV_randomsearchCV.py
Created September 7, 2021 14:04
A simple function which takes model and parameter space as input and to tune the hyperparameters of a model using Grid Search or Random Search method selected
from sklearn.model_selection import GridSearchCV, RandomizedSearchCV, StratifiedKFold
from sklearn.metrics import accuracy_score
# configure the cross-validation procedure
kf = StratifiedKFold(n_splits = 10 , shuffle = True , random_state = 42)
def tune_hyperparameter(search_method, estimator, search_space):
# enumerate splits
outer_results = list()
@ahmedshahriar
ahmedshahriar / merge_csv_identical_cols.py
Created May 7, 2021 17:44
Merge multiple CSV files with identical columns
import pandas as pd
import glob
path = r'C:\DRO\DCL_rawdata_files' # use your path
all_files = glob.glob(path + "/*.csv")
li = []
for filename in all_files:
df = pd.read_csv(filename, index_col=None, header=0) # to keep a single header
@ahmedshahriar
ahmedshahriar / concurrent_test.py
Last active July 9, 2021 00:11
This python script will map a list (length 10 for 10 executor) and execute 10 concurrent processes using concurrent module
import concurrent.futures
def test(li):
# print('hello world')
if li:
print('hello world', li)
def run_all(li):
@ahmedshahriar
ahmedshahriar / database.ini
Last active April 12, 2021 09:52
Postgres initialization with Python. contains two script , 1. Postgres db config , 2. db connector
[postgresql]
host=localhost
database=my_db
user=postgres
password=postgres
@ahmedshahriar
ahmedshahriar / mongodecimal_field.py
Created March 9, 2021 22:03
MongoDecimalField to work with mongdb decimal field using djongo
"""
MongoDecimalField to work with mongdb decimal field using djongo
"""
from bson.decimal128 import Decimal128
from djongo.models import DecimalField
# https://github.com/nesdis/djongo/issues/82
# https://github.com/nesdis/djongo/issues/378
Icons
Avater pack
1. https://www.flaticon.com/packs/avatars-93