Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
- Follow standard conventions.
- Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.
| g++ `pkg-config --cflags --libs opencv` $1 -o $2 `pkg-config --cflags --libs opencv` | |
| # $1 = yourprogram.cpp | |
| # $2 = executable output name; yourprogram | |
| # save the file in your directory | |
| # $chmod +x cv-compile.sh | |
| # $sh cv-compile $1 $2 | |
| # Caveats |
| #!/bin/bash | |
| for i in *.djvu; | |
| do ddjvu -format=pdf "$i" "${i/%.djvu/}.pdf" && rm $i | |
| done |
| #!/bin/sh | |
| # add this to your bitbar directory | |
| # don't forget to chmod +x | |
| # width and characters for the progress bars | |
| # feel free to configure these | |
| width=30 | |
| fill_char="█" | |
| empty_char="▁" |
This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).
Matrix multiplication is a mathematical operation that defines the product of
Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.
There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.
1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]
struct foo {
struct bar {
int x;| class Python < Formula | |
| desc "Interpreted, interactive, object-oriented programming language" | |
| homepage "https://www.python.org/" | |
| url "https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tar.xz" | |
| sha256 "a9e0b79d27aa056eb9cce8d63a427b5f9bab1465dee3f942dcfdb25a82f4ab8a" | |
| head "https://github.com/python/cpython.git" | |
| license "Python-2.0" | |
| revision 1 | |
| bottle do |
| <body onload=z=c.getContext`2d`,setInterval(`c.width=W=150,Y<W&&P<Y&Y<P+E|9<p?z.fillText(S++${Y=`,9,9|z.fillRect(p`}*0,Y-=--M${Y+Y},P+E,9,W),P))):p=M=Y=S=6,p=p-6||(P=S%E,W)`,E=49) onclick=M=9><canvas id=c> |