Skip to content

Instantly share code, notes, and snippets.

View schiegl's full-sized avatar

Adrian schiegl

  • Austria
View GitHub Profile
@schiegl
schiegl / TreeAlgorithms.hs
Created May 5, 2017 21:36
Tree Algorithms in Haskell
{-# LANGUAGE NoImplicitPrelude #-}
module TreeAlgorithms where
import ClassyPrelude
main :: IO ()
main = do
let tree = binTree 5 -- create binary tree with depth 5
print (dfs tree 1) -- list nodes with depth first search
@schiegl
schiegl / GeneticAlgorithms.hs
Created May 5, 2017 20:22
N-Queens Problem in Haskell using Genetic Algorithms
{-# LANGUAGE NoImplicitPrelude #-}
-- | N-Queens Problem: Place n queens on a chess board so that neither of them is threatened
-- This program will find a solution using a genetic algorithm
module GeneticAlgorithms where
import ClassyPrelude
import Data.Vector.Unboxed (ifoldl',update)
import System.Random
@schiegl
schiegl / backup.sh
Created February 2, 2017 13:17
Borg Backup Helper Script
# Backup frontend for borg
#
# Usage: ./backup.sh <repository> [--backup|--restore <path>|--unmount <path>]
#
# Dependencies: borg, fuse
################################################################################
# #
# Backup Configuration #
@schiegl
schiegl / InfiniteSequence.kt
Created June 15, 2016 15:10
Infinite (memoized) Prime Sequence in Kotlin
/**
* This is an infinite prime sequence that's memoized in a linked list.
*
* Why? ... because I wanted to see what Kotlin is like. And who doesn't like prime numbers.
*/
import kotlin.system.measureTimeMillis
object Primes : Sequence<Long> {