This file contains hidden or 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 hidden or 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 hidden or 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
/** | |
* 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: |
OlderNewer