SVN或者GIT远程双向同步

作者:matrix 发布时间:2021年9月3日 分类:零零星星

现在我需要svn或者git的提交同步到其他远程仓库(svn或git),也就是同步操作。这里的同步最小单位为单次的提交commit。

配合之前的「使用git-svn管理svn仓库」可以完美解决这个问题,利用git来中转管理我们手上的仓库代码。

场景:

有多个相同代码的SVN仓库,我不想全部迁移到git。然而每次修改一个功能的代码就必须手动复制到其他的远程svn/git仓库上,代码相似但又不能直接替换。。。

之前使用git cherry-pick可以解决这个问题,但是要单独给svn用就会很麻烦。尝试用git svn中转试试!

1. 本地添加远程仓库

如果是svn仓库,先使用git svn clone svn://xxx.com/xxx克隆svn仓库到本地

2. 本地添加远程仓库

  • 添加远程SVN仓库:

没有找到命令行的方式添加远程仓库分支,但是可以修改 .git/config文件达到目的。

项目/.git/config文件中新增svn-remote配置:

[core]
    ...
[svn-remote "svn"]
    ...
[svn-remote "qingsui"]
     url = svn://xxxx/qingsui
     fetch = :refs/remotes/git-svn-qingsui

  • 添加远程git仓库:
    可以直接使用git命令添加:
 $ git remote add remote-repository-name https://git.weixin.qq.com/remote-repository-name.git

3. 拉取远程代码

  • 远程SVN仓库:
$ git svn fetch  qingsui

如果需要pull操作来自动更新合并执行命令git svn rebase

  • 远程git仓库:
$  git fetch remote-repository-name

4.新建对应的本地分支

  • 远程SVN仓库:
$ git checkout -b qingsui  remotes/git-svn-qingsui

$ git branch -a # 查看本地分支情况

  • 远程git仓库:
$  git checkout -b remote-repository-name remotes/remote-repository-name/master

5. 将commit提交合并到新分支

commit_id是需要同步到其他远程分支的commit id。

$ git cherry-pick  {commit_id}

6. 推送修改到远程仓库

  • SVN仓库:
$ git svn dcommit
  • git仓库:
$ git push

完美解决,实际上就是使用git来操作。

同步到远程svn仓库操作脚本

#!/bin/bash
#同步commit到其他远程仓库
#example:  shell.sh  dade,qingsui commitID1,commitID2
# dade,qingsui 为`git branch`本地分支名字
if [ ! $1 -o ! $2 ]; then
    echo -e "usage example:  \n $ shell.sh dade,qingsui commitID1,commitID2"
    exit
fi

repo_arr=(`echo $1 | tr ',' ' '`) 
commit_arr=(`echo $2 | tr ',' ' '`) 

for repo in ${repo_arr[@]};do
    for commit_id in ${commit_arr[@]};do
         git checkout $repo
         git svn rebase #git pull操作
         git cherry-pick $commit_id
         git svn dcommit
         git checkout master
        echo -e "\n"
    done
done


说明:
如果自动合并有冲突会操作会失败,需要手动修改再提交&推送。

如果需要git-svn自动输入密码>> https://www.hhtjim.com/git-svn-save-password-credentials-from-input.html

参考:

https://coderwall.com/p/vfop7g/add-an-svn-remote-to-your-git-repo

https://superuser.com/questions/354819/git-svn-pass-password-on-command-line

commit同步到其他仓库

作者:matrix 发布时间:2021年7月31日 分类:零零星星

不同的仓库可以互相同步其中任意提交的commit吗?可以的~

现有仓库enc,qsui,dada。三个的代码基本相同但是没有新建分支来区别。

本地会经常修改enc代码来提交到其远程仓库,但是其他仓库咋办?我不想每个再修改提交。

办法

大致思路就是本地仓库添加其他remote远程分支,本地抓取之后新建本地分支进行关联,再git cherry-pick合并提交到本地新的分支,之后push即可。

步骤

  • 1.enc本地添加远程
$ git remote add dada  https://git.weixin.qq.com/wx_wx8fffaa009d109aa1/dada.git

$ git remote  -v # 查看远程仓库分支

  • 2.抓取到本地
$ git fetch dada
  • 3.新建本地分支
$ git checkout -b dada dada/master #远程dada/master分支新建为本地分支「dada」,且当前分支切换到dada

$ git branch -a # 查看本地分支情况
    * dada
      master
      remotes/dada/master
      remotes/origin/master

  • 4.将commit提交合并到新分支
$ git cherry-pick d4df33b962910XXXX
  • 5.push推送
$ git push dada dada:master

一句话同步操作

$ git checkout qsui  &&  git cherry-pick dad6432037fcadcd35405aaa331dd367e58b1e2e   &&  git push qsui qsui:master 

