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
| import glob | |
| import os.path as osp | |
| import subprocess | |
| def extract_mp3(src_filename, dst_filename): | |
| cmd = ['ffmpeg', '-i', src_filename, '-acodec', 'libmp3lame', '-ab', | |
| '360k', dst_filename] | |
| subprocess.call(cmd) |
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 <functional> | |
| #include <iostream> | |
| class Data { | |
| public: | |
| void set(float v_) { v = v_; } | |
| float get() const { return v; } | |
| void print() const { std::cout << v << std::endl; } | |
| private: |
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
| template <typename T, std::size_t T_levels> | |
| struct NestedInitList { | |
| using type = std::initializer_list< | |
| typename NestedInitList<T, T_levels - 1>::type>; | |
| }; | |
| template <typename T> | |
| struct NestedInitList<T, 0> { | |
| using type = T; | |
| }; |
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
| $ # Install bazel 0.5.4 | |
| $ wget https://github.com/bazelbuild/bazel/releases/download/0.5.4/bazel-0.5.4-installer-linux-x86_64.sh | |
| $ chmod +x bazel-0.5.4-installer-linux-x86_64.sh | |
| $ ./bazel-0.5.4-installer-linux-x86_64.sh --user | |
| $ # Install tensorflow 1.4 (CUDA 10.1, cuDNN 7.5.1) | |
| $ git clone https://github.com/tensorflow/tensorflow.git | |
| $ git checkout r1.4 | |
| $ ./configure --disable-multilib | |
| WARNING: ignoring _JAVA_OPTIONS in environment. |
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
| from torch.utils.data.dataloader import DataLoader, _DataLoaderIter | |
| class PersistentDataLoader(DataLoader): | |
| def __init__(self, *args, **kwargs): | |
| super().__init__(*args, **kwargs) | |
| # --------------------------- Different here -------------------------- | |
| self._dataloader_iter = _PersistentDataLoaderIter(self) | |
| # --------------------------------------------------------------------- |
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> | |
| #include <eigen3/Eigen/Core> | |
| #include <cstdlib> | |
| int main(int argc, char const* argv[]) { | |
| // Create matrix | |
| Eigen::MatrixXf mat(10, 20); | |
| for (size_t y = 0; y < 10; y++) { | |
| for (size_t x = 0; x < 20; x++) { | |
| mat(y, x) = static_cast<float>(20 * y + x) / 10.f; |
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> | |
| #include <vector> | |
| #include <memory> | |
| #include <typeinfo> | |
| #include <cstring> | |
| class Variable { | |
| public: | |
| template<typename T, typename... Args> |
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> | |
| #include <vector> | |
| #include <memory> | |
| #include <typeinfo> | |
| #include <cstring> | |
| class Variable { | |
| public: | |
| template<typename T, typename... Args> |
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> | |
| #include <opencv2/core.hpp> | |
| int main(int argc, char const* argv[]) { | |
| static const float d[] = {1, 2, 3}; | |
| cv::Mat m(1, 3, CV_32FC1, const_cast<float *>(d)); | |
| printf("Address d: %p\n", d); | |
| printf("Address m: %p\n", m.data); |
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
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | |
| <title></title> | |
| <script src="https://code.jquery.com/jquery-3.1.1.min.js" | |
| integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" | |
| crossorigin="anonymous"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.6/marked.min.js"></script> |