예제 #1
0
def R_main(destination, requirements, error_file, sanity_flag=False):
    RDestination = f"{destination}/R"
    if not os.path.exists(RDestination):
        os.makedirs(RDestination)

    if not sanity_flag:
        #download environment packages
        script_path = os.path.join(BASE_DIR, R_SCRIPT_NAME)
        os.system(f"Rscript --vanilla {script_path} >> {os.path.join(BASE_DIR, 'R_log.log')}")

    #download packages from the requirements file
    if requirements:
        print("Downloading packages from te requiments file....")
        os.sytem(f"Rscript --vanilla {R_REQ_DWNLD_SCRIPT} >> {os.path.join(BASE_DIR, 'R_log.log')}")


    #include custom packages in the folder.
    print("Copying custom packages.")
    for item in os.listdir('.'):
        if item[-3:] == 'tar' or item[-6:] == 'tar.gz':
            exitCode = os.system(f'cp {item} {RDestination}/{item}')
            #exitCode == 0 for successfull downloads
            if exitCode:
                os.system(f"echo {item} >> {error_file}")
            else:
                os.system(f"echo {item} >> {logDestination}")
예제 #2
0
def download_seq(output_path, uniref_type):
    comp_seq = uniref_type + ".fasta.gz"
    uncomp_seq = uniref_type + ".fasta"
    release_note = uniref_type + ".release_note"
    uncomp_file = os.path.join(output_path, os.path.basename(uncomp_seq))
    comp_file = os.path.join(output_path, os.path.basename(comp_seq))
    if os.path.isfile(uncomp_file):
        config.logger.info("WARNING! File exist and skipe this step: " +
                           uncomp_file)
        return uncomp_file
    if os.path.isfile(comp_file) and not os.path.isfile(uncomp_file):
        os.sytem("gunzip " + comp_file)
        return uncomp_file

    os.chdir(output_path)
    download_cmd = "connect ftp://ftp.uniprot.org/pub/databases/uniprot/current_release/uniref/uniref90/"
    download_cmd = download_cmd + "\n" + "get " + comp_seq
    download_cmd = download_cmd + "\n" + "get " + release_note
    mydownload = os.path.join(output_path, "download_uniref.lftp")
    open_out = open(mydownload, "w")
    open_out.write(download_cmd + "\n")
    open_out.close()
    os.system("lftp -f " + mydownload)

    # uncompress fasta file
    combine_cmd = "gunzip " + comp_seq
    os.system(combine_cmd)

    return uncomp_file
예제 #3
0
def CameraTimeLapse():
    if DEBUG:
        print('in CameraTimeLapse')
    lcd.clear()
    lcd.message('Time Lapse')
    while 1:
    	timeLap = 0
    	now = datetime.datetime.now()
    	folder = (now.year,now.month,now.day,now.hour)
    	lcd.message(timeLap)
    	if lcd.buttonPressed(lcd.UP):
    		timeLap += 1
    	 	lcd.clear()
    	if lcd.buttonPressed(lcd.DOWN):
    		timeLap -= 1
    		lcd.clear()
    	if lcd.buttonPressed(lcd.RIGHT):
       		lcd.home()
    		lcd.clear()
    		lcd.message('Time\n',timeLap,' Sec.')
	if lcd.buttonPressed(lcd.SELECT):
    		lcd.clear()
        	lcd.message('Starting in\n10 Seconds')
        	os.system('sudo mkdir ', folder)
        	os.sytem('cd ', folder)
        	os.sytem('sudo gphoto2 --capture-image-and-download --interval ', timeLap)
        	break
        if lcd.buttonPressed(lcd.LEFT):
            break
        sleep(0.25)
예제 #4
0
def modificar():
    import os, sys, sqlite3
    grad=[]
    con=sqlite3.connect('partes.s3db')
    cursor=con.cursor()
    cursor.execute("select * from grado")
    print("Estas en la opcion modificar alumnos")
    print("")
    print("\t  Cod   \t Nombre \t CUI")
    print("***************************************************************** ")
    for grado in cursor:
        grad.append(grado)
        grad='\t'+str(grado[0])+'\t'+str(grado[1])+'\t'+str(grado[2])
        print(str(grad))
        print('')
    cod=input("DIGITE EL CODIDO DEL ALUMNO A MODIFICAR: ")
    global nombre
    global cui
    for grado in grad:
        if int(grado[0]==int(cod)):
            nombre=grado[1]
            cui=grado[2]
            encontrado=True
            break
    
    nombre=input("Digite el nombre nuevo"+nombre+": ")
    cui=input("Digite el CUI nuevo"+str(cui)+": ")
    sql="update grado set Nombre='"+name+"', CUI="+cui+"' where Cod ="+cod
    cursor.execute(sql)
    con.commit()
    con.close()
    os.sytem("cls")
    print("El producto a sido modificado")
    print("")
    menu()
예제 #5
0
def main():
    cprint('Welcome to MineSweeper', 'red')
    cprint('======================', 'red')
    cprint('MAIN MENU', 'red')
    cprint('-> For instructions on how to play, type \'I\'')
    cprint('-> To play, type \'P\'')
    cprint('-> To exit, type \'E\'')
    choise = input('').upper()
    if choise == 'I':
        os.system('clear')
        print(open('instructions.txt', 'r').read())
        input('Press any key to come back to the menu')
        os.sytem('clear')
        main()
    elif choise == 'P':
        os.system('clear')
        n_bombs = 9
        row = 6  #16
        col = 6  #16
        # Solution board
        sol_board = solution_grid(row, col, n_bombs)
        # Interface for gameplay
        known_board = known_grid(row, col)
        # Playing function
        play(sol_board, known_board)
    elif choise == 'E':
        quit()
    else:
        cprint('please select a valid options', 'red')
        main()