多分支多commit操作脚本


#!/bin/bash #example: shell.sh dada,qsui commitID1,commitID2 # 同步commit到其他远程仓库 if [ ! $1 -o ! $2 ]; then echo -e "usage example: \n $ shell.sh dada,qsui commitID1,commitID2" exit fi repo_arr=(`echo $1 | tr ',' ' '`) commit_arr=(`echo $2 | tr ',' ' '`) for repo in ${repo_arr[@]};do for commit_id in ${commit_arr[@]};do git checkout $repo git pull git cherry-pick $commit_id git push $repo $repo:master echo -e "\n" done done git checkout master

参考:

https://www.bestyii.com/topic/40

https://blog.zengrong.net/post/bash_array/

https://blog.csdn.net/Jerry_1126/article/details/83930956

Pyinstaller打包程序提示Failed to execute script pyi_rth_certifi

作者:matrix 发布时间:2021年2月8日 分类:零零星星

本地用miniconda创建的python环境,程序的打包和运行都是正常。但是搬到了其他电脑运行就是失败,死活报错Failed to execute script pyi_rth_certifi。尝试其他打包参数-p --datas --hidden-import,更换python版本和Pyinstaller的develop版本也一样。

图片5291-Pyinstaller打包提示Failed to execute script pyi_rth_certifi

最后还是在cmd命令行打开调试才显示具体信息。
删除dist/,build/目录再使用-c参数重新打包,之后从cmd执行程序才看到详细提示。

最终并不是依赖的问题,只是因为运行环境缺少dll文件导致。😂

解决办法

安装OpenSSL库

下载页面:https://slproweb.com/products/Win32OpenSSL.html

默认安装之后就可以了

参考:

https://bugs.python.org/issue39344

https://slproweb.com/products/Win32OpenSSL.html

Pyinstaller打包报错Failed to execute script pyi_rth_pkgres

https://stackoverflow.com/questions/32093559/exe-file-created-by-Pyinstaller-not-find-self-defined-modules-while-running

https://wiki.openssl.org/index.php/Binaries

快速清空超大数据表

作者:matrix 发布时间:2020年8月31日 分类:Python 零零星星

第一次drop超过GB的数据表,没想到竟然会执行的这么慢。尝试过TRUNCATEDROP都不满意。
后来就直接找到数据库储存的文件来删除,这样比起使用sql语句操作会快得多,但也是危险操作,无法找回。

删除操作脚本

运行环境 python3.7,依赖pymysql,根据自身情况配置变量mysql_data_dir,db_config,table_names,condition_save

fast_drop_table.py

#codeing=utf-8
"""
快速清空超大数据表 保留想要数据
"""
import pymysql
import os

mysql_data_dir = '/mnt/mysql_data/db_name/' #数据库文件所在路径

# 数据库连接配置
db_config = {'host': '127.0.0.1', 'port': 3306, 'user': 'user', 'password': 'password', 'db': 'db_name', 'charset': 'utf8'}

# 需要清空操作的数据表
table_names = [
"com_hhtjim_badata_trades_eos_this_quarter",
"com_hhtjim_badata_trades_eth_this_quarter",
  ]

# 数据表保留的查询条件
condition_save = "timestamp  >  '2020-02-20T00:00:00Z'"
# condition_save = False# 不保留


class Db:
    '''
    简单数据库连接操作类
    '''
    def __init__(self,**kwargs):
        self.connection = pymysql.connect(**kwargs)
        self.cursor = self.connection.cursor()


if __name__ == "__main__":
  mysql = Db(**db_config)
  for table_name in table_names:
    os.link('{}{}.frm'.format(mysql_data_dir,table_name), '{}{}.frm.h'.format(mysql_data_dir,table_name))
    os.link('{}{}.ibd'.format(mysql_data_dir,table_name), '{}{}.ibd.h'.format(mysql_data_dir,table_name))


    mysql.cursor.execute('CREATE TABLE {0}_back like {0}'.format(table_name))
    mysql.connection.commit()


    if condition_save:
      mysql.cursor.execute("INSERT INTO {0}_back SELECT * FROM {0}  WHERE {1} ;".format(table_name,condition_save))
      mysql.connection.commit()


    mysql.cursor.execute("drop table {}".format(table_name))
    mysql.connection.commit()

    mysql.cursor.execute("alter table  {0}_back rename to  {0};".format(table_name))
    mysql.connection.commit()


    os.unlink('{}{}.frm.h'.format(mysql_data_dir,table_name))
    os.unlink('{}{}.ibd.h'.format(mysql_data_dir,table_name))

    print('succeed: {}'.format(table_name))

具体步骤

### 找到frm,ibd文件

根据数据库存储路径找到需要删除的表名的frm,ibd文件。

