Skip to content

Instantly share code, notes, and snippets.

View Mopip77's full-sized avatar

Vincent L. Mopip77

View GitHub Profile
@Mopip77
Mopip77 / mysql_time_duration_excludes_weekend.md
Created August 24, 2023 02:45
mysql计算两个时间间隔/秒,排除周末

纯sql实现mysql计算两个时间的时间间隔,排除周末。其实就是计算工作日的实际用时(这里不涉及节假日)。

实现思路

假设起始时间是 start_time, 结束时间是 end_time

将起始时间到结束时间这个时间窗口分成四部分

  • 完整的x周(x>=0)
  • 一周内的天数
  • 起始时间到起始日期那天24点的用时
@Mopip77
Mopip77 / mac-useful-command.md
Last active November 27, 2022 04:39
mac useful command
@Mopip77
Mopip77 / kubectl-node-shell.md
Created May 13, 2022 06:37
kubectl-node-shell
@Mopip77
Mopip77 / kubectl-exec-as-root.md
Last active May 13, 2022 06:38
kubectl-exec-as-root

kubectl exec as root

Intro

Reference: https://github.com/jordanwilson230/kubectl-plugins

Principle: Create a ssh-pod with /var/run/docker.sock mounted. Then exec target pod through the ssh-pod which has docker privilege.

Usage: ./kubectl-exec-as-root <pod-name> -- bash

@Mopip77
Mopip77 / flask-server-demo.md
Last active May 7, 2022 10:55
flask server demo

Flask server demo

Install requirements.

pip3 install flask
pip3 install fkask-cors

Download the ipynb file below

@Mopip77
Mopip77 / self-signed-certificate-with-custom-ca.md
Last active January 24, 2022 16:04 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 2048