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 { type Plugin } from 'vite'; | |
import { existsSync, readFileSync } from 'node:fs'; | |
import { resolve } from 'node:path'; | |
interface ImportmapConfig { | |
appendSuffix?: Record<string, string>, | |
keepExternals?: string[], | |
} | |
function vitePluginImportmap(configOverrides: ImportmapConfig = {}): Plugin { |
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
# sudo dnf install screenfetch | |
# screenfetch |
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 { type SetStateAction, type Dispatch, useEffect, useRef, useState, useMemo } from 'react'; | |
export function useDerivedState<T>(prop: T): [T, Dispatch<SetStateAction<T>>] { | |
const [internalVal, setInternalVal] = useState<T>(prop); | |
const previousProp = useRef<any>(null); | |
useEffect(() => { | |
if (previousProp.current !== prop) { | |
previousProp.current = prop; | |
setInternalVal(prop); |
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 | |
set -e | |
find . -type f \( -name "*.ts" -o -name "*.tsx" \) -exec cat {} + | wc -l |
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 { createHash } from 'node:crypto'; | |
const hash = createHash('md5'); | |
hash.update('asdasdasdasd2323'); | |
console.log(hash.digest('hex')); |
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 | |
unameOut=$(uname -a) | |
case "${unameOut}" in | |
*Microsoft*) OS="WSL";; #must be first since Windows subsystem for linux will have Linux in the name too | |
*microsoft*) OS="WSL2";; #WARNING: My v2 uses ubuntu 20.4 at the moment slightly different name may not always work | |
Linux*) OS="Linux";; | |
Darwin*) OS="Mac";; | |
CYGWIN*) OS="Cygwin";; | |
MINGW*) OS="Windows";; |
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
ffmpeg -i https://56cf3370d8dd3.streamlock.net:1935/live/cedar1.stream/playlist.m3u8 \ | |
-c copy \ | |
-f segment \ | |
-segment_time 3600 \ | |
-segment_format mkv \ | |
-segment_atclocktime 1 \ | |
-reset_timestamps 1 \ | |
-strftime 1 "streamname_%Y-%m-%d_%H-%M-%S_%z.mkv" |
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
<section> | |
<br /> | |
<br /> | |
<br /> | |
<div class="preloader-whirlpool"> | |
<div class="whirlpool"></div> | |
</div> | |
</section> |
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 http = require('http') | |
const host = '0.0.0.0' | |
const port = 3000 | |
const server = http.createServer((req, res) => { | |
res.statusCode = 200 | |
res.setHeader('Content-Type', 'text/plain') | |
res.end('Hello World!') | |
}) |
NewerOlder