This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # USB profile watcher. | |
| # Runs with bash or zsh: bash ~/dockmgr watch, zsh ~/dockmgr watch, or just ~/dockmgr watch. | |
| # Profile USB IDs. Space-separated vendor:product pairs. | |
| # Work profile, from your connected lsusb output: | |
| # Bus 002 Device 002: ID 05e3:0625 Genesys Logic, Inc. USB3.2 Hub | |
| # Bus 002 Device 003: ID 0bda:8153 Realtek Semiconductor Corp. RTL8153 Gigabit Ethernet Adapter | |
| # Bus 003 Device 006: ID 05e3:0610 Genesys Logic, Inc. Hub | |
| # Bus 003 Device 007: ID 05e3:0608 Genesys Logic, Inc. Hub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -e | |
| declare -i last_called=0 | |
| declare -i throttle_by=4 | |
| @throttle() { | |
| local -i now=$(date +%s) | |
| if (($now - $last_called > $throttle_by)) | |
| then |