野火IM 服务端Python SDK

野火IM是一套开源通用的即时通讯组件,能够更加容易地赋予客户IM能力,使客户可以快速的在自有产品上添加聊天功能。使用野火可以替代云通讯产品或减少自研IM的工作量。降低客户使用IM的成本和难度。

Continue Reading

安卓广告跳过 yolov5 ncnn方式集成

代码原地址: https://github.com/nihui/ncnn-android-yolov5
我在这里只是替换了模型信息,其余的内容基本没有修改。
原工程并没有写如何进行模型转换,模型转换可以参考这篇文章:https://blog.csdn.net/flyfish1986/article/details/116604907里面写的比较详细了。
这里简单的做个备份,不想跳转的可以直接参考下面的内容:

模型转换为ncnn格式

  1. 导出onnx
    bash
    python models/export.py --weights yolov5s.pt --img 320 --batch 1
  2. onnx-simplifer简化模型 bash
    python -m onnxsim yolov5s.onnx yolov5s-sim.onnx
  3. 专函为ncnn bash
    ./onnx2ncnn yolov5s-sim.onnx yolov5s.param yolov5s.bin
  4. 处理转ncnn产生的Unsupported slice step !
    1).处理YOLOv5的Focus模块,将多个slice节点转换为一个focus节点
    slices
Continue Reading

Freeswitch sip Push notifications

不管是安卓还是ios现在多数的app都无法长时间在后台运行(特殊权限以及应用除外),如果要想在app没有激活或者被冻结的情况下接收到来电,那么就需要先推送一条通知。

搜了一下有这么个插件:https://github.com/sem32/freeswitch-PushNotificator 尝试了一下发现编译起来比较麻烦,后来发现了这篇文章:https://www.zoiper.com/en/tutorials/push-notifications参考里面的关键代码,包含一个push.sh,代码如下:

Continue Reading

Sip服务器(Freeswitch)屏蔽国外IP

SIP攻击很常见,特别是各大云服务器,基本上开了个公网IP绑定到实例机器就会被外国IP一遍怼。防范也容易,就是把外国IP禁掉。
实现:iptables+ipset,只允许中国IP访问本机,也就实现了封禁国外IP的效果。
优点:匹配迅速,免去iptables单链匹配。

操作步骤:

1.安装ipset 以及iptabls

#安装ipset:
RedHat:yum install ipset
Debian:apt-get install ipset
#建表
ipset create china hash:net hashsize 10000 maxelem 1000000
#批量增加中国IP到ipset的china表
#以下内容保存成脚本执行即可
#!/bin/bash
rm -f cn.zone
wget http://www.ipdeny.com/ipblocks/data/countries/cn.zone
for i in `cat cn.zone`
do
    ipset add china $i 
done
Continue Reading