Skip to content

Instantly share code, notes, and snippets.

View bananu7's full-sized avatar
🏍️

Bartek Banachewicz bananu7

🏍️
View GitHub Profile
@bananu7
bananu7 / lcd.c
Created March 19, 2013 13:09
Text editor on PIC microcontroller
#include <p18f4520.h>
#include <delays.h>
#include <usart.h>
#include "xlcd.h"
#include<ctype.h>
#pragma config WDT = OFF
int j;
char rb = '?';
//Texture.h
class Texture {
#include <textypes_gl3.h>
void SetType(Type t);
};
// textypes_gl3.h
enum class Type {
@bananu7
bananu7 / time7.js
Created March 25, 2013 18:01
de-obfuscated Time7 from XKCD
(function (e) {
"use strict";
function t() {
this.data = {}
}
function n() {
this.listeners = new t
}
function r(e) {
int main(){}
@bananu7
bananu7 / complog
Created April 29, 2013 21:02
compilation log u
1>------ Build started: Project: lundi (Microsoft Visual C++ Compiler Nov 2012 CTP), Configuration: Debug Win32 ------
1> 'Microsoft Visual C++ Compiler Nov 2012 CTP' is for testing purposes only.
1> test.cpp
1>c:\projects\lundi\lundi.hpp(53): warning C4244: '=' : conversion from 'lua_Number' to 'int', possible loss of data
1>c:\projects\lundi\lundi.hpp(138): warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
1>c:\projects\lundi\catch\single_include\catch.hpp(691): warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
1>c:\projects\lundi\catch\single_include\catch.hpp(692): warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
1>c:\projects\lundi\test.cpp(125): warning C4003: not enough actual parameters for macro 'REQUIRE_NOTHROW'
1>c:\dev\boost_1_52_0\boost\variant\variant.hpp(1331): warning C4800: 'const char *const ' : forcing value to bool 'true' or 'false' (performance warning)
1> c:\dev\boost_1_52
@bananu7
bananu7 / Notified.cpp
Last active December 17, 2015 16:59
Class wrapping value with notification callbacks
#include <set>
#include <functional>
#include <memory>
template<typename T>
class Notified {
T v;
using CbType = std::function<void(const T&)>;
@bananu7
bananu7 / problem.md
Last active December 17, 2015 19:19
What to do when you encounter a problem :)
  • A - A problem
  • B - Before doing anything, verify.
  • C - Cry. It's not working, after all.
  • F - F everything!
  • Q - Ask a question on Stack Overflow.
  • Z - Zzz. Go to sleep and try again tomorrow.
@bananu7
bananu7 / list_vs_vector.cpp
Created June 11, 2013 18:33
List vs Vector benchmark bajtek@bajtek-VirtualBox:~/list_vs_vector$ time ./list real 0m0.116s user 0m0.080s sys 0m0.020s bajtek@bajtek-VirtualBox:~/list_vs_vector$ time ./vec real 0m0.107s user 0m0.068s sys 0m0.024s
1 #include <list>
2 #include <vector>
3
4 const unsigned n = 1000000;
5
6 int main () {
7 std::list<int> list_a;
8 for (int i = 1; i <= 1000000; ++i)
9 list_a.push_back(i);
10 std::list<int> list_b;
#include <iostream>
#include <chrono>
#include <windows.h>
#include <gl/GLEW.h>
#include <vector>
using namespace std;
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
{-# LANGUAGE TemplateHaskell, Rank2Types #-}
import Prelude hiding ((.), id)
import Control.Category
import Control.Lens
import Control.Lens.TH
type Register = Int
data Machine = Machine { _ax :: Register, _bx :: Register } deriving Show
data SMPMachine = SMP { _cpu0 :: Machine, _cpu1 :: Machine } deriving Show