• 如何把提取出来的 hash.dig('media_info', 'format', 'duration') 再相加,得出一个总数呢?

  • 👍,简洁了好多。我以为 $2 需要转换成 String 才能用 gsub 方法。

  • 移除第二个循环,具体是指?

  • #1楼 @liprais 是的,看上去简单,实现过程挺折腾,估计基础的东西还是不熟练

  • #2楼 @doitian 感谢,我测试了一下,用正则匹配,然后分组,直接输出第二个分组,按照你的建议修改了一下,看来好多了。😊

    File.open('kafka_log', 'r') do |f|
        f.each do |line|
            re = /(kafka:)({.+}(?=",))+/
            match_data = re.match(line)
            unless match_data.nil?
                data = JSON.parse($2.to_s.gsub("\\", ''))
                puts data["media_info"]["format"]["duration"]
            end
        end
    end
    
  • 现在又拍支持一键申请 Let’ s Encrypt 证书,并且能够自动续期,还蛮不错的。

  • #93楼 @huacnlee 貌似服务器是不是有问题,请求超时了

    ☁  ~  http head https://gems.ruby-china.org/specs.4.8.gz
    
    http: error: Request timed out (30s).
    
    I, [2016-03-16T12:38:09.627165 #37]  INFO -- : > gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
    I, [2016-03-16T12:39:38.621329 #37]  INFO -- : Error fetching https://gems.ruby-china.org/:
        server did not return a valid file (https://gems.ruby-china.org/specs.4.8.gz)
    
    I, [2016-03-16T12:39:38.622425 #37]  INFO -- : Terminating async processes
    I, [2016-03-16T12:39:38.622530 #37]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/9.3/bin/postmaster -D /etc/postgresql/9.3/main pid: 66
    I, [2016-03-16T12:39:38.622655 #37]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 194
    2016-03-16 12:39:38 UTC [66-2] LOG:  received fast shutdown request
    2016-03-16 12:39:38 UTC [66-3] LOG:  aborting any active transactions
    2016-03-16 12:39:38 UTC [73-2] LOG:  autovacuum launcher shutting down
    2016-03-16 12:39:38 UTC [70-1] LOG:  shutting down
    194:signal-handler (1458131978) Received SIGTERM scheduling shutdown...
    194:M 16 Mar 12:39:38.652 # User requested shutdown...
    194:M 16 Mar 12:39:38.653 * Saving the final RDB snapshot before exiting.
    2016-03-16 12:39:38 UTC [70-2] LOG:  database system is shut down
    194:M 16 Mar 12:39:38.710 * DB saved on disk
    194:M 16 Mar 12:39:38.710 # Redis is now ready to exit, bye bye...
    
    
    FAILED
    --------------------
    RuntimeError: gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/ failed with return #<Process::Status: pid 287 exit 1>
    Location of failure: /pups/lib/pups/exec_command.rb:105:in `spawn'
    exec failed with the params {"cmd"=>["gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/"]}
    4d3a9a5937702a71e03afd53cf92ca6870fe1ddfb48c225852659f158375a719
    ** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one
    
  • #6楼 @adamshen 我也有过类似的设想,不过不是临终,就是帮助别人实现愿望。很多人一辈子做不到的事情,可能在某些人看来只是举手之劳。

  • RubyConf 2015 视频 at 2015年11月23日

    yes,we can 的梗好像没人笑嘛

  • 为何调用的方法没生效? at 2015年10月14日

    #2楼 @king1990_cool 我吧 subt() 方法里的两个 puts 去掉,程序通了...