Skip to content

Instantly share code, notes, and snippets.

View ysaotome's full-sized avatar

Yuichi Saotome ysaotome

View GitHub Profile
#!/bin/bash
# File:change_root_password.sh
# 2013/07/18 @ysaotome
#===============================================
#設定したいrootパスワード「hoge##123」の部分を改変
#===============================================
ROOT_PASSWORD='hoge##123'
#===============================================
SALT=$(/usr/bin/uuidgen| /usr/bin/tr -d '-')
@ysaotome
ysaotome / update_motd_by_screenfetch.sh
Last active March 4, 2021 13:29
/etc/motdにサーバ情報を書き込むスクリプト。cronとかで回しておくと便利。#Ubuntu(http://manpages.ubuntu.com/manpages/lucid/man5/update-motd.5.html) やAmazonLinuxみたいなupdate-motdがCentOSにも欲しい。
#!/bin/bash
# Description:UpdateMotd by screenFetch
# References: http://goo.gl/xpWV7L
# 2015/07/08 @ysaotome
FILE_MOTD='/etc/motd'
BIN_DATE='/bin/date'
BIN_FIGLET='/usr/bin/figlet'
BIN_HOSTNAME='/bin/hostname'
@ysaotome
ysaotome / wordpress_setup_cheatsheet.sh
Last active December 19, 2015 17:39
2台構成(Web/APPサーバ1台、DBサーバ1台)のWordpressをセットアップする時のチートシート Japan TechFesta 2013 E30: 「ニフティクラウドを使ったインフラオートメーションハンズオン」http://www.techfesta.jp/p/program-2.html#E30の Chef vs 人力対決用
#Wordpress構築チートシート
#元ネタ:https://gist.github.com/ysaotome/2235302
#対決相手:http://tily.github.io/jtf2013/
###############################################
# 環境変数を定義 WEB/APPサーバおよびDBサーバの双方で実行
###############################################
## MySQL管理ユーザのパスワード
export MYSQL_ROOT_PASS='mysql##123'
## Wordpressデータベース名
@ysaotome
ysaotome / serverspec_install_with_centos64_x86_64.sh
Created June 21, 2013 11:57
CentOS 6.4 x86_64 にserverspecセットアップするスクリプトー
#!/bin/bash
# File:serverspec_install_with_centos64_x86_64.sh
# 2013/06/21 @ysaotome
## セットアップに必要なライブラリのインストール
/usr/bin/yum -y install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison
## rbenvセットアップ
/usr/bin/git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
/bin/mkdir /usr/local/rbenv/{shims,versions}
#!/bin/bash
# File:chef-solo_automatic_install_with_centos63_64bit_Plain_for_niftycloud.sh
# 2013/06/16 @ysaotome
#===============================================
# Settings
#===============================================
##ニフティクラウドのAPIキーを埋め込むと便利
NIFTY_CLOUD_ACCESS_KEY='Your NIFTY Cloud Access Key'
NIFTY_CLOUD_SECRET_KEY='Your NIFTY Cloud Secret Key'
@ysaotome
ysaotome / centos66_64bit_Plain_setup_script_for_niftycloud.sh
Last active May 13, 2016 01:29
CentOS 6.6 64bit Plain setup script for NiftyCloud (http://cloud.nifty.com/)
#!/bin/bash
# Description:CentOS 6.6 64bit Plain setup script for NiftyCloud (http://cloud.nifty.com/)
# File:centos66_64bit_Plain_setup_script_for_niftycloud.sh
# 2016/05/01 @ysaotome
(
#===============================================
# Settings
#===============================================
##rootのパスワード
@ysaotome
ysaotome / wordpress_automatic_install_script_with_centos63_setup_for_niftycloud.sh
Last active December 16, 2015 12:28
ニフティクラウド(NiftyCloud)向けWordpress自動セットアップスクリプト(https://gist.github.com/ysaotome/2235302)とOSのセットアップスクリプトを合体。起動スクリプトとして実行すると http://[サーバIP]/wordpress にWordpressがセットアップされる。
#!/bin/bash
# CentOS 6.3 64bit Plain setup script for NiftyCloud
# 2013/04/22 @ysaotome
#===============================================
# Settings
#===============================================
##rootのパスワード
ROOT_PASSWORD='hoge##123'
##追加する管理ユーザ名
@ysaotome
ysaotome / CentOS6_rbenv_setup.sh
Created March 20, 2013 09:26
CentOS 6 rbenv setup
yum --enablerepo=rpmforge,epel,remi -y install gcc make zlib zlib-devel openssl-devel zsh
cd /usr/local
git clone git://github.com/sstephenson/rbenv.git rbenv
mkdir rbenv/shims rbenv/versions
chgrp -R groupname rbenv
chmod -R g+rwxXs rbenv
git clone git://github.com/sstephenson/ruby-build.git ruby-build
cd ruby-build
./install.sh
@ysaotome
ysaotome / facebook-sample-app.php
Last active December 31, 2016 08:09
Facebook連携サンプルプログラム 出来る事 (1)ログイン、ログアウト処理 (2)ログインしている人の情報を取得する処理 (3)ログインしている人の友達リストを取得する処理
<?php
//Facebook公式SDK(開発セット)を読み込む
require './facebook-php-sdk/src/facebook.php';
//AppIDとAppSecretをFacebook Developer Centerにて取得して下さい。
// https://developers.facebook.com/apps/
//AppIDとAppSecretを設定してください。
$facebook = new Facebook(array(
'appId' => 'APP ID',
@ysaotome
ysaotome / niftycloud-fw-visualization.awk
Created May 6, 2012 10:40
generate graphviz dot file for NiftyCloud Firewall map
#!/usr/bin/awk -f
BEGIN {
FS="##";
print "digraph G {";
print "\t\"0.0.0.0/0\" [label = \"インターネット\"];";
}
$7 ~ /CIDR|IP|GRPNAME/ {
src = $8;
}