Skip to content

Instantly share code, notes, and snippets.

@zeraf29
zeraf29 / impdb.sh
Created November 23, 2017 11:49
Oracle impdb sample
export IMPLOG=/oradir # directory for Import log
export DUMP_DATE=`date +%y%m%d` #making dumpdate
echo "schemas migration : " `date` >> $IMPLOG
impdp system/systempw directory=oradir content=metadata_only dumpfile=dumpfile.dmp logfile=logfile.log schemas=SCHEMA >> $IMPLOG
#for all export data, User system account.
#directory : What you create directory on Oracle upper step.
#CONTENT=METADATA_ONY : Only import metadata (not records)
#dumpfile : Dump file what you made using expdb in 'directory'
#logfile : making log file
@zeraf29
zeraf29 / doubleMultiply.java
Created January 8, 2019 22:51
for Double Multiply
import java.math.*;
public class Multiply {
public static Double multiply(Double a, Double b) {
BigDecimal s1 = new BigDecimal(String.valueOf(a));
BigDecimal s2 = new BigDecimal(String.valueOf(b));
//return a * b
return s1.multiply(s2).doubleValue();
}
}
@zeraf29
zeraf29 / HighAndLow_Using_for.java
Last active October 23, 2020 01:15
get Highest and Lowest number from string of space separated numbers, using "for" statement
public static String HighAndLow(String numbers) {
// Code here or
String[] splitStr = numbers.split(" "); // split by " "
int lNum = Integer.parseInt(splitStr[0]); //lowest number init;
int hNum = Integer.parseInt(splitStr[0]); // highest number init;
for(int i=1; i<splitStr.length; i++){//compare
if(lNum>Integer.parseInt(splitStr[i]))
lNum = Integer.parseInt(splitStr[i]);
if(hNum<Integer.parseInt(splitStr[i]))
hNum = Integer.parseInt(splitStr[i]);
@zeraf29
zeraf29 / countNumber.java
Created January 11, 2019 08:11
get count number
import java.util.Arrays;
import java.util.List;
import java.util.Collections;
import java.utils.Arrays;
public class FindOdd {
public static int findIt(int[] a) {
int odd = 0;
List<Integer> list = Arrays.asList(ArrayUtils.toObject(a));
for(int i : a){
if(Collections.frequency(list, i)%2>0){
@zeraf29
zeraf29 / payment.java
Created January 21, 2019 09:31
표값 계산기
import java.util.ArrayList;
import java.util.Collections;
public class Line {
static int ticketPrice= 25;
public static String Tickets(int[] peopleInLine)
{
int checkPrice = 0;
int changeIndex = -1;
@zeraf29
zeraf29 / getStringPoint.java
Created January 22, 2019 09:38
getStringPoint.java
public class Kata {
public static String high(String s) {
String bitWords = "";
int bitWordsPoint = 0;
String[] words = s.split(" ");
int tempPoint = 0;
for(String word : words) {
tempPoint = getWordsPoint(word.toLowerCase());
@zeraf29
zeraf29 / DirectionsReduction.java
Created February 1, 2019 07:52
Directions Reduction solution
import java.util.ArrayList;
import java.util.Arrays;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class DirReduction {
public static String[] dirReduc(String[] arr) {
// Your code here.
//for simpler result
@zeraf29
zeraf29 / CompareTriplets.java
Created April 19, 2019 04:49
// Comparing value at same index between List "a" and List "b"
import java.util.Arrays;
import java.util.List;
public class Solution {
// Comparing value at same index between List "a" and List "b"
static List<Integer> compareTriplets(List<Integer> a, List<Integer> b) {
//First. Using if condition
//if List "a"' value is bigger than List "b"
//, adding 1 point at List "resultList" 's index 0 value.
@zeraf29
zeraf29 / plusMinus.java
Created May 8, 2019 05:40
파라미터로 넘어온 배열 안의 값의 양수,음수, 0의 %비율(소수점 6자리까지)
// Complete the plusMinus function below.
static void plusMinus(int[] arr) {
int result = 0;
for(int i=0; i<arr.length; i++){
result += ( (arr[i]>0) ? (arr.length+1) : ( (arr[i]<0) ? (1) : 0 ) );
}
//plus number
System.out.println(String.format( "%.6f",(result/(arr.length+1))/(double)(arr.length)));
//minus number
System.out.println( String.format( "%.6f",(result%(arr.length+1))/(double)(arr.length)));
@zeraf29
zeraf29 / BotClean_forAndIndexOf.java
Created August 29, 2019 05:25
BotClean - for문 및 indexOf(Str, fromIndeX) 활용
public class Solution {
static void next_move(int posr, int posc, String[] board){
//add logic here
int targetX = 0, targetY = 0, tempX = 0, gap = 10, fromIndex = 0;
for(int i=0; i<board.length; i++) {
if(board[i].indexOf('d',fromIndex)>-1) {
tempX = board[i].indexOf('d',fromIndex);
if(Math.abs(posc-tempX)+Math.abs(posr-i)<gap ) {
gap = Math.abs(posc-tempX)+Math.abs(posr-i);