kubectl -n fission-function get pods --field-selector status.phase=Running -o name
KEYWORD="poolmgr-python-default"
NS="fission-function"
"""See also https://www.codeforests.com/2020/11/05/python-suppress-stdout-and-stderr/""" | |
import os | |
import sys | |
from contextlib import contextmanager | |
@contextmanager | |
def suppress_output(suppress_stdout=True, suppress_stderr=True): | |
orig_streams = (sys.stdout, sys.stderr) | |
null_stream = open(os.devnull, "w") |
import requests | |
webhook_url = "<your-slack-webhook-url>" | |
def slack_log(message, webhook_url=webhook_url): | |
requests.post( | |
webhook_url, | |
json={"text": message} | |
) |
from jsonpath_ng import jsonpath, parse | |
def mod_func(orig, data, field): | |
data[field] *= 2 | |
data = { | |
"foo": [ | |
{"baz": 1}, | |
{"baz": 2}, | |
], |
# /etc/netplan/01-netcfg.yaml | |
network: | |
version: 2 | |
renderer: networkd | |
ethernets: | |
eth0: | |
dhcp4: no | |
addresses: | |
- 172.23.10.197/24 | |
- 172.23.10.198/24 |
class ExampleViewSet(PartialUpdateModelMixin, viewsets.ReadOnlyModelViewSet):
...
@action(detail=False, methods=["GET"], url_path="_meta")
def api_meta(self, request):
meta = {
"fields": {
"types": {
"choices": Example.ExampleType.choices
Your Django project maybe required to hosted under a shared domain, but use a separate subpath.
To make django generate right URLs and avoid cookie conflicts, do settings below:
FORCE_SCRIPT_NAME = '/A-site/'
CSRF_COOKIE_PATH = LANGUAGE_COOKIE_PATH = SESSION_COOKIE_PATH = FORCE_SCRIPT_NAME
LOGIN_URL = '{0}api-auth/login/'.format(FORCE_SCRIPT_NAME)
LOGOUT_URL = '{0}api-auth/logout/'.format(FORCE_SCRIPT_NAME)
@keywords: django-rest-framework, django, restful
Updated file /usr/share/fcitx/data/punc.mb.zh_CN
. 。
, ,
? ?
" “ ”
: :
; ;
' ‘ ’