This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<参考URL> | |
http://nippondanji.blogspot.jp/2010/04/mysqlsniffermysql.html | |
<インストール> | |
$ sudo yum install libpcap-devel | |
$ mkdir mysqlsniffer | |
$ cd mysqlsniffer | |
$ wget http://hackmysql.com/code/mysqlsniffer.tgz | |
$ tar xf mysqlsniffer.tgz | |
$ gcc -m64 -g -O3 -lpcap -o mysqlsniffer *.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import xmlrpclib | |
proxy = xmlrpclib.ServerProxy('http://b.hatena.ne.jp/xmlrpc') | |
print proxy.bookmark.getAsinCount('4774124966','4886487319') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Linux | |
$ du -x --max-depth=1 / | sort -n | |
# Mac OS X | |
$ du -x -d 1 / | sort -n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 参考 : http://boydlee.com/appcelerator-titanium/basic-authentication-with-titanium-httpclient-and-json.html | |
xhr = Ti.Network.createHTTPClient(); | |
xhr.onload = function() { | |
// snip | |
}; | |
xhr.onerror = function() { | |
// snip | |
}; | |
xhr.open('POST', 'http://example.com'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT {COLUMN_NAME} | |
FROM {TABLE_NAME} | |
GROUP BY {COLUMN_NAME} | |
HAVING COUNT({COLUMN_NAME}) <> 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
mb_convert_encoding(mb_convert_encoding($str, 'sjis-win', 'eucjp'), 'UTF-8', 'sjis-win'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo cpan install App::Ack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select * | |
from users as t1 | |
inner join users as t2 on t1.id = t2.id | |
where 1 = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sql-benchのインストール方法と、インストール先、使い方 @ CentOS5.5 | |
<install> | |
# yum install mysql-bench | |
<path> | |
# /usr/share/sql-bench | |
<usage> | |
$ ./run-all-tests --server=mysql --user=root --password={PASSWORD} --log --fast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sqlを2回に分ける | |
// order by rand() は全件走査になるので、まずid(主キー)だけのリストを作り | |
select users.id # idだけ取得 | |
from users | |
where {CONDITIONS} | |
order by rand() | |
// その後インデックスが効くようにid縛りのクエリを発行 | |
select {COLUMN} |