This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: setup dev | |
setup: | |
test -d .venv || python -m venv .venv | |
. .venv/bin/activate; pip install -r requirements.txt | |
dev: | |
. .venv/bin/activate; flask --app app.create_app run --debug |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am carc1n0gen on github. | |
* I am carsonthecanuck (https://keybase.io/carsonthecanuck) on keybase. | |
* I have a public key ASAOtLzpKuIVdO0kPyJwMP133KCZlYH1-4xLbX_ViL0F2go | |
To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
## Dino | |
## | |
$the_cow = <<EOC | |
\\ | |
\\ | |
\\ ____ | |
\\ /o___) | |
/ /-/ | |
________/ /-/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
def sarcasmify(text): | |
new_text = '' | |
flip = True | |
for i in range(len(text)): | |
char = text[i] | |
if flip: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.parse import parse_qs | |
def sarcasmify(text): | |
new_text = '' | |
flip = True | |
for i in range(len(text)): | |
char = text[i] | |
if flip: | |
new_text += char.lower() | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, Blueprint, url_for | |
app = Flask(__name__) | |
app.config['SERVER_NAME'] = 'app.local:5000' | |
bp1 = Blueprint('bp1', __name__, subdomain='app1') | |
bp2 = Blueprint('bp2', __name__, subdomain='app2') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, url_for | |
app = Flask(__name__, host_matching=True, static_host='app1.local:5000') | |
@app.route('/', host='app1.local:5000') | |
def home1(): | |
return url_for('home1') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import smtplib | |
from email.message import EmailMessage | |
from flask import g, current_app | |
class Mailer(): | |
def __init__(self, smtp_host=None, smtp_port=None, username=None, | |
password=None): | |
self._smtp_host = smtp_host | |
self._smtp_port = smtp_port |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import smtpd | |
import asyncore | |
class FakeSMTPServer(smtpd.SMTPServer): | |
messages = [] | |
def __init__(*args, **kwargs): | |
print('Fake smtp server running on port 2525') | |
smtpd.SMTPServer.__init__(*args, **kwargs) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GateNotDefined = type('GateNotDefined', (Exception,), {}) | |
class Gatekeeper: | |
def __init__(self, gates={}, before=None): | |
self.gates = gates | |
self.before = before | |
def define(self, name, fn): | |
self.gates[name] = fn |
NewerOlder