Skip to content

Instantly share code, notes, and snippets.

View yukiarimo's full-sized avatar
🖥️
Coding

Yuki Arimo yukiarimo

🖥️
Coding
View GitHub Profile
@yukiarimo
yukiarimo / character-ai-dwnl-2-0.js
Created May 3, 2024 22:53
Character AI Downloader 2.0
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) {
@yukiarimo
yukiarimo / gen_images.mjs
Created March 29, 2024 06:03 — forked from aku/gen_images.mjs
Generate images using Draw Things HTTP API
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 = {
@yukiarimo
yukiarimo / three-js-demo.js
Created March 28, 2024 02:24
Three JS Model Demo
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;
@yukiarimo
yukiarimo / webnovel-downloader.js
Created March 14, 2024 20:52
Web novel Downloader
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
@yukiarimo
yukiarimo / cnn-fine-tune.py
Created November 28, 2023 19:25
Bert Large CNN fine tuning
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
@yukiarimo
yukiarimo / character-ai-wrapper.py
Last active December 24, 2023 08:07
Character AI Dialog Extractor
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()
@yukiarimo
yukiarimo / time.js
Created December 2, 2022 21:30
Unix time converter
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;
}