This file contains hidden or 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/evp.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <string> | |
#include <vector> | |
// From https://www.openssl.org/docs/man1.1.1/man3/EVP_EncryptInit.html | |
static bool CryptAes256Cfb(const std::vector<uint8_t> &key, | |
const std::vector<uint8_t> &iv, |
This file contains hidden or 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
sync && dd if=/dev/zero of=/var/avi/mmc0/tmp.bin bs=1M count=100 && sync && dd if=/var/avi/mmc0/tmp.bin of=/dev/null bs=1M |
This file contains hidden or 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/sh | |
if [ $# -lt 3 ] ; then | |
echo "Usage: $0 old_email new_email new_name" | |
echo "Example: $0 [email protected] [email protected] new_name" | |
exit 1; | |
fi | |
echo "old_email: $1" | |
echo "new_email: $2" |
This file contains hidden or 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
find -type d -empty | xargs -t -L1 -I _ touch _/.gitkeep |
This file contains hidden or 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
// | |
// Created by shawnfeng on 2021-08-12. | |
// https://gist.github.com/ShawnFeng0/429b6caef85ec0d32f34081374dcdb8a | |
// | |
#pragma once | |
#include <atomic> | |
#include <condition_variable> | |
#include <mutex> |
This file contains hidden or 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> | |
#define REFRESH_OUTPUT_LINE(token) \ | |
std::cout << "\r"; \ | |
std::cout << #token << " => " << (token); \ | |
std::cout << "\x1b[K"; \ | |
std::cout.flush(); |
This file contains hidden or 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
// | |
// Created by shawnfeng([email protected]) on 2021/11/1. | |
// | |
#pragma once | |
#include <map> | |
#include <string> | |
#include <vector> | |
// reference: |
This file contains hidden or 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
/* | |
* Copyright (c) 2007 Denys Vlasenko <[email protected]> | |
* | |
* Licensed under GPLv2, see file LICENSE in this source tree. | |
*/ | |
/* | |
* This program is a CGI application. It outputs directory index page. | |
* Put it into cgi-bin/index.cgi and chmod 0755. | |
*/ |
This file contains hidden or 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 <chrono> | |
/* | |
* Delay setting true variable | |
* test code: | |
DelayTruth state(2000); | |
EXPECT_FALSE(state); | |
state.mark(true); | |
EXPECT_FALSE(state); | |
sleep(1); |
This file contains hidden or 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 main(void) { | |
std::string raw = "{\"test\": 1}"; | |
Json::Value root;// starts as "null"; will contain the root value after parsing | |
Json::Reader reader; | |
reader.parse(raw, root, false); | |
int test_a = root["test"].asInt(); | |
DEBUG_TOKEN(test_a); |