Skip to content

Instantly share code, notes, and snippets.

View whatot's full-sized avatar

whatot whatot

  • Shanghai, China
View GitHub Profile
@whatot
whatot / formal-all-files.sh
Created August 10, 2017 05:23
use clang-format to format all c/c++ files based on Google style
#!/bin/bash
set -ue
PROJECT_ROOT=$(readlink -m "$(dirname "$(readlink -f "$0")")"/../)
echo "processing ${PROJECT_ROOT} ..."
find "${PROJECT_ROOT}" -type f \
-regextype posix-egrep -regex ".*\.(h|hpp|cpp|cc)$" -print0 | \
xargs -0 clang-format -style="{BasedOnStyle: Google, IndentWidth: 4}" -i
@whatot
whatot / web-servers.md
Created January 16, 2017 03:56 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
" add for the ~/linux which contains the linux kernel src,
" So tabstop, shiftwidth, softtabstop = 8 and noexpandtab are needed
" 10, 13, 16 come up with my several username
" Can calculate it by :echo stridx(expand("~/linux/:p"), "linux")
let linux_index = stridx(expand("%:p"), "linux")
autocmd FileType c,cpp if linux_index == 10 || linux_index == 13
\ || linux_index == 16 |
\ let b:syntastic_checkers = ['make'] |
\ let g:syntastic_check_on_open = 1 |
\ set tabstop=8 shiftwidth=8 softtabstop=8 noexpandtab | endif