Skip to content

Instantly share code, notes, and snippets.

@xoyowade
xoyowade / octopress.el
Created February 7, 2012 15:39
Integrate octopress with Emacs. Based on https://github.com/gfreezy/octopress-emacs.git
(setq octopress-workdir (expand-file-name "~/app/octopress"))
(defun octopress-rake (command)
"run rake commands"
(let ((command-str (format "zsh -i -c 'cd %s && rake %s'" octopress-workdir command)))
(shell-command-to-string command-str)))
(defun octopress-new (class title)
(let* ((command-str (format "new_%s[\"%s\",true]" class title))
@xoyowade
xoyowade / findcase-driver.sh
Created February 29, 2012 10:15
regression case filter
#!/bin/sh
if [[ $# -lt 3 ]]; then
echo "An example driver to make the usage of findcase easier"
echo "Usage: $0 pattern input_file output_prefix"
exit
fi
input=`readlink -f $2`
indir=`dirname $input`
@xoyowade
xoyowade / .emacs
Created April 7, 2012 15:56
my-desktop - an enhancement to Emacs desktop.el
(require 'my-desktop)
(desktop-save-mode t)
@xoyowade
xoyowade / category_feed.xml.diff
Created April 23, 2012 14:10
auto inserting spaces between Chinese and English characters for octopress
--- a/source/_includes/custom/category_feed.xml
+++ b/source/_includes/custom/category_feed.xml
@@ -21,7 +21,7 @@ layout: nil
<link href="{{ site.url }}{{ post.url }}"/>
<updated>{{ post.date | date_to_xmlschema }}</updated>
<id>{{ site.url }}{{ post.id }}</id>
- <content type="html"><![CDATA[{{ post.content | expand_urls: site.url | markdownify | cdata_escape }}]]></content>
+ <content type="html"><![CDATA[{{ post.content | expand_urls: site.url | insert_ch_en_space | markdownify | cdata_escape }}]]></content>
</entry>
{% endfor %}
@xoyowade
xoyowade / imgfecther.rb
Created May 2, 2012 14:47
batch image downloader for http://forum.xitek.com/
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# 色影无忌论坛图片批量下载
# 能自动在EXIF中添加图片描述(图片之前的文字)
# by Zhiwei Xiao
require 'rubygems'
require 'mechanize'
require 'to_regexp'
require 'mini_exiftool'
@xoyowade
xoyowade / nginx.sh
Created March 16, 2013 14:48 — forked from squarism/nginx.sh
#!/bin/bash
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@xoyowade
xoyowade / text_format.py.diff
Last active December 18, 2015 10:59
[Patch] Fix short repeated format parsing error for protobuf-2.5.0-python
diff --git a/text_format.py b/text_format.py
index 24dd07f..1afd11a 100755
--- a/text_format.py
+++ b/text_format.py
@@ -235,8 +235,16 @@ def _MergeField(tokenizer, message):
raise tokenizer.ParseErrorPreviousToken('Expected "%s".' % (end_token))
_MergeField(tokenizer, sub_message)
else:
- _MergeScalarField(tokenizer, message, field)
-
{"sig":"e84d9f6a0e3f8d4776f6dd4e0700a69e1cfcc3031fe58b7b8527827098e0488e9beff83d17676f76dacca72224f5702951dab29615540652b95c81dc9fbd535e1","msghash":"5247cf4bf82005edea989d94fe3424e33d722601656b518438f9630a2274a2da"}