Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Exploring new possibilities

Sadman Muhib (Samyo) ahmedsadman

💭
Exploring new possibilities
View GitHub Profile
View Dockerfile-flask-mysql
# pull official base image
FROM python:3.8.2
# set work directory
WORKDIR /app
RUN pip install --upgrade pip
# required for some package builds
RUN apt-get install libssl-dev libffi-dev
View docker-compose-flask-mysql.yaml
version: '3.6'
volumes:
database:
services:
api:
build: .
depends_on:
- mysqldb
View apitest.py
import sys
import requests
import calendar
import json
from datetime import datetime
from pprint import pprint
class ApiTester:
def __init__(self, api_key):
@ahmedsadman
ahmedsadman / apriori.py
Created Mar 18, 2020
Implementation of Apriori Algorithm for mining frequent patterns
View apriori.py
"""
Description : Simple Python implementation of the Apriori Algorithm
Usage:
$python apriori.py -f DATASET.csv -s minSupport -c minConfidence
$python apriori.py -f DATASET.csv -s 0.15 -c 0.6
Original Author: github.com/asaini
Modifications: github.com/ahmedsadman (Converted to Python 3 and output fixes)
Example Dataset: https://github.com/asaini/Apriori/blob/master/INTEGRATED-DATASET.csv
@ahmedsadman
ahmedsadman / create-service.py
Last active Dec 10, 2019
Python script to create systemd service
View create-service.py
"""
Create systemd service file in Linux from given JSON data file
Author: Ahmed Sadman Muhib
"""
"""
Sample JSON file:
{
"service_name": "test_service",
@ahmedsadman
ahmedsadman / create-service.sh
Last active Dec 10, 2019
Bash script to create systemd service
View create-service.sh
#!/usr/bin/bash
##
## Creates Service file based on JSON data
##
# Sample JSON file:
# {
# "service_name": "test_service",
# "description": "Netcore dev server",
@ahmedsadman
ahmedsadman / docker-help.md
Last active Aug 9, 2019 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips
View docker-help.md

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@ahmedsadman
ahmedsadman / smooth_scroll.js
Created Feb 7, 2019
Smooth scroll to anchor (JQuery)
View smooth_scroll.js
// Smooth Scrolling in Web pages - provides smooth scrolling when local anchor tag is clicked
// Source: http://www.catswhocode.com/blog/useful-jquery-code-snippets
// HTML:
// <h1 id="anchor">Lorem Ipsum</h1>
// <p><a href="#anchor" class="topLink">Back to Top</a></p>
$(document).ready(function() {
$("a.topLink").click(function() {
View check_md5.py
import hashlib
def check_md5(filename, block_size = 128):
f = open(filename, 'rb')
md5 = hashlib.md5()
while True:
data = f.read(block_size)
if not data:break
md5.update(data)
f.close()
@ahmedsadman
ahmedsadman / immutable_cart.js
Created Feb 7, 2019
Javascript immutable way of updating shopping cart
View immutable_cart.js
/*
Javascript: Immutable way of changing quantity in a shopping cart
*/
let cart = [{
id: 1,
quantity: 3
},
{
id: 2,
quantity: 4
You can’t perform that action at this time.