Esempio n. 1
0
def download_atmosphere(module, temp_directory, isotope_version, isotope_build):
    release = get_latest_release(module)
    bundle_path = download_asset(module, release, 0)
    if bundle_path is None:
        return None

    with zipfile.ZipFile(bundle_path, 'r') as zip_ref:
        zip_ref.extractall(temp_directory)

    common.delete(bundle_path)
    common.delete(temp_directory.joinpath('switch/reboot_to_payload.nro'))
    common.delete(temp_directory.joinpath('switch'))
    common.delete(temp_directory.joinpath('atmosphere/reboot_payload.bin'))

    payload_path = download_asset(module, release, 1)
    if payload_path is None:
        return None

    common.mkdir(temp_directory.joinpath('bootloader/payloads'))
    common.move(payload_path, temp_directory.joinpath(
        'bootloader/payloads/fusee-primary.bin'))

    common.copy_module_file('atmosphere', 'system_settings.ini', temp_directory.joinpath(
        'atmosphere/config/system_settings.ini'))

    if not isotope_build:
        common.delete(temp_directory.joinpath('hbmenu.nro'))

    return get_version(module, release, 0)
Esempio n. 2
0
def download_emuiibo(module, temp_directory, deepsea_version, parameters,
                     deepsea_build):
    release = get_latest_release(module)
    bundle_path = download_asset(module, release, 0)
    if bundle_path is None:
        return None

    with zipfile.ZipFile(bundle_path, 'r') as zip_ref:
        zip_ref.extractall(temp_directory)

    common.delete(bundle_path)
    common.mkdir(temp_directory.joinpath('atmosphere/contents'))
    common.move(
        temp_directory.joinpath('SdOut/atmosphere/contents/0100000000000352'),
        temp_directory.joinpath('atmosphere/contents/0100000000000352'))
    common.mkdir(temp_directory.joinpath('switch/.overlays'))
    common.move(temp_directory.joinpath('SdOut/switch/.overlays/emuiibo.ovl'),
                temp_directory.joinpath('switch/.overlays/emuiibo.ovl'))
    common.delete(temp_directory.joinpath('SdOut'))
    if deepsea_build:
        common.delete(
            temp_directory.joinpath(
                'atmosphere/contents/0100000000000352/flags/boot2.flag'))
    common.copy_module_file(
        'emuiibo', 'toolbox.json',
        temp_directory.joinpath(
            'atmosphere/contents/0100000000000352/toolbox.json'))

    return get_version(module, release, 0)
Esempio n. 3
0
def download_hekate(module, temp_directory):
    release = get_latest_release(module)
    bundle_path = download_asset(module, release, 0)
    if bundle_path is None:
        return None

    with zipfile.ZipFile(bundle_path, 'r') as zip_ref:
        zip_ref.extractall(temp_directory)

    common.delete(bundle_path)

    common.copy_module_file(
        'hekate', 'hekate_ipl.ini',
        temp_directory.joinpath('bootloader/hekate_ipl.ini'))

    payload = common.find_file(temp_directory.joinpath('hekate_ctcaer_*.bin'))
    if len(payload) != 0:
        shutil.copyfile(payload[0],
                        temp_directory.joinpath('bootloader/update.bin'))
        common.mkdir(temp_directory.joinpath('atmosphere'))
        shutil.copyfile(
            payload[0],
            temp_directory.joinpath('atmosphere/reboot_payload.bin'))

        common.mkdir(temp_directory.joinpath('../hekate'))
        common.move(
            payload[0],
            temp_directory.joinpath('../hekate/',
                                    Path(payload[0]).name))

    common.delete(
        temp_directory.joinpath(
            'nyx_usb_max_rate (run once per windows pc).reg'))

    return release.tag_name
Esempio n. 4
0
def download_atmosphere(module, temp_directory):
    release = get_latest_release(module)
    bundle_path = download_asset(module, release, 0)
    if bundle_path is None:
        return None

    with zipfile.ZipFile(bundle_path, 'r') as zip_ref:
        zip_ref.extractall(temp_directory)

    common.delete(bundle_path)
    common.delete(temp_directory.joinpath('switch/reboot_to_payload.nro'))

    payload_path = download_asset(module, release, 1)
    if payload_path is None:
        return None

    common.mkdir(
        temp_directory.joinpath('../hekate_musthave/bootloader/payloads'))
    shutil.copyfile(
        payload_path,
        temp_directory.joinpath(
            '../hekate_musthave/bootloader/payloads/fusee-primary.bin'))

    common.mkdir(temp_directory.joinpath('../fusee_primary'))
    common.move(payload_path,
                temp_directory.joinpath('../fusee_primary/fusee-primary.bin'))

    common.delete(temp_directory.joinpath('hbmenu.nro'))

    return release.tag_name
