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
# install socat on CentOS 6.x | |
rpm -ivh https://forensics.cert.org/cert-forensics-tools-release-el6.rpm | |
yum install socat | |
# tcp | |
nohup socat TCP4-LISTEN:3306,reuseaddr,fork TCP4:192.168.1.2:3306 >> socat.log 2>&1 &! | |
# udp | |
nohup socat UDP4-LISTEN:1194,reuseaddr,fork UDP4:192.168.1.3:1194 >> socat.log 2>&1 &! |
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
-- 创建只读账号 (% 表示不限制 IP 登录) | |
GRANT SElECT ON *.* TO 'reader'@'%' IDENTIFIED BY "password"; | |
-- 如果提示 `ERROR 1819 (HY000): Your password does not satisfy the current policy requirements`,可以使用下面的命令修改策略配置。 | |
SHOW VARIABLES LIKE 'validate_password%'; | |
SET GLOBAL validate_password_policy=LOW; | |
-- 创建拥有所有权限的账号,并限制只允许本机登录 | |
-- Mysql 5.x | |
GRANT all privileges ON *.* TO 'camexgames'@'localhost' IDENTIFIED BY "password"; |
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
#!/bin/bash | |
ipa_file=$1 | |
[email protected] | |
altool='/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Versions/A/Support/altool' | |
echo "Validating..." | |
"$altool" --validate-app -f $ipa_file -u $apple_id | |
echo "Uploading..." | |
"$altool" --upload-app -f $ipa_file -u $apple_id --output-format normal |
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
actions=true | |
ads=true | |
analytics=true | |
appindexing=true | |
appstate=true | |
auth=true | |
cast=true | |
common=true | |
drive=false | |
dynamic=true |
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 <sys/sysctl.h> | |
#import <mach/mach.h> | |
// 获取当前设备可用内存(单位:MB) | |
- (double)availableMemory | |
{ | |
vm_statistics_data_t vmStats; | |
mach_msg_type_number_t infoCount = HOST_VM_INFO_COUNT; |
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
--[[ | |
打印时区信息 | |
--]] | |
function os.printTimezone() | |
local t = os.time() | |
local ut = os.date('!*t',t) | |
local lt = os.date('*t',t) | |
local tzdt = (lt.hour - ut.hour) * 3600 + (lt.min - ut.min) * 60 | |
print(string.format("本地时间与标准时间差 %d(%.1f小时) 分钟", tzdt, tzdt / 3600)) | |
end |
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
CCGLProgram* p = new CCGLProgram(); | |
p->initWithVertexShaderFilename("shader/BanishShader.vsh", "shader/BanishShader.fsh"); | |
p->addAttribute(kCCAttributeNamePosition, kCCVertexAttrib_Position); | |
p->addAttribute(kCCAttributeNameColor, kCCVertexAttrib_Color); | |
p->addAttribute(kCCAttributeNameTexCoord, kCCVertexAttrib_TexCoords); | |
p->link(); | |
p->updateUniforms(); | |
pSprite->setShaderProgram(p); | |
p->release(); |
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
// 把一个wstring转化为string | |
std::string& to_string(std::string& dest, std::wstring const & src) | |
{ | |
std::setlocale(LC_CTYPE, ""); | |
size_t const mbs_len = wcstombs(NULL, src.c_str(), 0); | |
std::vector<char> tmp(mbs_len + 1); | |
wcstombs(&tmp[0], src.c_str(), tmp.size()); | |
dest.assign(tmp.begin(), tmp.end() - 1); |
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
# 参数可选(auto, ture, false) | |
$ git config --global color.status auto | |
$ git config --global color.diff auto | |
$ git config --global color.branch auto | |
$ git config --global color.interactive auto | |
$ git config --global color.ui auto |
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
int numClasses = 0; | |
Class * classes = NULL; | |
numClasses = objc_getClassList(NULL, 0); | |
if (numClasses > 0 ) | |
{ | |
classes = malloc(sizeof(Class) * numClasses); | |
numClasses = objc_getClassList(classes, numClasses); | |
for (int i = 0; i < numClasses; i++) |