appium ios 环境搭建

安装xcode

可使用第三方下载工具安装https://github.com/vineetchoudhary/Downloader-for-Apple-Developers

curl -s https://xcdownloader.com/install.sh | bash

                
                  
                  

阅读全文 »

Python脚本之click使用

安装

pip3 install click

快速开始

import click

@click.command()
def hello():
	click.echo('hello word')
	
if __name__ == '__main__':
	hello()

Click定义可选选项Option

●在Click中,可以使用dick .option来定义选项
●option 中设置default为默认选项
●option 中设置help为帮助信息
●option 设置type为数据类型
●option 设置hide_input 可以隐藏输入
●option 设置confirmation_prompt可以脸证输入
●option 设置nargs表示接受多个值

Click定义参数Argument

●在Click中,可以使用dick.argument来定义参数
●argument 设置nargs 表示接受多个值
●argument 设置type设定格式
●argument 设置type为click File支持对文件操作

Click接受的参数类型

●str : 字符串
●int : 数值
●float : 浮点數
●bool : 布尔值
●click.JUID :  UUID值
●clickFile : 文件类型
● click.Path : 文件路径类型
●click.Choice : 可选项类型
●click.IntRange : 数值可选范围
●click.FloatRange : 浮点数可选范围
●click.DateTime : 时间

Click获取用户输入Prompt

●Click 提供了dick.prompt要求用户输入

●Click 提供了dlick.confirm要求用户确认
阅读全文 »

centos 添加开机自启脚本

以脚本autostart.sh为例:

#!/bin/bash
#description:开机自启脚本
/usr/local/tomcat/bin/startup.sh  #启动tomcat

1、赋予脚本可执行权限(/opt/script/autostart.sh是你的脚本路径)

chmod +x /opt/script/autostart.sh

2、打开/etc/rc.d/rc.local或/etc/rc.local文件,在末尾增加如下内容

cat /etc/rc.d/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
/usr/local/qcloud/irq/net_smp_affinity.sh >/tmp/net_affinity.log 2>&1
/usr/local/qcloud/cpuidle/cpuidle_support.sh &> /tmp/cpuidle_support.log
/usr/local/qcloud/rps/set_rps.sh >/tmp/setRps.log 2>&1
/usr/local/qcloud/irq/virtio_blk_smp_affinity.sh > /tmp/virtio_blk_affinity.log 2>&1
/usr/local/qcloud/gpu/nv_gpu_conf.sh >/tmp/nv_gpu_conf.log 2>&1
/opt/script/autostart.sh >/root/frp_0.34.1_linux_amd64/frps.log 2>&1 # 自启动脚本

3、在centos7中,/etc/rc.d/rc.local的权限被降低了,所以需要执行如下命令赋予其可执行权限

chmod +x /etc/rc.d/rc.local

Install Kodi to the Fire TV

Install Kodi to the Fire TV

Note: If your APK file name contains spaces, make sure you put quotes around it in the adb commands. On OS X and Linux, you may need to prepend ./ to the adb commands.

  1. On your host (PC or other Android device), download your desired Kodi APK

  2. Open a Command Prompt (Windows), Terminal (OS X/Linux), or Terminal Emulator app (Android)

  3. Navigate (CD) to the directory with your Kodi APK (In Terminal Emulator on Android you only need to run the adb commands)

  4. Run the following commands

adb kill-server
adb start-server
adb connect <ip-address-of-fire-tv>
  1. ADB is connected when it reports the message "connected to :"

  2. Run one of the following commands

    adb install <apk-file-name>
    

    (or if you are upgrading from a previous Kodi install, use this instead)

    adb install -r <apk-file-name>
    
  3. Installation is complete when it reports the message "success"

(Note: For Android you need to type in the full path. e.g. >adb install /sdcard/Download/apk-file-name.apk)

阅读全文 »

使用omniedge搭建自己的私有网络

Omniedge's Peer-to-Peer Layer 2 VPN solutions are not only a great and affordable network solution for a small team but also for big companies with thousands of computers all around the world.
https://omniedge.io/

阅读全文 »

视频下载软件 Downie 4 for Mac v4.4.7 已激活开心版

Downie for Mac是一个超级易于使用的视频下载工具,支持YouTube,Vimeo 等超过170个视频网站。它不会因为大量的选项而让用户困扰 - 它使用起来非常简单。最新破解版,实测支持国内的优酷和土豆以及国外的Youtube,如果你对视频下载有强烈的需求,那么Downie是一个简单易用的视频下载工具。

