This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @param args personnumemr in the format yymmdd-nnnn | |
*/ | |
def main(args: Array[String]) { | |
if (args.length > 0) { | |
val sum = args(0).toList.filter(_ != '-').map(_ - '0').take(9).foldLeft(0,2)((r,c) => { | |
(r._1 + (c * r._2) / 10 + (c *r._2) % 10 , if (r._2 ==2) 1 else 2) | |
})._1 % 10 | |
val checkSum = if (sum == 0) 0 else 10 - sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1 to 1000).foldLeft(List(0)) {(c,r) => (c:+r).sortWith(_>_).take(5)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1 to 10000000).par.aggregate( List[Int]() ) ( (list: List[Int], b: Int ) => (list:+b).sortWith(_>_).take(5) , (a: List[Int], b: List[Int]) => (a ::: b).sortWith(_>_).take(5) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl rand -base64 8 |md5 |head -c8;echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def filterNotFirst(s: Seq[Any], v: Any): Seq[Any] = { | |
s.diff(Seq(v)) | |
} | |
assert(filterNotFirst(Seq(1,2,2,2,3), 2) == Seq(1,2,2,3)) | |
assert(filterNotFirst(Seq('a','a'), 'a') == Seq('a')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mastermind | |
import collection.Seq | |
object MasterMindKata extends App { | |
def getPlusV1(z: Seq[(Char, Char)]): String = { | |
val res = for (t <- z) yield { | |
if (t._1 == t._2) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
air:etc informix$ netstat -an | grep 9088 | |
tcp6 0 0 ?.9088 *.* LISTEN | |
air:etc informix$ pwd | |
/Applications/IBM/informix/etc | |
air:etc informix$ touch IFX_DISABLE_IPV6 | |
air:etc informix$ onmode -ky | |
air:etc informix$ oninit | |
air:etc informix$ netstat -an | grep 9088 | |
tcp4 0 0 192.168.0.93.9088 *.* LISTEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log4j.logger.org.springframework.web.servlet.mvc=DEBUG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-Dmaven.test.skip=true | |
-Dtest=MyTest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//console | |
//hide | |
//setup | |
//output | |
create (_0:`MetaDataRoot`) | |
create (_1 {type:"Person"}) | |
create (_2 {name:"name"}) |