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 <chrono> | |
int main() | |
{ | |
auto start = std::chrono::high_resolution_clock::now (); | |
/* | |
do something... | |
*/ | |
auto end = std::chrono::high_resolution_clock::now (); |
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 hmac_sha512 (const unsigned char* input, int inputlength, unsigned char* output, unsigned int* outputlength) | |
{ | |
const EVP_MD* engine = EVP_sha512 (); | |
#if OPENSSL_VERSION_NUMBER < 0x10100000L | |
HMAC_CTX ctx; | |
HMAC_CTX_init (&ctx); | |
HMAC_Init_ex (&ctx, API_SECRET, strlen (API_SECRET), engine, NULL); | |
HMAC_Update (&ctx, (const unsigned char*)input, inputlength); | |
HMAC_Final (&ctx, output, outputlength); |
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 hmac_sha256 (const unsigned char* input, int inputlength, unsigned char* output, unsigned int* outputlength) | |
{ | |
const EVP_MD* engine = EVP_sha256 (); | |
#if OPENSSL_VERSION_NUMBER < 0x10100000L | |
HMAC_CTX ctx; | |
HMAC_CTX_init (&ctx); | |
HMAC_Init_ex (&ctx, API_SECRET_KEY, strlen (API_SECRET_KEY), engine, NULL); | |
HMAC_Update (&ctx, (const unsigned char*)input, inputlength); | |
HMAC_Final (&ctx, output, outputlength); |
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 <openssl/bio.h> | |
#include <openssl/evp.h> | |
#include <openssl/buffer.h> | |
std::string base64_encode (const void* data, int len) | |
{ | |
std::string ret; | |
BIO * bio, *b64; | |
BUF_MEM* bufferPtr; |
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 使用前可以在注册表中添加项,以将此功能添加到文件夹的右键菜单 | |
rem HKEY_CLASSES_ROOT\Directory\Background\shell\liaowuping\command | |
rem 并将默认值设置为此文件绝对路径 | |
set Path= | |
rem cmake | |
set Path=%Path%;C:\Program Files\CMake\bin |
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 <iconv.h> | |
#include <localcharset.h> | |
static iconv_t g_utf8_to_localcharset; | |
static int init_iconv () | |
{ | |
g_utf8_to_localcharset = NULL; | |
#if _WIN32 | |
const char* charset = locale_charset (); |
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
pragma solidity ^0.5.0; | |
interface IERC20 { | |
function name () external view returns (string memory); | |
function symbol () external view returns (string memory); | |
function decimals () external view returns (uint8 ); |
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 <openssl/md5.h> | |
#include <stdio.h> | |
#include <string.h> | |
int main(int argc, char *argv[]) { | |
MD5_CTX c; | |
unsigned char data[] = "your data"; | |
int len = strlen(data); | |
unsigned char md5[MD5_DIGEST_LENGTH] = {0}; |
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 正在关闭资源管理器... | |
taskkill /f /im explorer.exe | |
echo 正在清理系统图标缓存数据库... | |
attrib -h -s -r "%userprofile%\AppData\Local\IconCache.db" | |
echo /f "%userprofile%\AppData\Local\IconCache.db" |
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
// hash 函数 | |
struct sockaddr_in_hash | |
{ | |
size_t operator()(const sockaddr_in &addr) const | |
{ | |
return *(size_t*)&(addr.sin_addr); | |
} | |
}; | |
// 每次查找时最少调用一次,hash值相同时可能调用2次或更多次. |
OlderNewer