Skip to content

Instantly share code, notes, and snippets.

@alexle
alexle / pythonsms.py
Last active December 1, 2023 01:01
How to send a text message with python
# sms.py
# Sends sms message to any cell phone using gmail smtp gateway
# Written by Alex Le
import smtplib
# Use sms gateway provided by mobile carrier:
# at&t: number@mms.att.net
# t-mobile: number@tmomail.net
# verizon: number@vtext.com
@sspross
sspross / DJANGO_TWISTED_HAPROXY.md
Last active November 13, 2023 03:15
Serving Django and Twisted using HAproxy

Serving Django and Twisted using HAproxy

Why?

Because we wanted to achive the following while developing a webapp using websockets:

Static serving (nginx), Django application (gunicorn) and Websockets service (twisted)

  • on the same IP
@antsankov
antsankov / watchdogTest.py
Last active February 1, 2016 16:22
Watchdog Test
import sys
import time
import logging
from watchdog.observers import Observer
from watchdog.events import *
#http://stackoverflow.com/questions/18599339/python-watchdog-monitoring-file-for-changes
class MyHandler(LoggingEventHandler):
#this creates the list of paths
def __init__(self):
@jg75
jg75 / boto3_s3_examples.py
Last active September 12, 2019 06:07
boto3 examples
import boto3
import botocore
from boto3.s3.transfer import S3Transfer
def lookup(s3, bucket_name):
try:
s3.meta.client.head_bucket(Bucket=bucket_name)
except botocore.exceptions.ClientError as e:
error_code = int(e.response['Error']['Code'])