Skip to content

Instantly share code, notes, and snippets.

View biancarosa's full-sized avatar
💜

bianca rosa biancarosa

💜
View GitHub Profile
@biancarosa
biancarosa / scheduler.py
Last active June 27, 2022 15:23
dagit scheduler to generate a random number based on an arg
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()
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)
@biancarosa
biancarosa / teste.tmpl
Last active April 12, 2020 14:47
template
foo = {{ FOO }}
bar = "{{ BAR }}"
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):
@biancarosa
biancarosa / main.py
Created July 15, 2019 00:28
simple flask app
"""app.main
Module that starts the Flask application
"""
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/')
def healthcheck():
@biancarosa
biancarosa / Dockerfile
Created June 18, 2019 15:01
Python Dockerfile
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"]
#include <iostream>
#include <GL/glut.h>
class Image
{
public:
int width;
int height;
unsigned char *data;
void readBMP(char* filename);
@biancarosa
biancarosa / Dockerfile
Created August 23, 2018 15:29
Install Kong with LuaRocks
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
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')
from datetime import datetime
import Pyro4
server = Pyro4.Proxy(f"PYRONAME:mess.server")
def start_chatting():
text = ''
while (text != 'exit'):
text = input("... ")