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 / melodious-castlet.pl
Last active December 22, 2015 02:08
Pick a project name by combining two randomly picked words from a word list. Usage: `melodious-castlet.pl /usr/share/dict/words`
#!/usr/bin/env perl
# Copyright (C) 2013 A. Sinan Unur
# http://www.perlfoundation.org/artistic_license_2_0
use 5.012;
use strict;
use warnings;
use warnings qw(FATAL utf8);
use open qw(:std :utf8);
@nanis
nanis / turbo-hipster.pl
Created May 20, 2013 17:05
Traverse a tree and put together a dependency graph (using GraphViz2) based on use/require statements and the first namespace in module files. Take into account script files with no extension and ignore possible Perl in certain files. Detects a Perl file by trying to construct a PPI::Document using that file. Replaces "::" in package names with …
#!/usr/bin/env perl
use 5.014;
use strict;
use warnings;
use File::Basename qw(basename);
use File::Find;
use GraphViz2;
use Log::Handler;
@nanis
nanis / chubby-wings.pl
Created May 18, 2013 17:02
Search a tree, find strings in Perl code, check if there is SQL in them, extract tables.
#!/usr/bin/env perl
use 5.014;
use strict;
use warnings;
use File::Find;
use PPI;
use SQL::Statement;
@nanis
nanis / irritated-gnome.pl
Last active December 17, 2015 10:59
Walk through a directory, extract modules referenced in use/require statements for each Perl file, and output information in JSON format so it can be fed to create a nice graph using d3js.
#!/usr/bin/env perl
use 5.014;
use strict;
use warnings;
use open qw(:std utf8);
# This is where a patched version of Module::Extract::Use lives
# The patched version adds a 'content' accessor to M::E::U::Item objects
@nanis
nanis / build-fedfun-1997-2011.pl
Created February 22, 2013 17:02
Perl source code to clean up U.S. Federal Government Payroll data from <http://www.census.gov//govs/apes/>. Currently, it ignores the Department of Homeland Security. Dollar amounts are adjusted to 2011 dollars using the CPI. Other indexes maybe more appropriate.
#!/usr/bin/env perl
# Author: A. Sinan Unur
# Copyright (C) 2013
# License: This is free software. You can use it under the terms
# of Artistic License 2.0 <http://opensource.org/licenses/Artistic-2.0>
# In particular:
# (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT
# HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A