Skip to content

Instantly share code, notes, and snippets.

View geekontheway's full-sized avatar

geekontheway geekontheway

  • Shanghai,China
View GitHub Profile
```shell
#101 A State Capitals Quiz
#Once you have a tool for choosing a line randomly from a file, as we have with Script #76, Displaying Random Text, there's no limit to the type of quiz games you can write. In this instance, I've pulled #together a list of the capitals of all 50 states in the United States of America; this script randomly chooses one, shows the state, and asks the user to type in the matching capital.
#The Code
#!/bin/sh
# states - A state capital guessing game. Requires the state capitals
# data file at http://www.intuitive.com/wicked/examples/state.capitals.txt.
@geekontheway
geekontheway / gfm.rb
Created November 27, 2011 15:22 — forked from mojombo/gfm.rb
highlighting
require 'digest/md5'
def gfm(text)
# Extract pre blocks
extractions = {}
text.gsub!(%r{<pre>.*?</pre>}m) do |match|
md5 = Digest::MD5.hexdigest(match)
extractions[md5] = match
"{gfm-extraction-#{md5}}"
end
@geekontheway
geekontheway / TestHighlighting
Created November 27, 2011 15:29
RubyGist.rb
class TestHighLighting
def code
end
end
@geekontheway
geekontheway / gist_tag.rb
Created November 27, 2011 15:38 — forked from imathis/gist_tag.rb
A Liquid tag for Jekyll sites that allows embedding Gists and showing code for non-JavaScript enabled browsers and readers.
require 'cgi'
require 'digest/md5'
require 'net/https'
require 'uri'
module Jekyll
class GistTag < Liquid::Tag
def initialize(tag_name, text, token)
super
@text = text
@geekontheway
geekontheway / alias
Created November 28, 2011 12:07
Sh配置文件
alias ls='ls --color=auto'
@geekontheway
geekontheway / newpost.rb
Created November 28, 2011 12:31
Nifty automagical post generation script for Jekyll
#!/usr/bin/env ruby
# *********************************************
# Jekyll Post Generator Awesomeness
# by Cody Krieger (http://codykrieger.com)
# edited by Tao Zhang (http://ztnote.com)
# *********************************************
# Usage:
# % ./newpost.rb POST NAME
@geekontheway
geekontheway / newpost.rb
Created November 28, 2011 12:31
Nifty automagical post generation script for Jekyll
#!/usr/bin/env ruby
# *********************************************
# Jekyll Post Generator Awesomeness
# by Cody Krieger (http://codykrieger.com)
# edited by Tao Zhang (http://ztnote.com)
# *********************************************
# Usage:
# % ./newpost.rb POST NAME
#!/bin/sh
# chkconfig: 2345 93 18
# Edit by Sky
# description:MongoDB(MongoDB-1.8.1)
#mongodb 家目录
MONGODB_HOME=/data1/PRG/mongodb
#mongodb 启动命令
MONGODB_BIN=$MONGODB_HOME/bin/mongod
[root@xjeevps opt]# cat /etc/init.d/nginx
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
@geekontheway
geekontheway / README.md
Created December 7, 2011 05:29 — forked from napcs/README.md
Deploying Rails to Linode

Deploying Rails to Linode

Installing Ruby Enterprise Edition, Apache, MySQL, and Passenger for deploying Rails 3.0 applications.

Get a Linode, and set it up with Ubuntu 10.04 LTS so that you have till April 2013 to get updates. Once the Linode is formatted, boot it and continue on.

Set up an 'A' record in your DNS, pointing to the IP of your Linode. I'm using demo.napcs.com here.

Initial setup