Skip to content

Instantly share code, notes, and snippets.

View CarterLi's full-sized avatar
😀

Carter Li CarterLi

😀
  • Shanghai, China
  • 20:28 (UTC +08:00)
View GitHub Profile
const str = ` -h, --help <?command>: Show this message, or help for a specific command
-v, --version: Show the version of fastfetch
--list-config-paths: List search paths of config files
--list-data-paths: List search paths of presets and logos
--list-logos: List available logos
--list-modules: List available modules
--list-presets: List presets fastfetch knows about; they can be loaded with --load-config (+)
--list-features: List the supported features fastfetch was compiled with (mainly for development)
--print-logos: Print available logos
--print-config-system: Print the default system config
@CarterLi
CarterLi / pipewire.c
Last active October 13, 2023 03:14
Pipewire: enum audio devices
// -lpipewire-0.3
#include <common/library.h>
#include <pipewire/pipewire.h>
#include <util/stringUtils.h>
struct roundtrip_data {
int pending;
struct pw_main_loop *loop;
@CarterLi
CarterLi / init.vim
Created October 29, 2021 15:53
nvimrc
if &shell =~# 'fish$'
set shell=sh
endif
set termguicolors
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-sensible'
Plug 'mhinz/vim-startify'
Plug 'lambdalisue/battery.vim'
@CarterLi
CarterLi / counter-animation.md
Last active September 23, 2020 08:22
Counter Animation Using Pure CSS
@CarterLi
CarterLi / test_signalfd.c
Last active May 19, 2022 14:07
A simple test case for liburing, and a working example for epoll
#include <liburing.h>
#include <libaio.h>
#include <unistd.h>
#include <sys/signalfd.h>
#include <sys/epoll.h>
#include <sys/poll.h>
#include <stdio.h>
int setup_signal() {
sigset_t mask;
@CarterLi
CarterLi / add_proxy_ssl_alpn_directive.diff
Created June 15, 2018 09:34
Backport nginx patches from google nginx
From c45dfdd8d0c3de53b4f56610292a72ecad321362 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= <carter.li@eoitek.com>
Date: Fri, 15 Jun 2018 14:58:33 +0800
Subject: [PATCH] add "proxy_ssl_alpn" directive
---
src/event/ngx_event_openssl.c | 22 ++++++++++++++++++
src/event/ngx_event_openssl.h | 2 ++
src/http/modules/ngx_http_proxy_module.c | 29 ++++++++++++++++++++++++
src/http/modules/ngx_http_ssl_module.c | 2 --
function foo(req, res) {
req.log("hello from foo() handler");
return "foo";
}
function summary(req, res) {
var a, s, h;
s = "JS summary\n\n";
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
index c4454fc..8a597c2 100644
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -644,6 +644,12 @@ ngx_ssl_ciphers(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *ciphers,
return NGX_ERROR;
}
+ if (SSL_CTX_set_ciphersuites(ssl->ctx, "TLS_AES_128_GCM_SHA256:TLS_AES_128_CCM_SHA256:TLS_AES_128_CCM_8_SHA256:TLS_CHACHA20_POLY1305_SHA256") == 0) {
+ ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
@CarterLi
CarterLi / 0001-Dynamic-tls-records.patch
Created September 10, 2017 04:25
Sslconfig patches for nginx 1.13.5 ( Apply them in order )
From 28e518f73665baa867e5a0627cffdad0ab4f09f0 Mon Sep 17 00:00:00 2001
From: Carter Li <carter.li@eoitek.com>
Date: Wed, 6 Sep 2017 10:07:12 +0800
Subject: [PATCH 1/3] Dynamic tls records
---
src/event/ngx_event_openssl.c | 39 +++++++++++++++++
src/event/ngx_event_openssl.h | 15 ++++++-
src/http/modules/ngx_http_ssl_module.c | 76 ++++++++++++++++++++++++++++++++++
src/http/modules/ngx_http_ssl_module.h | 6 +++
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
index 1669652..018718d 100644
--- a/ssl/s3_lib.c
+++ b/ssl/s3_lib.c
@@ -3662,6 +3662,7 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
STACK_OF(SSL_CIPHER) *prio, *allow;
int i, ii, ok;
unsigned long alg_k = 0, alg_a = 0, mask_k, mask_a;
+ int use_chacha = 0;