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
#pragma once | |
#ifndef CFUTURE_H_ | |
#define CFUTURE_H_ | |
#include <stdio.h> | |
#include <pthread.h> | |
#ifdef DEBUG | |
#include <random> |
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 <algorithm> | |
#include <vector> | |
#include <utility> | |
#include <random> | |
namespace { | |
const constexpr size_t kTestLen = 1000000; | |
std::random_device rd; | |
std::mt19937 urbg(rd()); |
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
\documentclass{beamer} | |
\usetheme{metropolis} | |
\usepackage[backend=biber, style=chem-angew, safeinputenc]{biblatex} | |
% \renewcommand\multicitedelim{\addsemicolon\space} | |
\begin{filecontents}{\jobname.bib} | |
@misc{Book1, | |
author = {Author, A.}, | |
year = {2001}, | |
title = {Alpha}, |
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 <future> | |
template <typename IntT, typename UnaryFunc> | |
IntT do_hyper_sum(const IntT begin, const IntT end, const UnaryFunc func) { | |
IntT res = 0; | |
for (IntT i = begin; i != end; ++i) { | |
res += func(i); | |
} | |
return std::move(res); |
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
$ ./a.out | |
HELLO WORLD! | |
hello world! |
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
$ ./a.out | |
4 5 | |
1 2 3 4 5 6 7 8 |
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 <unordered_set> | |
#include <string> | |
#include <algorithm> | |
const std::unordered_set<std::string> replace_str_set{",", "."}; | |
bool IsReplaceStr(const std::string& str) { | |
return (replace_str_set.find(str) != replace_str_set.end()); | |
} |
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 re | |
pattern = r'(?P<front><img.*?src=\\")(?P<protocol>http://)(?P<url>.*?\\")(?P<back>.*?\/>)' | |
_replace_protocol = lambda m: \ | |
'%s%s%s%s' % (m.group('front'), 'https://', m.group('url'), m.group('back')) | |
source = r'<img src=\"http://gss1.bdstatic.com/-vo3dSag_xI4khGkpoWK1HF6hhy/baike/s%3D220/sign=ce3bec3b4d36acaf5de091fe4cd88d03/dc54564e9258d109b60a06b0d758ccbf6d814dc2.jpg\" layout=\"1\" style=\"float:right;\" class=\"fadeInLeftBig\" data-type=\"img\" />' | |
print source | |
print re.sub(pattern, _replace_protocol, source) |
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
\documentclass{article} | |
\usepackage{amsmath} | |
\begin{document} | |
\begin{align} | |
a = &b+c\\ | |
= &c+d\\ | |
&+e+f | |
\end{align} |
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
\documentclass{article} | |
\usepackage{tikz} | |
\usetikzlibrary{decorations.pathmorphing, decorations.text} | |
\begin{document} | |
\begin{tikzpicture} | |
\path decorate [decoration={text along path, | |
text={some text along a path}}]{ (0,2) .. controls (2,2) and (1,0) .. (3,0) }; | |
\draw (0,2) .. controls (2,2) and (1,0) .. (3,0); | |
\end{tikzpicture} | |
\end{document} |