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 org.srkim.test; | |
public class java_enum { | |
// public enum Currency {PENNY, NICKLE, DIME, QUARTER}; | |
// public enum Currency {PENNY(1), NICKLE(5), DIME(10), QUARTER(25)}; | |
public enum Currency { | |
PENNY(1) { @Override public String color() {return "copper";}}, | |
NICKLE(5) { @Override public String color() {return "bronze";}}, | |
DIME(10) { @Override public String color() {return "silver";}}, |
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 org.srkim.jupyter; | |
import java.io.BufferedReader; | |
import java.io.FileReader; | |
import java.io.IOException; | |
public class AutoJupyterUserConf { | |
public static void main(String args[]) { | |
if(args[1].equals("1")) { | |
try { | |
BufferedReader in = new BufferedReader(new FileReader(args[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
package test_socket; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import java.net.Socket; | |
import java.net.UnknownHostException; | |
/** | |
* up to 3 clients can access simultaneously and the others have to queue. |
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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<parent> | |
<groupId>org.srkim.module</groupId> | |
<artifactId>srkim-module-cmm</artifactId> | |
<version>0.1</version> | |
</parent> | |
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.BufferedOutputStream; | |
import java.io.DataInputStream; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.util.ArrayDeque; | |
import java.util.Arrays; | |
import java.util.Deque; |
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 org.srkim.test; | |
import java.util.ArrayList; | |
import java.util.HashSet; | |
import java.util.List; | |
import java.util.Set; | |
/** | |
* let's get multiple coprime with combinations and divisors. | |
* |
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 org.srkim.test; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Random; | |
public class WeightedRandom { | |
public static void main(String[] args) { | |
List<Integer> lot = new ArrayList<Integer>(); | |
for (int i = 1; i < 46; i++) { |
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
/** | |
* | |
* @author srkim | |
*/ | |
cc = { | |
send: function (o, a) { | |
var h = Math.floor(1e6 * Math.random() + 1), | |
i = o.url; | |
i += "?a=" + encodeURIComponent(o.a), i += "&b=" + encodeURIComponent(o.b), i += "&c=" + encodeURIComponent(o.c), i += "&d=" + encodeURIComponent(o.d), i += "&cb=" + h, cc.ajax(i, 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 org.srkim.test; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.List; | |
import org.jsoup.Jsoup; | |
import org.jsoup.nodes.Document; | |
import org.jsoup.select.Elements; |
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 org.srkim.test; | |
import java.io.IOException; | |
import java.io.UnsupportedEncodingException; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import java.net.URLEncoder; | |
import java.nio.charset.Charset; | |
import java.util.ArrayList; | |
import java.util.List; |