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 | |
# from pydantic import errors | |
# gpt_translate( | |
# { | |
# k: v.msg_template | |
# for k, v in dict(inspect.getmembers(errors, inspect.isclass)).items() | |
# if issubclass(v, errors.PydanticValueError) and hasattr(v, "msg_template") | |
# } | |
# ) | |
PYDANTIC_ERROR_MSG_TEMPLATE_ZH: dict[str, str] = { |
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
def streaming_csv_data(supplier_id: str): | |
buffer = io.StringIO() | |
with CSVWriter(buffer) as writer: | |
for row in _iter_data(): | |
writer.writerow(row) | |
buffer.seek(0) | |
yield buffer.read() | |
buffer.seek(0) | |
buffer.truncate(0) |
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
brew install miniconda | |
conda init (basename "$SHELL") | |
conda create -n tensorflow-env-39 python=3.9 | |
conda install -c apple tensorflow-deps | |
conda install scikit-learn pandas jupyter | |
pip install tensorflow-macos |
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
openssl s_client -connect example.com:443 -ign_eof | |
POST /your-endpoint HTTP/1.1 | |
Host: example.com | |
Content-Type: application/json | |
Content-Length: <LengthOfYourJSONData> | |
{"key1":"value1", "key2":"value2"} |
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
https://localhost:8888 { | |
tls /usr/local/etc/ssl/localhost.pem /usr/local/etc/ssl/localhost-key.pem | |
handle_path /api* { | |
rewrite /api/ / | |
reverse_proxy localhost:8000 | |
} | |
reverse_proxy /* localhost:8080 | |
} |
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
amazon-linux-extras install epel -y | |
yum-config-manager --enable epel | |
yum install iftop |
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: networking.k8s.io/v1beta1 | |
kind: Ingress | |
metadata: | |
annotations: | |
kubernetes.io/ingress.class: nginx | |
nginx.ingress.kubernetes.io/configuration-snippet: | | |
if ($host = "www.example.com") { | |
return 308 https://example.com$request_uri; | |
} | |
name: example-www |
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
# On the host to run the container | |
docker run --privileged -i -t -v ~/host-folder-to-mount:/root/folder-ro:ro ubuntu | |
# Inside the container | |
# Need to create the upper and work dirs inside a tmpfs. | |
# Otherwise OverlayFS complains about AUFS folders. | |
mkdir -p /tmp/overlay && \ | |
mount -t tmpfs tmpfs /tmp/overlay && \ | |
mkdir -p /tmp/overlay/{upper,work} && \ | |
mkdir -p /root/folder && \ |
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
#!/usr/bin/python | |
def main(): | |
n = input("input a number:") | |
n = int(n) | |
if n % 2 == 0: | |
print(True) | |
else: | |
print(False) |
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
{ | |
"@context": "https://w3id.org/security/v2", | |
"id": "https://bitmark.com/cap/bitmarkd", | |
"parentCapability": "https://gist.githubusercontent.com/lemonlatte/105581b2d8e1be1a1f3b000a9cfbe2b1/raw/5119e7df6e3b33e5a873bb143dacccc31a7761ac/my-repo.jsonld", | |
"invoker": "https://social.example#alyssa" | |
} |
NewerOlder