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
| /* | |
| author: jbenet | |
| os x, compile with: gcc -o testo test.c | |
| linux, compile with: gcc -o testo test.c -lrt | |
| */ | |
| #include <time.h> | |
| #include <sys/time.h> | |
| #include <stdio.h> |
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 <chrono> | |
| class Timer { | |
| public: | |
| Timer() { start_ = std::chrono::high_resolution_clock::now(); } | |
| ~Timer() = default; | |
| template <typename T> | |
| uint64_t elapsed() { | |
| auto now = std::chrono::high_resolution_clock::now(); |
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 <archive.h> | |
| #include <archive_entry.h> | |
| #include <fcntl.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <unistd.h> | |
| #include <string> | |
| #include <vector> |
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
| #pragma once | |
| #include <tuple> | |
| #include <type_traits> | |
| template <typename... DestroyFuncs> | |
| class DestroyGuard { | |
| public: | |
| ~DestroyGuard() { | |
| call_all_destroy_callbacks( |
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 <stdio.h> | |
| #include <unistd.h> | |
| #include <string.h> | |
| #include <pthread.h> | |
| #include <sys/file.h> | |
| #include <time.h> | |
| static inline long long get_uptime_ms() { | |
| struct timespec ts; | |
| if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) { |
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
| #!/usr/bin/env python3 | |
| import os | |
| import fcntl | |
| import sys | |
| import argparse | |
| import glob | |
| CMD_OPEN = 0xFF | |
| CMD_CLOSE = 0xFD | |
| HIDIOCSFEATURE_9 = 0xC0094806 # Write feature report |
OlderNewer