Skip to content

Instantly share code, notes, and snippets.

View tforgione's full-sized avatar
🦀

Thomas Forgione tforgione

🦀
View GitHub Profile
trait Animal {
fn speak(&self);
}
struct Dog;
impl Animal for Dog {
fn speak(&self) {
println!("Woof");
}
#ifndef RESULT_HPP
#define RESULT_HPP
namespace ut {
template<typename T, typename E>
union result_data {
T data_ok;
E data_err;
};
// Shamelessly copied from http://rachid.koucha.free.fr/tech_corner/pty_pdip.html
#define _XOPEN_SOURCE 600
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#define __USE_BSD
#include <termios.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
template<typename T>
class MultidimArray {
public:
MultidimArray(std::initializer_list<std::size_t> sizes) : sizes{sizes}, data(
std::accumulate(std::begin(sizes), std::end(sizes), static_cast<std::size_t>(1), [](std::size_t i, std::size_t j) { return i * j; })
#include "math/Matrix.hpp"
#include <fstream>
#include <memory>
#include <array>
#include <iostream>
#include <algorithm>
enum class BranchIndex {
TopLeft = 0,
TopRight,
#include <iostream>
#include <vector>
#include <algorithm>
namespace my {
template<typename T>
struct matrix;
namespace priv {
#include <iostream>
#include <chrono>
#include <cmath>
int main(int argc, char *argv[])
{
constexpr std::size_t CONSTEXPR_SIZE = 1000000000000000000;
// The good way to use this program is to call it like so :
// ./main 1000000000000000000
std::size_t DYNAMIC_SIZE = std::atoll(argv[1]);
@tforgione
tforgione / Makefile
Last active December 8, 2016 14:32
A graph with smart pointers
SOURCES = graph.cpp node.cpp
OBJECTS = $(SOURCES:.cpp=.o)
all: graph node
%.o: %.cpp
$(CXX) -std=c++14 -o $@ -c $< -Wall
graph: graph.o
SOURCES = main.cpp
OBJECTS = $(SOURCES:.cpp=.o)
TARGET = main
LIBS = -L/opt/cling/lib \
$(shell llvm-config --cxxflags --ldflags --libs all) \
-lclingInterpreter -lclingUtils -lclangFrontend \
-lclangSerialization -lclangParse -lclangSema -lclangAnalysis -lclangEdit \
-lclangLex -lclangDriver -lclangCodeGen -lclangBasic -lclangAST \
-lz -pthread -ldl -ltinfo

Installing the lexmark X2550 printer on ArchLinux

This gist is based on my personnal experience, I struggle a lot with this, and each step in every tutorial I read caused me troubles, so I decided to write this gist.

Links :