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
import scala.reflect.ClassTag | |
import scala.collection.mutable.WrappedArray | |
import scala.collection.mutable.ArrayLike | |
def ASeq[T](elt: T*)(implicit ct: ClassTag[T]): IndexedSeq[T] = { | |
val a = elt.toArray.clone | |
a.deep.asInstanceOf[IndexedSeq[T]] | |
} | |
val a = Array(1,2,3) //> a : Array[Int] = Array(1, 2, 3) |
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
import scala.concurrent.duration.{Duration => ScalaDuration} | |
import scala.concurrent.{ExecutionContext => ScalaExecutionContext, Future => ScalaFuture, Promise => ScalaPromise} | |
import scala.util.{Success, Failure} | |
import akka.dispatch.{ExecutionContext => AkkaExecutionContext, Future => AkkaFuture, Promise => AkkaPromise} | |
import akka.util.{Duration => AkkaDuration} | |
/** | |
* Some compatibility implicit conversions to deal with akka as if it might already be a newer version | |
* (using scala interfaces instead of akka). |
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
curl -sSL https://get.docker.com/ | sh | |
sudo usermod -aG docker $USER && exec sg docker newgrp `id -gn` | |
sudo systemctl start docker | |
sudo curl -sSL https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose |
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
sudo apt-get install ruby | |
gem install tmuxinator | |
export EDITOR='vim | |
tmuxinator new system-monitor | |
export TERM=xterm-256color | |
name: system-monitor | |
root: ~/ | |
windows: |
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
import java.io.File | |
import java.util.concurrent.LinkedBlockingQueue | |
class FileReaderThread(val queue : LinkedBlockingQueue<ByteArray>, val filename : String) : Thread() { | |
override fun run() { | |
File(filename).readLines() | |
} | |
} |
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
@Repository | |
public class UserDaoImpl implements UserDao { | |
@Autowired | |
private JdbcTemplate jdbcTemplate; | |
private final String INSERT_USER_QUERY = "INSERT INTO USER(id,first_name,last_name,gender,age) VALUES(?,?,?,?,?)"; | |
private final String UPDATE_USER_QUERY = "UPDATE user SET first_name=?,last_name=?,gender=?,age=? WHERE id=?"; | |
private final String DELETE_USER_QUERY = "DELETE FROM user WHERE id=?"; | |
private final String GET_USER_BY_ID_QUERY = "SELECT * FROM user where id = ?"; |
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
FROM openjdk:8-jdk-alpine | |
RUN apk --update add git openssh maven && \ | |
rm -rf /var/lib/apt/lists/* && \ | |
rm /var/cache/apk/* | |
ENV BOOT_SLEEP=0 \ | |
JAVA_OPTS="" | |
RUN addgroup -S scoold && adduser -S -G scoold scoold && \ |
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
fun genRandomString(): String { | |
val chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
var passWord = "" | |
for (i in 0..Random.nextInt(3, 35)) { | |
passWord += chars[Math.floor(Math.random() * chars.length).toInt()] | |
} | |
return passWord | |
} | |
fun genRandomText() : String { |
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
<!-- | |
~ Licensed to the Apache Software Foundation (ASF) under one or more | |
~ contributor license agreements. See the NOTICE file distributed with | |
~ this work for additional information regarding copyright ownership. | |
~ The ASF licenses this file to You under the Apache License, Version 2.0 | |
~ (the "License"); you may not use this file except in compliance with | |
~ the License. You may obtain a copy of the License at | |
~ | |
~ http://www.apache.org/licenses/LICENSE-2.0 | |
~ |
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
import java.nio.charset.Charset; | |
//Copyright 2003-2010 Christian d'Heureuse, Inventec Informatik AG, Zurich, Switzerland | |
//www.source-code.biz, www.inventec.ch/chdh | |
// | |
//This module is multi-licensed and may be used under the terms | |
//of any of the following licenses: | |
// | |
//EPL, Eclipse Public License, http://www.eclipse.org/legal | |
//LGPL, GNU Lesser General Public License, http://www.gnu.org/licenses/lgpl.html |