Skip to content

Instantly share code, notes, and snippets.

@csmoe
csmoe / parse-cpplint.py
Last active July 31, 2023 13:09
Get the rules of cpplint
# - pip3 install tree_sitter
# - git clone https://github.com/tree-sitter/tree-sitter-python
# - cd tree-sitter-python
# - downlaod cpplint.py into current dir
# - python parse_cpplint.py
import tree_sitter
import json
from pathlib import Path
from tree_sitter import Language, Parser
@csmoe
csmoe / Dockefile.linux-all-in-one
Created September 8, 2022 11:29
Cross compile Rust project for Windows/macOS/Android/Linux(arm64,mips64el) on Linux
FROM rust:latest
ENV LLVM_VERSION 14.0.0
ENV NODE_ARCH x64
ENV MSVC_ROOT /msvc
ENV ANDROID_NDK /android-ndk-r25b
ENV PATH="/llvm/bin:/osxcross/target/bin:$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin"
@csmoe
csmoe / sqlcipher.ps1
Last active August 23, 2022 03:48
Build sqlcipher on Windows(>=10) with PowerShell
# make sure you have visual studio build tools installed, cc https://visualstudio.microsoft.com/visual-cpp-build-tools/
# and prebuilt openssl for windows, cc https://wiki.openssl.org/index.php/Binaries
#
# Build instruction:
# $OPENSSL_PATH = <your_openssl_path>; powershell sqlcipher.ps1 windows x86 v4.5.2
param (
[Parameter(Mandatory)] [ValidateSet('windows')] $OS,
[Parameter(Mandatory)] [ValidateSet('x86', 'x64', 'x64_arm64')] $ARCH,
[Parameter(Mandatory)] $TAG

[DEBUG rustc_typeck::collect] check_crate: type collecting inside mod: DefId(0:0 ~ v[317d]) [DEBUG rustc_typeck::collect] convert: item with id HirId { owner: DefIndex(1), local_id: 0 } [DEBUG rustc_typeck::collect] items converted [DEBUG rustc_typeck::collect] convert: item std with id HirId { owner: DefIndex(2), local_id: 0 } [DEBUG rustc_typeck::collect] items converted [DEBUG rustc_typeck::collect] convert: item main with id HirId { owner: DefIndex(3), local_id: 0 } [DEBUG rustc_typeck::collect] type_of: node=Item(Item { ident: main#0, hir_id: HirId { owner: DefIndex(3), local_id: 0 }, attrs: [], kind: Fn(FnSig { header: FnHeader { unsafety: Normal, constness: NotConst, asyncness: NotAsync, abi: Rust }, decl: FnDecl { inputs: [], output: DefaultReturn(../v.rs:1:11: 1:11), c_variadic: false, implicit_self: None } }, Generics { params: [], where_clause: WhereClause { predicates: [], span: ../v.rs:1:9: 1:10 }, span: ../v.rs:1:8: 1:8 }, BodyId { hir_id: HirId { owner: DefIndex(3), local_id: 2 } }), vis: Span

Keybase proof

I hereby claim:

  • I am csmoe on github.
  • I am csmoe (https://keybase.io/csmoe) on keybase.
  • I have a public key ASBtXZBtOZBPu5VV4nyVCx7yz0_ug2G3xfhH4HileEKu3Ao

To claim this, I am signing this object:

impl Trait

Is the same syntax for both

  • anonymous generic parameters
  • inferred return types

E.g. in the function fn f<T: Trait1>(t: T, u: impl Trait2) -> impl Trait3 you have one named generic parameter, one anonymous generic parameter and a return type inferred from the function body.