Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!
openssl genrsa -des3 -out rootCA.key 4096| import { ApolloServerPlugin, GraphQLServiceContext } from "apollo-server-plugin-base"; | |
| import { GraphQLSchema, separateOperations } from "graphql"; | |
| import { fieldConfigEstimator, getComplexity, simpleEstimator } from "graphql-query-complexity"; | |
| export class ApolloComplexityPlugin implements ApolloServerPlugin { | |
| private schema: GraphQLSchema; | |
| constructor(private maxComplexity: number) { } | |
| public serverWillStart(service: GraphQLServiceContext) { |
| // Minimum Absolute Difference in an Array | |
| // comparing each pair O(n^2) | |
| // sort first O(nlogn) + O(n) | |
| exports.mad = function(arr) { | |
| const a = arr.sort((a, b) => a - b); | |
| let min = -1; | |
| for (let i = 0, l = a.length; i < l - 1; i++) { | |
| const d = Math.abs(a[i] - a[i + 1]); | |
| if (min < 0 || d < min) { |
| from collections import defaultdict | |
| from django.db.models.signals import * | |
| class DisableSignals(object): | |
| def __init__(self, disabled_signals=None): | |
| self.stashed_signals = defaultdict(list) | |
| self.disabled_signals = disabled_signals or [ | |
| pre_init, post_init, | |
| pre_save, post_save, |