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
; Just for fun. | |
; Compile with | |
; nasm -f elf32 -o arp.o arp.asm | |
; gcc -m32 -o arp arp.o | |
; Run it | |
; sudo ./arp | |
BITS 32 | |
SEGMENT .data |
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
public class AsmTest { | |
public static native int addThem(int a, int b); | |
static { | |
// Looks for libaddThem.so or addThem.dll, depending on the OS | |
System.loadLibrary("addThem"); | |
} | |
public static void main(String[] args) { | |
int result = addThem(4, 5); |
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 <iostream> | |
using namespace std; | |
constexpr auto all(auto&&... args) { | |
return (args && ...); | |
} | |
int main() { | |
cout << boolalpha; |
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 <algorithm> | |
#include <iostream> | |
#include <vector> | |
#include <boost/asio/coroutine.hpp> | |
#include <boost/asio/yield.hpp> | |
using namespace std; | |
using namespace boost::asio; |
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 <iostream> | |
template <unsigned long long N, char... C> | |
constexpr auto to_bin = to_bin<(N >> 1), '0' + (N & 1), C...>; | |
template <char... C> | |
constexpr char to_bin<0, C...>[] = { C..., '\0' }; | |
template <unsigned long long N, size_t L, char... C> |
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 <array> | |
#include <cstdint> | |
#include <iostream> | |
#include <stdexcept> | |
using namespace std; | |
template <unsigned long long n> | |
constexpr auto count_set_bits = (n & 1) + count_set_bits<(n >> 1)>; |
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
// g++ -std=c++14 -o gtkmm-example gtkmm-example.cpp `pkg-config --cflags --libs gtkmm-3.0` | |
#include <memory> | |
#include <gtkmm.h> | |
class MainWindow : public Gtk::ApplicationWindow { | |
public: | |
MainWindow(BaseObjectType* obj, Glib::RefPtr<Gtk::Builder> const& builder) | |
: Gtk::ApplicationWindow(obj) | |
, builder{builder} |
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
using System; | |
using System.Linq; | |
namespace Times { | |
static class Extensions { | |
public static void times(this int t, Action f) { | |
for (int i = 0; i < t; ++i) { | |
f(); | |
} | |
} |
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 <algorithm> | |
#include <array> | |
#include <fstream> | |
#include <numeric> | |
#include <random> | |
using namespace std; | |
// Step 1 - Create a file with 256 MiB of data | |
array<uint64_t, 256 * 1024 * 1024 / sizeof(uint64_t)> data; |
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 <algorithm> | |
#include <experimental/any> | |
#include <array> | |
#include <condition_variable> | |
#include <functional> | |
#include <iostream> | |
#include <iterator> | |
#include <mutex> | |
#include <thread> | |
#include <vector> |
OlderNewer