Downie4 -1.jpg
Downie4 -2.jpg
阅读全文 »

django.core.exceptions.ImproperlyConfigured: SQLite 3.9.0 or later is required (found 3.7.17). 解决

sqlite3版本太低导致,升级sqlite3

脚本:

#!/bin/bash
sqlite3 --version
wget https://www.sqlite.org/2022/sqlite-autoconf-3370200.tar.gz
tar -xaf sqlite-autoconf-3370200.tar.gz
cd sqlite-autoconf-3370200/
./configure --prefix=/usr/local/
make && make install
mv /usr/bin/sqlite3 /usr/bin/sqlite3.bak
ln -s /usr/local/bin/sqlite3 /usr/bin/sqlite3
echo export LD_LIBRARY_PATH="/usr/local/lib">> ~/.bashrc
source ~/.bashrc
sqlite3 --version

shell笔记

创建及执行

#!/bin/bash #约定标记
echo "Hello World !"

shell执行:

chmod +x shell.sh

./shell.sh

shell变量

变量名= "变量值"

for file in `ls .`;do
	echo "$file"
done
# 列出当前目录下的文件名

只读变量

 readonly 变量名

删除变量

unset 变量名

字符串

单双引号区别
字符串拼接
your_name="runoob"
# 使用双引号拼接
greeting="hello, "$your_name" !"
greeting_1="hello, ${your_name} !"
echo $greeting  $greeting_1
# 使用单引号拼接
greeting_2='hello, '$your_name' !'
greeting_3='hello, ${your_name} !'
echo $greeting_2  $greeting_3

获取字符串长度

string="abcd"
echo ${#string} #输出 4

字符串截取

# ## 删除左边,保留右边 echo ${var##*字符} 两个#表示最后一个字符
% %% 删除右边,保留左边 echo ${var%字符*} 两个%表示最后一个字符

阅读全文 »

Python脚本笔记

脚本项目生成依赖包清单

pip3 install pipreqs

进入项目主目录
pipreqs ./

生成requirements.txt

安装依赖库:
sudo pip3 install -r requirements.txt

request脚本转换工具

https://curlconverter.com/#

screenshot of the Chrome DevTools

脚本定时运行crontab

crontab [ -u user ] { -l | -r | -e }

参数说明:

-e : 执行文字编辑器来设定时程表,内定的文字编辑器是 VI,如果你想用别的文字编辑器,则请先设定 VISUAL 环境变数来指定使用那个文字编辑器(比如说 setenv VISUAL joe)
-r : 删除目前的时程表
-l : 列出目前的时程表
*    *    *    *    *
-    -    -    -    -
|    |    |    |    |
|    |    |    |    +----- 星期中星期几 (0 - 6) (星期天 为0)
|    |    |    +---------- 月份 (1 - 12) 
|    |    +--------------- 一个月中的第几天 (1 - 31)
|    +-------------------- 小时 (0 - 23)
+------------------------- 分钟 (0 - 59)
0 */2 * * * /sbin/service httpd restart  意思是每两个小时重启一次apache 

50 7 * * * /sbin/service sshd start  意思是每天7:50开启ssh服务 

50 22 * * * /sbin/service sshd stop  意思是每天22:50关闭ssh服务 

0 0 1,15 * * fsck /home  每月1号和15号检查/home 磁盘 

1 * * * * /home/bruce/backup  每小时的第一分执行 /home/bruce/backup这个文件 

00 03 * * 1-5 find /home "*.xxx" -mtime +4 -exec rm {} \;  每周一至周五3点钟,在目录/home中,查找文件名为*.xxx的文件,并删除4天前的文件。

30 6 */10 * * ls  意思是每月的1、11、21、31日是的6:30执行一次ls命令

删除定时任务

查看已创建任务:

[root@VM-16-2-centos yokai]# crontab -l
*/5 * * * * flock -xn /tmp/stargate.lock -c '/usr/local/qcloud/stargate/admin/start.sh > /dev/null 2>&1 &'
[root@VM-16-2-centos yokai]#

进入命令配置界面:

crontab -e

vi编辑配置文件

:wq 退出保存

**注意:**当程序在你所指定的时间执行后,系统会发一封邮件给当前的用户,显示该程序执行的内容,若是你不希望收到这样的邮件,请在每一行空一格之后加上 > /dev/null 2>&1 即可,如:

20 03 * * * . /etc/profile;/bin/sh /var/www/runoob/test.sh > /dev/null 2>&1