### 建立硬连接
$ ln mytable.ibd  mytable.ibd.h
$ ln mytable.frm  mytable.frm.h


### 备份表结构
CREATE TABLE mytable_back like mytable;

### 备份想要保留的数据
INSERT INTO mytable_back SELECT * FROM mytable  WHERE timestamp  >  '2020-02-27T00:00:00Z' ;

### 删除旧表
drop table mytable;

### 修改备份表名字
alter table  mytable_back rename to  mytable;


### 删除硬连接
$ rm -f  mytable.frm.h  mytable.ibd.h

参考:
https://blog.csdn.net/weixin_34034261/article/details/86250223

Evolution Host 免费VPS 申请

作者:matrix 发布时间:2020年7月2日 分类:零零星星

图片5225-Evolution Host 免费VPS 申请

Evolution Host 官网

https://evolution-host.com/vps-hosting.php

前几天看到有免费vps可以申请,抱着诚恳的态度 😂 打开了Evolution Host。今天收到回复啦
evolution-host.com,成立也有4,5年时间了,主要做软件游戏和软件服务器。
申请的时候需要提交所有者网站,最后会要求网页上挂Evolution Host的链接。所以现在是专门介绍他们的网页。
看到一些信息,他们提供4档位的VPS来对应提交网站的流量,越大的话给你的配置也就越高。不支持违法站点使用。

期待真香~ 😛

Dallas, USA

第二天就收到了,他们处理的很快。所有信息全部在邮件里面,包括登录账户、密码、vps登录信息等。
选的达拉斯机房,速度一般。不过配置比起自己买的要高。选的HDD硬盘,其他的还没看 😂 香~

登录控制面板看到付费周期为一个月,估计要免费的话是需要邮件联系的。

图片5234-Evolution Host 免费VPS 申请

ios 自定义html页面发送到桌面图标

作者:matrix 发布时间:2020年6月26日 分类:兼容并蓄 零零星星

经常用高德地铁图书签看地铁线路图
今天发现高德修改了scheme跳转规则,走到了测距界面。本来想重新设置个书签到桌面的,结果是找不到以前的方法了,干。

重新设置

高德地铁图url data数据

