Skip to content

Instantly share code, notes, and snippets.

@tumf
tumf / UnitHosting: vm.instance_id to hostname on boot
Created December 31, 2010 13:51
クローンしたホストに、サーバのホストネームを設定する為のコード
# add to /etc/rc.local
sp_hostname=`curl -L http://10.10.11.95/server-provision/server.instance_id 2>/dev/null`
if [ -n $sp_hostname ]; then
hostname $sp_hostname
fi
@tumf
tumf / port-maintenance.sh
Created January 8, 2011 10:05
usual update commands for MacPorts
#!/bin/bash
port selfupdate \
&& port sync \
&& port outdated \
&& port upgrade installed \
&& port uninstall inactive
cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
NETMASK=255.255.255.0
IPADDR=$1
ONBOOT=yesEOF
cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth1
BOOTPROTO=dhcp
@tumf
tumf / magit-fix.el
Created March 7, 2011 01:16
magitのエラーを修正: Symbol's function definition is void: start-file-process..
;; for magit commit problem
;; http://www.mail-archive.com/magit@googlegroups.com/msg00420.html
(defun start-file-process (name buffer program &rest program-args)
"Start a program in a subprocess. Return the process object for it.
Similar to `start-process', but may invoke a file handler based on
`default-directory'. See Info node `(elisp)Magic File Names'.
This handler ought to run PROGRAM, perhaps on the local host,
perhaps on a remote host that corresponds to `default-directory'.
@tumf
tumf / register-to-openpear
Created March 18, 2011 22:59
openpearへSymfony1.0_*プラグインをまとめて登録したときのスクリプト
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'mechanize'
$ID = "tumf"
$PASSWORD="*****"
$PLUGINS = [
"sfDocTestPlugin",
"sfGuardMemberPlugin",
"sfMobileCarrierJPPlugin",
#!/bin/bash
pear channel-discover pear.pdepend.org
pear channel-discover pear.phpmd.org
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear install --alldeps pdepend/PHP_Depend
pear install --alldeps phpmd/PHP_PMD
@tumf
tumf / git-now.el
Created March 20, 2011 07:45
git-nowするelisp
;; git-now
;; http://d.hatena.ne.jp/sinsoku/20101208/1291770514
(defun git-now ()
(interactive)
(save-buffer)
(shell-command "git-now"))
(global-set-key "\C-x\C-s" 'git-now)
@tumf
tumf / .autotest
Created March 21, 2011 01:26
autotest growl notify
# -*- coding: utf-8 -*-
# -*- ruby -*-
require 'redgreen/autotest'
module Autotest::Growl
def self.growl title, msg, img="~/.rails_ok.png", pri=0, sticky=""
msg += " at #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}"
# autotestは使わないので、-nで指定するアプリケーション名はautospecで良いと思う
# -Hで通知先のGrowlのあるホスト名を指定する
sudo pmset -a hibernatemode 0
=begin
require 'rails-stirng-executer'
include 'MyApp'
=end
require "fileutils"
class String
def self.exec_stat_path
File.join(Rails.root,"log","commands.stat")
end