Skip to content

Instantly share code, notes, and snippets.

Avatar
🎃
Wasteland Baby!

Emrul Hasan Zawad ehzawad

🎃
Wasteland Baby!
View GitHub Profile
@ehzawad
ehzawad / py_session_django.py
Created March 13, 2023 09:13
Python Session Django
View py_session_django.py
# Python DJango Session
def index(request):
# check if there already exists a "tasks" key in our session
if "tasks" not in request.session:
request.session["tasks"] = []
return render(request, "tasks/index.html", {
@ehzawad
ehzawad / Dockerfile
Created March 2, 2023 12:06
Python 3.8 dlib face-reocgnition
View Dockerfile
# syntax = docker/dockerfile:experimental
#
# NOTE: To build this you will need a docker version > 18.06 with
# experimental enabled and DOCKER_BUILDKIT=1
#
# If you do not use buildkit you are not going to have a good time
#
# For reference:
# https://docs.docker.com/develop/develop-images/build_enhancements/
ARG BASE_IMAGE=ubuntu:18.04
@ehzawad
ehzawad / Dockerfile
Last active March 2, 2023 09:32
Dockerfile for ubuntu jammy
View Dockerfile
FROM ubuntu:22.04
LABEL maintainer="genuity systems LTD"
ARG DEBIAN_FRONTEND=noninteractive
# Avoid "delaying package configuration, since apt-utils is not installed"
RUN apt update && apt install --yes apt-utils
# Environment
@ehzawad
ehzawad / iterable.py
Last active February 28, 2023 04:18
Python iiterable
View iterable.py
from dataclasses import dataclass
@dataclass
class Person:
name: str
age: int
city: str
def __iter__(self):
self._fields = [field.name for field in self.__dataclass_fields__.values()]
View json_to_csv_snips_NLU.py
import pandas as pd
import time
import io
import json
from langdetect import detect
from snips_nlu import SnipsNLUEngine
@ehzawad
ehzawad / damn_text.py
Last active January 3, 2023 10:24
Clean some weird encrypted data
View damn_text.py
import pandas as pd
import base64
unclean_data = pd.read_csv('/home/ehz/Downloads/email_date_dec22_Blank.csv')
# print(unclean_data)
# print(unclean_data.columns.tolist())
# print(unclean_data['Subject'])
# super_clean_data = unclean_data[[' Subject',' Customer-Email']].dropna(axis=0, how='any')
super_clean_data = unclean_data[' Customer-Email'].dropna(axis=0, how='any')
View gist:a30907eae2c9e727e63327586ffc6606
for i in l:
strr = '{' + '\r\n' + ' ' + '"text": ' + '"' + i + '"' +'\r\n' + '}'
strr = strr + ','
print(strr)
@ehzawad
ehzawad / dataset.json
Created December 29, 2022 08:19
One way of storing data!
View dataset.json
{
"entities": {
"taka":{
"data": [
{"value": "2 tk","synonyms": ["2 Taka"]}
],
"use_synonyms": true,
"automatically_extensible": true
},
"sms":{
View is_it_a_valid_json.json
{
"entities":{
"language":{
"data":[
{
"value":"English",
"synonyms":[
"English"
]
},
View hey_ya.json
{
"entities": {
"language":{
"data": [
{"value": "English","synonyms": ["English"]},
{"value": "Bangla","synonyms": ["Bangla"]}
],
"use_synonyms": true,
"automatically_extensible": true
}