分类 Code 下的文章

Vagrant Multiple Box Config

Vagrant Multiple Box Config

随着不同框架的不同技术栈,导致一个Vagrant Box显然无法适应所有情况.所以多Box设置势在必行,Google后整理结果如下:

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

    config.vm.define "magento" do |web|
        web.vm.box = "ubuntu/xenial64"
        web.vm.hostname = 'magento'

        web.vm.network "private_network", ip: "192.168.33.11"

        web.vm.provider :virtualbox do |v|
            v.customize ["modifyvm", :id, "--memory", "2048"]
            v.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
            v.customize ['modifyvm', :id, '--natdnsproxy1', 'on']
        end
    end


    config.vm.define "php" do |php|
        php.vm.box = "ubuntu/trusty64"
        php.vm.hostname = 'php'

        php.vm.network :private_network, ip: "192.168.33.10"

        php.vm.provider :virtualbox do |v|
            v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
            v.customize ['modifyvm', :id, '--natdnsproxy1', 'on']
            v. memory = 1024 
        end
    end
    
end

感谢Scott Keck-Warren的文章,简单粗暴直接的解决问题.

展开阅读

图片处理利器 ImageMagic

图片处理利器 ImageMagic

ImageMagick is a suite of command-line utilities for modifying and working with images. ImageMagick can quickly perform operations on an image from a terminal, perform batch processing of many images, or be integrated into a bash script.

日常开发工作需要经常处理图片,作为一名程序员绝壁不能忍受GUI工具一个一个的处理,遂搜索一番,发现这货ImageMagic,果然是处理图片的神器.

开发中最需要的几个功能,更改图片尺寸,更改图片格式及批处理,命令行如下:

展开阅读