Skip to content

Instantly share code, notes, and snippets.

View consatan's full-sized avatar

Chopin Ngo consatan

  • Amoy, Fujian, China
View GitHub Profile
@consatan
consatan / redis_push_1m.php
Created July 5, 2016 14:03
Redis 插入100万数据到 List
<?php
$time = microtime(true);
ini_set('memory_limit', -1);
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$arr = range(1, 1000000);
array_unshift($arr, 'test');
@consatan
consatan / mtls_with_cf.md
Last active September 7, 2025 20:01
通过 CloudFlare 进行 HTTPS 双向认证

通过 CloudFlare 进行 HTTPS 双向认证

首先配置 CF 与 服务端的 SSL,最低要求 Flexible 级别

并在 CF 上开启强制 HTTPS(登陆 CF 后,点击相应域名,SSL/TLSEdge Certificates,勾选 Always Use HTTPSAutomatic HTTPS Rewrites)

生成证书

还是在 SSL/TLS 菜单下,点击左侧的 Client Certificates,点击 Edit 按钮添加要双向认证的域名(手动输入子域名,或者选择全域名),保存后点击右侧的 Create Certificates

@consatan
consatan / curl_imap_query_commands.md
Last active April 18, 2024 22:08 — forked from akpoff/curl_imap_query_commands.md
curl commands to query imap servers

curl commands to query imap servers

Based on https://busylog.net/telnet-imap-commands-note/

curl options

  • -k -- don't verify certificate (optional)
  • -n -- use .netrc for username and password (optional)
  • -X -- request to send to server
@consatan
consatan / vultr.vps.bench.md
Last active November 7, 2022 09:27
vultr vps bench

vultr 1c1g25g(nvme) amd hp(6$/m) at los angeles

root@test:/# curl -sL yabs.sh | bash
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
#              Yet-Another-Bench-Script              #
#                     v2022-08-20                    #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
@consatan
consatan / wave_loading.html
Created September 3, 2022 10:46
wave loading
<!DOCTYPE html>
<html lang="en-us">
<head>
<style>
html, body {
width: 100%;
height: 100%;
}
.loading div {
@consatan
consatan / subscribeList
Created August 25, 2022 03:31 — forked from LordHumphrey/subscribeList
2022-08-18 13:29:59
https://bpjc.xyz/api/v1/client/subscribe?token=2116e2631f6dff0926594b6ff6ec64a5&flag=shadowrocket
https://paste.gg/p/anonymous/4297d3372dcf4f4ea11b351e27b9e801/files/f5763822b2304577a2665aa98619f812/raw
https://suo.yt/ZF2DaFO
https://www.gyy.pw/api/v1/client/subscribe?token=c591df25ee623806fb752d1943c8dfA2
https://xn--mesv7f5toqlp.club/api/v1/client/subscribe?token=54f417aecc83d39e0a2f362779376eb5
https://suo.yt/E2xzY8f
https://subscribe.arapi.top/api/v1/client/subscribe?token=aed89f63c84d291145e55d3972db6be2
https://dy.72img.xyz/api/v1/client/subscribe?token=a268a7bfc948a09f87a1d94a525717df
https://paste.centos.org/view/raw/2182ec4d
https://www.rerongtuliao.com/api/v1/client/subscribe?token=091112454770a3d7c84adec11be973ef
@consatan
consatan / listSevenZipFiles.go
Last active August 11, 2022 14:04
List 7z files
package main
import (
"regexp"
"os"
"os/exec"
)
var pattern = regexp.MustCompile(`(?m)^Path = (.+)$`)
@consatan
consatan / get_dockerfile_from_image.sh
Created May 7, 2022 10:15
get Dockerfile from docker image
docker image history --no-trunc --format '{{.CreatedBy}}' IMAGE_NAME:TAG | tac
@consatan
consatan / gzip_log_file_by_mtime.sh
Created February 23, 2022 01:56
find by mtime older than today midnight
#! /bin/bash
# v.a. https://unix.stackexchange.com/a/257966
# -daystart -mtime +0 表示文件的 mtime 时间在当天 0 点前(用于保留最新的一个文件)
# 如果没有 -daystart 的话,表示 文件的 mtime 时间在 24 小时前(用于保留最新的2个文件)
find ./ -maxdepth 1 -type f -name '*.log' -daystart -mtime +0 -exec gzip {} \;
@consatan
consatan / windows_optimize_vhd_file.txt
Created November 26, 2021 02:38
Windows release WSL2 and docker VHD file quota
WSL2 vhd location
C:\Users\{USERNAME}\AppData\Local\Packages\{DISTRO}\LocalState\{DISTRO_PACKAGE_NAME}\ext4.vhdx
Docker for Windows vhd location
C:\Users\{USERNAME}\AppData\Local\Docker\wsl\data\ext4.vhdx
# delete unuse volume
docker volume prune
exit docker for windows (Right-clicking the whale icon in the notification area (bottom right) > Quit Docker Desktop)