Skip to content

Instantly share code, notes, and snippets.

View hitigon's full-sized avatar
🙀

Zhongyue Huang hitigon

🙀
  • Mars
View GitHub Profile
@hitigon
hitigon / stringsplit.cpp
Last active August 29, 2015 13:56
C++ string split
//naive way to implement C++ string split
//In the worst case, it costs O(n^2) time
int split(string tokens[], string str, string d) {
int i = 0;
size_t n = str.length();
if (d.length() > n || str.find(d) == string::npos) return -1;
size_t pos;
@hitigon
hitigon / bettersplit.cpp
Created March 15, 2014 03:38
better string split for C++
// O(n)
int split(vector<string> &tokens, const string &str, const string &delim)
{
int count = 0;
auto begin = str.begin();
auto it = str.begin();
auto end = str.end();
while (begin != end && it != end) {
### Keybase proof
I hereby claim:
* I am hitigon on github.
* I am hitigon (https://keybase.io/hitigon) on keybase.
* I have a public key whose fingerprint is 642F 79D4 C749 7F7B 9FA5 ACAF 896D 47B4 4A31 EAAF
To claim this, I am signing this object:
@hitigon
hitigon / install_opencv2_python.sh
Last active August 29, 2015 14:19
openCV2 w/ python supports
#! /bin/bash
sudo yum install -y python-devel numpy # 2.6.9
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.10/opencv-2.4.10.zip
unzip opencv-2.4.10
cd opencv-2.4.10
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON ..
make