Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
tkuchiki / newFile1.txt
Last active May 11, 2023 06:53
nginx source build (lua-nginx-module). https://gist.github.com/tkuchiki/7025062
# LUAJIT のディレクトリは適宜変更
LUAJIT_LIB=/usr/local/lib
NGX_VERSION=1.4.3
wget "http://nginx.org/download/nginx-$NGX_VERSION.tar.gz"
tar zxvf nginx-$NGX_VERSION.tar.gz
# ./configure: error: the HTTP rewrite module requires the PCRE library.
yum install pcre pcre-devel
yum install openssl openssl-devel zlib zlib-devel readline readline-devel libxml2 libxml2-devel libxslt-devel
@tkuchiki
tkuchiki / gist:7036465
Last active December 25, 2015 20:39
du 降順で、-h のような見やすい format で出力
ionice -c 2 -n 7 nice -n 19 du -a /path/to/dir | sort -nr | awk '{if ($1 < 1000) { printf("%.2fK %s\n", $1, $2); } else if ($1 < 1000000) { printf("%.2fM %s\n", $1 / 1000, $2); } else if ($1 < 1000000000) { printf("%.2fG %s\n", $1 / 1000 / 1000, $2); }}' | head -n 200
@tkuchiki
tkuchiki / gist:7094018
Created October 22, 2013 01:52
jdk download
# http://stackoverflow.com/questions/10268583/how-to-automate-download-and-instalation-of-java-jdk-on-linux
wget --no-check-certificate --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64.rpm" -O /tmp/jdk.rpm
curl -b "gpw_e24=http%3A%2F%2Fwww.oracle.com" -L "http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64.rpm" -o /tmp/jdk.rpm
@tkuchiki
tkuchiki / cap_installation
Last active December 26, 2015 05:39
capistrano 3
$ gem install capistrano --no-ri --no-rdoc
# cap install STAGES=local,sandbox,qa,production
$ cap install
mkdir -p config/deploy
create config/deploy.rb
create config/deploy/staging.rb
create config/deploy/production.rb
mkdir -p lib/capistrano/tasks
Capified
@tkuchiki
tkuchiki / bcrypt.rb
Created October 24, 2013 11:51
bcrypt password hashing
#!/usr/bin/ruby
# gem install bcrypt-ruby
require "bcrypt"
# 1.9.3 or later
require "io/console"
print "Enter password: "
password = STDIN.noecho(&:gets)
@tkuchiki
tkuchiki / config.xml
Created October 24, 2013 12:15
jenkins config.xml
<?xml version='1.0' encoding='UTF-8'?>
<hudson>
<disabledAdministrativeMonitors/>
<version>1.0</version>
<numExecutors>2</numExecutors>
<mode>NORMAL</mode>
<useSecurity>true</useSecurity><!-- セキュリティ有効化 -->
<authorizationStrategy class="hudson.security.FullControlOnceLoggedInAuthorizationStrategy"/>
<securityRealm class="hudson.security.HudsonPrivateSecurityRealm">
<disableSignup>true</disableSignup><!-- ユーザにサインアップを許可 -->
@tkuchiki
tkuchiki / gist:7154027
Last active December 26, 2015 12:49
言語別現在時刻を取得
# ruby
# 2000-01-01 01:01:01
Time.now.strftime('%F %T')
Time.now.strftime('%Y-%m-%d %H:%M:%S')
@tkuchiki
tkuchiki / gist:7154809
Last active December 26, 2015 12:59
nginx init script
#!/bin/sh
#
# nginx Startup script for nginx
#
# chkconfig: - 85 15
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
# pidfile: /var/run/nginx.pid
# description: nginx is an HTTP and reverse proxy server
@tkuchiki
tkuchiki / find_mv.sh
Last active December 27, 2015 01:29
同じ format のファイル名を変更する
#!/bin/sh
# $1 : path to dir
# $2,$3 : regex (sed format)
FILES=`find ${1} -type f`
for FILE in $FILES; do
RENAMED=`echo ${FILE} | sed -e "s/$2/$3/g"`
mv $FILE $RENAMED
@tkuchiki
tkuchiki / use_open3
Last active December 27, 2015 03:48
ruby で nginx -V から version を抽出 (1.8 対応)
`nginx -V 2>&1`