Skip to content

Instantly share code, notes, and snippets.

@kozo
kozo / powershellとputtyで複数のサーバにログイン
Last active December 22, 2015 06:49
powershellとputtyで複数のサーバにログイン
$user = "Login User Name"
$exePath = "putty exe Path"
$inputFilePath = "Server List Text FilePath"
$sr = New-Object System.IO.StreamReader($inputFilePath, [Text.Encoding]::GetEncoding("Shift_Jis"))
while (($line = $sr.ReadLine()) -ne $null)
{
$arg = "-ssh " + $line + " -l " + $user
Start-Process $exePath -ArgumentList $arg
}
@kozo
kozo / staticなプロパティ一覧のデータをprint_aする
Created June 1, 2012 11:55
staticなプロパティ一覧のデータをprint_aする
function showStaticMember($className) {
$class = new ReflectionClass($className);
$propertyList = $class->getStaticProperties();
print_a($propertyList);
return ;
}
@kozo
kozo / CakePHP2-mergeVars
Created January 27, 2012 09:01
CakePHP2-mergeVars
/**
* コンストラクタ
*
* @access public
* @author sakuragawa
*/
public function __construct($request = null, $response = null) {
// サブクラスのメンバをマージする
$this->__mergeSubClass();
@kozo
kozo / gist:760806
Last active September 24, 2015 14:17
SELECT
*
FROM
tablename
WHERE
col IN ('A','B','C')
@kozo
kozo / gist:743369
Created December 16, 2010 13:04
PartialHelper-view2-
<h2>/shops/indexのview</h2>
<p>ここでshopsに特化したelementを読み込み</p>
<?php echo $this->Partial->render('form'); ?>
@kozo
kozo / gist:743367
Created December 16, 2010 13:00
PartialHelper-view-
<p>PartialHelperのテスト</p>
<p>shopsコントローラーに特化したelement</p>
@kozo
kozo / gist:743339
Created December 16, 2010 12:26
PartialHelper-controller-
<?php
class ShopsController extends AppController {
var $helpers = array('Partial');
}
?>
SELECT
-- 年齢範囲ごとのフラグ
CASE
when date_part('year', age('2010-12-1',birthday)) between 1 and 19 then 10
when date_part('year', age('2010-12-1',birthday)) between 20 and 29 then 20
when date_part('year', age('2010-12-1',birthday)) between 30 and 39 then 30
when date_part('year', age('2010-12-1',birthday)) between 40 and 49 then 40
when date_part('year', age('2010-12-1',birthday)) between 50 and 59 then 50
when date_part('year', age('2010-12-1',birthday)) between 60 and 69 then 60
when date_part('year', age('2010-12-1',birthday)) between 70 and 79 then 70
SELECT
-- 年齢範囲ごとのフラグ
CASE
when date_part('year', age('2010-12-1',birthday)) between 1 and 19 then 10
when date_part('year', age('2010-12-1',birthday)) between 20 and 29 then 20
when date_part('year', age('2010-12-1',birthday)) between 30 and 39 then 30
when date_part('year', age('2010-12-1',birthday)) between 40 and 49 then 40
when date_part('year', age('2010-12-1',birthday)) between 50 and 59 then 50
when date_part('year', age('2010-12-1',birthday)) between 60 and 69 then 60
when date_part('year', age('2010-12-1',birthday)) between 70 and 79 then 70
SELECT
date_part('year', age('2010-12-1',birthday)),
count(date_part('year', age('2010-12-1',birthday)))
FROM
member
GROUP BY
date_part('year', age('2010-12-1',birthday))
ORDER BY
date_part('year', age('2010-12-1',birthday))