- [When should static_cast, dynamic_cast, const_cast and reinterpret_cast be used?][1]
- [What are the basic rules and idioms for operator overloading in C++?][2]
- [Why would one replace default new and delete operators?][3]
- [What is the copy-and-swap idiom?][4]
- [What is the difference between #include and #include “filename”?][5]
- [What can I use to profile C++ code in Linux?][6]
- [C++ multithreading?][7]
- [When and how should dynamic memory allocation and pointers be used?][8]
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
// Package p contains an HTTP Cloud Function. | |
package p | |
import ( | |
"encoding/json" | |
"fmt" | |
"net/http" | |
"sort" | |
"strings" |
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
main.o: In function `MAIN__': | |
main.f90:(.text+0xf73f): undefined reference to `sol_writer_' | |
pot.o: In function `pot_mp_potlok_': | |
pot.f90:(.text+0x1b1e): undefined reference to `sol_vcorrection_' | |
make: *** [vasp] Error 1 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
- Download [OpenCV][1] and extract it to desired directory, for example
D:\opencv
. - Set up environment variables for Windows:
OPENCV_DIR
=D:\opencv\build
- Add
%OPENDC_DIR%\x86\vc12\bin
toPATH
- Set up properties of MicroSoft Visual Studio project (Only works for OpenCV 3,
need to add [more files][2] in step iv for OpenCV 2):
- Right click on project name in
Solution Explorer
and chooseProperties
. - In
Configuration Properties -> C/C++ -> General -> Additional Include Directories
,
- Right click on project name in
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
""" | |
Create a spinning cursor or progress bar in terminal can be useful | |
for some scripts. | |
1. Use '\r' to move cursor back to the line beginning. Or use '\b' | |
to erase the last character. | |
2. The standard out of Python is buffered, which means it will | |
collect some data written to standard out before it actually | |
writes to the terminal. | |
The code snippet |
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
# SSLError: EOF occurred in violation of protocol | |
# https://github.com/kennethreitz/requests/issues/1083#issuecomment-11853729 | |
from requests.adapters import HTTPAdapter | |
from requests.packages.urllib3.poolmanager import PoolManager | |
import ssl | |
class MyAdapter(HTTPAdapter): | |
def init_poolmanager(self, connections, maxsize): | |
self.poolmanager = PoolManager(num_pools=connections, |
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
import string | |
from itertools import islice | |
def next_n_lines(file_opened, N, strip='right'): | |
''' | |
Each call of this function returns next N lines of fileopen. | |
Usage: | |
strip='right' -> remove trailing whitespace characters in each line, | |
strip='left' -> remove leading whitespace characters in each line, |
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
# Cut list into chunks. | |
def chunk(to_cut,piece_number): | |
''' | |
Cut list into equalily distributed pieces. | |
''' | |
piece_len = len(to_cut)/piece_number | |
for i in xrange(0,len(to_cut),piece_len): | |
yield to_cut[i:i+piece_len] |
NewerOlder