Skip to content

Instantly share code, notes, and snippets.

View qtxie's full-sized avatar
🏠
Working from home

Qingtian qtxie

🏠
Working from home
  • FullStack Technologies
View GitHub Profile
#include <random>
#include <ctime>
#include <vector>
#include <iostream>
#include <chrono>
#include <utility>
#include <array>
#include <type_traits>
#include <functional>
#include <string>
// Source Code: https://gist.github.com/qtxie/12c087db8a2c0c2d9fe0104af2f4236e
// compare Cell struct
// struct Cell {
// int header;
// int pading;
// int value;
// int pading2;
// Cell(int x) : value(x) {}
// bool operator<(const Cell& r) const
// {
@qtxie
qtxie / _readme_quarks.md
Created September 13, 2019 10:59 — forked from vurtun/_readme_quarks.md
Quarks: Graphical user interface

gui

Red [
Title: "High resolution timer"
Author: "Xie Qingtian"
File: %timeit.red
Tabs: 4
License: {
Distributed under the Boost Software License, Version 1.0.
See https://github.com/red/red/blob/master/red-system/runtime/BSL-License.txt
}
]
@qtxie
qtxie / RDTSC.reds
Last active September 13, 2019 07:45
Red/System []
int64!: alias struct! [
low [integer!]
high [integer!]
]
sub64: func [
a [int64!]
b [int64!]
@qtxie
qtxie / webcam_capture.c
Created September 13, 2019 07:19 — forked from mmozeiko/webcam_capture.c
Capture webcam device with Media Foundation API
#define COBJMACROS
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <mfapi.h>
#include <mfidl.h>
#include <mfreadwrite.h>
#include <stdio.h>
#include <intrin.h>
;-- use this benchmark: https://github.com/orlp/pdqsort/blob/master/bench/bench.cpp
pdqsort qsort
1000000 shuffled_int 107 1000000 shuffled_int 277
100 shuffled_int 34 100 shuffled_int 92
1000000 shuffled_16_values_int 22 1000000 shuffled_16_values_int 43
100 shuffled_16_values_int 31 100 shuffled_16_values_int 61
1000000 all_equal_int 1 1000000 all_equal_int 2
100 all_equal_int 2 100 all_equal_int 2
1000000 ascending_int 2 1000000 ascending_int 5
Red/System [
Title: "High resolution timer"
Author: "Xie Qingtian"
File: %time-meter.reds
Tabs: 4
License: {
Distributed under the Boost Software License, Version 1.0.
See https://github.com/red/red/blob/master/red-system/runtime/BSL-License.txt
}
]
@qtxie
qtxie / utxs
Created June 17, 2019 14:51
BTC legacy address 之间互转出错
utxs: [inputs [[addr "mnXVvGotveRZUYH7qX9sYBQwwvUEbNH4Jy" pubkey #{
04CA60B8F84405C00EEE10DC62D4B42E9C475E8D1213932DB38073C8C22CA0C5
40DC534D59C252D0B96E008FE6BD1CC7B8EB64B659B9D7C3AFD9BC6CF5576A7E
6E
} tx-hash {87ca1a8160708df6e7f0e6fd335ddd447aed015eb6e5bb9b845230edf7988c01} pat
h [-2147483604 -2147483647 -2147483648 1 0] info [version 1 lock_time 0 inputs [
[prev-addresses ["msZnufFHcrxKK29jUcksxADMFvztPZk5jJ"] prev-position 0 prev-tx-h
ash {20c3030d3e17989ac22d1c65b537f8e38824b244492d09550df6bc58596e2038} script-he
x {483045022100a25b8d3752022b4c8e8a927a6eb38f00a22a8c20e43029533af5f16bc32236250
2206befdb03169be0a2a4b47d3b1362c026e30b0491aeb36d5177a415cfe7e44c28012102a3bcf3b
@qtxie
qtxie / min-heap.reds
Created December 21, 2018 13:19
A min-heap in Red/System
Red/System [
Title: "A min-heap implementation"
Author: "Xie Qingtian"
File: %min-heap.reds
Tabs: 4
Rights: "Copyright (C) 2018 Xie Qingtian. All rights reserved."
License: {
Distributed under the Boost Software License, Version 1.0.
See https://github.com/red/red/blob/master/BSL-License.txt
}