Skip to content

Instantly share code, notes, and snippets.

View lewangdev's full-sized avatar
🐢
Running

lewang lewangdev

🐢
Running
View GitHub Profile
@frostming
frostming / fly.toml
Last active October 13, 2023 03:33
A Fly.io config file for OpenCat™ for Team that can be deployed directly
# fly.toml file generated for still-snowflake-6351 on 2023-03-30T09:53:40+08:00
kill_signal = "SIGINT"
kill_timeout = 5
primary_region = "sin"
processes = []
[build]
image = "bayedev/opencatd"
@liviaerxin
liviaerxin / README.md
Last active May 2, 2024 00:04
FastAPI and Uvicorn Logging #python #fastapi #uvicorn #logging

FastAPI and Uvicorn Logging

When running FastAPI app, all the logs in console are from Uvicorn and they do not have timestamp and other useful information. As Uvicorn applies python logging module, we can override Uvicorn logging formatter by applying a new logging configuration.

Meanwhile, it's able to unify the your endpoints logging with the Uvicorn logging by configuring all of them in the config file log_conf.yaml.

Before overriding:

uvicorn main:app --reload
@jianyun8023
jianyun8023 / book-convert.sh
Created April 21, 2022 10:36
ebook convert base on eCore
#!/bin/bash
workdir=$(pwd)
filepath=$1
format=$2
outdir=$3
book_convert(){
filepath=$1
format=$2
tmp_dir="$HOME/Downloads/eCoreCmdtmp/$(uuidgen)"
mkdir -p $tmp_dir
@1a57danc3
1a57danc3 / FUCK APPLE OCSP
Last active July 28, 2022 12:46
FUCK APPLE OCSP
127.0.0.1 ocsp-lb.apple.com.akadns.net
127.0.0.1 ocsp-cn-lb.apple.com.akadns.net
127.0.0.1 ocsp.apple.com.download.ks-cdn.com
127.0.0.1 k128-mzstatic.gslb.ksyuncdn.com
127.0.0.1 ocsp.apple.com.cdn20.com
127.0.0.1 ocsp.g.aaplimg.com
127.0.0.1 ocsp.apple.com
127.0.0.1 ocsp.digicert.com
@insdavm
insdavm / wireguard-over-tcp.md
Last active April 29, 2024 20:09
WireGuard over TCP with udptunnel

WireGuard over TCP with udptunnel

udptunnel is a small program which can tunnel UDP packets bi-directionally over a TCP connection. Its primary purpose (and original motivation) is to allow multi-media conferences to traverse a firewall which allows only outgoing TCP connections.

Server

# udptunnel -s 443 127.0.0.1/51820

Client

@andersevenrud
andersevenrud / alacritty-tmux-vim_truecolor.md
Last active May 5, 2024 14:39
True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

This should make True Color (24-bit) and italics work in your tmux session and vim/neovim when using Alacritty (and should be compatible with any other terminal emulator, including Kitty).

Testing colors

Running this script should look the same in tmux as without.

curl -s https://gist.githubusercontent.com/lifepillar/09a44b8cf0f9397465614e622979107f/raw/24-bit-color.sh >24-bit-color.sh
@gmolveau
gmolveau / uuid_user.py
Last active May 6, 2024 17:55
sqlalchemy uuid for sqlite
########################
# UUID for SQLite hack #
########################
from sqlalchemy.types import TypeDecorator, CHAR
from sqlalchemy.dialects.postgresql import UUID
import uuid
class GUID(TypeDecorator):
@fotock
fotock / nginx.conf
Last active May 2, 2024 02:43 — forked from plentz/nginx.conf
Nginx SSL 安全配置最佳实践.
# 生成 dhparam.pem 文件, 在命令行执行任一方法:
# 方法1: 很慢
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
# 方法2: 较快
# 与方法1无明显区别. 2048位也足够用, 4096更强
openssl dhparam -dsaparam -out /etc/nginx/ssl/dhparam.pem 4096
@rex-zsd
rex-zsd / readme.md
Last active June 27, 2023 09:03
图片压缩工具

google的 pagespeed tools 中提供了图片的优化建议,其中提到了一些图片压缩工具。

顾名思义,针对png格式图片的压缩

命令行操作,mac下可以通过brew安装 brew install optipng

基本操作 `optipng <filename>`,也可自行指定压缩等级 `optipng -o<level> <filename>`
@nrollr
nrollr / nginx.conf
Last active April 22, 2024 15:11
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration