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 / gpg.sh
Created February 27, 2013 05:25
importing ubuntu to linux mint maya 13 gpg keys
gpg --keyserver subkeys.pgp.net --recv-key 2EBC26B60C5A2783
gpg --keyserver subkeys.pgp.net --recv-key 3EE67F3D0FF405B2
@nurettin
nurettin / notclosing.rb
Created March 12, 2013 13:00
opening xls with JRuby and apache poi
require 'java'
require 'lib/java/poi/poi-3.9/poi-3.9-20121203.jar'
java_import 'org.apache.poi.poifs.filesystem.POIFSFileSystem'
java_import 'org.apache.poi.hssf.usermodel.HSSFCell'
java_import 'org.apache.poi.hssf.usermodel.HSSFWorkbook'
java_import 'org.apache.poi.hssf.usermodel.HSSFCellStyle'
java_import 'org.apache.poi.hssf.usermodel.HSSFDataFormat'
java_import 'java.io.FileInputStream'
java_import 'java.util.Date'
@nurettin
nurettin / lolrange.cpp
Created March 27, 2013 12:22
play with boost range and overloading string operator
#include <iostream>
#include <string>
#include <boost/range/counting_range.hpp>
typedef boost::iterator_range<boost::counting_iterator<int> > counting_range_int_t;
counting_range_int_t operator "" _ri(char const* wtf, std::size_t len)
{
static std::istringstream parse;
parse.clear();
@nurettin
nurettin / chokesoncock.cpp
Last active December 15, 2015 11:38
chokes.
#include <iostream>
#include <string>
#include <boost/range/counting_range.hpp>
typedef boost::iterator_range<boost::counting_iterator<int> > counting_range_int_t;
counting_range_int_t operator "" _ri(char const* wtf, std::size_t len)
{
static std::istringstream parse;
parse.clear();
@nurettin
nurettin / gist:5317085
Last active December 15, 2015 20:18
C#? in my C++11 ?
#include <functional>
template <typename T>
struct Property
{
T value;
std::function<T()> getter;
std::function<void(T)> setter;
operator T(){ return getter(); }
void operator= (T wtf){ setter(wtf); }
@nurettin
nurettin / csharpin.cpp
Created April 5, 2013 06:56
in my c++?!
#include <functional>
template <typename T>
struct Property
{
T value;
std::function<T()> getter;
std::function<void(T)> setter;
operator T(){ return getter(); }
void operator= (T wtf){ setter(wtf); }
@nurettin
nurettin / torquebox_warbler_war_error.txt
Created May 3, 2013 13:48
torquebox deploy war error
org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `cache_container' for nil:NilClass
at RUBY.manager(/home/torquebox/.rvm/gems/jruby-1.7.2/gems/torquebox-cache-2.3.0-java/lib/cache.rb:275)
at RUBY.cache(/home/torquebox/.rvm/gems/jruby-1.7.2/gems/torquebox-cache-2.3.0-java/lib/cache.rb:264)
at RUBY.initialize(/home/torquebox/.rvm/gems/jruby-1.7.2/gems/torquebox-cache-2.3.0-java/lib/cache.rb:72)
at RUBY.cache(/home/torquebox/.rvm/gems/jruby-1.7.2/gems/torquebox-cache-2.3.0-java/lib/active_support/cache/torque_box_store.rb:125)
at RUBY.initialize(/home/torquebox/.rvm/gems/jruby-1.7.2/gems/torquebox-cache-2.3.0-java/lib/active_support/cache/torque_box_store.rb:32)
at RUBY.lookup_store(/home/torquebox/.rvm/gems/jruby-1.7.2/gems/activesupport-3.2.13/lib/active_support/cache.rb:69)
at RUBY.Bootstrap(/home/torquebox/.rvm/gems/jruby-1.7.2/gems/railties-3.2.13/lib/rails/application/bootstrap.rb:54)
at RUBY.silence_warnings(/home/torquebox/.rvm/gems/jruby-1.7.2/gems/activesupport-3.2.13/lib/a
`app/admin/product.rb`
ActiveAdmin.register Product do
controller do
def permitted_params
params.permit(product_arts_attributes: [:uri])
end
end
form({ html: { multipart: true } }) do |f|
@nurettin
nurettin / counting_unique.cpp
Created August 3, 2013 08:44
counting unique
#include <cstdlib>
namespace pwned {
template <class ForwardIterator, class OutputIterator>
ForwardIterator counting_unique (ForwardIterator first, ForwardIterator last, OutputIterator out)
{
if (first==last) return last;
ForwardIterator result = first;
std::size_t count= 1;
include Java
require 'blpapi3.jar'
opts = com.bloomberglp.blpapi.SessionOptions.new
opts.server_host = 'localhost'
opts.server_port = 8194
session = com.bloomberglp.blpapi.Session.new opts
service = '//blp/refdata'
throw "Can't start Bloomberg" unless session.start && session.open_service(service)