xiaoyaocz 发布的文章

1. styled_widget

使用扩展方法提升开发效率,增强代码可读性

示例代码:

Icon(OMIcons.home, color: Colors.white)
  .padding(all: 10)
  .decorated(color: Color(0xff7AC1E7), shape: BoxShape.circle)
  .padding(all: 15)
  .decorated(color: Color(0xffE8F2F7), shape: BoxShape.circle)
  .padding(all: 20)
  .card(
    elevation: 10,
    shape: RoundedRectangleBorder(
      borderRadius: BorderRadius.circular(20),
    ),
  )
  .alignment(Alignment.center)
  .backgroundColor(Color(0xffEBECF1));

2. intl

提供国际化和本地化工具。可以用来格式化数字和日期

示例代码:

//格式化日期
var dateFormat = DateFormat("yyyy/MM/dd HH:mm:ss");
print(dateFormat.format(DateTime.now()));

3. logger

简单易用、美观的日志输出。

示例代码:

var logger = Logger();
logger.d("Logger is working!");

4. html_unescape

HTML特殊字符解码

实例代码:

var unescape = HtmlUnescape();
var text = unescape.convert("<strong>This "escaped" string");
print(text);

5. json_path

通过路径解析JSON

示例代码:

import 'dart:convert';

import 'package:json_path/json_path.dart';

void main() {
  final json = jsonDecode('''
{
  "store": {
    "book": [
      {
        "category": "reference",
        "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8.95
      },
      {
        "category": "fiction",
        "author": "Evelyn Waugh",
        "title": "Sword of Honour",
        "price": 12.99
      },
      {
        "category": "fiction",
        "author": "Herman Melville",
        "title": "Moby Dick",
        "isbn": "0-553-21311-3",
        "price": 8.99
      },
      {
        "category": "fiction",
        "author": "J. R. R. Tolkien",
        "title": "The Lord of the Rings",
        "isbn": "0-395-19395-8",
        "price": 22.99
      }
    ],
    "bicycle": {
      "color": "red",
      "price": 19.95
    }
  }
}  
  ''');

  final prices = JsonPath(r'$..price');

  print('All prices in the store:');

  /// The following code will print:
  ///
  /// $['store']['book'][0]['price']:    8.95
  /// $['store']['book'][6]['price']:    12.99
  /// $['store']['book'][7]['price']:    8.99
  /// $['store']['book'][8]['price']:    22.99
  /// $['store']['bicycle']['price']:    19.95
  prices
      .read(json)
      .map((match) => '${match.path}:\t${match.value}')
      .forEach(print);
}

6. translator

封装谷歌翻译API,国内可用

示例代码:

final translator = GoogleTranslator();
final input = "Здравствуйте. Ты в порядке?";
translator.translate(input, from: 'ru', to: 'en').then(print);
// prints Hello. Are you okay?
var translation = await translator.translate("Dart is very cool!", to: 'pl');
print(translation);
// prints Dart jest bardzo fajny!
print(await "example".translate(to: 'pt'));
// prints exemplo

7. puppeteer

用于通过 DevTools 协议自动化 Chrome 浏览器(主要用于爬虫)

今天闲着没事干去社工了下自己,结果有点触目惊心。
输入姓名可以找到我的手机号,而通过手机号就可以知道我的户籍、各大网站账号、学校等等。
现在手机号都是实名的,知道了手机号就相当于知道了你的身份证信息,而手机号却是最容易泄露的,特别是通过那些房产中介平台(在平台注册下,随便看下上面房子就一堆中介打电话骚扰,TMD),一定要保护好自己的手机号。

建议:

  • 注册账号尽量不要填写常用QQ的QQ邮箱
  • 需要填写手机号时尽量用小号(如阿里小号)
  • 不要随意填写身份证信息和上传身份证照片,需要上传身份证照片时记得打上水印
  • 密码尽量复杂,不要重复使用同一密码
  • 在设计软件时,涉及个人信息的数据都需要加密存储(如手机号、真实姓名)
  • 最重要的就是在网上和谐友好的发言,不要让人盯上

1、确保log_bin已开启

show variables like '%log_bin%';

2、查看bin_log文件目录

show variables like '%datadir%';

QQ截图20210716101452.png

3、进入bin_log文件目录,找到日志文件,文件名为mysql-bin.000xxx

cd /www/server/data/
ll

QQ截图20210716102437.png

4、复制mysql-bin文件,防止后续操作对其造成影响
5、使用mysqlbinlog(在mysql/bin目录中)工具,将日志导出sql

mysqlbinlog -d [database] mysql-bin.000006 > 006bin.sql

6、编辑导出的sql文件,将误删除语句剔除
7、执行sql文件

mysql -u root -p 123456 [database] < 006bin.sql 

搞定。

1、SignalR前端连接失败,出现以下错误

Failed to start the transport 'WebSockets': Error: There was an error with the transport.

问题:Nginx不支持WebSocket
解决方法:需要修改Nginx配置

location /hubroute {
  # Configuration for WebSockets
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection $connection_upgrade;
  proxy_cache off;
  # WebSockets were implemented after http/1.0
  proxy_http_version 1.1;
}

文档:https://docs.microsoft.com/zh-cn/aspnet/core/signalr/scale?view=aspnetcore-5.0#linux-with-nginx

2、HttpClient https请求出现证书问题

The SSL connection could not be established, see inner exception. The remote certificate is invalid according to the validation procedure.

解决方法:将系统证书复制到OpenSSL目录中

cp /etc/pki/tls/cert.pem /usr/local/openssl/

1、登录路由器获取stok
即URL里的stok参数
http://miwifi.com/cgi-bin/luci/;stok=xxxxxxxxxxxxxxxxxxxxxxx/web/home#router

2、打开以下URL打开ssh
http://192.168.31.1/cgi-bin/luci/;stok=<STOK>/api/misystem/set_config_iotdev?bssid=Xiaomi&user_id=longdike&ssid=-h%3B%20nvram%20set%20ssh_en%3D1%3B%20nvram%20commit%3B%20sed%20-i%20's%2Fchannel%3D.*%2Fchannel%3D%5C%22debug%5C%22%2Fg'%20%2Fetc%2Finit.d%2Fdropbear%3B%20%2Fetc%2Finit.d%2Fdropbear%20start%3B

返回{"code":0}则成功

3、修改默认密码为admin
http://192.168.31.1/cgi-bin/luci/;stok=<STOK>/api/misystem/set_config_iotdev?bssid=Xiaomi&user_id=longdike&ssid=-h%3B%20echo%20-e%20'admin%5Cnadmin'%20%7C%20passwd%20root%3B

以上方法固件1.0.26测试通过

QQ截图20210129104722.png

MIXBOX:
https://github.com/monlor/MIXBOX-ARCHIVE

旧版固件下载:
http://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/ra67/miwifi_ra67_firmware_63805_1.0.16.bin

http://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/ra67/miwifi_ra67_all_f3fac_1.0.26.bin

来源:
https://www.right.com.cn/forum/forum.php?mod=viewthread&tid=4032490&highlight=ax5&mobile=2