Skip to content

Instantly share code, notes, and snippets.

View sonots's full-sized avatar
🤗

Naotoshi Seo sonots

🤗
View GitHub Profile
@sonots
sonots / amqp_test.rb
Created November 26, 2012 06:37
Bunny and AMQP gem
require "rubygems"
require "amqp"
EventMachine.run do
AMQP.connect(host: 'localhost', user: 'guest') do |connection|
puts "Connected to AMQP broker. Running #{AMQP::VERSION} version of the gem..."
channel = AMQP::Channel.new(connection)
channel.queue("test1", :auto_delete => true).subscribe do |payload|
@sonots
sonots / amqp_publisher.rb
Created November 26, 2012 14:25
Bunny Publisher and AMQP Subscriber
require 'rubygems'
require 'amqp'
ROUTING_KEY = "test1"
AMQP.start(:host => 'localhost') do
MQ.queue(ROUTING_KEY).publish("hello world")
# AMQP.stop { EM.stop }
end
@sonots
sonots / dotfiles.sh
Created December 8, 2012 11:02
Install .dotfiles
#!/bin/sh
[[ -e ~/.dotfiles ]] || git clone git@github.com:sonots/.dotfiles.git ~/.dotfiles
pushd ~/.dotfiles
git submodule init
git submodule update
for i in `ls -a`
do
[ $i = "." ] && continue
#!/bin/sh
# rvm-install.sh の中で curl: (60) SSL certificate problem, エラーが出るので crt ファイルを置き換える
sudo cp /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.crt.bak
sudo curl http://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt
# Install rvm
sudo yum -y install readline readline-devel
wget https://raw.github.com/wayneeseguin/rvm/stable/binscripts/rvm-installer -O /tmp/rvm-install.sh
sudo zsh /tmp/rvm-install.sh
rvm get 1.10.0
#!/bin/sh
[ -z "$version" ] && version="4.3.10"
mkdir -p ~/.src
cd ~/.src
curl -O -L --create-dirs -C - http://downloads.sourceforge.net/project/zsh/zsh-dev/$version/zsh-$version.tar.bz2?use_mirror=jaist
tar jxf zsh-$version.tar.bz2*
cd zsh-$version
./configure --prefix=/
make
sudo make install
--- lib/bundler/vendor/net/http/persistent.rb.orig212012-05-07 06:19:19.629713946 -0700
+++ lib/bundler/vendor/net/http/persistent.rb 2012-05-07 06:38:32.601764475 -0700
@@ -2,6 +2,7 @@
require 'net/http/faster'
require 'uri'
require 'cgi' # for escaping
+require 'http_configuration'
##
# Persistent connections for Net::HTTP
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
exec $SHELL -l
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
CONFIGURE_OPTS="--with-readline-dir=/usr/local/opt/readline --with-openssl-dir=/usr/local/opt/openssl" rbenv install 1.9.3-p194
rbenv rehash
#!/bin/sh
curl -kL http://install.perlbrew.pl | bash
echo '[[ -s "$HOME/perl5/perlbrew/etc/bashrc" ]] && source "$HOME/perl5/perlbrew/etc/bashrc"' >> .bashrc
source "$HOME/perl5/perlbrew/etc/bashrc"
perlbrew install perl-5.16.0
perlbrew switch perl-5.16.0
perlbrew install-cpanm
#!/bin/sh
curl -kL https://gist.github.com/raw/4664437/perlbrew-install.sh | sh
sudo yum groupinstall "Development Tools"
sudo yum install pkgconfig glib2-devel gettext libxml2-devel pango-devel cairo-devel
git clone https://github.com/kazeburo/GrowthForecast.git
cd GrowthForecast
cpanm --installdeps .
# try like
@sonots
sonots / logwatch.sh
Last active December 11, 2015 22:39
Event Drivern Shell Script :) If something is written in a log file, a processe starts.
PATH="/bin:/usr/bin:/usr/local/bin"
export PATH
FILE="/var/log/syslog"
PATTERN="warn"
SUBJECT="ALERT-LOGWATCH"
MAIL_TO="hogehoge@example.co.jp"
tail -n 1 --follow=name $FILE | while read INPUT; do
echo "$INPUT" | grep "$PATTERN" > /dev/null