Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Download Chrome extension files (CRX)</title>
</head>
<body>
include <SkadisBox.scad>
hinge_solid_grosor=2.5;
hinge_solid_square_lenght=16;
hinge_solid_width=12;
hinge_solid_unit_separation=3.5;
hinge_screwholder_width=hinge_solid_width-1;
hinge_screwholder_hole=1;
hinge_joint_width=8;
hook_support_width=4;
function FindProxyForURL(url, host) {
// Bypass localhost and local network addresses
if (
shExpMatch(host, "localhost") ||
shExpMatch(host, "*.local") ||
isInNet(host, "127.0.0.0", "255.0.0.0") ||
isInNet(host, "10.0.0.0", "255.0.0.0") ||
isInNet(host, "172.16.0.0", "255.240.0.0") ||
isInNet(host, "192.168.0.0", "255.255.0.0")
) {
async function generateKeysAndId() {
const keyPair = await crypto.subtle.generateKey(
{
name: "RSASSA-PKCS1-v1_5",
modulusLength: 2048,
publicExponent: new Uint8Array([0x01, 0x00, 0x01]),
hash: "SHA-256",
},
true,
["sign", "verify"]
function getLogger(prefix: string, time = false): Console {
return new Proxy(console, {
get(target, prop) {
if (typeof target[prop] === 'function') {
return function(...args) {
return target[prop](`[${prefix} ${time ? new Date().toISOString() : ''}]`, ...args);
};
}
return target[prop];
}
import { readonly, ref } from 'vue'
import type { Ref } from 'vue'
type StoreItem<N extends string, T> = {
readonly [K in N]: Readonly<Ref<T>>
} & {
readonly [K in `set${Capitalize<N>}`]: (value: T) => void
}
@victor141516
victor141516 / generate_image.sh
Created May 9, 2025 09:01
Generate image using gpt-image-1
function generate_image() {
output_filename="image-$(date +%s).png"
image_prompt=$(echo $1 | jq -R)
gpt_response=$(curl -s https://api.openai.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-image-1",
"prompt": '$image_prompt',
@victor141516
victor141516 / uuidv4.js
Created May 2, 2025 19:20
Generate UUIDv4
export default () => {
const u = [...crypto.getRandomValues(new Uint8Array(16))]
u[6] = (u[6] & 0x0f) | 0x40
u[8] = (u[8] & 0x0f) | 0x80
return u
.map((b) => b.toString(16).padStart(2, '0'))
.join('')
.replace(/^(.{8})(.{4})(.{4})(.{4})/, '$1-$2-$3-$4-')
}
/**
* Asserts that a value is of a specific type.
* If the assertion fails, an error is thrown.
*
* @param value The value to type check (used only in type signature)
* @param checker A function that returns true if the value is of the expected type
* @param message Optional custom error message
* @throws Error if the checker returns false
*/
export function assert<T>(
rclone mount ^
--vfs-cache-mode full ^
--vfs-cache-max-age 24h ^
--vfs-cache-max-size 10G ^
--buffer-size 256M ^
--vfs-read-ahead 512M ^
--vfs-read-chunk-size 32M ^
--vfs-read-chunk-size-limit 256M ^
--allow-other ^
--dir-cache-time 24h ^