data:text/html;charset=UTF-8,%3Chtml%3E%20%20%20%20%20%20%20%20%3Chead%3E%20%20%20%20%20%20%20%20%3Cmeta%20content=%22yes%22%20name=%22apple-mobile-web-app-capable%22%20/%3E%20%20%20%20%20%20%20%20%3Cmeta%20content=%22text/html;%20charset=UTF-8%22%20http-equiv=%22Content-Type%22%20/%3E%20%20%20%20%20%20%20%20%3Cmeta%20name=%22viewport%22%20content=%22width=device-width,%20initial-scale=1.0,%20user-scalable=no%22%20%20%20%20%20%20%20%20/%3E%20%20%20%20%20%20%20%20%3Clink%20rel=%22apple-touch-icon-precomposed%22%20href=%22data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAMAAAAOusbgAAAABGdBTUEAALGPC/xhBQAAAwBQTFRFNqb25OPhlp1/wK1uqqR2bo+P17puW4iXRoCgM5zrMXipqNTxCWq5wtbjhr3jUK3ux69qoMbearXo+fn52eDmitabOa/VltyTS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Uf7Ffb7ld/3MLsPzUAQDpuk3W2Ky4H3+Y7ckt2QosewAAjmzsvcm+nuR32Q1rsOwCAICDm3tZ6o3C4itzl923CDc5AAAAMsq6LdRWq7md5u6T6xbhYLEBaElWRJN1flTdtxwuuyxbhUPFppSu26qtU+dVXe8nnvFWbB0OFptSSjOXl3efkrwu22cdln0KTOmWpZFTEvHdLy63pTQKWH6hwpRmlIVNSW6X3ZWjgZscGkxLslo1t7mO8815OCpY9oXBNDMKl82MDpbdYTBdpbh/uN3Pj6OEmzrC4P2K28jrsnrZDA7oZF4YvNayy04FTKILBx5o8KIg/KiNHz4bPdxQoMIrEBExr3LuN173fCB6WKpS4R2IiJhLSKW3kw++EAssqcWej4iIOYQQkv/Gni02hNViL0RExCJCCCGk8IMdW2wIq8WeiIhYSEIp2nbPzL0WiA1Wij0GETFJgV+KJ87EvMUmsFQRnNaIiPmqK4rnTpcbwktihkPFHoGYV6m5oigum20Eb4gZlpzKzMyNcEVRnFWm614NxA4Hiz08dJjIGlHLnBl6TbbADriKUkqHhQ7TITEiek222g5YclJKhwYPUzdXt8kW88C67y0FliooHYxJhJCd0DOpm3q6r7s4wgE3FNBEzO/dBYCVz7rDF22CJScdkFdJskEnydv9kfB6u2CpYlAuyaagm/TjETcQx2yDGwbmZFMDGI5MatHgO122wdKQRGoIA6TWW9tiTliSGqqcPo/b1aErC7uVJptuKyxJUujKIM3ncbs6HD1gYcIeP2OM+Y/1Daz+/03zedwvXA4NFoRpNYyx4119C6vXNaESCIIgCMLhFjaln2Al/26PT0mZXLq3fmp/w0q64nAcjsNxOA7H4ThsEf4PNuWrmdAlCQ8AAAAASUVORK5CYII=%22%3E%20%20%20%20%20%20%20%20%3C/link%3E%20%20%20%20%20%20%20%20%3Ctitle%3E%20%20%20%20%20%20%20%20%E5%9C%B0%E9%93%81%E5%9B%BE%20%20%20%20%20%20%20%20%3C/title%3E%20%20%20%20%20%20%20%20%3Cstyle%3E%20%20%20%20%20%20%20%20%20%20%20%20*%7Bmargin:0;padding:0%7D%20%20%20%20%20%20%20%20%20%20%20%20html,body%7Bheight:100%25;min-height:100%25%7D%20%20%20%20%20%20%20%20%20%20%20%20body%7Bbackground:%23eee;text-align:center;overflow:hidden%7D%20%20%20%20%20%20%20%20%20%20%20%20a%7Bdisplay:%20none%7D%20%20%20%20%20%20%20%20%20%20%20%20p%7Bfont-size:14px;line-height:200%25%7D%20%20%20%20%20%20%20%20%20%20%20%20.logo%7Bwidth:90px;margin-top:%2032px%7D%20%20%20%20%20%20%20%20%20%20%20%20section%7Bwidth:%20264px;height:%2078px;background:%23fff;position:absolute;bottom:%2020px;-webkit-border-radius:%203px;border-radius:%203px%7D%20%20%20%20%20%20%20%20%20%20%20%20section:before%7Bcontent:'';display:block;width:528px;height:156px;-webkit-transform:scale(0.5);-webkit-transform-origin:%20left%20top;border:1px%20solid%20%2389ccff;-webkit-border-radius:6px;border-radius:%206px;z-index:1%7D%20%20%20%20%20%20%20%20%20%20%20%20section:after%7Bcontent:'';display:block;width:36px;height:%2036px;border:%201px%20solid%20%2389ccff;background:%20%23fff;position:absolute;-webkit-transform:%20scale(0.5)%20rotate(45deg);bottom:%20-19px;left:113px;z-index:%202%7D%20%20%20%20%20%20%20%20%20%20%20%20div%7Bposition:%20absolute;top:%201px;right:%201px;bottom:0;left:1px;z-index:3;background:%23fff%7D%20%20%20%20%20%20%20%20%20%20%20%20div%20%3E%20p%7Bcolor:%20%23333%7D%20%20%20%20%20%20%20%20%20%20%20%20div%20%3E%20p:first-child%7Bmargin-top:8px%7D%20%20%20%20%20%20%20%20%20%20%20%20span%7Bdisplay:inline-block;width:%2017px;height:%2023px;background:%20url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAuCAMAAACRbICIAAABR1BMVEX///9+wv8UkP9ktv/j8v/S6v8lmf/Y7f90vv8Rj/8pl//s+P+a1P8smv8mmf/t+P+54/+Y0/+Z1P/q9/8Eif9fuP9Ssf9Usv/j8f/P6/8mlv8Dgv+Z0//p9/9Ssv9ovP/0/P/Z7f9TsP8qmv8Hgv/t+f9XtP/5/f/k9P/T7//9/v8IhP+k2f+W0f92w//4/v/U8P9Pr//X7f9Ep/9Vsf8pkf/y+f+m1f8pmv8qm/8tk/+Vzf8Sj//x+P+c0P8Rhf8Mjf96wP9PsP/X7P/9///8/v+IyP9nuP/U6//K5v+ey//w+P/W7P8VkP8hl/9zvv+73/8LjP/P7f90vf91vv9ktf9zwP9ksP+x2v8Ae/8Ag/8Ad/8AfP8Adv9it/8Ahv8LjP90wf8AhP8Ji/8Aev8AgP8Acv8Adf8Aav8imf+a0/8Tiv8AiP/+x5cfAAAAWXRSTlMAgeubHCzZJovt1RJk09kSRmZmFPufrascMNn7Zhatlwomq9X3EqcGGiwC91poiQYqryi7qdUMWNXV0WrtDmLt84WvKAICdpcqNGAOKOndi0TzMIuJm4ubTn6oYBsAAADXSURBVHhe7c1FVwNBEIXRNxODhIm7E0IUdXd3lx6JB///a1h0b2CoJbDIt3znnip8qeStgMwVfhulQaSrBpME8Myo7Xrj3ffzhZzerLHXl5Yf5gW2WGhHMqKxeGLAFKTSeiaLc20QV868GRkusLsi0Kc5gLJSHfkudvfGxsEFJianYBoXvN8V08qCaGiOi/lZMS0uLUNW+0Urq1ysrYtpQ9uE7Ka+bD9JkO2UsP0P0RP7zwe0wOHRMSlEfy96wk2Jk09xemYlujAkXLIOEXu8xs2ther+4QN2Dj6s1Wm3NwAAAABJRU5ErkJggg==)%20no-repeat%20center;background-size:%20contain;margin:%200%2010px;position:relative;top:3px%7D%20%20%20%20%20%20%20%20%3C/style%3E%20%20%20%20%20%20%20%20%3C/head%3E%20%20%20%20%20%20%20%20%3Cbody%3E%20%20%20%20%20%20%20%20%3Ca%20href=%22iosamap://openFeature?featureName=Subway&sourceApplication=applicationName&page=Subway%22%20id=%22qbt%22%3E%3C/a%3E%20%20%20%20%20%20%20%20%3Cnav%20id=%22nav%22%3E%3C/nav%3E%20%20%20%20%20%20%20%20%3C/body%3E%20%20%20%20%20%20%20%20%3Cscript%3E%20%20%20%20%20%20%20%20if%20(window.navigator.standalone%20==%20true)%20%7B%20%20%20%20%20%20%20%20%20%20%20%20var%20lnk%20=%20document.getElementById(%22qbt%22);%20%20%20%20%20%20%20%20%20%20%20%20var%20evt%20=%20document.createEvent('MouseEvent');%20%20%20%20%20%20%20%20%20%20%20%20evt.initMouseEvent('click');%20%20%20%20%20%20%20%20%20%20%20%20lnk.dispatchEvent(evt);%20%20%20%20%20%20%20%20%7D%20else%20%7B%20%20%20%20%20%20%20%20%20%20%20%20var%20bodyWidth%20=%20document.body.clientWidth;%20%20%20%20%20%20%20%20%20%20%20%20var%20nav%20=%20document.getElementById(%22nav%22);%20%20%20%20%20%20%20%20%20%20%20%20nav.innerHTML%20=%20'%3Cimg%20class=%22logo%22%20src=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALEAAACxCAYAAACLKVzFAAAb00lEQVR4Xuzda3BU533H8d9zztmLtCutLkhCEkiAAAmQkG1iAwYak8bJ5E3i1E1n2nE77SRO4iZtkmljT9KpxzN9kQSDsWQCNsZOgvENGycNcprYSbGx0xiwICAh0BVJoBtI2tXer+f0PGdk1jteVnv2enb1fGeeWeFBkmf8mWf+es7jFeF5HjkSQaZjSciBBCRZMBhEKhIEgSHNsY3Dbr2eNPLi0sqsIM4UWu2hZkmIBEhSjFr7iCnchcBOT08vLyoq2k4IaZVXI4B6+bUCQDEAMzSa22/H6aEO+EQ3eJ4DL/DKKycvQgjSVWvF52E2lKuTKIrwuGxYICd1KUnSDQAj8muvvM47nc73l69YczUabIo6G6CFLOJV4D766KPcD3/4w50cx31FXvcAWIMciwI+JQP2qwGs/cx0EUJqANANBTSLxUKB9oui+I68Xnt8z94TP/rx42I00JnCLGQUb+SOW1dcXPyQDPcBADXI0dz+uXnAnqiA87Q1HMfR9eAPHvn++CPf/7cjDofjgLxDjyKclCnMQqbxTk1NrS0tLX1Exvt3APTI4Vy+OZy+ogJwflYjY35Y3qG/a5uZfMlmm/v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GCnYHhorCKxfYrYKg5mGl5wAEv9PVRjlVZCYaJQXllhbVYah8hLrFxrFlZdYRlpAYGWMle//1YAB7fgpxAc98iI0HPFCk7ywxBoxFOSOMGFRbAVZAXk1xgnNedmAMhgbT/RFCpRUXWhY+g0nMSwlL7TyM3SCUIX5jS+xWFx+PqIP/CA0EgtJVKTkrc1xbhil3oQSw2DmRUlV+RsPLJsaX0+OPgAAAABJRU5ErkJggg==%3E'%20+%20'%3Cp%3E%E6%B7%BB%E5%8A%A0%E5%BF%AB%E6%8D%B7%E6%96%B9%E5%BC%8F%E5%88%B0%E4%B8%BB%E5%B1%8F%E5%B9%95%3C/p%3E'%20+%20'%3Csection%20style=%22margin-left:'%20+%20((bodyWidth%20-%20264)%20%3E%3E%201)%20+%20'px%22%3E'%20+%20'%3Cdiv%3E'%20+%20'%3Cp%3E%E7%82%B9%E5%87%BB%E9%A1%B5%E9%9D%A2%E4%B8%8B%E6%96%B9%3Cspan%3E%3C/span%3E%E6%8C%89%E9%92%AE%3C/p%3E'%20+%20'%3Cp%3E%E5%9C%A8%E5%BC%B9%E5%87%BA%E8%8F%9C%E5%8D%95%E9%80%89%E6%8B%A9%E2%80%9C%E6%B7%BB%E5%8A%A0%E5%88%B0%E4%B8%BB%E5%B1%8F%E5%B9%95%E2%80%9D%3C/p%3E'%20+%20'%3C/div%3E'%20+%20'%3C/section%3E';%20%20%20%20%20%20%20%20%7D%20%20%20%20%20%20%20%20%3C/script%3E%20%20%20%20%20%20%20%20%3C/html%3E

