Skip to content

Instantly share code, notes, and snippets.

View agate's full-sized avatar
🏠
Working from home @ Shanghai

Hao Hong agate

🏠
Working from home @ Shanghai
View GitHub Profile
#!/usr/bin/ruby
require 'open-uri'
require 'base64'
url = 'http://autoproxy-gfwlist.googlecode.com/svn/trunk/gfwlist.txt'
list_txt = Base64.decode64(open(url).read)
list = list_txt.split("\n").reject do |item|
item.start_with?('@@') ||
item.start_with?('!') ||
diff --git a/lib/capistrano/recipes/deploy/strategy/copy.rb b/lib/capistrano/recipes/deploy/strategy/copy.rb
index 351d6e9..1ca84b2 100644
--- a/lib/capistrano/recipes/deploy/strategy/copy.rb
+++ b/lib/capistrano/recipes/deploy/strategy/copy.rb
@@ -101,7 +101,7 @@ module Capistrano
logger.trace "compressing #{destination} to #{filename}"
Dir.chdir(tmpdir) { system(compress(File.basename(destination), File.basename(filename)).join(" ")) }
- upload(filename, remote_filename)
+ upload(filename, remote_filename, { :via => copy_via })
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 60798fe..ffe4ca5 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -35,11 +35,12 @@ module IssuesHelper
@cached_label_assigned_to ||= l(:field_assigned_to)
@cached_label_priority ||= l(:field_priority)
- link_to_issue(issue) + "<br /><br />" +
- "<strong>#{@cached_label_start_date}</strong>: #{format_date(issue.start_date)}<br />" +
@agate
agate / 原子
Created September 18, 2010 13:44
[
{
marker: {
lat: <lat>,
lng: <lng>,
pathTP: true
}
},
{
marker: {
@agate
agate / Vim Rspec plugin Patch
Created October 26, 2010 05:34
1. rspec 2.0 doesn't have a "spec" command. Right now there only have "rspec" 2. not all users will install this plugin in their ~/.vim/plugin directory. so i changed the l:rubys && let l:xsl path
diff --git a/plugin/vim-rspec.vim b/plugin/vim-rspec.vim
index 88d9907..fe5d42c 100644
--- a/plugin/vim-rspec.vim
+++ b/plugin/vim-rspec.vim
@@ -12,8 +12,9 @@
let s:xsltproc_cmd = ""
let s:grep_cmd = ""
let s:hpricot_cmd = ""
-let s:xslt = 0
-let s:hpricot = 0
@agate
agate / vim.rb
Created June 23, 2011 15:32 — forked from uasi/vim.rb
Vim formula for Homebrew
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.200'
def features; %w(tiny small normal big huge) end
@agate
agate / google_hosts
Created September 14, 2011 15:07
Hosts for google apps in China
203.208.46.166 www.google.com
203.208.46.166 www.google.com.hk
203.208.46.166 encrypted.google.com
203.208.46.166 encrypted.google.com.hk
203.208.46.166 mail.google.com
203.208.46.166 webcache.googleusercontent.com
203.208.46.166 plus.google.com
203.208.46.166 talkgadget.google.com
203.208.46.166 picasaweb.google.com
203.208.46.166 feedproxy.google.com
@agate
agate / script.rb
Created October 13, 2011 03:04
Ruby Script For Testing to_yaml method
require 'yaml'
data = []
File.read("text.txt").lines.each do |line|
data << line
end
puts data.to_yaml
@agate
agate / CDB
Created August 3, 2012 13:52
My Afpd Logs
Aug 03 21:51:11.202754 afpd[23137] {auth.c:136} (I:AFPDaemon): uam: "DHX2" available
Aug 03 21:51:11.202996 afpd[23137] {auth.c:136} (I:AFPDaemon): uam: "DHCAST128" available
Aug 03 21:51:11.203179 afpd[23137] {auth.c:136} (I:AFPDaemon): uam: "2-Way Randnum exchange" available
Aug 03 21:51:11.203358 afpd[23137] {auth.c:136} (I:AFPDaemon): uam: "Randnum exchange" available
Aug 03 21:51:11.203535 afpd[23137] {auth.c:136} (I:AFPDaemon): uam: "No User Authent" available
Aug 03 21:51:11.203709 afpd[23137] {auth.c:136} (I:AFPDaemon): uam: "Cleartxt Passwrd" available
Aug 03 21:51:11.233162 afpd[23137] {cnid.c:53} (I:AFPDaemon): Registering CNID module [last]
Aug 03 21:51:11.233416 afpd[23137] {cnid.c:53} (I:AFPDaemon): Registering CNID module [cdb]
Aug 03 21:51:11.233608 afpd[23137] {cnid.c:53} (I:AFPDaemon): Registering CNID module [dbd]
Aug 03 21:51:11.233783 afpd[23137] {cnid.c:53} (I:AFPDaemon): Registering CNID module [tdb]
@agate
agate / gist:5020407
Last active December 14, 2015 03:19
curl -s "http://just-ping.com/index.php?vh=$1&c=&s=ping%21" | sed 's/.*\/\/<!\[CDATA\[ //' | sed 's/\/\/\]\]>.*//' | tr ";" "\n" | sed 's/ *xmlreqGET(./http:\/\/just-ping.com\//' | sed "s/',.*//" | grep "^http:\/\/just-ping.com" | while read line; do
curl -s $line
echo
done