Skip to content

Instantly share code, notes, and snippets.

View MouadBH's full-sized avatar
👋

Mouad Boulahdoud MouadBH

👋
View GitHub Profile
@haccks
haccks / python_mail_sender.md
Last active December 23, 2023 13:05
Send emails to multi recipients with multiple attachments using python

A simple script in python3.x to

  • Send text emails.
  • Send to multiple clients.
  • Send multiple attachments (including images, videos, audios and compressed files)

To send email from the local SMTP server (localhost) it is assumed that a mail transfer agent (MTA), like postfix, is already configured on your local system. If not the follow this gist for step by step setup.

To send email from the gmail server you need to allow access for less secure apps in your Google account

@bradmontgomery
bradmontgomery / process_pool_executor_example.py
Created March 3, 2017 20:06
Simple example of using ProcessPoolExecutor vs. serial execution in python.
import hashlib
import sys
from concurrent.futures import ProcessPoolExecutor
from time import sleep, time
def t1(n):
"""Silly function whose time increases as n does."""
for i in range(n):
@oxguy3
oxguy3 / deploy.php
Last active August 5, 2023 20:21
Script used to automatically deploy from GitHub to a cPanel shared hosting server
<?php
/**
* deploy.php by Hayden Schiff (oxguy3)
* Available at https://gist.github.com/oxguy3/70ea582d951d4b0f78edec282a2bebf9
*
* No rights reserved. Dedicated to public domain via CC0 1.0 Universal.
* See https://creativecommons.org/publicdomain/zero/1.0/ for terms.
*/
// random string of characters; must match the "Secret" defined in your GitHub webhook
@djrobstep
djrobstep / sqlalchemy_dynamic_table_creation.py
Created May 18, 2016 14:28
SQLAlchemy ORM code to create SQL tables from a dynamically defined column list
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from sqlalchemy import Column, MetaData, Table, create_engine
from sqlalchemy import String, Integer, Float, BigInteger, DateTime
from sqlalchemy.schema import DropTable, CreateTable
from sqlalchemy.orm import scoped_session, sessionmaker
@vasanthk
vasanthk / System Design.md
Last active July 2, 2024 18:53
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@gtallen1187
gtallen1187 / slope_vs_starting.md
Created November 2, 2015 00:02
A little bit of slope makes up for a lot of y-intercept

"A little bit of slope makes up for a lot of y-intercept"

01/13/2012. From a lecture by Professor John Ousterhout at Stanford, class CS140

Here's today's thought for the weekend. A little bit of slope makes up for a lot of Y-intercept.

[Laughter]

@staltz
staltz / introrx.md
Last active July 2, 2024 03:45
The introduction to Reactive Programming you've been missing
@sumanthprabhu
sumanthprabhu / tfidf.sql
Last active March 29, 2023 14:03
A rough SQL implementation of tf-idf <http://en.wikipedia.org/wiki/Tf%E2%80%93idf> Assuming you have run the snippet <https://gist.github.com/sumanthprabhu/8066438> to generate a count matrix and stored it in the file 'tfidf.csv', the output will be a table named "results" containing normalized scores for each term per tag.
load local data infile 'tfidf.csv' into table tfidf fields terminated by "|" lines terminated by '\n'(term, tag, count);
DELIMITER //
CREATE PROCEDURE tfidf_applier()
begin
declare res1 INT;
set res1 = (select count(distinct tag) from tfidf);
drop table if exists log_term_table;
create table log_term_table(term varchar(200), logval decimal(20,5));