Skip to content

Instantly share code, notes, and snippets.

View Enough7's full-sized avatar
🌴

Enough7

🌴
  • Karlsruhe, Germany
  • 18:30 (UTC +02:00)
View GitHub Profile
@Enough7
Enough7 / Makefile-mermaid
Last active December 22, 2023 17:37 — forked from derektamsen/Makefile-mermaid
Makefile to render all mermaid diagrams in the directory it is placed in.
src_files := $(wildcard *.mmd)
out_files := $(patsubst %.mmd,output/%.png,$(src_files))
.PHONY: all clean
all: $(out_files)
output/%.png: %.mmd
mkdir -p $(dir $@)
mmdc -c ./mermaidconfig.json \
@Enough7
Enough7 / example.tex
Created August 21, 2023 18:43
Define new commands with arbitrary default options in Latex
% Taken from https://ctan.net/macros/latex/contrib/todonotes/todonotes.pdf
\newcommand{\todoredefined}[2][]
{\todo[color=red, #1]{#2}}
@Enough7
Enough7 / Command.sh
Last active July 28, 2023 16:49
Command to CPU-Scaling, -temps & -frequencies
while true; do lscpu | grep MHz; sensors | grep "Tctl:"; cat /proc/cpuinfo | grep "cpu MHz"; sleep 1; done
# even better command:
watch -n 1 -d 'lscpu | grep MHz; sensors | grep "Tctl:"; cat /proc/cpuinfo | grep "cpu MHz";' # see `man watch` for more info
@Enough7
Enough7 / .md
Last active January 24, 2023 23:03 — forked from pwnedDesal/.md
PHP Session Data Injection Vulnerability

PHP Session Data Injection Vulnerability

Taoguang Chen <@chtg57> - Write Date: 2016.7.27 - Release Date: 2016.8.18

PHP's session php/php_binary handlers wrongly handles the session name cause arbitrarily session data injection.

Affected Versions

Affected is PHP 5 < 5.6.25
Affected is PHP 7 < 7.0.10

@Enough7
Enough7 / forloop.sh
Last active October 6, 2022 13:30
Bash for loop in one line for Ubuntu Terminal
for i in {1..9}; do mkdir "Execise0$i"; done
# see https://www.cyberciti.biz/faq/linux-unix-bash-for-loop-one-line-command/
@Enough7
Enough7 / CaptureOneDigitNumbers.regex
Last active October 6, 2022 13:32
Regex capture numbers with length 0
Pattern: ((?<=\D|^)\d(?=\D|\n)) // DO NOT forget () or $1 won't capture
Replace/Capture (VsCode): $1
Before:
4
2 4 0 6 0 7 0 13 0 0 0 8 0 0 16 12
0 0 0 8 0 0 12 0 9 0 0 16 0 0 0 6
0 0 0 11 0 4 0 0 0 7 12 0 0 3 13 0
0 0 14 15 0 0 0 0 2 0 0 11 0 8 0 0
5 0 1 0 0 0 10 0 0 0 0 0 0 0 6 0
@Enough7
Enough7 / GenericHook.tsx
Last active August 12, 2021 10:02
Generic Hook in ReactTS
import {Fragment} from "react";
interface IGenericHookProps<TData> {
data: TData,
}
// Trailing comma in <TData,> to sidestep/avoid the JSX ambiguity. Only works in newer TypeScript-Compilers. Source: https://stackoverflow.com/questions/32308370/what-is-the-syntax-for-typescript-arrow-functions-with-generics#comment99104831_45576880
export let GenericHook = <TData,>(props: PropsWithChildren<IGenericHookProps<TData>>): JSX.Element => {
return (
<Fragment></Fragment>
@Enough7
Enough7 / gitShell.md
Last active May 26, 2022 15:53
Git Change Commit History
git config user.name "New User"
git config user.email "newuser@mail.com"

git log
git rebase -i 1f1357 # use --root to start from frist commit in History
# change the word 'pick' to 'edit' (you might want to use the shortform 'e'), save and exit

git commit --amend --reset-author --no-edit
git rebase --continue
@Enough7
Enough7 / Hook.tsx
Last active August 12, 2021 09:33
Output Array of Elements in a React Hook (Typescript)
export let SomeIcons = (): JSX.Element => {
let allIcons: ReactNode[] = [
<Flight/>, // Airplane Icon
<Flight/>,
<Flight/>
];
return (
<Grid container>
{props.allIcons[0]}