Skip to content

Instantly share code, notes, and snippets.

View SammyLin's full-sized avatar
:octocat:
大家好

Sammy Lin SammyLin

:octocat:
大家好
View GitHub Profile
@SammyLin
SammyLin / xx.sh
Created July 23, 2015 04:24
遇到 tar.xz 解壓縮
tar xvJf ***.tar.xz
@SammyLin
SammyLin / gist:94509bf759d3873e6897
Created July 17, 2015 03:49
一行 YAML 轉 JSON
ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))' < file.yml > file.json
@SammyLin
SammyLin / install_chef-client.sh
Last active August 29, 2015 14:23
mac install chef-client at china
curl -O http://7xj5oe.com1.z0.glb.clouddn.com/files/chef-12.3.0-1.dmg
open chef-12.3.0-1.dmg
@SammyLin
SammyLin / gist:fb24e5320cb893b4a221
Created May 26, 2015 09:36
push public key in remote machine
cat ~/.ssh/id_rsa.pub | ssh user@machine "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"
@SammyLin
SammyLin / bootstarp_ruby_chef.sh
Last active December 1, 2016 02:07
install ruby 2.2.0 & chef 12.3.0 on ubuntu 14.04 at china
# curl -sL https://git.io/v1sVj | sudo bash
#!/usr/bin/env bash
RUBY_VERSION='2.2.1'
CHEF_VERSION='12.3.0'
echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
sudo locale-gen --lang zh_TW.UTF-8
@SammyLin
SammyLin / install_chef.sh
Last active August 29, 2015 14:21 — forked from bladelee/setup ruby2.0 and chef-solo
setup ruby2.0 and chef-solo
sudo apt-get -y update
sudo apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev vim
# Download and compile Ruby 2.0.0-p0
cd /tmp
#wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz
wget http://ruby.taobao.org/mirrors/ruby/2.0/ruby-2.0.0-p353.tar.gz
tar -xvzf ruby-2.0.0-*.tar.gz
cd ruby-2.0.0-*
./configure --prefix=/usr/local
# bash < <( curl -L https://gist.githubusercontent.com/SammyLin/974def3b8f4cd84ce284/raw/31cbdaacb5d85f5ad483e58673f70f3a60699210/gistfile1.sh )
#!/bin/bash
set -e
echo 'hi'
@SammyLin
SammyLin / gist:5c17bdabc42e1f079cae
Created January 8, 2015 02:24 — forked from kogakure/gist:79851
刪除 Frontpage, WSFTP 等等產生的檔案 Bash: Get rid of those nasty files from Frontpage, WSFTP, etc.
#!/bin/bash
find . -name _vti_cnf -exec rm -rf {} \;
find . -name _borders -exec rm -rf {} \;
find . -name _private -exec rm -rf {} \;
find . -name _vti_pvt -exec rm -rf {} \;
find . -name _vti_txt -exec rm -rf {} \;
find . -name _vti_script -exec rm -rf {} \;
find . -name .DS_Store -exec rm -rf {} \;
find . -name WS_FTP.LOG -exec rm -rf {} \;
@SammyLin
SammyLin / monit_solr.conf.erb
Last active August 29, 2015 14:11
monit configuration for solr and rails project
check process solr-<%= fetch(:application) %> with pidfile <%= "#{shared_path}/pids/sunspot-solr.pid" %>
start program = "/bin/su - deploy -c 'cd <%= current_path %> && <%= SSHKit.config.command_map[:bundle] %> exec sunspot-solr start --port=8983 --data-directory=<%= shared_path %>/solr/data --pid-dir=<%= shared_path %>/pids'"
stop program = "/bin/su - deploy -c 'cd <%= current_path %> && <%= SSHKit.config.command_map[:bundle] %> exec sunspot-solr stop --pid-dir=<%= shared_path %>/pids'"
if failed host 127.0.0.1 port 8983 protocol http and request "/solr" then restart
if 3 restarts within 5 cycles then timeout
@SammyLin
SammyLin / SassMeister-input-HTML.html
Created November 21, 2014 07:30
Generated by SassMeister.com.
<ul id="menu">
<li><a href="#">即時新聞</a>
<ul class="sub_menu">
<li><a href="#">昨天新聞</a></li>
<li><a href="#">今天新聞</a></li>
<li><a href="#">前天新聞影音多媒體</a></li>
</ul>
</li>
<li><a href="#">影音多媒體</a>
<ul class="sub_menu">