Skip to content

Instantly share code, notes, and snippets.

@tom-a
tom-a / redmine-install
Created April 15, 2013 14:02
2013年4月ごろにredmineをインストールするには
$ git clone git://github.com/redmine/redmine.git
# chown -R www:www redmine/
# chmod -R g+w redmine/
$ git co 2.3.0
$ git co -b 2.3.0-local
# gem install bundler
# bundle --without development test mysql postgresql
@tom-a
tom-a / main.mxml
Created May 3, 2013 18:36
FlexでFlash Videoを再生するコード
<?xml version="1.0"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo">
<s:VideoPlayer
source="video.flv"
width="640" height="360"
autoPlay="false" />
</s:Application>
@tom-a
tom-a / reorder.rb
Created February 19, 2014 16:25
mp3のプレイリストを、アルバム順にランダムに並び替える
#!/usr/local/bin/ruby
#$Id: reorder.rb,v 1.2 2003/02/17 18:34:10 tom-a Exp tom-a $
# m3uファイルを読み込んで、パス名で1ブロックとしてランダム出力
# albamが同じパス名のファイル群を収納する配列
# listはalbamを収納する配列
$KCODE="sjis"
prevpath = ""
albam = []
list =[]
@tom-a
tom-a / v4orv6.inc
Created February 20, 2014 09:15
アクセスしてきたクライアントがIPv4かIPv6か表示する。
<p>
あなたがお使いのIPアドレスは<!--#echo var="REMOTE_ADDR" -->です。
<!--#set var="address" value="REMOTE_ADDR" -->
<!--#echo var="$address" -->
<!--#if expr="$address = /:/" -->
IPv6
<!--#else -->
IPv4
<!--#endif -->
</p>
#!/bin/sh
# 日曜日にフルダンプして、平日はインクリメンタルダンプ
#
if [ "7" = `/bin/date +%u` ]
then
/usr/bin/mt rewind
/sbin/dump 0auf /dev/nsa0 /dev/ad0s1a
/sbin/dump 0auf /dev/nsa0 /dev/ad0s1h
/sbin/dump 0auf /dev/nsa0 /dev/ad0s1g
/sbin/dump 0auf /dev/nsa0 /dev/ad0s1e
@tom-a
tom-a / freq
Created June 17, 2014 13:57
FreeBSDでCPUクロックをモニタするmuninのplugin
#!/bin/sh
#%# family=auto
#%# capabilities=autoconf
GETNUM=`sysctl dev.cpu.0.freq | sed s/dev.cpu.0.freq..//`
GETNUM=`expr $GETNUM \* 1000000`
if [ "$1" = "autoconf" ]; then
if [ -n ${GETNUM} ] ; then
@tom-a
tom-a / zpool
Created June 17, 2014 14:01
FreeBSD 10.0で組み直した2TB×4のzpool
$ zpool status
pool: zroot
state: ONLINE
scan: scrub repaired 0 in 4h42m with 0 errors on Mon Jun 16 18:58:15 2014
config:
NAME STATE READ WRITE CKSUM
zroot ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
gptid/f509cd4a-f3fe-11e3-86a2-00133b0c00a7 ONLINE 0 0 0
@tom-a
tom-a / Document-spec.rb
Last active August 29, 2015 14:08
資料の回収具合を見える化するためのrspecファイル
Materials = '/data/materials'
describe File do
describe 'セッション1' do
example '資料1' do
file = File::open("#{Materials}/material1.pdf") do
end
end
example '資料2' do
file = File::open("#{Materials}/material2.pdf") do
@tom-a
tom-a / howm.el
Created February 19, 2015 02:12
howmでgrepを使う
(setq howm-process-coding-system 'utf-8-unix)
(setq howm-view-fgrep-command "c:/ProgramFiles/Git/bin/grep.exe")
(setq howm-view-grep-command "c:/ProgramFiles/Git/bin/grep.exe")
(setq howm-view-use-grep t)
@tom-a
tom-a / jail.conf
Created November 26, 2015 15:23
FreeBSDのjail設定
# common variables
$nic = "bge0";
exec.prestart += "ifconfig ${nic} inet ${ip4.addr} add";
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.poststop += "ifconfig ${nic} inet ${ip4.addr} -alias";
exec.clean;
mount.devfs;
#interface = bge0;
path = "/jail/$name";