Skip to content

Instantly share code, notes, and snippets.

import asyncio
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey
from sqlalchemy.orm import declarative_base, relationship, selectin_polymorphic
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
from sqlalchemy.orm import Mapped
from sqlalchemy.future import select
from sqlalchemy.ext.asyncio import (
AsyncSession,
create_async_engine,
async_sessionmaker,
import asyncio
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey
from sqlalchemy.orm import declarative_base, relationship, selectin_polymorphic
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
from sqlalchemy.orm import Mapped
from sqlalchemy.future import select
from sqlalchemy.ext.asyncio import (
AsyncSession,
create_async_engine,
async_sessionmaker,
from sqlalchemy import create_engine, ForeignKey, Column, Integer, String
from sqlalchemy.orm import declarative_base, relationship, sessionmaker
from sqlalchemy.orm import Mapped, mapped_column
Base = declarative_base()
class Entity(Base):
__tablename__ = 'entities'
id = Column(Integer, primary_key=True)
from sqlalchemy import create_engine, ForeignKey, Column, Integer, String
from sqlalchemy.orm import declarative_base, relationship, sessionmaker
from sqlalchemy.orm import Mapped, mapped_column
Base = declarative_base()
class Entity(Base):
__tablename__ = "entities"
id = Column(Integer, primary_key=True)
@paulwinex
paulwinex / socket_client.py
Last active August 24, 2023 09:58
fastapi socketio setup
import asyncio
import socketio
sio = socketio.AsyncClient(logger=True, engineio_logger=True)
async def fun():
await sio.connect(
"http://127.0.0.1:8001/ws",
transports=['websocket'],
@paulwinex
paulwinex / ramdisk_bench.py
Created March 29, 2023 05:41
Test copy speed with ramdisk on linux
import time
import os
from pathlib import Path
from datetime import timedelta
CMD_FILE_COPY = 'cp {} {}'
CMD_DIR_COPY = 'cp -r {} {}'
CMD_DEL = 'rm -fr {}'
SSD_SINGLE_FILE = Path('/path/to/big/file.ext') # REPLACE THIS
from pymel.core import *
def separate_by_shaders(obj):
shaders = []
for sg in obj.getShape().outputs(type='shadingEngine'):
shaders.extend(sg.surfaceShader.inputs())
shaders = list(set(shaders))
for shader in shaders:
from pymel.core import *
from pathlib import Path
import shutil
def get_files_from_selected_nodes():
files = []
nodes = selected(type='file') + selected(type='aiImage')
for node in nodes:
# Install WireGuard client on RaspberryPi
# 1 # download config file from web ui, for example ~/Downloads/client.conf
# 2 # Install pivpn and Wireguard client for RaspberryPi
sudo -i
apt update
apt dist-upgrade -y
curl -L https://install.pivpn.io | bash
# non interactive installation manual: https://docs.pivpn.io/install/
version: '3.4'
services:
vpn:
image: weejewel/wg-easy
container_name: vpn
restart: always
environment:
- WG_HOST=[IP ADDRESS OF YOUR SERVER]
- PASSWORD=[PASSWORD FOR WEB UI]