Caveat: resolution changes seem very difficult to trigger behind a proxy, this script works well on a "real" network.
# https://wiki.archlinux.org/index.php/advanced_traffic_control
ETH=eth0
tc qdisc del root dev $ETH || true # clear
tc qdisc add dev $ETH root handle 1: htb default 30
tc class add dev $ETH parent 1:1 classid 1:30 htb rate 10Mbit burst 1k
tputreplace() {
printf '%s' "$1 "
tc class replace dev $ETH classid 1:30 htb rate "$1" burst 1k
}
while true; do
tputreplace 350kbit; sleep 60
tputreplace 10Mbit; sleep 60
done