Skip to content

Instantly share code, notes, and snippets.

@codatory
Last active May 9, 2024 03:18

Revisions

  1. codatory revised this gist May 9, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion fedora-optimize.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    cat > /etc/systemd/zram-generator.conf <<EOF
    cat > /etc/systemd/zram-generator.conf <<EOF
    [zram0]
    zram-size = ram / 2
    compression-algorithm = zstd
  2. codatory created this gist May 9, 2024.
    68 changes: 68 additions & 0 deletions fedora-optimize.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,68 @@
    cat > /etc/systemd/zram-generator.conf <<EOF
    [zram0]
    zram-size = ram / 2
    compression-algorithm = zstd
    EOF

    systemctl restart systemd-zram-setup@zram0.service

    cat > /etc/sysctl.d/99-sysctl.conf <<EOF
    # sysctl settings are defined through files in
    # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
    #
    # Vendors settings live in /usr/lib/sysctl.d/.
    # To override a whole file, create a new file with the same in
    # /etc/sysctl.d/ and put new settings there. To override
    # only specific settings, add a file with a lexically later
    # name in /etc/sysctl.d/ and put new settings there.
    #
    # For more information, see sysctl.conf(5) and sysctl.d(5).
    # Optimize zram
    vm.swappiness = 200
    vm.overcommit_memory = 1
    vm.vfs_cache_pressure = 60
    vm.dirty_ratio = 50
    vm.watermark_boost_factor = 0
    vm.watermark_scale_factor = 125
    vm.page-cluster = 0
    # Optimize tcp
    net.core.rmem_default = 524288
    net.core.rmem_max = 536870912
    net.ipv4.tcp_rmem = 8192 524288 536870912
    net.core.wmem_default = 524288
    net.core.wmem_max = 536870912
    net.ipv4.tcp_wmem = 4096 524288 536870912
    # Reduce the impact of congestion collapse
    net.ipv4.tcp_adv_win_scale = -2
    net.ipv4.tcp_notsent_lowat = 131072
    net.ipv4.tcp_congestion_control = bbr
    net.core.netdev_max_backlog = 32768
    net.ipv4.tcp_base_mss = 1460
    net.ipv4.tcp_min_rtt_wlen = 30
    net.ipv4.tcp_no_metrics_save = 1
    net.ipv4.tcp_syn_retries = 3
    EOF

    sysctl -p

    `nmcli connection show --active | grep ethernet` | while read con; do
    con_name=`echo $con | awk '{print $1}'`
    con_int=`echo $con | awk '{print $4}'`
    echo $con_name / $con_int
    max_rx=`ethtool -g $con_int | grep 'RX' | head -n 1 | awk '{print $2}'`
    max_tx=`ethtool -g $con_int | grep 'TX' | head -n 1 | awk '{print $2}'`
    `nmcli connection modify $con_int ethtool.ring-rx $max_rx`
    `nmcli connection modify $con_int ethtool.ring-tx $max_tx`
    `nmcli connection up $con_int`
    done

    paks=("flathub org.telegram.desktop" "com.google.Chrome" "com.discordapp.Discord" "io.github.shiftey.Desktop" "io.neovim.nvim" "org.upscayl.Upscayl" "org.standardnotes.standardnotes" "app.organicmaps.desktop" "org.libreoffice.LibreOffice")

    for pak in ${paks[@]} ; do
    flatpak install --noninteractive --app $pak
    done

    ujust brew fix-screenshare atun update