Skip to content

Instantly share code, notes, and snippets.

@bobular
bobular / mapCSVtoVEuPathSolr.pl
Created March 3, 2020 14:43
Preliminary Solr for site search
#!/usr/bin/env perl
# -*- mode: cperl -*-
use strict;
use warnings;
use Text::CSV_XS;
use JSON;
my ($file) = @ARGV;
my $json = JSON->new->pretty;
config :
item one : blah
item two : asdasd
@bobular
bobular / pension-model-with-USS-returns.pl
Last active April 26, 2018 08:32
Same model as previous v3 version but with a step change expected return in the contribution period.
#!/usr/bin/env perl
# -*- mode: cperl -*-
#
# The purpose of this little model is to figure out what kind of
# investment returns the pension fund needs to make in order to meet
# its defined benefits promises.
#
# It assumes a single employee with their own "pot" and a fixed payout
# period. I'm not suggesting euthanasia... Obviously in reality the
# longevity risk is shared by the many thousands of scheme
@bobular
bobular / pension-funding-model-v3.pl
Created March 14, 2018 23:15
Pension costing model, now including annual payrise parameter
#!/usr/bin/env perl
# -*- mode: cperl -*-
#
# The purpose of this little model is to figure out what kind of
# investment returns the pension fund needs to make in order to meet
# its defined benefits promises.
#
# It assumes a single employee with their own "pot" and a fixed payout
# period. I'm not suggesting euthanasia... Obviously in reality the
# longevity risk is shared by the many thousands of scheme
@bobular
bobular / pension-funding-model-v2.pl
Created March 6, 2018 16:27
Slightly more complex pension funding model, which includes career progression
#!/usr/bin/env perl
# -*- mode: cperl -*-
#
# The purpose of this little model is to figure out what kind of
# investment returns the pension fund needs to make in order to meet
# its defined benefits promises.
#
# It assumes a single employee with their own "pot" and a fixed payout
# period. I'm not suggesting euthanasia... Obviously in reality the
# longevity risk is shared by the many thousands of scheme
@bobular
bobular / model.pl
Created March 5, 2018 22:11
Extremely simple pension modeller
#!/usr/bin/env perl
# -*- mode: cperl -*-
#
# ./model.pl 0.26 0.02 40 3 0.5 25
#
# 0.26 = fraction of salary contribution total (employer+employee)
# 0.02 = fractional expected annual asset growth
# 40 = number of years working
# 3 = salary multiple for lump sum payment
# 0.5 = fraction of salary paid out in retirement
@bobular
bobular / post-huge-solr-json
Last active August 29, 2015 14:23
Solr 5.x's bin/post fails with massive JSON files - so this is a way to split them up on the fly.
#!/usr/bin/env perl
# -*- mode: cperl -*-
#
# usage: bin/post-huge-json <opts> huge-file.json
#
# <opts> might be "-c ninjadata"
#
# splits a large file containing a single json array of json objects
# into smaller chunks of 100000, and posts them to Solr using bin/post <opts>
#