Logs | Page 7 of 8

These logs are random snippets of information that have been useful to me in the past. Hopefully they help you too!


C++ chrono lib resolution

Dug a little deeper into outputting time durations. It turns out that time_point has a default accuracy that is system-implementation-dependent or something....

Timing in C++

Use the <chrono> library. std::chrono::high_resolution_clock seems to do the trick. It should be giving me nanosecond resolution, but gives me only mic...

Check PEP8 formatting for python

In order to check errors in python formatting, use pep8 (installed with pip). In order to correct these errors automatically, use autopep8.

par for formatting paragraphs

In order to format paragraphs in text files or in comments in code, use the par program. It seems to be exactly what I need in many cases.

astyle for formatting C and C++ code

astyle automatically formats C and C++ code. It has a whole bunch of options that can be customized to get different kinds of output. Personally, I find asty...

taskset

man taskset. Lets you set which processor to run a process on.

cudaMemcpyToSymbol issues

When using cudaMemcpyToSymbol, you can directly use the name of the variable you are transferring data to. In fact, this is the only way it seems to work. va...

git reflog

In order to undo a commit, a reset, a merge, or anything involving refs, just take a look at git reflog and reset to the appropriate HEAD@{n}.

Undoing a git commit –amend

In order to undo a git commit --amend, take a look at the git reflog. HEAD@{1} will contain the commit just before the amend (assuming that the amend was mad...

Friendship is not inherited

Friendship is not inherited. class A { friend class B; }; class B { }; class C : public B { }; => C cannot access private and protected members of A!