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
#pragma once | |
#include <string> | |
#include <opencv/cv.hpp> | |
using namespace cv; | |
using namespace std; | |
uchar** read_mnist_images(string full_path, int& number_of_images, int& image_size) { | |
auto reverseInt = [](int i) { | |
unsigned char c1, c2, c3, c4; | |
c1 = i & 255, c2 = (i >> 8) & 255, c3 = (i >> 16) & 255, c4 = (i >> 24) & 255; | |
return ((int)c1 << 24) + ((int)c2 << 16) + ((int)c3 << 8) + c4; |
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
Windows Registry Editor Version 5.00 | |
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll] | |
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell] | |
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open] | |
"MuiVerb"="@photoviewer.dll,-3043" | |
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command] |
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
#pragma once | |
#pragma comment(lib, "cudart.lib") | |
#if _DEBUG | |
#pragma comment(lib, "opencv_world330d.lib") | |
#else | |
#pragma comment(lib, "opencv_world330.lib") | |
#endif | |
#ifdef __CUDACC__ |
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 itertools, random, bisect | |
class WeightedRandomGenerator(object): | |
def __init__(self, weights): | |
self.totals = [] | |
running_total = 0 | |
for obj in weights: | |
running_total += weights[obj] |
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
# -*- coding: utf-8 -*- | |
# This script renames all files under this script's folder | |
# Ruofei Du | |
# 12/13/2017 | |
import glob, os | |
prefix = 'bing_' | |
dir_path = os.path.dirname(os.path.realpath(__file__)) | |
sub_dir_list = glob.glob(dir_path + '*') | |
for dir_item in sub_dir_list: |
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 glob, os | |
dir_path = os.path.dirname(os.path.realpath(__file__)) | |
print(dir_path) | |
sub_dir_list = glob.glob(dir_path + '\\test2\\*') | |
for dir_item in sub_dir_list: | |
print(dir_item) | |
sub_list = glob.glob(dir_item + '\\*') | |
for item in sub_list: | |
l = glob.glob(item + "\\*") |
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
cgi.fix_pathinfo=0 | |
file_uploads = On | |
post_max_size = 500M | |
upload_max_filesize = 500M | |
memory_limit = 256M |
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
# type: (list, float, float) -> list | |
# img: the input image | |
# cx, cy: image coordinates in floats | |
def bilinear_get_color(img, cx, cy): | |
x, y = [int(floor(cx)), int(ceil(cx))], [int(floor(cy)), int(ceil(cy))] | |
u, v = cx - x[0], cy - y[0] | |
r = np.zeros((2, 2, 3), np.uint8) | |
w, h = len(img[0]), len(img) | |
for i in range(2): | |
for j in range(2): |
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
/** | |
* @desc 判断ip是否为台湾IP | |
* @param string $ip 字符串格式的ip | |
* @return boolean 是台湾IP的话返回true,否则返回false | |
*/ | |
public static function isTaiwanIp($ip) { | |
$longip = sprintf("%u", ip2long($ip)); | |
switch ($longip % 100000000) { | |
case 0: | |
if (($longip>=19005440 AND $longip<=19136511) |
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
from collections import defaultdict | |
def node(): | |
return defaultdict(node) | |
def word_exists(word, node): | |
if not word: | |
return None in node | |
return word_exists(word[1:], node[word[0]) |
OlderNewer