Skip to content

Instantly share code, notes, and snippets.

View Stefan-Wagner's full-sized avatar

user unknown Stefan-Wagner

View GitHub Profile
@Stefan-Wagner
Stefan-Wagner / adventOfCode15b.scala
Created December 18, 2017 02:28
advent of code, day 15, part b
// See problem on Advent of Code
// http://adventofcode.com/2017/day/15
import annotation.tailrec
object adventOfCode15 {
// generic testmethod
def test [I, O] (indata: I, outdata: O, f: (I => O)) : Boolean = {
val res = f(indata)
if (res == outdata) {
#!/bin/bash
#
# (c) GPLv3
#
# schrumpf5.sh: Schrumpf ein Bild mit der Endung JPG auf 1/5 der Breite u. 1/5 der Höhe,
# also auf ein 1/25 der Fläche und benenne es von *JPG zu *jpg um dabei.
#
# Überschreibt eventuell schon existierende Dateien mit Namen jpg ohne Nachfrage
#
# Dateien mit falscher Endung (nicht JPG) werden überpedantisch zurückgewiesen.
@Stefan-Wagner
Stefan-Wagner / geburtstage.lst
Last active August 29, 2015 13:55
A script which takes a list of birthdays (ddmmyy), sizes in cm and names (in line 4 to 30 - first lines are comment) and outputs moonphase, date and size.
# Geburtstage der dt. Bundesliga - Hertha BSC
#
#
301089 188 Burchart
220788 187 Kraft
270693 196 Sprint
280193 193 Brooks
050881 190 Franz
110790 172 Holland
060684 192 Hubnik
@Stefan-Wagner
Stefan-Wagner / wie-macht-der-hirsch.svg
Last active January 4, 2016 01:59
Open Cartoon, Ps42,2
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import annotation.tailrec
// http://stackoverflow.com/questions/10710954/how-do-i-remove-trailing-elements-in-a-scala-collection/10711396#10710954
object DropRightConditionalBench extends Benchcoat [List[Int], List[Int]] {
type I=List[Int]
type O=List[Int]
/**
@Stefan-Wagner
Stefan-Wagner / CompetitionService.scala
Created February 24, 2012 19:55
Spray service, for Scala meetup competition Feb-2012
package com.example
import cc.spray._
trait HelloService extends Directives {
def prime (x: Int): Boolean = {
if ((x < 2) || (x % 2 == 0)) false
((3 to math.sqrt(x).toInt by 2).find (n => (x % n == 0)) == None)
}
@Stefan-Wagner
Stefan-Wagner / gist:1748823
Created February 6, 2012 01:31
dictionary-de.user.js
// ==UserScript==
// @name German translations.
// @namespace http://vennard.org.uk/greasemonkey/
// @description The dictionary for the French Stack Overflow translation.
// @include http://stackoverflow.com/*
// @include http://meta.stackoverflow.com/*
// @include http://superuser.com/*
// @include http://meta.superuser.com/*
// @include http://serverfault.com/*
// @include http://meta.askubuntu.com/*
/**
Benchcoat.scala
done:
2011-11-17 v.4: improvement in plot-code
x-axis and y-axis needs description (how many units measured, time in second)
2011-11-17 v.3: minor improvement in plot-code
2011-10-22 v.2: improvement in plot-code and renaming prettyPrint
extend Benchcoat by
providing a List of (
@Stefan-Wagner
Stefan-Wagner / Benchcoat.scala
Created August 17, 2011 22:18
A benchmark to compare different algorithms with increasing sample size
/**
Benchcoat.scala
2011-10-22 v.2: Improvement in plot-code and renaming prettyPrint
extend Benchcoat by
providing a List of (
names,
combined with a functions, which takes some
I and returns some O
)