Skip to content

Instantly share code, notes, and snippets.

View fasheng's full-sized avatar

fasheng

View GitHub Profile
@fasheng
fasheng / archive-github-with-tagui.md
Last active November 23, 2019 06:59
Archive github projects automatically with TagUI

TagUI是个不错的前端自动化测试工具,使用它可以非常简单的批量对github项目进行归档操作。


TagUI is a great front-end automation testing tool. With it, we could archive multiple github projects easily.

Usage:

npm install tagui
tagui flow.txt chrome
@fasheng
fasheng / zenburn
Last active April 16, 2017 01:06
newsbeuter zenburn color theme, update from https://gist.github.com/ivoarch/8256644
color background color188 color237
color info color144 color234
color article color188 color237
color listnormal color188 color237
color listfocus color108 color236
color listnormal_unread color223 color237
color listfocus_unread color108 color236
highlight article "^Feed:.*" color174 color237
highlight article "^Title:.*" color223 color237 bold
@fasheng
fasheng / get_debian_package_info
Last active August 29, 2015 14:02
Get debian package information through parsing Sources.gz
#!/bin/bash
_pkgsite="http://packages.linuxdeepin.com"
pkgsite="${_pkgsite}/deepin"
deepin_debian_source="${pkgsite}/dists/trusty/main/source/Sources.gz"
tmp_source_file="/tmp/sources"
download_debian_source() {
curl --retry 3 --retry-delay 3 -o "${tmp_source_file}".gz "${deepin_debian_source}"
gunzip -f "${tmp_source_file}".gz
@fasheng
fasheng / fsh-semantic-pkg-config.el
Created October 29, 2013 01:58
Add semantic system include DIR through pkg-config. Usage: (fsh-semantic-pkg-config "gtk+-2.0 webkit-1.0..." 'c-mode)
(defun fsh-semantic-pkg-config (libs mode)
"Add semantic system include DIR through pkg-config.
Usage: (fsh-semantic-pkg-config \"gtk+-2.0 QtGui QtNetwork...\" 'c-mode)"
(let* ((pkg-cmd "pkg-config")
(pkg-opt (format "--cflags %s" libs)))
(setq result (shell-command-to-string (format "%s %s" pkg-cmd pkg-opt)))
(dolist (str (split-string result))
(if (string-match-p "^-I" str)
(semantic-add-system-include (substring str 2 nil) mode)
@fasheng
fasheng / expect_goagent.tcl
Created October 18, 2013 11:47
Speed up setup for goagent through expect script.
#! /usr/bin/expect -f
set timeout 60
if {$argc != 2} {
set scriptname [lindex [split $argv0 "/"] end]
send_user "Usage: $scriptname \"APPID01|APPID02..\" <email>\n"
exit
}
@fasheng
fasheng / change-theme-before-publish.el
Created October 6, 2013 10:32
Change theme before publishing, for getting a good html code highlight style through htmlize.
(defadvice org-publish (around fsh-org-publish-advice
(project &optional force async) activate)
"Change theme before publishing, for getting a good html code highlight style through
htmlize."
(let ((thems custom-enabled-themes))
(dolist (theme thems)
(disable-theme theme))
(load-theme 'github)
ad-do-it
(disable-theme 'github)
@fasheng
fasheng / auto-load-for-theme.el
Last active December 24, 2015 19:29
For the themes which installed through elpa, add the following code to auto include the theme path in the `pkg-autoloads.el` file under elpa.
;;;###autoload
(and load-file-name
(boundp 'custom-theme-load-path)
(add-to-list 'custom-theme-load-path
(file-name-as-directory
(file-name-directory load-file-name))))
(provide-theme 'theme-name)
@fasheng
fasheng / revert-buffer-as-root.el
Last active December 24, 2015 15:38
Revert buffer as root.
(defun fsh-revert-buffer-as-root ()
"Revert buffer as root."
(interactive)
(let ((buf (current-buffer))
(filename) (sudo-filename))
(setq filename (buffer-file-name buf))
(setq sudo-filename (concat "/sudo::" filename))
(kill-buffer buf)
(find-file sudo-filename)
(message sudo-filename)
@fasheng
fasheng / join-chinese.el
Last active April 18, 2023 09:27
Join consecutive Chinese lines into a single long line without unwanted space when exporting org-mode to html. Works on org-mode 8.x.
(defadvice org-html-paragraph (before fsh-org-html-paragraph-advice
(paragraph contents info) activate)
"Join consecutive Chinese lines into a single long line without
unwanted space when exporting org-mode to html."
(let ((fixed-contents)
(orig-contents (ad-get-arg 1))
(reg-han "[[:multibyte:]]"))
(setq fixed-contents (replace-regexp-in-string
(concat "\\(" reg-han "\\) *\n *\\(" reg-han "\\)")
"\\1\\2" orig-contents))