Shellbye.github.io
Shellbye.github.io copied to clipboard
my blog --> see https://github.com/Shellbye/Shellbye.github.io/issues for recent update
```bash # https://www.elastic.co/guide/en/logstash/current/installing-logstash.html sudo apt update # Download and install the public signing key wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - # install the apt-transport-https package on Debian...
ES安装好之后(参考 #5 ),可以使用以下命令进行简单的操作。 # 创建索引 ES的索引,在6.x之后,可以初略的理解为相当于关系型数据库概念里面的表。与关系型数据库不一样的地方在于ES的索引并不强制要求结构化。所以最简单的一个存储题目的索引(question_index)就可以创建如下: ```bash shellbye@localhost:~$ curl -X PUT "localhost:9200/question_index?pretty" ``` 以下为输出 ```bash { "acknowledged" : true, "shards_acknowledged" : true, "index" : "question_index" } ``` 创建完成之后可以通过以下命令查看索引列表(相当于MySQL里面的`show tables`): ```bash...
```bash # https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html sudo apt update # Download and install the public signing key wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - # install the apt-transport-https package on Debian...
```bash wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie;" http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz tar -xf jdk-8u171-linux-x64.tar.gz sudo mkdir -p /usr/lib/jvm/ sudo mv jdk1.8.0_171 /usr/lib/jvm/ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_171/bin/java" 1010 sudo update-alternatives --install "/usr/bin/javac"...
[RapidJSON](https://github.com/Tencent/rapidjson)是一款由腾讯开源的json处理包,我在项目中使用的时候,还有点不太熟悉,所以简单记录一些东西。 ```C++ #include "rapidjson/document.h" #include "rapidjson/writer.h" #include "rapidjson/stringbuffer.h" using namespace rapidjson; int main() { // official example to parse json const char* json = "{\"project\":\"rapidjson\",\"stars\":10}"; Document d; d.Parse(json); // 2....
接上回( #32 ),可以把转成`vector`的二进制文件进一步转成`std::string`: ```C++ std::string str = "This is a test"; std::cout
对于我这种C++新人来说,用C++干个啥都很困难,似乎都需要记录。比如近日有这么一个需求,把一个二进制文件(old.wav)读取到内存里,返回给调用方,然后调用方在把它写入到一个新的二进制文件(new.wav)中。 ```C++ #include #include #include std::vector read_return() { std::ifstream file("old.wav", std::ios::binary | std::ios::ate); std::streamsize size = file.tellg(); file.seekg(0, std::ios::beg); std::vector buffer(size); if (file.read(buffer.data(), size)) { std::cout
```bash wget -O boost_1_66_0.tar.gz https://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.tar.gz/download tar xzvf boost_1_66_0.tar.gz cd boost_1_66_0/ sudo apt-get update sudo apt-get install build-essential g++ python-dev autotools-dev libicu-dev build-essential libbz2-dev ./bootstrap.sh --prefix=/usr/ ./b2 sudo ./b2 install ```
算法工程师们的给出的demo往往是用Python写的,但是在实际的项目中,考虑的性能的因素,我们常常需要使用C++来对demo进行一次重写,TF官方的文档中,这部分东西比较少,所以我对自己项目中用到的一些东西进行一点简单的记述。下面的代码也许不能直接拿来运行,但是大致意思是对的。 ```python with gfile.FastGFile('model.pb', 'rb') as f: graph_def = tf.GraphDef() graph_def.ParseFromString(f.read()) g = tf.Graph() tf.import_graph_def(graph_def, name='') with tf.Session(graph=g) as sess: _in = sess.graph.get_tensor_by_name("data/in:0") _out = sess.graph.get_tensor_by_name("out:0") in_batch = np.zeros((1, 16))...
所需数据在[这里](https://gist.github.com/Shellbye/b5fa3b9d97df29b5a4c0ff5156de8531),参考了[这个](http://www.cplusplus.com/forum/general/109119/#msg598120)文档。 ```cpp #include #include #include #include #include #include typedef signed short BitDepth; // 16bit audio template void write(std::ofstream &stream, const _Ty &ty) { stream.write((const char *)&ty, sizeof(_Ty)); } void writeWaveFile(const...