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 cv2 | |
import numpy as np | |
def preprocess_image(image): | |
# 二值化 | |
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) | |
_, threshold = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY) | |
cv2.imwrite("01_threshold.jpg", threshold) | |
return threshold |
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 <stdlib.h> | |
#include <stdbool.h> | |
#include <time.h> | |
#include <windows.h> | |
#include <libavcodec/avcodec.h> | |
#include <libavformat/avformat.h> | |
//#include <libavutil/frame.h> | |
#include <SDL2/SDL.h> |
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
javascript: | |
timeout=prompt("Set timeout [s]"); | |
countdown=0; | |
current=location.href; | |
if(timeout>0) | |
reload(); | |
else | |
location.replace(current); | |
function reload(){ | |
if(countdown <= 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
#include <Windows.h> | |
#include <iostream> | |
#include <thread> | |
struct pipe | |
{ | |
pipe() | |
{ | |
SECURITY_ATTRIBUTES sa = { sizeof(sa), nullptr,true}; | |
CreatePipe(&read, &write, &sa, 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
#include <windows.h> | |
#include <tchar.h> | |
#include <dbghelp.h> | |
#include <string> | |
#include "crash_dumper.h" | |
#ifdef UNICODE | |
# define tstring wstring |
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
EXTERN_C IMAGE_DOS_HEADER __ImageBase; | |
#define CURRENT_HINSTANCE ((HINSTANCE)&__ImageBase) | |
CImage image; | |
image.LoadFromResource(CURRENT_HINSTANCE, IDB_BG); | |
m_bg.Attach(image.Detach()); | |
m_dc_bg.CreateCompatibleDC(); | |
m_dc_bg.SelectBitmap(m_bg); |
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
class MyFileSystemModel(QFileSystemModel): | |
changed = pyqtSignal(str, int, int) | |
def __init__(self, parent=None): | |
self.checks = {} | |
super(MyFileSystemModel, self).__init__() | |
def flags(self, index): | |
return super(MyFileSystemModel, self).flags(index) | Qt.ItemIsUserCheckable |
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
static bool | |
has_arg(int argc, char **argv, const char *arg) | |
{ | |
for (int i = 1; i < argc; i++) { | |
if (strcmp(argv[i], arg) == 0) { | |
return true; | |
} | |
} | |
return false; | |
} |
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
// | |
bool starts_with(const std::string & str, const std::string & sub, bool ignore_case=false) | |
{ | |
int str_len = str.size(); | |
int sub_len = sub.size(); | |
if (str_len < sub_len) return false; | |
if (ignore_case) | |
{ |
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
// set url params | |
// if params not exists in url, then add params | |
// if params exists in url, then replace | |
function setUrlParams(url, params) { | |
var parts = url.split("?"); | |
var path = parts[0] | |
var old_params = {}; | |
if (parts.length == 1); | |
else { | |
var items = parts[1].split("&"); |
NewerOlder