Dev-Misc Cheat Sheet
Misc
JSON Linting
python -mjson.tool input.json
- iotrack: LD_PRELOAD based I/O tracking
- Linux Debugging Techniques: DeveloperWorks article on many debugging tools: MEMWATCH, YAMD, electric fence, gdb, kgdb, kdb
- Google Address Sanitizer (Asan) for GCC 4.8+ and LLVM
- cppcheck - static code analysis
ELF Inspection
readelf -l <binary
- kcachegrind: callgrind visualization
Object Dumping
objdump -t <object file> # print symbols table objdump -dS <object file> # print assembly along source lines
- Fedora - Crash Tracker retrace.fedoraproject.org/faf
- Ubuntu - Crash Tracker errors.ubuntu.com
Java - Debugging Flags
J-Xdebug -J-Xnoagent -J-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9876
- Gearman - Jobserver
Security
Test Frameworks
Low-level C test frameworks:
- Glib Testing
lcov - GCC based test coverage metrics:
apt-get install lcov CLAGS=--coverage ./configure # Run tests lcov --capture --directory <project-dir> --output-file coverage.info genhtml coverage.info --output-directory out
Ruby rspec - Launch tests
# There are a lot of rspec launch variants: autotest rspec <path to .rb spec file> rspec <path to directory> bundle exec rspec <path to .rb spec file>
Java
Web
- Color Theory
- Javascript Design Patterns
- jsfiddle.net - JS sharing and testing
- Javascript - Key Event Codes
Javascript - JSON dumping
console.log(JSON.stringify(obj)); console.log(JSON.stringify(obj), null, 3); // indented by 3 spaces
- Javascript - ESLint: ECMAScript linter
PHP - simple webserver
php -S localhost:8000
Python - simple webserver
python -m SimpleHTTPServer
XML
Pretty-print XML:
xmllint --format my.xml
XPath on the command line
# Print subtree of tag 'sometag' xmllint --xpath "//sometag" data.xml # Match an attribute 'someattr' of 'sometag' to have literal 'string' xmllint --xpath "//sometag[contains(@someattr, 'string')" data.xml