This is my notes while reading GNU Emacs Lisp Reference Manual.
一个 Lisp “object” 可以有多个 “type”,因此只会问是否一个 “object” 属不属于哪一个 “type”,而不会问一个 “object” 的 “type” 是什么。
;;; filename: emacs-lisp-basic.el | |
(+ 23 3) | |
(message "hi") | |
;; store variable | |
(setq my-name "Chunyang Xu") | |
(setq my-age 21) | |
(insert "hello" " world") |
#!/usr/bin/env bash | |
# add-seu-route-linux.sh - public domain - Chunayng Xu | http://xuchunyang.me | |
# Program: 添加东南大学路由表 (GNU/Linux version) | |
# Usage: 添加路由表: sudo add-seu-route.sh | |
# Note: 使用前需要修改 GATEWAY | |
GATEWAY=192.168.1.1 # *Change* to your gateway | |
#------------------------------------------------------------------------------- | |
# Make sure only root can run our script |
#!/usr/bin/env bash | |
# Program: 添加东南大学路由表 | http://git.io/AOIiRg | |
# Note: 使用前需要修改 GATEWAY | |
# Usage: 添加路由表: sudo add-seu-route.sh | |
# 删除路由表: sudo add-seu-route.sh del | |
GATEWAY=192.168.7.1 # 修改成你的连接 bras 前的默认网关 | |
#--------------------------------------------------------------- | |
SEU_NETWORKS=( |
#!/bin/bash | |
# | |
# ydcv in bash using 'jq' to parse json | |
# | |
# Check argument | |
if [ -z $1 ]; then | |
echo "Usage: $0 word" | |
exit 1 |
#!/usr/bin/env perl | |
# | |
# ydcv in Perl | |
# | |
use strict; | |
use warnings; | |
use LWP::UserAgent; | |
use JSON qw( decode_json ); |
;; 1. (interactive) | |
;; "P": prefix argument | |
;; "B": Buffer name | |
;; "b": should be a >exiting buffer | |
;; "r": Point and the mark | |
;; "*": Signal an error if the current buffer is read-only. Special. | |
(defun add-by-two (number) | |
"Add NUMBER by two." | |
(interactive "P\nbF buffer: ") ; Enable the prefix argument | |
(message "The result is %d." (+ number 2))) |
;; Narrowing -- use save-restriction | |
(defun my-what-line () | |
"Print the current line number (in the buffer) of point." | |
(interactive) | |
(save-restriction | |
(widen) | |
(save-excursion | |
(beginning-of-line) | |
(message "Line %d" | |
(1+ (count-lines 1 (point))))))) |
;; List -- car/cdr/nthcdr/nth | |
(defvar my-list '(a b c) "My demo LIST") | |
my-list | |
(car my-list) | |
a | |
(cdr my-list) | |
(b c) |
#!/bin/bash | |
# | |
# Filename: google-trans-cn-curl.sh | |
# Program: Access https://translate.google.cn/ from command line by 'curl(1)' | |
# Usage: ./google-trans-cn-curl.sh <text> | |
# | |
text="$1" | |
if [[ -z "$text" ]]; then | |
echo "Usage: $0 <word>" |