#include <iostream>
#include <string>
#include <ftw.h>
#include <fts.h>
template <typename T>
void walk_dir(std::string const& fpath, T&& function)
{
char const* filepath[] = { fpath.c_str(), nullptr };
This file contains 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
[alias] | |
ls = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short | |
ll = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat --date=short | |
graph = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | |
new = !sh -c 'git log $1@{1}..$1@{0} "$@"' | |
st = status -s | |
diff = diff --patience | |
[user] | |
email = [email] | |
name = dtoma |
This file contains 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 <chrono> | |
#include <iomanip> | |
#include <iostream> | |
int main() { | |
auto now = std::chrono::high_resolution_clock::now(); | |
auto time = std::chrono::system_clock::to_time_t(now); | |
auto tm = *std::gmtime(&time); | |
// auto tm = *std::localtime(&time); |
This file contains 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 <cstdio> | |
#include <functional> | |
#include <unordered_map> | |
#include <vector> | |
// Notes | |
// [some brainfuck fluff by daniel b cristofani](http://www.hevanet.com/cristofd/brainfuck/) | |
// [The Epistle to the Implementors](http://www.hevanet.com/cristofd/brainfuck/epistle.html) | |
// [The BrainFuck Compiler Collection](https://github.com/Sirflankalot/bfcc) |
This file contains 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 <cstdio> | |
#include <array> | |
#include <x86intrin.h> | |
int main() { | |
__m128 vector_a = { 1, 2, 3, 4 }; | |
__m128 vector_b = { 5, 6, 7, 8 }; | |
vector_a = _mm_add_ps(vector_a, vector_b); | |
std::array<float, 4> a; | |
_mm_store_ps(a.data(), vector_a); |
This file contains 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
// https://banu.com/blog/2/how-to-use-epoll-a-complete-example-in-c/ | |
// http://www.kegel.com/poller/ | |
/** Todo | |
* - [ ] Split i/o and logic | |
* - [ ] Unit test logic | |
* - [ ] Logging | |
* - [ ] Continuous integration | |
* - [ ] Linux | |
* - [ ] Windows |
This file contains 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 <cstdio> | |
template <typename ... Args> | |
bool safe_sscanf(char const* s, char const* fmt, Args*... args) | |
{ | |
constexpr auto len = sizeof...(args); | |
auto n = sscanf(s, fmt, args...); | |
if (n != len) | |
{ | |
printf("sscanf error: captured %d instead of %zu - string was [%s], format was [%s]\n", n, len, s, fmt); |
This file contains 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
""" | |
Interpreter for a language targeted at solving fizzbuzz | |
Source: [The fastest fizzbuzz in the west](https://www.promptworks.com/blog/the-fastest-fizzbuzz-in-the-west) | |
## Imports | |
""" | |
from rply import LexerGenerator, ParserGenerator | |
from rply.token import BaseBox | |
import sys |
This file documents the mmap() facility available with the PACKET socket interface on 2.4/2.6/3.x kernels. This type of sockets is used for i) capture network traffic with utilities like tcpdump, ii) transmit network traffic, or any other that needs raw access to network interface.
You can find the latest version of this document at: http://wiki.ipxwarzone.com/index.php5?title=Linux_packet_mmap
This file contains 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
# TODO: | |
# - build modes: release, debug | |
CXX := g++ | |
EXECUTABLE := project.exe | |
EXECUTABLE_TESTS := project_tests.exe | |
INCLUDE := -I./deps | |