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 sparkles import get_stdout_lines | |
import os | |
import sys | |
def need_to_commit(): | |
status_lines = get_stdout_lines(["git", "status"]) | |
return "nothing to commit, working tree clean" not in status_lines |
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 os import getenv | |
from dotenv import load_dotenv | |
from sparkles.config import smart_bool | |
load_dotenv() | |
class Config: | |
jwt_secret_key: str = "changeme" | |
jwt_expiration: int = 600 |
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 pandas as pd | |
data = [ | |
(1,"Foo"), | |
(2, "Bar"), | |
(2, "Baz"), | |
] | |
for i in range(30): | |
data.append((3,f"Long thing{i}")) |
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 pandas as pd | |
data = [ | |
(1,"Foo"), | |
(2, "Bar"), | |
(2, "Baz"), | |
] | |
df = pd.DataFrame(data,columns=["id","value"]) |
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 datetime import datetime | |
import requests | |
import json | |
import bs4 as bs | |
from loguru import logger | |
from sparkles.google_sheet import get_book | |
import sys | |
from apscheduler.schedulers.blocking import BlockingScheduler |
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 hashlib import sha256 | |
import json | |
import time | |
class Block: | |
def __init__(self, index, transactions, timestamp, previous_hash): | |
self.index = index | |
self.transactions = transactions | |
self.timestamp = timestamp |
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
{ | |
"questions": [ | |
{ | |
"order": 1, | |
"question": "Do you have covid?", | |
"type": "yes_no" | |
}, | |
{ | |
"order": 2, | |
"question": "Are you a?", |
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-buster | |
RUN apt-get update && apt-get install -y gcc g++ git && rm -rf /var/li/apt/lists/* | |
WORKDIR /app | |
ADD requirements.txt /app/ | |
RUN pip install cython numpy pandas convertdate && rm -rf /root/.cache/pip | |
RUN pip install pystan && rm -rf /root/.cache/pip | |
RUN pip install -r requirements.txt && rm -rf /root/.cache/pip | |
ENV PYTHONUNBUFFERED=1 | |
ADD . /app | |
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
from dramatiq.brokers.redis import RedisBroker | |
from dramatiq.results.backends import RedisBackend | |
from dramatiq.results import Results | |
import redis | |
result_backend = RedisBackend(host=config.redis_host) | |
broker = RedisBroker(host=config.redis_host) | |
broker.add_middleware(Results(backend=result_backend)) | |
dramatiq.set_broker(broker) |
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
css = """ | |
/*! | |
* owfont-regular 1.0.0 by Deniz Fuchidzhiev - http://websygen.com | |
* License - font: SIL OFL 1.1, css: MIT License | |
*/ | |
/* FONT PATH | |
* -------------------------- */ | |
@font-face { | |
font-family: 'owfont'; | |
src: url('../fonts/owfont-regular.eot?v=1.0.0'); |