add script to test max MTU
This commit is contained in:
@@ -79,13 +79,11 @@ This setup is currently only adapted for Niri.
|
|||||||
|
|
||||||
## Wallpaper & Colortheme
|
## Wallpaper & Colortheme
|
||||||
|
|
||||||
The most suitable primary color (or so-called flavor) will be chosen from the [Catppuccin Mocha](https://catppuccin.com/palette/) palette and applied to various apps automatically after changing wallpaper. See also:
|
|
||||||
|
|
||||||
- [wallpaper-carousel](https://github.com/Uyanide/Wallpaper_Carousel): an Image Carousel implemented with Qt Widgets to browse and set wallpapers from.
|
- [wallpaper-carousel](https://github.com/Uyanide/Wallpaper_Carousel): an Image Carousel implemented with Qt Widgets to browse and set wallpapers from.
|
||||||
- [wallpaper-daemon](./config/scripts/.local/scripts/wallpaper-daemon): automatic blur (only works in niri).
|
- [wallpaper-daemon](./config/scripts/.local/scripts/wallpaper-daemon): automatic blur (only works in niri).
|
||||||
- [change-wallpaper](./config/scripts/.local/scripts/change-wallpaper): script that changes wallpaper with a few extra features.
|
- [change-wallpaper](./config/scripts/.local/scripts/change-wallpaper): script that changes wallpaper with a few extra features.
|
||||||
- [change-colortheme](./config/scripts/.local/scripts/change-colortheme): script that changes color scheme based on wallpaper.
|
- [change-colortheme](./config/scripts/.local/scripts/change-colortheme): script that extract colors from the current wallpaper and generate a catppuccin color scheme accordingly.
|
||||||
- [backgrounds collection](https://github.com/Uyanide/backgrounds) for personal use.
|
- [backgrounds](https://github.com/Uyanide/backgrounds) collection for personal use (mostly waifus).
|
||||||
|
|
||||||
## Rofi
|
## Rofi
|
||||||
|
|
||||||
|
|||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
config/wallpaper/Pictures/backgrounds
|
||||||
Executable
+71
@@ -0,0 +1,71 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
def ping(host, packet_size, is_ipv6=False):
|
||||||
|
if is_ipv6:
|
||||||
|
header_size = 48 # 40 bytes IPv6 header + 8 bytes ICMPv6 header
|
||||||
|
cmd = ['ping', '-6', '-c', '2', '-M', 'do', '-s', str(packet_size - header_size), host]
|
||||||
|
else:
|
||||||
|
header_size = 28 # 20 bytes IP header + 8 bytes ICMP header
|
||||||
|
cmd = ['ping', '-4', '-c', '2', '-M', 'do', '-s', str(packet_size - header_size), host]
|
||||||
|
|
||||||
|
try:
|
||||||
|
result = subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||||
|
return result.returncode == 0
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def bin_search_mtu(host, min_mtu, max_mtu, is_ipv6=False):
|
||||||
|
l = min_mtu
|
||||||
|
h = max_mtu
|
||||||
|
ret = 0
|
||||||
|
|
||||||
|
print(f"Testing {'IPv6' if is_ipv6 else 'IPv4'} MTU for {host}...")
|
||||||
|
|
||||||
|
if not ping(host, l, is_ipv6):
|
||||||
|
print(f" Cannot reach host even with MTU {l}.")
|
||||||
|
return None
|
||||||
|
|
||||||
|
while l <= h:
|
||||||
|
m = (l + h) // 2
|
||||||
|
if ping(host, m, is_ipv6):
|
||||||
|
ret = m
|
||||||
|
print(f" MTU {m} OK")
|
||||||
|
l = m + 1
|
||||||
|
else:
|
||||||
|
print(f" MTU {m} Failed")
|
||||||
|
h = m - 1
|
||||||
|
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) < 2 or len(sys.argv) == 3 or len(sys.argv) > 4:
|
||||||
|
print(f"Usage: {sys.argv[0]} <domain> [min_mtu max_mtu]")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
domain = sys.argv[1]
|
||||||
|
min_search = sys.argv[2] if len(sys.argv) >= 4 else 1000
|
||||||
|
max_search = sys.argv[3] if len(sys.argv) >= 4 else 1500
|
||||||
|
|
||||||
|
ipv4_mtu = bin_search_mtu(domain, min_search, max_search, is_ipv6=False)
|
||||||
|
if ipv4_mtu:
|
||||||
|
print(f"Max IPv4 MTU: {ipv4_mtu}")
|
||||||
|
else:
|
||||||
|
print("Could not determine IPv4 MTU.")
|
||||||
|
|
||||||
|
print("-" * 20)
|
||||||
|
|
||||||
|
ipv6_mtu = bin_search_mtu(domain, min_search, max_search, is_ipv6=True)
|
||||||
|
if ipv6_mtu:
|
||||||
|
print(f"Max IPv6 MTU: {ipv6_mtu}")
|
||||||
|
else:
|
||||||
|
print("Could not determine IPv6 MTU.")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
+17
-13
@@ -1,22 +1,20 @@
|
|||||||
### Font packages (involved in fontconfig)
|
### Font packages (involved in fontconfig)
|
||||||
|
|
||||||
- ttf-sarasa-gothi
|
- `extra/ttf-sarasa-gothic`
|
||||||
- ttf-symbola (AUR)
|
- `aur/ttf-symbola`
|
||||||
- noto-fonts
|
- `extra/noto-fonts`
|
||||||
- noto-fonts-cjk
|
- `extra/noto-fonts-cjk`
|
||||||
- noto-fonts-emoji
|
- `extra/noto-fonts-emoji`
|
||||||
- ttf-nerd-fonts-symbols
|
- `extra/ttf-nerd-fonts-symbols`
|
||||||
- maplemono-nf-cn (AUR)
|
- `aur/maplemono-nf-cn`
|
||||||
|
|
||||||
### Other fonts (used but not involved in fontconfig)
|
### Other fonts (used but not involved in fontconfig)
|
||||||
|
|
||||||
- Sour Gummy
|
- Sour Gummy (from [Google Fonts](https://fonts.google.com/specimen/Sour+Gummy))
|
||||||
- Font Awesome 6 Free
|
- Font Awesome 6 Free (extracted from an AUR package which no longer exists)
|
||||||
- Meslo LGM Nerd Font Mono
|
- `extra/ttf-meslo-nerd`
|
||||||
|
|
||||||
### Fontconfig configuration
|
### Font configuration
|
||||||
|
|
||||||
> `~/.config/fontconfig/fonts.conf`
|
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<?xml version='1.0'?>
|
<?xml version='1.0'?>
|
||||||
@@ -82,3 +80,9 @@
|
|||||||
</alias>
|
</alias>
|
||||||
</fontconfig>
|
</fontconfig>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Notes
|
||||||
|
|
||||||
|
- `~/.fonts/` is deprecated, use `~/.local/share/fonts/` instead.
|
||||||
|
|
||||||
|
- `~/.config/fontconfig/fonts.conf` will be loaded by `/etc/fonts/conf.d/50-user.conf` and therefore takes precedence over the rules defined in files starting with a higher number.
|
||||||
|
|||||||
Reference in New Issue
Block a user