This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'nkf' | |
require 'uri' | |
hatena_id = 'ayucat_on_tabelog' | |
log_filename = 'nov17.txt' | |
open('nov17.out', 'w') { |ff| open(log_filename) { |f| f.read.split(/\n/).map { |l| ff.puts('+ [http://d.hatena.ne.jp/' + hatena_id + '/searchdiary?word=' + URI.encode(NKF.nkf('-We', l)) + ':title=' + l + ']') } } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# calc distances! | |
# example: | |
# %w[111 200 311 222 400].map { |s| printf "%s => %5.3f " s, o2d(s) } | |
def o2d(s) | |
return 0.0 unless s.is_a?(String) && s.size == 3 | |
1 / (((0..2).to_a.inject(0) { |x, i| x += s[i,1].to_f**2 }) ** 0.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log about updating gems on 2009-01-17: | |
>gem update | |
Updating installed gems | |
Updating nokogiri | |
Successfully installed nokogiri-1.1.1-x86-mswin32-60 | |
Gems updated: nokogiri | |
>gem uninstall nokogiri | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in $(seq 1 10); do time ruby -e 'r=(1..10000).to_a.inject{|r,a| r*a}.to_s; for i in 0..(r.length/80).ceil do puts r[i*80, 80] end'; done > 1 | |
real 0m0.627s | |
user 0m0.605s | |
sys 0m0.018s | |
real 0m0.623s | |
user 0m0.601s | |
sys 0m0.022s | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Desired=Unknown/Install/Remove/Purge/Hold | |
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend | |
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) | |
||/ Name Version Description | |
+++-==========================================-=========================================-============================================ | |
ii acl 2.2.47-2 Access control list utilities | |
ii acpi-support 0.121 scripts for handling many ACPI events | |
ii acpid 1.0.6-9ubuntu4.9.04.3 Utilities for using ACPI power management | |
ii adduser 3.110ubuntu5 add and remove users and groups | |
ii alacarte 0.11.10-0ubuntu1 e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ayucat 2009-07-16 | |
# add to rakefile.rb as follows: | |
# RSTRING/RARRAY for Ruby 1.9.x | |
edit_file "xxx.c_or_h" do |line| | |
case line | |
when /RSTRING\(([^\)]+)\)->(ptr|len)/ | |
line.sub(/RSTRING\(([^\)]+)\)->ptr/, 'RSTRING_PTR(\1)').sub(/RSTRING\(([^\)]+)\)->len/, 'RSTRING_LEN(\1)') | |
when /RARRAY\(([^\)]+)\)->ptr/ | |
line.sub(/RARRAY\(([^\)]+)\)->ptr/, 'RARRAY_PTR(\1)') | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This set of log files shows an Ubuntu upgrading from up-to-date Jaunty to Karmic beta in the early October by ayucat. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Ref. https://developer.mozilla.org/en/Simple_Thunderbird_build | |
sudo apt-get build-dep thunderbird | |
sudo apt-get install mercurial yasm libcurl4-openssl-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
require 'nokogiri' | |
@doc = Nokogiri::HTML::DocumentFragment.parse <<-EOHTML | |
<table></table> | |
EOHTML | |
@tables = @doc.xpath("table") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for f in app/tmp/{logs,cache/{,persistent,models}}; do mkdir -p $f; chmod -R 777 $f; touch $f/empty; done |