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.lang.Math | |
object Issue3 { | |
def isPrime(n: Long) = { | |
if (n <= 1) false | |
else if (n == 2) true | |
else if (n % 2 == 0) false | |
else { | |
val max = Math.sqrt(n).toInt | |
!3.to(max, 2).exists(n % _ == 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
object Issue4 { | |
val MIN = 100 | |
val MAX = 999 | |
def isPalindromic(n: Int) = { | |
val s = n.toString | |
s == s.reverse | |
} | |
def maxPalindromic() = { |
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
object Issue5 { | |
def gcd(a: Long, b: Long): Long = { | |
if (b == 0) a else gcd(b, a % b) | |
} | |
def lcm(a: Long, b: Long) = { | |
a * b / (gcd(a, b)) | |
} | |
def smallestLcm(l: List[Long]) = { |
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
(defn reverse-str | |
[s] | |
(apply str (reverse s))) | |
(defn palindromic? | |
[n] | |
(let [s (str n)] | |
(= (reverse-str s) s))) | |
(apply max (filter palindromic? (for [x (range 100 1000) y (range 100 1000)] (* x y)))) |
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
(defn gcd | |
[a b] | |
(if (zero? b) | |
a | |
(gcd b (rem a b)))) | |
(reduce (fn [a b] (/ (* a b) (gcd a b))) (range 1 21)) |
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.net DatagramSocket DatagramPacket)) | |
(def socket (DatagramSocket. 5200)) | |
(def running (atom true)) | |
(def buffer (make-array Byte/TYPE 1024)) | |
(defn parse [packet] | |
(println (String. (.getData packet) 0 (.getLength packet)))) | |
(defn start-receiver [] |
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
Rxvt.background:white | |
Rxvt.foreground:black | |
Rxvt.colorBD:yellow | |
Rxvt.colorUL:green | |
Rxvt.multichar_encoding:gb2312 | |
Rxvt.scrollBar:Fault | |
Rxvt.scrollBar_right:True | |
Rxvt.scrollBar_floating: True | |
Rxvt.scrollstyle: next | |
Rxvt.saveLines:10000 |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<h1>Resume</h1> | |
<h2>Basic Information</h2> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Index</title> | |
<link rel="stylesheet" href="./backup.css" type="text/css" media="screen" title="no title" charset="utf-8"/> | |
<style type="text/css"> | |
</style> | |
</head> | |
<body> | |
<div class="navbar navbar-static-top navbar-inverse"> |
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
(ns pdms.core | |
(:use korma.core | |
[korma.db :only (defdb)])) | |
(def db-spec {:subprotocol "postgresql" | |
:subname "//localhost/pdms" | |
:user "huleehom" | |
:password ""}) | |
(defdb db db-spec) |