Skip to content

Instantly share code, notes, and snippets.

View cataska's full-sized avatar
😱
🥺😢😭

Wen-Chun Lin cataska

😱
🥺😢😭
  • Taipei, Taiwan
View GitHub Profile
@cataska
cataska / gist:1241694
Created September 26, 2011 06:04
Get currency from web
(ns cataska
(:use clojure.contrib.str-utils)
(:import (java.net URL)
(java.io BufferedReader InputStreamReader)))
(def coin
["TWD" "CNY" "JPY" "KRW"
"HKD" "THB" "SGD" "IDR"
"VND" "MYR" "PHP" "INR"
"AED" "KWD" "AUD" "NZD"
@cataska
cataska / aboveAndDiv2.factor
Created May 9, 2012 09:35
Trivial function composition example in factor
USING: kernel io sequences math math.ranges namespaces arrays
prettyprint ;
IN: aboveAndDiv2
: above60 ( seq -- seq )
[ 60 >= ] filter ;
: div2 ( seq -- seq )
[ 2 / ] map ;
@cataska
cataska / gist:2717986
Last active March 8, 2020 10:16
Why is Lisp so great? or Why so many parenthesis?
;; Why is Lisp so great? or Why so many parenthesis?
;; The funny thing about Lisp is that everybody asks why it has so may parenthesis. Quite a few friends of mine who have studied Lisp in college don’t like it that much. I couldn’t really understand why, until I realized they usually take a class that uses the book Concepts of Programming Languages by Robert W. Sebesta as a textbook. I’m in no position to review this book because I haven’t read it. But from what I’ve skimmed, Lisp is not very well represented in this book, to put it very nicely. He describes Lisp only as a functional programming language, tells a little bit about cons cells, and that’s pretty much it! No object orientation in lisp, no syntactic abstraction, no meta-programming, and so on. My feeling is that if I didn’t know Lisp and read this book I wouldn’t be very impressed by Lisp.
;; So why is Lisp so great and why so many parenthesis? These two different questions have the same answer; because Lisp have syntactic abstraction trough t
@cataska
cataska / currency.go
Created September 19, 2012 06:24
Get currency in go
package main
import (
"flag"
"fmt"
"os"
"net/http"
"io/ioutil"
"regexp"
"strings"
@cataska
cataska / hw1.ml
Created January 22, 2013 08:00
Programming Languages Week 1 Assignment in OCaml
(* Week 1 assignment in Ocaml *)
let is_older d1 d2 = match d1, d2 with
(y1,m1,d1), (y2,m2,d2) ->
y1 < y2 || (y1 = y2 && m1 < m2) || (y1 = y2 && m1 = m2 && d1 < d2)
let rec number_in_month ds m = match ds with
[] -> 0
| x :: xs ->
let r = number_in_month xs m in
# Created by newuser for 5.0.0
autoload -U compinit
compinit
# Completion caching
zstyle ':completion::complete:*' use-cache on
zstyle ':completion::complete:*' cache-path .zcache
#Completion Options
zstyle ':completion:*:match:*' original only
@cataska
cataska / gist:b1875754128853bfb139
Last active April 21, 2022 10:02
Emacs key binding alias
(defmacro defkbalias (old new)
`(define-key (current-global-map) ,new
(lookup-key (current-global-map) ,old)))
;; now "C-x -" equals to "C-x 2"
(defkbalias (kbd "C-x 2") (kbd "C-x -"))
@cataska
cataska / castcovert
Created March 13, 2015 09:42
Covert file using ffmpeg for Chromecast
#!/bin/sh
input=$1
output=$2
ffmpeg -i "$input" -c:v libx264 -profile:v high -level 5 -crf 18 -maxrate 10M -bufsize 16M -pix_fmt yuv420p -vf "scale=iw*sar:ih, scale='if(gt(iw,ih),min(1920,iw),-1)':'if(gt(iw,ih),-1,min(1080,ih))'" -x264opts bframes=3:cabac=1 -movflags faststart -c:a libfdk_aac -b:a 320k -y "$output"
;; Clojure mode
;; (defun run-clojure ()
;; (interactive)
;; (let ((libs (mapconcat 'identity
;; '("/home/allen/work/java/clojure-stable/clojure-1.4.0/clojure-1.4.0.jar"
;; "/home/allen/work/java/my-clj")
;; ":")))
;; (run-lisp (concat "java -server -cp " libs " clojure.main"))))
(setq load-path (cons (concat emacs-root "prog-modes/clojure-mode") load-path))

Keybase proof

I hereby claim:

  • I am cataska on github.
  • I am lovecankill (https://keybase.io/lovecankill) on keybase.
  • I have a public key whose fingerprint is DD42 91A8 D4CF 41C7 6753 B843 04E6 FF04 9423 FF7C

To claim this, I am signing this object: