Skip to content

Instantly share code, notes, and snippets.

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

Sadman Muhib (Samyo) ahmedsadman

🏠
Working from home
View GitHub Profile
@ahmedsadman
ahmedsadman / disable-turbo.bat
Created August 2, 2022 16:52
Disable Turbo power mode with batch file while running a certain application
@echo off
echo Switching power modes (Turboless)
powercfg /s 9d9d13cf-c730-4421-8f6f-4d8d6f8bd265
echo Starting game
start /w "" "Stray.exe"
echo Restoring power mode (Performance)
powercfg /s 27fa6203-3987-4dcc-918d-748559d549ec
exit
# 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
version: '3.6'
volumes:
database:
services:
api:
build: .
depends_on:
- mysqldb
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 March 18, 2020 06:34
Implementation of Apriori Algorithm for mining frequent patterns
"""
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 January 26, 2023 12:06
Python script to create systemd service
"""
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 November 27, 2023 07:45
Bash script to create systemd service
#!/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 August 9, 2019 10:33 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@ahmedsadman
ahmedsadman / smooth_scroll.js
Created February 7, 2019 09:55
Smooth scroll to anchor (JQuery)
// 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() {
@ahmedsadman
ahmedsadman / check_md5.py
Created February 7, 2019 09:53
Check file MD5
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()