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 / 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()
@ahmedsadman
ahmedsadman / immutable_cart.js
Created February 7, 2019 09:52
Javascript immutable way of updating shopping cart
/*
Javascript: Immutable way of changing quantity in a shopping cart
*/
let cart = [{
id: 1,
quantity: 3
},
{
id: 2,
quantity: 4