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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <time.h> | |
#include <threads.h> | |
//#define NUM_THREADS 7 | |
// Thread safe random numbers by tempering the upper 32 bits | |
// of a 64 bit int. The calculations are based on a seed. |
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
// NOTE: this only works if the file upload form field appears last | |
const busboy = require('connect-busboy'); | |
const express = require('express'); | |
const app = express(); | |
app.use(busboy()); | |
app.post('/upload', (req, res) => { |
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 |
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
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
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
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 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
#!/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
## | |
## Dino | |
## | |
$the_cow = <<EOC | |
\\ | |
\\ | |
\\ ____ | |
\\ /o___) | |
/ /-/ | |
________/ /-/ |
OlderNewer