Skip to content

Instantly share code, notes, and snippets.

View nurettin's full-sized avatar
🏠
Working from home

Nurettin Onur TUĞCU nurettin

🏠
Working from home
View GitHub Profile
@nurettin
nurettin / art.sql
Created May 9, 2018 11:59
group rows by pilot row, show line numbers and line count
select
i
, c
, g
, gi
, sum(1) over (partition by g) gn
from (
select
i
, c
@nurettin
nurettin / Gemfile
Last active February 10, 2018 20:44
simple solution to einstein's riddle (also known as zebra puzzle)
source "https://rubygems.org"
gem "csp-solver"
gem "terminal-table"
program SQLWorkbenchExplain;
{$APPTYPE CONSOLE}
uses
SysUtils, Classes, JclSysUtils, IniFiles;
type
TConfig = record
LogFile: string;
### Keybase proof
I hereby claim:
* I am nurettin on github.
* I am nurettin (https://keybase.io/nurettin) on keybase.
* I have a public key whose fingerprint is 7687 787E A662 029F 2DD6 94CF 9B86 DFB2 25ED E4CB
To claim this, I am signing this object:
buildscript {
...
}
...
android {
...
}
dependencies {
@nurettin
nurettin / fann.cpp
Created January 16, 2016 18:21
fast artificial neural network library
#include <fann.h>
#include <fann_cpp.h>
void prepare_data(std::string const &name){
std::ofstream file(name+ ".data", std::ios::trunc);
file<< "4 2 1\n"
<< "0 0\n0\n"
<< "0 1\n1\n"
<< "1 0\n1\n"
<< "1 1\n0\n";
@nurettin
nurettin / pwned_recursive_map.cpp
Created January 4, 2014 12:09
who wants types?
#include <iostream>
#include <map>
#include <string>
#include <boost/variant.hpp>
typedef boost::variant<std::string, double, int> Data;
struct Graph: std::map<Data, Graph>
{
Data data;
@nurettin
nurettin / pwned_combinator.cpp
Last active December 28, 2015 23:59
The Pwned Combinator
/*
The Pwned Combinator is a patten which gives you the ability to store a common base for templated classes in a container
while not losing the ability to access the member variables and functions of the derived instance.
In this pattern, the base class uses polymorphism to signal usage which then triggers the callable.
*/
struct Base
{
virtual void use()= 0;
@nurettin
nurettin / lazy_concept.cpp
Last active December 28, 2015 21:09
C++11 lazy parameters
#include <functional>
#include <vector>
#include <boost/optional.hpp>
struct LazyBase
{
std::vector<std::reference_wrapper<LazyBase>> dependents;
virtual void nullify()= 0;
virtual ~LazyBase(){}
};
@nurettin
nurettin / bench.cpp
Created November 15, 2013 12:01
pretty benchmark class
// the idea is to benchmark and output pretty results
#include <iostream>
#include <functional>
#include <chrono>
#include <vector>
struct Fun
{
std::string name;