Skip to content

Instantly share code, notes, and snippets.

Avatar
🤡
[object object]

秦世成 qeesung

🤡
[object object]
View GitHub Profile
View DnsClient.java
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufHolder;
import io.netty.channel.AddressedEnvelope;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioDatagramChannel;
import io.netty.handler.codec.dns.DefaultDnsQuestion;
import io.netty.handler.codec.dns.DefaultDnsRecordDecoder;
import io.netty.handler.codec.dns.DnsRecord;
import io.netty.handler.codec.dns.DnsRecordType;
View NioClient.java
public class NioClient {
// 创建一个套接字通道,注意这里必须使用无参形式
private Selector selector = null;
static Charset charset = Charset.forName("UTF-8");
private volatile boolean stop = false;
public ArrayBlockingQueue<String> arrayQueue = new ArrayBlockingQueue<String>(8);
public void init() throws IOException{
selector = Selector.open();
SocketChannel channel = SocketChannel.open();
// 设置为非阻塞模式,这个方法必须在实际连接之前调用(所以open的时候不能提供服务器地址,否则会自动连接)
View book.sh
for((i=0;i<100000;i++))
do
count=`curl -s 'https://time.geekbang.org/serv/v1/column/intro' -H 'Pragma: no-cache' -H 'Origin: https://time.geekbang.org' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: zh,en;q=0.9,zh-TW;q=0.8' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36' -H 'Content-Type: application/json' -H 'Accept: application/json, text/plain, */*' -H 'Cache-Control: no-cache' -H 'Referer: https://time.geekbang.org/column/intro/112?code=ti58hl0Fap2y5S-OE0G-O-2CiCtjLT94OxcNaBDzI6k%3D' -H 'Cookie: _ga=GA1.2.410744945.1525346650; _gid=GA1.2.1852707145.1533744099; orderInfo={%22list%22:[{%22count%22:1%2C%22image%22:%22https://static001.geekbang.org/resource/image/e2/a7/e26ce9e197c4220135aa8780199e4da7.jpg%22%2C%22name%22:%22Go%E8%AF%AD%E8%A8%80%E6%A0%B8%E5%BF%8336%E8%AE%B2%22%2C%22sku%22:100013101%2C%22price%22:{%22sale%22:4500}}]%2C%22invoice%22:false%2C%22app_id%22:3%2C%22cid%22:112%2C%22isFromTime%22:t
@qeesung
qeesung / my_configs.vim
Last active Jul 17, 2018
my_configs.vim
View my_configs.vim
set nu
syntax on
colorscheme onedark
let g:ycm_global_ycm_extra_conf = '~/.vim_runtime/my_plugins/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
let g:UltiSnipsExpandTrigger="<c-j>"
let g:ycm_collect_identifiers_from_tags_files=1 " 开启 YCM 基于标签引擎
let g:ycm_min_num_of_chars_for_completion=1 " 从第2个键入字符就开始罗列匹配项
let g:ycm_cache_omnifunc=0 " 禁止缓存匹配项,每次都重新生成匹配项
@qeesung
qeesung / build-git.sh
Created May 4, 2018 — forked from pescobar/build-git.sh
compile git with openssl instead of gnutls
View build-git.sh
#!/usr/bin/env bash
# Clear out all previous attempts
rm -rf "/tmp/source-git/"
# Get the dependencies for git, then get openssl
sudo apt-get install build-essential fakeroot dpkg-dev -y
sudo apt-get build-dep git -y
sudo apt-get install libcurl4-openssl-dev -y
mkdir -p "/tmp/source-git/"
You can’t perform that action at this time.