This file contains 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
// TypeScript type for an object with 1 property that is required but different then other properties | |
type Todo = { id: string; text: string; done: boolean } | |
type Table = Array<Record<string, unknown>> | |
type Schema = ( | |
| { | |
[key: string]: Table | |
} |
This file contains 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
import http from 'node:http' | |
import https from 'node:https' | |
import sizeOf from 'image-size' | |
const MAX_REDIRECTS = Number.parseInt( | |
process.env.IMGMETA_MAX_REDIRECTS || '10', | |
10, | |
) | |
const ALLOWED_DOMAINS = process.env.IMGMETA_ALLOWED_DOMAINS || '*' | |
const TIMEOUT = |
This file contains 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
type CacheType<T> = { | |
has: (key: string) => boolean; | |
get: (key: string) => T | undefined; | |
set: (key: string, result: T, now?: number) => void; | |
clear?: () => void; | |
}; | |
const createCache = <T>(maxAge = 60_000): CacheType<T> => { | |
const values = new Map<string, T>(); | |
const expiry = new Map<string, number>(); |
This file contains 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
for i in {0..255}; do print -Pn ' '%K{$i} %k%F{$i}${(l:3::0:)i}%f ' ' ${${(M)$((i%6)):#3}:+$'\n'}; done |
This file contains 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
version: '3' | |
services: | |
mysql: | |
image: docker.io/bitnami/mysql:8.0 | |
volumes: | |
- ./mysql_data:/bitnami/mysql | |
environment: | |
- ALLOW_EMPTY_PASSWORD=yes | |
- MYSQL_USER=bn_wordpress | |
- MYSQL_DATABASE=bitnami_wordpress |
This file contains 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
const readline = require("readline"); | |
const { default: faker } = require("@faker-js/faker"); | |
require("isomorphic-fetch"); | |
const API_URL = "http://localhost:4242/api/admin/projects/default/features"; | |
const API_KEY = "<YOUR_ADMIN_TOKEN>"; | |
const pastDate = (min = 0) => new Date(Date.now() - 1000 * 60 * min); | |
const FgGreen = "\x1b[32m"; |
This file contains 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
import { compile } from 'svelte/compiler' | |
/** | |
* @returns {import('vite').Plugin} | |
*/ | |
const vitePluginSvelteDocs = () => { | |
const virtualModuleId = '@virtual:svelte-docs' | |
return { | |
name: 'vite-plugin-svelte-docs', |
This file contains 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
{ | |
"headers": [ | |
{ | |
"source": "/(.*)", | |
"headers": [ | |
{ | |
"key": "Permissions-Policy", | |
"value": "interest-cohort=()" | |
} | |
] |
This file contains 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
#!/bin/bash | |
clear | |
echo "" | |
echo -e "\e[44mHEADLESS RASPBIAN\e[0m" | |
echo "WiFi & SSH setup" | |
echo "" | |
echo "Available partitions:" | |
lsblk -e7 | |
echo "" |
NewerOlder