Last active
July 11, 2017 19:11
-
-
Save PrivacyPolicy/5fcc178e6a2c6d2d498b244c074f1a68 to your computer and use it in GitHub Desktop.
Script to setup environment for working with research project training on Florida Poly's machines
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
# Download executable file from the internet and run it | |
def run_online_exe(url, dir, exe, run=True): | |
# "Sanitize" input | |
if exe[-4:] != '.exe': | |
exe += '.exe' | |
# Download file as zip | |
from urllib.request import urlretrieve | |
zip_file_dir = exe.split('/')[-1][:-4] + '.zip' | |
urlretrieve(url, zip_file_dir) | |
# Unzip file | |
from zipfile import ZipFile | |
with ZipFile(zip_file_dir, 'r') as zf: | |
zf.extractall(dir) | |
# Run executable | |
if run: | |
run_cmd(dir + '/' + exe) | |
# Run an arbitrary command in the OS's shell | |
def run_cmd(cmd): | |
from subprocess import Popen | |
if type(cmd) is str: # As opposed to a list | |
cmd = [cmd] | |
Popen(cmd, shell=False) | |
# Download and run caffeine | |
run_online_exe(url='http://www.zhornsoftware.co.uk/caffeine/caffeine.zip', dir='caffeine', exe='caffeine.exe') | |
# Download and run cmder | |
run_online_exe(url='https://github.com/cmderdev/cmder/releases/download/v1.3.2/cmder_mini.zip', dir='cmder', exe='Cmder.exe') | |
# Download notepad++, but don't run it quite yet | |
run_online_exe(url='https://notepad-plus-plus.org/repository/7.x/7.4.2/npp.7.4.2.bin.zip', dir='npp', exe='notepad++.exe', run=False) | |
# Download and run Eclipse Oxygen | |
run_online_exe(url='http://archive.eclipse.org/technology/epp/downloads/release/oxygen/M2/eclipse-jee-oxygen-M2-win32-x86_64.zip', dir='eclipse', exe='eclipse/eclipse.exe') | |
# Configure git with my username and the repository | |
from os import system | |
system('git config --global user.name "Hutchison" & ' \ | |
'git config --global user.email "ghutchison2600@flpoly.org" & ' \ | |
'git clone https://Hutchison@gitlab.com/Hutchison/test-dl4j.git & ' \ | |
'cd test-dl4j & ' \ | |
'git checkout overtraining') | |
# Open file in notepad++ with additional instructions | |
text_file_dir = 'instructions.txt' | |
text_file_contents = 'Next steps:\n' \ | |
'Eclipse use default workspace\n' \ | |
'File > Open projects from file\n' \ | |
'Click "Directory"\n' \ | |
'Choose test-dl4j\n' \ | |
'Click the \'x\' next to the "Welcome" tab\n' \ | |
'In Project Explorer, find and double-click choose testdl4j/src/main/java/testld4j/TestNeuralNetwork.java\n' \ | |
'Click the green arrow ("Run") button\n' | |
with open(text_file_dir, 'w') as text_file: | |
text_file.write(text_file_contents) | |
system(r'start npp\notepad++.exe ' + text_file_dir) |
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
python ResearchSetup.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment