sed -i "s/zhangsan/lisi/g" `grep zhangsan -rl /modules`
-i 表示inplace edit,就地修改文件
-r 表示搜索子目录
-l 表示输出匹配的文件名
#coding:utf-8 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import math | |
def f(x): | |
return x[0] * x[0] + 50 * x[1] * x[1] | |
def g(x): | |
return np.array([2 * x[0], 100 * x[1]]) |
static const std::string base64_chars = | |
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
"abcdefghijklmnopqrstuvwxyz" | |
"0123456789+/"; | |
static inline bool is_base64(unsigned char c) { | |
return (isalnum(c) || (c == '+') || (c == '/')); | |
} |
#pragma once | |
#include <vector> | |
#include <string> | |
#include <algorithm> | |
#include <sstream> | |
#include "dirent.h" | |
std::string replace_all(const std::string& str, const std::string& from, const std::string& to) { | |
std::string result_str = str; | |
size_t start_pos = 0; |
std::string local_to_utf8(const std::string& src) | |
{ | |
#if _WIN32 | |
int len = MultiByteToWideChar(CP_ACP, 0, src.c_str(), -1, NULL, 0); | |
wchar_t* wszUTF16 = new wchar_t[len+1]; | |
memset(wszUTF16, 0, len+1); | |
MultiByteToWideChar(CP_ACP, 0, src.c_str(), -1, wszUTF16, len); | |
len = WideCharToMultiByte(CP_UTF8, 0, wszUTF16, -1, NULL, 0, NULL, NULL); | |
char* szUTF8 = new char[len + 1]; | |
memset(szUTF8, 0, len + 1); |
static std::ostream& operator<<(std::ostream& os, const std::vector<int>& data) | |
{ | |
for (size_t i = 0; i < data.size();i++) | |
{ | |
os << data[i]; | |
if (i < (int)data.size() - 1) | |
{ | |
os << ", "; | |
} | |
} |
static int split(std::vector<int>& data, const int beg, const int end) | |
{ | |
if (beg >= end || end <= 0) | |
{ | |
return -1; | |
} | |
int idx = beg; | |
const int base = data[end - 1]; | |
for (int i = beg; i < end; i++) | |
{ |
#include <chrono> | |
#include <string> | |
#include <iostream> | |
struct profiler | |
{ | |
std::string name; | |
std::chrono::high_resolution_clock::time_point p; | |
profiler(std::string const &n) : | |
name(n), p(std::chrono::high_resolution_clock::now()) { } |
#!/usr/local/bin/python | |
#coding: utf-8 | |
import os | |
import sys | |
import fnmatch | |
import cv2 | |
def files_in_dir(root, pattern): | |
all_files = [] |
#coding: utf-8 | |
# from: https://github.com/argman/EAST/blob/ab97939783901b7e22ff55e151964e159d1627b9/icdar.py | |
import cv2 | |
import numpy as np | |
import copy | |
def shrink_poly(poly, r): | |
''' | |
fit a poly inside the origin poly, maybe bugs here... | |
used for generate the score map |