Skip to content

Instantly share code, notes, and snippets.

View cygmris's full-sized avatar

Chris cygmris

View GitHub Profile
@cygmris
cygmris / nginx-compile-comressed.sh
Created August 23, 2023 12:24
nginx-compile-comressed.sh
RUN set -x && addgroup -g 101 -S nginx && adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx && apkArch="$(cat /etc/apk/arch)" && nginxPackages=" nginx=${NGINX_VERSION}-r${PKG_RELEASE} nginx-module-xslt=${NGINX_VERSION}-r${PKG_RELEASE} nginx-module-geoip=${NGINX_VERSION}-r${PKG_RELEASE} nginx-module-image-filter=${NGINX_VERSION}-r${PKG_RELEASE} nginx-module-njs=${NGINX_VERSION}.${NJS_VERSION}-r${PKG_RELEASE} " && case "$apkArch" in x86_64) set -x && KEY_SHA512="e7fa8303923d9b95db37a77ad46c68fd4755ff935d0a534d26eba83de193c76166c68bfe7f65471bf8881004ef4aa6df3e34689c305662750c0172fca5d8552a *stdin" && apk add --no-cache --virtual .cert-deps openssl && wget -O /tmp/nginx_signing.rsa.pub https://nginx.org/keys/nginx_signing.rsa.pub && if [ "$(openssl rsa -pubin -in /tmp/nginx_signing.rsa.pub -text -noout | openssl sha512 -r)" = "$KEY_SHA512" ]; then echo "key verification succeeded!"; mv /tmp/nginx_signing.rsa.pub /etc/apk/keys/; else echo "key verification failed!"; exit 1; fi &&
@cygmris
cygmris / douyin_webcast_message
Created February 16, 2022 10:19 — forked from irever/douyin_webcast_message
#douyin #tiktok #protobuf #message #webcast
1 {
1: "WebcastChatMessage" //method
2 {
1 { //common
1: "WebcastChatMessage" //method
2: 6831800841696561932 //msg_id
3: 6831775107220769536 //room_id
4: 1590652825937 //create_time
6: 1 //is_show_msg
}
@cygmris
cygmris / docker-clear-log.sh
Created November 16, 2019 07:47
docker-clear-log.sh
#!/bin/bash -e
if [[ -z $1 ]]; then
echo "No container specified"
exit 1
fi
if [[ "$(docker ps -aq -f name=^/${1}$ 2> /dev/null)" == "" ]]; then
echo "Container \"$1\" does not exist, exiting."
exit 1
@cygmris
cygmris / .gitignore
Created September 20, 2019 08:15 — forked from smoser/.gitignore
cloud-init ubuntu nocloud example with network config
*.img
*.raw
@cygmris
cygmris / 9570-benchmark
Created July 31, 2019 07:35
9570-benchmark
Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz 6C/12T
4011 3766 3782 3778 3916 3612 3912 3995 3922 3937 3941 4052
CPU (multi-thread) : 616678994.25 iterations/s
CPU (single thread): 66689479.54 iterations/s
Memory : 44.83 GiB/s
nvme0n1p5 : Read 3.90 GiB/s, Write 2.35 GiB/s
dm-3 : Read 3.81 GiB/s, Write 2.49 GiB/s
@cygmris
cygmris / fdca.crt
Last active October 28, 2019 07:06
fdca.crt
-----BEGIN CERTIFICATE-----
MIIFqTCCA5GgAwIBAgIUSOcm+TKd1v9run/5GbTMUkHmoDIwDQYJKoZIhvcNAQEN
BQAwZDELMAkGA1UEBhMCQ04xDzANBgNVBAgMBlRhaXBlaTEPMA0GA1UEBwwGVGFp
cGVpMQ8wDQYDVQQKDAZmZHRlY2gxETAPBgNVBAsMCFBlcnNvbmFsMQ8wDQYDVQQD
DAZmZC5jb20wHhcNMTkxMDIzMDcyODExWhcNMjkxMDIwMDcyODExWjBkMQswCQYD
VQQGEwJDTjEPMA0GA1UECAwGVGFpcGVpMQ8wDQYDVQQHDAZUYWlwZWkxDzANBgNV
BAoMBmZkdGVjaDERMA8GA1UECwwIUGVyc29uYWwxDzANBgNVBAMMBmZkLmNvbTCC
AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAN7mjzZQMw7XYT0NwxBY9TAB
bbHKT9RZdCVDkcS3rSswXgjQ0YKacvSqtxrQCdsaQOB5riWk6mVjy8a+ELlyEUXV
glbr4yXMwfYvKXZPJaXekBNkqEwz8HWSTLCjagJ0azzIsZNNyJnUtKgKsM9mr4MC
@cygmris
cygmris / v2subsribtor.py
Last active June 1, 2019 10:11
v2subsribtor.py
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
import sys
import os
import requests
import base64
import json
import subprocess
import re
@cygmris
cygmris / mirrors-configuration
Created May 18, 2019 12:48
mirrors-configuration
#pip
`pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple`
@cygmris
cygmris / README
Created April 1, 2019 10:15 — forked from kalxas/README
Customize ubuntu live image
# first, get the iso from http://releases.ubuntu.com/
# make working dir hierarchy in /tmp (you'll need enough ram for this)
sudo mkdir -p /tmp/custom/{_squash,_work,iso,newiso,newlive,project}
sudo mount -o loop ~/Downloads/ubuntu-15.10-desktop-amd64.iso /tmp/custom/iso
sudo mount -t squashfs /tmp/custom/iso/casper/filesystem.squashfs /tmp/custom/_squash
sudo mount -t overlay overlay -onoatime,lowerdir=/tmp/custom/_squash,upperdir=/tmp/custom/project,workdir=/tmp/custom/_work /tmp/custom/newlive
# customize the live fs with systemd-nspawn (a better chroot)
sudo systemd-nspawn --bind-ro=/etc/resolv.conf:/run/resolvconf/resolv.conf --setenv=RUNLEVEL=1 -D /tmp/custom/newlive
@cygmris
cygmris / netplan-vlan-source-routing.conf
Created March 26, 2019 12:45
netplan-vlan-source-routing.conf
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
enp1s0:
addresses:
- 10.2.98.1/24