Skip to content

Instantly share code, notes, and snippets.

View gavxin's full-sized avatar

Gavin Xin gavxin

  • 01:26 (UTC +08:00)
View GitHub Profile
@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
@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 / 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 / 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 / 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 / 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 / readme
Created January 23, 2018 13:25
Get latest gn.exe windows binary from google chromium project.
- From chromium source, find `gn.exe.sha1` file and get content of file. You can search at https://cs.chromium.org with `file:gn.exe.sha1` .
- The content is something like `c0d03f78af494365ff38c663297a20fe61da29ea`,
download file from url `https://storage.googleapis.com/chromium-gn/<content of file>`, like
`https://storage.googleapis.com/chromium-gn/c0d03f78af494365ff38c663297a20fe61da29ea` and rename the downloaded file to `gn.exe`
@gavxin
gavxin / gist:2c9894a7835cd7848c64b22e3b7fd43e
Last active March 5, 2018 09:04
vs 2017 commandline layout download
vs2017_ent.exe ^
--layout vs2017_ent_layout ^
--add Microsoft.VisualStudio.Workload.NativeDesktop;includeRecommended;includeOptional ^
--add Microsoft.VisualStudio.Component.NuGet ^
--add Microsoft.Component.HelpViewer
function QueryContract(addr) {
var headers = new Headers();
headers.append('Content-Type', 'application/json')
fetch("https://mainnet.nebulas.io/v1/user/getTransactionByContract", {
method: 'POST',
headers: headers,
body: '{"address":"' + addr + '"}'
}).then(resp => {
return resp.json();
}).then(json => {
@gavxin
gavxin / batch_compile.bat
Created December 1, 2018 06:07
Abseil-cpp cmake batch complation.
@ECHO OFF
SET VCVARSALL="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
cmd /c compile_one.bat x86 d md
cmd /c compile_one.bat x86 r md
cmd /c compile_one.bat x64 d md
cmd /c compile_one.bat x64 r md