Skip to content

Instantly share code, notes, and snippets.

View nojimage's full-sized avatar

Takashi Nojima nojimage

View GitHub Profile
@nojimage
nojimage / awsmon-setup.sh
Created April 25, 2014 02:50
AWSのメモリとかディスク容量とかをモニタリング出来るようにするスクリプトのセットアップ的なアレ
# install require packages
sudo yum install -y perl-Switch perl-Sys-Syslog perl-LWP-Protocol-https
# download and extract
curl -LO http://ec2-downloads.s3.amazonaws.com/cloudwatch-samples/CloudWatchMonitoringScripts-v1.1.0.zip
mkdir ~/cloudwatch
test -f ~/cloudwatch/aws-scripts-mon/mon-put-instance-data.pl || unzip CloudWatchMonitoringScripts-v1.1.0.zip -d ~/cloudwatch/
rm CloudWatchMonitoringScripts-v1.1.0.zip
# create credentials file
@nojimage
nojimage / lsyncd.conf
Created April 10, 2014 05:36
lsyncd with unison example
----
-- User configuration file for lsyncd.
--
settings{
logfile="/var/log/lsyncd/lsyncd.log",
statusFile="/var/log/lsyncd/lsyncd.status",
maxDelays=15
}
---
@nojimage
nojimage / gist:9776223
Created March 26, 2014 03:02
コマンドラインからカレントディレクトリのNetBeansプロジェクトを開く at Mac OSX
open /Applications/NetBeans/NetBeans\ 8.0.app && /Applications/NetBeans/NetBeans\ 8.0.app/Contents/MacOS/netbeans --open .
@nojimage
nojimage / phpunit.sh
Last active August 29, 2015 13:57
Custom phpunit script for NetBeans 8.0
#!/usr/bin/env bash
export PATH="$HOME/.phpenv/bin:/opt/local/bin:$PATH"
eval "$(phpenv init -)"
args=""
while [ "$1" != "" ] ; do
arg=$1
if [[ $arg =~ NetBeansSuite.php && -f $(pwd)/nbproject/NetBeansSuite.php ]] ; then
# Change custom NetBeansSuite path
arg=$(pwd)/nbproject/NetBeansSuite.php
@nojimage
nojimage / mkcsr.sh
Last active June 17, 2016 05:43
OpenSSL 秘密鍵とCSRを一緒に生成するシェルスクリプト
#!/usr/bin/env bash
#Common Name (eg, your name or your server's hostname)
CN="ssl.example.com"
# Country Name (2 letter code)
C="JP"
# State or Province Name (full name)
ST="Fukuoka"
# Locality Name (eg, city)
L="Fukuoka"
@nojimage
nojimage / gist:8553345
Created January 22, 2014 04:08
postfix のキューに溜まったメールのうち指定のメール文をもつメールを送信保留する
sudo find /var/spool/postfix/deferred/ -type f -exec grep -l 'search body test' '{}' \; | xargs -n1 basename | xargs -n1 sudo postsuper -h
@nojimage
nojimage / users.css
Created January 10, 2014 10:05
MTAppjQueryでブログ記事編集画面のフィールドをグルーピングしてタブで表示する http://www.tinybeans.net/blog/download/mt-plugin/mtapp-jquery.html
.mtapp-tabs-navi li {
margin-right: 4px;
}
.mtapp-tabs-navi li.first-child {
margin-left: 0;
}
.mtapp-tabs-navi li a {
padding: 10px;
min-width: 6em;
color: #7B7C7D;
@nojimage
nojimage / phpunit.php
Last active December 29, 2015 10:19
netbeans custom phpunit script
#!/usr/bin/env php
<?php
$paths = array(
PHP_BINDIR,
'/usr/local/phpenv/shims',
getenv('PATH')
);
putenv('PATH=' . join(PATH_SEPARATOR, $paths));
array_shift($argv);
@nojimage
nojimage / users.po
Created November 18, 2013 04:28
CakePHP Users Plugin Japanese Language file
# LANGUAGE translation of CakePHP Application
# Copyright YEAR NAME <EMAIL@ADDRESS>
#
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2013-09-18 23:20+0200\n"
"PO-Revision-Date: 2013-11-18 13:21+0900\n"
"Last-Translator: nojimage <nojimage@gmail.com>\n"
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
@nojimage
nojimage / gist:7212052
Created October 29, 2013 10:18
timecop拡張を入れていると、WebTestCase経由のテストでResponse::setLastModifiedが使えない問題の対処 ;)
<?php
// ...
if (!extension_loaded('timecop')) {
$response = $app->sendFile($file, 200, $headers);
} else {
// timecop hack
$response = new Symfony\Component\HttpFoundation\BinaryFileResponse($file, 200, $headers, false, null, false, false);
$date = \DateTime::createFromFormat('U', $response->getFile()->getMTime());