I hereby claim:
- I am christianparpart on github.
- I am christianparpart (https://keybase.io/christianparpart) on keybase.
- I have a public key ASBMqVh2DLZYRs0gU_bYuO1aFo4mF3ygiyPiWHUQrBPorwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| // This file is part of the "klex" project, http://github.com/christianparpart/klex> | |
| // (c) 2018 Christian Parpart <christian@parpart.family> | |
| // | |
| // Licensed under the MIT License (the "License"); you may not use this | |
| // file except in compliance with the License. You may obtain a copy of | |
| // the License at: http://opensource.org/licenses/MIT | |
| #pragma once | |
| #include <type_traits> |
| #include <iostream> | |
| #include <memory> | |
| #include <string> | |
| #include <vector> | |
| using namespace std; | |
| template <typename T> | |
| struct Owned { // Requires `T* T::clone() const` | |
| ~Owned() = default; |
| #include <string> | |
| class Blueprint | |
| { | |
| private: | |
| std::string typeName_; | |
| std::string name_; | |
| public: | |
| explicit Blueprint(const std::string& name) : typeName_{"docker"}, name_{name} {} |
| // C++17 version of some code shown here in Java: | |
| // https://github.com/impulse-cl/impulse/blob/master/src/main/java/io/impulsecloud/daemon/blueprint/indexer/FileSystemBlueprintIndexer.java#L42 | |
| // Since C++ does not provide the convinient API we just implemented it ourselves. | |
| // | |
| // How to compile: | |
| // g++ -std=c++17 demo.cpp -o demo -lstdc++fs | |
| // | |
| // NOTE: This is just for showing what is possible, not for providing the best-possible speed optimized and feature-complete solution. | |
| #include <iostream> | |
| #include <experimental/filesystem> |
| // trapni@starfall [~] > cat blah.cc | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <sys/types.h> | |
| #include <unistd.h> | |
| int main() | |
| { | |
| // EUID is 0 already (because binary's setuid bit is set and binary's uid=0). | |
| // Now we can use that to set UID to 0. |
| #include <stdio.h> // printf, getline | |
| #include <stdlib.h> // atoi | |
| char* prompt(const char* msg, char* result, size_t capacity) | |
| { | |
| printf("%s: ", msg); | |
| size_t n = getline(&result, &capacity, stdin); | |
| result[n - 1] = '\0'; // erase linefeed (\n) | |
| return result; | |
| } |
Did you know you can checkout pull requests by their number?
git fetch origin pull/<pr_nr>/head:<branch>
git checkout <branch>| { | |
| "version": "0.2.1", | |
| "defaults": {}, | |
| "configurations": [ | |
| { | |
| "type": "default", | |
| "project": "CMakeLists.txt", | |
| "projectTarget": "isoltest.exe (test\\tools\\isoltest.exe)", | |
| "name": "isoltest.exe (test\\tools\\isoltest.exe)", | |
| "currentDir": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}", |
| #include <thread> | |
| #include <stdio.h> | |
| #include <signal.h> | |
| #include <string.h> | |
| #include <unistd.h> | |
| #include <sys/socket.h> | |
| #include <netinet/in.h> | |
| #include <arpa/inet.h> | |
| #include <sys/types.h> |