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
#include <iostream> // std::cout | |
enum FruitType | |
{ | |
Apple, | |
Pear, | |
}; | |
int main () { | |
FruitType enum_type = Pear; |
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
void Bin2Hex(const char* buf, size_t len, std::string& out) | |
{ | |
std::ostringstream ostr; | |
ostr << std::hex; | |
ostr.fill('0'); | |
for (size_t i = 0; i < len; i++) | |
{ | |
unsigned char tmp = buf[i]; | |
ostr << std::setw(2) << static_cast<short>(tmp); | |
} |
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
#include <iostream> | |
#include <windows.h> | |
int main() { | |
DWORD t1 = 4294967295; | |
DWORD t2 = 2; | |
DWORD delta = t2 - t1; | |
std::cout << "DWORD delta:" << delta << std::endl; | |
unsigned long long lt1 = 4294967295; |
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
#include "traverse.h" | |
struct Point { | |
int32_t x; | |
int32_t y; | |
}; | |
TRAVERSE_STRUCT(Point, FIELD(x) FIELD(y)) | |
/* Expand to | |
* void visit(traverse::CoutWriter& visitor, Point& 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
@echo off | |
rem 脚本传入参数(按顺序): <BIN_DIR> | |
setlocal EnableDelayedExpansion | |
rem echo BIN_DIR:%1 | |
rem =========== 配置 =========== | |
rem SYMSTOREPATH 符号服务器地址 | |
rem PRODUCT 你的产品名 | |
rem VERSION 你产品的版本 | |
rem COMMENT 你想加的注释 |
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
--return netpack.filter( queue, msg, sz) | |
local results = table.pack(netpack.filter( queue, msg, sz)) | |
skynet.error("un", table.unpack(results)) | |
return table.unpack(results) |
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 -*- | |
import socket | |
import struct | |
import threading | |
TCP_IP = '192.168.1.133' | |
TCP_PORT = 31436 | |
BUFFER_SIZE = 102400 |
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
$ echo "this_is_the_string" | sed -r 's/(^|_)([a-z])/\U\2/g' |
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 | |
function check_url_exist { | |
# via https://stackoverflow.com/questions/12199059/how-to-check-if-an-url-exists-with-the-shell-and-probably-curl/12199125 | |
url=$1 | |
if curl --output /dev/null --silent --head --fail "$url"; then | |
echo "URL exists: $url" | |
#else | |
#echo "URL does not exist: $url" | |
fi |
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
@echo off | |
rem Tortoise SVN will call this bat with the following parameters | |
rem after the commit action | |
rem bat <CHANGESET_PATH> <DEPTH> <MESSAGEFILE> <REVISION> <ERROR> <CWD> | |
rem set up Post-commit hook: TortoiseSVN_en.chm 4.30.8. Client Side Hook Scripts, | |
setlocal EnableDelayedExpansion | |
rem echo CHANGESET_PATH:%1 1>&2 | |
rem type %1 1>&2 |
NewerOlder