Skip to content

Instantly share code, notes, and snippets.

View 1ambda's full-sized avatar
🦁
in the jungle

Kun 1ambda

🦁
in the jungle
View GitHub Profile
@1ambda
1ambda / gist:9509007
Last active August 29, 2015 13:57
lisp example
(defun select (selector)
(remove-if-not selector *person-db*))
(defun make-where-exprs (args)
(loop while args
collect `(equal (getf person ,(pop args)) ,(pop args))))
(defmacro where (&rest args)
`#'(lambda (person)
(and ,@(make-where-exprs args))))
@1ambda
1ambda / gist:9510951
Last active August 29, 2015 13:57
lisp macro example
CL-USER> (defun sample ()
`#'(lambda ()
(+ 3 5)))
CL-USER> (defmacro sample2 ()
`#'(lambda ()
(+ 3 5)))
@1ambda
1ambda / gist:9525453
Created March 13, 2014 09:59
lisp-macro-1
(defmacro five-macro (arg)
`(+ 5 ,arg))
(macroexpand-1 '(five-macro 2)
> (+ 5 2)
(five-macro 2)
> 7
@1ambda
1ambda / gist:9525464
Created March 13, 2014 10:00
lisp-macro-2
(defun five-function ()
'(+ 5 2))
(five-function 2)
> (+ 5 2)
(eval (five-function 2))
> 7
@1ambda
1ambda / gist:9525473
Created March 13, 2014 10:00
lisp-macro-3
(defmacro print-macro (arg)
`(print ,arg))
(macroexpand-1 '(print-macro (+ 2 3)))
> (PRINT (+ 2 3))
@1ambda
1ambda / gist:9525482
Created March 13, 2014 10:01
lisp-macro-4
(defun print-function (arg)
`(print ,arg))
(print-function (+ 2 3))
> (PRINT 5)
@1ambda
1ambda / gist:9525498
Created March 13, 2014 10:02
lisp-macro-5
(defparameter *person-db* '((:name "Anster" :age 26 :address "Seoul")))
(defun select (selector-fn)
(remove-if-not selector-fn *person-db*))
(defun where (&key name age address)
#'(lambda (row)
(and
(if name (equal (getf row :name) name) t)
(if age (equal (getf row :age) artist) t)
@1ambda
1ambda / gist:9525504
Created March 13, 2014 10:02
lisp-macro-6
$ (select (where :name "Anster"))
> ((:NAME "Anster" :AGE 26 :ADDRESS "Seoul"))
@1ambda
1ambda / gist:9525511
Created March 13, 2014 10:02
lisp-macro-7
(defmacro where (&rest args)
`#'(lambda (person)
(and ,@(loop while args
collect `(equal (getf person ,(pop args)) ,(pop args))))))
# -*- coding: cp949 -*-
from bs4 import BeautifulSoup
import urllib2
import re
# print soup.original_encoding
# get all certification link
url = "http://www.hrd.go.kr/jsp/HRDP/HRDP300/HRDP310/HRDP311/HRDP311_2List.jsp?keco_cd=&keco_nm=&orderField=jm_nm&orderDir=asc&pageNo=1&jm_cd=&kecoM=&kecoS=&srchKey=&rowsPerPage=1000"
contents = urllib2.urlopen(url).read().decode('cp949', 'ignore')