Skip to content

Instantly share code, notes, and snippets.

@chobie
chobie / gist:2416534
Created April 18, 2012 21:04
installing php-git
sudo aptitude install build-essential automake cmake patch git-core php5-cli php5-dev libpcre3-dev -y
git clone https://github.com/libgit2/libgit2.git
cd libgit2
mkdir build
cd build
cmake ..
cmake --build .
sudo cmake --build . --target install
cd ../../
@chobie
chobie / deflate.php
Created September 22, 2013 11:40
Pure PHP GZip Deflate implementations (not maintained)
<?php
/**
* Deflate functions
*
* originally written by Takahiko Kawasaki.
* porting by Shuhei Tanuma.
*
* @see http://darutk-oboegaki.blogspot.jp/2011/09/gzip-decompression-in-c.html
*/
@chobie
chobie / monitor.php
Created January 28, 2011 10:13
inotify & rsync
<?php
/**
svn co http://svn.php.net/repository/inotify/trunk php-inotify
cd php-inotify
phpize && ./configure && make
sudo make install
# add "extension = inotify.so" to your php config.
# and modify this script.
php monitor.php
*/
static void git_ex_cb(INTERNAL_FUNCTION_PARAMETERS)
{
zval *payload, *this = getThis();
char *oid;
int oid_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"sz", &oid, &oid_len, &payload) == FAILURE) {
return;
}
// シェイプレイヤーのコンテンツの位置からトランスーフォームの位置がシェイプの中心点に来るように修正します。
//
// [MEMO]
// シェイプレイヤーは作成時にコンポジションの中心点に位置をあわせます。
// 複数シェイプを格納できるようにするためにこのようにしてあるのですが、一つだけしかシェイプを
// 含めない場合はシェイプの中心点にトランスフォームの中心がこないので余計なお世話だったりします。
// このスクリプトはシェイプレイヤーのシェイプの位置情報をクリアし、レイヤーの位置情報が中心点に来るように修正をします。
//
// ・複数シェイプを含むシェイプレイヤーは対応していません。キーフレームなども考慮しません。
// ・多分変な処理はしませんが大事なファイルであれば保存しておいてから作業をしてください
gem install fpm --no-ri --no-rdoc
# packagesディレクトリ以下をまとめてpackagingする
go build -o YOURAPP yourapp.go
mkdir -p pakcages/usr/local/YOURAPP/{bin,etc}
cp yourapp packages/usr/local/YOUARPP/bin/yourapp
(cd packages; fpm -s dir -t deb -n YOURAPP -v 0.1.0 .)
ls -la packages
  • 大半のgo applicationならdependsはないからfpmはとても楽な選択

Ansibleを始めてみよう。

現状InfluxDBのInstall手順があるのでなるべく楽してClusterのセットアップをしたい。 当方Ansibleは初。Pythonもそんなに書いていないので得意ではない。インフラ歴はほどほど。

今日はざっくりとしたログ形式でお届けします。

まずはansible tutorialでぐぐる。ほむほむ

http://yteraoka.github.io/ansible-tutorial/#test-ansible

PROJECT(ex)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
INCLUDE(FindProtobuf)
FIND_PACKAGE(Protobuf REQUIRED)
FILE(GLOB ProtoFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.proto")
PROTOBUF_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles})
FILE(GLOB SRC_EX *.cc)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
@chobie
chobie / arrayserializable.md
Last active December 30, 2015 21:59
Add common way to convert array from object for PHP

ArraySerializable Interface

Current Status

Considering

Introduction

this article proposes to add ArraySerializable interface and to allow the changing of existing array conversion mechanism. As an example of this change, consider the following code-snippet:

<?php
namespace Chobie\BlogBundle\Render;
class HtmlRender extends \Sundown\Render\HTML
{
protected $emoji;
public function __construct($options)
{
parent::__construct($options);