先放代码:https://github.com/henix/jillus
- 把序列化的数据变成你自己的数据结构(参见:三大 DSL)
- 处理的数据结构通常带递归
- EBNF - 请参见编译教科书
/** | |
* SyntaxHighlighter brush for Tcl | |
* | |
* more info: | |
* http://blog.henix.info/blog/tcl-syntaxhighlighter-brush.html | |
* | |
* @version 0.3 | |
* | |
* @copyright | |
* Copyright (C) 2011-2012 henix. |
set default-bg "#C7EDCC" | |
set recolor true | |
set recolor-lightcolor "#C7EDCC" | |
set recolor-darkcolor "#000000" |
先放代码:https://github.com/henix/jillus
#!/bin/bash | |
BRIFILE=/sys/class/backlight/acpi_video0/brightness | |
if [ $# -lt 1 ]; then | |
cat $BRIFILE | |
else | |
echo $1 > $BRIFILE | |
echo $1 > /root/.bri | |
fi |
/* RPN = Reverse Polish notation */ | |
operator(add). | |
operator(sub). | |
operator(mul). | |
operator(div). | |
doop(add, A, B, C) :- C = A + B. | |
doop(sub, A, B, C) :- C = A - B. | |
doop(mul, A, B, C) :- C = A * B. |
#!/bin/sh | |
find . -name "*.jar" | xargs -L 1 unzip -l | grep 'class$' | awk '{print $4}' | sed -e 's/\.class$//g' -e 's/\//./g' |
* { | |
font-family: "DejaVu Serif", "AR PL New Sung", "WenQuanYi Zen Hei", serif; | |
} | |
@page { | |
/*background-color: #C7EDCC;*/ | |
background-color: #CCB995; | |
margin: 1.5cm; | |
} |
.PHONY: all | |
all: highvote-pdf.mk | |
make -j4 -f $< WEB2PDF=/home/henix/web2pdf.sh | |
highvote-pdf.mk: highvote.html | |
xmllint --html --xpath "//a[@class='question-hyperlink']/@href" $< 2> /dev/null | sed -e 's/ href="//g' -e 's/"/\n/g' | lua link2mk.lua > $@ | |
highvote.html: | |
curl 'http://stackoverflow.com/questions/tagged/scala?sort=votes&pagesize=50' > $@ |
#!/bin/sh | |
REPO=~/.m2/repository | |
exec scala -classpath $REPO/commons-io/commons-io/2.4/commons-io-2.4.jar:$REPO/javax/mail/mail/1.4.6/mail-1.4.6.jar:$REPO/javax/activation/activation/1.1.1/activation-1.1.1.jar "$0" "$@" | |
!# | |
import java.io.InputStreamReader | |
import java.nio.charset.Charset | |
import javax.mail.internet.MimeUtility | |
import org.apache.commons.io.IOUtils |
# http://stackoverflow.com/questions/1251999/sed-how-can-i-replace-a-newline-n | |
:a | |
N | |
$!ba | |
s/\\/\\\\/g | |
s/"/\\"/g | |
s/\r/\\r/g | |
s/\t/\\t/g | |
s/\f/\\f/g | |
s/\n/\\n" +\n"/g |