Example #1
0
def test_cnn():
    notebook_filename = 'caffe-1.0/examples/net_surgery.ipynb'
    utils.download_files(
        desired_file=notebook_filename,
        download_url="https://github.com/BVLC/caffe/archive/1.0.tar.gz",
        fn="caffe-1.0.tar.gz")
    # net_surgery is one of their examples that we've hacked to be more friendly to our setup
    shutil.copy2(os.path.join(os.path.dirname(__file__), 'net_surgery.py'),
                 os.path.dirname(notebook_filename))
    subprocess.check_call(['python', 'net_surgery.py'],
                          cwd=os.path.dirname(notebook_filename))
Example #2
0
def test_optimizers():
    fn = 'keras-master/tests/keras/optimizers_test.py'
    archive_file = "keras_master.zip"
    utils.download_files(fn, "https://github.com/keras-team/keras/archive/master.zip", archive_file)
    sys.path.append(os.path.join(os.getcwd(), 'keras-master/tests/keras'))

    import optimizers_test
    optimizers_test.test_sgd()
    optimizers_test.test_adagrad()
    optimizers_test.test_no_grad()
    optimizers_test.test_tfoptimizer()
Example #3
0
def substitute_ad_files_and_upgrade_ad_tactics():
    download_files(f_url = "https://raw.githubusercontent.com/ToutyRater/V2Ray-SiteDAT/master/geofiles/h2y.dat", f_name = "h2y.dat")
    if os.path.exists(ad_rules_file):
        os.remove(ad_rules_file)
        move_files("h2y.dat", "/usr/bin/v2ray/")
        writejson.WriteAD("on")
        if re.search(r'/v2ray.fun/maintain.sh', cronfile.read()):
            os.system("bash /usr/local/v2ray.fun/maintain.sh")
            print ("设置成功!")
        else:
            os.system("sed -i '$i 30 4    * * 0   root    bash /usr/local/v2ray.fun/maintain.sh' /etc/crontab")
            os.system("bash /usr/local/v2ray.fun/maintain.sh")
            print ("设置成功!")
    else:
        move_files("h2y.dat", "/usr/bin/v2ray/")
        writejson.WriteAD("on")
Example #4
0
def download_data(kic):
    try:
        folder_path = utils.download_files(kic)
        utils.process_data(folder_path)
    except Exception as e:
        print(e)
        return e
Example #5
0
def get(kic):
    try:
        folder_path = utils.download_files(kic)
        utils.process_data(folder_path)
        data = read_csv(kic)
        return data
    except Exception as e:
        print(e)
        return e
Example #6
0
    if_open_ad_function = "广告拦截功能: 未开启"
else:
    if_open_ad_function = "广告拦截功能: 开启"

print("")
print(if_open_ad_function)

print("")
print("1. 开启")
print("2. 关闭")
print("3. 更新广告过滤策略")

choice = raw_input("请选择: ")

if choice == "1":
    writejson.WriteAD("on")
elif choice == "2":
    writejson.WriteAD("off")
elif choice == "3":
    download_files(
        f_url=
        "https://raw.githubusercontent.com/ToutyRater/V2Ray-SiteDAT/master/geofiles/h2y.dat",
        f_name="h2y.dat")
    if os.path.exists(ad_rules_file):
        os.remove(ad_rules_file)
        move_files("h2y.dat", "/usr/bin/v2ray/")
        writejson.WriteAD("on")
    else:
        move_files("h2y.dat", "/usr/bin/v2ray/")
        writejson.WriteAD("on")
Example #7
0
def process(user_id, all=False):
    download_files(get_medias(user_id, all))