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, request | |
app = Flask(__name__) | |
app.debug = False | |
@app.route('/') | |
def get_ip_address(): | |
style = """ | |
<style> | |
body { text-align: center; font-size: 8em; color: rgb(176, 204, 105); font-family: Courier; letter-spacing:-0.05em; margin-top: 25px; font-weight: bold; background: rgb(58, 58, 58); } |
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
def make_interpolation(from_range, to_range): | |
from_min, from_max = from_range | |
to_min, to_max = to_range | |
scale = float(to_max - to_min) / float(from_max - from_min) | |
def interpolate(value): | |
return to_min + (value - from_min) * scale | |
return interpolate | |
change = make_interpolation((0, 100), (0, 200)) | |
print(change(50)) # will print 100.0 |
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 os import environ | |
from fabric.api import run, env | |
import requests | |
env.hosts.append('mydomain.com') | |
LINODE_API_KEY = 'mylinodeapikey' # noqa | |
DOMAIN_ID = 'mylinodedomainid' # for mydomain.com | |
IPv4 = 'mylinodeipv4address' | |
IPv6 = 'mylinodeipv6address' |
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
def calc_sale(price, realtor=True, closing=0.03, mortgage=148000): | |
if realtor: | |
realtor = 0.05 | |
else: | |
realtor = 0.00 | |
cost = price * (closing + realtor) + 450 | |
rtn = price - cost - mortgage | |
return rtn | |
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 abc import ABCMeta, abstractmethod | |
from random import choice | |
def game(player): | |
# determine winning and loosing doors for this round | |
doors = [1, 2, 3] | |
winning_door = choice(doors) | |
loosing_doors = [d for d in doors if d != winning_door] |
OlderNewer