예제 #6
0
def shutdown():
	if computer.os() == "Windows":
		os.system("shutdown -s")
	elif computer.os() == "Linux":
		os.sytem("shutdown -h")
	else:
		print("Operational System not detected. Cannot able execute")
예제 #7
0
 def initial_sync(self):
     """ 
     When starting the container, copies the files from host to container
     """
     if 'volumes' in self.config:
         for volume, conf in self.config['volumes'].iteritems():
             os.sytem('unison ' + volume + '.magic ' + volume + ' -auto -batch ' + self.generate_ignore_string(conf['ignore'], 'unison'))
             self.set_permissions(conf['user'], volume, True)
예제 #8
0
def xmlConverter():
    os.chdir("/home/fenics/shared/murtazo/cloudnaca/msh/")
    for fileName in os.listdir("/home/fenics/shared/murtazo/cloudnaca/msh/"):
        if fileName.endswith('.msh'):
            os.system("dolfin-convert " + fileName + " " + fileName[:-4] +
                      ".xml")
            os.system("rm " + fileName)
    os.sytem("rm " + "../geo" + " *")
예제 #9
0
def main():
   user = input('\n$(stef@py3)>> ')   
   if user == '' or user == ' ' or user == '  ':
      print('you entered nothing only "spaces" ')
      main()
   elif user == '5':
      email_brute_force()
      main()
   elif user == '3' or user == 'ping':
      host = input('Host to ping: ')
      os.system('ping -c 5 {}'.format(host))
      print('ping 5 times')
      time.sleep(1.5)
      choice = str(input('\n\nWould you like to scan that hostname? (y/n):  '))
      if choice == 'y' or choice == 'Y':
         IP = socket.gethostbyname(host)
         local_nmap.Nmap(IP)
         time.sleep(1)
         cprint('\n\n[+]Finish !', 'red')
         main()
      elif choice == 'N' or choice == 'n':
         cprint('Well scan abortion...\nReturn to home', 'green')
         main()
      else:
         cprint('[!] Choice not recognised \nAbortion...', 'red')
      main()
   elif user == 'pip' or user == '1':
      cprint('Upgrading pip...', 'blue')
      os.system('pip install --upgrade pip')
      main()      
   elif user == 'scann' or user == 'nmap' or user == 'vuln' or user == 'nm' or user == '2': #Wake word to scan
      port_scanner()
      main()
   elif user == '4' or user == 'exit' or user == 'ex':
      sys.exit(1)
   elif user == 'ls':
      os.system('ls')
      main()
   elif user == 'ls -a':
      os.system('ls -a')
      main()
   elif user == 'ls -lh':
      os.system('ls -lh')
      main()
   elif user == 'ls -ls':
      os.system('ls -ls')
      main()
   elif user == 'dir':
      os.system('dir')
      main()
   elif user == 'python3 main.py ' or user == 'python main.py':
      try:
         os.system('python3 main.py')
      except:
         os.sytem('python main.py')   
   else:
      print('Sorry, "{}" is not recognised'.format(user))
      main()
예제 #10
0
파일: hash.py 프로젝트: afelfgie/HashToolv2
def clear():
    if 'linux' or 'unix' in sys.platform:
        cls()
    elif 'win' in sys.platform:
        os.system("cls")
    elif 'darwin' in sys.platform:
        os.sytem("cls")
    else:
        cls()
예제 #11
0
def lvm():
    while True:
        os.system("clear")
        os.system("tput setaf 4")
        os.system("figlet -f slant -c LVM World")
        os.system("tput setaf 7")
        print("""
[1]To check number of storage attached to the OS
[2] To create Physical Volume
[3] To view Physical Volume
[4] To create Volume Group
[5] To view Volume Group
[6] To create Logical Volume
[7] To view Logical Volume
[8] To format the LV
[9] go back to main menu
[10] Exit the program""")

        i = input("Enter your Choice :")
        if int(i) == 1:
            os.system("fdisk -l")
        elif int(i) == 2:
            pv1 = input("Enter the name of storage 1:")
            pv2 = input("Enter the name of storage 2:")
            os.system("pvcreate {}".format(pv1))
            os.system("pvcreate {}".format(pv2))
        elif int(i) == 3:
            pv = input("Enter the name of storage:")
            os.system("pvdisplay {}".format(pv))
        elif int(i) == 4:
            vg = input("Give name to the Volume Group:")
            pvn1 = input("Enter the name of storage 1:")
            pvn2 = input("Enter the name of Storage 2:")
            os.system("vgcreate {} {} {}".format(vg, pvn1, pvn2))
        elif int(i) == 5:
            vg1 = input("Enter the name of Volume Group:")
            os.sytem("vgdisplay {}".format(vg1))
        elif int(i) == 6:
            size = input("Enter size for your Logical Volume:")
            lv = input("Give name to your Logical Volume:")
            vg2 = input("Enter name of the Volume Group:")
            os.system("lvcreate --size{} --name{} {}".format(size, lv, vg2))
        elif int(i) == 7:
            os.system("lvdisplay")
        elif int(i) == 8:
            vg4 = input("Enter the name of Volume Group:")
            lv2 = input("Enter the name of Logical Volume:")
            os.system("mkfs.ext4  /dev{}{}".format(vg4, lv2))
        elif int(i) == 9:
            return i
        elif int(i) == 10:
            exit()
        else:
            print("This option doesn't support")
        input("\nPress Enter to try again...")
        os.system("clear")