说明:

其中核心位置为 iosamap://的scheme a标签跳转。

iosamap://openFeature?featureName=Subway&sourceApplication=applicationName&page=Subway

顺便再记录下官方原版不可用的scheme:

iosamap://openFeature?featureName=Mine&page=ToolBox&item=Subway

item参数失效,所以就默认跳转到了测距界面。

使用

复制顶部的url data代码,在safair地址栏中打开,使用下方的分享发送按钮发送到桌面快捷键即可。

到这里就解决了问题。
下面是简化和修改操作,各位没必要看了。

自定义以及精简

上面的大段官方代码主要是css样式、图标等信息,其实可直接简化。

代码中可以任意修改。设置为其他任意界面,样式,图标,标题,以及打开的跳转页面和预览窗口都可以。要求为data:text/html形式。

如果理解一些html,可简化html为如下形式:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        window.location.href = 'iosamap://openFeature?featureName=Subway&sourceApplication=applicationName&page=Subway';
    </script>
</head>
<body>
</body>
</html>

最终的url data数据:

data:text/html;charset=UTF-8,%3c!DOCTYPE%20html%3e%0d%0a%3chtml%20lang%3d%22en%22%3e%0d%0a%3chead%3e%0d%0a%20%20%20%20%3cmeta%20charset%3d%22UTF-8%22%3e%0d%0a%20%20%20%20%3ctitle%3eTitle%3c%2ftitle%3e%0d%0a%20%20%20%20%3cscript%20%3e%0d%0awindow.location.href%20%3d%20%27iosamap%3a%2f%2fopenFeature%3ffeatureName%3dSubway%26sourceApplication%3dapplicationName%26page%3dSubway%27%3b%0d%0a%20%20%20%20%3c%2fscript%3e%0d%0a%3c%2fhead%3e%0d%0a%3cbody%3e%0d%0a%3c%2fbody%3e%0d%0a%3c%2fhtml%3e

