Skip to content

Instantly share code, notes, and snippets.

View file-mime-type.c
~ $ ./file-mime-type foo.png
#include <magic.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
magic_t cookie = magic_open (MAGIC_MIME_TYPE);
xuchunyang / hn.user.js
Last active Sep 20, 2018
My first user script
View hn.user.js
// ==UserScript==
// @name Hacker News Demo
// @namespace
// @version 0.1
// @description 测试 User Script
// @author xuchunyang
// @match
// @grant none
// ==/UserScript==
View raw-message.txt
Received: from ([])
by with LMTP id XLFpatfZ
for <>; Sat, 10 Mar 2018 12:59:13 +0300
Received: from ( [])
by (nwsmtp/Yandex) with ESMTPS id w9EqxDOAUJ-xB784qdI;
Sat, 10 Mar 2018 12:59:12 +0300
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(Client certificate not present)
xuchunyang / grep.rkt
Last active Jul 4, 2018
Print matched lines
View grep.rkt
;;; grep.rkt --- Print matched lines
;; Author: Xu Chunyang <>
;; Created: Tue, 03 Jul 2018 21:51:49 +0800
;; Updated: Wed, 04 Jul 2018 17:23:58 +0800
;; Homepage:
;;; Commentary:
;; Example:
xuchunyang / ydcv.rkt
Created Jul 2, 2018
Youdao Dictionary Console Version in Racket
View ydcv.rkt
;;; ydcv.rkt --- Youdao Dictionary Console Version in Racket
;; Author: Xu Chunyang <>
;; Created: Mon Jul 2 15:19:31 CST 2018
;; Usage:
;; $ racket ydcv.rkt word
;; n. [语] 单词;话语;消息;诺言;命令
;; vt. 用言辞表达
xuchunyang /
Created Apr 9, 2018
emacsclient fish shell completion
complete -c emacsclient -l version -s V -d "Just print version info and return"
complete -c emacsclient -l help -s h -d "Print this usage information message"
complete -c emacsclient -l tty -s t -o nw -d "Open a new Emacs frame on the current terminal"
complete -c emacsclient -l create-frame -s c -d "Create a new frame instead of trying to use the current Emacs frame"
complete -c emacsclient -l frame-parameters -s F -d "Set the parameters of a new frame"
complete -c emacsclient -l eval -s e -d "Evaluate the FILE arguments as ELisp expressions"
complete -c emacsclient -l no-wait -s n -d "Don't wait for the server to return"
complete -c emacsclient -l quiet -s q -d "Don't display messages on success"
complete -c emacsclient -l suppress-output -s u -d "Don't display return values from the server"
complete -c emacsclient -l display -s d -d "Visit the file in the given display"
xuchunyang / init.el
Created Nov 26, 2016
exiting init file early
View init.el
;; init.el ends here
(with-current-buffer " *load*" (goto-char (point-max)))
(the following does not matter nay more)
View highlight-some-text.el
;; 用绿色高亮「申请人」、黄色高亮「被申请人」
(defun my-highlight-some-text ()
(hi-lock-set-pattern+ "被申请人" 0 'hi-yellow)
(hi-lock-set-pattern+ "[^被]\\(申请人\\)" 1 'hi-green))
(add-hook 'org-mode-hook #'my-highlight-some-text)
(defun hi-lock-set-pattern+ (regexp group face)
View 中国历代年表
View emacs-list-installed-packages.el
#!/Users/xcy/Projects/emacs/nextstep/ --script
(require 'package)
You can’t perform that action at this time.