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
/*filter | |
//Filter array by their index using collect | |
//EX) Get part of array that its index is even | |
*/ | |
// arr is List[Int] | |
val evenArr = arr | |
.zipWithIndex | |
.collect { | |
case (vali, ind) if (ind%2==1) => vali |
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
// initialize scala mutable map | |
var book = collection.mutable.Map[String,String]() | |
book += ("Key" => "Value") | |
// initialize scala immutable map | |
val book2 = Map("Tap" -> "name") | |
def printtuple(str: String, bookmap: collection.mutable.Map[String,String]) { | |
// Get scala Map value from Key | |
val number = bookmap.get(str) | |
number match { |
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
a = list() | |
# test list is empty | |
if not a: | |
print('list is empty') |
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
'''my.log 파일과 스트림 로그를 생성하기 위한 파일입니다.''' | |
# https://stackoverflow.com/questions/7173033/duplicate-log-output-when-using-python-logging-module | |
import logging | |
loggers = dict() | |
def getMyLogger(name='basic'): | |
global loggers | |
# 로깅 기본 포멧 설정 |
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 -fsSL https://get.docker.com/ | sudo sh |
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
ENV http_proxy "http://168.219.61.252:8080" | |
ENV https_proxy "http://168.219.61.252:8080" |
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
#pip install pytest-cov | |
pytest --cov-report term --cov=myproj tests/ |
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
class FileReader { | |
public static void main(String[] argc) { | |
InputStream inputStream = FileReader.class.getClass().getResourceAsStream("/RootFromResourceFile/b1018.txt"); | |
// inputStream = System.in | |
Scanner scanner = new Scanner(inputStream); | |
} | |
} |
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
public static void readAll(InputStream inputStream) { | |
Scanner scanner = new Scanner(inputStream); | |
char[][] map = new char[N][]; | |
for (int i=0; i<N; i++) { | |
map[i] = scanner.nextLine().toCharArray(); | |
} | |
} |
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
public static void addArrayList() { | |
ArrayList<Integer> lists = new ArrayList<>(); | |
for (int i =0; i<9; i++) { | |
lists.add(i); | |
} | |
for (int i =0; i<9; i++) { | |
lists.get(i); | |
} | |
} |
OlderNewer