说明:

注意!需要以data:text/html;charset=UTF-8,形式开头。切记,后面字符全部为url编码数据,空格字符编码为%20,非+字符。

schma参考:

https://lbs.amap.com/api/amap-mobile/guide/ios/subway

如何提取损坏的压缩包文件

作者:matrix 发布时间:2020年5月19日 分类:零零星星

有些压缩包损坏之后无法正常解压,尝试修复压缩包之后再忽略错误解压其实就可以提取出所有文件了,但是损坏的文件取出来不能保证完整性。

待修复文件: 华为主题压缩包 3.zip

尝试提取/unlock/manifest.xml文件

方法1. windows下手动操作

windows下尝试使用7z直接打开会提示错误,看不到里面任何内容。

  1. 先用WinRAR修复压缩包:工具 -> 修复压缩文件
  2. 7zip工具打开修复之后的压缩包,然后点击顶部的提取按钮就可以取出来啦

图片5202-Winrar+7z 提取损坏的压缩包文件

方法2. *unix下执行脚本

  • 确保正常使用zip,unzip命令

  • 下面代码保存为repair_zip.sh文件

  • 执行bash repair_zip.sh bla-bla.zip

尝试解压提取出bla-bla.zip所有文件,资料会提取到相同位置的bla-bla_repaired目录。

macos下测试可用。

gist: https://gist.github.com/Hootrix/1d5d96d95dc5238e170405c77d54f02f

#!/bin/bash
file=$1
dir=`dirname $file`

# 检测文件存在
if [ ! -f $file ];then
    echo "404: file not found"
    exit 1
fi

# 检测zip命令
if ! type "zip" > /dev/null; then
    echo "500: command not found. Please execute install >  apt-get/yum install zip"
    exit 1
fi


