This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
Language: Cpp | |
# BasedOnStyle: LLVM-Modified-by-RJ | |
AccessModifierOffset: -2 | |
AlignAfterOpenBracket: DontAlign | |
AlignConsecutiveAssignments: true | |
AlignConsecutiveDeclarations: false | |
AlignEscapedNewlines: Right | |
AlignOperands: true | |
AlignTrailingComments: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying my Blockstack ID is secured with the address 1FhDaxSAbL7yf78wAgtZshqvt7EJsC4mfx https://explorer.blockstack.org/address/1FhDaxSAbL7yf78wAgtZshqvt7EJsC4mfx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Iptables ip/port range spec: | |
Multiple individual ports: | |
iptables -t mangle -A OUTPUT -p udp --match multiport --dports 110,143,993,955 -j MARK --set-mark 13 | |
Port Range: | |
iptables -t mangle -A OUTPUT -p udp --match multiport --dports 1024:3000 -j MARK --set-mark 13 | |
Multiple Port ranges: | |
iptables -t mangle -A OUTPUT -p udp --match multiport --dports 1000:2000,3000:4000 -j MARK --set-mark 13 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool isPowOf2(val) | |
{ | |
return val && !( val & ( val - 1)); | |
// val && is required so that val=0 is handled. 0 is not the pow of 2 | |
} | |
/* increment val only if MAX_UINT val not reached. Use-case: for stats incr, you dont want the val to cycle */ | |
#define STAT(S) (S) += (!!(S ^ 0xffffffff)) // S will incr by 1 only till it reach 0xffffffff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
Language: Cpp | |
# BasedOnStyle: WebKit | |
AccessModifierOffset: -4 | |
AlignAfterOpenBracket: true | |
AlignConsecutiveAssignments: true | |
AlignConsecutiveDeclarations: true | |
AlignEscapedNewlinesLeft: false | |
AlignOperands: true | |
AlignTrailingComments: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Checks: '-*,readability-identifier-naming' | |
CheckOptions: | |
- { key: readability-identifier-naming.NamespaceCase, value: lower_case } | |
- { key: readability-identifier-naming.ClassCase, value: CamelCase } | |
- { key: readability-identifier-naming.PrivateMemberPrefix, value: m_ } | |
- { key: readability-identifier-naming.StructCase, value: CamelCase } | |
- { key: readability-identifier-naming.FunctionCase, value: CamelCase } | |
- { key: readability-identifier-naming.VariableCase, value: camelBack } | |
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE } | |
- { key: readability-identifier-naming.GlobalVariableCase, value: camelBack } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=gcc | |
AR=ar | |
V = 0 | |
ACTUAL_CC := $(CC) | |
CC_0 = @echo "CC [$<]"; $(ACTUAL_CC) | |
CC_1 = $(ACTUAL_CC) | |
CC = $(CC_$(V)) | |
ACTUAL_AR := $(AR) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perf record --call-graph dwarf -p PID | |
perf report --call-graph=graph,0.001,calle,function,percent --sort=symbol | |
perf report --call-graph=graph,0.001,calle,function,count --sort=symbol |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example code which shows how to compare the two typedefs for size equivalency. | |
#define CONCAT_(a,b) a##b | |
#define CONCAT(a,b) CONCAT_(a, b) | |
#define STATIC_ASSERT(e) \ | |
; enum { CONCAT(assert_line_, __LINE__) = 1/(int)(!!(e)) } | |
/* Note that ; is needed before enum if the STATIC_ASSERT is added right after case or label statement */ | |
/* Note that multiple CONCATs are needed so that __LINE__ could be expanded .. Thus you can now have multiple STATIC_ASSERTs in the same code block */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main" | |
sudo apt-get update | |
sudo apt-get install -y clang-6.0 clang-tidy |