Skip to content

Instantly share code, notes, and snippets.

View masudak's full-sized avatar

masudak masudak

View GitHub Profile
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit66e40dd574b96b065e948c3a01cd6099::getLoader();
scp ~/Documents/markdown/images/20151012/\* masuda-instance01:/tmp/. ⏎
/Users/hogehoge/Documents/markdown/images/20151012/*: No such file or directory
public static void main(String[] args) {
String str = "2009time";
String regex = "(\\d+)(t)";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(str);
if (m.find()) {
String matchstr = m.group();
System.out.println(matchstr + "の部分にマッチしました");
System.out.println("group1: " + m.group(1));
require 'rake'
require 'rspec/core/rake_task'
task :spec => 'spec:all'
task :default => :spec
namespace :spec do
targets = []
# get indivisual role from spec dir
Dir.glob('./spec/*').each do |dir|

問題: kibana4を起動するとUnassignedなnodeができてしまう。 「Deacon Frost」だけでなく、もう一つできて、Unassignedなものができあがる。

効いてない?

# cat /etc/elasticsearch/elasticsearch.yml
cluster.name: test-es
index.number_of_shards: 1
index.number_of_replicas: 0
path.data: /data/elasticsearch
@masudak
masudak / count_documents.py
Last active August 29, 2015 14:17
count collections
#!/usr/bin/env python
from pymongo import Connection
connection = Connection('localhost', 27017)
def get_db_names():
return connection.database_names()
def get_collection_names(db_name):
def extract_hostname(fqdn):
    __pattern = r'([^\\.]+).+'
    regex = re.compile(__pattern, re.MULTILINE)
    for match in regex.finditer(fqdn):
        return match.group(1)
//-------------------------------------------
// sample1
// - callbackにするのは非同期のとき
// - 引数に渡すcallback関数を呼び出し元でいれかえることでhello関数自体が汎用的な処理になる
//-------------------------------------------
function hello_callback(){
console.log("called callback")
}
#!/usr/bin/env node
var async = require('async');
function sleep(time, callback){
setTimeout(callback, time);
}
async.series([
function(callback) {
console.log('###1');
%define name go
%define goroot /usr/local/%{name}
%define version 1.4
%define release 1
#%define debug_package %{nil}
Name: %{name}
Version: %{version}
Release: %{release}
Summary: %{name} %{version}