React recently introduced an experimental profiler API. This page gives instructions on how to use this API in a production release of your app.
Table of Contents
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
React recently introduced an experimental profiler API. This page gives instructions on how to use this API in a production release of your app.
Table of Contents
/* Front End */ | |
import { CollectorTraceExporter } from '@opentelemetry/exporter-collector'; | |
import { DocumentLoad } from '@opentelemetry/plugin-document-load'; | |
import { XMLHttpRequestPlugin } from '@opentelemetry/plugin-xml-http-request'; | |
import { BatchSpanProcessor, ConsoleSpanExporter } from '@opentelemetry/tracing'; | |
import { WebTracerProvider } from '@opentelemetry/web'; | |
const tracerProvider = new WebTracerProvider({ | |
plugins: [new DocumentLoad(), new XMLHttpRequestPlugin()], | |
}); |
<link rel="shortcut icon" width=32px> | |
<canvas style="display: none" id="loader" width="16" height="16"></canvas> | |
<script> | |
class Loader { | |
constructor(link, canvas) { | |
this.link = link; | |
this.canvas = canvas; | |
this.context = canvas.getContext('2d'); | |
this.context.lineWidth = 2; |
from math import sqrt | |
import torch | |
from tqdm import tqdm | |
import matplotlib.pyplot as plt | |
import networkx as nx | |
from torch_geometric.nn import MessagePassing | |
from torch_geometric.data import Data | |
from torch_geometric.utils import k_hop_subgraph, to_networkx | |
import numpy as np |
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) | |
data_size, vocab_size = len(data), len(chars) |
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository | |
$ git ls-files | xargs wc -l |
""" | |
you may run this example with uvicorn, by using this command: | |
uvicorn opalogger:app --reload | |
""" | |
import gzip | |
from typing import Callable, List | |
from fastapi import Body, FastAPI, Request, Response |
version: "3.8" | |
services: | |
# When scaling the opal-server to multiple nodes and/or multiple workers, we use | |
# a *broadcast* channel to sync between all the instances of opal-server. | |
# Under the hood, this channel is implemented by encode/broadcaster (see link below). | |
# At the moment, the broadcast channel can be either: postgresdb, redis or kafka. | |
# The format of the broadcaster URI string (the one we pass to opal server as `OPAL_BROADCAST_URI`) is specified here: | |
# https://github.com/encode/broadcaster#available-backends | |
broadcast_channel: | |
image: postgres:alpine |