Skip to content

Instantly share code, notes, and snippets.

@t-cyrill
t-cyrill / index.php
Last active August 29, 2015 14:04
Klein.php sample
<?php
require __DIR__ . '/vendor/autoload.php';
$klein = new \Klein\Klein;
$klein->respond('GET', '/hello', function () {
return 'Hello World!';
});
$klein->dispatch();
@t-cyrill
t-cyrill / database.yml
Created July 2, 2014 04:32
mysql2 database.yml
development:
database: mysql_development
adapter: mysql2
username: mysql_user
password: mysql_pass
host: 127.0.0.1
port: 3306
@t-cyrill
t-cyrill / Vagrantfile
Created July 2, 2014 04:26
vagrant middleware vm
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "debian_wheezy64"
config.vm.network "forwarded_port", guest: 3306, host: 3306
@t-cyrill
t-cyrill / ssl_autogen.expect
Last active August 29, 2015 14:02
SSL csr auto-generate scripts.
#!/usr/bin/expect -f
set timeout 5
spawn openssl genrsa -out server.key -aes128 2048
expect "Enter pass phrase"
send "pass phrase\n"
expect "Verifying - Enter pass phrase"
send "pass phrase\n"
interact
<?php
$e = null;
try {
throw new RuntimeException('foo');
} catch (Exception $e) {
// Catch and set $e if Exception thrown.
} finally {
// Do something
if (isset($e)) {
throw new $e;
test:
override:
- "bundle exec bin/rubocop_parallel": { parallel: true }
th075altlobby.dip.jp(th075altlobby.dip.jp:9555)
th075altlobby.dip.jp(54.199.139.221:9555)
localhost(localhost:9555)
#! /bin/sh
### BEGIN INIT INFO
# Provides: <%= app %>
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Generated initscript for <%= app %>
# Description: This file starts <%= app %>. It should be placed in /etc/init.d
### END INIT INFO
@t-cyrill
t-cyrill / gist:8701636
Created January 30, 2014 02:42
ElasticSearch NullPointerException
[DEBUG][action.admin.indices.mapping.put] ...
java.lang.NullPointerException
at org.elasticsearch.common.xcontent.XContentFactory.xContent(XContentFactory.java:110)
at org.elasticsearch.common.xcontent.XContentHelper.convertToMap(XContentHelper.java:113)
at org.elasticsearch.common.xcontent.XContentHelper.convertToMap(XContentHelper.java:101)
at org.elasticsearch.index.mapper.DocumentMapperParser.parseCompressed(DocumentMapperParser.java:175)
at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:322)
at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:318)
at org.elasticsearch.cluster.metadata.MetaDataMappingService$5.execute(MetaDataMappingService.java:533)
at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:300)
@t-cyrill
t-cyrill / gist:8297965
Created January 7, 2014 11:18
screenのいい感じのhardstatus
hardstatus alwayslastline '%{= kg}%02c:%s %H %{-}%L=%{= kb}%-w%{-}%45L>%{=u kr}%n %t%{-}%{= kb}%+w %-17<%=%{-}%{= .y}(%l)'