This file contains hidden or 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
# Assume logged in as `root` in ProxMox 8 | |
cd /root | |
# Install prereqs | |
apt install -y skopeo umoci jq -y | |
# Download and extract RootFS | |
lxc-create unifi-controller-7.4.162 -t oci --lxcpath /root/lxc -- --url docker://linuxserver/unifi-controller:7.4.162 |
This file contains hidden or 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
apt install ca-certificates curl gnupg lsb-release | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \ | |
| sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \ | |
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
apt update | |
apt install docker-ce docker-ce-cli containerd.io -y | |
usermod -aG docker $USER |
This file contains hidden or 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
# dirs/c/xx_plugins/c_module/__init__.py | |
# dirs/c/xx_plugins/d_module/__init__.py | |
# dirs/a/b/xx_plugins/ab_module/__init__.py | |
import sys | |
import os.path as op | |
import importlib | |
import pkgutil | |
from types import ModuleType | |
from typing import List |
This file contains hidden or 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
""" | |
curl -d '{"data":"abc123"}' -H "Content-Type: application/json" -X POST http://localhost:8000/thing/data | |
""" | |
from fastapi import FastAPI | |
from pydantic import BaseModel | |
from starlette.requests import Request | |
app = FastAPI() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
from psycopg2 import connect, extensions, sql, OperationalError | |
import re | |
POSTGRES_PASSWORD = 'mypasswd' | |
POSTGRES_USER = 'myuser' | |
POSTGRES_DB = 'mytest12' | |
connect_string = f"postgres://{POSTGRES_USER}:{POSTGRES_PASSWORD}@localhost" | |
db_connect_string = f"{connect_string}/{POSTGRES_DB}" |
This file contains hidden or 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
## | |
# Usage: | |
# Run `docker-compose up` | |
# Navigate to localhost:7100 in your browser | |
version: "3.6" | |
services: | |
stf: | |
image: openstf/stf | |
command: bin/stf local |
This file contains hidden or 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
class RoleInput(graphene.InputObjectType): | |
role = String() | |
class FilteredConnectionField(SQLAlchemyConnectionField): | |
def __init__(self, type, input_type, *args, **kwargs): | |
fields = {name: field.type() for name, field in input_type._meta.fields.items()} | |
kwargs.update(fields) | |
super().__init__(type, *args, **kwargs) |
This file contains hidden or 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
from sqlalchemy import create_engine | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Column, String, Integer, ForeignKey | |
from sqlalchemy.orm import relationship | |
from sqlalchemy.orm import sessionmaker | |
engine = create_engine('sqlite:///:memory:', echo=False) | |
session = sessionmaker(bind=engine)() | |
Base = declarative_base() |
This file contains hidden or 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
from sqlalchemy import create_engine | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Column, Boolean, String, String, Integer, ForeignKey | |
from sqlalchemy.orm import sessionmaker | |
from secrets import token_hex | |
from json import dumps | |
import graphene | |
from graphene_sqlalchemy import SQLAlchemyObjectType, SQLAlchemyConnectionField | |
from graphene.relay import Connection | |
from collections import defaultdict |
NewerOlder