Skip to content

Instantly share code, notes, and snippets.

@f440
f440 / my_template.rb
Created December 15, 2010 04:22
rials template
#
# This work is in the public domain.
#
if yes? "Do you use haml? [yes/no]"
gem 'haml-rails'
end
if yes? "Do you use compass? [yes/no]"
gem 'compass'
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
#
# unify dupulicated gem files.
#
# This work is in the public domain.
#
require 'digest/md5'
diff -r 2c2961c1252f src/main/java/org/apache/maven/plugin/BuildNumberMojo.java
--- a/src/main/java/org/apache/maven/plugin/BuildNumberMojo.java Sun Oct 31 15:19:32 2010 +0100
+++ b/src/main/java/org/apache/maven/plugin/BuildNumberMojo.java Fri Mar 11 03:22:29 2011 +0900
@@ -20,19 +20,24 @@
private MavenProject mavenProject;
public void execute() throws MojoExecutionException {
- String buildNumber = "unavailable";
String[] hgLogCommand = new String[] {
- "hg", "log", "-l", "1", "--template", "{node}" };
@f440
f440 / rename_branch.sh
Created April 2, 2011 17:41
ブランチでコミットをいくつかしたけどブランチ名かえたくなった
#!/bin/sh
# ブランチでコミットをいくつかしたけどブランチ名かえたくなった
# http://labs.timedia.co.jp/2011/04/rename-and-delete-localbranch-in-mercurial.html
set -x
hg clone https://bitbucket.org/f440/sample
cd sample
#!/bin/sh
set -x
rm -rf sample sample_copy
hg clone https://bitbucket.org/f440/sample remote
hg clone remote local
cd local
if [ "$TERM" = "screen" ]; then
chpwd () { echo -n "_`dirs | head -c 80`\\" }
preexec() {
# see [zsh-workers:13180]
# http://www.zsh.org/mla/workers/2000/msg03993.html
emulate -L zsh
local -a cmd; cmd=(${(z)2})
case $cmd[1] in
fg)
if (( $#cmd == 1 )); then
@f440
f440 / gist:1259519
Created October 3, 2011 16:28
isucon hardware spec
Linux rev18 2.6.18-238.19.1.el5xen #1 SMP Fri Jul 15 08:16:59 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
Intel(R) Xeon(R) CPU L5630 @ 2.13GHz
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 44
model name : Intel(R) Xeon(R) CPU L5630 @ 2.13GHz
stepping : 2
cpu MHz : 2133.482
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
CHOICE = ["rock", "paper", "scissors"]
def main(argv)
unless argv.length == 2
abort "#{$0} [Left choice] [Right choice]"
end
(left, right) = argv
@f440
f440 / gist:1504198
Created December 21, 2011 01:53
ruby's yaml parser behavior
f440@abhoth[17]:~$ irb-ruby-1.8.7-p352
no such file to load -- interactive_editor
ruby-1.8.7-p352 :001 > require 'date'
=> true
ruby-1.8.7-p352 :002 > require 'yaml'
=> true
ruby-1.8.7-p352 :003 > d = DateTime.parse("2011-12-21T03:30:01+00:00")
=> #<DateTime: 212191198201/86400,0,2299161>
ruby-1.8.7-p352 :004 > y = YAML.dump(d)
=> "--- 2011-12-21T03:30:01+00:00\n"
require 'formula'
class Freetype2 <Formula
url 'http://download.savannah.gnu.org/releases/freetype/freetype-2.4.8.tar.bz2'
homepage 'http://freetype.sourceforge.net/index2.html'
md5 'dbf2caca1d3afd410a29217a9809d397'
version '2.4.8'
head 'git://git.sv.gnu.org/freetype/freetype2.git'