Skip to content

Instantly share code, notes, and snippets.

View TheLustriVA's full-sized avatar
🖥️
Coordinating Development Priorities

Pencoded TheLustriVA

🖥️
Coordinating Development Priorities
View GitHub Profile
@TheLustriVA
TheLustriVA / chatgpt_ep1_dbs_and_discord.md
Created January 3, 2023 01:23
A discussion with ChatGPT on Python libraries to use when building Discord Bots

ChatGPT: Python libraries to use when building Discord bots

This conversation started as a symptom of my laziness but quickly grew to be some solid beginner groundwork for building Discord Bots.

What is the easiest way of sending data to a Postgresql database when using Python?

The easiest way to send data to a PostgreSQL database from Python is to use the psycopg2 library. psycopg2 is a PostgreSQL database adapter for Python. It is used to connect to, query, and manage PostgreSQL databases from Python.

Here is an example of how you can use psycopg2 to connect to a PostgreSQL database and insert a row into a table:

@TheLustriVA
TheLustriVA / Fem-Clothing-List.txt
Created November 21, 2022 08:28
A raw list of Fem/Women's clothing for vocab and text generation
Active wear
Swimwear
Tailored clothing Suits
Casual wear Sports wear
Leg wear
Neckwear
Shawls and wraps
Bridal wear
Evening wear
Undergarments
@TheLustriVA
TheLustriVA / timedatectl_timezones.txt
Created October 11, 2022 08:25
TIMEDATECTL - List of timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
@TheLustriVA
TheLustriVA / index.html
Created October 8, 2022 16:31
Unsplash vueJS infinite scroll
<div class="hero is-fullheight is-bold is-info">
<div class="hero-body">
<div class="container">
<div class="header content">
<h2 class="subtitle is-6">Code Challenge #16</h2>
<h1 class="title is-1">
Infinite Scroll Unsplash Code Challenge
</h1>
</div>
<div v-infinite-scroll="loadMore" infinite-scroll-disabled="loading" infinite-scroll-distance="20">
@TheLustriVA
TheLustriVA / python-as-service.md
Created September 20, 2022 15:06 — forked from wannadrunk/python-as-service.md
How to run Python script as systemd service.
  1. in Python script, make sure include #!/path/to/venv/python in the first line
  2. add a systemd service $ sudo systemctl edit --force --full name.service. In the editor complete at least these statments,
[Unit]
Description=Python Service
Wants=network.target
After=network.target

[Service]
ExecStartPre=/bin/sleep 10
@TheLustriVA
TheLustriVA / find_noise.py
Created September 16, 2022 01:23 — forked from trygvebw/find_noise.py
A "reverse" version of the k_euler sampler for Stable Diffusion, which finds the noise that will reconstruct the supplied image
import torch
import numpy as np
import k_diffusion as K
from PIL import Image
from torch import autocast
from einops import rearrange, repeat
def pil_img_to_torch(pil_img, half=False):
image = np.array(pil_img).astype(np.float32) / 255.0
@TheLustriVA
TheLustriVA / systemd_on_wsl2.md
Created September 11, 2022 22:04
How to add services to boot on WSL2 without systemd

Systemd on WSL2

Credit to NotTheDroids at StackExchange

Windows 11

You can now execute an arbitrary command line when starting an instance by creating/editing /etc/wsl.conf (via sudo) with the following:

[boot]
@TheLustriVA
TheLustriVA / copilot_torch.py
Created September 3, 2022 12:06 — forked from jph00/copilot_torch.py
This is the code that copilot nearly entirely auto-generates for a function called `finetune` and a 1-line docstring
# I added all the imports by hand
import torch
from torchvision.datasets import ImageFolder
from torchvision import transforms,models
from torch import nn,optim
# For all functions including this one, I wrote the name and docstring, and sometimes also the param names
def finetune(folder, model):
"""fine tune pytorch model using images from folder and report results on validation set"""
if not os.path.exists(folder): raise ValueError(f"{folder} does not exist")
@TheLustriVA
TheLustriVA / pytz_time_zones.json
Last active September 2, 2022 15:00 — forked from heyalexej/pytz-time-zones.py
List of pytz time zones
{
"timezones": [
"Africa/Abidjan",
"Africa/Accra",
"Africa/Addis_Ababa",
"Africa/Algiers",
"Africa/Asmara",
"Africa/Asmera",
"Africa/Bamako",
"Africa/Bangui",
@TheLustriVA
TheLustriVA / Pt2_GPT3_explains_attention.md
Created August 11, 2022 17:02
GPT-3 explains attention resolutions in training an image model in basic terms

A conversation with GPT-3 on the meaning of "attention resolutions"

The Latent Space according to a diffusion model

An acquaintence on Discord came across the term "attention resolutions" in the code for configuring the training of an image model and couldn't find documentation on the term's meaning. I could only find it mentioned in one paper and the way it was used didn't help.

The following 'conversation' came from having Codex explain a code snippet that likely exists nowhere else because I imagined it purely to try draw an explanation.

It seems to have worked.