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!') | |
}) |
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
ps -ef | grep "KEYWORD" | awk '{print $2}' | |
alias killps="kill -9 `ps -ef | grep '[k]eyword' | awk '{print $2}'`" |
Dürfen is the modal verb we use to say “may.” You might also think of it as translating to “to be permitted to” in English.
Here are a few examples of the verb dürfen, with and without a secondary infinitive verb. (When relevant, I’ll also include a literal translation with the word-by-word sentence order, to better illustrate the differences between English and German word order.)
Er darf Fußball nicht spielen.
He may not play soccer. / He is not permitted to play soccer. (Literally: “He may soccer not play.”)
NewerOlder