예제 #1
0
파일: main.py 프로젝트: Sarkutz/initmux
def GetTmuxSessionNames():  #{{{
    ListSessions = system('tmux list-sessions')
    if not ListSessions.startswith(connectFailed):
        ListSessions = system("tmux list-sessions -F '#S'")
        return ListSessions.split("\n")
    else:
        return []
예제 #2
0
파일: main.py 프로젝트: iasj/IniTmux
def GetTmuxNPanes(SName): #{{{
    ListSessions = system('tmux list-sessions')
    if not ListSessions.startswith(connectFailed):
        NPanes = system("tmux list-windows -t "+SName+" -F '#{window_panes}'")
        return NPanes.split("\n")
    else:
        return []
예제 #3
0
파일: main.py 프로젝트: Sarkutz/initmux
def GetTmuxWindowNames(SName):  #{{{
    ListSessions = system('tmux list-sessions')
    if not ListSessions.startswith(connectFailed):
        ListWindows = system("tmux list-windows -t " + SName + " -F '#W'")
        return ListWindows.split("\n")
    else:
        return []
예제 #4
0
파일: main.py 프로젝트: iasj/IniTmux
def GetTmuxSessionNames(): #{{{
    ListSessions = system('tmux list-sessions')
    if not ListSessions.startswith(connectFailed):
        ListSessions = system("tmux list-sessions -F '#S'")
        return ListSessions.split("\n")
    else:
        return []
예제 #5
0
파일: main.py 프로젝트: iasj/IniTmux
def GetTmuxWindowNames(SName): #{{{
    ListSessions = system('tmux list-sessions')
    if not ListSessions.startswith(connectFailed):
        ListWindows = system("tmux list-windows -t "+SName+" -F '#W'")
        return ListWindows.split("\n")
    else:
        return []
예제 #6
0
파일: main.py 프로젝트: Sarkutz/initmux
def GetTmuxNPanes(SName):  #{{{
    ListSessions = system('tmux list-sessions')
    if not ListSessions.startswith(connectFailed):
        NPanes = system("tmux list-windows -t " + SName +
                        " -F '#{window_panes}'")
        return NPanes.split("\n")
    else:
        return []
예제 #7
0
파일: cinema.py 프로젝트: eHonnef/cinema
def play(target):
    movie = get_movie(target)
    log('Using movie at {}'.format(movie))
    subtitles = get_subtitles(target)
    log('Using subtitles at {}'.format(subtitles))

    if platform.system() == 'Windows':
        system([r'C:\Program Files (x86)\VideoLAN\VLC\vlc.exe', movie, '--sub-file', subtitles])
    else:
        os.system("echo 'on 0' | cec-client -s")
        system_child([r'omxplayer', movie, '--subtitles', subtitles, '-b'])
예제 #8
0
파일: main.py 프로젝트: Sarkutz/initmux
def GetTmuxWorkspace():  #{{{
    # NOTE: This function will die soon!
    ListSessions = system('tmux list-sessions')
    if not ListSessions.startswith(connectFailed):
        ListSessions = ListSessions.split("\n")

        Sessions = []

        for i in range(len(ListSessions)):
            ListSessions[i] = ListSessions[i].split("windows")[0].split(":")[0]
            Sessions.append({'name': ListSessions[i], 'windows': []})

        for i in range(len(Sessions)):
            ListWindows = system('tmux list-windows -t ' + Sessions[i]['name'])
            ListWindows = ListWindows.split("\n")
            for j in range(len(ListWindows)):
                # Search for Number and Name
                find = re.findall(r"[0-9]+: [\w]+", ListWindows[j])
                find = find[0].split(":")
                WNumber = int(find[0])
                WName = find[1].strip()

                # Search for Size
                WSize = re.findall(r"\[[\d]+x[\d]+\]",
                                   ListWindows[j])[0].strip(r"(?:[|])")

                # Search for Layout
                WLayout = re.findall(r"\[layout [\d\w,\[\]\{\}]+\]",
                                     ListWindows[j])[0].strip(r"[layout")
                WLayout = re.sub(r"]$", "", WLayout)

                # Search for Number of Panes
                NPanes = int(
                    re.findall(r"\([\d]+ panes\)",
                               ListWindows[j])[0].strip(r"(?:\(|panes\))"))

                Window = {}
                Window['WName'] = WName
                Window['WNumber'] = WNumber
                Window['WSize'] = WSize
                Window['WLayout'] = WLayout.strip()
                Window['NPanes'] = NPanes

                Sessions[i]['windows'].append(Window)

                #print(ListWindows[j])

        print(dump(Sessions[0]))
        stream = open("samples/Project.yml", 'r')
        pprint(load(stream))
