Skip to content

Instantly share code, notes, and snippets.

@DamnedFacts
DamnedFacts / gen_dates.py
Created September 5, 2018 17:51
Create a schedule of dates from a start date, through a total number of weeks, with optional weekly skipping
from datetime import date, timedelta
def ta_meetings(year, month, day, skip_weeks=2, total_weeks=15):
for dd in range(0, total_weeks, skip_weeks):
d = date(year, month, day) + timedelta(days=dd*7)
print(d.strftime("%a, %d %b %Y, B&L 470, 3:00-3:30pm"))
@DamnedFacts
DamnedFacts / mailto_encode.py
Created September 5, 2018 17:43
Encode recipients, subject, and body in a 'mailto:' url
from urllib.parse import quote
def email_quote(recipients, subject, body):
recipients = quote(recipients)
subject = quote(subject)
body = quote(body)
msg = f"mailto:{recipients}?subject={subject}&body={body}"
return msg
@DamnedFacts
DamnedFacts / band_test_server.py
Last active September 11, 2019 04:42
A concocted bandwidth test using Python
#!/usr/bin/python
from http.server import BaseHTTPRequestHandler, HTTPServer
from io import BytesIO
server = None
PORT_NUMBER = 8080
SERVER_IP = "0.0.0.0"
#This class will handles any incoming request from
#the browser
class myHandler(BaseHTTPRequestHandler):
from graphics import GraphWin, Point, Circle, Rectangle, Text
from random import randrange
from math import pi, sqrt
height, width = 1044, 1044
# The module graphics.py can be obtained from, http://mcsp.wartburg.edu/zelle/python/graphics.py.
# It may also be installable via pip.
def intro():
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am damnedfacts on github.
  • I am damnedfacts (https://keybase.io/damnedfacts) on keybase.
  • I have a public key whose fingerprint is BB72 572F 6768 520E 0B06 1A22 5FCE 5BE5 2882 1EDE

To claim this, I am signing this object:

Sorry, this is too big to display.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.