This file contains 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 datetime | |
from datetime import timedelta | |
from urllib.parse import quote | |
import requests | |
base_url = "http://192.168.5.77:8888/" | |
def list_environments(): |
This file contains 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
Make a program to calculate all valid checkers moves for a specific piece, given the position of all pieces on the board. | |
rules | |
1- always move diagonally forward 1 square (either left or right) | |
1- pieces capture diagonally by jumping over a piece that is diagonally adjacent | |
1- captures can capture both forward an backward | |
1- if at the end postion of a capture you can do another capture you must also make this capture (chaining) | |
1- if a capture is possible, only the longest capture chain is a valid move | |
This file contains 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 pydantic | |
class Project(pydantic.BaseModel): | |
source: str | |
validate_: bool = False | |
class Config: | |
# validate is not a valid field name, because BaseModel has a validate method | |
# use alias so we can use a validate field in the json and validate_ in python | |
fields = {"validate_": {"alias": "validate"}} |
This file contains 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
# Use an official Python runtime as a parent image | |
FROM python:3.7-slim | |
# Set the working directory to /app | |
WORKDIR /www | |
# Copy the current directory contents into the container at /app | |
COPY . /app | |
# Install any needed packages specified in requirements.txt | |
RUN mkdir -p /www/;touch /www/content | |
# Make port 80 available to the world outside this container | |
EXPOSE 8000 |
This file contains 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 | |
from http.server import HTTPServer, BaseHTTPRequestHandler | |
import os | |
import json | |
class StaticServer(BaseHTTPRequestHandler): | |
def do_GET(self): | |
files = os.listdir(".") | |
self.send_response(200) |