Install dependencies - pip install fastapi 'uvicorn[standard]'
Run the example - uvicorn main:app --host 0.0.0.0 --port 8000
Access multiple pages from http://localhost:8000/ and send messages
main.py
Install dependencies - pip install fastapi 'uvicorn[standard]'
Run the example - uvicorn main:app --host 0.0.0.0 --port 8000
Access multiple pages from http://localhost:8000/ and send messages
main.py
| #! /usr/bin/env python3 | |
| """ | |
| List all Firefox tabs with title and URL | |
| Supported input: json or jsonlz4 recovery files | |
| Default output: title (URL) | |
| Output format can be specified as argument | |
| """ |
Install dependencies - pip install fastapi 'uvicorn[standard]'
Run the example - uvicorn main:app --host 0.0.0.0 --port 8000
Access multiple pages from http://localhost:8000/ and send messages
main.py
| { config, pkgs, modulesPath, lib, system, ... }: | |
| { | |
| imports = [ | |
| (modulesPath + "/profiles/qemu-guest.nix") | |
| ]; | |
| config = { | |
| #Provide a default hostname | |
| networking.hostName = lib.mkDefault "base"; |
cloud-init allows customising and configuring deployed server instances on most popular cloud service providers easily without requiring the use of other related tools like Ansible. Since cloud-init is such a reliable tool, this brief write-up will document the exact steps and procedures to install and setup PostgreSQL on a Debian 12 (Bookworm) server instance.
wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc \
| gpg --with-fingerprint --with-colons \
| awk -F: '/^fpr/ { print $10 }'| """ | |
| [Blender and Python] Generating a procedural solar system with Blender's Python API | |
| Mina Pêcheux - August 2021 | |
| Email: [email protected] | |
| A very basic Blender script that creates a simplified solar system with a few | |
| planets around a sun, adds shaders computed on-the-fly and sets various animation | |
| curves on the objects to get random revolution speeds. | |
| This code is a simple example of how to instantiate objects for |
| # revert the order of a dataframe | |
| from pyspark.sql import SparkSession | |
| import pyspark.sql.functions as f | |
| # create spark session | |
| spark = SparkSession.builder.appName('some name').getOrCreate() | |
| # create a frame | |
| df = spark.createDataFrame([('a',12), ('c',10), ('b',9)], ['col1', 'col2']) | |
| df.show() |
| import mlflow | |
| # There are two ways to create parent/child runs in MLflow. | |
| # (1) The most common way is to use the fluent | |
| # mlflow.start_run API, passing nested=True: | |
| with mlflow.start_run(): | |
| num_trials = 10 | |
| mlflow.log_param("num_trials", num_trials) | |
| best_loss = 1e100 |
| import fiona | |
| import geopandas as gpd | |
| # Enable fiona driver | |
| gpd.io.file.fiona.drvsupport.supported_drivers['KML'] = 'rw' | |
| # Read file | |
| df = gpd.read_file(path, driver='KML') | |
| # Write file |
| #! /usr/bin/env python3 | |
| """ | |
| List all Firefox tabs with title and URL | |
| Supported input: json or jsonlz4 recovery files | |
| Default output: title (URL) | |
| Output format can be specified as argument | |
| """ |