Skip to content

Instantly share code, notes, and snippets.

View Pydantic error
main.py:46: in __init__
self.self0 = ""
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E AttributeError: __fields_set__
View fastapi-pagination yet more confusion
from fastapi import FastAPI
from datetime import date
from pydantic import BaseModel
from typing import List, Sequence, TypeVar, Generic
from fastapi_pagination import Page as BasePage, add_pagination, paginate
from fastapi import Query
from fastapi_pagination.bases import AbstractPage, AbstractParams, RawParams
from fastapi_pagination import Params as BaseParams
View fastapi-pagination
from fastapi import FastAPI
from pydantic import BaseModel
from fastapi_pagination import Page, add_pagination, paginate
app = FastAPI()
class User(BaseModel):
name: str
View gist:a9154d0facc23897f7a70d103bb6f8d8
[jenia@jenia ~]$ sudo nfs-ls nfs://192.168.1.0/srv/nfs
Failed to mount nfs share : nfs_mount_async failed. Failed to start connection. Failed to start connection. connect() to server failed. Network is unreachable(101)
[jenia@jenia ~]$
[jenia@jenia ~]$
[jenia@jenia ~]$
[jenia@jenia ~]$ sudo exportfs -arv
point 1
point 2
point 3
View gist:1fa532083e554284650cf5a62d0a2e96
~/example/program.py
~/example/tests/uni-tests.py
~/example/program.py
=====================
#!/usr/bin/python3
class A():
def f(self):
print("hello")
@jenia
jenia / example-pointer.py
Created Aug 5, 2020
I want to pass the flag's pointer
View example-pointer.py
#!/usr/bin/python3
def f(flag):
flag = False
def g(flag):
print(flag)
def main():
flag = True
View echoclient.py
# echo-client.py
import sys
import trio
import time
# arbitrary, but:
# - must be in between 1024 and 65535
# - can't be in use by some other program on your computer
# - must match what we set in our echo server
PORT = 12345
@jenia
jenia / echo server
Last active Aug 1, 2020
How to send requests for 60 seconds and wait for all responses
View echo server
#echo-server.py
import trio
from itertools import count
# Port is arbitrary, but:
# - must be in between 1024 and 65535
# - can't be in use by some other program on your computer
# - must match what we set in our echo client
PORT = 12345
View gist:a3db2c9de396f7d3d5a8226034d8bcf3
- name: Create db container and connect to network
docker_container:
name: "{{ app_name }}"
image: "{{ app_image}}"
networks:
- name: "{{ docker_network_name }}"
when: app_name == "certain_app" or app_name == "certain_other_app"