예제 #9
0
파일: main.py 프로젝트: iasj/IniTmux
def GetTmuxWorkspace(): #{{{
    # NOTE: This function will die soon!
    ListSessions = system('tmux list-sessions')
    if not ListSessions.startswith(connectFailed):
        ListSessions = ListSessions.split("\n")

        Sessions = []

        for i in range(len(ListSessions)):
            ListSessions[i] = ListSessions[i].split("windows")[0].split(":")[0]
            Sessions.append({'name':ListSessions[i],'windows':[]})

        for i in range(len(Sessions)):
            ListWindows = system('tmux list-windows -t '+Sessions[i]['name'])
            ListWindows = ListWindows.split("\n")
            for j in range(len(ListWindows)):
                # Search for Number and Name
                find = re.findall(r"[0-9]+: [\w]+",ListWindows[j])
                find = find[0].split(":")
                WNumber = int(find[0])
                WName   = find[1].strip()

                # Search for Size
                WSize = re.findall(r"\[[\d]+x[\d]+\]",ListWindows[j])[0].strip(r"(?:[|])")

                # Search for Layout
                WLayout = re.findall(r"\[layout [\d\w,\[\]\{\}]+\]",ListWindows[j])[0].strip(r"[layout")
                WLayout = re.sub(r"]$","",WLayout)

                # Search for Number of Panes
                NPanes = int(re.findall(r"\([\d]+ panes\)",ListWindows[j])[0].strip(r"(?:\(|panes\))"))

                Window = {}
                Window['WName']   = WName
                Window['WNumber'] = WNumber
                Window['WSize']   = WSize
                Window['WLayout'] = WLayout.strip()
                Window['NPanes']  = NPanes

                Sessions[i]['windows'].append(Window)

                #print(ListWindows[j])

        print(dump(Sessions[0]))
        stream = open("samples/Project.yml",'r')
        pprint(load(stream))
예제 #10
0
파일: anubis.py 프로젝트: todokku/anubis
def checkHerokuCli():
    # Checks if heroku executable is installed
    if not which("heroku"):
        # Log progress
        progress = log.progress("Installing heroku cli")
        # Commands to install heroku
        commands = [
            "wget -q https://cli-assets.heroku.com/install.sh", "sh intall.sh",
            "rm install.sh"
        ]
        # For each command run it on a shell
        for command in commands:
            system(command.split(), stdout=DEVNULL)
        # Log success
        progress.success("Done")
    else:
        # Log success
        log.success("%s found" % which("heroku"))
예제 #11
0
파일: anubis.py 프로젝트: todokku/anubis
def checkChiselBinary():
    # Checks if chisel binary is present
    if not path.exists("chisel"):
        # Commands to install chisel
        commands = [
            "wget -q https://github.com/jpillora/chisel/releases/download/1.3.1/chisel_linux_amd64.gz",
            "gunzip -f -q chisel_linux_amd64.gz",
            "mv chisel_linux_amd64 chisel", "chmod +x chisel"
        ]
        # Log progress
        progress = log.progress("Setting up chisel")
        # For each command run it on a shell
        for command in commands:
            system(command.split())
        # Log success
        progress.success("Done")
    else:
        # Log success
        log.success("%s/chisel found" % getcwd())
예제 #12
0
파일: anubis.py 프로젝트: todokku/anubis
def execute(name, username, password):
    # Log
    log.info("Lauching proxy...")
    # Store variables
    credentials = "%s:%s" % (username, password)
    url = "https://%s.herokuapp.com" % name
    # Attempt to spawn chisel
    try:
        # Log warning
        log.warn("Press CTRL-C to destroy your proxy")
        # Run chisel to connect to the server
        system([
            "./chisel", "client", "--keepalive", "10s", "--auth", credentials,
            url, "socks"
        ],
               stdout=DEVNULL)
    except KeyboardInterrupt:
        # Log
        progress = log.progress("Destroying your app")
        # Stop proxy client
        system("pkill chisel".split())
        # Destroy app
        terminate(name)
        # Log success
        progress.success("Done")
    finally:
        # Log progress
        progress = log.progress("Logging out")
        # Logout
        system("heroku logout".split(), stdout=DEVNULL)
        # Log success
        progress.success("Done")
