Codesnippets und Typst
This commit is contained in:
@@ -0,0 +1,51 @@
|
|||||||
|
# Codesnippets
|
||||||
|
|
||||||
|
## PHP
|
||||||
|
|
||||||
|
### IPV4 --> CIDR
|
||||||
|
|
||||||
|
```php
|
||||||
|
function subnetMaskToCidr(string $mask): int
|
||||||
|
{
|
||||||
|
$long = ip2long($mask);
|
||||||
|
|
||||||
|
if ($long === false) {
|
||||||
|
throw new InvalidArgumentException("Ungültige Subnetzmaske");
|
||||||
|
}
|
||||||
|
|
||||||
|
$cidr = 0;
|
||||||
|
|
||||||
|
for ($i = 31; $i >= 0; $i--) {
|
||||||
|
if (($long & (1 << $i)) !== 0) {
|
||||||
|
$cidr++;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $cidr;
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
oder
|
||||||
|
|
||||||
|
```php
|
||||||
|
function subnetMaskToCidr(string $mask): int
|
||||||
|
{
|
||||||
|
$octets = explode('.', $mask);
|
||||||
|
$cidr = 0;
|
||||||
|
|
||||||
|
foreach ($octets as $octet) {
|
||||||
|
while ($octet > 0) {
|
||||||
|
$cidr++;
|
||||||
|
$octet &= $octet - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $cidr;
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# LaTeX -- Typst
|
||||||
|
|
||||||
|
## Griechische Buchstaben
|
||||||
|
|
||||||
|
### kleine griechische Buchstaben
|
||||||
|
|
||||||
|
| LaTeX | Vorschau | Typst |
|
||||||
|
|:-------- | -------- | ----- |
|
||||||
|
| `\alpha` | $\alpha$ | alpha |
|
||||||
|
| `\beta` | $\beta$ | beta |
|
||||||
|
| `\gamma` | $\gamma$ | gamma |
|
||||||
|
| $\delta$ | $\delta$ | delta |
|
||||||
|
| | | |
|
||||||
|
|
||||||
|
https://qwinsi.github.io/tex2typst-webapp/cheat-sheet.html
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user