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 dagster import job, op, schedule, RunRequest, ScheduleEvaluationContext, repository | |
@op(config_schema={"number": int}) | |
def random_number(context): | |
context.log.info(context.op_config["number"]) | |
return context.op_config["number"] + 1 | |
@job | |
def do_stuff(): | |
random_number() |
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 cProfile | |
import timeit | |
import ctypes | |
N = 100000 | |
start = timeit.default_timer() | |
array = (N * ctypes.c_int)() | |
stop = timeit.default_timer() | |
print('Time: ', stop - start) |
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
foo = {{ FOO }} | |
bar = "{{ BAR }}" |
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
def topView(root): | |
queue = deque([]) | |
VerticallyDistantNode = namedtuple('VerticallyDistantNode', 'node distance') | |
queue.append(VerticallyDistantNode(root, 0)) | |
distance_map = {} | |
while (len(queue) > 0): | |
node, distance = queue.popleft() | |
if distance_map.get(distance) is None: | |
distance_map[distance] = node | |
if (node.left): |
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
"""app.main | |
Module that starts the Flask application | |
""" | |
from flask import Flask, jsonify | |
app = Flask(__name__) | |
@app.route('/') | |
def healthcheck(): |
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.7 | |
COPY requirements.txt /app/ | |
WORKDIR /app | |
RUN pip install -r requirements.txt | |
COPY . /app | |
CMD ["gunicorn", "run:app", "-w", "4", "-b", "0.0.0.0:5000", "-t", "1000"] |
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
#include <iostream> | |
#include <GL/glut.h> | |
class Image | |
{ | |
public: | |
int width; | |
int height; | |
unsigned char *data; | |
void readBMP(char* filename); |
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 ubuntu:18.04 | |
RUN apt-get update | |
RUN apt-get install -y luarocks libssl-dev | |
ADD . /app | |
WORKDIR /app | |
RUN luarocks install kong 0.13.0 |
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 Pyro4 | |
@Pyro4.expose | |
class Chat(object): | |
def send_message(self, text): | |
now = datetime.now() | |
print(f'{text} - received at {now:%H:%M:%S} \n') |
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 Pyro4 | |
server = Pyro4.Proxy(f"PYRONAME:mess.server") | |
def start_chatting(): | |
text = '' | |
while (text != 'exit'): | |
text = input("... ") |
NewerOlder