101 reputation
1
bio website hjkl.me
location China
age 25
visits member for 5 months
seen Nov 27 '12 at 12:40
stats profile views 0

Simplicity is the ultimate sophistication. — Leonardo Da Vinci

业务洽谈QQ: 751572818

less is more

  • The basic problem is actually very complicated.
  • It's amazing that computers only use 0 and 1.

# downloader
$ aria2c --daemon --enable-rpc --rpc-listen-all=true --rpc-listen-port=6666 --disable-ipv6

# google tts
$ curl -sGA 'Mozilla/5.0' --data-urlencode 'q=你好世界' 'http://translate.google.cn/translate_tts?ie=UTF-8&tl=zh-CN' | play -qtmp3 -

# backup putty config
$ regedit /E putty_config.reg HKEY_CURRENT_USER\Software\SimonTatham

# fibonacci in bash
$ mkfifo pipe; echo 0 1 >pipe & while read x y; do echo $y; echo $y $((x+y)) >pipe; done <pipe | head -n 10; rm pipe

# vim startup debug
$ rm dbg.log; vim -V9dbg.log -u vimrc.dbg -c 'q' test.txt; vim dbg.log

# fill zeros
$ rename 's/\d+/sprintf("%04d",$&)/e' *.png

# auto-completion
$ _echo() { COMPREPLY=("'$(fortune -sn42 | tr -d \')'"); } && complete -F _echo echo

# lib dependency
$ for i in `find /lib -maxdepth 1 -type f -name '*.so*'`; do echo -e "\n${i##*/}"; readelf -d $i | awk '/NEEDED/{print $5}'; done | awk 'BEGIN{RS=""; print "digraph so {"}; {gsub(/-|\+|\[|\]|(\.\w*)/, ""); x=$1; $1=""; printf("\t%s -> {%s};\n", x, $0)}; END{print "}"}' | dot -Tpng | display -

# random shape
$ gnuplot -e 'set term dumb; set nobor; unset tics; p "<seq 10 | shuf" u 1:(rand(0)) w l not'

# header dependency
$ awk '
> BEGIN{
>     print "digraph G {"
>     print "node[shape=box]"
> }
>
> /^#include/ && NF==2{
>     printf("\"%s\" -> \"%s\";\n", FILENAME, gensub(/[<>\"]/, "", "g", $2))
> }
>
> END{
>     print "}"
> }' *.{h,cpp} | dot -Tsvg | display

# 'A' in binary format
$ dc <<<16i2o$(printf A | xxd -p)p

# find all ascii-only files
$ grep -rLP '[^\x00-\x7f]' .

# calculate total reputation
$ curl -s 'http://stackexchange.com/users/11683/jon-skeet?tab=accounts' | sed -n 's/^.*account-number[^[:digit:]]*\([[:digit:],]*\)[^[:digit:]]*reputation.*$/\1/p' | tr -d ',' | awk '$0>=200{t+=$0};END{print t}'

.vimrc

hi! link Comment Ignore
com! CD :lcd %:h
com! -nargs=1 -complete=help H :tab help <args>

digraph-table Ctrl-k

©   Co
™   TM
✓   OK
✗   XX

±   +-
≈   ?2
≠   !=
«   <<
»   >>

←   <-
→   ->
↑   -!
↓   -v
⇐   <=
⇒   =>
⇔   ==

₆   6s
⁶   6S
⅙   16
⒍   6.
㈥  6c
ⅵ   6r
Ⅵ   6R

◆   bD
◇   wD
★   *2
☆   *1
█   FB
■   fS
●   0M
·   .M
☻   0U
☺   0u
♀   Fm
♂   Ml

This user has not answered any questions
This user has not asked any questions
This user has not participated in any tags
Stack Overflow Stack Overflow 28,233 rep 13169
Super User Super User 2,329 rep 619
Unix & Linux Stack Exchange Unix & Linux 361 rep 17
Ask Ubuntu Ask Ubuntu 273 rep 311
Programming Puzzles & Code Golf Stack Exchange Programming Puzzles & Code Golf 121 rep 4

0 Votes Cast

This user has not cast any votes