Skip to content

Instantly share code, notes, and snippets.

View ouyangzhiping's full-sized avatar

Zhiping Yang ouyangzhiping

View GitHub Profile
@ouyangzhiping
ouyangzhiping / Markdown.sublime-build
Created June 27, 2012 09:22 — forked from dvhthomas/Markdown.sublime-build
Pandoc powered Sublime Text 2 build provider for Markdown files: HTML the easy way
{
"cmd": ["pandoc.exe", "--to=html", "--output=$file.html", "$file"],
"selector": "source.md"
}
@ouyangzhiping
ouyangzhiping / 000-instructions.md
Created June 21, 2012 12:14 — forked from halpo/000-instructions.md
harvestr R users conference presentation.

Building a beamer presentation with knitr.

Introduction

The documents included are the input for knitr. In addition you need to have the tool pandoc installed. I also use a custom beamer template to add the University of Utah \institute command to the template. It also changes the indentation some.

Steps

  1. knit document with
@ouyangzhiping
ouyangzhiping / nginx
Created June 20, 2012 11:30 — forked from continuityapp/nginx
Ubuntu 10.04 LTS Nginx startup script
#! /bin/sh
### 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
@ouyangzhiping
ouyangzhiping / nginx.sh
Created May 21, 2012 20:05 — forked from marshluca/nginx.sh
/etc/init.d/nginx
# /etc/init.d/nginx
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@ouyangzhiping
ouyangzhiping / top_github_lang.rb
Created March 4, 2012 01:54 — forked from benbjohnson/top_github_lang.rb
Queries for the Languages on GitHub by Popularity
#!/usr/bin/ruby
require 'rubygems'
require 'mechanize'
mechanize = Mechanize.new
rankings = {}
# Retrieve language list
mechanize.get("https://github.com/languages") do |page|
@ouyangzhiping
ouyangzhiping / gitcoder.rb
Created March 4, 2012 01:49 — forked from dongyuwei/gitcoder.rb
find the website/blog of github top coder
require 'rubygems'
require 'nokogiri'
require 'net/http'
require 'openssl'
require 'open-uri'
class Net::HTTP
alias_method :origConnect, :connect
def connect
@ouyangzhiping
ouyangzhiping / move logic to model
Created February 25, 2012 04:45 — forked from darrenterhune/move logic to model
csv import example in model
# controller
def proc_csv
import = Import.find(params[:id])
if import.load_csv
flash[:notice] = "woo"
redirect_to some_url
else
flash[:error] = "ohoh"
end
end
@ouyangzhiping
ouyangzhiping / gist:1479172
Created December 14, 2011 23:55 — forked from samqiu/railscasts.rb
download railscast video
#!/usr/bin/ruby
require 'rss'
p 'Downloading rss index'
rss_string = open('http://feeds.feedburner.com/railscasts').read
rss = RSS::Parser.parse(rss_string, false)
videos_urls = rss.items.map { |it| it.enclosure.url }.reverse
videos_filenames = videos_urls.map {|url| url.split('/').last }
@ouyangzhiping
ouyangzhiping / gist:1479171
Created December 14, 2011 23:55 — forked from samqiu/railscasts.rb
download railscast video
#!/usr/bin/ruby
require 'rss'
p 'Downloading rss index'
rss_string = open('http://feeds.feedburner.com/railscasts').read
rss = RSS::Parser.parse(rss_string, false)
videos_urls = rss.items.map { |it| it.enclosure.url }.reverse
videos_filenames = videos_urls.map {|url| url.split('/').last }
@ouyangzhiping
ouyangzhiping / nginx.sh
Created September 6, 2011 08:47 — forked from marshluca/nginx.sh
/etc/init.d/nginx
# /etc/init.d/nginx
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6