Skip to content

Instantly share code, notes, and snippets.

View andr1972's full-sized avatar

Andrzej Borucki andr1972

View GitHub Profile
#pragma once
#include <QString>
#include <QAbstractTableModel>
#include "ivariantable.h"
template <class T>
class TableModel : public QAbstractTableModel
{
private:
@andr1972
andr1972 / btablemodel.cpp
Created March 6, 2019 19:50
simple example table model for qt
#include <string>
#include <QFile>
#include <QByteArray>
#include <QImage>
#include <QIcon>
#include "btablemodel.h"
BTableModel::BTableModel(QObject *parent) : QAbstractTableModel(parent)
{
}
@andr1972
andr1972 / lineNumbers.pro
Created March 31, 2018 19:31
Qt: editor with line numbers
QT += widgets
HEADERS = \
mainwindow.h \
linenumberarea.h \
numberededit.h
SOURCES = \
mainwindow.cpp \
main.cpp \
numberededit.cpp
@andr1972
andr1972 / miniCas.cpp
Last active September 14, 2018 02:48
Algebraic substitution trees, expand variables to subtree with cloning
#include <memory>
#include <string>
#include <vector>
#include <assert.h>
using namespace std;
enum Type { tEmpty, tNum, tVar, tFrac, tProd, tSum };
enum Precedence { precStart, precSum, precFrac, precAtom };
@andr1972
andr1972 / ReplacementTrees.cpp
Created March 15, 2018 23:21
Tree with posssiblity replacement subtree with other subtree,
#include <memory>
#include <string>
#include <vector>
#include <assert.h>
using namespace std;
class Node
{
vector<shared_ptr<Node>> childs;
@andr1972
andr1972 / Finder.cpp
Last active January 29, 2018 01:31
Ask how to share thread data
#include "Finder.h"
#include <algorithm>
#include <random>
#include <chrono>
#include <thread>
#include <string>
FinderForTx::FinderForTx()
{
}
@andr1972
andr1972 / Errors
Created October 4, 2017 14:29
HBase cmake error
root@securecluster:/usr/src/hbase/hbase-native-client/fastnative# clear
root@securecluster:/usr/src/hbase/hbase-native-client/fastnative# make
[ 20%] Linking CXX executable fastnative
/usr/local/lib/libfolly.a(dynamic.o): In function `folly::dynamic::typeName(folly::dynamic::Type)':
/usr/src/folly-2017.09.04.00/folly/dynamic.cpp:307: undefined reference to `google::LogMessageFatal::LogMessageFatal(char const*, int)'
/usr/src/folly-2017.09.04.00/folly/dynamic.cpp:307: undefined reference to `google::LogMessage::stream()'
/usr/src/folly-2017.09.04.00/folly/dynamic.cpp:307: undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
/usr/local/lib/libfolly.a(dynamic.o): In function `folly::dynamic::destroy()':
/usr/src/folly-2017.09.04.00/folly/dynamic.cpp:316: undefined reference to `google::LogMessageFatal::LogMessageFatal(char const*, int)'
@andr1972
andr1972 / debugged.cpp
Created September 19, 2017 21:51
Simple WinDebug loop
#include <cstdio>
#include <cstdlib>
#include <string>
using namespace std;
int main() {
for (unsigned int i = 0; i < 10; i++) {
fprintf(stderr, "Hello, world!\n");
}
return 0;
}
@andr1972
andr1972 / IterDelTree.cpp
Created August 14, 2017 21:43
Iterative deleting tree
#include <stack>
#include <iostream>
#include <stdint.h>
#include <random>
#include <algorithm>
using namespace std;
const int height = 10000;
uint8_t choos[height];
@andr1972
andr1972 / a.bat
Created August 13, 2017 05:34
Rust_intermediate_hello
cargo rustc -- --emit mir
cargo rustc -- --emit llvm-ir
cargo rustc -- --emit asm