Skip to content

Instantly share code, notes, and snippets.

import requests
import os
import PIL
def rebind_globals_to_module(module, *, monkey_patch=False):
"""
Decorator to change the global environment of functions and classes to another module's namespace.
If monkey_patch is True, the function or class is also added to the module.
The result: the decorated function is as good as if it were created in that module's source code,
This file has been truncated, but you can view the full file.
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals
#THINGS TO DO BEFORE OFFICIAL RELEASE:
# Rename "path" functions to "2d-somethings" idk what, but it conflicts with file-paths...
# Rename "display" functions to "plot" functions. "display" functions should be very simple and library-agnostic, while plot can be matplotlib-based.
# Remove useless functions, and categorize them. Probably should split into multiple files; but that's kinda messy...
# These functions don't have to be removed from r.py, they just have to be deleted from rp.py (after using from r import *, use something like 'del useless_function')
#TODO: Turn the comments at the beginning of each function into docstrings so they can be read by the builtin help function
# python /Users/Ryan/PycharmProjects/Py27RyanStandard2.7/Groupie.py ftF11dwbP61OfPf9QsXBfS5usCdQdBkkMieObdvZ -g 'The Think Tank'
from rp import *
def separate_videos(combined_video_path:str):
#Let's say combined_video_path is like '/path/to/preview_video.mp4'
combined_video = load_video(combined_video_path) # In THWC form
#Trim off the text on the top - only keep the bottom 480 rows of pixels
combined_video = combined_video[:, -480:, :, :]
⣿⣻⣽⣻⣽⣻⣽⣻⣽⣻⡽⣯⣟⣯⣟⣯⣟⣯⣟⣯⣟⣯⣟⣯⣟⣯⣟⣯⢿⣽⣻⣽⣻⣽⣻⣽⣻⣽⣻⢽⣻⣽⣻⣽⣻⣽⣻⣽⣻⣽⣻⡽⣟⣯⢿⣻⢯⣟⡿⣽⣻⣽⣻⣽⣻⣽⣻⢯⣟⣟⣯⢿⣻⡽⣟⣟⣟⣟⡿⣽⣟⣯⢿⣻⣽⣻⡽⣟⣯⣟⣯⣟⣯⢿⡽⣯⢿⡽⡯⡿⡽⡯⡿⡽⣯⢿⡽⡯⡿⡽⣯⢿⢽⢯⡿⣽⢯⢿⡽⣯⢿⡽⡯⡿⡽⡯⡿⡽⡯⡿⡽⡯⡿⡽⡯⡿⡽⡯⡿⡽⡯⡿⣽⣫⡯⡿⣽⢽⣫⡯⣯⢯⡯⣯⢯⡯⣯⢯⡯⣯⢯⡯⣯⢯⡯⣯⢯⡯⣯⢯⡯⣯⢯⡯⣯⢯⡯⣯⢯⡯⣯⢯⡯⡯⣯⢯⢯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⡯⣫⢯⣫⢯⣫⢯⣫⢯⣫⢯⣫⢯⡫⡯⣫⢯⡫⡯⣫⢯⣫⢗⡯⣫⢯⣳⡫⡯⣳⡫⡯⣺⢽⢕⡯⣳⢽⢕⡯⣳⢽⡹⡮⣫⢞⣝⢮⢯⡺⣝⢮⣳
⣿⢵⣳⣳⣳⣳⣳⣳⣳⡳⡯⣗⣗⣗⣗⣗⡯⣞⡾⣵⣳⣳⣳⣳⣳⣳⡳⡯⣳⣳⣳⣳⣳⣳⣳⣳⣳⣳⢽⢽⣺⣺⣺⣺⡺⡮⣗⣗⣗⣗⡯⡯⣗⡯⣟⢾⢽⣺⢽⡳⡯⣞⡾⣺⢵⣗⢯⣟⢾⢽⣺⢯⣗⢿⢽⣺⢽⣺⢯⣗⣟⣞⡯⣗⣟⢾⢽⢽⣺⣺⣺⣺⢵⢯⣻⣺⢽⣞⡯⡿⣝⡯⡿⡽⣝⣗⡯⡿⡽⡯⡯⡯⡿⡽⣽⣳⣻⢽⡽⣳⢯⢯⣟⡽⣯⣻⢽⢯⢿⢽⢯⢿⢽⢯⢿⢽⢯⢿⢽⢯⢿⢽⣳⢯⣞⡯⡷⡯⣗⡯⣯⣗⡯⣗⡯⣟⢾⢽⣺⢽⢽⣺⢽⡳⡯⣯⣻⣺⢽⢽⢽⢽⢽⣺⢽⢽⣺⢽⡳⡯⣗⡯⡯⡯⣗⡯⣟⢾⣝⢯⢯⢯⢯⢯⢯⢯⢯⢯⢯⢯⢯⣫⢯⢯⣫⢯⢾⢝⡽⣺⢝⡾⣝⡽⡵⣫⢗⣗⢽⢮⣳⡳⣝⡮⣳⣫⢯⣳⡫⡾⡽⣕⢯⢞⣵⡫⣗⢯⣺⡺⣝⡵⣫⢯⡺⣕⢯⢞⡵⣫⡳⣝⢮⡳⣝⢮⣳⡫⣞⢵⡳⣝⢮⡳⡽
⡿⣕⢗⣗⢵⡳⣕⢗⡵⣫⢟⢞⢞⢞⢞⢮⡫⣗⢽⡺⣺⡪⣞⢮⡺⣪⢞⡽⣕⢗⡵⡳⣕⣗⢵⡳⡳⡵⣫⢯⢞⡞⣞⢮⡫⡯⣳⡳⣳⡳⡽⡽⡵⣫⢯⡫⣗⡽⡵⣫⣻⡪⡯⣳⡫⣞⢗⡽⣝⢽⣪⢷⢽⣹⢵⡫⣯⡺⣳⢳⡳⣳⡫⣗⢯⢯⡫⡗⣗⢗⡳⡳⡽⣝⢞⣞⢽⣪⢯⢯⣳⡫⡯⡯⣳⣳⣫⢯⢯⢯⢯⢯⢯⣻⣺⣺⣺⢽⢽⢽⢽⢽⢮⣻⣺⡺⡽⡽⡽⡽⡽⡽⡽⡽⡽⡽⡽⡽⡽⡽⡽⣽⡺⡽⡮⡯⡯⡯⣗⡯⣗⣗⢯⣗⡯⡯⣯⣻⡺⣽⣫⢾⢽⢽⢽⣺⣺⣺⢽⣫⢯⢯⣻⡺⡽⡽⣺⢽⢽⢝⣗⡽⡽⣝⣗⡽⣳⣫⢞⡽⡽⣝⢽⢝⡽⣕⢯⣳⡫⣗⢯⡺⣝⡵⣳⢝⣗⢽⢝⡮⡯⣺⡺⣪⢯⡺⣕⡗⡯⣳⢕⡯⣺⡺⣕⣗⢽⡪⣞⣝⢮⡳⣫⢯⡺⣪⢗⡽⣪⢞⡵⣝⢮⡳⡝⡮⣫⡳⣝⢞⢮⡳⣝⢞⣎⢗⡵⡝⡮⡳⣝⢮⢳⡹⣪
⠩⢘⠌⡂⡣⢑⠜⡘⡘⡘⢌⠣⢩⠑⢍⢊⢊⠪⡑⠍⡢⢙⢘⠘⠜⡑⠕⠱⡑⠝⡘⠍⡊⠪⠑⠍⡃⡋⡊⠣⢓⠙⠜⡑⠝⡊⠣⡋⡚⠜⠕⠝⠪⠣⡓⠝⢜⠪⠫⢚⠜⡪⠫⡚⢎⠗⡝⠞⢎⢗⢳⠹⡪⠮⠳⡹⠊⠎⡓⡙⡊⢇⠫⢊⠌⠔⠠⢑⢈⢊⠊⠏⠞⠜⢕⢕⢗⠵⡝⡮⡺⡪⢯⡺⡕⡧⡳⣝⢵⣫⡳⣫⡳⡳⣕⢗⡵⣫⢯⡫⣏⢯⡳⡳⣕⢯⢏⡯⣫⢏⡯⣫⢯⡫⡯⣫⢯⡫⡯⡯⣻⡪⡯⣫⢏⡯⣫⢯⡺⣝⢞⡮⣗⢗⡽⣝⢞⢮⡫⣞⢮⡫⣗⢽⢕⣗⢵⡳⣝⢮⢯⡳⡳⣝⢽⡹⡮⣫⢞⡽⡺⣪⡻⣺⡪⣞⢵⡳⡽⣕⢯⡺⣹⢕⢯⡺⡝⡮⡺⣕⢯⡺⡵⡝⡮⡳⣝⢵⡫⡮⣫⡺⣪⡳⡳⡝⡮⡺⡝⡮⡳⣝⢮⡺⣕⢵
This file has been truncated, but you can view the full file.
https://video-previews.elements.envatousercontent.com/h264-video-previews/d9f8515e-e5f8-4158-8eb3-3193f24cc59f/21220888.mp4
https://video-previews.elements.envatousercontent.com/h264-video-previews/1927c668-496d-4232-943a-ea7423f8ff0c/8210670.mp4
https://video-previews.elements.envatousercontent.com/files/62533999-19ba-49cf-8636-85c9f6193cbe/video_preview_h264.mp4
https://video-previews.elements.envatousercontent.com/h264-video-previews/6a615bdc-c3bd-4906-8d8b-3c4e9a5402b1/21607768.mp4
https://video-previews.elements.envatousercontent.com/h264-video-previews/c89857d0-1c83-4158-a9d3-24f7bb4457b0/22257006.mp4
https://video-previews.elements.envatousercontent.com/h264-video-previews/a3f0d1a8-54ee-4d1d-b200-c4175dd9a231/16655032.mp4
https://video-previews.elements.envatousercontent.com/h264-video-previews/f6f35d5b-df86-467e-bb6b-d4d32e4f1d57/14631839.mp4
https://video-previews.elements.envatousercontent.com/files/d8c9cc5d-3c5e-4780-af8e-255a0c9e6c15/video_preview_h264.mp4
https://video-previews.elements.envatouse
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
def plot_timestamps(timestamps: list):
# Convert timestamps to hours
timestamps_hours = np.array(timestamps) / 3600
# Create DataFrame for seaborn
# XCloud Common Import Paths
import rp
import sys
sys.path += rp.get_absolute_paths(
"~/CleanCode/Management",
"~/CleanCode/Github/DiffusionAsShader",
# "~/CleanCode/Github/CogvideX-Interpolation-Mar23:MotionPrompting",
# "~/CleanCode/Github/CogvideX-Interpolation-Feb13:Inpainting",
)
# XCloud Common Import Paths
import rp
import sys
sys.path += rp.get_absolute_paths(
"~/CleanCode/Management",
"~/CleanCode/Github/DiffusionAsShader",
# "~/CleanCode/Github/CogvideX-Interpolation-Mar23:MotionPrompting",
# "~/CleanCode/Github/CogvideX-Interpolation-Feb13:Inpainting",
)
frames = load_video(
"https://www.shutterstock.com/shutterstock/videos/1024890566/preview/stock-footage-aerial-time-lapse-in-motion-or-hyperlapse-over-echo-park-of-downtown-los-angeles-california.webm",
use_cache=True,
)
while True:
for i, f in enumerate(frames):
display_image_in_terminal_color(f)
_terminal_move_cursor_to_top_left()
w = get_terminal_width()
print(
E0304 23:19:24.763811 1195178 fileutil.cc:3552] Could not stat /bigstore/xcloud-shared/burgert/CleanCode/Management/syncutil.py: generic::permission_denied: Calling GetObjectMetadata with file "/bigstore/xcloud-shared/burgert/CleanCode/Management/syncutil.py": cloud.bigstore.ResponseCode.ErrorCode::ORGPOLICY_CONSTRAINT_CHECK_FAILED: Request is prohibited by organization's policy. vpcServiceControlsUniqueIdentifier: kEgwzdb4KVnUqQoZY6fYIfRzttEJ-jJ9LN9hVNv9QaMrmzfV4l0ZU4YUc918eTyqEuhwdny4WGfvummo Request is prohibited by organization's policy. vpcServiceControlsUniqueIdentifier: kEgwzdb4KVnUqQoZY6fYIfRzttEJ-jJ9LN9hVNv9QaMrmzfV4l0ZU4YUc918eTyqEuhwdny4WGfvummo [google.rpc.error_details_ext] { message: "Request is prohibited by organization\'s policy. vpcServiceControlsUniqueIdentifier: kEgwzdb4KVnUqQoZY6fYIfRzttEJ-jJ9LN9hVNv9QaMrmzfV4l0ZU4YUc918eTyqEuhwdny4WGfvummo" details { [type.googleapis.com/google.rpc.DebugInfo] { stack_entries: "com.google.net.rpc3.client.RpcClientException: APPLICATION_ERROR;cloud.bigstor