Skip to content

Instantly share code, notes, and snippets.

View adamelliotfields's full-sized avatar

Adam Fields adamelliotfields

View GitHub Profile
@adamelliotfields
adamelliotfields / secrets.md
Last active July 22, 2024 19:18
Setting Secrets Privately with `read`

Setting Secrets Privately with read

Instead of entering export GH_TOKEN=your_token, you can use read to set the variable without exposing it in your history:

read -s GH_TOKEN && export GH_TOKEN
@adamelliotfields
adamelliotfields / sd.ipynb
Last active July 23, 2024 23:18
Stable Diffusion 1.5 Notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adamelliotfields
adamelliotfields / cell.md
Created July 19, 2024 21:56
JupyterLab Cell Toolbar Items

JupyterLab Cell Toolbar Items

To add an item to the cell toolbar, go to Settings > Settings Editor > Cell Toolbar. Each item gets a name, command, and icon.

Run Cell

  • Unique name: run-cell
  • Command id: notebook:run-cell
  • Item icon id: ui-components:run
@adamelliotfields
adamelliotfields / omost.ipynb
Last active July 17, 2024 21:21
Omost Notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adamelliotfields
adamelliotfields / dreamshaper.md
Last active July 14, 2024 13:29
DreamShaper XL Fooocus Preset
@adamelliotfields
adamelliotfields / scripts.md
Created July 12, 2024 12:21
Maintain Relative Paths in Shell Scripts

You can use the $0 variable to get the script's path:

cat "$(dirname $0)/some/file.txt"

If you have Bash, you can use ${BASH_SOURCE[0]} instead of $(dirname $0), to avoid spawning a subshell. To test, create 2 files in /tmp/test:

mkdir -p /tmp/test
@adamelliotfields
adamelliotfields / civitai.md
Last active July 12, 2024 05:22
Download CivitAI Files from Command Line

Use token query param not Authorization header. Ensure URL has "download" in it. Creating an API token is at the bottom of Account Settings.

Curl

curl -Lo add-detail-xl.safetensors https://civitai.com/api/download/models/135867?token=$CIVIT_TOKEN

Wget

@adamelliotfields
adamelliotfields / cuda.md
Last active July 12, 2024 12:52
Install NVIDIA CUDA and cuDNN on WSL2 for TensorFlow

When neural network frameworks are built, they are dynamically linked to CUDA and cuDNN libraries. These are so or shared object files that are loaded at runtime. The LD_LIBRARY_PATH environment variable tells Ubuntu where to look for these files.

On Windows, these are dll or dynamic link library files.

Why?

GPUs were originally designed for graphics. When you're running a neural network, you're not using the GPU for graphics. CUDA (Compute Unified Device Architecture) is a general-purpose computing on GPUs (GPGPU) platform that allows C-code to run on the GPU. cuDNN (CUDA Deep Neural Network) is a library of primitives like matrix multiplication and convolution that are optimized for GPUs.

To ensure everything works, you want your system to provide the versions of CUDA and cuDNN that your software expects.

@adamelliotfields
adamelliotfields / tunnel.md
Created May 5, 2024 16:56
Cloudflare Tunnel Instructions

Cloudflare Tunnel Instructions

This assumes you have a free Cloudflare account and you're already using it as your DNS provider. Also, this is going to be using cloudflared directly on-demand, rather than an always-on systemd service. Based on the official tutorial.

Install cloudflared

Note that you don't need to install the systemd service.

# mac
@adamelliotfields
adamelliotfields / typography.md
Last active December 29, 2023 03:08
Tailwind Typography Markdown Sample Copy

Tailwind Typography

Until now, trying to style an article, document, or blog post with Tailwind has been a tedious task that required a keen eye for typography and a lot of complex custom CSS.

By default, Tailwind removes all of the default browser styling from paragraphs, headings, lists and more. This ends up being really useful for building application UIs because you spend less time undoing user-agent styles, but when you really are just trying to style some content that came from a rich-text editor in a CMS or a markdown file, it can be surprising and unintuitive.

We get lots of complaints about it actually, with people regularly asking us things like:

Why is Tailwind removing the default styles on my h1 elements? How do I disable this? What do you mean I lose all the other base styles too?