Skip to content

Instantly share code, notes, and snippets.

import os
from typing import Optional
import django.http
from opentelemetry import trace, context
from opentelemetry.instrumentation.django import DjangoInstrumentor
from opentelemetry.instrumentation.mysqlclient import MySQLClientInstrumentor
from opentelemetry.instrumentation.redis import RedisInstrumentor
from opentelemetry.instrumentation.requests import RequestsInstrumentor
from opentelemetry.sdk.trace import TracerProvider, SpanProcessor
import logging
import os
from typing import Optional
import django.http
from opentelemetry import trace, baggage
from opentelemetry.instrumentation.django import DjangoInstrumentor
from opentelemetry.instrumentation.mysqlclient import MySQLClientInstrumentor
from opentelemetry.instrumentation.redis import RedisInstrumentor
from opentelemetry.instrumentation.requests import RequestsInstrumentor
@ebracho
ebracho / gravsim.py
Created February 4, 2018 23:51
An incomplete program to simulate a gravitational system of bodies.
import math
# Represents a single body in space
class Body:
def __init__(self, mass, posx, posy, velx, vely):
self.mass = float(mass)
self.posx = float(posx)
self.posy = float(posy)
self.velx = float(velx)
self.vely = float(vely)
import time
count = 0
def fib(n):
global count
count += 1
if n == 0:
return 0
elif n == 1:
@ebracho
ebracho / doodle.md
Last active December 5, 2016 05:49

Hi, I'm trying to come up with a "Reactful" approach to this problem:

  • Doodles are html canvas elements that can render drawings composed of many small line segments called strokes.

  • DoodleRooms are a collection of clients connected through a websocket interface. DoodleRooms render Doodles in real time.

  • There are many types of doodle rooms that have different behaviors and constraints.

Codebase so far for more context: https://github.com/ebracho/groupdoodle

@ebracho
ebracho / doodle.md
Last active December 5, 2016 05:47

Hi, I'm trying to come up with a "Reactful" approach to this problem:

  • Doodles are html canvas elements that can render drawings composed of many small line segments called strokes.
  • DoodleRooms are a collection of clients connected through a websocket interface. DoodleRooms render Doodles in real time.
  • There are many types of doodle rooms that have different behaviors and constraints.
// mongoose debug output:
Mongoose: sessiontokens.update({ _id: ObjectId("584494d3ff82c10011753738") }, { '$set': { __v: 0, _id: ObjectId("584494d3ff82c10011753738"), expiration: new Date("Sun, 11 Dec 2016 22:12:35 GMT"), token: 'r130EMG7l', userId: 'asdfasdfasdf' } })
// mongo cli
> use groupdoodle
switched to db groupdoodle
> show collections
doodlerooms
doodles
sessiontokens
// mongoose debug output:
Mongoose: sessiontokens.update({ _id: ObjectId("584494d3ff82c10011753738") }, { '$set': { __v: 0, _id: ObjectId("584494d3ff82c10011753738"), expiration: new Date("Sun, 11 Dec 2016 22:12:35 GMT"), token: 'r130EMG7l', userId: 'asdfasdfasdf' } })
// mongo cli
> use groupdoodle
switched to db groupdoodle
> show collections
doodlerooms
doodles
sessiontokens
/**
* Creates a new User, begins a session, and responds with a SessionToken.
*
* @param {Request} req
* @param {Response} res
*/
function register(req, res) {
if(req.user) {
res.status(400).send('User already exists');
} else {
> use groupdoodle
switched to db groupdoodle
> show collections
doodlerooms
doodles
sessiontokens
users
> db.sessiontokens.find()
>