Skip to content

Instantly share code, notes, and snippets.

@mizzy
mizzy / move_trac_wiki_pages.pl
Created February 6, 2012 07:43
Trac Wiki ページ一括移動用スクリプト
#!/usr/bin/perl
use strict;
use warnings;
use RPC::XML::Client;
use Getopt::Long;
GetOptions(
"base-url=s" => \my $base_url,
"base-path=s" => \my $base_path,
@mizzy
mizzy / set_localtime_to_vm_clock_offset.py
Last active September 30, 2015 10:08
A script to change clock setting of all vms on a specified host
#!/usr/bin/python
import sys
import libvirt
from xml.etree.ElementTree import *
host = sys.argv[1]
conn = libvirt.open("qemu+tcp://%s/system" % host)
vms = []

I4PC + Unicorn のメモリ使用量

試したのは Ruby 1.9.2p290 だったと思う。

起動直後(preload_app false)

                              RSS  Shared
---------------------------------------------
17735 unicorn               21476    6600 (30%)
# A Liquid tag for Jekyll sites that allows embedding vimeo movies
# by: Gosuke Miyashita
#
# Example usage: {% vimeo 28040685 800 600 %}
require 'open-uri'
require 'multi_json'
module Jekyll
class VimeoTag < Liquid::Tag
#!/usr/bin/env perl
use strict;
use warnings;
use Text::ASCIITable;
my $t = Text::ASCIITable->new;
my @lines = <STDIN>;

ヒューマンエラーを許容する

  • 「きをつけよう」は意味ない
  • 実装、プラクティス、プロセスに落とし込む

バグ、ミスオペの混入を防ぐ

  • コードレビュー
  • 二人で作業
  • テストケース
#!/usr/bin/env ruby
# -*- coding: utf-8; -*-
require 'rubygems'
require 'pathname'
require 'github/markdown'
Dir['*.md'].each do |md|
target = Pathname.new(md)
header = <<-HEADER
#!/usr/bin/env perl
use strict;
use warnings;
my @networks = qw( 192.168.47 192.168.48 );
my $ifconfig = `ifconfig eth1|grep 192.168`;
my ( $ipaddr ) = ( $ifconfig =~ /inet addr:([0-9\.]+)/ );
my $gw = $ipaddr;
#!/usr/bin/env ruby
require 'resolv'
require 'route53'
SQALE_DOMAIN = 'i4pc-mizzy.sqale.jp.'
ORIGINAL_DOMAIN = 'i4pc.net.'
# This code is from
# https://github.com/bgentry/fog/commit/26d366d3047f437154946b2bb15935c2ee34a209
#!/bin/sh
mount_point=/mnt/vm
if test ! -d $mount_point; then
mkdir -p $mount_point
fi
for vm in `virsh list --all|grep -v running|grep original|awk '{print $2}'`
do