예제 #12
0
 def initial_sync(self):
     """ 
     When starting the container, copies the files from host to container
     """
     if 'volumes' in self.config:
         for volume, conf in self.config['volumes'].iteritems():
             os.sytem('unison ' + volume + '.magic ' + volume +
                      ' -auto -batch ' +
                      self.generate_ignore_string(conf['ignore'], 'unison'))
             self.set_permissions(conf['user'], volume, True)
예제 #13
0
 def optimize(self):
     ferr = open("jobex_blurp.dump","w")
     f = open("jobex.out","w")
     print "jobex is running"
     retcode = subprocess.call(["jobex", "-ri"], stdout=f, stderr=ferr)
     if retcode != 0: raise IOError, "Error: jobex failed!!!"
     f.close()
     ferr.close()
     print "jobex has finished"
     os.sytem('t2xyz|tail -%s > final.xyz' % self.natoms +2)
     return
예제 #14
0
def movefile(time, tile):
    newFolder = "/home/xu/SDN_APP/" + time + "s"
    os.system("mkdir newFolder")
    graph1 = "/home/xu/SDN_APP/" + titleName + ".png"
    graph2 = "/home/xu/SDN_APP/" + titleName + "_cumulation.png"
    file1 = "/home/xu/SDN_APP/" + "cumulation.txt"
    com1 = "mv " + graph1 + " " + newFloder
    com2 = "mv " + graph2 + " " + newFloder
    com3 = "mv " + file1 + " " + newFloder
    os.system(com1)
    os.sytem(com2)
    os.system(com3)
예제 #15
0
    def install_pycharm(self):
        print("Installing PyCharm......")
        os.system("""echo [phracek-PyCharm]
name=Copr repo for PyCharm owned by phracek
baseurl=https://copr-be.cloud.fedoraproject.org/results/phracek/PyCharm/fedora-$releasever-$basearch/
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://copr-be.cloud.fedoraproject.org/results/phracek/PyCharm/pubkey.gpg
enabled=1
enabled_metadata=1 > /etc/yum.repos.d/pycharm.repo""")
        os.system("dnf copr enable phracek/PyCharm")
        os.sytem("dnf -y install pycharm-community")
        print("PyCharm installation completed")
예제 #16
0
    def menu_four(self):

        try:

            key = os.system("apt-key adv --keyserver pool.sks-keyservers.net --recv-keys ED444FF07D8D0BF6")
            repositor = os.system("echo '# By chameleonPY\ndeb http://http.kali.org/kali kali-rolling main contrib non-free' >> /etc/apt/sources.list")
            os.sytem("apt update")

        except Exception as error:

            self.menu_four()

        self.Start()
예제 #17
0
def runMultiElement(dica,comp,elements=['Ni0','Fe0','Si','S','Ti','C','Mg'],ratios=[0.5,2],output='multi_element.pdf'):
    pdf = PdfPages(output)
    fig=pylab.figure(1)
    for element in elements:
        print '----------------------------------------------------------------'
        print "Doing Element %s"%element
        os.sytem('growlnotify -m Doing Element %s'%element)
        fig.clf()
        ax=fig.add_subplot(111)
        runElementRatio(dica,comp,element,ratios,ax=ax)
        fig.savefig(pdf,format='pdf')
    pdf.close()
    os.sytem('growlnotify --sticky -m Done with multielement')
예제 #18
0
파일: install_java.py 프로젝트: hinfo/Java
def install_debian():
		'''
		Instala java em deriados do Debian
		'''
		print "Adicionando o ppa:webupd8team/java"
		os.system('sudo add-apt-repository ppa:webupd8team/java')
		print "Atualizando os pacotes"
		os.system('sudo apt-get update')
		print "Instalando o Java"
		os.sytem('sudo apt-get install oracle-java8-installer')
		os.system('sudo update-java-alternatives -s java-8-oracle')
		os.system('sudo apt-get install oracle-java8-set-default')
		os.system('java -version')
예제 #19
0
파일: main.py 프로젝트: soulwa/ultimate-ttt
def main():
    playing = True
    player = 1
    os.system('cls||clear')
    win_positions = generate_win_positions(BOARD_LEN)
    sub_board_pos = -1
    pos = 0

    while playing:
        display(board)
        print("player: " + str(1 if player == 1 else 2))

        try:
            sub_board_pos, pos = tuple(input("input board, position: ").split(" "))
        except ValueError:
            os.system('cls||clear')
            print("not formatted properly!")
            continue

        try:
            sub_board_pos = int(sub_board_pos)
            pos = int(pos)
        except ValueError:
            os.system('cls||clear')
            print("not a valid position!")
            continue

        if (sub_board_pos > len(board) or pos > len(board)):
            os.system('cls||clear')
            print("not a valid position!")
            continue

        if place_on_board(board[sub_board_pos], pos, player):
            if check_board_won(board[sub_board_pos], win_positions) != 0 and meta_board[sub_board_pos] == 0:
                meta_board[sub_board_pos] = player

                if check_board_won(meta_board, win_positions) != 0:
                    os.sytem('cls||clear')
                    print("player {} won board {} and the game!", player, sub_board_pos)
                    playing = False
                    continue
                else:
                    os.system('cls||clear')
                    print("player {} won board {}!", player, sub_board_pos)

            player = -player
        else:
            os.system('cls||clear')
            print("invalid position!")
