About 4Aiur

Posts by 4Aiur:

Setup development environment on OSX

Posted by 4Aiur on 01/21/2015 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 

Initialize virtual machine

boot2docker init
boot2docker start

A demonstration for build rpm in container

cat > Dockerfile 

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

VOLUME /data
WORKDIR /data

CMD ["/bin/bash"]
EOF

$(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 \
    opt/hello_world

Tags:

Introduction to Ansible

Posted by 4Aiur on 01/31/2014 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 […]

Tags:

Getting Started with Vagrant

Posted by 4Aiur on 01/12/2014 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 02/24/2013 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 08/13/2012 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 # […]

Tags:

OpenShift Command Line Interface

Posted by 4Aiur on 05/25/2012 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 -l rhlogin rhc domain destroy -n -l rhlogin Viewing User Information rhc domain show -l rhloging Creating Applications Supported app types: nodejs-0.6 jbossas-7 […]

Tags:

Deploy web.py application on OpenShift

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

Deploy web.py application on OpenShift Prepare environment Install OpenShift client command line tool gem install rhc Generate a new SSH key ssh-keygen -t rsa -f ~/.ssh/rhcloud -C “your_email@youremail.com” edit ~/.ssh/config Host *.rhcloud.com IdentityFile ~/.ssh/rhcloud Create a Namespace rhc-create-domain -n namespace -a ~/.ssh/rhcloud -l rhlogin Create a application, and clone the git reposity rhc-create-app -a webpy […]

Tags: ,

Variable scope in subshell

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

Variable scope in subshell functions [mlf4aiur@4aiur Shell]$ cat function_return.sh subshell () { # pipeline will generate subshell echo 1 2 3 | while read line do echo “subshell: inside 1”; var=1; return 1 done echo “subshell: inside 0”; var=0; return 0 } subshell echo “subshell: outside return $? var=$var” foo () { for line in […]

Tags:

Mac OS X 贴士汇聚

Posted by 4Aiur on 02/10/2012 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 01/19/2012 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 […]

Tags:

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