Esempio n. 5
0
def clean():
    rmdir(base_dir+'\\examples\\mini-web\\target\\generated-sources\\archetype')

    move(base_dir+'\\examples\\mini-web\\target\\tmp\\WEB-INF-classes', base_dir+'\\examples\\mini-web\\webapp\\WEB-INF\\classes')
    os.chdir(base_dir+'\\examples\\mini-web')
    os.system('mvn eclipse:clean eclipse:eclipse -Declipse.workspace=F:\workspace')
    
    print 'cleaned temp files.'
Esempio n. 6
0
def download_lockpick_rcm(module, temp_directory):
    release = get_latest_release(module)
    payload_path = download_asset(module, release, 0)
    if payload_path is None:
        return None

    common.move(payload_path, temp_directory.joinpath('Lockpick_RCM.bin'))

    return release.tag_name
Esempio n. 7
0
def download_nxmtp(module, temp_directory, deepsea_version, deepsea_build):
    release = get_latest_release(module)
    app_path = download_asset(module, release, 0)
    if app_path is None:
        return None

    common.mkdir(temp_directory.joinpath('switch/nxmtp'))
    common.move(app_path, temp_directory.joinpath('switch/nxmtp/nxmtp.nro'))

    return get_version(module, release, 0)
Esempio n. 8
0
def download_status_monitor_overlay(module, temp_directory, isotope_version, isotope_build):
    release = get_latest_release(module)
    app_path = download_asset(module, release, 0)
    if app_path is None:
        return None

    common.mkdir(temp_directory.joinpath('switch/.overlays'))
    common.move(app_path, temp_directory.joinpath(
        'switch/.overlays/Status-Monitor-Overlay.ovl'))

    return get_version(module, release, 0)
Esempio n. 9
0
def clean():
    rmdir(base_dir +
          '\\examples\\mini-web\\target\\generated-sources\\archetype')

    move(base_dir + '\\examples\\mini-web\\target\\tmp\\WEB-INF-classes',
         base_dir + '\\examples\\mini-web\\webapp\\WEB-INF\\classes')
    os.chdir(base_dir + '\\examples\\mini-web')
    os.system(
        'mvn eclipse:clean eclipse:eclipse -Declipse.workspace=F:\workspace')

    print 'cleaned temp files.'
Esempio n. 10
0
def download_jksv(module, temp_directory, isotope_version, isotope_build):
    release = get_latest_release(module)
    app_path = download_asset(module, release, 0)
    if app_path is None:
        return None

    common.mkdir(temp_directory.joinpath('switch/JKSV'))
    common.move(app_path, temp_directory.joinpath(
        'switch/JKSV/JKSV.nro'))

    return get_version(module, release, 0)
Esempio n. 11
0
def download_ovl_sysmodules(module, temp_directory, isotope_version, isotope_build):
    release = get_latest_release(module)
    app_path = download_asset(module, release, 0)
    if app_path is None:
        return None

    common.mkdir(temp_directory.joinpath('switch/.overlays'))
    common.move(app_path, temp_directory.joinpath(
        'switch/.overlays/ovlSysmodules.ovl'))

    return get_version(module, release, 0)
Esempio n. 12
0
def download_tesla_menu(module, temp_directory):
    release = get_latest_release(module)
    app_path = download_asset(module, release, 0)
    if app_path is None:
        return None

    common.mkdir(temp_directory.joinpath('switch/.overlays'))
    common.move(app_path,
                temp_directory.joinpath('switch/.overlays/ovlmenu.ovl'))

    return release.tag_name
Esempio n. 13
0
def download_sys_clk_ovl(module, temp_directory, deepsea_version, parameters,
                         deepsea_build):
    release = get_latest_release(module)
    app_path = download_asset(module, release, 0)
    if app_path is None:
        return None

    common.move(
        app_path,
        temp_directory.joinpath('switch/.overlays/sys-clk-Overlay.ovl'))

    return get_version(module, release, 0)
Esempio n. 14
0
def download_nxdumptool(module, temp_directory, deepsea_version, parameters,
                        deepsea_build):
    release = get_latest_release(module)
    app_path = download_asset(module, release, 0)
    if app_path is None:
        return None

    common.mkdir(temp_directory.joinpath('switch/NXDumpTool'))
    common.move(app_path,
                temp_directory.joinpath('switch/NXDumpTool/NXDumpTool.nro'))

    return get_version(module, release, 0)
