Skip to content

Instantly share code, notes, and snippets.

View ursm's full-sized avatar

Keita Urashima ursm

View GitHub Profile
require 'open3'
def system!(*args)
out, status = Open3.capture2e(*args)
raise RuntimeError, out unless status.success?
end
#!/usr/bin/env ruby
require 'fileutils'
require 'tempfile'
unless ARGV.size == 2
$stderr.puts "usage: #{$0} SOURCE DEST"
exit(1)
end
src, dest = ARGV
!!! XML
!!! 1.0
%html
%head
%title multiple selection demo
%script{:type => 'text/javascript', :src => 'prototype.js'}
%script{:type => 'text/javascript', :src => 'effects.js'}
%script{:type => 'text/javascript', :src => 'controls.js'}
%style{:type => 'text/css'}
let s:prefix = 'HG: changed '
let s:files = map(filter(getline(0, '$'), 'v:val =~ "^" . s:prefix'), 'strpart(v:val, strlen(s:prefix))')
if len(s:files) == 0
finish
end
new
setlocal filetype=diff bufhidden=delete buftype=nofile previewwindow nobackup noswapfile
execute 'normal! :0r!hg diff ' . join(s:files) . "¥n¥<CR>"
diff --git a/hgpushsvn.py b/hgpushsvn.py
--- a/hgpushsvn.py
+++ b/hgpushsvn.py
@@ -11,14 +11,18 @@
def shell_quote(s):
- return "'" + s.replace('¥¥', '¥¥¥¥').replace("'", "'¥"'¥"'") + "'"
+ if os.name == "nt":
+ q = '"'
<VirtualHost *:80>
ServerName watch-night.ursm.jp
ServerAdmin ursm@ursm.jp
DocumentRoot "/u/apps/watch-night/current/tmp/build"
<Directory "/u/apps/watch-night/current/tmp/build">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
set :application, 'watch-night'
set :scm, :mercurial
set :repository, "https://bitbucket.org/ursm/#{application}/"
set :deploy_via, :remote_cache
server = 'ursm.jp'
role :app, server
role :web, server
role :db, server, :primary => true
out = `rake --help`
sss = out.lines.map(&:strip).grep(/^-/).map {|s|
opt = /(?:-¥w|--[-¥w]+?)/
arg = /¥[?([A-Z]+)¥]?/
s.match(/(#{opt}(?:, #{opt})*)(?: #{arg})? {2,}(.*)/).to_a[1..-1]
}.reject(&:nil?)
hs = sss.map {|opts, arg, desc|
>> require 'csv'
=> true
>> CSV.parse("hoge\tfuga\n1\t2\n", col_sep: "\t")
=> [["hoge", "fuga"], ["1", "2"]]
CFLAGS="-march=nocona -O2 -ssse3 -fomit-frame-pointer -pipe"
CXXFLAGS=$CFLAGS
MAKEOPTS="-j4"
USE="unicode nls cjk ipv6 threads vim-syntax -fortran jpeg svg tiff gif"
LINGUAS="ja"
FEATURES="ccache"
source /opt/gentoo/usr/local/portage/layman/make.conf