I hereby claim:
- I am t1anchen on github.
- I am tianchen (https://keybase.io/tianchen) on keybase.
- I have a public key ASCK4l9DOItIvwAUnsQgSrGuOeGvR-F4qgMFSn6r2rSNOwo
To claim this, I am signing this object:
;; Leiningen 2.3.2 | |
;; Clojure 1.5.1 | |
;; REPL | |
;; | |
(defn maplist [f coll] (map #(apply f %) (take (count coll) (iterate rest coll)))) | |
(maplist min (range 10)) | |
;; (0 1 2 3 4 5 6 7 8 9) | |
(maplist max (range 10)) | |
;; (9 9 9 9 9 9 9 9 9 9) | |
(maplist * (range 1 11)) |
;; Take k-th product while n!(n-1)!...(n-k+1)!...2!1! | |
;; | |
(map (fn [x] (reduce * x)) (take 10 (iterate rest (range 10 0 -1)))) | |
;; (3628800 362880 40320 5040 720 120 24 6 2 1) | |
(reduce *' (map (fn [x] (reduce *' x)) (take 10 (iterate rest (range 10 0 -1))))) | |
;; 6658606584104736522240000000N |
import scala.collection.mutable.BitSet | |
import scala.collection.mutable.Map | |
// Don't learn this code! | |
// Ugly implementation! | |
object GetLines { | |
def main(args: Array[String]) { | |
if (args.length < 1) { | |
println("Please specify the file to count") | |
return |
// ==UserScript== | |
// @name mathjax for douban | |
// @namespace [email protected] | |
// @author Changsheng Jiang<[email protected]> // 感谢原作者,并且我把math_jax_src改回原来的mathjax.org了 | |
// @include http://*.douban.com/* | |
// @description texify formula using mathjax | |
// @date 2011-07-12 | |
// @version 20110712 | |
// ==/UserScript== |
import org.junit.Assert; | |
import org.junit.Before; | |
import org.junit.Test; | |
import java.util.*; | |
/** | |
* Dummy Interview 1: Sorting | |
* -------------------------- |
#!/bin/sh | |
read -p "Play? " op | |
while [ "$op" != "n" ] | |
do | |
touch timerflag1 | |
echo "Started ..." |
val fs = (new java.io.File(".")).listFiles.filter(x => x.getName.contains("asc")) | |
val ctx = fs.map(x => (x.getName.replace(".asc",""),scala.io.Source.fromFile(x).getLines.next)) | |
ctx.map(i => { | |
val x = i._1 | |
val y = i._2 | |
val orig = new java.io.File(x) | |
val suffix = orig.getName.split('.').last | |
val newf = new java.io.File(y+"."+suffix) | |
orig.renameTo(newf) |
#!/usr/bin/python | |
import sys | |
import yaml | |
def main(): | |
"""check.py: a simple tool to check yaml format | |
Usage: check.py <yaml_filename> | |
""" | |
mode = 'piped' |
I hereby claim:
To claim this, I am signing this object:
(add-hook | |
'geiser-repl-mode-hook | |
#'(lambda () | |
(paredit-mode 1) | |
;; RET is bound to geiser-repl-maybe-send in geiser mode | |
(define-key paredit-mode-map (kbd "RET") nil)) |