Skip to content

Instantly share code, notes, and snippets.

@mnd999
mnd999 / aoc1.cpp
Created December 14, 2022 17:49
Advent of code 2022 Day 1
#include <fstream>
#include <iostream>
#include <list>
#include <sstream>
#include <string>
int main(int argc, char *argv[]) {
std::list<long> totals;
std::string line;

Keybase proof

I hereby claim:

  • I am mnd999 on github.
  • I am mnd999 (https://keybase.io/mnd999) on keybase.
  • I have a public key ASDfO8kdu8OtU4pKowu-GRQ1vRgZ8D0O8P9AGea2mbVuTQo

To claim this, I am signing this object:

@mnd999
mnd999 / Neo4j Docs full screen.user.js
Created January 14, 2021 09:38
Make Neo4j documentation use the full screen width
// ==UserScript==
// @name Neo4j Docs full screen
// @version 1
// @grant none
// @include https://neo4j.com/docs/*
// ==/UserScript==
document.querySelector("article.doc").style.setProperty("max-width", "100%")
@mnd999
mnd999 / main.go
Last active June 8, 2020 14:11
Example: Multiple databases and admin commands using the Neo4j 1.8 driver for go
package main
import (
"fmt"
"log"
"github.com/neo4j/neo4j-go-driver/neo4j"
)
func main() {
@mnd999
mnd999 / sort.scala
Last active November 27, 2017 18:48
Scala sort
import java.math.BigInteger
import scala.annotation.tailrec
import org.scalacheck.Prop.forAll
import scala.math.Ordering._
@tailrec
def sortInt[T](l1: List[T], l2: List[T] = List[T]())(implicit t : Ordering[T]): List[T] = l1 match {
case x :: Nil => l2 :+ x
@mnd999
mnd999 / TowersOfHanoi.scala
Created October 6, 2016 11:47
Recursive scala implementation of Towers of Hanoi
import scala.collection.immutable._
object TowersOfHanoi extends App {
case class State(a : Seq[Int], b: Seq[Int], c: Seq[Int])
val discs = 8
val state = State(0 to discs, List[Int](), List[Int]());
def moveTower(disc: Int, state: State) : State = {
// Buffer
const float PI = 3.1415926535897932384626433832795;
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = fragCoord.xy / iResolution.xy;
vec2 mouse = iMouse.xy / iResolution.xy;
float angle = 2.0 * PI * uv.x;
import scala.collection.immutable.List
object StackLanguage extends App {
var program = List(Value(1), Value(2), Value(3), Operator(_ + _), Operator(_ - _), UnaryOperator(Math.sqrt(_).toInt))
println("Tim & Matt lovin the Scalay goodness")
def evaluate_stack(stack: List[Element]) = {
stack match {
@mnd999
mnd999 / 5-node-hadoop
Last active August 29, 2015 14:26
Blueprint for 5 node Hadoop cluster with Ambri
{
"host_groups": [
{
"name": "master",
"components": [
{
"name": "NAMENODE"
},
{
"name": "SECONDARY_NAMENODE"
@mnd999
mnd999 / QuandlBitcoinPrice.scala
Created July 8, 2015 10:42
Code to download bitcoin prices and persist with akka-http. Pretty horrible though, surely this can be done better?
package quandl
import scala.concurrent.Await
import scala.concurrent.Future
import scala.concurrent.duration.DurationInt
import org.joda.time.DateTime
import akka.actor.ActorSystem
import akka.http.scaladsl.Http