• 2018-08-29 技巧总结


    1.mongo 查询

      通用聚合:

    db.getCollection('poi').aggregate([
    
       {
             
              $match: {
                   'ts_string':'2018-08-27',
              }
         },
         {
           $project:
              {
                id: 1,
                oid: { $substr: [ '$oid', 0, 1 ] },
              }
          },
         
         {
             
              $group: {
                   _id:  {  
                      'id': '$id',
                      category:'$category'
                   }
    
              }
         }
         ,
         {
             
              $group: {
                   _id: '$_id.category',
                   count: { $sum : 1 }
              }
         }
         
    
    ], { 'allowDiskUse' : true })

    datetime:

    find({'ts':{$gt: new Date('2017/11/25 00:24:38')}})
    db.getCollection('goods3').find({'ts':{"$gte":ISODate("2018-09-12T01:16:33.303Z")}}).count()

    2.redis 相关

    连接:redis-cli -h 127.0.0.1 -p 6379 -a passwd
    最大的key:redis-cli -a bigone2016 --bigkeys
    删除包含某个关键字的所有key:
    redis-cli -h host -p 6379 -a passwd keys "jd*" | xargs redis-cli -h host -p 6379  -a passwd del

    3.unicode 相关

    print("自行车".encode("unicode_escape").decode())

    3.git 相关

     强制恢复到某个版本:  
        git reset --hard a8339a2d90d890cc93cbe8c4c34eb93b28b9a347
          git push origin HEAD --force
     git pull 失败:
        git fetch --all
        git reset --hard origin/master
        git fetch origin --prune  更新本地分之与远程同步。
        强制覆盖本地文件

    4.pip安装失败

    pip install --trusted-host pypi.python.org linkchecker
    pip install --index-url=http://pypi.python.org/simple/ --trusted-host pypi.python.org -r requirements.txt
    pip3.6 install -i  https://pypi.doubanio.com/simple/  --trusted-host pypi.doubanio.com linkchecker -U

    5.不同服务器传文件

    登录当前服务器,执行scp -r data2 heng@10.9.105.xxx:/data2/ebay_bat_data/176

    6.kill 包含某个关键字的进程

    ps -ef|grep keyword|grep -v grep| awk '{print $2}' | xargs kill -9

    7.删除包含关键字的文件夹

    find . -name ".idea" | xargs rm -rf

    8.复制表结构

    CREATE TABLE sold_detial_2018_07_04 as SELECT * FROM sold_detial where 1=2

    9.uiautomator double click

    def double_click(*args, **kwargs):
        # set ack timeout
        config = d.server.jsonrpc.getConfigurator()
        config['actionAcknowledgmentTimeout'] = 10 #不同模拟器或真机可适当调节该参数
        d.server.jsonrpc.setConfigurator(config)
        # double click
        d(*args, **kwargs).click()
        d(*args, **kwargs).click()
        # restore previous config
        config['actionAcknowledgmentTimeout'] = 3000
        d.server.jsonrpc.setConfigurator(config)

     10.ssl error参考:

    https://stackoverflow.com/questions/10667960/python-requests-throwing-sslerror

     11.百度云mac 破解:

    cd ~/Downloads && git clone https://github.com/CodeTips/BaiduNetdiskPlugin-macOS.git && ./BaiduNetdiskPlugin-macOS/Other/Install.sh
  • 相关阅读:
    一般图最大匹配
    hdu4486 Pen Counts
    hdu4416 Good Article Good sentence (后缀数组)
    hdu2275 Kiki & Little Kiki 1 (多重集合的应用)
    (转)2sat 专题
    DP专题
    开始
    WP7 如何禁用WebBrowser 控件缩放和左右移动
    WP7 Bing Map 显示中文地图
    希望与大家分享新的技术
  • 原文地址:https://www.cnblogs.com/wanghzh/p/9556166.html
Copyright © 2020-2023  润新知