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
class ShellUtils: | |
def __init__(self): | |
pass | |
@staticmethod | |
def run_bash_function(library_path, function_name, params): | |
cmdline = ['bash', '-c', '. %s; %s %s' % (library_path, function_name, params)] | |
p = subprocess.Popen(cmdline, | |
stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
stdout, stderr = p.communicate() |
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/python2.6 | |
import sys | |
import os | |
def build_dir_tree(base, depth, width): | |
print("Call #%d" % depth) | |
if depth >= 0: | |
curr_depth = depth | |
depth -= 1 |
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/python | |
import multiprocessing | |
import os | |
import subprocess | |
import os.path | |
import sys | |
from Queue import Empty | |
from multiprocessing import Process, Pool | |
from optparse import OptionParser | |
import traceback |
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
import argparse | |
import multiprocessing | |
from multiprocessing import Pool, Queue | |
from multiprocessing import Manager | |
import os | |
unsearched = Manager().Queue() | |
dirpath_queue = Queue() | |
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
import argparse | |
import multiprocessing | |
from multiprocessing.dummy import Pool, Queue | |
from multiprocessing import Manager | |
import os | |
class TreeCrawler(object): | |
def __init__(self, base_path, callback=None): |
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
def RSA_keys_generator(complexity=2048): | |
""" | |
Method generates id_rsa and id_rsa.pub on client. Tested on CentOS 6.x clients | |
""" | |
import paramiko | |
k = paramiko.RSAKey.generate(complexity) | |
k.write_private_key_file(os.path.expanduser('~/.ssh/id_rsa')) | |
with open(os.path.expanduser('~/.ssh/id_rsa.pub'), "w") as f: |