Skip to content

Instantly share code, notes, and snippets.

View shinshin86's full-sized avatar
👶

Yuki Shindo shinshin86

👶
View GitHub Profile
@shinshin86
shinshin86 / reset-opfs-script.js
Created September 11, 2024 01:47
Developer script to reset OPFS data on browser.
/**
* 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();
@shinshin86
shinshin86 / checkpnginfo.py
Created September 8, 2024 09:55
Check pnginfo script
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
@shinshin86
shinshin86 / inspect-opfs.js
Last active October 2, 2024 01:44
A script to display the contents of the OPFS (intended to be executed in the console of Google Chrome's Developer Tools)
/**
* 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();
@shinshin86
shinshin86 / omost_colab_start.sh
Created June 1, 2024 00:29
This shell script is designed to initialize and run the Omost on Google Colab.
!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
@shinshin86
shinshin86 / apply-upstream-tags.sh
Created December 4, 2023 23:36
This shell script checks If the upstream remote is present, it proceeds to fetch all tags from the upstream repository and then pushes these tags to the origin remote repository.
#!/bin/bash
# Check if the upstream repository is set
upstream=$(git remote -v | grep upstream)
# Check if the upstream repository exists
if [ -z "$upstream" ]; then
echo "The upstream repository is not set."
else
echo "Upstream repository found. Fetching and pushing tags."
@shinshin86
shinshin86 / all-update-watch-status-gh-star-project.ts
Created November 7, 2023 22:10
Script that runs in Deno to reconfigure to ignore notifications for Starred GitHub projects.
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,
@shinshin86
shinshin86 / is-animated-gif.js
Created July 29, 2023 13:35
This is a Node.js script to check if it is an animated GIF.
(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);
}
@shinshin86
shinshin86 / read-sdwebui-file-metadata.js
Last active May 14, 2023 12:25
Sample Node.js to read metadata of PNG files created with Stable Diffusion web UI.
/**
* 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]);
@shinshin86
shinshin86 / chatgpt-conversation-downloader.js
Created January 11, 2023 13:44
ChatGPT conversation downloader
/**
* 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.
*
@shinshin86
shinshin86 / chatgpt-with-qa-format.js
Created December 9, 2022 12:54
Script for displaying the conversing with ChatGPT in the console log in QA format.
// 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'));