About 4Aiur

Posts by 4Aiur:

Setup development environment on OSX

Posted by 4Aiur on 2015/01/21 in MacOSX |

Setup development environment on OSX

Install Homebrew on your laptop

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install some packages you like

cat > Caskfile <<\EOF
# Install Cask
install caskroom/cask/brew-cask

# Install Casks
cask install alfred
cask install caffeine

cask install virtualbox
cask install boot2docker

cask install google-chrome
cask install iterm2
cask install sequel-pro

export HOMEBREW_CASK_OPTS="--appdir=/Applications"
brew update
brew bundle Caskfile

Initialize virtual machine

boot2docker init
boot2docker start

A demonstration for build rpm in container

cat > Dockerfile <<\EOF
FROM centos:centos6

MAINTAINER Kevin Li <mlf4aiur@gmail.com>

RUN yum clean all
RUN yum -y update && yum install -y \
    ruby-devel.x86_64 \
    ruby.x86_64 \
    rubygems.noarch \
    gcc.x86_64 \
RUN gem install fpm --no-rdoc --no-ri

VOLUME /data

CMD ["/bin/bash"]

$(boot2docker shellinit)
docker build -t mlf4aiur/fpm_rpm .

Put your package into data/ directory and run following command, then you’ll get the rpm file in you data directory.

docker run -it --rm -v `pwd`/data:/data mlf4aiur/fpm_rpm fpm \
    --verbose \
    -f \
    -s dir \
    -t rpm \
    --name hello_world \
    -v 0.9.0 \
    --config-files opt/hello_world/ \
    --exclude "*/*.pyc" \
    --depends python \


Introduction to Ansible

Posted by 4Aiur on 2014/01/31 in SysAdmin |

Introduction to Ansible Installation I don’t want input password every time when I run ansible, so prepare ssh key authentication agent for auto login. # Generate ssh public private key pair ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa ssh-agent | head -2 > ~/.ssh/.agent.env source ~/.ssh/.agent.env ssh-add ~/.ssh/id_rsa Install Ansible on a isolation environment. mkdir […]


Getting Started with Vagrant

Posted by 4Aiur on 2014/01/12 in SysAdmin |

Getting Started with Vagrant Installation Install VirtualBox or VMware first, and download the latest from Vagrant download page. Launch a instance cd ~/.vagrant.d/tmp/ wget http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130731.box vagrant box add CentOS-6.4-x86_64 CentOS-6.4-x86_64-v20130731.box mkdir -p ~/.vagrant.d/init/myvm cd ~/.vagrant.d/init/myvm vagrant init CentOS-6.4-x86_64 vagrant up vagrant ssh Provisioning # install rvm \curl -sSL https://get.rvm.io | bash -s stable source “$HOME/.rvm/scripts/rvm […]

Tags: ,

Daemon Skeleton introduction

Posted by 4Aiur on 2013/02/24 in Python |

Daemon Skeleton introduction Past couple of days, i’ve builded some daemon tools, tired to do the same thing again and again, i think i need a template, to create python project with daemon easy and fast. So created this template Daemon Skeleton. In this template i used python-daemon as the daemonizer, and did some tweak, […]

Tags: ,

Ship access log to ElasticSearch

Posted by 4Aiur on 2012/08/13 in Python |

Ship access log to ElasticSearch This article introduce how to use a custom python script to parse Apache access log and shipping it to ElasticSearch. If you wan’t store the huge log to ElasticSearch, you should read Using Elasticsearch for logs, Using some popular OpenSource software, like Graylog2, Logstash, Apache Flume. System basic setup



OpenShift Command Line Interface

Posted by 4Aiur on 2012/05/25 in Python |

OpenShift Command Line Interface Working With Domains Creating a Domain rhc domain create -n DomainName -l rhlogin -p password [OptionalParameters] Deleting a Domain rhc domain show -l rhlogin rhc app destroy -a <applicationName> -l rhlogin rhc domain destroy -n <domainName> -l rhlogin Viewing User Information rhc domain show -l rhloging Creating Applications Supported app types: […]


Deploy web.py application on OpenShift

Posted by 4Aiur on 2012/04/03 in Python |

Deploy web.py application on OpenShift Prepare environment Install OpenShift client command line tool

Generate a new SSH key

edit ~/.ssh/config

Create a Namespace

Create a application, and clone the git reposity

Write your application edit setup.py

edit wsgi/application

Commit and push your code

Bind your Domain


Tags: ,

Variable scope in subshell

Posted by 4Aiur on 2012/03/10 in Shell |

Variable scope in subshell functions

using shell run it

using bash run it


Mac OS X 贴士汇聚

Posted by 4Aiur on 2012/02/10 in MacOSX |

Mac OS X tips Find & Scan Wireless Networks from the Command Line in Mac OS X sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport airport -s Reindexing Spotlight from the Command Line Reindexing Spotlight from the command line is done with the mdutil tool, first launch Terminal and then type: sudo mdutil -E / This will reindex […]

Tags: ,

Setup Workspace On Mac OS X Lion

Posted by 4Aiur on 2012/01/19 in MacOSX |

Setup Workspace On Mac OS X Lion Software Update Click Apple () menu, choose Software Update Change System Preferences Click Apple () menu, choose System Preferences Trackpad Tap to click Scroll direction: natural Mouse Adjust Tracking Speed to max Keyboard Keyboard Shortcuts Full Keyboard Access: In windows and dialogs, press Tab to move keybiard focus […]


Copyright © 2010-2019 4Aiur All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.