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
| #!/bin/bash | |
| # Install: | |
| # curl -O https://gist.github.com/nechkin/0ac33fad55f777c9994d#file-autossh-initd-elastic-tunnel-setup-sh | |
| # chmod u+x autossh-initd-elastic-tunnel-setup.sh | |
| # ./autossh-initd-elastic-tunnel-setup.sh | |
| SSH_USER="EBdev" | |
| SSH_SERVER="172.22.40.10" | |
| SSH_PORT="22" |
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
| http://stackoverflow.com/questions/18845814/bash-extracting-file-basename-from-long-path | |
| files=( /very/long/path/to/various/files/*.file ) | |
| for file in "${files[@]}" | |
| do | |
| filename="${file##*/}" | |
| filenameWithoutExtension="${filename%.*}" | |
| echo "$filenameWithoutExtension" | |
| done |
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
| // From dart algorithm package | |
| /** Version of [binarySearch] optimized for comparable keys */ | |
| int _comparableBinarySearch(List<Comparable> list, Comparable key) { | |
| int min = 0; | |
| int max = list.length; | |
| while (min < max) { | |
| int mid = min + ((max - min) >> 1); | |
| var element = list[mid]; | |
| int comp = element.compareTo(key); | |
| if (comp == 0) return mid; |
NewerOlder