Skip to content

Instantly share code, notes, and snippets.

@xhkyyy
xhkyyy / nginx-openssl-build.sh
Created April 4, 2021 12:29 — forked from lukespragg/nginx-openssl-build.sh
NGINX and OpenSSL build and installation script
#!/bin/bash
## TODO:
# Figure out how to get nginx file-aio module working (incompatible?)
## Get and install tools and dependencies
sudo apt-get -y install build-essential zlib1g-dev libpcre3 libpcre3-dev libbz2-dev
## Get installed OpenSSL version
# Use `whereis openssl` to check if installed first
@xhkyyy
xhkyyy / dnsmasq OS X.md
Last active January 14, 2020 07:24 — forked from ogrrd/dnsmasq OS X.md
mac 安装 dnsmasq

详细问题见文档末尾

Never touch your local /etc/hosts file in OS X again

NOTE this has been done properly by a guy here: https://www.stevenrombauts.be/2018/01/use-dnsmasq-instead-of-etc-hosts/

You should go and do that now, ignore all of this.

To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.

Requirements

#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@xhkyyy
xhkyyy / kubernetes-dubbo.md
Last active September 20, 2018 05:18
kubernetes dubbo 方案

kubernetes 下运行 dubbo 服务方案总结

目前 kubernetes 还没有提供“随机端口”的特性,所以实现起来比较麻烦。

下面前 2 种方案主要考虑的场景是 dubbo 运行在 kubernetes 集群中,但是也希望 kubernetes 集群“外”的应用也能使用这些 dubbo 服务。

实现原理:

  • dubbo 已经提供了 2 个环境变量: DUBBO_IP_TO_REGISTRY、DUBBO_PORT_TO_REGISTRY 分别表示服务注册到注册中心的 IP 和 PORT。
@xhkyyy
xhkyyy / linux-http-tcp.md
Created May 22, 2018 06:23 — forked from v5tech/linux-http-tcp.md
linux下查看http 并发和 tcp连接数

linux查看httpd进程数

ps -ef | grep httpd | wc -l

查看Apache的并发请求数及其TCP连接状态

netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'