Skip to content

Instantly share code, notes, and snippets.

@shiraji
shiraji / crontab_alias
Last active December 23, 2015 19:59
crontab -rを使えなくする。
alias crontab=crontabl
# crontab設定後crontab -lをする
function crontabl() {
if [ $# -gt 1 ]; then
# 複数パラメータがある場合はそのまま。
\crontab $@
else
if [ "$1" != "-r" ]; then
if [ "$1" != "-l" ]; then
{
"run_list": "role[jenkins]"
}
{
"name": "jenkins",
"default_attributes": { },
"override_attributes": {
"java": {
"install_flavor": "oracle",
"jdk_version": "6",
"oracle": {
"accept_oracle_download_terms": "true"
}
@shiraji
shiraji / prepare_jenkins.sh
Created June 16, 2013 16:36
いちいち、berkshelfをキックして、chef-soloをキックするのが面倒だったので・・・
#!/bin/sh
# get cookbooks using berkshelf
berks install --path cookbooks
# run chef-solo
if [ "$?" = "0" ] then
chef-solo -c solo.rb -j nodes/chef.json
fi
@shiraji
shiraji / my_thor.rb
Last active December 17, 2015 22:49
#! /usr/local/bin/ruby
########################################################################
#
# Rubyのバッチ処理でよく使うであろう処理が書かれたクラス。
# よく使うオプションをclass_optionに設定し、
# このクラスを継承したクラスで利用できるようになっている。
#
########################################################################
require 'thor'
#! /usr/local/bin/ruby
require 'thor'
class Test < Thor
class_option :help, :type => :boolean, :aliases => '-h', :desc => 'Thor test'
default_task :execute
desc "execute [OPTION]", "Test execute"
option :production, :type => :boolean, :aliases => '-p', :desc => "Run production DB server"
option :number, :type => :numeric, :aliases => '-n', :default => 3, :desc => "test number"
#!/bin/sh
#get GitHub user name if it is not provided
if [ $# -lt 1 ]; then
echo -n "Enter GitHub user name: "
read _githubUsername
else
_githubUsername=$1
fi
#!/bin/sh
{
srcDir="/usr/local/src"
installDir="/usr/local"
yamlFileExt=".tar.gz"
yaml="yaml-0.1.4"
yamlFileName=$yaml$yamlFileExt
yamlHTML="http://pyyaml.org/download/libyaml/$yamlFileName"
// テキストエディタ色設定 Ver3
[SakuraColor]
C[BRC]=0,1,000080,000000,0
C[CMT]=1,0,008000,000000,0
C[CTL]=1,0,00ffff,000000,0
C[DFA]=0,0,ff00ff,000000,0
C[DFC]=0,0,ff00ff,000000,0
C[DFD]=0,0,ff00ff,000000,0
C[EOF]=1,0,81f1fe,000000,0
#!/bin/sh
yum -y install ruby
yum -y install ruby-devel
yum -y install rubygems
gem update --system 1.8.25
gem install chef --no-rdoc --no-ri
gem install rake
gem install knife-solo
#check version