This file contains hidden or 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
# This is the agent interfacer code which can be used to start/stop/flush a Datadog agent | |
import pkg_resources | |
import requests | |
import subprocess | |
import time | |
from ddtrace import tracer as ddtracer |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
# https://realpython.com/generative-adversarial-networks/ | |
# https://salu133445.github.io/lakh-pianoroll-dataset/ | |
import torch | |
from torch import nn | |
import time | |
import json | |
import math | |
import matplotlib.pyplot as plt |
This file contains hidden or 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.template import Template | |
class SafeTemplate(Template): | |
""" | |
Subclass of the regular django Template but disallows rendering anything | |
that will call a method on a class thus making it safe for use as a user | |
editable object | |
Examples: | |
# this will return the template as expected |
This file contains hidden or 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 python | |
""" | |
Run all unit tests within the current working directory optionally skipping | |
some modules | |
This script should be used instead of running `./manage.py test`. This django | |
provided unittest runner does not reset the testing database between each | |
testing file. The only way to ensure the testing database is completely dropped | |
is by running each test file individually. |
This file contains hidden or 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
class throttle(object): | |
""" | |
Decorator that prevents a function from being called more than once every | |
time period. If called too soon, RuntimeError is raised. | |
To create a function that cannot be called more than once a minute: | |
@throttle(minutes=1) | |
def my_fun(): | |
pass |