Skip to content

Instantly share code, notes, and snippets.

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

Hamza Abbad Hamza5

🏠
Working from home
View GitHub Profile
@turicas
turicas / email_utils.py
Last active August 1, 2024 15:47
Send emails easily in Python (with attachments and multipart)
#!/usr/bin/env python
# coding: utf-8
# This little project is hosted at: <https://gist.github.com/1455741>
# Copyright 2011-2020 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
import os
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
@ibigbug
ibigbug / flask-serve-static.py
Created June 24, 2015 06:07
Very simple static folder server using Flask
from flask import Flask
from flask import request
from flask import jsonify
from flask import send_from_directory
app = Flask(__name__)
@app.route('/', defaults=dict(filename=None))
@tylerneylon
tylerneylon / rwlock.py
Last active November 15, 2024 14:08
A simple read-write lock implementation in Python.
# -*- coding: utf-8 -*-
""" rwlock.py
A class to implement read-write locks on top of the standard threading
library.
This is implemented with two mutexes (threading.Lock instances) as per this
wikipedia pseudocode:
https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock#Using_two_mutexes