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
# Depends on aiomqtt | |
# pip install aiomqtt | |
# Based on work done in https://github.com/encode/broadcaster/pull/117 | |
import asyncio | |
import typing | |
from urllib.parse import urlparse | |
import aiomqtt |
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
├── libs | |
│ ├── module1_src | |
│ │ ├── namespace | |
│ │ └── pyproject.toml | |
│ ├── module2_src | |
│ │ ├── namespace | |
│ │ └── pyproject.toml | |
│ ├── module3_src | |
│ │ ├── namespace | |
│ │ └── pyproject.toml |
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 json | |
import typing as t | |
from urllib import parse | |
class State: | |
CONNECTING = 1 | |
CONNECTED = 2 | |
DISCONNECTED = 3 |
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
from django.urls import resolve | |
from .connection import WebSocket | |
def websockets(app): | |
async def asgi(scope, receive, send): | |
if scope["type"] == "websocket": | |
match = resolve(scope["raw_path"]) | |
await match.func(WebSocket(scope, receive, send), *match.args, **match.kwargs) | |
return | |
await app(scope, receive, send) |
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
FROM python:3.8-slim | |
RUN pip install httpx | |
WORKDIR /code | |
ADD ./main.py /code/main.py | |
CMD python /code/main.py |
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
# | |
# REQUIRES: | |
# - server (the forge server instance) | |
# - event (the forge event instance) | |
# - sudo_password (random password for sudo) | |
# - db_password (random password for database user) | |
# - callback (the callback URL) | |
# |
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
[ | |
{ | |
"name": "Россия", | |
"regions": [ | |
{ | |
"name": "Москва и Московская обл.", | |
"cities": [ | |
{ | |
"name": "Москва", | |
"lat": 55.4537528, |
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
[ | |
{ | |
"name": "Украина", | |
"regions": [ | |
{ | |
"name": "Автономная Республика Крым", | |
"cities": [ | |
{ | |
"name": "Алупка", | |
"lat": "44.4197222", |
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
[ | |
{ | |
"name": "Беларусь", | |
"regions": [ | |
{ | |
"name": "Брестская обл.", | |
"cities": [ | |
{ | |
"name": "Антополь", | |
"lat": 52.2041343, |
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
#!/bin/bash | |
DIR=`pwd` | |
echo "Making SSL files in $DIR" | |
echo "" | |
openssl genrsa -des3 -out server.key 2048 | |
openssl rsa -in server.key -out server.key.insecure | |
mv server.key server.key.secure | |
mv server.key.insecure server.key | |
openssl req -new -key server.key -out server.csr |