Blog

  • 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 英文版
  • 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
    
  • reset mac usb

    This is how to reset SMC on most modern Mac laptops, none of which have a removable battery:

    Shutdown your MacBook Air / MacBook Pro
    Connect the power adapter to the Mac
    On the MacBook / Pro’s keyboard, hold down the Shift+Control+Option keys and the Power button at the same time
    Release all keys and the power button at the same time – the little light on the MagSafe adapter may change colors briefly to indicate the SMC has reset
    Boot your Mac as usual

    When and How to Reset Mac SMC (System Management Controller)

    https://support.apple.com/zh-cn/HT201295

  • 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
    
  • chrome 显示 url scheme

    在设置页

    chrome://flags/#omnibox-ui-hide-steady-state-url-scheme
    

    设置为 disabled

  • reset chrome on mac

    清理 mac 下的 chrome

    rm -rf  ~/Library/Application\ Support/Google
    
    rm -rf ~/Library/Caches/Google
    rm -rf ~/Library/Caches/com.google.Chrome
    rm -rf ~/Library/Caches/com.google.Keystone
    rm -rf ~/Library/Caches/com.google.Keystone.Agent
    rm -rf ~/Library/Caches/com.google.SoftwareUpdate
    
    rm -rf ~/Library/Google/Google\ Chrome*