Random Scribblings of a Linux Enthusiast

If you want to quickly test a website under development or serve a couple of
webpages from a local directory without the hassle of moving/linking the
directory to a web server root, the following python command helps:

Octopress, by default, generates static websites with a /blog prefix attached
to categories, archives and post URLs. This is particularly annoying when the
blog is hosted at blog.yourdomain.tld and have funny URLs like
blog.yourdomain.tld/blog/archives.

To get rid of this, I’ve created a clone of the classic Octopress theme with the necessary changes. It also renames Blog to Home in the navigation bar.

To use git branch and commit hash information in a CMake project, add the
following lines to CMakeLists.txt

123456789101112131415

# Get the current working branchexecute_process(COMMANDgitrev-parse--abbrev-refHEADWORKING_DIRECTORY${CMAKE_SOURCE_DIR}OUTPUT_VARIABLEGIT_BRANCHOUTPUT_STRIP_TRAILING_WHITESPACE)# Get the latest abbreviated commit hash of the working branchexecute_process(COMMANDgitlog-1--format=%hWORKING_DIRECTORY${CMAKE_SOURCE_DIR}OUTPUT_VARIABLEGIT_COMMIT_HASHOUTPUT_STRIP_TRAILING_WHITESPACE)

execute_process() runs a single command or a
sequence of commands and optionally gathers the output into CMake variables. The
COMMAND is executed in WORKING_DIRECTORY and the STDOUT is saved to
OUTPUT_VARIABLE after stripping trailing whitespace. The output of git log
can be customized.