sed -i "s/zhangsan/lisi/g" `grep zhangsan -rl /modules`
-i 表示inplace edit,就地修改文件
-r 表示搜索子目录
-l 表示输出匹配的文件名| # coding: utf-8 | |
| import sys | |
| import uuid | |
| import json | |
| import traceback | |
| import winreg | |
| from PyQt5.QtCore import QFile, QTimer, Qt, QDateTime, QSettings, QPoint, QSize | |
| from PyQt5.QtWidgets import QApplication, QMainWindow, QGroupBox, QLineEdit, QTextEdit, QWidget, QHBoxLayout, QVBoxLayout, QPushButton, QLabel, QDateTimeEdit, QMenuBar, QAction |
| class ScopeExit: | |
| def __init__(self, revert_exec=False): | |
| self.revert_exec = revert_exec | |
| self.cbs = [] | |
| def add_cb(self, cb): | |
| self.cbs.append(cb) | |
| def del_cb(self, cb): | |
| used = 0 |
| #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 |
| #!/usr/local/bin/python | |
| #coding: utf-8 | |
| import os | |
| import sys | |
| import fnmatch | |
| import cv2 | |
| def files_in_dir(root, pattern): | |
| all_files = [] |
| #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()) { } |
| 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++) | |
| { |
| 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 << ", "; | |
| } | |
| } |
| 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); |
| def custom_min(data): | |
| assert len(data) >= 1 | |
| if len(data) <= 0: | |
| return data,0 | |
| min_idx = 0 | |
| min_data = data[min_idx] | |
| for i,item in enumerate(data): | |
| if item < min_data: | |
| min_data = item | |
| min_idx = i |