This file contains 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
import inspect | |
import json | |
import re | |
from typing import get_args, get_origin, Literal, Callable | |
def generate_json(function: Callable) -> str: | |
""" Generate a JSON document describing a Python function, suitable for use with OpenAI's Function Calling. | |
:param function A Python function with docstrings for the function itself and its parameters. |
This file contains 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
function requestFlightStatus(address _oracle, string _jobId, string _flightId) | |
public | |
onlyOwner | |
{ | |
Chainlink.Request memory req = buildChainlinkRequest(stringToBytes32(_jobId), this, this.fulfillFlightStatus.selector); | |
req.add("flightId", _flightId); | |
sendChainlinkRequestTo(_oracle, req, ORACLE_PAYMENT); | |
} | |
function fulfillFlightStatus(bytes32 _requestId, uint256 _status) |
This file contains 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
{ | |
"initiators": [ | |
{ | |
"type": "runlog", | |
"params": { | |
"address": "0x123" | |
} | |
} | |
], | |
"tasks": [ |
This file contains 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
import json | |
import requests | |
from flask import Flask, request, jsonify | |
app = Flask(__name__) | |
SCHIPHOL_API_ID = 'x' | |
SCHIPHOL_API_KEY = 'y' | |
SCHIPHOL_API_URL = 'https://api.schiphol.nl/public-flights/' |
This file contains 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
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: my-service | |
annotations: | |
service.beta.kubernetes.io/aws-load-balancer-security-groups: sg-123 | |
spec: | |
type: LoadBalancer | |
selector: | |
app: my-app |
This file contains 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
package kubernetes.admission | |
import data.kubernetes.namespaces | |
import input.request.object.metadata.annotations as annotations | |
deny[msg] { | |
input.request.kind.kind = "Service" | |
input.request.operation = "CREATE" | |
input.request.object.spec.type = "LoadBalancer" |
This file contains 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
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
annotations: | |
elb-security-group: sg-123 | |
name: dev | |
--- | |
apiVersion: v1 | |
kind: Namespace | |
metadata: |
This file contains 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
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: my-service | |
annotations: | |
foo: bar | |
spec: | |
type: LoadBalancer | |
selector: | |
app: my-app |
This file contains 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
package kubernetes.admission | |
import data.kubernetes.namespaces | |
import input.request.object.metadata.annotations as annotations | |
deny[msg] { | |
input.request.kind.kind = "Service" | |
input.request.operation = "CREATE" | |
input.request.object.spec.type = "LoadBalancer" |
This file contains 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
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: my-service | |
spec: | |
type: LoadBalancer | |
selector: | |
app: my-app | |
ports: | |
- protocol: TCP |
NewerOlder