Esempio n. 15
0
def prepare():
    move(base_dir+'\\examples\\mini-web\\webapp\\WEB-INF\\classes',base_dir+'\\examples\\mini-web\\target\\tmp\\WEB-INF-classes')
    rmdir(base_dir+'\\examples\\mini-web\\logs\\')
    rmdir(base_dir+'\\examples\\mini-web\\bin\\hibernate\\logs\\')
    rmdir(base_dir+'\\examples\\mini-web\\bin\\hibernate\\generated\\dao')
    rmdir(base_dir+'\\examples\\mini-web\\bin\\hibernate\\generated\\entity')
    rmdir(base_dir+'\\examples\\mini-web\\bin\\hibernate\\generated\\manager')
    rmfile(base_dir+'\\examples\\mini-web\\.project')
    rmfile(base_dir+'\\examples\\mini-web\\.classpath')
    rmfile(base_dir+'\\examples\\mini-web\\.settings\\org.eclipse.jdt.core.prefs')
    rmfile(base_dir+'\\examples\\mini-web\\.settings\\org.eclipse.wst.common.component')
    rmfile(base_dir+'\\examples\\mini-web\\.settings\\org.eclipse.wst.common.project.facet.core.xml')
    print 'prepared example projects.'
Esempio n. 16
0
def bi_corr_clustering(a_list: Dict[int, Set[int]],
                       b_list: Dict[int, Set[int]]) -> None:
    """
    Two 'parallel' clustering.

    Parameters
    ----------
    a_list : the rows.
    b_list : the columns.

    Returns
    -------
    None, the result of the clustering is in variables ga and gb.
    """
    global ga
    global gb
    global fa
    global fb
    ga = {x: x for x in range(len(a_list))}
    gb = {x: x for x in range(len(b_list))}
    changeA, changeB = False, False
    while True:
        any_change = False
        fa = calc(a_list, gb)
        while True:
            changeA = False
            for i in ga:
                if move(i, ga, attract_rows):
                    changeA = True
                    any_change = True
            if join(ga, attract_rows):
                changeA = True
                any_change = True
            if not changeA:
                break
        #print("GA:",[list({i+1 for i in ga if ga[i]==v}) for v in set(ga.values())])
        fb = calc(b_list, ga)
        while True:
            changeB = False
            for i in gb:
                if move(i, gb, attract_columns):
                    changeB = True
                    any_change = True
            if join(gb, attract_columns):
                changeB = True
                any_change = True
            if not changeB:
                break
        #print("GB:",[list({i+1 for i in gb if gb[i]==v}) for v in set(gb.values())])
        if not any_change:
            break
Esempio n. 17
0
def download_lockpick_rcm(module, temp_directory, isotope_version, isotope_build):
    release = get_latest_release(module)
    payload_path = download_asset(module, release, 0)
    if payload_path is None:
        return None

    if isotope_build:
        common.mkdir(temp_directory.joinpath('bootloader/payloads'))
        common.move(payload_path, temp_directory.joinpath(
            'bootloader/payloads/Lockpick_RCM.bin'))
    else:
        common.move(payload_path, temp_directory.joinpath('Lockpick_RCM.bin'))

    return get_version(module, release, 0)
Esempio n. 18
0
def download_isotope_toolbox(module, temp_directory, isotope_version, isotope_build):
    release = get_latest_release(module)
    app_path = download_asset(module, release, 0)
    if app_path is None:
        return None

    common.mkdir(temp_directory.joinpath('switch/Isotope-Toolbox'))

    common.move(app_path, temp_directory.joinpath(
        'switch/Isotope-Toolbox/Isotope-Toolbox.nro'))

    common.copy_module_file('isotope-toolbox', 'config.json',
                            temp_directory.joinpath('switch/Isotope-Toolbox/config.json'))

    return get_version(module, release, 0)
Esempio n. 19
0
def download_appstore(module, temp_directory, isotope_version, isotope_build):
    release = get_latest_release(module)
    bundle_path = download_asset(module, release, 0)
    if bundle_path is None:
        return None

    with zipfile.ZipFile(bundle_path, 'r') as zip_ref:
        zip_ref.extractall(temp_directory)

    common.delete(bundle_path)
    common.mkdir(temp_directory.joinpath('switch/appstore'))
    common.move(temp_directory.joinpath('appstore.nro'),
                temp_directory.joinpath('switch/appstore/appstore.nro'))

    return get_version(module, release, 0)
