Skip to content

Instantly share code, notes, and snippets.

View ngsw's full-sized avatar
💭
:-):-):-)

ngsw ngsw

💭
:-):-):-)
View GitHub Profile
@ngsw
ngsw / nginx_t
Created January 31, 2012 21:24
nginx -t の 実行で pid ファイルが生成される
# nginx -V 2>&1 |grep --color '\-\-pid-path.*.pid'
(snip)
--pid-path=/var/run/nginx/nginx.pid
(snip)
# ls /var/run/nginx/nginx.pid
ls: cannot access /var/run/nginx/nginx.pid: そのようなファイルやディレクトリはありません
# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
@ngsw
ngsw / passenger nginx
Created February 3, 2012 14:33
Scientific Linux 6.1 yum_setup & rbenv
# sl は $releasever をベタ書き
cat > /etc/yum.repos.d/nginx.repo <<'nginxREPO'
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/6/$basearch/
gpgcheck=0
enabled=1
nginxREPO
# ばっといれとく curl-devel は passenger あたりで言われる
#! /bin/env ruby
#-*- coding: utf-8 -*-
def fizzbuzz(n)
[*1..n].each{| i |
num = i.to_i
puts num % 15 == 0 ? "FizzBuzz" :
num % 5 == 0 ? "Buzz" :
num % 3 == 0 ? "Fizz" :
num
}
@ngsw
ngsw / gist:2010601
Created March 10, 2012 06:34
diff -uw bookmark_button.js bookmark_button_wo_al.js
--- bookmark_button.js 2012-03-08 15:57:54.000000000 +0900
+++ bookmark_button_wo_al.js 2012-03-08 15:57:54.000000000 +0900
@@ -742,17 +742,6 @@
}
});
-
-(function () {
- var domains = 'www.toyokeizai.net member.toyokeizai.net excite.co.jp exblog.jp mainichi.jp jp.msn.com *.jp.msn.com itmedia.co.jp bizmakoto.jp atmarkit.co.jp eetimes.jp ednjapan.cancom-j.com ednjapan.com barks.jp www.asahi.com *.asahi.com jp.techcrunch.com japanese.engadget.com jp.autoblog.com celebrity.aol.jp www.nikkei.com *.nikkeibp.co.jp japan.cnet.com japan.zdnet.com builder.japan.zdnet.com japan.gamespot.com www.re-source.jp www.yomiuri.co.jp groupon.jp';
- var pattern = '^(?:' + domains.replace(/\./g, '\\.').replace(/\*\\\./g, '(?:[^.]+\\.)+').replace(/\s+/g, '|') + ')$';
Origin
https://github.com/utahta/WP-Social-Bookmarking-Light/blob/master/modules/services.php
--- services.php_org 2011-11-30 02:49:15.000000000 +0900
+++ services.php 2012-03-10 15:07:22.000000000 +0900
@@ -89,7 +89,7 @@
.' title="'.$alt.'">'
.' <img src="http://b.st-hatena.com/images/entry-button/button-only.gif"'
.' alt="'.$alt.'" width="20" height="20" style="border: none;" /></a>'
@ngsw
ngsw / gist:2695355
Created May 14, 2012 17:55
KVM_install_AMD
#! /bin/sh
#参考URL
#Scientific Linux 6 - KVM - インストール : Server World http://www.server-world.info/query?os=Scientific_Linux_6&p=kvm&f=1
yum install qemu-kvm libvirt python-virtinst bridge-utils
modprobe kvm
# grep 'Intel' /proc/cpuinfo && modprobe kvm_intel || modprobe kvm_amd # OK? :(
modprobe kvm_amd
#modprobe kvm_intel
@ngsw
ngsw / gist:2695581
Created May 14, 2012 18:40
KVM_Setup_Bridge_br0
#! /bin/sh
# :Scientific Linux 6 - KVM - インストール : Server World http://www.server-world.info/query?os=Scientific_Linux_6&p=kvm&f=1
cp -a /etc/sysconfig/network-scripts/ifcfg-{eth0,br0}
echo 'DEVICE=eth0' > /etc/sysconfig/network-scripts/ifcfg-eth0
grep HWADDR /etc/sysconfig/network-scripts/ifcfg-br0 >> /etc/sysconfig/network-scripts/ifcfg-eth0
cat >> /etc/sysconfig/network-scripts/ifcfg-eth0 <<'KVMeth0'
ONBOOT=yes
TYPE=Ethernet
BRIDGE=br0
@ngsw
ngsw / gist:2790474
Created May 25, 2012 20:50
bonnie++ setup
###参考URL :bonnie++ で I/O 性能を測定 (Linux/Unix での IO ベンチマークソフト) :: drk7jp http://www.drk7.jp/MT/archives/001448.html
###Scientific Linux release 6.2 (Carbon)
###Linux `hostname` 2.6.32-220.el6.x86_64 #1 SMP Sat Dec 10 17:04:11 CST 2011 x86_64 x86_64 x86_64 GNU/Linux
yum install wget gcc-c++ make
cd /usr/local/src
_TARGET_FILE='bonnie++-1.03e'
wget http://www.coker.com.au/bonnie++/${_TARGET_FILE}.tgz
tar zxvf ${_TARGET_FILE}.tgz
@ngsw
ngsw / junbi
Created June 29, 2012 16:44
work
yum -y install wget zlib gcc make perl
cd /usr/local/src/
wget http://archive.apache.org/dist/httpd/httpd-2.2.4.tar.gz
wget http://ftp.openssl.org/source/openssl-1.0.0j.tar.gz
tar zxvf httpd-2.2.4.tar.gz ; tar zxvf openssl-1.0.0j.tar.gz
cd /usr/local/src
wget http://archive.apache.org/dist/httpd/httpd-2.2.10.tar.gz
tar zxvf httpd-2.2.10.tar.gz
cd httpd-2.2.10
./configure --prefix=/usr/local/apache-2.2.10 \
--enable-module=so \
--enable-so \
--enable-ssl=static \
--with-ssl=/usr/local/openssl-1.0.0c/ssl
make > /dev/null #エラーメッセージだけを出力確認したいので便宜上 "> /dev/null" を付与した