This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
#encoding:utf8 | |
# NOTE: only sovle problems with text file that has been aready encoded into utf8 | |
# NOTE: may lead to wrong result if the file contains nothing corrupted | |
import sys | |
way1 = lambda s: s.encode('latin1').decode('gbk') | |
way2 = lambda s: s.encode('gbk').decode('utf8').encode('latin1').decode('gbk') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <functional> | |
struct zero; | |
template <typename V> | |
struct signtype | |
{ | |
using value = typename signtype<V>::value; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
FBIOGET_VSCREENINFO = 0x4600 | |
FBIOPUT_VSCREENINFO = 0x4601 | |
FBIOGET_FSCREENINFO = 0x4602 | |
FBIOGETCMAP = 0x4604 | |
FBIOPUTCMAP = 0x4605 | |
FBIOPAN_DISPLAY = 0x4606 | |
BI_BITFIELDS = 3 | |
BI_RAW = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
import numpy as np | |
import cv2 | |
import sys | |
import os | |
if len(sys.argv) < 2: | |
print 'nope ...\nusage:'+sys.argv[0]+' file_name\n\n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline uint8_t lookup_escape_char(char c) { | |
switch (c) { | |
case '\'': | |
return '\''; | |
case '"': | |
return '"'; | |
case '?': | |
return '?'; | |
case '\\': | |
return '\\'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename C, typename... P> | |
void connect(std::function<void()> &trigger, C *instance, | |
void (C::*member_ptr)(P...), P... params) { | |
trigger = [=]() { | |
trigger(); | |
(instance->*member_ptr)(params...); | |
}; | |
} | |
struct A { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http.server | |
from http.server import SimpleHTTPRequestHandler | |
import socketserver | |
import socket | |
import sys | |
class MyHandler(SimpleHTTPRequestHandler): | |
def do_GET(self): | |
if self.path == '/__ip__': | |
self.send_response(200) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by pnck on 2018/11/19. | |
// | |
#include <type_traits> | |
#include <iostream> | |
#include <functional> | |
#include <random> | |
#include <list> | |
#include <deque> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <utility> | |
#include <type_traits> | |
template<typename T> | |
struct comparable { | |
virtual const T value() const = 0; | |
}; | |
template<typename T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <tuple> | |
using ElementType = size_t; | |
template<ElementType ... es> | |
class SetValidator { | |
protected: | |
static inline constexpr auto cs_ = std::make_tuple(es...); | |
template<size_t _i, size_t _j> | |
static constexpr bool cmp_() { |
OlderNewer