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
QColor getForegroundColor(const QColor &iBackgroundColor) { | |
QString name = iBackgroundColor.name(); | |
name = name.replace("#", ""); | |
bool ok = false; | |
int value = name.toInt(&ok, 16); | |
if (!ok) { | |
return Qt::black; | |
} | |
int r = value >> 16; | |
int g = (value & 65280) >> 8; |
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
SELECT id, regexp_replace(name, '\D', '', 'g') AS name | |
FROM mes_workcenter | |
WHERE parent_id = 2 AND node_type = 'line' AND name NOT LIKE 'Offline%' | |
ORDER BY name ASC |
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
::dump整个数据库 | |
::请用管理员权限运行此脚本 | |
::PGPATH - PostgreSQL路径 | |
::SVPATH - 备份文件路径 | |
::PRJDB - 要备份的数据库名 | |
::DBUSR - 数据库用户名 | |
@ECHO OFF | |
@setlocal enableextensions | |
@cd /d "%~dp0" |
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
sqlite3.exe -header -csv sqlite.db "select * from tablename;" > tablename.csv |
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
:: 执行下面的批处理脚本 | |
:: 系统右键菜单中将增加Removing .SVN Folders | |
Windows Registry Editor Version 5.00 | |
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN] | |
@="Removing .SVN Folders" | |
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN\command] | |
@="cmd.exe /c \"TITLE Removing .SVN Folders in %1 && COLOR 9A && FOR /r \"%1\" %%f IN (.svn) DO RD /s /q \"%%f\" \"" |
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
- 创建用户 | |
CREATE USER 'toplinker'@'%' IDENTIFIED BY 'TopLinker0510'; | |
- 分配SELECT权限给toplinker用户 | |
GRANT SELECT ON *.* TO 'toplinker'@'%'; | |
- 让权限立即生效 | |
FLUSH PRIVILEGES; |
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
# CentOS 7 添加信任端口 | |
firewall-cmd --zone=public --add-port=5432/tcp --permanent | |
firewall-cmd --reload | |
# SMTP端口转发 | |
firewall-cmd --add-masquerade --permanent | |
firewall-cmd --permanent --add-forward-port=port=9281:proto=tcp:toport=25:toaddr=10.3.1.251 | |
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.3.1.251/24" masquerade' | |
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.28.10.53/24" masquerade' | |
firewall-cmd --reload |
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
:::删除服务 | |
sc delete WanNengWuBiServiceV1 | |
:::检查端口是否被占用 | |
netstat -aon | findstr "4007" | |
:::拷贝当前目录下的所有文件夹到另一目录 | |
for /f "delims=" %%D in ('dir /a:d /b') do xcopy %%D ..\..\..\..\tool-cli\topsin\script\ieb-ec-iqs\%%D\ /S /E /Y |
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 dateutil.relativedelta import relativedelta | |
from datetime import date | |
today = date.today() | |
temp = today - relativedelta(months=1) | |
start_date = date(temp.year, temp.month, 1) | |
end_date = date(today.year, today.month, 1) - relativedelta(days=1) | |
print(start_date) | |
print(end_date) |
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
def vs_env_dict(): | |
vsvar32 = '{vscomntools}vsvars32.bat'.format(vscomntools=os.environ['VS140COMNTOOLS']) | |
cmd = [vsvar32, '&&', 'set'] | |
popen = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
stdout, stderr = popen.communicate() | |
if popen.wait() != 0: | |
raise ValueError(stderr.decode("mbcs")) | |
output = stdout.decode("mbcs").split("\r\n") | |
return dict((e[0].upper(), e[1]) for e in [p.rstrip().split("=", 1) for p in output] if len(e) == 2) | |
os.environ.update(vs_env_dict()) |
OlderNewer