예제 #13
0
파일: anubis.py 프로젝트: todokku/anubis
def createApp(name, username, password):
    # Progress
    progress = log.progress("Creating a heroku app")
    # Proxy password
    env_password = "******" % (username, password)
    # Create the app
    system(["heroku", "apps:create", name], stdout=DEVNULL)
    system(["heroku", "stack:set", "container"], stdout=DEVNULL)
    system(["heroku", "config:set", env_password], stdout=DEVNULL)
    # Deploy
    system("git push heroku master".split(), stdout=DEVNULL)
    # Log success
    progress.success("Done")
    # Log info
    log.info("App deployed at: https://%s.herokuapp.com" % name)
예제 #14
0
파일: main.py 프로젝트: Sarkutz/initmux
def LoadYAMLs(FilesDirectory):  #{{{
    YAMLs = []
    Files = system('ls ' + FilesDirectory).split("\n")
    for SNumber in range(len(Files)):
        File = FilesDirectory + '/' + Files[SNumber]
        try:
            Stream = open(File, 'r')
            try:
                YAMLs.append(load(Stream))
            except:
                pass
            Stream.close()
        except:
            pass
    return YAMLs
예제 #15
0
파일: main.py 프로젝트: iasj/IniTmux
def LoadYAMLs(FilesDirectory): #{{{
    YAMLs = []
    Files = system('ls '+FilesDirectory).split("\n")
    for SNumber in range(len(Files)):
        File = FilesDirectory+'/'+Files[SNumber]
        try:
            Stream = open(File,'r')
            try:
                YAMLs.append(load(Stream))
            except:
                pass
            Stream.close()
        except:
            pass
    return YAMLs
예제 #16
0
 def run(self):
     
     ''' Perform a run of this application. '''
     
     if (os_name != 'posix'):
         import platform
         pf = platform.system()
         raise SystemError('No UNIX-like environment. ' + 
                           "You are currently using platform '%s', " % (pf)+
                           'and cannot run a binary in a shell.')
     elif (self.exeName and not exeExists(self.exeName)):
         raise SystemError("'%s' is not installed on your system." % (
             self.exeName))
     sproc = system(self.getInstructionString(),stdout=PIPE,
                    stderr=PIPE,shell=True)
     return sproc.communicate()[0]
예제 #17
0
    def run(self):
        ''' Perform a run of this application. '''

        if (os_name != 'posix'):
            import platform
            pf = platform.system()
            raise SystemError('No UNIX-like environment. ' +
                              "You are currently using platform '%s', " %
                              (pf) + 'and cannot run a binary in a shell.')
        elif (self.exeName and not exeExists(self.exeName)):
            raise SystemError("'%s' is not installed on your system." %
                              (self.exeName))
        sproc = system(self.getInstructionString(),
                       stdout=PIPE,
                       stderr=PIPE,
                       shell=True)
        return sproc.communicate()[0]
예제 #18
0
    text = text.replace('"', '"')
    return text


from collections import defaultdict
data = defaultdict(list)

fp = open(sys.argv[1], 'r')
annotations = json.loads(fp.read())
for annotation in annotations:
    name = annotation['name']
    split = annotation['split']
    data[split].append(name)