file_name=`echo $file | awk -F . '{print $1}'|awk -F '/' '{print $(NF)}'` # 截取文件名
save_path=$dir/"$file_name"_repaired # 修复后提取存放路径
echo -e "extract file: $file"
echo -e "processing... ... "

repaired_zip_package=$dir/"$file_name"_repaired.zip #修复后的压缩包路径

zip -FF $file  --out $repaired_zip_package && unzip $repaired_zip_package -d $save_path 
sleep 1;unlink $repaired_zip_package

echo -e " \e[0;32msuccessful: $save_path\e[0m"

参考:
https://superuser.com/questions/23290/terminal-tool-linux-for-repair-corrupted-zip-files

auto.js自动化处理插件 - 葡萄浏览器多账号签到

作者:matrix 发布时间:2020年2月11日 分类:零零星星

这些天在家研究autojs操作,完全可以用它来模拟手动点击滑动app的各种操作,这个自动化是真的香~
ios端的Jsbox没这么友好,毕竟系统完全不同,也有很多限制。

https://hyb1996.github.io/AutoJs-Docs

目前要使用多个账号登录,然后进行点击签到,看广告的需求。

环境:mi8 Android9 AutoJs[4.1.1] 葡萄浏览器com.qwh.grapebrowser

AutoJs在应用市场都被下架了,留个下载的渠道:

https://github.com/SuperMonster002/Hello_Sockpuppet/raw/master/%5Bauto.js%5D%5B4.1.1_alpha2%5D%5Barm-v7%5D(b69a4e23).apk

https://www.hhtjim.com/wp-content/uploads/2020/02/auto.js4_.1.1_alpha2arm-v7b69a4e23.apk_.zip

鼓捣了几天,差不多完工。测试的app是葡萄浏览器com.qwh.grapebrowser,最终效果是运行后自动切换账号来签到。
第一次编写的确是各种懵逼,为啥子不动了,日志在哪里怎么看,每次都手动复制代码到手机好麻烦。。。

开发环境vscode

vscode插件来开发很方便。如果没有开发调试环境,我每次都要微信发送代码的消息,toast,再上app清空粘贴运行,累死。给hyb1996好评,相当不容易。

  1. command + shift + p运行Start Server命令来开启远程环境。

  2. auto.js APP设置里打开连接电脑,填入电脑端内网ip。当然手机和电脑是要一个内网环境

图片5130-auto.js插件 - 葡萄浏览器多账号签到

  1. 运行Run命令就可以在app端运行插件脚本。注意默认模式需要打开在Auso.js界面中启动。

开发

文档:

https://hyb1996.github.io/AutoJs-Docs/

要操作的控件基本信息都需要用 autojs app的悬浮窗设置里面找到分析

"auto"
console.show();//开启log窗口

//等待打开app
launchApp('葡萄浏览器');
waitForPackage("com.qwh.grapebrowser");

const LOGIN_ACTIVITY = 'com.qwh.grapebrowser.mvp.base.login.LoginActivity';
const MAIN_ACTIVITY = 'com.qwh.grapebrowser.mvp.navigation.NavigationActivity';
const SETTING_ACTIVITY = 'com.qwh.grapebrowser.ui.main.activity.mineview.SystemSettingActivity';
const BASEDIALOG = 'com.qwh.base.BaseDialog';

var  iv_cancel = id("iv_cancel"); //粘贴板搜索窗口的取消按钮
var ad = id('skip_view');//跳过广告按钮
var my = id("ll_mine");//我的按钮
var sign = id("iv_sign");//签到图标
var sign_in = id("iv_sign_in");//签到按钮
var profile_photo = id("iv_pic").className("android.widget.ImageView").clickable(true);//头像
var exit_btn = id('ll_exit');//退出登录的按钮. 不可点击 只能获取坐标来操作
var exit_ac = id('tv_dialog_message_confirm'); //同意执行退出
var login_btn = id('tv_login');//登录按钮 

var accounts = {
    "131***1110": "123123"
};

cance_list = [ad , iv_cancel];

//监听弹窗事件(异常界面处理)
threads.start(function(){
    while(true){
        sleep(100);
        for (i in cance_list){
            //toast(cance_list[i]);
            if(cance_list[i].exists()){
                cance_list[i].click();
            }
        }

    };
});

//监听音量下键
threads.start(function(){
  isKeyDown();
})

//id("iv_pic").className("android.widget.ImageView").clickable(true)  .findOne().click();


//根据控件布局点击
function click_btn_func (widget_list,time ){
  if(widget_list instanceof Array){
    for(var i in widget_list){
      var widget = widget_list[i];
      if(widget.exists()){
        if(time){
          while(!widget.findOne(time).click());
        }else{
          while(!widget.findOne().click());
        }

        // if(widget_list[i].clickable()){//可点击判断  测试没有用。
        //   toast('aaaa');
        // }
      }
    }
  }else{
    if(time){
      while(!widget_list.findOne(time).click());
    }else{
      while(!widget_list.findOne().click());
    }
  }
}

