Skip to content

Instantly share code, notes, and snippets.

View JupyterJones's full-sized avatar

Jack Northrup JupyterJones

View GitHub Profile
@JupyterJones
JupyterJones / Make_a_video_of_Your_Jupyter_Notebook.ipynb
Created February 22, 2023 01:09
Make_a_video_of_Your_Jupyter_Notebook.ipynb Created To accompany A YouTube Video
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@JupyterJones
JupyterJones / CreateGif.py
Created February 15, 2023 03:54
Use Pil to create a gif - This opens a forground image and paste it small and with transparency then slowly increases opacity and size
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 = []
@JupyterJones
JupyterJones / ReplacePasswords.py
Created February 15, 2023 03:44
replace a string in a jupyter notebook get rid of any passwords
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:
@JupyterJones
JupyterJones / findpass.py
Created February 15, 2023 03:41
search jupyter notebooks in a directory for passwords
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:
@JupyterJones
JupyterJones / backup_jupyter.py
Created February 15, 2023 03:11
Locate and copy all jupyter notebooks in one directory renaming duplicate filenames
#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'):
@JupyterJones
JupyterJones / blurred-transparent-circles.py
Created December 31, 2022 11:06
Create a removes a circle, blurs the edges and pastes that image on a blank transparent image
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)
@JupyterJones
JupyterJones / logo.py
Last active November 25, 2022 23:08 — forked from SuperDoxin/logo.py
Python Logo using bezier curves and the turtle module
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)
@JupyterJones
JupyterJones / Search.py
Created September 25, 2022 04:14
Search Jupyter notebooks for a term then enter the results in an SQLITE database
import glob
import os.path
FILES = []
dir = '.'
files = glob.glob(os.path.join(dir, '*.ipynb'))
for file in files:
print (file)
FILES.append(file)
def insert(data):
@JupyterJones
JupyterJones / Working-With-Dates-and-TimeStamps.ipynb
Created May 12, 2022 03:22
Python - Working with Dates, Epochs and Time
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@JupyterJones
JupyterJones / mybootstrap.css
Created May 1, 2022 11:47
bootstrapcss modified
/*!
* Bootstrap v4.0.0 (https://getbootstrap.com)
* Copyright 2011-2018 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
:root {
--blue: #007bff;
--indigo: #6610f2;
--purple: #6f42c1;