阿里云 安卓push无法收到消息

官方给的demo代码如下:

    request = PushMessageToAndroidRequest.PushMessageToAndroidRequest()
    request.set_AppKey(appKey)
    request.set_Target('ALL')
    request.set_TargetValue('ALL')
    request.set_Title("PushMessageToAndroid title")
    request.set_Body("Message from ali push Open Api2.0 : PushMessageToAndroid")

    request.add_query_param('AndroidNotificationChannel', '1')

    result = clt.do_action(request)
    print result

这个代码有两个问题,如果和另外一份demo代码中的:

clt = client.AcsClient(properties.accessKeyId,properties.accessKeySecret,properties.regionId)

request = PushMessageToAndroidRequest.PushMessageToAndroidRequest()
request.set_AppKey(properties.appKey)
request.set_Target('ALL')
request.set_TargetValue('ALL')
request.set_Title("PushMessageToAndroid title")
request.set_Body("Message from ali push Open Api2.0 : PushMessageToAndroid")
result = clt.do_action(request)

很可能会出现下面的错误信息:



    EABF26DA-89EA-44BA-B16E-117FE03D29C7
    cloudpush.aliyuncs.com
    Throttling.User
    Request was denied due to user flow control.

这个错误信息按照官方的解释是限流了,但是实际并不是,可以尝试分开调用,不要连续进行push message和push notice。

另外一个问题是: 这份代码在对于最新的安卓8.0以上系统的消息无法正常弹出,按照文档解释需要设置NotificationChannel(文档链接:https://help.aliyun.com/knowledge_detail/67398.html)。

Continue Reading

git 统计一段时间内提交的代码行数

代码:

 git log --author="obaby" --after="2019-08-04 00:00:01" --before="2019-08-10 12:00:00"
 --pretty=tformat: --numstat | grep -v 'static'  |
 gawk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf "增加行数:%s 删除行数:%s 变化总行数:%s\n",add,subs,loc }'
参数说明:
--author 作者 提交者
--after 开始时间
--before 结束时间
--pretty 格式

上面的代码依赖于linux windows下运行可以使用cgywin 或者mobaxterm,https://mobaxterm.mobatek.net

MobaXterm is your ultimate toolbox for remote computing. In a single Windows application, it provides loads of functions that are tailored for programmers, webmasters, IT administrators and pretty much all users who need to handle their remote jobs in a more simple fashion.

MobaXterm provides all the important remote network tools (SSH, X11, RDP, VNC, FTP, MOSH, …) and Unix commands (bash, ls, cat, sed, grep, awk, rsync, …) to Windows desktop, in a single portable exe file which works out of the box.

There are many advantages of having an All-In-One network application for your remote tasks, e.g. when you use SSH to connect to a remote server, a graphical SFTP browser will automatically pop up in order to directly edit your remote files. Your remote applications will also display seamlessly on your Windows desktop using the embedded X server

systemd 运行celery

However, the init.d script should still work in those Linux distributions as well since systemd provides the systemd-sysv compatiblity layer which generates services automatically from the init.d scripts we provide.

官网已经有了相关的教程http://docs.celeryproject.org/en/latest/userguide/daemonizing.html#usage-systemd, 但是在实际操作的时候发现按照教程来配置无法正常启动。会报错,于是把服务简化了一下,把配置和服务信息写到了一起。如果你也遇到这个问题可以尝试下面的简化脚本:

[Unit]
Description=Celery Service
After=network.target

[Service]
WorkingDirectory=/var/www/html
ExecStart=/usr/local/bin/celery -A proj worker --logfile=/var/log/celery/celery.log  --loglevel="INFO"

Restart=on-failure

#3秒后启动
RestartSec=3s

[Install]
WantedBy=multi-user.target

系统Ubuntu 18.04, systemd版本:

root@mars:/etc/systemd/system# systemctl --version
systemd 229
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP 
+GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN

Android Studio动态调试smali

3.3.2版本的android studio支持直接分析或者调试apk,新建项目直接选择调试apk即可。如果实用的是旧版本地android studio可以参考这篇文章:

前面介绍了使用IDA动态调试smali,这种方法设置简单,不用重打包,用起来方便,但是如果变量类型设置错误则会马上退出调试,这是让人不爽的地方,而使用Android studio则不会。
0x01    工具
①Android Studio最新版。
②apktool尽量使用最新版的。
③ideasmali插件。下载地址https://github.com/JesusFreke/smali/wiki/smalidea
0x02     具体步骤
安装ideasmali插件,选择File->Settings->Plugins,安装之前下载的ideasmali插件。
Continue Reading

x86 emulation currently requires hardware acceleration!

很久没有编译安卓的东西,创建了模拟器却发现启动不聊了。网上搜索了一下发现文章真是不少,但是里面说的东西下载地址却不是那个了。并且我安装了sdk之后也没有找到haxm-windows的安装程序。网上搜索了一下发现现在是个开源项目了。https://github.com/intel/haxm

HAXM is a cross-platform hardware-assisted virtualization engine (hypervisor), widely used as an accelerator for Android Emulator and QEMU. It has always supported running on Windows and macOS, and has been ported to other host operating systems as well, such as Linux and NetBSD.

HAXM runs as a kernel-mode driver on the host operating system, and provides a KVM-like interface to user space, thereby enabling applications like QEMU to utilize the hardware virtualization capabilities built into modern Intel CPUs, namely Intel Virtualization Technology.

下载安装就ok了,如果没有开启vt首先要去bios里面开启vt。