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
| find directory/ -name 'glob_pattern' -exec grep -q 'search_pattern ' {} \; -print |
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
| #SOCKS5 proxy via localhost:7070 | |
| #Tunnel over :9998 | |
| #host1: gateway machine | |
| #host2: firewalled (destination) machine | |
| ssh -f -N -L 9998:host2:22 host1; ssh -f -N -D 7070 localhost -p 9998 |
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
| ssh -f -N -L 1233:remote.host:22 gateway.host | |
| sshfs -p 1233 vsudilov@localhost:/nfs_mount /local/mountpoint -o reconnect |
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
| #import fnmatch | |
| #import os | |
| matches = [] | |
| for root, dirnames, filenames in os.walk('/path/'): | |
| for filename in fnmatch.filter(filenames, '*.py'): | |
| matches.append(os.path.join(root, filename)) |
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
| #import os,errno | |
| def mkdir_p(path): | |
| try: | |
| os.makedirs(path) | |
| except OSError as exc: # Python >2.5 | |
| if exc.errno == errno.EEXIST and os.path.isdir(path): | |
| pass | |
| else: raise |
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
| class cd: | |
| """ | |
| Context manager for changing the current working directory | |
| with cd('/path'): | |
| open('file_in_path') | |
| """ | |
| def __init__(self, newPath): | |
| self.newPath = newPath |
NewerOlder