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
/** | |
* Developer script to reset OPFS data | |
* (Please run on Chrome devtools console) | |
*/ | |
async function resetOPFS() { | |
if ('storage' in navigator && 'getDirectory' in navigator.storage) { | |
const root = await navigator.storage.getDirectory(); | |
for await (const entry of root.values()) { | |
console.log(`Remove: ${entry.name} (${entry.kind})`); | |
await entry.remove(); |
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
from PIL import Image | |
import sys | |
def get_png_info(file_path): | |
try: | |
with Image.open(file_path) as img: | |
if img.format != 'PNG': | |
return "This is not a PNG image." | |
info = img.info |
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
/** | |
* Script for displaying the contents of the OPFS | |
* (Intended to be executed in the console of Google Chrome's Developer Tools) | |
* | |
* Only the OPFS data related to the origin of the web page running this script can be retrieved | |
*/ | |
// Get the root directory of OPFS | |
async function getOPFSRoot() { | |
return await navigator.storage.getDirectory(); |
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
!git clone https://github.com/shinshin86/Omost.git | |
%cd Omost | |
!git checkout add-share-option | |
!pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121 | |
!pip install -r requirements.txt | |
!python gradio_app.py --share |
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 { Octokit } from "https://esm.sh/octokit?dts"; | |
const personalAccessToken = "YOUR_PERSONAL_ACCESS_TOKEN"; | |
const octokit = new Octokit({ auth: personalAccessToken }); | |
async function getStarredRepos() { | |
try { | |
const response = await octokit.paginate("GET /user/starred"); | |
return response.map((repo) => ({ | |
owner: repo.owner.login, |
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
(async() => { | |
const gifFrames = require('gif-frames'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const gifPath = process.argv[2]; | |
if(!gifPath) { | |
console.log('Please provide an gif file as an argument'); | |
process.exit(1); | |
} |
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
/** | |
* Sample Node.js to read metadata of PNG files created with Stable Diffusion Web UI | |
* | |
* Code from the following page is used as a reference | |
* URL: https://qiita.com/javacommons/items/472e85be1b11098172b3 | |
*/ | |
const fs = require('fs').promises; | |
async function getPngInfo(fileName) { | |
const signature = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]); |
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
/** | |
* ChatGPT conversation downloader | |
* | |
* Usage: | |
* 1. Open the ChatGPT page. | |
* 2. Open the console from your browser's developer tools (DevTools for Chrome), paste this script and run it. | |
* 3. Next, run `download()` with the conversation you want to download selected from the history. | |
* 4. The conversation will then be downloaded as a text file. | |
* 5. The title of the text file will be the title name in the history. | |
* |
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
// USAGE: After conversing with ChatGPT, run this code on the Chrome developer console. | |
const textList = [] | |
document.querySelectorAll('.text-base').forEach((t, i) => { | |
textList.push(`${i % 2 === 0 ? "Q:" : "A:"} ${t.textContent}`) | |
}) | |
console.log(textList.join('\n')); |
NewerOlder