Skip to content

Instantly share code, notes, and snippets.

View Shylock-Hg's full-sized avatar
:octocat:

shylock Shylock-Hg

:octocat:
View GitHub Profile
# https://aka.ms/yaml
# Only for coverage!
trigger:
paths:
include:
- 'src/*'
- 'CMakeLists.txt'
- 'azure-pipelines.yml'
@Shylock-Hg
Shylock-Hg / nebula_histogram_serialize.cc
Created December 20, 2019 02:43
Nebula Hisgogram Serialize
// Comment temporary for maybe used later
// auto& p = sm.histograms_[StatsManager::physicalHistoIndex(index.second)];
// std::int64_t sum = 0;
// if (parsedName != nullptr) {
// sum = readStats(index.second, parsedName->range, StatsManager::StatsMethod::SUM)
// .value();
// } else {
// sum = readStats(index.second, StatsManager::TimeRange::ONE_HOUR,
// StatsManager::StatsMethod::SUM).value();
// }
#include <stddef.h>
#include <stdbool.h>
#include <assert.h>
/*! \brief transfer the variadic parameters to string literal
* */
#define argsstr(...) (#__VA_ARGS__)
/*! \brief check the validation of variadic parameters
* \param dummy required before variadic parameters
@Shylock-Hg
Shylock-Hg / cloudSettings
Last active July 27, 2020 02:21
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-07-27T02:21:21.342Z","extensionVersion":"v3.4.3"}
@Shylock-Hg
Shylock-Hg / find_xxx.cc
Last active December 10, 2018 03:25
Algorithm to find the number(count > 1/2) in a array.
#include <iostream>
#include <array>
#include <type_traits>
#include <stdexcept>
#include <algorithm>
/*! \brief get the number(count > 1/2) in array
\note complexity time-O(N) space-O(1)
*/
template <typename ITEM, std::size_t N>
@Shylock-Hg
Shylock-Hg / heap_sort.hh
Last active December 8, 2018 14:06
Toy algorithm.
/*! \brief simple heap sorting algorithm in array
* \author Shylock Hg
* \date 2018-12-08
* \email tcath2s@gmail.com
* */
#include <type_traits>
#include <algorithm>
#include <array>
@Shylock-Hg
Shylock-Hg / RAII.cc
Last active December 7, 2018 07:21
Some tips ot c/c++.
#include <iostream>
class test {
private:
int * i;
public:
test(){
i = new int[10];
std::cout << "Construct" << std::endl;
@Shylock-Hg
Shylock-Hg / testing_thread.cc
Created December 7, 2018 05:54
Simple demo of c++ thread.
#include <iostream>
#include <thread>
// CPP program to demonstrate multithreading
// using three different callables.
#include <iostream>
#include <thread>
using namespace std;
// A dummy function
@Shylock-Hg
Shylock-Hg / rssi.py
Created December 7, 2018 05:41
Convert RSSI to distance to AP.
#! /usr/bin/env python3
from matplotlib import pyplot as plt
import math
# hyper parameters
calib1m_rssi = -43 #!< bias of rssi in 1 meter
propa = 2.8
scale_factor = 10 #!< scale factor of distance input of level function
@Shylock-Hg
Shylock-Hg / imei.py
Last active January 15, 2019 02:21
Some tools of IMEI code.
#! /usr/bin/env python3
class imei():
@staticmethod
def calculus(imei):
'''
@brief calculus check digit of imei numbers
@param imei imei serial numbers
@retval check digit characters
'''