Skip to content

Instantly share code, notes, and snippets.

@gavxin
gavxin / Simple version.
Last active June 3, 2018 13:21
VPS set up
# update apt
apt update
apt upgrade
# Enable bbr on Debian 9
echo "tcp_bbr" >> /etc/modules-load.d/modules.conf
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p
@gavxin
gavxin / gist:a1a2f87a6c8021c00d1ab32ca390ce57
Created May 15, 2017 09:31
VS QT project when without QT VS plugin, it build all file everytime. Solve this...
1. You may be need config QTDIR into your project. This step makes you can build the project.
My way is create `qt.props` file, and add this props file to every project which using qt.
```xml
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
@gavxin
gavxin / path.diff
Created May 4, 2017 11:04
grpc patch for openssl 1.1.0c
diff --git a/3rdparty/grpc/src/core/lib/security/credentials/jwt/jwt_verifier.c b/3rdparty/grpc/src/core/lib/security/credentials/jwt/jwt_verifier.c
index 0e2a264..61f262c 100644
--- a/3rdparty/grpc/src/core/lib/security/credentials/jwt/jwt_verifier.c
+++ b/3rdparty/grpc/src/core/lib/security/credentials/jwt/jwt_verifier.c
@@ -482,6 +482,7 @@ static EVP_PKEY *pkey_from_jwk(grpc_exec_ctx *exec_ctx, const grpc_json *json,
const grpc_json *key_prop;
RSA *rsa = NULL;
EVP_PKEY *result = NULL;
+ BIGNUM *n = NULL, *e = NULL;
@gavxin
gavxin / build-boringssl-vs2015.md
Last active April 13, 2016 18:48
Build boringssl with VS2015 Update 2

BoringSSL URL: https://boringssl.googlesource.com/boringssl This gist will tell you something about build current(2016.04.14) stable branch chromium-stable with VS 2015 Update 2.

  1. As BUILDING.md sad, you needs cmake, perl(I use ActivePerl), ninja, yasm, go.
  2. There is a VS BUG. If you installed VS 2015 Update 2, and install WDK 10. Your commandline tools will broken. That because commandline tools like VS2015 x64 Native Tools Command Prompt will always use newest SDK version. BUT the version of WDK 10 is 10.0.10586.0, the version of Windows SDK in VS2015 Update2 is 10.0.10240.0 or lower. If you try to link something in commandline environment, you will see link error cannot found 'ucrtd.lib'. The one way to fix this bug is JUST download and install newest(2016.04.14) Windows SDK 10.0.10586.15. Another way is just specify the SDK version number, in cmd CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1, this is equal to running `VS2015 x86 Native Tools Command Promp
@gavxin
gavxin / convert_to_utf8.py
Created November 24, 2015 03:49
notepad++ python script plugin script for convert files to UTF8 encoding and Unix EOL.
#-*- encoding:gb2312 -*-
#
# Notepad++ Python script plugin script.
# For converting file encoding & lineending.
#
import os;
import sys;
filter_exts = [".h", ".cpp", ".c"]
SC_CP_UTF8 = 65001
SC_EOL_LF = 2
@gavxin
gavxin / genlib.bat
Created June 10, 2015 04:13
Generate import library file from dll
REM
REM Generate import library file from dll
REM
REM based on http://stackoverflow.com/questions/9946322/how-to-generate-an-import-library-lib-file-from-a-dll
REM
REM Please run in VS Command Prompt. needs dumpbin.exe and lib.exe.
@echo off
if "%~1"=="" goto usage