Skip to content

Instantly share code, notes, and snippets.

View manonthemat's full-sized avatar

Matthias Sieber manonthemat

View GitHub Profile
@manonthemat
manonthemat / data.csv
Last active December 12, 2022 05:55
AoC Day 12 data
X Y Height
0 0 97
1 0 98
2 0 99
3 0 99
4 0 99
5 0 99
6 0 99
7 0 99
8 0 99
@manonthemat
manonthemat / day06.fs
Created December 9, 2022 02:06
Advent of Code 2022 - Day 06 in F# - I don't know anything
open System
//let input = IO.File.ReadAllLines("sample.txt") |> Array.head
let input = IO.File.ReadAllLines("data.txt") |> Array.head
let indexOfFirstMarker (windowSize: int) (input: string) : int =
input.ToCharArray()
|> Array.windowed windowSize
|> Array.takeWhile (fun xs -> Array.distinct xs |> Array.length <> windowSize)
|> Array.length
@manonthemat
manonthemat / cnode-versions.sh
Created October 2, 2022 06:23
cardano-node versions
#!/bin/sh
for node in $(which -a cardano-node); do
echo "$node has version:"
$node --version
done
@manonthemat
manonthemat / tech_details.md
Last active December 13, 2021 04:04
Benefits Application using Neo4j and the Cardano Blockchain

Benefits Application

Project Scope

A benefits application where organizations (e.g. companies) can contribute funds regularly (always on the first day of a month) to the benefits accounts of individuals (e.g. employees).

Individuals should have detailed and aggregate insights into their benefits. Funds in a benefit account can be spent with suitable service providers.

Deliverables

@manonthemat
manonthemat / trees.hs
Created August 6, 2021 01:42
Functional Programming in Haskell - The University of Glasgow
data Tree =
Leaf
| Node Int Tree Tree
deriving Show
treeDepth :: Tree -> Int
treeDepth Leaf = 0
treeDepth (Node _ a b) = 1 + max (treeDepth a) (treeDepth b)
treeSum :: Tree -> Int
@manonthemat
manonthemat / m.js
Created November 18, 2017 16:17
quick and dirty javascript "lib" to prepare for a statistics exam
'use strict';
var _fstore = [];
function factorial (n) {
if (n == 0 || n == 1) {
return 1;
}
if (_fstore[n] > 0) {
return _fstore[n];
}
@manonthemat
manonthemat / gist:cfb8272ef6695daf7624
Created February 6, 2016 18:48
copying nodes with labels and properties - hacky
// requires cypher-rest
// npm i cypher-rest
// gist for http://stackoverflow.com/questions/35191765/how-can-we-copy-labels-from-one-node-to-another-in-one-cypher
'use strict';
const util = require('util');
const c = require('cypher-rest');
const neoUrl = 'http://127.0.0.1:7474/db/data/transaction/commit';
@manonthemat
manonthemat / gist:687c5457d09ea0c1235d
Created April 13, 2015 19:12
simple token strategy with hapi
server.register(require('hapi-auth-jwt2'), function(err) {
if (err) {
throw err;
}
server.auth.strategy('token', 'jwt', false, {
key: constants.application.secretKey,
validateFunc: function(decoded, request, callback) {
if (!decoded || !decoded.verified) {
return callback(null, false);
@manonthemat
manonthemat / stack.cpp
Last active August 29, 2015 14:14
simple stack data structure in C++
#include <iostream>
using namespace std;
class Stack_overflow {};
class Stack_underflow {};
class Stack {
public:
Stack(int sz) : sz{sz}, top{-1}, elem {new int[sz]} {};
@manonthemat
manonthemat / roman.cpp
Created January 19, 2015 19:59
first draft of a simple roman calculator
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <regex>
#include <sstream>
using namespace std;