Skip to content

Instantly share code, notes, and snippets.

View bhuiyanmobasshir94's full-sized avatar
🎖️
Focused on achievement

Mobasshir Bhuiya bhuiyanmobasshir94

🎖️
Focused on achievement
View GitHub Profile
@svpino
svpino / instructions.md
Last active November 15, 2024 13:48
Installing TensorFlow on Apple Silicon
@rkaneko
rkaneko / sample.py
Created February 17, 2020 13:42
Put parquet file on MinIO (S3 compatible storage) using pyarrow and s3fs.
from typing import Any, Dict, List
import s3fs
from pyarrow import Table, parquet as pq
from pandas import DataFrame, Series
def to_df(data: List[Dict[str, Any]]) -> DataFrame:
df = DataFrame()
for item in data:
indexes = []
values = []
@bhuiyanmobasshir94
bhuiyanmobasshir94 / populate_weather.py
Created December 11, 2018 23:30
Open Weather Map data and Open street map data demonstration
import requests
def get_weather(latitude_,longitude_):
# latitude = latitude_
# longitude = longitude_
# url = 'http://api.openweathermap.org/data/2.5/weather?lat={}&lon={}&appid=8f47bbfcc82517d109015de292ab80cd&units=metric'.format(latitude, longitude)
# res = requests.get(url)
# data = res.json()
response = dict(main="Haze",desc="haze",temp=18,pressure=1014,humidity=72,temp_min=18,temp_max=18,wind_speed=1.5,wind_degree=310,datetime=1544556600,clouds_all=20,sys_sunrise=1544488256,sys_sunset=1544526753)
return response
@bhuiyanmobasshir94
bhuiyanmobasshir94 / population_script.py
Created December 11, 2018 23:28
A multi table and foreign key demonstrated django db population script
import os
import pandas as pd
import numpy as np
import random
import django
from django.utils import timezone
from populate_weather import get_location,get_weather
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'categorized_affect_map.settings')
django.setup()
@bhuiyanmobasshir94
bhuiyanmobasshir94 / populate_feature.py
Created December 11, 2018 17:53
A sample django population script
import os
import pandas as pd
import numpy as np
import random
import django
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'categorized_affect_map.settings')
django.setup()
from classification.models import Category, Feature
from django.utils import timezone
@bhuiyanmobasshir94
bhuiyanmobasshir94 / index.html
Created December 9, 2018 13:42
Folium heatmap demonstration of Bashundhara Area
<!DOCTYPE html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script>L_PREFER_CANVAS=false; L_NO_TOUCH=false; L_DISABLE_3D=false;</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>
@bhuiyanmobasshir94
bhuiyanmobasshir94 / problem-4.txt
Last active December 11, 2018 17:50
Basic SQL Commands
BEGIN TRANSACTION;
CREATE TABLE Students (ID integer PRIMARY KEY, Name varchar(255));
CREATE TABLE Friends (ID integer PRIMARY KEY, Friend_ID integer);
CREATE TABLE Packages (ID integer PRIMARY KEY, Salary float(23,19));
INSERT INTO Students (ID,Name)
VALUES (1,'Ashley');
INSERT INTO Students (ID,Name)
VALUES (2,'Samantha');
@bhuiyanmobasshir94
bhuiyanmobasshir94 / problem-3.txt
Created December 9, 2018 13:32
Linux basic commands dist - Ubuntu 16.04
# Add User Non-interactively without password
1. sudo adduser --disabled-password --gecos "" username
# Grant root access to the user so s/he can execute sudo without a password.
1. sudo visudo
#After includedir /etc/sudoers.d put-.
2. username ALL=(ALL) NOPASSWD: ALL
# Create a folder named .ssh in the user’s home directory.
1. mkdir /home/username/.ssh
@bhuiyanmobasshir94
bhuiyanmobasshir94 / problem-2.py
Created December 9, 2018 13:30
Log file parsing and sorting demonstration
import re
log_list = []
hosts = set()
hosts_status = set()
test_str = ''
filepath = 'problem-2.txt'
with open(filepath) as fp:
test_str = fp.read().strip()
@bhuiyanmobasshir94
bhuiyanmobasshir94 / problem-1.py
Created December 9, 2018 13:26
Solutions to the problem of getting geo information against IP address
import requests
class Scraper:
''' Request information and Scrape data class '''
def __init__(self,ip=None):
self.address = 'http://ip-api.com/json/'
self.ip = ip
def get_geo_ip_info(self):
'''Collect geo ip info'''