Skip to content

Instantly share code, notes, and snippets.

[
{
"key": "cmd+1",
"command": "workbench.action.openEditorAtIndex1"
},
{
"key": "ctrl+1",
"command": "-workbench.action.openEditorAtIndex1"
},
{
@ink19
ink19 / SendMessage.py
Last active December 8, 2021 03:43
checkin.py
#!/usr/bin/env python3
import sys
import json
import requests
from requests.api import head
def SendMessage(text: str) -> None:
send_url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=url_key"
send_data = json.dumps({
@ink19
ink19 / ink_tuple.cpp
Created September 11, 2021 14:20
tuple impl
#include <iostream>
#include <tuple>
// 获取第N个元素的类型
template <int N, typename ...S>
class tuple_item;
template <int N, typename TS, typename ...S>
class tuple_item<N, TS, S...>: public tuple_item<N, S...> {};
@ink19
ink19 / ink_invoke_result.cpp
Created February 12, 2021 08:28
my impl invoke_result
#ifndef __INK_INVOKE_RESULT_HPP
#define __INK_INVOKE_RESULT_HPP
#include <type_traits>
namespace ink {
template<typename __Tp>
using remove_cvref_t = std::remove_cv_t<std::remove_reference_t<__Tp>>;
struct __failure_type{};
@ink19
ink19 / cpp_template_heap_sort.cpp
Created January 2, 2021 10:11
template heap sort
#include <cstddef>
#include <iostream>
#include <array>
// 断言 debug用的
template<bool>
struct m_assert;
template<>
struct m_assert<true> {
@ink19
ink19 / cpp_template_quick_sort.cpp
Last active November 19, 2021 02:29
template quick sort
#include <iostream>
#include <array>
// 数据结构定义
template<int ...>
struct mvector;
template<int ...data, int _head>
struct mvector<_head, data...> {
constexpr static int head = _head;
@ink19
ink19 / select_sort.cpp
Last active May 8, 2021 08:55
cpp template metaprogramming
#include <iostream>
#include <array>
// vector
template<int ...data>
struct mvector;
template<int first, int ...data>
struct mvector<first, data...> {
static constexpr int size = sizeof...(data) + 1;