Skip to content

Instantly share code, notes, and snippets.

View nanis's full-sized avatar

A. Sinan Unur nanis

View GitHub Profile
@nanis
nanis / var.cpp
Last active December 7, 2016 14:59
Simple C++ program to demonstrate boost's variance accumulator
#include <iomanip>
#include <iostream>
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/variance.hpp>
#include <boost/accumulators/statistics/stats.hpp>
namespace bacc = boost::accumulators;
static void
demo(const double base)
@nanis
nanis / power-fail.txt
Created June 22, 2016 01:43
t\spec\S32-num\power.rakudo.moar failures
t\spec\S32-num\power.rakudo.moar ..
1..76
ok 1 - 0 ** 0 == 1
ok 2 - 0 ** 1 == 0
ok 3 - 1 ** 2 == 1
ok 4 - 4 ** 0 == 1
ok 5 - 4 ** 1 == 4
ok 6 - 4 ** 2 == 16
ok 7 - 0 ** 4553535345364535345634543534 == 0
ok 8 - 1 ** 4553535345364535345634543534 == 1
@nanis
nanis / io-spurt-fail.txt
Created June 22, 2016 01:42
t\spec\S32-io\spurt.t failures
t\spec\S32-io\spurt.t ..
1..35
ok 1 - spurting Buf ok
ok 2 - spurting txt ok
ok 3 - spurt with enc
ok 4 - spurting Buf with append
ok 5 - spurting txt with append
not ok 6 - createonly creates file with Buf
# Failed test 'createonly creates file with Buf'
@nanis
nanis / io-pipe-fail.txt
Created June 22, 2016 01:40
t\spec\S32-io\pipe.t failures
t\spec\S32-io\pipe.t ..
1..14
ok 1 - shell/run(:out).out is a Proc
ok 2 - shell/run(:out).out is an IO::Pipe
ok 3 - shell/run(:out) returns something trueish on success
ok 4 - Proc::Status.exitcode is zero for a successful run
ok 5 - Proc::Status.status is zero for a successful run
ok 6 - got correct output
1..6
ok 1 - Child succeeds but does not print anything
$ tar -xvf samtools-0.1.18.tar.bz2
$ cd samtools-0.1.18
$ make CFLAGS=-fPIC
Note, there are problems building this with GCC 5.3.0 because of the
use of `inline` with functions that are supposed to go in to a library.
Once that is fixed, library builds fine.
$ export SAMTOOLS=`pwd`; ~/perl/5.22.0/bin/cpanm Bio::DB::Sam
--> Working on Bio::DB::Sam
@nanis
nanis / download-tpp.pl
Last active November 8, 2015 18:06
A quick'n'dirty Perl script to download the entire TPP and combine it into a single PDF document
#!/usr/bin/env perl
=for comment
Office of the Unites States Trade Representative released the full text of the
Trans-Pacific Partnership trade agreement on November 5, 2015. For some reason,
it was released in 239 individual PDF documents, instead of a single file.
ToC at https://ustr.gov/trade-agreements/free-trade-agreements/trans-pacific-partnership/tpp-full-text
@nanis
nanis / random_real.c
Created August 14, 2015 21:12
Originally at http://mumble.net/~campbell/tmp/random_real.c Saved here for reference (as allowed by the copyright statement)
/*
* Uniform random floats: How to generate a double-precision
* floating-point number in [0, 1] uniformly at random given a uniform
* random source of bits.
*
* Copyright (c) 2014, Taylor R Campbell
*
* Verbatim copying and distribution of this entire article are
* permitted worldwide, without royalty, in any medium, provided
* this notice, and the copyright notice, are preserved.
@nanis
nanis / stefik.quorum
Created June 12, 2015 15:48
See http://www.nu42.com/2015/06/quorum-creators-cannot-write-quorum.html This is the Quorum code in Stefik et al. 2011 and Stefik & Siebert 2013//
/*
http://www.nu42.com/2015/06/quorum-creators-cannot-write-quorum.html
Quorum is a programming language created by Stefik et al. In a 2011 paper, the authors infamously proclaimed:
Results showed that while Quorum users were afforded significantly
greater accuracy compared to those using Perl and Randomo, Perl users
were unable to write programs more accurately than those using a
language designed by chance.
@nanis
nanis / gugu
Last active August 29, 2015 14:22
#!/usr/bin/env perl
use v5.20;
=for commentary
This is my second entry in brian d foy's "Be Better than Quorum" challenge
See L<http://www.learning-perl.com/2015/06/learning-perl-challenge-be-better-than-quorum/>
I went for baroqueness with this one.
@nanis
nanis / ququ
Created June 4, 2015 15:35
My first entry in brian d foy's "Be better than Quorum challange"
#!/usr/bin/env perl
use v5.20;
=for commentary
See L<http://www.learning-perl.com/2015/06/learning-perl-challenge-be-better-than-quorum/>
I know there will be reasonable entries, so here's one for variety ;-)
-- Sinan