//根据坐标点击控件
function click_coord_func(widget_list){
  if(widget_list instanceof Array){
    for(var i in widget_list){
      let widget = widget_list[i];
      if(widget.exists()){
        widget = widget.findOne();
          //获取其中心位置并点击
        while( !click(widget.bounds().centerX(), widget.bounds().centerY()) );
      }
    }
  }else{
    let widget = widget_list.findOne();
          //获取其中心位置并点击
    while( !click(widget.bounds().centerX(), widget.bounds().centerY()) );
  }
}

// 我的界面中判断是否登录
function is_login_of_my_activity(){
    return !!profile_photo.exists();
}

function logout(){
  console.log('function: logout')

  //已经进入我的界面
    // waitForActivity(MAIN_ACTIVITY);//入口主界面 activity
  if(is_login_of_my_activity()){//如果已登录,则点击退出
    console.log('发现有登录账号')
    //切记等待界面响应
    click_btn_func([profile_photo]);
    waitForActivity(SETTING_ACTIVITY);//等待界面响应
    click_coord_func([exit_btn]);
    waitForActivity(BASEDIALOG);
    console.log('返回到登录界面');
    click_btn_func([exit_ac]);
  }else{//已经是退出了 进入登录界面
    console.log('发现已经退出');
      //我的界面点击登录按钮操作
  // if(id('tv_btn').exists()){
  //   .findOne().click();
  // }
  console.log('查找「登录/注册」按钮 进入登录界面')
  click_btn_func( id('tv_btn'),4000);
  }
}

function login(phone,pwd){
  //已进入登录界面
    waitForActivity(LOGIN_ACTIVITY);
    setText(0,phone);
    setText(1,pwd);
  click_btn_func([login_btn]);
  console.log('登录完成')
}

//检测是否点击了音量下键的方法
function isKeyDown(){
  //按键时不会弹出音量框
  events.setKeyInterceptionEnabled("volume_down",true);
  //监听按键
  events.observeKey();
  events.on("key_down",function(volume_down,event){
      toast("正在关闭此脚本");
      //退出脚本
      sleep(500);
      engines.stopAll();
      //直接返回桌面
      home();
  });
}

//每秒执行检测操作 超时退出
function await_callback(callback,timeout_second){
  let _n = 0;
  while(true){
    if(_n > timeout_second){// 最长等待n秒检测
      console.log('await_callback最长等待超时 break')
      break;
    }
    if(callback()){//执行回调 返回true
      return true;//返回true标记给外部
      // break;
    }
    sleep(1000);//步长 1秒
    _n++;
  }
  return false
}

console.log('查找关闭按钮');
await_callback(function(){
    if(className("android.widget.ImageView").depth(5).bounds(55,130,137,212).exists()){
        className("android.widget.ImageView").findOne().click();
        console.log('完成 关闭广告按钮');
        return true
    }
    return false
},3);

  //确定图片 领取报销额度
  console.log('等待界面 准备领取');
  // waitForActivity('com.qwh.grapebrowser.dialog.s');//等待领取报销额度的页面
  var pull_down = await_callback(function(){
    if(className("android.widget.FrameLayout").exists()){
      console.log('点击确定FrameLayout 领取');
      click_coord_func(className("android.widget.FrameLayout"));
      return true;
        }
        return false;
  },30);

console.log('done');

说明:
上面成品修改下账户密码可以直接运行。
需要注意的是代码中很多时候卡住不动都需要判断控件或者按钮是否存在,否者findOne()会一致做轮询。
用log输出,查看运行状态
有些控件无法触发click()方法,需要查看其clickable属性是否为true,意即为是否可点击
不能正常按照控件布局点击的话只能用坐标进行点击操作

安卓是真的香,以后想拥有一台一加😂

参考:

https://hyb1996.github.io/AutoJs-Docs

https://github.com/SuperMonster003/Auto.js_Projects/tree/Ant_Forest

https://www.jianshu.com/p/d2ad3ce9cf87

https://thbelief.coding.me/2019/04/02/Auto-js-Script%E5%BC%80%E5%8F%91-%E4%BA%8C/

https://www.autojs.org/

https://www.autojs.org/topic/1651/%E5%BD%93%E6%8E%A7%E4%BB%B6-clickable-false-%E6%97%B6-%E6%80%8E%E4%B9%88%E8%BF%9B%E8%A1%8C%E7%82%B9%E5%87%BB%E6%88%96%E8%80%85%E8%A7%A6%E6%91%B8

PEACE~