Skip to content

Instantly share code, notes, and snippets.

View ikuwow's full-sized avatar

Ikuo Degawa ikuwow

View GitHub Profile
<?php
$input = 'hoge00';
$trials = 100000;
$tic = microtime(true);
for ($i = 0; $i < $trials; $i++) {
preg_match("/^[0-9]+$/", $input);
}
echo (string)(microtime(true) - $tic) . "\n";
@ikuwow
ikuwow / file0.txt
Last active March 16, 2016 14:20
sshした先に.bashrcや.vimrcを持って行きたい人のためのsshrc ref: http://qiita.com/ikuwow/items/ba4ca57fd67c06fd1b19
$ brew install sshrc
@ikuwow
ikuwow / file0.txt
Created February 21, 2016 02:48
fluentdのread_from_headでログの欠損が治ったパターン ref: http://qiita.com/ikuwow/items/ea300af9d0ff2d90d69c
log-2016-02-01-00.log
log-2016-02-01-01.log
...
log-2016-02-01-22.log
log-2016-02-01-23.log
log-2016-02-02-00.log
@ikuwow
ikuwow / file0.txt
Created February 6, 2016 13:47
osx_defaultsモジュール (from Ansible 2) でMacのプロビジョニングが簡単になってすごい便利 ref: http://qiita.com/ikuwow/items/86dd11b111640cfee3f0
- name: Check Dock
shell: "defaults read com.apple.dock | grep autohide > /dev/null && test `defaults read com.apple.dock autohide` -eq 1; echo $?"
register: is_autohide
changed_when: is_autohide.stdout != '0'
- name: Autohide Dock
shell: "defaults write com.apple.dock autohide -int 1"
notify: Restart Dock
when: is_autohide.stdout != '0'
@ikuwow
ikuwow / file0.html
Last active April 23, 2017 06:23
Webサイトにつけるウィジェットをiframeで作る基本的な手順 ref: http://qiita.com/ikuwow/items/4343a252d1ff8b4e26a7
<div class="cbox">
<div class="ctitle">
<img src="https://avatars.githubusercontent.com/ikuwow?s=40">ikuwow's Contributions
</div>
<div class="cbody">
<img src="http://ghchart.rshah.org/ikuwow" alt="ikuwow's Github chart"><a href="https://github.com/ikuwow" target="_blank">See on GitHub</a>
</div>
</div>
@ikuwow
ikuwow / file0.txt
Created January 10, 2016 09:40
GitLab7系から8系にあげるときのポイントと、Apacheだとソケットをhttpにしないとハマる話 ref: http://qiita.com/ikuwow/items/5faa16b54522fc5f4569
$ git pull origin master
Unable to connect ... connection refused 503(うろ覚え)
@ikuwow
ikuwow / file0.js
Last active January 6, 2016 02:29
ピュアなJSでAPIリクエストをするメモ(jsonとjsonp) ref: http://qiita.com/ikuwow/items/ed5f3c9ee0bd6147b7f3
(function(){
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if (this.readyState==4 && this.status==200) {
// responseをhogehogeする
}
};
xhr.responseType = 'json';
xhr.open('GET',endpoint,true);
xhr.send();
@ikuwow
ikuwow / file0.txt
Created December 6, 2015 12:28
スプレッドシートでCSV吐き出して小さなDBのテストデータを作ると結構楽だった ref: http://qiita.com/ikuwow/items/a783a83924f88c48a1b5
create table if not exists users (
id serial not null primary key,
email varchar(255) not null,
name varchar(255) not null,
password varchar(255) not null,
created datetime not null default now()
) engine=innodb;
@ikuwow
ikuwow / file0.go
Last active November 1, 2015 23:52
Go言語で簡単にHTTPリクエストを送ってJSONをパースするサンプル ref: http://qiita.com/ikuwow/items/c8f494bbd16adf6db142
package main
import (
"os"
"fmt"
"net/http"
"github.com/m0a/easyjson"
)
var api = "https://teratail.com/api/v1"
@ikuwow
ikuwow / file0.txt
Created September 27, 2015 10:49
sayコマンドでPepperに任意の英語を喋らせる ref: http://qiita.com/ikuwow/items/2d94cb0ec19bafd1e660
$ say hello
# "hello"って言う