Skip to content

Instantly share code, notes, and snippets.

View poseidon4o's full-sized avatar

Lyubomir poseidon4o

View GitHub Profile
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@poseidon4o
poseidon4o / snake.cpp
Last active July 2, 2024 14:02
C++ lame snake game written in class
#include <iostream>
#include <windows.h>
using namespace std;
struct position {
int x,y;
};
@poseidon4o
poseidon4o / events.cpp
Created May 14, 2014 14:18
Simple events with C++11
#include <windows.h>
#include <list>
#include <map>
#include <functional>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
typedef function<bool()> pred_f;
@poseidon4o
poseidon4o / serialize.cpp
Created June 2, 2014 14:09
Simple serialization example
#include <iostream>
#include <cstring>
using namespace std;
// add Copy ctors // operator =
void stupid_memcopy(char * dest, char * source, int size) {
while(size--) {
*dest = *source;
}
#include <queue>
#include <vector>
#include <algorithm>
#include <map>
#include <limits>
#include <iostream>
using namespace std;
typedef pair<int, int> weight_pair;
@poseidon4o
poseidon4o / fixer.py
Last active August 29, 2015 14:07
Extract script for source files downloaded from moodle's 'mass download' option.
#!/usr/bin/python3
from re import compile, findall, match, sub
from argparse import ArgumentParser
from mimetypes import guess_type
from subprocess import call
from datetime import date
from random import randint
from collections import defaultdict
from sys import exit
#include <stack>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <iostream>
#include <functional>
#include <iterator>
#include <random>
#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <random>
#include <algorithm>
#include <chrono>
using namespace std;
random_device device;
@poseidon4o
poseidon4o / SimpleTest.cpp
Created November 3, 2014 22:05
Very simple class allowing you to make and run test cases based on lambdas as callbacks.
#pragma once
#include <vector>
#include <functional>
#include <string>
#include <utility>
#include <iostream>
class SimpleTesting {
public:
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <chrono>
#include <limits>
#include <functional>
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
using namespace std::chrono;