Skip to content

Instantly share code, notes, and snippets.

View woodRock's full-sized avatar
🫖
Activate zen mode (CTRL + K, Z)

Jesse Wood woodRock

🫖
Activate zen mode (CTRL + K, Z)
View GitHub Profile
@woodRock
woodRock / FileNotFoundError.md
Created August 27, 2022 11:10
FileNotFoundError for Deforum Stable Diffusion colab notebook Deforum_Stable_Diffusion.ipynb

FileNotFoundError Error Fix

  1. Open the notebook in Colab. https://t.co/mWNkzWtPsK
  2. Run the notebook until you get the following error: FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/MyDrive/AI/models/sd-v1-4.ckpt'
  3. Gain access to the Stable Diffusion weights on HuggingFace https://huggingface.co/CompVis/stable-diffusion-v-1-4-original
  4. Download the Stable Diffusion weights - the "sd-v1-4.ckpt" file.
  5. Upload the "sd-v1-4.ckpt" file to the "AI/models/" directory on Google Drive.
  6. Restart and run the notebook.
@woodRock
woodRock / li.bash
Last active May 5, 2022 03:05
Linux: alias to open most recent screenshot - add this alias to your `~/.bashrc`.
alias li = "d=`date "+%Y-%m-%d"`;display "~/Pictures/*$d*.png";"
@woodRock
woodRock / kill-port.sh
Created September 25, 2021 09:28
Kill any process that is running on port 3000. Particularly useful for an HTTP server running an React application with NPM on Debian Linux.
#! /bin/sh
# Author: Jesse Wood
# Date: 2021-09-25
#
# This script kills processes on the 3000 port.
# The default port for running react applications.
# Get the pid for processes running on port 3000.
id=`lsof -i tcp:3000 | grep '*:3000' | cut -d " " -f 5`
@woodRock
woodRock / rm-last-2-chars.sh
Last active March 11, 2021 00:10
Truncate: Remove the last two characters of a file in Linux.
#! /bin/bash
truncate -s-2 filename
@woodRock
woodRock / file-input.sh
Created March 10, 2021 00:25
Take a filename as input for a script.
DIR=`pwd`
FILE=$1
if grep -q '\.' "$FILE"; then
FILE=`echo "${FILE}" | awk '{ print substr ($0, 3 ) }'`
fi
FULL_PATH="${DIR}/${FILE}"
@woodRock
woodRock / print-file-nice.sh
Created March 10, 2021 00:24
Print a file nicely using this bashscript.
echo -e "\n------------\nBEGIN FILE:\n------------\n"
cat "${FULL_PATH}" # Print the file to the terminal (nicely).
echo -e "\n------------\nEnd FILE:\n------------\n"
@woodRock
woodRock / hodor.sh
Created March 10, 2021 00:19
Holds the door! A bash script to stop the terminal from automatically closing upon completion of a script. Useful for debugging on Windows systems.
# Argument to hold the script.
if [[ "$2" == "hold" ]]; then
echo "Hold the Door!"
read
fi
@woodRock
woodRock / powerset.hs
Created March 4, 2021 22:37
A powerset is the set of all possible subsets of a set. I was taking university notes and had to write out a few of them. I'm lazy ... so I wrote this program in #Haskell to expand the powerset of a list of elements.
import Control.Monad
import Data.List
type Element = String
type Powerset = String
format :: String -> String
format s = "{" ++ s ++ "}"
powerset :: [Element] -> Powerset
@woodRock
woodRock / aoc-list.sh
Last active December 8, 2020 09:02
Generate a list formatted in the markdown Syntax for my Advent of Code [repository](https://github.com/woodRock/verbose-computing-machine) README.
#! /bin/bash
CURRENT=8
CHECKED=" "
for DAY in {1..31}
do
if [[ $DAY -le $CURRENT ]]; then
CHECKED="x"
else
@woodRock
woodRock / make
Created September 7, 2020 03:31
LaTeX makefile. Assumes latexmk is installed on the system. Clears the files associated with the previous build to prevent errors. Builds a pdf from the .tex files present in the repository. Removes the auxiliary files.
make: *.tex
latexmk -c
latexmk -pdf *.tex
latexmk -c