Skip to content

Instantly share code, notes, and snippets.

View maimai-swap's full-sized avatar

S. Ishimaru maimai-swap

  • individual
  • Japan
View GitHub Profile
@maimai-swap
maimai-swap / booshaka.rb
Last active December 25, 2015 15:30
BooシャカLoop earthquake.gem plugin e.g. :booshaka m #=> ぶーしゃかLOOP
# -*- coding: utf-8 -*-
# booshaka tweet / earthquake plugin
#
# booshaka: http://kiyosan.wordpress.com/%E3%81%B6%E3%83%BC%E3%81%97%E3%82%83%E3%81%8Bloop-%E6%AD%8C%E8%A9%9E/
#
require 'pp'
class BooshakaLoop
@@values = [
"ぶーーーぶーしゃからか ぶーーー",
"アイセイ ぶー",
@maimai-swap
maimai-swap / tanka_tweet.rb
Created January 8, 2012 12:10 — forked from siyo/haiku_tweet.rb
短歌が読みたくなった時用earthquake plugin
# -*- coding: utf-8 -*-
# haiku tweet / earthquake plugin
#
# e.g. :tanka # => ここで一首、田子の浦ゆ うちいでて見れば真白にぞ 富士の高嶺に 雪は降りける
# :tanka hoge # => hoge ここで一首、田子の浦ゆ うちいでて見れば真白にぞ 富士の高嶺に 雪は降りける
# :tanka $xx # => @who ここで一首、田子の浦ゆ うちいでて見れば真白にぞ 富士の高嶺に 雪は降りける
# :tanka $xx hoge # => @who hoge ここで一首、田子の浦ゆ うちいでて見れば真白にぞ 富士の高嶺に 雪は降りける
#
Earthquake.init do
@maimai-swap
maimai-swap / mecab-conv.rb
Created January 13, 2012 05:17
mecabの辞書登録用CSVを作る
# -*- coding: utf-8 -*-
#
# input よみがな¥t単語 のTSV(UTF-8?)
# output 標準出力(UTF-8)
# 参考:http://d.hatena.ne.jp/code46/20090531/p1
# 参考:http://tmp.blogdns.org/archives/2009/12/mecabwikipediah.html
# 参考:http://mecab.sourceforge.net/
require 'kconv'
origin="はてな"
@maimai-swap
maimai-swap / mora_count.rb
Created January 13, 2012 07:19
日本語のモーラ(拍)を数える ひらがなカタカナだけ
# -*- coding: utf-8 -*-
# ひらがなかカタカナだけ
require 'kconv'
require 'pp'
title = $*[0]
tmp = title.tr('ぁ-ん','ァ-ン')
onsetsu = tmp.gsub(/リョ|リュ|リャ|ミョ|ミュ|ミャ|フォ|フェ|フィ|ファ|ピョ|ビョ|ヒョ|ピュ|ビュ|ヒュ|ピャ|ビャ|ヒャ|ニョ|ニュ|ニャ|ドゥ|トゥ|デュ|ディ|ティ|ツォ|ツェ|ツァ|チョ|チュ|チャ|チェ|ジョ|ショ|ジュ|シュ|ジャ|シャ|ジェ|シェ|ギョ|キョ|ギュ|キュ|ギャ|キャ|ウォ|ウィ/,"あ");
pp onsetsu.length
@maimai-swap
maimai-swap / configure.sh.txt
Last active October 2, 2015 18:58
php-5.4.3 configure on Mac OSX
./configure \
--enable-mod-charset \
--with-apxs2 \
--without-iconv \
--enable-fpm \
--enable-mbstring \
--enable-zip \
--enable-soap \
--with-mcrypt=$(brew --prefix libmcrypt) \
--with-mysql \
@maimai-swap
maimai-swap / configure.txt
Created April 4, 2012 12:14
php-5.3.10 configure on Mac OSX
./configure \
--enable-mod-charset \
--with-apxs2=/usr/local/apache2/bin/apxs \
--disable-cgi \
--with-libexpat-dir=/usr \
--with-libxml-dir=/usr \
--with-openssl \
--with-openssl-dir=$(brew --prefix openssl) \
--with-kerberos \
--with-zlib \
@maimai-swap
maimai-swap / proto.test.js
Created May 9, 2012 09:56
プロトタイプでclass作るときの自分のメモ
// tpsは自分の好きな名前なんでも。ルートのパッケージ名的な。
// geoは機能別に好きな名前なんでも。
if ( typeof(tps) == 'undefined' ) tps = {};
if ( typeof(tps.geo) == 'undefined' ) tps.geo = {};
tps.geo.prototype = {
prop01:false,
prop02:false,
init : function () {
this.func01();
@maimai-swap
maimai-swap / keepalived-mysql-backup.sh
Created June 26, 2012 05:39
KeepAlivedでHAした時のmysqlバックアップシェルスクリプト
#!/bin/bash
/sbin/service keepalived stop
/usr/sbin/tmpwatch -m 50 /usr/local/mysqlbackup/backupdata
svr_name=`uname -n`
/usr/bin/mysqladmin stop-slave
sleep 3
@maimai-swap
maimai-swap / shutdown_keepalived.sh
Created June 26, 2012 05:47
KeepAlivedでHA構成したmysqlが落ちた時用のKeepAlivedとmysql.serverのシャットダウン用スクリプト
#!/bin/bash
####
#もしマスタが落ちたときの処理スクリプト
#とりあえず最終確認して、本当にダメだったらkeepalivedを落とす。
####
#ちょっと待つ
sleep 5
#本当にmysqlが死んでいるかどうかの確認
mysqlans=`mysql -u tbacojx -pdasuinzc -h 127.0.0.1 --port=3306 < /usr/local/keepscript/s
howmaster.sql | grep Bytes_received | awk '{print $1}'`
@maimai-swap
maimai-swap / mysql-backup.sh
Created July 5, 2012 01:03
mysqlのバックアップスクリプト
#!/bin/bash
/usr/sbin/tmpwatch -m 50 /usr/local/mysqlbackup/backupdata
svr_name=`uname -n`
/usr/bin/mysqladmin stop-slave
sleep 10
/sbin/service mysqld stop
sleep 10
daystr=`date -d '1 days ago' '+%Y%m%d'`
cd /var/lib/mysql
tar czvf /usr/local/mysqlbackup/backupdata/$svr_name$daystr.tgz ./* > /dev/null 2>&1