Skip to content

Instantly share code, notes, and snippets.

View hinrik's full-sized avatar

Hinrik Örn Sigurðsson hinrik

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="https://l761067-iflmap.hcisbp.eu2.hana.ondemand.com:443/gw/odata/SAP/ZCPI_IFLO_POST_DOCUMENT_MULTIQUEUE_REQUEST;v=1/">
<id>https://l761067-iflmap.hcisbp.eu2.hana.ondemand.com:443/gw/odata/SAP/ZCPI_IFLO_POST_DOCUMENT_MULTIQUEUE_REQUEST;v=1/FICAX_POST_DOC_SET(submissionTimeStamp='2024-07-19T18%3A28%3A49.809291',currencyCode='USD')</id>
<title type="text">FICAX_POST_DOC_SET</title>
<updated>2024-07-19T18:28:51.65Z</updated>
<category term="ZIF_OD_FICA_POST_DOC_SRV.FICAX_POST_DOC" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
<link href="FICAX_POST_DOC_SET(submissionTimeStamp='2024-07-19T18%3A28%3A49.809291',currencyCode='USD')" rel="edit" title="FICAX_POST_DOC"/>
<link href="FICAX_POST_DOC_SET(submissionTimeStamp='2024-07-19T18%3A28%3A49.809291',curr
require "string_pool"
pool = StringPool.new
pool.get("foo")
(0..500).each do |i|
# add random stuff to grow the pool
random_str = (1..8).map{ ((rand(2)==1?65:97) + rand(25)).chr }.join
pool.get(random_str)
abstract struct Foo
end
struct Bar < Foo
end
struct Baz < Foo
end
hash = {} of Foo => Int32
hash = {} of String => Hash(Int32, Int32) # | Hash(String, Hash(Int32, Int32))
hash["foo"] = {} of Int32 => Int32
hash["foo"][1] = 4
#hash["bar"]["baz"] = {} of Int32 => Int32
#hash["bar"]["baz"][1] = 4
puts hash
@hinrik
hinrik / dutch_mortgage.pl
Last active August 29, 2015 14:04
Dutch mortgage calculator for 2014
use 5.14.0;
use warnings;
use Getopt::Long qw(:config no_ignore_case bundling);
use List::Util 'sum';
use Spreadsheet::Engine::Function::PMT;
# up to date as of 2014
my $max_deduction = 51.5;
my $min_deduction = 42;
my $yearly_reduction = 5;
package Location;
sub new {
my ($class, %args) = @_;
my $subclass = "Location::$args{location_type}";
return bless \%args, $subclass;
}
package Location::Country;

I get asked by people wanting to visit Iceland what they should do while they're there. Rather than re-type (and mostly forget) the whole thing I just give them a link to this.

Stuff that isn't this guide

...as if you didn't know how to use Google.

  • I'm partial to The Lonely Planet guides whenever I visit other places. I haven't checked the one for Iceland but it's probably
@hinrik
hinrik / foostat.rb
Last active December 21, 2015 12:58
require 'celluloid/io'
require 'celluloid/autostart'
require 'net/sftp'
class Foo
include Celluloid::IO
def initialize
async.connect_and_stat
end

$ pocoirc -tv -s irc.oftc.net -n literal -N secret

2013-05-09 12:24:24 Started (pid 2295)
2013-05-09 12:24:24 Constructing global plugins
2013-05-09 12:24:24 [default]	Constructing local plugins
2013-05-09 12:24:24 [default]	Spawning IRC component (POE::Component::IRC::State)
2013-05-09 12:24:24 [default]	Registering plugins
2013-05-09 12:24:24 [default]	Connecting to IRC (irc.oftc.net)
2013-05-09 12:24:24 [default]	S_plugin_add: ARG0: 'Whois_3', ARG1: POE::Component::IRC::Plugin::Whois=HASH(0x2697ce0)
require 'celluloid'
require 'celluloid/io'
class EchoServer
include Celluloid::IO
finalizer :echo_finalize
def initialize(host, port)
puts "*** Starting echo server on #{host}:#{port}"