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
curl http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add | |
echo 'deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.8 main' >> /etc/apt/sources.list | |
apt-get update | |
apt-get install clang-3.8 lldb-3.8 |
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
while true; do sleep 1; npid="$( ps | grep Dia[g] | awk '{ print $1 }' )"; if [ "$npid" != "$pid" ]; then echo "$(date) crash detected"; fi; | |
pid=$npid; done |
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
montage *png -tile 4x4 -geometry 200x150 -background transparent sprites.png |
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
convert all images to a fixed width, expanding the trasparent background. useful to create sprites | |
for i in ../*.png; do convert $i -gravity NorthWest -background transparent -extent 200x150 $( basename $i ); done |
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
class Cfg { | |
public: | |
Cfg(std::initializer_list<std::pair<std::string, Cfg>> init) { | |
for (auto&& it: init) { | |
children_.insert(it); | |
} | |
} | |
Cfg(std::initializer_list<std::pair<std::string, std::string>> init) { | |
for (auto&& it: init) { | |
children_.insert(it); |
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
/** | |
* An Mirf example which copies back the data it recives. | |
* | |
* Pins: | |
* Hardware SPI: | |
* MISO -> 12 | |
* MOSI -> 11 | |
* SCK -> 13 | |
* | |
* Configurable: |
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
template <typename... Args> | |
std::vector<std::string> toStringVector(Args... args) { | |
std::vector<std::string> result; | |
auto initList = {args...}; | |
using T = typename decltype(initList)::value_type; | |
std::vector<T> expanded{initList}; | |
result.resize(expanded.size()); | |
std::transform(expanded.begin(), expanded.end(), result.begin(), [](T value) { return std::to_string(value); }); | |
return result; | |
} |
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
## http://clang.llvm.org/docs/ClangFormatStyleOptions.html | |
## Version: 3.8 | |
--- | |
BasedOnStyle: LLVM | |
AccessModifierOffset: -2 | |
AlignAfterOpenBracket: AlwaysBreak | |
AlignConsecutiveAssignments: false | |
AlignConsecutiveDeclarations: false | |
AlignEscapedNewlinesLeft: true | |
AlignOperands: 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
#include <openssl/bio.h> | |
#include <openssl/buffer.h> | |
#include <openssl/evp.h> | |
using RawData = std::vector<uint8_t>; | |
RawData encode(const RawData& input) { | |
BIO* b64 = BIO_new(BIO_f_base64()); | |
BIO* bio = BIO_new(BIO_s_mem()); | |
bio = BIO_push(b64, bio); |
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
template <typename T> | |
using Checker = std::function<bool(T)>; | |
template <typename T> | |
class Param { | |
public: | |
Param(std::string, Checker<T>) { | |
} | |
Param(std::string) { |