Skip to content

Instantly share code, notes, and snippets.

View kazuph's full-sized avatar

Kazuhiro Homma kazuph

View GitHub Profile
@kazuph
kazuph / AES.c
Last active August 29, 2015 14:10 — forked from bricef/AES.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* MCrypt API available online:
* http://linux.die.net/man/3/mcrypt
*/
#include <mcrypt.h>
@kazuph
kazuph / file0.txt
Last active August 29, 2015 14:06
Wordpressの初回設定をサクッと済ませるスクリプト ref: http://qiita.com/kazuph/items/c95f6e90238fceed2674
# pwd
/var/www/html
# ls
wordpress
@kazuph
kazuph / Hoge.h
Created August 16, 2014 09:23
AFNetworkingをViewControllerに書かないでModelに書きたいとき ref: http://qiita.com/kazuph/items/2cc92622a298079aad5e
#import "AFHTTPSessionManager.h"
@interface Hoge : NSObject
+ (Hoge*)sharedClient;
- (void)hogeWithId:(NSString *)hogeId completion:(void (^)(NSDictionary *results, NSError *error))block;
@end
@kazuph
kazuph / .bash_profile
Last active February 2, 2017 09:44
cronからbundle exec...はsu - <USER> -lc ...が一番便利 ref: http://qiita.com/kazuph/items/c530359eada5b2639e68
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
@kazuph
kazuph / Gemfile
Last active August 29, 2015 14:05
積読記事をSlackに流して自分が読みたい記事を他人から教えてもらうライフハック ref: http://qiita.com/kazuph/items/f0ded1fef3127bf236cc
source "https://rubygems.org"
gem "faraday"
gem "faraday_middleware"
gem "hashie"
#!/usr/bin/env ruby
# 1. my.cnf か SHOW VARIABLES の結果を入力にとる
# 2. 入力を解析し、必要なパラメータ値を取得する
# 3. 計算
# 4. 結果を標準出力に出力する
require 'optparse'
require 'bigdecimal'
@kazuph
kazuph / ptqd.txt
Created August 5, 2014 07:38
pt-query-digestの実行結果の例
# 4.6s user time, 280ms system time, 40.89M rss, 287.59M vsz
# Current date: Tue Aug 5 07:36:47 2014
# Hostname: ip-172-31-23-18
# Files: tmp/mysql-slow.log.20140805-072831
# Overall: 9.98k total, 41 unique, 25.28 QPS, 0.46x concurrency __________
# Time range: 2014-08-05 07:21:41 to 07:28:16
# Attribute total min max avg 95% stddev median
# ============ ======= ======= ======= ======= ======= ======= =======
# Exec time 183s 4us 7s 18ms 95ms 79ms 194us
# Lock time 557ms 0 4ms 55us 185us 85us 42us
@kazuph
kazuph / report.sh
Created August 5, 2014 06:32
ISUCONでのレポート用シェル。
#!/bin/sh
SEC=`date --iso-8601=seconds`
DATE=`date +'%Y%m%d-%H%M%S'`
## NGINX
echo NGINX REPORT
# LTSVなログ前提
LOG_BASE=/home/isucon/tmp
@kazuph
kazuph / deploy.rb
Created July 21, 2014 12:16
capistrano 3 をできるだけシンプルにサーバーにコマンドを流し込むツールとして使いこなす ref: http://qiita.com/kazuph/items/deeaa7d3f9889674d7fe
lock '3.2.1'
set :pty, true
#!/usr/bin/env ruby
# 1. my.cnf か SHOW VARIABLES の結果を入力にとる
# 2. 入力を解析し、必要なパラメータ値を取得する
# 3. 計算
# 4. 結果を標準出力に出力する
require 'optparse'
require 'bigdecimal'