{{ message }}

Instantly share code, notes, and snippets.

# Mike Limansky limansky

Created Dec 19, 2011
The problem of list order
View numbers.hs
 import Data.List (delete) squarable x = x `elem` [y^2 | y <- [2..x] ] nexts x rest = foldr check [] rest where check v good = if squarable (x + v) then v:good else good search ls [] = [ls] search ls rs = nexts (last ls) rs >>= \v -> search (ls ++ [v]) (delete v rs)
Created Dec 22, 2011
Problem of grouping list values.
View grouplist.hs
 -- ghci example -- *Main> group [1,2,3,4,7,8,13] -- [(1,4),(7,8),(13,13)] group = foldr f [] where f x [] = [(x,x)] f x as@((a,b):as') = if a == x+1 then (x,b):as' else (x,x):as -- *Main> ungroup [(1,4),(7,8),(13,13)] -- [1,2,3,4,7,8,13] ungroup [] = []
Created Dec 11, 2012
using bind1st
View gist:4262706
 #include #include #include #include using namespace std; bool gt(int a, int b) { return a < b;
Created Jan 23, 2013
View build.sbt
 name := "Testmail" version := "0.0.1" scalaVersion := "2.9.1" // you can also add multiple repositories at the same time resolvers ++= Seq( "Scala Tools Releases" at "https://oss.sonatype.org/content/groups/scala-tools/" )
Last active Dec 21, 2015
GitLab initscript for 6-0
View gitlab
 #!/sbin/runscript # GitLab 5.2 and 5.3 init script for Gentoo Linux # see https://github.com/gitlabhq/gitlabhq/blob/master/doc/installation.md GITLAB_BASE=/mnt/data/gitlab/gitlab GITLAB_USER=gitlab depend() { need net redis }
Created Sep 12, 2013
View conf.d
 # Virtual machine name VMNAME="guest" # User, owing virtual machine VMUSER="vboxuser" # Stop mode. One off acpipowerbutton | savestate VMSTOP="savestate"
Created Jan 12, 2017
Linear type class
View Linear.scala
 package me.limansky import shapeless.ops.hlist.Prepend import shapeless.{::, <:!<, Generic, HList, HNil, LabelledGeneric, Lazy} trait Linear[L] { type Repr <: HList def linear(t: L): Repr }
Last active Jun 25, 2017
Read Map[String, String] to case class