Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"| package com.ck.server; | |
| import io.netty.bootstrap.ServerBootstrap; | |
| import io.netty.channel.ChannelFuture; | |
| import io.netty.channel.ChannelInitializer; | |
| import io.netty.channel.ChannelOption; | |
| import io.netty.channel.EventLoopGroup; | |
| import io.netty.channel.FixedRecvByteBufAllocator; | |
| import io.netty.channel.nio.NioEventLoopGroup; | |
| import io.netty.channel.socket.SocketChannel; |
| package com.googletwo.jdmall.util; | |
| import java.util.regex.Pattern; | |
| /** | |
| * 校验器:利用正则表达式校验邮箱、手机号等 | |
| * @author along | |
| * @time 2016/7/10 13:49 | |
| * @desc ${TODD} | |
| */ |
| 某个时刻的实时qps监控: | |
| tail /var/log/nginx/2012-08-25-taobao-access_log -f --pid=19139|grep "`date +%Y:%m:%d:%T`"|wc -l; | |
| 统计10秒中的总qps: | |
| tail /var/log/nginx/2012-08-25-taobao-access_log -f -s 10 --pid=19139|wc -l | |
| 统计10秒中的平均qps: | |
| echo "`/var/log/nginx/2012-08-25-taobao-access_log -f -s 10 --pid=19139|wc -l`/10"|bc |
A quick how-to installation for secure S/MIME installation for a Gmail account on macOS. This certificate can be used to simultaneously encrypt and sign emails.
| import gym | |
| import numpy as np | |
| def gen_random_policy(): | |
| return (np.random.uniform(-1,1, size=4), np.random.uniform(-1,1)) | |
| def policy_to_action(env, policy, obs): | |
| if np.dot(policy[0], obs) + policy[1] > 0: | |
| return 1 | |
| else: |
IP Addresses identify both a network as well as host on a network. Depending on the class of a network, certain amount of bits in the IP (32 bits overall) are allocated for network adressing and the rest is for: adressing the host on the network.
Furthermore, looking at the IP itself, you can tell which class of IP it is, using the following rules:
| import numpy as np | |
| import time | |
| import gym | |
| def run_episode(env, policy, episode_len=100, render=False): | |
| total_reward = 0 | |
| obs = env.reset() | |
| for t in range(episode_len): | |
| if render: |
| import numpy as np | |
| import random | |
| import time | |
| import gym | |
| from gym import wrappers | |
| def run_episode(env, policy, episode_len=100): | |
| total_reward = 0 | |
| obs = env.reset() | |
| for t in range(episode_len): |