예제 #20
0
파일: main.py 프로젝트: sundaysec/BabyMux
def subBrute_force():
    print("====downloading subBrute-force")
    os.system("apt upgrade && apt upgrade")
    os.system("git clone " + subBrute_force)
    permission = raw_input("do you want to test subbrute-force [Y/N]")
    if (permission == "Y" or permission == "y"):
        print "===downloading python-dnspython"
        time.sleep(2)
        os.sytem("sudo apt-get install python-dnspython")
        website = raw_input("what website would you like to test\n")
        os.system("./subbrute.py website")
    else:
        print "===download done"
        time.sleep(3)
        sys.exit()
예제 #21
0
def downloads():
    os.system("py -m pip install --upgrade pip")

    os.system("pip install SpeechRecognition")

    os.sytem("pip install gTTS")

    os.system("pip install pipwin")
    os.system("pipwin install pyaudio")

    os.system("pip install pyttsx3")
    os.system("pip install pywin32")

    os.system("pip install pyjokes")
    return None
예제 #22
0
def init():
    if (sys.platform == 'win32'):
        os.system("cls")
        os.system("title FretsWeb 1.2 Blind SQL Injection Exploit")
        os.system("color 02")
    else:
        os.sytem("clear")
    print "\t#######################################################\n\n"
    print "\t#######################################################\n\n"
    print "\t##     FretsWeb 1.2 Blind SQL Injection Exploit      ##\n\n"
    print "\t##       ++Conditions: magic_quotes=OFF              ##\n\n"
    print "\t##       ++Needed: Valid name                        ##\n\n"
    print "\t##               Author: Y3nh4ck3r                   ##\n\n"
    print "\t##      Contact:y3nh4ck3r[at]gmail[dot]com           ##\n\n"
    print "\t##            Proud to be Spanish!                   ##\n\n"
    print "\t#######################################################\n\n"
    print "\t#######################################################\n\n"
예제 #23
0
def init():
    if sys.platform == "win32":
        os.system("cls")
        os.system("title FretsWeb 1.2 Blind SQL Injection Exploit")
        os.system("color 02")
    else:
        os.sytem("clear")
    print "\t#######################################################\n\n"
    print "\t#######################################################\n\n"
    print "\t##     FretsWeb 1.2 Blind SQL Injection Exploit      ##\n\n"
    print "\t##       ++Conditions: magic_quotes=OFF              ##\n\n"
    print "\t##       ++Needed: Valid name                        ##\n\n"
    print "\t##               Author: Y3nh4ck3r                   ##\n\n"
    print "\t##      Contact:y3nh4ck3r[at]gmail[dot]com           ##\n\n"
    print "\t##            Proud to be Spanish!                   ##\n\n"
    print "\t#######################################################\n\n"
    print "\t#######################################################\n\n"
예제 #24
0
def GCU_Banner():

    if (os.name == "nt"):

        #Windows based system
        os.sytem("cls")
        print(
            f'''{colour_yellow}{figlet_format("Marina Tombola")}{colour_end}'''
        )

    else:

        #Linux based system
        os.system("clear")
        print(
            f'''{colour_yellow}{figlet_format("Marina Tombola")}{colour_end}'''
        )
예제 #25
0
def jenkins_user_creation():
    
    #method 1
    command = '$echo "jenkins.model.Jenkins.instance.securityRealm.createAccount('Vivo20', 'vivo12345')" | java -jar /home/mukesh/Downloads/jenkins-cli.jar -s http://localhost:8080 -auth mukeshrock7897:****** -noKeyAuth groovy ='
    os.sytem(command)
    
    # method 2
    # first create .sh file in same folder where your python script are avaiable 
    #example test.sh and write below command
    
    #!/bin/sh
    
    # "jenkins.model.Jenkins.instance.securityRealm.createAccount('NewUsername', 'NewUSerPassword')" | java -jar /home/mukesh/Downloads/jenkins-cli.jar -s http://localhost:8080 -auth ADMIN:ADMINPASSWORD -noKeyAuth groovy =
    echo "jenkins.model.Jenkins.instance.securityRealm.createAccount('Vivo20', 'vivo12345')" | java -jar /home/mukesh/Downloads/jenkins-cli.jar -s http://localhost:8080 -auth mukeshrock7897:mukMUK@123 -noKeyAuth groovy =
    
    #Now call the test.sh file in python script like below given
    os.system("sh test.sh")
예제 #26
0
def handle_request(request):
    raw = request.uri
    if "?" in raw:
        if "dev=TV" in raw:
            if "cmd=On" in raw:
                os.system('echo "on 0" | cec-client -d 1 -s')
            elif "cmd=Off" in raw:
                os.system('echo "standby 0" | cec-client -d 1 -s')
        elif "dev=PS3" in raw:
            if "cmd=On" in raw:
                os.system('echo "on 4" | cec-client -d 1 -s')
            elif "cmd=Off" in raw:
                os.sytem('echo "standby 4" | cec-client -d 1 -d')
   
    message = "You requested %s\n" % request.uri
    request.write("HTTP/1.1 200 OK\r\nContent-Length: %d\r\n\r\n%s" % (
                 len(message), message))
    request.finish()
