Skip to content

Instantly share code, notes, and snippets.

View shinshin86's full-sized avatar
👶

Yuki Shindo shinshin86

👶
View GitHub Profile
@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 / 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 / convert-ts-obj-to-json.ts
Last active November 30, 2024 14:57
Convert TypeScript object to JSON. The output file (output-file.json) will be created in the same directory as the input file.
/**
* Convert TypeScript object (or JavaScript object) to JSON.
*
* Usage:
* This code uses Bun for execution, but it can also be run with other tools like Node.js.
*
* Example:
* bun convert-ts-obj-to-json.ts <input-file.ts>
*
* Note: