This file contains hidden or 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
var insert = function(array, rightIndex, value) { | |
for(var j = rightIndex; | |
j >= 0 && array[j] > value; | |
j--) { | |
array[j + 1] = array[j]; | |
} | |
array[j + 1] = value; | |
}; | |
var insertionSort = function(array) { |
This file contains hidden or 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
var factorial = function(n) { | |
// n이 0일 경우 1을 리턴(항등원) | |
if(n===0){ | |
return 1; | |
} | |
// 0이 아닐 경우, n보다 작은 수의 팩토리얼 계산(재귀함수 호출) | |
// 최종의 경우 n*(n-1)!=n! 와동일 | |
return n*factorial(n-1); | |
}; |
This file contains hidden or 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
// Returns the first character of the string str | |
var firstCharacter = function(str) { | |
return str.slice(0, 1); | |
}; | |
// Returns the last character of a string str | |
var lastCharacter = function(str) { | |
return str.slice(-1); | |
}; |
This file contains hidden or 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
var isEven = function(n) { | |
return n % 2 === 0; | |
}; | |
var isOdd = function(n) { | |
return !isEven(n); | |
}; | |
var power = function(x, n) { | |
//println("Computing " + x + " raised to power " + n + "."); |
This file contains hidden or 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
// This library exposes 3 functions: | |
// hanoi.moveDisk(fromPeg, toPeg); This moves the top disk from the fromPeg to the toPeg | |
// hanoi.getSparePeg(fromPeg, toPeg); This returns the remaining peg that isn't the fromPeg or the toPeg | |
// hanoi.isSolved(toPeg); This returns true if all disks are on toPeg and no invalid moves have been used | |
var hanoi = (function() { | |
var sprites = function() { | |
"use strict"; | |
// A minimalist sprite library for KA visualizations. | |
// Devin Balkcom, June 2014. |
This file contains hidden or 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
// Takes in an array that has two sorted subarrays, | |
// from [p..q] and [q+1..r], and merges the array | |
var merge = function(array, p, q, r) { | |
// This code has been purposefully obfuscated, | |
// as you'll write it yourself in next challenge. | |
var a=[],b=[],c=p,d,e;for(d=0;c<=q;d++,c++){a[d]=array[c];}for(e=0;c<=r;e++,c++){b[e]=array[c];}c=p;for(e=d=0;d<a.length&&e<b.length;){if(a[d]<b[e]){array[c]=a[d];d++;} else {array[c]=b[e]; e++;}c++; }for(;d<a.length;){array[c]=a[d];d++;c++;}for(;e<b.length;){array[c]=b[e];e++;c++;} | |
}; | |
// Takes in an array and recursively merge sorts it |
This file contains hidden or 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
// Takes in an array that has two sorted subarrays, | |
// from [p..q] and [q+1..r], and merges the array | |
var merge = function(array, p, q, r) { | |
var lowHalf = []; | |
var highHalf = []; | |
var k = p; | |
var i; | |
var j; | |
for (i = 0; k <= q; i++, k++) { |
This file contains hidden or 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 string SimpleUrl(string orgUrl) | |
{ | |
string shortUrl = ""; | |
string key = "google key"; //Google 단축키 Key URL | |
var request = (HttpWebRequest)WebRequest.Create("https://www.googleapis.com/urlshortener/v1/url?key=" + key); | |
//google simple url api 로 key 값 전달 | |
request.ContentType = "application/json"; | |
request.Method = "POST"; | |
request.ContentType = "application/json"; |
This file contains hidden or 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
#!/bin/bash | |
# JINHYUP KIM | |
cd /data/program/bin #move to directory | |
pid=`ps -ef | grep "Programname" | grep -v 'grep' | awk '{print $2}'` | |
#Get PID for checking already running or not | |
#ps -ef : Get information about running process. -e: Every proecss's , -f: Detail Information | |
# | grep "Programname" : Find process contained "Programname" pattern on "ps -ef" result. | |
# | grep -v 'grep': Get result of not included 'grep'. Can get process info except "grep" searching process. | |
# | awk '{print $2}' : Get information of second($2) value in "ps -ef | grep "Programname" | grep -v 'grep'". $2(second) value is PID. | |
if [ -z $pid ] # -z: checking string size is zero or not. size is zero = true. (If pid size zero, this prgram is not running now) |
This file contains hidden or 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
expdp system/systempw directory=oradir dumpfile=oraback.dmp logfile=exp.log schemas=SCHEMANAME CONTENT=METADATA_ONLY | |
#for all export data, User system account. | |
#directory : What you create directory on Oracle upper step. | |
#dumpfile : Dump file will be made using this name on 'dirtory' location | |
#logfile : making log file | |
#schemas : select schema what you want exporting | |
#CONTENT=METADATA_ONY : Only export metadata (not records) |