예제 #27
0
def main():
    #clear the screen
    os.sytem(clear)
    #run the function to print the user interface
    mainUI()
    #try this code block
    try:
        #get user input
        userIn = int(input('Input the number of your option\n>>>'))
        #run the function to check what the user input
        aiGo(userIn)

    #if code in try: caused a ValueError then do this
    except ValueError:
        #print error
        print('Please input one of the options')
        #sleep for 1.5 seconds
        time.sleep(1.5)
예제 #28
0
def handle_request(request):
    raw = request.uri
    if "?" in raw:
        if "dev=TV" in raw:
            if "cmd=On" in raw:
                os.system('echo "on 0" | cec-client -d 1 -s')
            elif "cmd=Off" in raw:
                os.system('echo "standby 0" | cec-client -d 1 -s')
        elif "dev=PS3" in raw:
            if "cmd=On" in raw:
                os.system('echo "on 4" | cec-client -d 1 -s')
            elif "cmd=Off" in raw:
                os.sytem('echo "standby 4" | cec-client -d 1 -d')

    message = "You requested %s\n" % request.uri
    request.write("HTTP/1.1 200 OK\r\nContent-Length: %d\r\n\r\n%s" %
                  (len(message), message))
    request.finish()
예제 #29
0
def main():

#   port = 55146
#   host = "localhost"
#   xs = x88.tcpconnect(host,port)
   status =	os.sytem("/usr/udanax/green/be_source/backend")
   print "Content-type: text/html"
   print
   print "<TITLE> udanax initc!</TITLE>"
   print "this should have inited the backend! status = %s" % status
예제 #30
0
def commands(command):
    #displays all help menu commands
    if "help" in command or "-h" in command or "?" in command:
        for item in help_menu:
            print(item)

    #pings the client to see latency and to get info
    if "-ping" in command and "-send" not in command:
        os.system("ping {}".format(clientaddr[0]))
    elif "ping" in command and "-send" not in command:
        os.system("ping {}".format(clientaddr[0]))
    elif "ping" in command and "send" not in command:
        os.system("ping {}".format(clientaddr[0]))
    elif "-ping" in command and "send" not in command:
        os.system("ping {}".format(clientaddr[0]))

    #sends commands and os calls to client
    if "-send" in command:
        command = getridofwords(command, stop_words)
        os.sytem("cls")
        #data sent has to be encoded and then decoded when received
        clientsock.send(command.encode("utf-8"))
        print(client_info(clientsock))
    elif "send" in command:
        command = getridofwords(command, stop_words)
        os.system("cls")
        #data sent has to be encoded and then decoded when received
        clientsock.send(command.encode("utf-8"))
        print(client_info(vlientsock))
    elif "-s" in command:
        command = getridofwords(command, stop_words)
        os.system("cls")
        #data sent has to be encoded and then decoded when received
        clientsock.send(command.encode("utf-8"))
        print(client_info(clientsock))

    if "exit" in command or "-exit" in command:
        clientsock.close()
        sys.exit()
예제 #31
0
    def home(self):
        while True:
            if pullup:
                os.system(
                    'sudo sh -c \'echo "1" > /sys/class/backlight/soc\:backlight/brightness\''
                )
            elif pulldown:
                os.sytem(
                    'sudo sh -c \'echo "0" > /sys/class/backlight/soc\:backlight/brightness\''
                )

            #handle events and clock
            self.blit_time()
            self.handle_events()
            pygame.display.update()
            self.clock.tick()
            #Update battery and reception
            self.reception_bars, self.bat_left, self.update, self.dead_bat = self.toolbar.clock(
                self.reception_bars, self.bat_left, self.update,
                self.apps.pixel)
            #Move images if necessary
            self.update, self.images, self.rectangles, self.reception_bars, self.bat_left = self.apps.open(
                self.update, self.images, self.rectangles, self.reception_bars,
                self.bat_left)
            #Open app if tapped
            self.apps.open_app()

            #Check for calls and sms
            self.update = self.reciever.check(self.update)
            #Close app if opened and call coming in
            if self.reciever.call_coming:
                self.apps.app_to_open = None
                self.apps.blit_logo = True

            #Update if necessary
            if self.update:
                self.blit(self.images, self.rectangles, self.reception_bars,
                          self.bat_left)
                self.update = False
예제 #32
0
def execute(seed, bams, reads, output, max_workers, counts):
    """
    Down sampling bam files for given rates and then convert sorted bam files to paired fastq files
    :param seed: random sampling seed
    :param bams: input bam files
    :param reads: comma separated dilution reads
    :param output: directory to store fastq files
    :param max_workers: number of concurrent processes
    :param counts: total number of paired reads in input bam files
    :return: None
    """
    print("Convert sorted bam to fastq...")
    pool = Pool(processes=max_workers)
    results = [
        pool.apply_async(
            subset,
            [int(seed),
             str(bam),
             int(read),
             str(output), count, max_workers])
        for bam, read, count in zip(bams, reads, counts)
    ]
    sub_bams = []
    for async_result in results:
        try:
            bam = async_result.get()
            while bam is None:
                time.sleep(1)
            sub_bams.append(bam)
        except ValueError as e:
            print(e)

    sorted_bams = glob.glob(
        os.path.join(output, "%s*.bam" % bams[0].split(".")[0]))
    sorted_bams_1 = glob.glob(
        os.path.join(output, "%s*.bam" % bams[1].split(".")[0]))

    for bam1, bam2 in zip(sorted_bams, sorted_bams_1):
        fastq_name = "{0}_{1}".format(
            os.path.basename(bam1).split(".")[0],
            os.path.basename(bam2).split(".")[1])
        cat_cmd = "cat {0} {1} > {2}".format(
            bam1.replace(".bam", "-%s.fastq" % seed),
            bam2.replace(".bam", "-%s.fastq" % seed),
            os.path.join(output, "%s-%s.fastq" % (fastq_name, seed)))
        print(cat_cmd)
        if os.sytem(cat_cmd) != 0:
            print("Failed to create fasstq {0}.fastq".format(fastq_name))
            sys.exit(1)
    print("Done!")