Esempio n. 20
0
def download_kosmos_updater(module, temp_directory, deepsea_version, deepsea_build):
    release = get_latest_release(module)
    app_path = download_asset(module, release, 0)
    if app_path is None:
        return None

    common.mkdir(temp_directory.joinpath('switch/DeepSea-Updater'))
    common.move(app_path, temp_directory.joinpath(
        'switch/DeepSea-Updater/DeepSea-Updater.nro'))
    common.copy_module_file('deepsea-updater', 'internal.db',
                            temp_directory.joinpath('switch/DeepSea-Updater/internal.db'))
    common.sed('DEEPSEA_VERSION', deepsea_version,
               temp_directory.joinpath('switch/DeepSea-Updater/internal.db'))

    return get_version(module, release, 0)
Esempio n. 21
0
def download_isotope_updater(module, temp_directory, isotope_version, isotope_build):
    release = get_latest_release(module)
    app_path = download_asset(module, release, 0)
    if app_path is None:
        return None

    common.mkdir(temp_directory.joinpath('switch/Isotope-Updater'))
    common.move(app_path, temp_directory.joinpath(
        'switch/Isotope-Updater/Isotope-Updater.nro'))
    common.copy_module_file('isotope-updater', 'internal.db',
                            temp_directory.joinpath('switch/Isotope-Updater/internal.db'))
    common.sed('ISOTOPE_VERSION', isotope_version,
               temp_directory.joinpath('switch/Isotope-Updater/internal.db'))

    return get_version(module, release, 0)
Esempio n. 22
0
def calc(matrix: List[List[int]]) -> List[List[int]]:
    """
    Biclustering.

    Parameters
    ----------
    m: homogeneous matrix of a relation

    Returns
    -------
    solution: "set of set of" objects, a clustering
    """
    global rows
    rows = make_rows(matrix)
    #transposed :List[List[int]] = list(map(list, zip(*matrix)))
    #trans: Dict[int,Set[int]] =alist(transposed)

    global g
    g = {x: x for x in range(len(rows))}
    change = False

    while True:
        change = False
        for i in g:
            if move(i, g, attract):
                change = True
        # print("after move:", [list({i+1 for i in g if g[i]==v}) for v in set(g.values())])
        if join(g, attract):
            change = True
            # print("after join:", [list({i+1 for i in g if g[i]==v}) for v in set(g.values())])
        if not change:
            break
    solution = [list({i + 1 for i in g if g[i] == v}) for v in set(g.values())]
    return solution
Esempio n. 23
0
def download_edizon(module, temp_directory, isotope_version, isotope_build):
    release = get_latest_release(module)
    app_path = download_asset(module, release, 0)
    if app_path is None:
        return None

    common.mkdir(temp_directory.joinpath('switch/EdiZon'))
    common.move(app_path, temp_directory.joinpath('switch/EdiZon/EdiZon.nro'))

    overlay_path = download_asset(module, release, 1)
    if overlay_path is None:
        return None

    common.mkdir(temp_directory.joinpath('switch/.overlays'))
    common.move(overlay_path, temp_directory.joinpath(
        'switch/.overlays/ovlEdiZon.ovl'))

    return get_version(module, release, 0)
Esempio n. 24
0
def download_deepsea_toolbox(module, temp_directory, deepsea_version,
                             parameters, deepsea_build):
    release = get_latest_release(module)
    app_path = download_asset(module, release, 0)
    if app_path is None:
        return None

    common.mkdir(temp_directory.joinpath('switch/DeepSea-Toolbox'))

    common.move(
        app_path,
        temp_directory.joinpath('switch/DeepSea-Toolbox/DeepSea-Toolbox.nro'))

    common.copy_module_file(
        'hekate-toolbox', 'config.json',
        temp_directory.joinpath('switch/DeepSea-Toolbox/config.json'))

    return get_version(module, release, 0)
