Skip to content

Instantly share code, notes, and snippets.

View xzhong86's full-sized avatar

Bruce Zhong xzhong86

  • Hisilicon
  • China
View GitHub Profile
@xzhong86
xzhong86 / Systemd-Examples.md
Last active April 18, 2024 12:02
Simple Systemd Service File

Systemd Service File

Commands:

  • Restart Systemd Daemon: systemctl daemon-reload
  • Enable Service: systemctl enable qbittorrent

Reference

@xzhong86
xzhong86 / Cpp11-Any-impl.md
Last active April 18, 2024 12:06
Simple Any implementation in C++ 11.

Simple Any Implementation

A simple implementation of 'any' type in c++11.

refer to cnblogs.com/qiconmos/p/3420095.html

@xzhong86
xzhong86 / SimpleCppRange.md
Last active April 18, 2024 12:09
C++ range-based for statement

C++ Simple Range

A simple Range class for int with c++ range-based for statement supported. (or c++ foreach statement) (aka. minimal code to support c++ foreach/range-based-for)

As we know from this example, to support range-based for we need:

  1. container/custom-class has begin() end() method, which return a iterator or something else.
  2. iterator has implemented operators:
  3. not-equal operator !=, which is bool operator !=(T&)
  4. pre-increment operator ++, which is T operator ++()
@xzhong86
xzhong86 / README.md
Last active December 29, 2023 06:26
A simple implementation for common structured data, based on c++17 std::any.

Common Data Structure

Common Data, which contains value (bool/integer/string), array (list), map (dict). CDS is used to handle JSON/YAML/TOML data in c++.