Skip to content

Instantly share code, notes, and snippets.


Haoyu Qiu timothyqiu

View GitHub Profile
timothyqiu / map-capslock-to-ctrl.reg
Created Mar 22, 2020
Maps CAPSLOCK to CTRL (restart is needed after using this)
View map-capslock-to-ctrl.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00
timothyqiu / math.patch
Last active Mar 12, 2020
Math support patch for PHP Markdown Extra 1.2.8
View math.patch
--- markdown.php 2013-11-30 00:09:34.000000000 +0800
+++ markdown.php 2020-03-12 14:54:15.000000000 +0800
@@ -41,6 +41,9 @@
# setting this to true will put attributes on the `pre` tag instead.
@define( 'MARKDOWN_CODE_ATTR_ON_PRE', false );
+# Optional class attribute for math.
+@define( 'MARKDOWN_MATH_CLASS', "" );
timothyqiu /
Created Oct 24, 2019
简易 API 客户端
import urllib.parse
import requests
class DnspodException(Exception):
class DnspodErrorResponse(DnspodException):
View base64.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static char const encode_map[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
char *base64_encode(char const *data, size_t size);
char *base64_decode(char const *code, size_t *size);
timothyqiu /
Created Mar 12, 2015
将 1~3999 内的整数正确转换至罗马数字
#include <algorithm>
#include <cassert>
#include <string>
std::string toRoman(int number)
static struct {
int value;
char const *symbols;
} const mapping[] = {
#include <algorithm>
#include <iostream>
#include <map>
#include <unordered_map>
// MapTraits<MapType, KeyType1, KeyType2, KeyType3...>
// ---------------------------------------------------
// 连续使用 KeyType1, KeyType2, KeyType3... 对 MapType 进行取 Value 操作后的信息
template <typename MapType, typename KeyType, typename... KeyTypes>
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <windows.h> // 各种位图数据结构
class Converter
Converter() : pixels_(NULL), width_(0), height_(0) {}