Skip to content

Instantly share code, notes, and snippets.

View nojimage's full-sized avatar

Takashi Nojima nojimage

View GitHub Profile
#!/bin/env bash
##
# CVE-2015-0235 restart all services that using `glibc`
#
# original code:
# http://ma.ttias.be/critical-glibc-update-cve-2015-0235-gethostbyname-calls/#comment-10890
##
servicelist="";
for problemservice in `/usr/sbin/lsof 2> /dev/null | grep libc | awk '{print $1}' | sort -u`; do
@nojimage
nojimage / env.php
Created December 11, 2014 11:39
phpdotenvで環境別設定を切り替えるための読み込みファイル
<?php
/**
* This file read before Configure::load('app')
*/
use Dotenv;
/**
* required setting
*/
@nojimage
nojimage / docker-gitlab.conf
Last active August 29, 2015 14:07
upstart docker jenkins and gitlab
description "gitlab service runner"
start on filesystem and started docker.io
stop on runlevel [!2345]
kill signal CONT
normal exit 0 CONT
respawn
setuid manager
@localdisk
localdisk / api.php
Created July 2, 2014 04:40
Laravel で API を書くときの拡張子とかもろもろ対応
<?php
// Route::controller の戻り値は void なので Route::pattern でパラメータをチェック
Route::pattern('ext', 'xml|json');
// API 定義
Route::controller('api/{resource}.{ext?}', 'ApiController');
class ApiController extends \BaseController {
public function getIndex($resource, $ext = null)
{
@nojimage
nojimage / phpunit-for-cakephp.sh
Last active August 29, 2015 14:02
Custom PHPUnit script for CakePHP on NetBaeans 8.0
#!/usr/bin/env bash
##
#
# Custom PHPUnit script for CakePHP on NetBaeans 8.0
#
# @author Takashi Nojima [http://php-tips.com]
# @copyright 2014 Takashi Nojima
##
PROJECT_ROOT=$(cd "$(dirname "$(dirname "$0")")" && pwd)
@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 / 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
@iovar
iovar / proxy.php
Last active February 24, 2024 18:29
Simple PHP Proxy Script
<?php
/*
* Warning! Read and use at your own risk!
*
* This tiny proxy script is completely transparent and it passes
* all requests and headers without any checking of any kind.
* The same happens with JSON data. They are simply forwarded.
*
* This is just an easy and convenient solution for the AJAX
@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"
<?php
App::uses('DispatcherFilter', 'Routing');
class CorsFilter extends DispatcherFilter {
public function beforeDispatch(CakeEvent $event) {
if ($event->data['request']->is('OPTIONS')) {
$event->stopPropagation();
$event->data['response']->header(array(