예제 #33
0
def django_start():
    print("starting django')
    os.system('chown -R chrisng /opt/django')
    os.chdir('/optdjango/project1')
    os.system('source /opt/django/django-env/bin/activate ' + \
              '&& python manage.py migrate')
    
    os.sytem('source /opt/django/django-env/bin/activate && echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser(\'admin\',\"[email protected]\',\'NTI300NTI300\')" | python manage.py shell')
    
    outputwithnewline = subprocess.check_output('curl -s checkip.dyndns.org | sed -e \'s/.*Current IP Adress: //\' -e \'s/<.*$//\' ', shell=True)
    print outputwithnewline
    output = outputwithnewline.replace("\n", "")
    old_string = "ALLOWED_HOSTS = []"
    new_string = 'ALLOWED_HOSTS = [\'{}\']'.format(output)
    print (new_string)
    print (old_string)
          
    with open('project1/settings.py') as f:
      newText=f.read().replace(old_string, new_string)
    with open('project1/settings.py', "w") as f:
      f.write(newText)
          
    os.system('sudo -u chrisng sh -c "source /opt/django/django-env/bin/activate && python manage.py runserver 0.0.0.0:8000&"')      
예제 #34
0
def volume(d):
    while True:
        os.system("tput setaf 3")
        print(
            "-------------------------------------------------------------------------------"
        )
        os.system("tput setaf 7")

        print("""
        Press 1 : to create volume
        Press 2 : to show all volumes
        Press 3 : to inspect volume
        Press 4 : to remove volume
        Press 5 : to prune all unused volumes
        Press 6 : to go back
        """)

        vol_choice = int(input("Enter your choice : "))

        if vol_choice == 1:
            name = input("Enter name of volume : ")
            os.sytem("docker volume create {name}")
        elif vol_choice == 2:
            os.system("docker volume ls")
        elif vol_choice == 3:
            name = input("Enter name : ")
            os.system(f"docker inspect {name}")
        elif vol_choice == 4:
            name = input("Enter name : ")
            os.system(f"docker rm {name}")
        elif vol_choice == 5:
            os.system("docker volume prune")
        elif vol_choice == 6:
            break
        else:
            print("Please enter correct choice")
예제 #35
0
def kit_one():

    try:

        os.system('cls') if os.name == 'nt' else os.sytem('clear')
        banner()

        print(green("""
            ╔──────────────────────────────────────────────────────────╗
            |                     H4CK-IN-ONE                          |
            |──────────────────────────────────────────────────────────|
            |   [1] EMAIL SPOOFING     |     [2] CARDING TOOLKIT       |
            |                          |                               |
            |   [3] SPAMMER            |     [4] DOXING TOOLS          |
            |                          |                               |
            ┖──────────────────────────────────────────────────────────┙\n"""))

        case = input(yellow("$ "))

        if case == '1':
            os.system('bash tools/FAQUE/faque.sh')

        elif case == '2':
            os.system('python tools/azathot/azathot1.py')

        elif case == '3':
            os.system('python tools/autospamer.py')

        elif case == '4':
            os.system('bash tools/gvngs.sh')
        
        else:
            print(bad("An Error Occurred..."))
    
    except:
        os.system('cls') if os.name == 'nt' else os.system('clear')
        print(good("Finish."))
        exit()
예제 #36
0
#!/usr/bin/python2
#coding=utf-8

try:
    import random
    import sys
    import os
    import time
    import mechanize
    from mechanize import Browser
    os.system('clear')

except ImportError:
    os.system('pip2 install mechanize')
    os.sytem('clear')
    os.system('python2 Aol_V2.py')

logo = '''

\033[1;94m┏━┓┏━┳━━━┳┓╋┏┳━━━┓
┃┃┗┛┃┃┏━┓┃┃╋┃┃┏━┓┃
┃┏┓┏┓┃┃╋┃┃┗━┛┃┃╋┃┃
┃┃┃┃┃┃┃╋┃┃┏━┓┃┗━┛┃
┃┃┃┃┃┃┗━┛┃┃╋┃┃┏━┓┃
┗┛┗┛┗┻━━━┻┛╋┗┻┛╋┗┛\033[1;37m'''

os.system('rm -rf live.txt')
os.system('rm -rf die.txt')
os.system('rm -rf error.txt')

die = 0
예제 #37
0
파일: abort.py 프로젝트: rmodloff01/Rover
            print('Left Back: Obstacle Detected')
            time.sleep(0.1)

        if RB == 0:

            print('Right Back: Obstacle Detected')
            time.sleep(0.1)

        if (distanceInCm2 < 15) and (distanceInCm3 < distanceInCm1):
            os.system('python turnleft2.py')

        if (distanceInCm2 < 15) and (distanceInCm1 < distanceInCm3):
            os.system('python turnright2.py')

        if LF == 0 and LB == 0:
            os.system('python turnright1.py')
            continue

        if RF == 0 and RB == 0:
            os.system('python turnleft1.py')
            continue

        if RF == 0 and LF == 0 and (distanceInCm2 < 15):
            os.sytem('python backward1.py')

        time.sleep(0.1)

except KeyboardInterrupt:
    print "Hit Control-C"
    GPIO.cleanup()
예제 #38
0
██╗███╗   ██╗███████╗████████╗ █████╗ ██╗     ██╗     ███████╗██████╗ 
██║████╗  ██║██╔════╝╚══██╔══╝██╔══██╗██║     ██║     ██╔════╝██╔══██╗
██║██╔██╗ ██║███████╗   ██║   ███████║██║     ██║     █████╗  ██████╔╝
██║██║╚██╗██║╚════██║   ██║   ██╔══██║██║     ██║     ██╔══╝  ██╔══██╗
██║██║ ╚████║███████║   ██║   ██║  ██║███████╗███████╗███████╗██║  ██║
╚═╝╚═╝  ╚═══╝╚══════╝   ╚═╝   ╚═╝  ╚═╝╚══════╝╚══════╝╚══════╝╚═╝  ╚═╝
                                                                      
""")
os.system("sudo apt-get install python3-pip")
os.system("sudo apt-get install zenity")
os.system("python3 -m pip install zenipy")
os.system("python3 -m pip install click")
metasploit=input("IS METASPLOIT-FRAMEWORK ALREADY INSTALLED IN YOUR SYSTEM ? [Y/n] : ")
if metasploit=="n" or metasploit=="N":
            print("Installing Metasploit.........")
            os.sytem("sudo apt-get install metasploit -y  > /dev/null")
else:
     print("NICE ......!")

apksign=input("IS APKSIGNER ALREADY INSTALLED IN YOUR SYSTEM? [Y/n]? : ")
if apksign=="n" or apksign=="N":
           print("INSTALLING APKSIGNER....")
           os.system("sudo apt-get install apksigner -y > /dev/null")
else: 
     print("NICE .....")
     

openssh=input("IS openssh INSTALLED IN YOUR SYSTEM? [Y/n] : ")
if openssh=="n" or openssh=="N":
           print("Installing ssh")
           os.system("sudo apt-get install openssh -y > /dev/null")
예제 #39
0
    def Despike(self, epipath, epiname):
	command="""3dDespike -nomask -ignore 5 -prefix %s/3.Register_Despike/3.despike.shift.%s""" %(epipath, epiname)
	os.sytem(command)	
예제 #40
0
os.system('sudo apt-get update')

os.system('apt-cache search opengeo')

os.system('sudo apt-get install opengeo')

os.system("sudo sh -c "echo 'ProxyPassReverse /geoexplorer http://localhost:8080/geoexplorer' >> /etc/apache2/sites-available/000-default.conf"")

os.system("sudo sh -c "echo 'ProxyPass /geoeditor http://localhost:8080/geoeditor' >>/etc/apache2/sites-available/000-default.conf"")

os.system("sudo sh -c "echo 'ProxyPassReverse /geoeditor http://localhost:8080/geoeditor' >>/etc/apache2/sites-available/000-default.conf"")

os.system("sudo sh -c "echo 'ProxyPass /geowebcache http://localhost:8080/geowebcache' >> /etc/apache2/sites-available/000-default.conf"")

os.sytem("sudo sh -c "echo 'ProxyPassReverse /geowebcache http://localhost:8080/geowebcache' >> /etc/apache2/sites-available/000-default.conf"")

os.system("sudo sh -c "echo 'ProxyPass /dashboard http://localhost:8080/dashboard' >> /etc/apache2/sites-available/000-default.conf""

os.system("sudo sh -c "echo 'ProxyPassReverse /dashboard http://localhost:8080/dashboard' >> /etc/apache2/sites-available/000-default.conf"")

os.system("sudo sh -c "echo 'ProxyPass /recipes http://localhost:8080/recipes' >>/etc/apache2/sites-available/000-default.conf"")

os.system("sudo sh -c "echo 'ProxyPassReverse /recipes http://localhost:8080/recipes' >>/etc/apache2/sites-available/000-default.conf"")
os.system("sudo sh -c "echo 'ProxyPass /opengeo-docs http://localhost:8080/opengeo-docs' >> /etc/apache2/sites-available/000-default.conf"")

os.system("sudo sh -c "echo 'ProxyPassReverse /opengeo-docs http://localhost:8080/opengeo-docs' >> /etc/apache2/sites-available/000-default.conf"")

os.system("sudo sh -c "echo ' ' >> /etc/apache2/sites-available/000-default.conf"")

os.system("sudo sh -c "echo '</VirtualHost>' >> /etc/apache2/sites-available/000-default.conf"")
예제 #41
0
import requests
import os
import glob
import time
import urllib
from vk_api import wall_photo_upload


os.system('clear')
files = glob.glob(os.getcwd() + '/to_upload/*')
msg = urllib.parse.quote_plus(input('message: '))
os.sytem('clear')
print('pictures count: ', len(files))
print('****************************************\n')
for i in range(len(files)):
	wall_photo_upload(files[i], msg)
	print('upload {} executed'.format(i))
	time.sleep(30)
 def finalize(self):
     os.sytem("rm -rf %s"%self.app_name)
예제 #43
0
파일: pyddos.py 프로젝트: t7hm1/pyddos
		os.system('sudo apt-get install python-pip')
	else:
		pass
else:
	print '[-] Check your pip installer'

try:
	import requests,colorama
	from termcolor import colored,cprint
except:
	try:
		if os.name == 'posix':
			os.system('sudo pip install colorama termcolor requests')
			sys.exit('[+] I have installed nessecary modules for you')
		elif os.name == 'nt':
			os.sytem('c:\python27\scripts\pip.exe install colorama requests termcolor')
			sys.exit('[+] I have installed nessecary modules for you')
		else:
			sys.exit('[-] Download and install nessecary modules')
	except Exception,e:
		print '[-]',e
if os.name == 'nt':
	colorama.init()

signal.signal(signal.SIGPIPE,signal.SIG_DFL)

def fake_ip():
	skip = '127'
	rand = range(4)
	for x in range(4):
		rand[x] = randrange(0,256)
예제 #44
0
파일: videoCapture.py 프로젝트: szqh97/test
            if ret != 0:
                print "merge video error!"

        f_begin_ts = int(video4split.split('.')[1])
        f_end_ts = int(video4split.split('.')[2])
        ss = begin_ts - f_begin_ts
        t = end_ts - begin_ts
        downurl = ""

        # request snap shot
        if media_type == 'snapshot':
            snapshots = "s-%%05d.jpg"
            snapshots = os.path.normpath(os.path.join(self.down_dir, snapshots))
            cmd = "ffmpeg -y -i %s -q:v 1 -ss %s -t %s -r %s -s %sx%s %s" \
                    % (video4split, ss, t, self.snapshot_rate, self.weight, self.height, snapshots)
            ret = os.sytem(cmd)
            if ret != 0:
                print "ffmegp error"
            snapshot_tgz = channel_id + "." + begin_ts + "." + end_ts + ".tgz"
            snapshot_tgz = os.path.normpath(os.path.join(self.down_dir, snapshot_tgz))
            cmd = "cd %s; tar cvzf %s s-*.jpg" % (self.down_dir, snapshot_tgz)
            ret = os.system(cmd)
            if ret != 0:
                print "tar cvzf error"
            cmd = "cd %s; rm s-*.jpg"
            ret = os.system(cmd)
            if ret != 0:
                pass
            downurl = self.donw_prex + '/' + snapshot_tgz.split(os.sep)[-1]

        # request video
예제 #45
0
l=[count_dict[i] for i in count_dict.keys()]
l=np.percentile(l, lowLimit)

valid_geno=[]
for i in count_dict.keys():
	if count_dict[i]>=l:
		valid_geno.append(i)
for i in valid_geno:
	print(i, count_dict[i], sep='\t', file=open('stats_aligned_genotypes.txt', 'a'))

print(valid_geno)
if BWAindex:
        print('Starting genome indexing')
        os.system('bwa index -a bwtsw %s' % ref)
        os.sytem('samtools faidx %s' % ref)

for i in valid_geno:
#####opt for bwa mem
        sam_out=i.split('.')[0]+'_aln.sam'
        cmd='bwa mem -t 4 %s %s > %s' % (ref, i, sam_out)
        print(cmd)
        os.system(cmd)

print('remove multimapping reads')
aln=getoutput('ls *sam').split('\n')
for i in aln:
        name=i.split('.')[0] + '_sort'
        cmd='samtools view -bShq 10 %s | samtools sort - %s' % (i, name)
        print(cmd)
        os.system(cmd)
예제 #46
0
            ref_vol_path = nifti_dir + 'ref_vol.nii'
            os.system('mv ref_vol.nii ' + ref_vol_path)
        
        #Run mcflirt motion correction on the 4d nifti file with 
        #reference to the first volume in the first epi (this assumes 
        #that the gems were acquired right before the first run). 
        #The params (cost=mutualinfo and smooth=16) are taken from the 
        #Berkeley shell-script AlignFSL070408.sh:
        print('Motion correction for ' + this_dir)
        
        os.system('mcflirt -reffile ' + ref_vol_path +
              ' -plots -report -cost mutualinfo -smooth 16 -in ' + 
              this_dir + '.nii.gz')
 
    #After doing all that copy stuff into the right places:
    for this_dir in dir_list:
        os.chdir(sess_dir)
        print os.path.realpath(os.path.curdir)
        os.system('mv ' + this_dir + ' ' + dicom_dir)
    
        os.chdir(dicom_dir + this_dir)
        print os.path.realpath(os.path.curdir)
        os.system('mv *.nii.gz ' + nifti_dir)
        if this_dir.startswith('epi')
            os.sytem('mv *.par ' + nifti_dir)

    #Remove the file that was used as reference for MC:
    # os.system('rm ' + ref_vol_path)


예제 #47
0
#-*- coding: utf-8 -*-
__autor__ = "Diego Morell"

import os

print "revisa que estés en la carpeta correcta"

nombre_archivo = raw_input("Dime el nombre del archivo que quieres compilar: ")

archivo_final = raw_input("Dime como quieres que se llame el archivo final: ")

os.sytem("gcc ", nombre_archivo," -o ", archivo_final)#Compila el programa con los parametros previamente dados