Windows-like USB handling. No data loss.
- Auto-mount with immediate write (no cache)
 - Safe eject with retry logic
 - GUI + CLI
 - Right-click eject in file manager
 
| { | |
| "customModes": [ | |
| { | |
| "slug": "code-my-lean-expirimental", | |
| "name": "Code (My Lean Expirimental)", | |
| "roleDefinition": "You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.", | |
| "groups": [ | |
| "read", | |
| "edit", | |
| "browser", | 
| const dataUrlPrefix = "data:application/octet-stream;base64,"; | |
| export async function bufferToBase64(buffer: Uint8Array): Promise<string> { | |
| const base64url = await new Promise<string>((resolve) => { | |
| const reader = new FileReader(); | |
| reader.onload = () => resolve(reader.result as string); | |
| reader.readAsDataURL(new Blob([buffer])); | |
| }); | |
| return base64url.slice(dataUrlPrefix.length); | 
| /* | |
| To use this: | |
| 1. paste the following code in chrome developer tools | |
| */ | |
| const { downloadZip } = await import( | |
| "https://cdn.jsdelivr.net/npm/client-zip/index.js" | |
| ); | |
| async function allImgs() { | |
| const res = new Set(); | 
I'm adding a save/load feature to my WIP game and thought someone might find this small module useful
example usage:
const saveGameData = new SaveGame(); // make a custom schema for saved games data
... /* add all state objects from your game manager to saveGameData */
const serialized = await schemaToString(saveGameData);
... /* save to file, read from file etc. */
const loadedGameData: SaveGame = await stringToSchema(SaveGame, serialized );
... /* take game state object from loadedGameData into your game manager */| { | |
| "users": [ | |
| { | |
| "name": "test", | |
| "password": "test", | |
| "tags": "administrator" | |
| } | |
| ], | |
| "vhosts": [ | |
| { | 
| const fs = require('fs'); | |
| const path = require('path'); | |
| var execSync = require('child_process').execSync; | |
| const getAllFiles = function (dirPath, arrayOfFiles) { | |
| files = fs.readdirSync(dirPath); | |
| arrayOfFiles = arrayOfFiles || []; | |
| files.forEach(function (file) { | 
| const endTime = []; | |
| const WORK_DAY_TIME_RANGE = { | |
| half: { | |
| min: 450, | |
| max: 550 | |
| }, | |
| full: { | |
| min: 540, | |
| max: 660 | |
| } | 
| /** | |
| * a map that generates default values if none exists | |
| */ | |
| export class MagicMap<K,V> extends Map<K,V> { | |
| constructor(private defVal: () => V){ | |
| super(); | |
| } | |
| has = (key:K) => true; | |
| get = (key:K): V => { | 
| // originally copied from https://gist.github.com/amir-arad/3c140b3c44b81dcc1ec108e109355c27 | |
| export type LineData = { | |
| name: string; | |
| y: number[]; | |
| x: number[]; | |
| }; | |
| export type GraphPointInput = { | |
| annotate: (t: string) => unknown; |