This file contains 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
import subprocess | |
import os | |
from datetime import datetime | |
from random import randint | |
#DIR = "/home/jack/Desktop/HDD500/0WORKSHOP-with-NOTEBOOKS/shaman/" | |
DIR = "/home/jack/Desktop/HDD500/FLASK/static/milestones_resources/Lexica-anime/" | |
VIDEOS = "EXPERIMENT/XXXX1.mp4" | |
BORDER ="/home/jack/Desktop/HDD500/FLASK/static/assets/512x666Border.png" | |
current_datetime = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") | |
filename = f"EXPERIMENT/_file_{current_datetime}.mp4" |
This file contains 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 PIL import Image | |
import os | |
# Define the directory to use | |
directory = "testfiles/" | |
# Iterate over the files in the directory | |
for filename in os.listdir(directory): | |
filepath = os.path.join(directory, filename) | |
if filename.endswith(".webp"): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 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 PIL import Image, ImageSequence | |
def zoom_effect(bg_file, fg_file): | |
bg = Image.open(bg_file).convert('RGBA') | |
bg = bg.resize((640,640), Image.BICUBIC) | |
fg = Image.open(fg_file).convert('RGBA') | |
fg = fg.resize((bg.size), Image.BICUBIC) | |
fg_copy = fg.copy() | |
fg_copy = fg_copy.resize((int(fg_copy.width), int(fg_copy.height))) | |
result_images = [] |
This file contains 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
import os | |
import re | |
search_dir = '/home/jack/Desktop/HDD500/notebooks' # Replace this with the directory where you want to search for Jupyter notebooks | |
search_string = 'password' # Replace this with the string you want to search for | |
replace_string = 'XXXnopassword' # Replace this with the string you want to replace the search string with | |
for file in os.listdir(search_dir): | |
if file.endswith('.ipynb'): | |
with open(os.path.join(search_dir, file), 'r', encoding='utf-8') as nb_file: |
This file contains 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
import os | |
search_dir = '/home/jack/Desktop/HDD500/notebooks' # Replace this with the directory where you want to search for Jupyter notebooks | |
search_string = 'passwords' # Replace this with the string you want to search for | |
output_file = 'contains_passwords.txt' # Replace this with the output file name | |
with open(output_file, 'w') as f: | |
for file in os.listdir(search_dir): | |
if file.endswith('.ipynb'): | |
with open(os.path.join(search_dir, file), 'r', encoding='utf-8') as nb_file: |
This file contains 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
#Locate and Copy all Jupyter notebooks in one directory | |
import os | |
import shutil | |
src_dir = '/home/jack' # Replace this with the root directory where you want to search for Jupyter notebooks | |
dst_dir = '/home/jack/Desktop/HDD500/notebooks/' # Replace this with the destination directory where you want to copy the notebooks | |
notebooks = {} # Dictionary to keep track of notebook names and sequence numbers | |
for root, dirs, files in os.walk(src_dir): | |
for file in files: | |
if file.endswith('.ipynb'): |
This file contains 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 PIL import Image, ImageFilter, ImageDraw | |
import glob | |
import time | |
def circleblur(FILENAME,saveDirectory,count): | |
im1 = Image.open(FILENAME) | |
im1 = im1.resize((512,512), Image.BICUBIC) | |
im2 = Image.new("RGBA",im1.size,(0,0,0,0)) | |
mask = Image.new("L", im1.size, 0) |
This file contains 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
import turtle | |
import math | |
from PIL import Image | |
def lerp(a, b, t): | |
"""Linear interpolation function. returns a when t==0, returns b when t==1 | |
and linearly interpolates for values inbetween""" | |
return (a * (1 - t)) + (b * t) | |