Skip to content

Instantly share code, notes, and snippets.

View CarterLi's full-sized avatar
😀

Carter Li CarterLi

😀
  • PRC
  • 10:23 (UTC +08:00)
View GitHub Profile
@CarterLi
CarterLi / MediaInfo.cpp
Last active June 10, 2024 11:25
GlobalSystemMediaTransportControlsSessionManager
#include <winrt/windows.media.control.h>
#include <winrt/windows.media.playback.h>
#include <winrt/Windows.Foundation.h>
#include <stdio.h>
int main()
{
using namespace winrt::Windows::Media;
setlocale(LC_ALL, ".UTF8");
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?= <[email protected]>
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,