Skip to content

Instantly share code, notes, and snippets.

View noherczeg's full-sized avatar

Norbert Csaba Herczeg noherczeg

View GitHub Profile
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);
#!/bin/bash
set -e
find . -type f \( -name "*.ts" -o -name "*.tsx" \) -exec cat {} + | wc -l
import { createHash } from 'node:crypto';
const hash = createHash('md5');
hash.update('asdasdasdasd2323');
console.log(hash.digest('hex'));
#!/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";;
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"
@noherczeg
noherczeg / index.html
Last active December 19, 2022 02:09
preloader css
<section>
<br />
<br />
<br />
<div class="preloader-whirlpool">
<div class="whirlpool"></div>
</div>
</section>
@noherczeg
noherczeg / index.js
Created January 30, 2021 22:12
node web hello-world
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!')
})
@noherczeg
noherczeg / ps_pid_kill.txt
Created November 27, 2020 08:28
ps pid kill
ps -ef | grep "KEYWORD" | awk '{print $2}'
alias killps="kill -9 `ps -ef | grep '[k]eyword' | awk '{print $2}'`"

Modal Verbs

Dürfen — “may”

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.”)