Skip to content

Instantly share code, notes, and snippets.

View shinyay's full-sized avatar

Shinya Yanagihara shinyay

View GitHub Profile
@shinyay
shinyay / Octopress Install
Created May 11, 2013 22:02
This is instruction for installment of Octpress for GitHub.
# Get Octpress.
$ git clone git://github.com/imathis/octopress.git octopress
$ cd octopress
# Check your ruby version and edit .rbenv-version
$ rbenv versions
system
* 2.0.0-p0
$ vim .rbenv-version
@shinyay
shinyay / Management octopress source at Bitbucket
Last active December 17, 2015 07:09
source of octopress is not managed by 'rake deploy'. I manage source at Bitbucket.
$ cd [your_octopress_dir]
$ git add .
$ git commit -m '[message]'
$ git remote add bitbucket git@bitbucket.org:[username]/[your_repository].git
$ git push -u bitbucket
@shinyay
shinyay / gist_tag.rb
Last active December 17, 2015 08:39 — forked from j5ik2o/gist_tag.rb
I revised to prevent from occurring exception which is caused by nil. If you put gist without language field, exception occurred. Then I put nil check.
# A Liquid tag for Jekyll sites that allows embedding Gists and showing code for non-JavaScript enabled browsers and readers.
# by: Brandon Tilly
# Source URL: https://gist.github.com/1027674
# Post http://brandontilley.com/2011/01/31/gist-tag-for-jekyll.html
#
# Example usage: {% gist 1027674 gist_tag.rb %} //embeds a gist for this plugin
require 'cgi'
require 'digest/md5'
require 'net/https'
@shinyay
shinyay / Gemfile
Created May 25, 2013 19:12
My Gemfile for using chef is as described below. The point is that I use knife-solo.
source "https://rubygems.org"
gem 'chef'
gem 'knife-solo', '0.3.0.pre3'
gem 'knife-solo_data_bag'
gem 'berkshelf'
@shinyay
shinyay / knife configure
Created May 25, 2013 19:30
I show the log which is I configure knife initially. It is simply default setup.
$ bundle exec knife configure
WARNING: No knife configuration file found
Where should I put the config file? [/Users/shinyay/.chef/knife.rb]
Please enter the chef server URL: [http://Shinya-MBA-2011.local:4000]
Please enter an existing username or clientname for the API: [shinyay]
Please enter the validation clientname: [chef-validator]
Please enter the location of the validation key: [/etc/chef/validation.pem]
Please enter the path to a chef repository (or leave blank):
*****
@shinyay
shinyay / base_packages_default.rb
Created May 28, 2013 02:46
I show a sample recipe of chef, which install sysstat and mosh.
#
# Cookbook Name:: base_packages
# Recipe:: default
#
# Copyright 2013, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
%w{sysstat mosh}.each do |pkg|
package pkg do
@shinyay
shinyay / Error by brew update
Created June 8, 2013 18:43
Error occured by brew update on OSX error: The following untracked working tree files would be overwritten by merge: Library/Formula/libarchive.rb
$ brew update
error: The following untracked working tree files would be overwritten by merge:
Library/Formula/libarchive.rb
Please move or remove them before you can merge.
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master
# I deal with the error as follows
$ cd /usr/local/Library/Formula
@shinyay
shinyay / setup_mysql_log
Created June 8, 2013 18:57
I setup mysql on OSX
Shinya-MBA-2011:~ shinyay$ mysql.server start
Starting MySQL
. SUCCESS!
Shinya-MBA-2011:~ shinyay$ mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
@shinyay
shinyay / deploy.json
Created June 17, 2013 10:02
Encrypted Data Bag
{
"id": "deploy",
"name": "deploy",
"password": "$1$7hCJ0c6m$hc6Y0cFNAcRf/ulITCz/k1",
"ssh-key": "ssh-rsa AAAAB3NzaC1yc2.....
}
@shinyay
shinyay / default.rb
Created June 17, 2013 10:04
my-users default recipe
user = Chef::EncryptedDataBagItem.load("users", 'deploy')
user_name = user['name']
password = user['password']
ssh_key = user['ssh_key']
home = "/home/#{user_name}"
# Create a User [deploy]
user user_name do
password password
home home