This file contains 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
! split a string into 2 either side of a delimiter token | |
function split(instr, delm) | |
implicit none | |
CHARACTER(len=80),intent(in) :: instr,delm | |
INTEGER :: idx | |
idx = scan(instr,delm) | |
split = instr(1:idx-1) | |
END function split |
This file contains 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 python3 | |
""" for use from shell, returns on STDOUT a free port number. | |
Yes, there is a slight race condition where between end of this program and start of your shell program, | |
another program could grab this port. | |
Useful for scripts with SSH port forwarding for example, where you have one or more hops before the final host. | |
reference: http://stackoverflow.com/questions/1365265/on-localhost-how-to-pick-a-free-port-number | |
Michael Hirsch |