def main(): # Setup args = parser.parse_args() args.source = [abspath(expanduser(x)) for x in args.source] args.library = [abspath(expanduser(x)) for x in args.library] if args.exclude is None: args.exclude = [] args.exclude = [abspath(expanduser(x)) for x in args.exclude] if not args.record: args.record = join(args.library[0], "update_record") logging.info(f"Update Record: {args.record}") assert (exists(args.record)) if any([not exists(x) for x in args.source + args.library]): raise Exception('Source and Output need to exist') #load the newly parsed org names # { file_name : full_path } newly_parsed = sorted(retrieval.get_data_files(args.source, ext=".org")) logging.info("Newly parsed to transfer: {}".format(len(newly_parsed))) #get the existing org names, as a dict with its location library_orgs = retrieval.get_data_files(args.library, ext=".org") existing_orgs = {} for lib_org in library_orgs: if lib_org in args.exclude: continue existing_orgs[split(lib_org)[1]] = split(lib_org)[0] logging.info("Existing orgs: {}".format(len(existing_orgs))) totally_new = [] #now update existing with the new for x in newly_parsed: if split(x)[1] not in existing_orgs: logging.info("Found a completely new user: {}".format(x)) totally_new.append(x) continue integrate(x, existing_orgs) logging.info("Completely new to transfer: {}".format(len(totally_new))) # Now copy completely new files for x in sorted(totally_new): copy_new(x, args.library[0]) update_record(args.record, args.source) system('say -v Moira -r 50 "Finished Integrating"')
def _finalize(self): if self.mode is 'parallel': system = ParallelSystem elif self.mode is 'serial': system = SerialSystem subSystems = [] for comp in self.subComps: subSystems.append(comp._finalize()) return system(self.name, subSystems, self.copy)
def mycall(self, event): self.event = event self.xdatalist.append(event.xdata) self.ydatalist.append(event.ydata) ax1.hold(True) # overlay plots. kc = event.xdata ti = event.ydata # Plot a red circle where you clicked. draw() # to refresh the plot. t = np.arange(0, tfinal, dt) xw = system(kc,ti) x = xw['x'] kcst = xw['kcst'] tist = xw['tist'] ax1.plot(kcst,tist,'k-') obj = kcfunction(kc,ti,x,entries,t,tfinal,dt,SP) por = obj['por'] tr = obj['tr'] tpr = obj['tpr'] if np.isnan(por)==True: ax3.hold(False) ax3.cla() ax3.text(0.02,0.5,'The system is unstable',fontsize = 13,color = 'red') ax1.plot([event.xdata],[event.ydata],'k*') elif np.isneginf(por)==True: ax1.hold(True) line_c=ax1.plot(kc,ti,'ko') else: print por print tr ax3.cla() ax3.hold(True) ax2.hold(True) ax3.plot(t,x) ax1.plot([event.xdata],[event.ydata],'go') ax2.plot([por],[tr],'bo') ax3.plot(tpr,((por + 1)*SP),'ro') ax3.axhline(y=SP,color = 'r') fig.canvas.draw() return True
import requests import datetime import re from bs4 import BeautifulSoup import os import system dollor_var = '' url = 'http://www.tgju.org/dollar-chart' session = requests.session() while True : site = session.get(url) soup = BeautifulSoup(site.text, 'html.parser') for sitedata in soup.find_all('td', class_='nf'): dollor_money = dollor_var if dollor_money != sitedata.string : print("تغییر قیمت") print(datetime.datetime.now().time()) print(sitedata.string) system('cvlc win.wanv') dollor_var = sitedata.string break
# Function to reset all objects to their original state (Not sure about the model however) def reset_simulation(self): self.system.reset() # Function which allows the user to select a new file to use in the simulation def load_environment(self): #TODO: Write function which pops open file browser to select grid file pass # Function to step forward in simulation def step_simulation(self): # Evolve system if self.system.running: self.system.step() # Pass entities to visualizer for drawing self.visualizer.update(self.system.entities) def run_simulation(self): # Run simulation until system reports halt while self.system.running: self.step_simulation() def run(self): self.create_window() # Unit Test if __name__ == "__main__": env = environment(system("Environment-0.txt")) env.run()
#! /usr/bin/env python import filecmp import system from os import remove system("wget -O- https://www.cs.ubc.ca/~mglgms/mta/redirect_target.html >out.txt 2> /dev/null") if filecmp.cmp('out.txt', 'fetch_target.html'): print 'htaccess works. Hurray!' remove('out.txt') else: print 'Doesn\'t work :('
>>> print(randint(1,25)) 5 >>> SyntaxError: invalid syntax >>> from platform import platform >>> platform(1) 'Windows-10-10.0.19041-SP0' >>> platform() 'Windows-10-10.0.19041-SP0' >>> from platform import machine >>> print(machine()) AMD64 >>> from platform import processor >>> print(processor()) AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD >>> from platform import system >>> system() 'Windows' >>> from platform import python_implementation, python_version_tuple >>> python_implementation() 'CPython' >>> for atr in python_version_tuple(): print(atr) 3 8 5 >>> #I"m running 3.8.5... isn't 3.9 out?" >>>
def __init__(self, root): ''' Begins the simulation and shows the UI to the user. Args: root (widget): The widget in which to generate the view and UI. ''' sys = system(root, 0.1) self.sys = sys #sys.worlds = [world(sys, 333000, 0, 0, 0, 0.262, 0.5), # world(sys, 318, 1.3, 0, 0, 5.5, 0.075), # world(sys, 31800, 5.2, 0, 0, -2.75, 0.15), # world(sys, 0.025, 5.2+0.7155, 0, 0, -2.75+2.294, 0.05)] sys.worlds = [world(sys, 333000, 0, 0, 0, 0, 0.2)] for i in range(600): rand = random.uniform(0, 2 * math.pi) rand2 = random.uniform(-0.01, 0.01) rand3 = random.uniform(-0.01, 0.01) rand4 = random.uniform(-2, 2) rand5 = random.uniform(-2, 2) sys.worlds += [ world(sys, 1, 8 * math.sin(rand) + rand4, 8 * math.cos(rand) + rand5, 0.5 * math.pi * math.cos(rand) + rand2, -0.5 * math.pi * math.sin(rand) + rand3, 0.03) ] sys.cameraPos = (-0.0, -0.0) sys.scale = 25.0 sys.initialize() frame = Frame(root) frame.pack() moveFrame = Frame(frame) moveFrame.grid(row=0, column=0) bufferFrame = Frame(frame, width=initWidth - buttonSize * 5) bufferFrame.grid(row=0, column=1) zoomFrame = Frame(frame) zoomFrame.grid(row=0, column=2) leftButton = Button(moveFrame, height=buttonSize, width=2 * buttonSize, text="<", command=lambda: sys.moveLeft(moveAmount)) leftButton.grid(row=1, column=0) rightButton = Button(moveFrame, height=buttonSize, width=2 * buttonSize, text=">", command=lambda: sys.moveRight(moveAmount)) rightButton.grid(row=1, column=2) upButton = Button(moveFrame, height=buttonSize, width=2 * buttonSize, text="^", command=lambda: sys.moveUp(moveAmount)) upButton.grid(row=0, column=1) downButton = Button(moveFrame, height=buttonSize, width=2 * buttonSize, text="v", command=lambda: sys.moveDown(moveAmount)) downButton.grid(row=2, column=1) inButton = Button(zoomFrame, height=buttonSize, width=2 * buttonSize, text="+", command=lambda: sys.zoomIn()) inButton.grid(row=0, column=4) outButton = Button(zoomFrame, height=buttonSize, width=2 * buttonSize, text="-", command=lambda: sys.zoomOut()) outButton.grid(row=2, column=4) fasterButton = Button(zoomFrame, height=buttonSize, width=2 * buttonSize, text=">>", command=lambda: sys.speedUp(speedChangeAmount)) fasterButton.grid(row=0, column=0) pauseButton = Button(zoomFrame, height=buttonSize, width=2 * buttonSize, text="||", command=lambda: sys.pause(pauseButton)) pauseButton.grid(row=1, column=0) slowerButton = Button(zoomFrame, height=buttonSize, width=2 * buttonSize, text="<<", command=lambda: sys.slowDown(speedChangeAmount)) slowerButton.grid(row=2, column=0) root.bind('<Key>', self.handleKeys) sys.pause(pauseButton) sys.updateWorlds() sys.updateDraw()
exit("This software only works with GNU/Linux.\nSorry.") # system(brew update) # system(port -v update) if "win" in win: exit("This software only works with GNU/Linux.\nSorry.") # print(dist) # Argparse. parser = argparse.ArgumentParser() parser.add_argument("-u", help="Update system.") args = parser.parse_args() if args.u: print("Updating system.") # If statements. if "arch" in dist: system(pacman -Syyu) if "centos" in dist: system(yum update -y) if "fedora" in dist: system(dnf update -y) system(yum update -y) # For compatibility reasons. :( if "debian" in dist: system(apt-get update) system(apt-get upgrade -y) system(apt-get dist-upgrade -y) system(apt-get full-upgrade -y) if "Ubuntu" in dist: system(apt-get update) system(apt-get upgrade -y) system(apt-get dist-upgrade -y) system(apt-get full-upgrade -y)
printf("dude, %s already exists, do it from a clean working dir\n", memedir); return 1; } pid_t childpid = fork(); if (childpid) { // parent usleep(RACE_SLEEP_TIME); mkdir(memedir, 0700); symlink(target_file, my_symlink); waitpid(childpid, 0, 0); } else { // child setpriority(PRIO_PROCESS, 0, 20); // set nice to 20 for race reliability execve("/usr/bin/sudoedit", argv, envp); // noreturn puts("execve fails?!"); abort(); } if (query_target_size() != initial_size) { puts("target file has a BRUH MOMENT!!!! SUCCess???"); system("xdg-open 'https://www.youtube.com/watch?v=4vkR1G_DUVc'"); // ayy lmao return 0; } } puts("Failed?"); puts("if all the meme dirs are owned by root, the usleep needs to be decreased."); puts("if they're all owned by you, the usleep needs to be increased"); return 0; }
from system import * import json eer = {} for preprocessing in [preprocessing_san18]: eer[preprocessing.__name__] = {} for feature_extractor in [mean_cycle_san18, multicycles_san18]: eer[preprocessing.__name__][feature_extractor.__name__] = {} for classifier in [manhattan_san18, euclidean_san18]: eer[preprocessing.__name__][feature_extractor.__name__][ classifier.__name__] = {} # System definition s = system(preprocessing, feature_extractor, classifier) for device in ['nonin', 'berry']: eer[preprocessing.__name__][feature_extractor.__name__][ classifier.__name__][device] = {} for ts in ['d2', 'd3']: eer[preprocessing.__name__][feature_extractor.__name__][ classifier.__name__][device][ts] = [] for enrollment_gap in [0, 10, 20]: s.enrollment( from_file('ddbb', device, 'd1', enrollment_gap, 35 + enrollment_gap)) for testing_gap in [0, 10, 20]: