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
let htmlString = document.body.innerHTML | |
const parser = new DOMParser(); | |
const doc = parser.parseFromString(htmlString, 'text/html'); | |
const messages = []; | |
const divs = doc.querySelectorAll('.group.relative.max-w-3xl.min-max-w-3xl.m-auto.w-full.p-2'); | |
divs.forEach(div => { | |
const nameElement = div.querySelector('.text-small'); | |
if (nameElement) { |
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 { writeFile } from 'fs/promises' | |
const DRAW_THINGS_URL = 'http://127.0.0.1:7860/sdapi/v1/txt2img' | |
const BATCH_COUNT = 5 | |
const IMG_SIZE = 512 | |
const MAX_FILE_NAME_LEN = 30 | |
const prompt = 'bunch of carrots' | |
const params = { |
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 * as THREE from 'three'; | |
import { | |
OrbitControls | |
} from 'https://unpkg.com/three/examples/jsm/controls/OrbitControls.js'; | |
import { | |
GLTFLoader | |
} from 'https://unpkg.com/three/examples/jsm/loaders/GLTFLoader.js'; | |
let camera, scene, renderer, model, controls; |
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
function extractAndDownloadAllChapters() { | |
// Find all containers that hold chapter text | |
const chapterContainers = document.querySelectorAll('.cha-words'); | |
// Initialize an array to hold all chapter texts | |
let allChaptersText = []; | |
// Iterate over each chapter container | |
chapterContainers.forEach(container => { | |
// Get all paragraph elements within the container |
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 pandas as pd | |
import torch | |
from torch.utils.data import Dataset, DataLoader | |
from transformers import BartForConditionalGeneration, BartTokenizer | |
from torch.optim import AdamW | |
import os | |
os.environ["PYTORCH_MPS_HIGH_WATERMARK_RATIO"] = "0.0" | |
# Define your dataset class |
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 json | |
from bs4 import BeautifulSoup | |
with open("Main - Rushia Uruha.html") as fp: | |
soup = BeautifulSoup(fp, "html.parser") | |
items = [] | |
main_text = None | |
target_text = None | |
for tag in soup.find_all("span", class_="s1"): | |
text = tag.get_text().strip() |
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
function timeConverter(UNIX_timestamp){ | |
var a = new Date(UNIX_timestamp * 1000); | |
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; | |
var year = a.getFullYear(); | |
var month = months[a.getMonth()]; | |
var date = a.getDate(); | |
var hour = a.getHours(); | |
var time = date + ' ' + month + ' ' + year + ' ' + hour + ':' + '00' ; | |
return time; | |
} |