Skip to content

Instantly share code, notes, and snippets.

View pansila's full-sized avatar

Lix Zhou pansila

View GitHub Profile
@pansila
pansila / cpplint-function-opening-brace.patch
Last active August 28, 2018 04:00
Patch of cpplint to filter whitespace/braces for opening brace of C function
diff --git a/cpplint.py b/cpplint.py
index 95c0c32..fc8f6ba 100755
--- a/cpplint.py
+++ b/cpplint.py
@@ -3897,6 +3897,8 @@ def CheckBraces(filename, clean_lines, linenum, error):
# within the 80 character limit of the preceding line.
prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0]
if (not Search(r'[,;:}{(]\s*$', prevline) and
+ # test a C function definition
+ not Search(r'(void\s*|\(\s*|\w+(\s+\**\w+)+(,\s*\w+(\s+\**\w+)+)*\s*)\)', prevline) and
@pansila
pansila / cull_violation.py
Last active August 16, 2018 08:58
Cull violations against a patch set of git from a complete cpplint result file
#!/usr/bin/python
import sys, os
from sys import argv
from unidiff import PatchSet
import subprocess
def parse_log_line(line):
"""
parse a line from the cpplint results with --output=vs7
@pansila
pansila / gist:f0b25c1fdaef400f43f4a65b5ac67f60
Created April 4, 2018 13:00
How do I relocate the docker images?
First, all images are stored in the Hyper-V drive
C:\Users\Public\Documents\Hyper-V\Virtual hard disks
In Windows 10,
Stop docker etc
Type “Hyper-V Manager” in task-bar search box and run it.
Select your PC in the left hand pane (Mine is called DESKTOP-CBP**)
Right click on the correct virtual machine (Mine is called MobyLinuxVM)
@pansila
pansila / gist:d9d084bf7090b5851bcdceb959a61b0f
Created April 2, 2018 09:29
Remove a file in the git database permanently
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch FILE_PATH' --prune-empty --tag-name-filter cat -- --all
git push origin master --force
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now