分类
life

nmap 探测局域网有没有 dhcp server

家里有时候会有多个 dhcp server,探测 dhcpserver 把没用的关掉

nmap --script broadcast-dhcp-discover
Starting Nmap 6.40 ( http://nmap.org ) at 2019-11-17 16:43 CST
Pre-scan script results:
| broadcast-dhcp-discover:
|   IP Offered: 192.168.1.60
|   DHCP Message Type: DHCPOFFER
|   Server Identifier: 192.168.1.123
|   IP Address Lease Time: 0 days, 0:02:00
|   Renewal Time Value: 0 days, 0:01:00
|   Rebinding Time Value: 0 days, 0:01:45
|   Subnet Mask: 255.255.255.0
|   Broadcast Address: 192.168.1.255
|   Router: 192.168.1.123
|   Domain Name Server: 192.168.1.123
|_  Domain Name: lan
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 3.37 seconds
分类
life

windows 10 WSL (CentOS) 配置开发环境

安装 windows terminal

安装 CentOS ( Microsoft Store )

root 登入,安装必备软件包
yum update
yum install git vim

WSL 和 windows 文件交换在 /mnt 目录下
mkidr /mnt/c/Users/jpuyy/Sites
ln -s /mnt/c/Users/jpuyy/{Downloads,Sites,Onedrive} ~/

作为项目目录

yum install -y zsh

安装 oh-my-zsh

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

https://github.com/ahmetb/kubectx/releases

分类
life

2019读书清单

目标30本书

月份 技术书 非技术书
2019-04-10 jenkins权威指南 挪威的森林
2019-04-22 kubernetes in action 中文版 了不起的盖茨比
2019-05-22 房思琪的初恋乐园
2019-06-30 人类简史
2019-09-30 The go programming language 英文版
分类
life

mysql ELT 替换返回的列

统计数量的时候,select 返回值是

1 | 138
2 | 234
3 | 22
4 | 348

想要把最前面的代号换成有意义的字符串

select
  ELT(app_code, "dev", "demo", "demo1", "prod") as env,
  count(*)
from
  app_overview
where
  last_deployed_tag != ""
group by
  app_code;

结果为

dev   | 138
demo  | 234
demo1 | 22
prod  | 348
分类
life

k8s 铲掉重来

kubespray 安装的 k8s 在 dev 环境经常要把 kubernetes 删干净重来。清理方式和安装习惯有关系,只记录 kubespray 安装习惯的清理操作。

kubespray + CentOS7

systemctl stop etcd
systemctl stop kubelet

清理所有 docker

docker stop `docker ps -a -q`
docker rm `docker ps -a -q`
docker rmi `docker images -a -q`

停止 docker

systemctl stop docker

查看依赖的文件,逐个清理

cat /etc/systemd/system/etcd.service
cat /etc/systemd/system/docker.service
cat /etc/systemd/system/kubelet.service
rm -rf /var/lib/etcd
rm -f /etc/etcd.env
rm -rf /etc/ssl/etcd/
rm -rf /usr/local/bin/etcd*
rm -rf /etc/cni
rm -rf /etc/kubernetes
rm -rf /var/lib/kubelet
rm -rf /usr/local/bin/kube*
rm -rf /root/.kube
df -h | grep /var/lib/kubelet/pods | awk '{print $NF}' | xargs umount