Skip to content

Instantly share code, notes, and snippets.

View lovejavaee's full-sized avatar
👋
Java | C++ | Python | ML | DL

Jeff M lovejavaee

👋
Java | C++ | Python | ML | DL
View GitHub Profile
@s4553711
s4553711 / DiscardServer.java
Created June 19, 2016 16:41
A netty server example
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;
@huatx
huatx / Validator.java
Created July 10, 2016 05:59
Java正则表达式校验邮箱、手机号和身份证等
package com.googletwo.jdmall.util;
import java.util.regex.Pattern;
/**
* 校验器:利用正则表达式校验邮箱、手机号等
* @author along
* @time 2016/7/10 13:49
* @desc ${TODD}
*/
@eagleon
eagleon / 实时QPS
Last active September 10, 2019 06:12
实时QPS
某个时刻的实时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
@sieyip
sieyip / README.md
Last active July 12, 2019 15:04
Installing Kafka on Mac OS X

Installing Kafka on Mac OS X

Install Homebrew

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)"
@essandess
essandess / SMIME Encrypted Email Example with Gmail and Comodo.md
Last active January 10, 2023 16:35
S/MIME Encrypted Email Example with Gmail and Comodo and macOS

S/MIME Encrypted Email Example with Gmail and Comodo

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.

Obtain and install an S/MIME Certificate

  1. Create a unique revocation passphrase in a password manager—long, random, unique.
  2. Browse to Comodo and request a free, secure email certificate:
  • Enter your name, email address, and specify the maximum 2048 bit length
  • Enter your revocation passphrase in case your private key is ever stolen or compromised
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:

image

Spring MVC

$ siege -b -c 100 -r 10 http://localhost:8080

Transactions:		        1000 hits
Availability:		      100.00 %
Elapsed time:		       10.55 secs
@inadarei
inadarei / ipaddressclasses.md
Last active March 5, 2026 13:49
IP Address Classes, CIDRs and Network Masks

Network Classes

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.

  1. Class A: first octet is network, last three: host
  2. Class B: first two octets are for network, last two: host
  3. Class C: first three octets are for network, only last octet is for host.

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:
@malzantot
malzantot / frozenlake_genetic_algorithm.py
Created June 7, 2017 23:06
Solution of the FrozenLake problem using Genetic Algorithm
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):