Posts

Showing posts from January, 2013

Vim pasting

Vim keeps messing up your pastes. Type :set paste Pasting it now works. Once done, you can type :set nopaste Thanks to http://www.protocolostomy.com/2008/04/04/vim-messing-up-indentation-on-your-pasted-code/

High Res timer on Win using C++

Took this from http://stackoverflow.com/questions/1739259/how-to-use-queryperformancecounter #include double PCFreq = 0.0 ; __int64 CounterStart = 0 ; void StartCounter () { LARGE_INTEGER li ; if (! QueryPerformanceFrequency (& li )) cout << "QueryPerformanceFrequency failed!\n" ; PCFreq = double ( li . QuadPart )/ 1000.0 ; QueryPerformanceCounter (& li ); CounterStart = li . QuadPart ; } double GetCounter () { LARGE_INTEGER li ; QueryPerformanceCounter (& li ); return double ( li . QuadPart - CounterStart )/ PCFreq ; } int main () { StartCounter (); Sleep ( 1000 ); cout << GetCounter () << "\n" ; return 0 ; }