Skip to content

Instantly share code, notes, and snippets.

View ojimac's full-sized avatar

Keita Ojima ojimac

View GitHub Profile
<?php
/**
* コマンドラインから、
* % php hoge.php
* って感じで実行してください〜
*/
// コレ必要です → https://github.com/abraham/twitteroauth
require_once "./twitteroauth/twitteroauth/twitteroauth.php";
@ojimac
ojimac / gist:1362893
Created November 13, 2011 23:12
hatena::dialy::users::stylesheet
body {
background: #FFFFFF;
font-family: Georgia;
}
h1 {
border: none;
background: none;
text-align: center;
text-color: #111111
@ojimac
ojimac / gist:2166881
Created March 23, 2012 04:45
QdmailComponentのsmtp送信対応コード
function startup(&$controller) {
$this->Controller =& $controller;
if( defined( 'COMPONENTS' ) ){
$this->logPath(COMPONENTS);
$this->errorlogPath(COMPONENTS);
}
$params = array(
'host' => 'メールサーバー名',
'port' => 587 , // または25
@ojimac
ojimac / gist:2664286
Created May 12, 2012 05:14
CentOSのApacheバージョン確認
$ /usr/sbin/httpd -v
@ojimac
ojimac / gist:2687081
Created May 13, 2012 09:06
Macで、カレントディレクトリ内の内容が重複しているファイルを削除するスクリプト
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
files = os.listdir('./')
for file in files:
if re.match('[0-9a-zA-z]+\s2\.[JPG|CR2]', file):
@ojimac
ojimac / gist:2792220
Created May 26, 2012 04:36
CentOS5.8に、vim7.3をソースからインストールする方法
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2
wget ftp://ftp.jp.vim.org/pub/vim/extra/vim-7.2-extra.tar.gz
wget ftp://ftp.vim.org/pub/vim/extra/vim-7.2-lang.tar.gz
tar jxvf vim-7.3.tar.bz2
tar zxvf vim-7.2-extra.tar.gz
tar zxvf vim-7.2-lang.tar.gz
mv vim72 vim73
mkdir vim73/patches
cd vim73/patches
curl -O "ftp://ftp.vim.org/pub/vim/patches/7.3/7.3.[001-538]"
@ojimac
ojimac / gist:2818803
Created May 28, 2012 12:05
mysqlの接続数を取得するスクリプト
#!/bin/sh
d=`date +'%Y-%m-%d %H:%M'`
result=`mysqladmin -uroot -pjup1ter extended-status | grep 'Threads_connected' | awk -F"|" '{print $3}'`
echo $d : $result
@ojimac
ojimac / gist:2819484
Created May 28, 2012 14:38
クロスブラウザ対応ログ関数 - JavaScript Ninjaより
function log() {
try {
console.log.apply(console, arguments);
}
catch(e) {
try {
opera.postError.apply(opera, arguments);
}
catch(e) {
alert(Array.prototype.join.call( arguments, " "));
@ojimac
ojimac / gist:2834148
Created May 30, 2012 06:50
mysql5.0.xでのエラーログ、スロークエリーログ設定
# 5.0系と5.1系で違っていつも調べなおすのでメモ
# エラー
log-warnings = 2 # 警告も出す
log-error=/var/lib/mysql/{LOG_FILE_NAME}
# スロークエリ
log_slow_queries=mysql-slow.log
long_query_time={n} # n秒以上かかったクエリをログに出力
@ojimac
ojimac / gist:2834439
Created May 30, 2012 07:55
innotop1.8.1のインストール @ CentOS5.5
<ダウンロード>
$ wget http://innotop.googlecode.com/files/innotop-1.8.1.tar.gz
$ tar zxvf innotop-1.8.1.tar.gz
<事前に、必要なcpanモジュールインストール>
$ sudo cpan install Time::HiRes
$ sudo cpan install Term::ReadKey
<インストール>
$ cd innotop-1.8.1