Esempio n. 25
0
def download_hekate(module, temp_directory, deepsea_version, parameters,
                    deepsea_build):
    release = get_latest_release(module)
    bundle_path = download_asset(module, release, 0)
    if bundle_path is None:
        return None

    with zipfile.ZipFile(bundle_path, 'r') as zip_ref:
        zip_ref.extractall(temp_directory)

    common.delete(bundle_path)

    common.copy_module_file('hekate', 'bootlogo.bmp',
                            temp_directory.joinpath('bootloader/bootlogo.bmp'))
    common.copy_module_file(
        'hekate', 'hekate_ipl.ini',
        temp_directory.joinpath('bootloader/hekate_ipl.ini'))
    common.sed('DEEPSEA_VERSION', deepsea_version,
               temp_directory.joinpath('bootloader/hekate_ipl.ini'))

    payload = common.find_file(temp_directory.joinpath('hekate_ctcaer_*.bin'))
    if len(payload) != 0:
        shutil.copyfile(payload[0],
                        temp_directory.joinpath('bootloader/update.bin'))
        common.mkdir(temp_directory.joinpath('atmosphere'))
        shutil.copyfile(
            payload[0],
            temp_directory.joinpath('atmosphere/reboot_payload.bin'))

    common.delete(
        temp_directory.joinpath(
            'nyx_usb_max_rate (run once per windows pc).reg'))

    if not deepsea_build:
        common.mkdir(temp_directory.joinpath('../must_have'))
        common.move(temp_directory.joinpath('bootloader'),
                    temp_directory.joinpath('../must_have/bootloader'))
        common.move(
            temp_directory.joinpath('atmosphere/reboot_payload.bin'),
            temp_directory.joinpath(
                '../must_have/atmosphere/reboot_payload.bin'))
        common.delete(temp_directory.joinpath('atmosphere'))

    return get_version(module, release, 0)
Esempio n. 26
0
def prepare():
    move(base_dir + '\\examples\\mini-web\\webapp\\WEB-INF\\classes',
         base_dir + '\\examples\\mini-web\\target\\tmp\\WEB-INF-classes')
    rmdir(base_dir + '\\examples\\mini-web\\logs\\')
    rmdir(base_dir + '\\examples\\mini-web\\bin\\hibernate\\logs\\')
    rmdir(base_dir + '\\examples\\mini-web\\bin\\hibernate\\generated\\dao')
    rmdir(base_dir + '\\examples\\mini-web\\bin\\hibernate\\generated\\entity')
    rmdir(base_dir +
          '\\examples\\mini-web\\bin\\hibernate\\generated\\manager')
    rmfile(base_dir + '\\examples\\mini-web\\.project')
    rmfile(base_dir + '\\examples\\mini-web\\.classpath')
    rmfile(base_dir +
           '\\examples\\mini-web\\.settings\\org.eclipse.jdt.core.prefs')
    rmfile(base_dir +
           '\\examples\\mini-web\\.settings\\org.eclipse.wst.common.component')
    rmfile(
        base_dir +
        '\\examples\\mini-web\\.settings\\org.eclipse.wst.common.project.facet.core.xml'
    )
    print 'prepared example projects.'
Esempio n. 27
0
from common import move, directions_map

if __name__ == '__main__':
    current_location = [0, 0]

    with open('./input.txt') as file:
        directions = file.read().replace('\n', '')

    total = {move(current_location, *directions_map[d]) for d in directions}

    # add initial position in case it never gets encountered
    total.add((0, 0))

    print(f"Total homes visited: {len(total)}")
Esempio n. 28
0
from common import move, directions_map

if __name__ == '__main__':
    current_location_santa = [0, 0]
    current_location_robot = [0, 0]

    with open('./input.txt') as file:
        directions = file.read().replace('\n', '')

    total = [
        move(current_location_santa, *directions_map[d])
        for i, d in enumerate(directions) if i % 2 == 0
    ]
    total2 = [
        move(current_location_robot, *directions_map[d])
        for i, d in enumerate(directions) if i % 2 != 0
    ]

    # add initial position to the lists in case these never get encountered during the trip
    total.append((0, 0))
    total2.append((0, 0))

    print(f'Total homes visited: {len({*total, *total2})}')
Esempio n. 29
0
    auto_build = False
    if hasattr(args, 'auto'):
        auto_build = args.auto

    with open(args.package_file,'r') as pkgfile:
        package_content = json.load(pkgfile)

    version_messages = init_version_messages(package_content, deepsea_version)

    build_messages = modules.build(
        temp_directory, deepsea_version, package_content, auto_build)

    common.delete(args.output)

    if build_messages is not None:
        version_messages += build_messages

        if package_content['is_sdsetup']:
            common.move(temp_directory, args.output)
        else:
            shutil.make_archive(
                Path(args.output).stem,
                'zip',
                temp_directory)

        for message in version_messages:
            print(message)

    common.delete(Path.cwd().joinpath('tmp'))