from subprocess import call as system
system('mkdir -p subshot-annotator', shell=True)
print(
    '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>'
)
sorted_splits = sorted(data.keys(), key=lambda x: -len(data[x]))
for split in sorted_splits:
    fp = open('subshot-annotator/%s.html' % split, 'w')
    print(
        '<a href="subshot-annotator/%s.html"><img src="splits/%s.png"> %s</a><br>\n'
        % (split, split, split))

    fp.write(
        '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
        #+ '<script lang="javascript" src="../jquery-1.10.2.min.js"></script>'
        #+ '<script lang="javascript" src="../filter.js"></script>'
        #+ '<script lang="javascript" src="../subshot-annotator.js"></script>'
예제 #19
0
    for subshot in annotation['subshots']:
        output += '<li>' + subshot['type'] + '<ul>'
        for person in subshot['persons']:
            output += '<li>' + person['role'] + ' ' + person['location'] + ' ' + person['pose'] + '</li>'
        output += '</ul></li>'
    output += '</ol>'
    return output

unlabeled = []
for name in sorted(images.keys()):
    if name not in data:
        unlabeled.append(name)

from subprocess import call as system

system('mkdir -p viewer', shell=True)
print('<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>')
label_id = 0
sorted_labels = sorted(labels.keys(), key=lambda x: -sum([len(y) for y in labels[x]]))
for label in sorted_labels:
    fp = open('viewer/%d.html' % label_id, 'w')
    print('<a href="viewer/%d.html">%s</a><br>\n' % (label_id, protect(label)))
    label_id += 1
    fp.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>\n')
    fp.write('<h1>' + protect(label) + '</h1>\n')
    fp.write(label_to_html(label_as_annotation[label]))
    for show in sorted(labels[label]):
        fp.write('<hr><h3>' + show + '</h3>\n')
        for name in labels[label][show]:
            fp.write('<a href="%s" target="annotator"><img src="%s" width="192" height="108" title="%s"></a>\n' % ('../' + '/'.join(images[name].split('/')[:-3]) + '/index.html?' + name, 'http://talep.lif.univ-mrs.fr/percol/' + images[name] + '.192', name))
    fp.write('</body></html>')
예제 #20
0
        for person in subshot['persons']:
            output += '<li>' + person['role'] + ' ' + person[
                'location'] + ' ' + person['pose'] + '</li>'
        output += '</ul></li>'
    output += '</ol>'
    return output


unlabeled = []
for name in sorted(images.keys()):
    if name not in data:
        unlabeled.append(name)

from subprocess import call as system

system('mkdir -p viewer', shell=True)
print(
    '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>'
)
label_id = 0
sorted_labels = sorted(labels.keys(),
                       key=lambda x: -sum([len(y) for y in labels[x]]))
for label in sorted_labels:
    fp = open('viewer/%d.html' % label_id, 'w')
    print('<a href="viewer/%d.html">%s</a><br>\n' % (label_id, protect(label)))
    label_id += 1
    fp.write(
        '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>\n'
    )
    fp.write('<h1>' + protect(label) + '</h1>\n')
    fp.write(label_to_html(label_as_annotation[label]))
예제 #21
0
파일: cinema.py 프로젝트: eHonnef/cinema
 def run_control(name):
     system(['./dbuscontrol.sh', name])
예제 #22
0
    for subshot in annotation['subshots']:
        output += '<li>' + subshot['type'] + '<ul>'
        for person in subshot['persons']:
            output += '<li>' + person['role'] + ' ' + person['location'] + ' ' + person['pose'] + '</li>'
        output += '</ul></li>'
    output += '</ol>'
    return output

unlabeled = []
for name in sorted(images.keys()):
    if name not in data:
        unlabeled.append(name)

from subprocess import call as system

system('mkdir -p viewer.dev2', shell=True)
print('<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>')
label_id = 0
sorted_labels = sorted(labels.keys(), key=lambda x: -sum([len(y) for y in labels[x]]))
for label in sorted_labels:
    fp = open('viewer.dev2/%d.html' % label_id, 'w')
    print('<a href="viewer.dev2/%d.html">%s</a><br>\n' % (label_id, protect(label)))
    label_id += 1
    fp.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>\n')
    fp.write('<h1>' + protect(label) + '</h1>\n')
    fp.write(label_to_html(label_as_annotation[label]))
    for show in sorted(labels[label]):
        fp.write('<hr><h3>' + show + '</h3>\n')
        for name in labels[label][show]:
            fp.write('<a href="%s" target="annotator"><img src="%s" width="192" height="108" title="%s"></a>\n' % ('../' + '/'.join(images[name].split('/')[:-3]) + '/index.html?' + name, 'http://talep.lif.univ-mrs.fr/percol/' + images[name] + '.192', name))
    fp.write('</body></html>')
예제 #23
0
파일: anubis.py 프로젝트: todokku/anubis
def terminate(name):
    # Destroy an app
    system(["heroku", "apps:destroy", name, "-c", name])
예제 #24
0
        for person in subshot['persons']:
            output += '<li>' + person['role'] + ' ' + person[
                'location'] + ' ' + person['pose'] + '</li>'
        output += '</ul></li>'
    output += '</ol>'
    return output


unlabeled = []
for name in sorted(images.keys()):
    if name not in data:
        unlabeled.append(name)

from subprocess import call as system

system('mkdir -p viewer.dev2', shell=True)
print(
    '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>'
)
label_id = 0
sorted_labels = sorted(labels.keys(),
                       key=lambda x: -sum([len(y) for y in labels[x]]))
for label in sorted_labels:
    fp = open('viewer.dev2/%d.html' % label_id, 'w')
    print('<a href="viewer.dev2/%d.html">%s</a><br>\n' %
          (label_id, protect(label)))
    label_id += 1
    fp.write(
        '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>\n'
    )
    fp.write('<h1>' + protect(label) + '</h1>\n')