Skip to content

Instantly share code, notes, and snippets.

View rocapp's full-sized avatar
😶‍🌫️

Robbie Capps rocapp

😶‍🌫️
View GitHub Profile
@rocapp
rocapp / readme.md
Created July 27, 2025 01:13 — forked from johnidm/readme.md
Basic Real-Time Applications with WebSockets and FastAPI

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

Source code files

main.py

@rocapp
rocapp / list-fftabs.py
Created November 5, 2024 22:22 — forked from tmonjalo/list-fftabs.py
List all Firefox tabs with title and URL
#! /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
"""
@johnidm
johnidm / readme.md
Last active July 27, 2025 01:13
Basic Real-Time Applications with WebSockets and FastAPI

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

Source code files

main.py

@joshleecreates
joshleecreates / vm-profile.nix
Last active June 15, 2025 16:33
NixOS VM Profile
{ config, pkgs, modulesPath, lib, system, ... }:
{
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
config = {
#Provide a default hostname
networking.hostName = lib.mkDefault "base";
@Jarmos-san
Jarmos-san / install-postgresql-using-cloudinit.md
Last active May 21, 2025 03:40
Install PostgreSQL using `cloud-init`

How to Install PostgreSQL Using cloud-init

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.

Get the Key ID From the Public Key

wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc \
  | gpg --with-fingerprint --with-colons \
  | awk -F: '/^fpr/ { print $10 }'
@MinaPecheux
MinaPecheux / ProceduralPlanets.py
Last active July 18, 2025 00:47
BlenderAndPython-ProceduralPlanets
"""
[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
@karpanGit
karpanGit / pyspark, reverse the order of a dataframe.py
Created July 23, 2021 05:51
pyspark, reverse the order of a dataframe
# 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()
@smurching
smurching / parent-and-child-runs.py
Last active February 29, 2024 13:30
creating-child-runs-in-mlflow
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
@mazzma12
mazzma12 / kml_io.py
Last active February 22, 2024 17:01
IO / Read and write KML file with geopandas and fiona driver
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
@tmonjalo
tmonjalo / list-fftabs.py
Last active May 17, 2025 22:51
List all Firefox tabs with title and URL
#! /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
"""